diff options
author | jhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-26 01:51:21 +0000 |
---|---|---|
committer | jhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-26 01:51:21 +0000 |
commit | 387b71b7d1d1bf267cbe088136610959b319f3b3 (patch) | |
tree | c364e3543f8b9185f65086ef678989edd0b69966 /chrome | |
parent | ceed72954b3444d1f06468a2edc6fe41aeb8f012 (diff) | |
download | chromium_src-387b71b7d1d1bf267cbe088136610959b319f3b3.zip chromium_src-387b71b7d1d1bf267cbe088136610959b319f3b3.tar.gz chromium_src-387b71b7d1d1bf267cbe088136610959b319f3b3.tar.bz2 |
Make chrome_plugin_host.cc and chrome_plugin_util.cc compile on Posix.
Review URL: http://codereview.chromium.org/27150
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@10436 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/browser.scons | 1 | ||||
-rw-r--r-- | chrome/browser/chrome_plugin_host.cc | 39 | ||||
-rw-r--r-- | chrome/browser/dom_ui/html_dialog_contents.h | 3 | ||||
-rw-r--r-- | chrome/browser/modal_html_dialog_delegate.cc | 6 | ||||
-rw-r--r-- | chrome/browser/modal_html_dialog_delegate.h | 3 | ||||
-rw-r--r-- | chrome/browser/views/html_dialog_view.cc | 8 | ||||
-rw-r--r-- | chrome/browser/views/html_dialog_view.h | 3 | ||||
-rw-r--r-- | chrome/chrome.xcodeproj/project.pbxproj | 4 | ||||
-rw-r--r-- | chrome/common/chrome_plugin_util.cc | 14 | ||||
-rw-r--r-- | chrome/common/chrome_plugin_util.h | 2 | ||||
-rw-r--r-- | chrome/common/common.scons | 1 | ||||
-rw-r--r-- | chrome/common/temp_scaffolding_stubs.cc | 19 | ||||
-rw-r--r-- | chrome/common/temp_scaffolding_stubs.h | 10 |
13 files changed, 64 insertions, 49 deletions
diff --git a/chrome/browser/browser.scons b/chrome/browser/browser.scons index 9be39b9..bb29c42 100644 --- a/chrome/browser/browser.scons +++ b/chrome/browser/browser.scons @@ -668,7 +668,6 @@ if not env.Bit('windows'): 'automation/ui_controls.cc', 'browser_accessibility.cc', 'browser_accessibility_manager.cc', - 'chrome_plugin_host.cc', 'dock_info.cc', 'dom_ui/html_dialog_contents.cc', 'download/download_exe.cc', diff --git a/chrome/browser/chrome_plugin_host.cc b/chrome/browser/chrome_plugin_host.cc index 761be8e..ed801e6 100644 --- a/chrome/browser/chrome_plugin_host.cc +++ b/chrome/browser/chrome_plugin_host.cc @@ -6,6 +6,7 @@ #include <set> +#include "base/basictypes.h" #include "base/command_line.h" #include "base/file_util.h" #include "base/gfx/png_encoder.h" @@ -18,7 +19,6 @@ #include "chrome/browser/browser_list.h" #include "chrome/browser/chrome_plugin_browsing_context.h" #include "chrome/browser/chrome_thread.h" -#include "chrome/browser/dom_ui/html_dialog_contents.h" #include "chrome/browser/gears_integration.h" #include "chrome/browser/plugin_process_host.h" #include "chrome/browser/plugin_service.h" @@ -33,7 +33,6 @@ #include "chrome/common/gears_api.h" #include "chrome/common/notification_service.h" #include "chrome/common/net/url_request_intercept_job.h" -#include "chrome/common/plugin_messages.h" #include "chrome/common/render_messages.h" #include "net/base/base64.h" #include "net/base/cookie_monster.h" @@ -41,6 +40,14 @@ #include "net/url_request/url_request_error_job.h" #include "skia/include/SkBitmap.h" +// TODO(port): Port these files. +#if defined(OS_WIN) +#include "chrome/browser/dom_ui/html_dialog_contents.h" +#include "chrome/common/plugin_messages.h" +#else +#include "chrome/common/temp_scaffolding_stubs.h" +#endif + using base::TimeDelta; // This class manages the interception of network requests. It queries the @@ -283,12 +290,12 @@ class ModelessHtmlDialogDelegate : public HtmlDialogContentsDelegate { void* plugin_context, ChromePluginLib* plugin, MessageLoop* main_message_loop, - HWND parent_hwnd) - : plugin_(plugin), - plugin_context_(plugin_context), - main_message_loop_(main_message_loop), + gfx::NativeWindow parent_wnd) + : main_message_loop_(main_message_loop), io_message_loop_(MessageLoop::current()), - parent_hwnd_(parent_hwnd) { + plugin_(plugin), + plugin_context_(plugin_context), + parent_wnd_(parent_wnd) { DCHECK(ChromePluginLib::IsPluginThread()); params_.url = url; params_.height = height; @@ -308,9 +315,9 @@ class ModelessHtmlDialogDelegate : public HtmlDialogContentsDelegate { virtual bool IsDialogModal() const { return false; } virtual std::wstring GetDialogTitle() const { return L"Google Gears"; } virtual GURL GetDialogContentURL() const { return params_.url; } - virtual void GetDialogSize(CSize* size) const { - size->cx = params_.width; - size->cy = params_.height; + virtual void GetDialogSize(gfx::Size* size) const { + size->set_width(params_.width); + size->set_height(params_.height); } virtual std::string GetDialogArgs() const { return params_.json_input; } virtual void OnDialogClosed(const std::string& json_retval) { @@ -323,7 +330,7 @@ class ModelessHtmlDialogDelegate : public HtmlDialogContentsDelegate { void Show() { DCHECK(MessageLoop::current() == main_message_loop_); Browser* browser = BrowserList::GetLastActive(); - browser->ShowHtmlDialog(this, parent_hwnd_); + browser->ShowHtmlDialog(this, parent_wnd_); } // Gives the JSON result string back to the plugin. @@ -352,16 +359,18 @@ class ModelessHtmlDialogDelegate : public HtmlDialogContentsDelegate { // The window this dialog box should be parented to, or NULL for the last // active browser window. - HWND parent_hwnd_; + gfx::NativeWindow parent_wnd_; DISALLOW_EVIL_CONSTRUCTORS(ModelessHtmlDialogDelegate); }; // Allows InvokeLater without adding refcounting. The object is only deleted // when its last InvokeLater is run anyway. +template<> void RunnableMethodTraits<ModelessHtmlDialogDelegate>::RetainCallee( ModelessHtmlDialogDelegate* remover) { } +template<> void RunnableMethodTraits<ModelessHtmlDialogDelegate>::ReleaseCallee( ModelessHtmlDialogDelegate* remover) { } @@ -576,6 +585,7 @@ CPError STDCALL CPB_CreateRequest(CPID id, CPBrowsingContext context, ScopableCPRequest* cprequest = new ScopableCPRequest(url, method, context); PluginRequestHandler* handler = new PluginRequestHandler(plugin, cprequest); + CHECK(handler); *request = cprequest; return CPERR_SUCCESS; @@ -700,8 +710,13 @@ CPError STDCALL CPB_SendMessage(CPID id, const void *data, uint32 data_len) { const unsigned char* data_ptr = static_cast<const unsigned char*>(data); std::vector<uint8> v(data_ptr, data_ptr + data_len); +#if defined(OS_WIN) if (!host->Send(new PluginProcessMsg_PluginMessage(v))) return CPERR_FAILURE; +#else + // TODO(port): Implement PluginProcessMsg. + NOTIMPLEMENTED(); +#endif return CPERR_SUCCESS; } diff --git a/chrome/browser/dom_ui/html_dialog_contents.h b/chrome/browser/dom_ui/html_dialog_contents.h index ff31002..c047622 100644 --- a/chrome/browser/dom_ui/html_dialog_contents.h +++ b/chrome/browser/dom_ui/html_dialog_contents.h @@ -5,6 +5,7 @@ #ifndef CHROME_BROWSER_DOM_UI_HTML_DIALOG_CONTENTS_H__ #define CHROME_BROWSER_DOM_UI_HTML_DIALOG_CONTENTS_H__ +#include "base/gfx/size.h" #include "chrome/browser/dom_ui/dom_ui_host.h" // Implement this class to receive notifications. @@ -17,7 +18,7 @@ class HtmlDialogContentsDelegate { // Get the HTML file path for the content to load in the dialog. virtual GURL GetDialogContentURL() const = 0; // Get the size of the dialog. - virtual void GetDialogSize(CSize* size) const = 0; + virtual void GetDialogSize(gfx::Size* size) const = 0; // Gets the JSON string input to use when showing the dialog. virtual std::string GetDialogArgs() const = 0; // A callback to notify the delegate that the dialog closed. diff --git a/chrome/browser/modal_html_dialog_delegate.cc b/chrome/browser/modal_html_dialog_delegate.cc index 5148c38..68d364c 100644 --- a/chrome/browser/modal_html_dialog_delegate.cc +++ b/chrome/browser/modal_html_dialog_delegate.cc @@ -45,9 +45,9 @@ GURL ModalHtmlDialogDelegate::GetDialogContentURL() const { return params_.url; } -void ModalHtmlDialogDelegate::GetDialogSize(CSize* size) const { - size->cx = params_.width; - size->cy = params_.height; +void ModalHtmlDialogDelegate::GetDialogSize(gfx::Size* size) const { + size->set_width(params_.width); + size->set_height(params_.height); } std::string ModalHtmlDialogDelegate::GetDialogArgs() const { diff --git a/chrome/browser/modal_html_dialog_delegate.h b/chrome/browser/modal_html_dialog_delegate.h index a5f5670..a2bca1c 100644 --- a/chrome/browser/modal_html_dialog_delegate.h +++ b/chrome/browser/modal_html_dialog_delegate.h @@ -7,6 +7,7 @@ #include <vector> +#include "base/gfx/size.h" #include "chrome/browser/dom_ui/html_dialog_contents.h" #include "chrome/common/notification_observer.h" @@ -31,7 +32,7 @@ class ModalHtmlDialogDelegate virtual bool IsDialogModal() const; virtual std::wstring GetDialogTitle() const { return L"Google Gears"; } virtual GURL GetDialogContentURL() const; - virtual void GetDialogSize(CSize* size) const; + virtual void GetDialogSize(gfx::Size* size) const; virtual std::string GetDialogArgs() const; virtual void OnDialogClosed(const std::string& json_retval); diff --git a/chrome/browser/views/html_dialog_view.cc b/chrome/browser/views/html_dialog_view.cc index 0ef3b9e..76281f3 100644 --- a/chrome/browser/views/html_dialog_view.cc +++ b/chrome/browser/views/html_dialog_view.cc @@ -29,9 +29,9 @@ HtmlDialogView::~HtmlDialogView() { // HtmlDialogView, views::View implementation: gfx::Size HtmlDialogView::GetPreferredSize() { - CSize out; + gfx::Size out; delegate_->GetDialogSize(&out); - return gfx::Size(out.cx, out.cy); + return out; } //////////////////////////////////////////////////////////////////////////////// @@ -80,8 +80,8 @@ GURL HtmlDialogView::GetDialogContentURL() const { return delegate_->GetDialogContentURL(); } -void HtmlDialogView::GetDialogSize(CSize* size) const { - return delegate_->GetDialogSize(size); +void HtmlDialogView::GetDialogSize(gfx::Size* size) const { + delegate_->GetDialogSize(size); } std::string HtmlDialogView::GetDialogArgs() const { diff --git a/chrome/browser/views/html_dialog_view.h b/chrome/browser/views/html_dialog_view.h index 6a4e144..e03997f 100644 --- a/chrome/browser/views/html_dialog_view.h +++ b/chrome/browser/views/html_dialog_view.h @@ -7,6 +7,7 @@ #include <string> +#include "base/gfx/size.h" #include "chrome/browser/dom_ui/html_dialog_contents.h" #include "chrome/browser/tab_contents/tab_contents_delegate.h" #include "chrome/browser/views/dom_view.h" @@ -55,7 +56,7 @@ class HtmlDialogView virtual bool IsDialogModal() const; virtual std::wstring GetDialogTitle() const; virtual GURL GetDialogContentURL() const; - virtual void GetDialogSize(CSize* size) const; + virtual void GetDialogSize(gfx::Size* size) const; virtual std::string GetDialogArgs() const; virtual void OnDialogClosed(const std::string& json_retval); diff --git a/chrome/chrome.xcodeproj/project.pbxproj b/chrome/chrome.xcodeproj/project.pbxproj index 0cc3587..4e0c5b7 100644 --- a/chrome/chrome.xcodeproj/project.pbxproj +++ b/chrome/chrome.xcodeproj/project.pbxproj @@ -75,6 +75,7 @@ /* End PBXAggregateTarget section */ /* Begin PBXBuildFile section */ + 00DB1C89F45A2D08B3CB5806 /* chrome_plugin_host.cc in Sources */ = {isa = PBXBuildFile; fileRef = 4D7BF85D0E9D4839009A6919 /* chrome_plugin_host.cc */; }; 0A124E6F8B659427ABF96220 /* plugin_service.cc in Sources */ = {isa = PBXBuildFile; fileRef = 4D7BF8E00E9D4839009A6919 /* plugin_service.cc */; }; 0A32377E82932F703AA3120A /* download_request_manager.cc in Sources */ = {isa = PBXBuildFile; fileRef = 4D640D1F0EAE881300EBCFC0 /* download_request_manager.cc */; }; 0D71821EDDA2629232DE3AD9 /* safe_browsing_blocking_page.cc in Sources */ = {isa = PBXBuildFile; fileRef = 4D7BFADB0E9D49DE009A6919 /* safe_browsing_blocking_page.cc */; }; @@ -89,6 +90,7 @@ 261AA15DB2FF0FA9B0E63ACF /* automation_provider.cc in Sources */ = {isa = PBXBuildFile; fileRef = E48FB9640EC4EA270052B72B /* automation_provider.cc */; }; 2760C4346D6AB3AD94E9CF05 /* url_fixer_upper.cc in Sources */ = {isa = PBXBuildFile; fileRef = B5D16EF40F2145C600861FAC /* url_fixer_upper.cc */; }; 28283DBE4B6DB2B0F9893676 /* dns_master.cc in Sources */ = {isa = PBXBuildFile; fileRef = 4D7BFA6D0E9D4981009A6919 /* dns_master.cc */; }; + 2D70E0E2053C6C759EC97929 /* chrome_plugin_util.cc in Sources */ = {isa = PBXBuildFile; fileRef = 4D7BFB950E9D4C9F009A6919 /* chrome_plugin_util.cc */; }; 2DF2A9EB8AF96926EE9B6B02 /* ipc_logging.cc in Sources */ = {isa = PBXBuildFile; fileRef = 4D7BFBAE0E9D4C9F009A6919 /* ipc_logging.cc */; }; 3257B6150A16A88F55E5AE34 /* bookmark_drop_info.cc in Sources */ = {isa = PBXBuildFile; fileRef = 12F137DA942221A44BFA0967 /* bookmark_drop_info.cc */; }; 331218220F3BFF32006CB2B0 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 331B93A90F3BF2B9008B1C46 /* QuartzCore.framework */; }; @@ -5680,6 +5682,7 @@ 6A3646C882BD4CC722624544 /* character_encoding.cc in Sources */, 651621527E9FCD7FB5AF2E14 /* child_process_host.cc in Sources */, E43A770D0F16610300ABD5D1 /* chrome_plugin_browsing_context.cc in Sources */, + 00DB1C89F45A2D08B3CB5806 /* chrome_plugin_host.cc in Sources */, 4D7BF9920E9D485F009A6919 /* chrome_thread.cc in Sources */, E43A771C0F1661AF00ABD5D1 /* chrome_url_data_manager.cc in Sources */, E43A77110F16613700ABD5D1 /* chrome_url_request_context.cc in Sources */, @@ -5930,6 +5933,7 @@ E4BD55490F55AE6900591DFA /* chrome_font_mac.mm in Sources */, E4F3256E0EE82C83002533CE /* chrome_paths.cc in Sources */, 4D175916B2FC058793051209 /* chrome_paths_mac.cc in Sources */, + 2D70E0E2053C6C759EC97929 /* chrome_plugin_util.cc in Sources */, 4D7BFC2C0E9D4CF1009A6919 /* chrome_switches.cc in Sources */, 4D7BFCC90E9D4D72009A6919 /* color_utils.cc in Sources */, B562E2C70F0582F800FB1A4F /* common_glue.cc in Sources */, diff --git a/chrome/common/chrome_plugin_util.cc b/chrome/common/chrome_plugin_util.cc index e7a2ed0..922c837 100644 --- a/chrome/common/chrome_plugin_util.cc +++ b/chrome/common/chrome_plugin_util.cc @@ -22,8 +22,13 @@ ScopableCPRequest::ScopableCPRequest(const char* u, const char* m, CPBrowsingContext c) { pdata = NULL; data = NULL; +#if defined(OS_WIN) url = _strdup(u); method = _strdup(m); +#else + url = strdup(u); + method = strdup(m); +#endif context = c; } @@ -94,7 +99,7 @@ uint32 PluginResponseUtils::CPLoadFlagsToNetFlags(uint32 flags) { int PluginResponseUtils::GetResponseInfo( const net::HttpResponseHeaders* response_headers, - CPResponseInfoType type, void* buf, uint32 buf_size) { + CPResponseInfoType type, void* buf, size_t buf_size) { if (!response_headers) return CPERR_FAILURE; @@ -129,11 +134,10 @@ CPError CPB_GetCommandLineArgumentsCommon(const char* url, std::wstring user_data_dir = cmd.GetSwitchValue(switches::kUserDataDir); if (!user_data_dir.empty()) { // Make sure user_data_dir is an absolute path. - wchar_t user_data_dir_full[MAX_PATH]; - if (_wfullpath(user_data_dir_full, user_data_dir.c_str(), MAX_PATH) && - file_util::PathExists(user_data_dir_full)) { + if (file_util::AbsolutePath(&user_data_dir) && + file_util::PathExists(user_data_dir)) { arguments_w += std::wstring(L"--") + switches::kUserDataDir + - L'=' + user_data_dir_full; + L'=' + user_data_dir; } } diff --git a/chrome/common/chrome_plugin_util.h b/chrome/common/chrome_plugin_util.h index 07f99e4..ef0b982 100644 --- a/chrome/common/chrome_plugin_util.h +++ b/chrome/common/chrome_plugin_util.h @@ -64,7 +64,7 @@ public: // Common implementation of a CPR_GetResponseInfo call. static int GetResponseInfo( const net::HttpResponseHeaders* response_headers, - CPResponseInfoType type, void* buf, uint32 buf_size); + CPResponseInfoType type, void* buf, size_t buf_size); }; // Helper to allocate a string using the given CPB_Alloc function. diff --git a/chrome/common/common.scons b/chrome/common/common.scons index 617c4c1..bd94858 100644 --- a/chrome/common/common.scons +++ b/chrome/common/common.scons @@ -232,7 +232,6 @@ if not env.Bit('windows'): # TODO(port): Port these. input_files.Remove( - 'chrome_plugin_util.cc', 'chrome_process_filter.cc', 'drag_drop_types.cc', 'gfx/emf.cc', diff --git a/chrome/common/temp_scaffolding_stubs.cc b/chrome/common/temp_scaffolding_stubs.cc index baaf839..47789bb 100644 --- a/chrome/common/temp_scaffolding_stubs.cc +++ b/chrome/common/temp_scaffolding_stubs.cc @@ -246,11 +246,6 @@ bool IsPluginProcess() { //-------------------------------------------------------------------------- -// This is from chrome_plugin_util.cc. -void CPB_Free(void* memory) { NOTIMPLEMENTED(); } - -//-------------------------------------------------------------------------- - void RunJavascriptMessageBox(WebContents* web_contents, int dialog_flags, const std::wstring& message_text, @@ -352,10 +347,6 @@ void DebuggerShell::ProcessCommand(const std::wstring& data) { } #endif // !CHROME_DEBUGGER_DISABLED -ScopableCPRequest::~ScopableCPRequest() { - NOTIMPLEMENTED(); -} - MemoryDetails::MemoryDetails() { NOTIMPLEMENTED(); } @@ -379,21 +370,11 @@ InfoBar* LinkInfoBarDelegate::CreateInfoBar() { return NULL; } -void CPHandleCommand(int command, CPCommandInterface* data, - CPBrowsingContext context) { - NOTIMPLEMENTED(); -} - bool CanImportURL(const GURL& url) { NOTIMPLEMENTED(); return false; } -CPBrowserFuncs* GetCPBrowserFuncsForBrowser() { - NOTIMPLEMENTED(); - return NULL; -} - DownloadRequestDialogDelegate* DownloadRequestDialogDelegate::Create( TabContents* tab, DownloadRequestManager::TabDownloadState* host) { diff --git a/chrome/common/temp_scaffolding_stubs.h b/chrome/common/temp_scaffolding_stubs.h index 3fbd2a1..ba7d9b5 100644 --- a/chrome/common/temp_scaffolding_stubs.h +++ b/chrome/common/temp_scaffolding_stubs.h @@ -629,6 +629,16 @@ class ModalHtmlDialogDelegate : public HtmlDialogContentsDelegate { IPC::Message*, WebContents*) { } }; +class HtmlDialogContents { + public: + struct HtmlDialogParams { + GURL url; + int width; + int height; + std::string json_input; + }; +}; + class CharacterEncoding { public: static std::wstring GetCanonicalEncodingNameByAliasName( |