From 9a3f8123c421faae8b4573c895a7b1c0ef236205 Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Tue, 7 Apr 2015 15:35:48 -0700 Subject: Merge to XFA: Fix (nearly all) IWYU in fpdfskd/include/javascript/ headers. Original Review URL: https://codereview.chromium.org/1060133002 TBR=thestig@chromium.org Review URL: https://codereview.chromium.org/1065103002 --- fpdfsdk/include/javascript/Consts.h | 2 ++ fpdfsdk/include/javascript/Document.h | 2 +- fpdfsdk/include/javascript/Field.h | 5 +++ fpdfsdk/include/javascript/Icon.h | 7 ++--- fpdfsdk/include/javascript/JS_Context.h | 4 +++ fpdfsdk/include/javascript/JS_Define.h | 4 --- fpdfsdk/include/javascript/JS_EventHandler.h | 7 +++++ fpdfsdk/include/javascript/JS_GlobalData.h | 5 +-- fpdfsdk/include/javascript/JS_Module.h | 47 ---------------------------- fpdfsdk/include/javascript/JS_Object.h | 1 + fpdfsdk/include/javascript/JS_Runtime.h | 7 +++++ fpdfsdk/include/javascript/JS_Value.h | 3 ++ fpdfsdk/include/javascript/PublicMethods.h | 2 ++ fpdfsdk/include/javascript/app.h | 2 ++ fpdfsdk/include/javascript/color.h | 3 ++ fpdfsdk/include/javascript/console.h | 2 ++ fpdfsdk/include/javascript/event.h | 2 ++ fpdfsdk/include/javascript/global.h | 4 +++ fpdfsdk/include/javascript/report.h | 2 ++ fpdfsdk/include/javascript/util.h | 4 +++ fpdfsdk/include/jsapi/fxjs_v8.h | 7 +++++ 21 files changed, 64 insertions(+), 58 deletions(-) delete mode 100644 fpdfsdk/include/javascript/JS_Module.h (limited to 'fpdfsdk/include') diff --git a/fpdfsdk/include/javascript/Consts.h b/fpdfsdk/include/javascript/Consts.h index c3a954efa6..5d1906428c 100644 --- a/fpdfsdk/include/javascript/Consts.h +++ b/fpdfsdk/include/javascript/Consts.h @@ -7,6 +7,8 @@ #ifndef _CONSTS_H_ #define _CONSTS_H_ +#include "JS_Define.h" + /* ------------------------------ border ------------------------------ */ class CJS_Border : public CJS_Object diff --git a/fpdfsdk/include/javascript/Document.h b/fpdfsdk/include/javascript/Document.h index 8aa53fe7f7..0824185aa3 100644 --- a/fpdfsdk/include/javascript/Document.h +++ b/fpdfsdk/include/javascript/Document.h @@ -7,7 +7,7 @@ #ifndef _DOCUMENT_H_ #define _DOCUMENT_H_ - +#include "JS_Define.h" class PrintParamsObj : public CJS_EmbedObj { diff --git a/fpdfsdk/include/javascript/Field.h b/fpdfsdk/include/javascript/Field.h index ba834b961e..f9e5e49f9e 100644 --- a/fpdfsdk/include/javascript/Field.h +++ b/fpdfsdk/include/javascript/Field.h @@ -7,6 +7,11 @@ #ifndef _FIELD_H_ #define _FIELD_H_ +#include // For std::wstring. + +// TODO(tsepez): include PWL_Wnd.h for PWL_Color after fixing its IWYU. +#include "JS_Define.h" + class Document; enum FIELD_PROP diff --git a/fpdfsdk/include/javascript/Icon.h b/fpdfsdk/include/javascript/Icon.h index e07ae8e89b..097917a5e5 100644 --- a/fpdfsdk/include/javascript/Icon.h +++ b/fpdfsdk/include/javascript/Icon.h @@ -7,20 +7,19 @@ #ifndef _ICON_H_ #define _ICON_H_ +#include "JS_Define.h" + class Icon : public CJS_EmbedObj { public: Icon(CJS_Object* pJSObject); virtual ~Icon(); - -public: FX_BOOL name(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); - -public: void SetStream(CPDF_Stream* pIconStream); CPDF_Stream* GetStream(); void SetIconName(CFX_WideString name); CFX_WideString GetIconName(); + private: CPDF_Stream* m_pIconStream; CFX_WideString m_swIconName; diff --git a/fpdfsdk/include/javascript/JS_Context.h b/fpdfsdk/include/javascript/JS_Context.h index adb28cdaed..b35ba3b4b2 100644 --- a/fpdfsdk/include/javascript/JS_Context.h +++ b/fpdfsdk/include/javascript/JS_Context.h @@ -7,6 +7,10 @@ #ifndef _JS_CONTEXT_H_ #define _JS_CONTEXT_H_ +#include "../../../core/include/fxcrt/fx_system.h" +#include "../../../core/include/fxcrt/fx_string.h" +#include "IJavaScript.h" + class CJS_EventHandler; class CJS_Runtime; diff --git a/fpdfsdk/include/javascript/JS_Define.h b/fpdfsdk/include/javascript/JS_Define.h index 2213ff9e39..7175ece367 100644 --- a/fpdfsdk/include/javascript/JS_Define.h +++ b/fpdfsdk/include/javascript/JS_Define.h @@ -10,10 +10,6 @@ #include "../jsapi/fxjs_v8.h" #include "resource.h" -typedef v8::Value JSValue; -typedef v8::Handle JSObject; -typedef v8::Handle JSFXObject; - #include "JS_Object.h" #include "JS_Value.h" diff --git a/fpdfsdk/include/javascript/JS_EventHandler.h b/fpdfsdk/include/javascript/JS_EventHandler.h index d16933aeef..a6736d319b 100644 --- a/fpdfsdk/include/javascript/JS_EventHandler.h +++ b/fpdfsdk/include/javascript/JS_EventHandler.h @@ -7,7 +7,14 @@ #ifndef _JS_EVENTHANDLER_H_ #define _JS_EVENTHANDLER_H_ +#include "../../../core/include/fxcrt/fx_string.h" +#include "../../../core/include/fxcrt/fx_system.h" + class CJS_Context; +class CPDFSDK_Annot; +class CPDFSDK_Document; +class CPDF_Bookmark; +class CPDF_FormField; class Field; enum JS_EVENT_T diff --git a/fpdfsdk/include/javascript/JS_GlobalData.h b/fpdfsdk/include/javascript/JS_GlobalData.h index c54d7b550d..b21a360820 100644 --- a/fpdfsdk/include/javascript/JS_GlobalData.h +++ b/fpdfsdk/include/javascript/JS_GlobalData.h @@ -7,6 +7,8 @@ #ifndef _JS_GLOBALDATA_H_ #define _JS_GLOBALDATA_H_ +#include "../../../core/include/fxcrt/fx_basic.h" + #define JS_GLOBALDATA_TYPE_NUMBER 0 #define JS_GLOBALDATA_TYPE_BOOLEAN 1 #define JS_GLOBALDATA_TYPE_STRING 2 @@ -14,8 +16,7 @@ #define JS_GLOBALDATA_TYPE_NULL 4 class CJS_KeyValue; -class CJS_GlobalVariableArray; -class CJS_GlobalData_Element; +class CPDFDoc_Environment; class CJS_GlobalVariableArray { diff --git a/fpdfsdk/include/javascript/JS_Module.h b/fpdfsdk/include/javascript/JS_Module.h deleted file mode 100644 index 1fcb583a9d..0000000000 --- a/fpdfsdk/include/javascript/JS_Module.h +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2014 PDFium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com - -#ifndef _JS_MODULE_H_ -#define _JS_MODULE_H_ - -class CJS_GlobalData; -class CJS_ConsoleDlg; - -class CJS_Module : public IReader_Module -{ -public: - CJS_Module(HMODULE hModule, CReader_App* pApp); - virtual ~CJS_Module(); - - virtual void Destroy(){delete this;} - virtual CFX_ByteString GetModuleName(); - -public: - static CJS_Module* GetModule(CReader_App* pApp); - - IFXJS_Runtime* NewJSRuntime(); - CJS_GlobalData* NewGlobalData(); - void ReleaseGlobalData(); - -public: - //console - void ShowConsole(); - void HideConsole(); - void ClearConsole(); - void PrintLineConsole(FX_LPCWSTR string); - -private: - HMODULE m_hModule; - CReader_App* m_pApp; - - FX_BOOL m_bInitial; - CJS_GlobalData* m_pGlobalData; - FX_INT32 m_nGlobalDataCount; - - CJS_ConsoleDlg* m_pConsole; -}; - -#endif //_JS_MODULE_H_ \ No newline at end of file diff --git a/fpdfsdk/include/javascript/JS_Object.h b/fpdfsdk/include/javascript/JS_Object.h index f30bc17ce6..74af9ba12d 100644 --- a/fpdfsdk/include/javascript/JS_Object.h +++ b/fpdfsdk/include/javascript/JS_Object.h @@ -10,6 +10,7 @@ #include "../fsdk_define.h" // For FX_UINT #include "../fsdk_mgr.h" // For CPDFDoc_Environment #include "../fx_systemhandler.h" // For IFX_SystemHandler +#include "../jsapi/fxjs_v8.h" class CPDFSDK_PageView; class CJS_Object; diff --git a/fpdfsdk/include/javascript/JS_Runtime.h b/fpdfsdk/include/javascript/JS_Runtime.h index 96f00bbbb1..86d49713a8 100644 --- a/fpdfsdk/include/javascript/JS_Runtime.h +++ b/fpdfsdk/include/javascript/JS_Runtime.h @@ -7,6 +7,13 @@ #ifndef _JS_RUNTIME_H_ #define _JS_RUNTIME_H_ +#include "../../../core/include/fxcrt/fx_basic.h" +#include "../jsapi/fxjs_v8.h" +#include "IJavaScript.h" +#include "JS_EventHandler.h" + +class CJS_Context; + class CJS_FieldEvent { public: diff --git a/fpdfsdk/include/javascript/JS_Value.h b/fpdfsdk/include/javascript/JS_Value.h index 165898cf33..1431349552 100644 --- a/fpdfsdk/include/javascript/JS_Value.h +++ b/fpdfsdk/include/javascript/JS_Value.h @@ -7,6 +7,9 @@ #ifndef _JS_VALUE_H_ #define _JS_VALUE_H_ +#include "../jsapi/fxjs_v8.h" +#include "../../../core/include/fxcrt/fx_basic.h" + class CJS_Array; class CJS_Date; class CJS_Document; diff --git a/fpdfsdk/include/javascript/PublicMethods.h b/fpdfsdk/include/javascript/PublicMethods.h index 1decb6f0de..e7a4010016 100644 --- a/fpdfsdk/include/javascript/PublicMethods.h +++ b/fpdfsdk/include/javascript/PublicMethods.h @@ -7,6 +7,8 @@ #ifndef _PUBLICMETHODS_H_ #define _PUBLICMETHODS_H_ +#include "JS_Define.h" + class CJS_PublicMethods : public CJS_Object { public: diff --git a/fpdfsdk/include/javascript/app.h b/fpdfsdk/include/javascript/app.h index 3acbb81a0e..a515df4770 100644 --- a/fpdfsdk/include/javascript/app.h +++ b/fpdfsdk/include/javascript/app.h @@ -7,6 +7,8 @@ #ifndef _APP_H_ #define _APP_H_ +#include "JS_Define.h" + class CJS_Runtime; /* ---------------------------- TimerObj ---------------------------- */ diff --git a/fpdfsdk/include/javascript/color.h b/fpdfsdk/include/javascript/color.h index d042a677e3..6eeb37be7e 100644 --- a/fpdfsdk/include/javascript/color.h +++ b/fpdfsdk/include/javascript/color.h @@ -7,6 +7,9 @@ #ifndef _COLOR_H_ #define _COLOR_H_ +#include "JS_Define.h" +// TODO(tsepez): include CPWL_Color.h once its own IWYU is fixed. + class color : public CJS_EmbedObj { public: diff --git a/fpdfsdk/include/javascript/console.h b/fpdfsdk/include/javascript/console.h index 336ba08a0e..60326aaf8b 100644 --- a/fpdfsdk/include/javascript/console.h +++ b/fpdfsdk/include/javascript/console.h @@ -7,6 +7,8 @@ #ifndef _CONSOLE_H_ #define _CONSOLE_H_ +#include "JS_Define.h" + class console : public CJS_EmbedObj { public: diff --git a/fpdfsdk/include/javascript/event.h b/fpdfsdk/include/javascript/event.h index 94b4124bba..b3418c2b71 100644 --- a/fpdfsdk/include/javascript/event.h +++ b/fpdfsdk/include/javascript/event.h @@ -7,6 +7,8 @@ #ifndef _EVENT_H_ #define _EVENT_H_ +#include "JS_Define.h" + class event : public CJS_EmbedObj { public: diff --git a/fpdfsdk/include/javascript/global.h b/fpdfsdk/include/javascript/global.h index b7e6e512bf..9ee9f42b42 100644 --- a/fpdfsdk/include/javascript/global.h +++ b/fpdfsdk/include/javascript/global.h @@ -7,7 +7,11 @@ #ifndef _GLOBAL_H_ #define _GLOBAL_H_ +#include "JS_Define.h" + class CJS_GlobalData; +class CJS_GlobalVariableArray; +class CJS_KeyValue; struct js_global_data { diff --git a/fpdfsdk/include/javascript/report.h b/fpdfsdk/include/javascript/report.h index 822250e63d..05e7ddd803 100644 --- a/fpdfsdk/include/javascript/report.h +++ b/fpdfsdk/include/javascript/report.h @@ -7,6 +7,8 @@ #ifndef _REPORT_H_ #define _REPORT_H_ +#include "JS_Define.h" + class Report : public CJS_EmbedObj { public: diff --git a/fpdfsdk/include/javascript/util.h b/fpdfsdk/include/javascript/util.h index 72473d0113..7601f7a4e5 100644 --- a/fpdfsdk/include/javascript/util.h +++ b/fpdfsdk/include/javascript/util.h @@ -7,6 +7,10 @@ #ifndef _UTIL_H_ #define _UTIL_H_ +#include // For std::wstring. + +#include "JS_Define.h" + class util : public CJS_EmbedObj { public: diff --git a/fpdfsdk/include/jsapi/fxjs_v8.h b/fpdfsdk/include/jsapi/fxjs_v8.h index 70653c5d83..739fd2d4c0 100644 --- a/fpdfsdk/include/jsapi/fxjs_v8.h +++ b/fpdfsdk/include/jsapi/fxjs_v8.h @@ -4,12 +4,19 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com +// PDFium wrapper around V8 APIs. PDFium code should include this file rather +// than including V8 headers directly. + #ifndef FXJSAPI_H #define FXJSAPI_H #include #include "../../../core/include/fxcrt/fx_string.h" // For CFX_WideString +typedef v8::Value JSValue; +typedef v8::Handle JSObject; +typedef v8::Handle JSFXObject; + enum FXJSOBJTYPE { JS_DYNAMIC = 0, -- cgit v1.2.3