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/browser | |
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/browser')
-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 |
7 files changed, 40 insertions, 23 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); |