diff options
42 files changed, 1112 insertions, 545 deletions
diff --git a/app/app_base.gypi b/app/app_base.gypi index dad6f9e..3715498 100644 --- a/app/app_base.gypi +++ b/app/app_base.gypi @@ -130,6 +130,7 @@ 'gfx/gl/gl_context_mac.cc', 'gfx/gl/gl_context_osmesa.cc', 'gfx/gl/gl_context_osmesa.h', + 'gfx/gl/gl_context_stub.cc', 'gfx/gl/gl_context_stub.h', 'gfx/gl/gl_context_win.cc', 'gfx/gl/gl_headers.h', diff --git a/app/gfx/gl/gl_context_stub.cc b/app/gfx/gl/gl_context_stub.cc new file mode 100644 index 0000000..62825c7 --- /dev/null +++ b/app/gfx/gl/gl_context_stub.cc @@ -0,0 +1,39 @@ +// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "app/gfx/gl/gl_context_stub.h" + +namespace gfx { + +StubGLContext::~StubGLContext() {} + +bool StubGLContext::MakeCurrent() { + return true; +} + +bool StubGLContext::IsCurrent() { + return true; +} + +bool StubGLContext::IsOffscreen() { + return false; +} + +bool StubGLContext::SwapBuffers() { + return true; +} + +gfx::Size StubGLContext::GetSize() { + return size_; +} + +void* StubGLContext::GetHandle() { + return NULL; +} + +std::string StubGLContext::GetExtensions() { + return std::string(); +} + +} // namespace gfx diff --git a/app/gfx/gl/gl_context_stub.h b/app/gfx/gl/gl_context_stub.h index 0037044..d4a1e18 100644 --- a/app/gfx/gl/gl_context_stub.h +++ b/app/gfx/gl/gl_context_stub.h @@ -15,16 +15,18 @@ namespace gfx { // A GLContext that does nothing for unit tests. class StubGLContext : public gfx::GLContext { public: + virtual ~StubGLContext(); + // Implement GLContext. virtual void Destroy() {} - virtual bool MakeCurrent() { return true; } - virtual bool IsCurrent() { return true; } - virtual bool IsOffscreen() { return false; } - virtual bool SwapBuffers() { return true; } - virtual gfx::Size GetSize() { return size_; } - virtual void* GetHandle() { return NULL; } + virtual bool MakeCurrent(); + virtual bool IsCurrent(); + virtual bool IsOffscreen(); + virtual bool SwapBuffers(); + virtual gfx::Size GetSize(); + virtual void* GetHandle(); virtual void SetSwapInterval(int interval) {} - virtual std::string GetExtensions() { return std::string(); } + virtual std::string GetExtensions(); void SetSize(const gfx::Size& size) { size_ = size; } diff --git a/app/gfx/gl/gl_implementation_linux.cc b/app/gfx/gl/gl_implementation_linux.cc index 74fd21e..8ac29a3 100644 --- a/app/gfx/gl/gl_implementation_linux.cc +++ b/app/gfx/gl/gl_implementation_linux.cc @@ -5,7 +5,6 @@ #include <vector> #include "app/gfx/gl/gl_bindings.h" -#include "app/gfx/gl/gl_context_stub.h" #include "app/gfx/gl/gl_implementation.h" #include "base/base_paths.h" #include "base/command_line.h" diff --git a/chrome/browser/automation/automation_autocomplete_edit_tracker.cc b/chrome/browser/automation/automation_autocomplete_edit_tracker.cc new file mode 100644 index 0000000..e34e26f --- /dev/null +++ b/chrome/browser/automation/automation_autocomplete_edit_tracker.cc @@ -0,0 +1,28 @@ +// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/automation/automation_autocomplete_edit_tracker.h" + +#include "chrome/common/notification_source.h" +#include "chrome/common/notification_type.h" + +AutomationAutocompleteEditTracker::AutomationAutocompleteEditTracker( + IPC::Message::Sender* automation) + : AutomationResourceTracker<AutocompleteEditView*>(automation) { +} + +AutomationAutocompleteEditTracker::~AutomationAutocompleteEditTracker() { +} + +void AutomationAutocompleteEditTracker::AddObserver( + AutocompleteEditView* resource) { + registrar_.Add(this, NotificationType::AUTOCOMPLETE_EDIT_DESTROYED, + Source<AutocompleteEditView>(resource)); +} + +void AutomationAutocompleteEditTracker::RemoveObserver( + AutocompleteEditView* resource) { + registrar_.Remove(this, NotificationType::AUTOCOMPLETE_EDIT_DESTROYED, + Source<AutocompleteEditView>(resource)); +} diff --git a/chrome/browser/automation/automation_autocomplete_edit_tracker.h b/chrome/browser/automation/automation_autocomplete_edit_tracker.h index 2394b89..0e0a4ed 100644 --- a/chrome/browser/automation/automation_autocomplete_edit_tracker.h +++ b/chrome/browser/automation/automation_autocomplete_edit_tracker.h @@ -8,27 +8,14 @@ #include "chrome/browser/autocomplete/autocomplete_edit_view.h" #include "chrome/browser/automation/automation_resource_tracker.h" -#include "chrome/common/notification_source.h" -#include "chrome/common/notification_type.h" class AutomationAutocompleteEditTracker : public AutomationResourceTracker<AutocompleteEditView*> { public: - explicit AutomationAutocompleteEditTracker(IPC::Message::Sender* automation) - : AutomationResourceTracker<AutocompleteEditView*>(automation) { } - - virtual ~AutomationAutocompleteEditTracker() { - } - - virtual void AddObserver(AutocompleteEditView* resource) { - registrar_.Add(this, NotificationType::AUTOCOMPLETE_EDIT_DESTROYED, - Source<AutocompleteEditView>(resource)); - } - - virtual void RemoveObserver(AutocompleteEditView* resource) { - registrar_.Remove(this, NotificationType::AUTOCOMPLETE_EDIT_DESTROYED, - Source<AutocompleteEditView>(resource)); - } + explicit AutomationAutocompleteEditTracker(IPC::Message::Sender* automation); + virtual ~AutomationAutocompleteEditTracker(); + virtual void AddObserver(AutocompleteEditView* resource); + virtual void RemoveObserver(AutocompleteEditView* resource); }; #endif // CHROME_BROWSER_AUTOMATION_AUTOMATION_AUTOCOMPLETE_EDIT_TRACKER_H_ diff --git a/chrome/browser/automation/automation_browser_tracker.cc b/chrome/browser/automation/automation_browser_tracker.cc new file mode 100644 index 0000000..3000e44 --- /dev/null +++ b/chrome/browser/automation/automation_browser_tracker.cc @@ -0,0 +1,24 @@ +// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/automation/automation_browser_tracker.h" + +#include "chrome/common/notification_source.h" + +AutomationBrowserTracker::AutomationBrowserTracker( + IPC::Message::Sender* automation) + : AutomationResourceTracker<Browser*>(automation) { +} + +AutomationBrowserTracker::~AutomationBrowserTracker() {} + +void AutomationBrowserTracker::AddObserver(Browser* resource) { + registrar_.Add(this, NotificationType::BROWSER_CLOSED, + Source<Browser>(resource)); +} + +void AutomationBrowserTracker::RemoveObserver(Browser* resource) { + registrar_.Remove(this, NotificationType::BROWSER_CLOSED, + Source<Browser>(resource)); +} diff --git a/chrome/browser/automation/automation_browser_tracker.h b/chrome/browser/automation/automation_browser_tracker.h index 88d95b5..f3c8d3b 100644 --- a/chrome/browser/automation/automation_browser_tracker.h +++ b/chrome/browser/automation/automation_browser_tracker.h @@ -7,25 +7,16 @@ #pragma once #include "chrome/browser/automation/automation_resource_tracker.h" -#include "chrome/common/notification_source.h" class Browser; // Tracks Browser objects. class AutomationBrowserTracker : public AutomationResourceTracker<Browser*> { public: - explicit AutomationBrowserTracker(IPC::Message::Sender* automation) - : AutomationResourceTracker<Browser*>(automation) { } - - virtual void AddObserver(Browser* resource) { - registrar_.Add(this, NotificationType::BROWSER_CLOSED, - Source<Browser>(resource)); - } - - virtual void RemoveObserver(Browser* resource) { - registrar_.Remove(this, NotificationType::BROWSER_CLOSED, - Source<Browser>(resource)); - } + explicit AutomationBrowserTracker(IPC::Message::Sender* automation); + virtual ~AutomationBrowserTracker(); + virtual void AddObserver(Browser* resource); + virtual void RemoveObserver(Browser* resource); }; #endif // CHROME_BROWSER_AUTOMATION_AUTOMATION_BROWSER_TRACKER_H__ diff --git a/chrome/browser/automation/url_request_automation_job.cc b/chrome/browser/automation/url_request_automation_job.cc index 12fd431..4386ba9 100644 --- a/chrome/browser/automation/url_request_automation_job.cc +++ b/chrome/browser/automation/url_request_automation_job.cc @@ -437,15 +437,14 @@ void URLRequestAutomationJob::StartAsync() { } // Ask automation to start this request. - IPC::AutomationURLRequest automation_request = { - request_->url().spec(), - request_->method(), - referrer.spec(), - new_request_headers.ToString(), - request_->get_upload(), - resource_type, - request_->load_flags() - }; + IPC::AutomationURLRequest automation_request( + request_->url().spec(), + request_->method(), + referrer.spec(), + new_request_headers.ToString(), + request_->get_upload(), + resource_type, + request_->load_flags()); DCHECK(message_filter_); message_filter_->Send(new AutomationMsg_RequestStart(0, tab_, id_, diff --git a/chrome/browser/external_tab_container_win.cc b/chrome/browser/external_tab_container_win.cc index 6127769..f2f3e83 100644 --- a/chrome/browser/external_tab_container_win.cc +++ b/chrome/browser/external_tab_container_win.cc @@ -622,14 +622,14 @@ bool ExternalTabContainer::HandleContextMenu(const ContextMenuParams& params) { POINT screen_pt = { params.x, params.y }; MapWindowPoints(GetNativeView(), HWND_DESKTOP, &screen_pt, 1); - IPC::MiniContextMenuParams ipc_params; - ipc_params.screen_x = screen_pt.x; - ipc_params.screen_y = screen_pt.y; - ipc_params.link_url = params.link_url; - ipc_params.unfiltered_link_url = params.unfiltered_link_url; - ipc_params.src_url = params.src_url; - ipc_params.page_url = params.page_url; - ipc_params.frame_url = params.frame_url; + IPC::MiniContextMenuParams ipc_params( + screen_pt.x, + screen_pt.y, + params.link_url, + params.unfiltered_link_url, + params.src_url, + params.page_url, + params.frame_url); bool rtl = base::i18n::IsRTL(); automation_->Send( diff --git a/chrome/browser/gtk/accessibility_event_router_gtk.cc b/chrome/browser/gtk/accessibility_event_router_gtk.cc index b3ff63d..1248247 100644 --- a/chrome/browser/gtk/accessibility_event_router_gtk.cc +++ b/chrome/browser/gtk/accessibility_event_router_gtk.cc @@ -12,11 +12,11 @@ #include "chrome/browser/gtk/gtk_chrome_link_button.h" #include "chrome/browser/profiles/profile.h" #include "chrome/common/notification_type.h" -#include "views/controls/textfield/native_textfield_gtk.h" #if defined(TOOLKIT_VIEWS) #include "views/controls/textfield/gtk_views_textview.h" #include "views/controls/textfield/gtk_views_entry.h" +#include "views/controls/textfield/native_textfield_gtk.h" #endif namespace { diff --git a/chrome/browser/gtk/translate/after_translate_infobar_gtk.cc b/chrome/browser/gtk/translate/after_translate_infobar_gtk.cc index 914f2ca..3f36ca6 100644 --- a/chrome/browser/gtk/translate/after_translate_infobar_gtk.cc +++ b/chrome/browser/gtk/translate/after_translate_infobar_gtk.cc @@ -64,6 +64,10 @@ void AfterTranslateInfoBar::Init() { gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); } +bool AfterTranslateInfoBar::ShowOptionsMenuButton() const { + return true; +} + void AfterTranslateInfoBar::OnOriginalLanguageModified(GtkWidget* sender) { int index = GetLanguageComboboxActiveId(GTK_COMBO_BOX(sender)); if (index == GetDelegate()->original_language_index()) diff --git a/chrome/browser/gtk/translate/after_translate_infobar_gtk.h b/chrome/browser/gtk/translate/after_translate_infobar_gtk.h index bd870be..4f49ffd 100644 --- a/chrome/browser/gtk/translate/after_translate_infobar_gtk.h +++ b/chrome/browser/gtk/translate/after_translate_infobar_gtk.h @@ -20,7 +20,7 @@ class AfterTranslateInfoBar : public TranslateInfoBarBase { virtual void Init(); protected: - virtual bool ShowOptionsMenuButton() const { return true; } + virtual bool ShowOptionsMenuButton() const; private: CHROMEGTK_CALLBACK_0(AfterTranslateInfoBar, void, OnOriginalLanguageModified); diff --git a/chrome/browser/gtk/translate/before_translate_infobar_gtk.cc b/chrome/browser/gtk/translate/before_translate_infobar_gtk.cc index 75c668e..01a94ff 100644 --- a/chrome/browser/gtk/translate/before_translate_infobar_gtk.cc +++ b/chrome/browser/gtk/translate/before_translate_infobar_gtk.cc @@ -75,6 +75,10 @@ void BeforeTranslateInfoBar::Init() { } } +bool BeforeTranslateInfoBar::ShowOptionsMenuButton() const { + return true; +} + void BeforeTranslateInfoBar::OnLanguageModified(GtkWidget* sender) { int index = GetLanguageComboboxActiveId(GTK_COMBO_BOX(sender)); if (index == GetDelegate()->original_language_index()) diff --git a/chrome/browser/gtk/translate/before_translate_infobar_gtk.h b/chrome/browser/gtk/translate/before_translate_infobar_gtk.h index 1373247..e6ff5a9 100644 --- a/chrome/browser/gtk/translate/before_translate_infobar_gtk.h +++ b/chrome/browser/gtk/translate/before_translate_infobar_gtk.h @@ -19,7 +19,7 @@ class BeforeTranslateInfoBar : public TranslateInfoBarBase { virtual void Init(); protected: - virtual bool ShowOptionsMenuButton() const { return true; } + virtual bool ShowOptionsMenuButton() const; private: CHROMEGTK_CALLBACK_0(BeforeTranslateInfoBar, void, OnLanguageModified); diff --git a/chrome/browser/prerender/prerender_contents.cc b/chrome/browser/prerender/prerender_contents.cc index 71ff4ac..407f789 100644 --- a/chrome/browser/prerender/prerender_contents.cc +++ b/chrome/browser/prerender/prerender_contents.cc @@ -58,6 +58,14 @@ PrerenderContents::~PrerenderContents() { render_view_host_->Shutdown(); // deletes render_view_host } +RenderViewHostDelegate::View* PrerenderContents::GetViewDelegate() { + return this; +} + +const GURL& PrerenderContents::GetURL() const { + return url_; +} + ViewType::Type PrerenderContents::GetRenderViewType() const { return ViewType::BACKGROUND_CONTENTS; } @@ -134,6 +142,14 @@ gfx::NativeWindow PrerenderContents::GetMessageBoxRootWindow() { return NULL; } +TabContents* PrerenderContents::AsTabContents() { + return NULL; +} + +ExtensionHost* PrerenderContents::AsExtensionHost() { + return NULL; +} + void PrerenderContents::UpdateInspectorSetting(const std::string& key, const std::string& value) { RenderViewHostDelegateHelper::UpdateInspectorSetting(profile_, key, value); diff --git a/chrome/browser/prerender/prerender_contents.h b/chrome/browser/prerender/prerender_contents.h index 0732841..7a2b08b 100644 --- a/chrome/browser/prerender/prerender_contents.h +++ b/chrome/browser/prerender/prerender_contents.h @@ -53,8 +53,8 @@ class PrerenderContents : public RenderViewHostDelegate, int32 page_id() const { return page_id_; } // RenderViewHostDelegate implementation. - virtual RenderViewHostDelegate::View* GetViewDelegate() { return this; } - virtual const GURL& GetURL() const { return url_; } + virtual RenderViewHostDelegate::View* GetViewDelegate(); + virtual const GURL& GetURL() const; virtual ViewType::Type GetRenderViewType() const; virtual int GetBrowserWindowID() const; virtual void DidNavigate(RenderViewHost* render_view_host, @@ -126,8 +126,8 @@ class PrerenderContents : public RenderViewHostDelegate, const std::wstring& prompt); virtual void SetSuppressMessageBoxes(bool suppress_message_boxes) {} virtual gfx::NativeWindow GetMessageBoxRootWindow(); - virtual TabContents* AsTabContents() { return NULL; } - virtual ExtensionHost* AsExtensionHost() { return NULL; } + virtual TabContents* AsTabContents(); + virtual ExtensionHost* AsExtensionHost(); virtual void UpdateInspectorSetting(const std::string& key, const std::string& value); diff --git a/chrome/browser/renderer_host/render_widget_host_view.cc b/chrome/browser/renderer_host/render_widget_host_view.cc new file mode 100644 index 0000000..6413f3a --- /dev/null +++ b/chrome/browser/renderer_host/render_widget_host_view.cc @@ -0,0 +1,11 @@ +// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/renderer_host/render_widget_host_view.h" + +RenderWidgetHostView::~RenderWidgetHostView() {} + +void RenderWidgetHostView::SetBackground(const SkBitmap& background) { + background_ = background; +} diff --git a/chrome/browser/renderer_host/render_widget_host_view.h b/chrome/browser/renderer_host/render_widget_host_view.h index 14cf129..fdbe440 100644 --- a/chrome/browser/renderer_host/render_widget_host_view.h +++ b/chrome/browser/renderer_host/render_widget_host_view.h @@ -51,7 +51,7 @@ struct WebPluginGeometry; // changes. class RenderWidgetHostView { public: - virtual ~RenderWidgetHostView() {} + virtual ~RenderWidgetHostView(); // Platform-specific creator. Use this to construct new RenderWidgetHostViews // rather than using RenderWidgetHostViewWin & friends. @@ -268,11 +268,9 @@ class RenderWidgetHostView { } WebKit::WebPopupType popup_type() const { return popup_type_; } - // Subclasses should override this method to do is appropriate to set + // Subclasses should override this method to do what is appropriate to set // the custom background for their platform. - virtual void SetBackground(const SkBitmap& background) { - background_ = background; - } + virtual void SetBackground(const SkBitmap& background); const SkBitmap& background() const { return background_; } // Returns true if the native view, |native_view|, is contained within in the diff --git a/chrome/browser/sync/glue/password_data_type_controller.cc b/chrome/browser/sync/glue/password_data_type_controller.cc index a4b43d2..c483860 100644 --- a/chrome/browser/sync/glue/password_data_type_controller.cc +++ b/chrome/browser/sync/glue/password_data_type_controller.cc @@ -73,6 +73,27 @@ void PasswordDataTypeController::Stop() { NewRunnableMethod(this, &PasswordDataTypeController::StopImpl)); } +bool PasswordDataTypeController::enabled() { + return true; +} + +syncable::ModelType PasswordDataTypeController::type() { + return syncable::PASSWORDS; +} + +browser_sync::ModelSafeGroup PasswordDataTypeController::model_safe_group() { + return browser_sync::GROUP_PASSWORD; +} + +const char* PasswordDataTypeController::name() const { + // For logging only. + return "password"; +} + +DataTypeController::State PasswordDataTypeController::state() { + return state_; +} + void PasswordDataTypeController::StartImpl() { // No additional services need to be started before we can proceed // with model association. diff --git a/chrome/browser/sync/glue/password_data_type_controller.h b/chrome/browser/sync/glue/password_data_type_controller.h index 910eba9..56fb55bd 100644 --- a/chrome/browser/sync/glue/password_data_type_controller.h +++ b/chrome/browser/sync/glue/password_data_type_controller.h @@ -38,26 +38,15 @@ class PasswordDataTypeController : public DataTypeController { virtual void Stop(); - virtual bool enabled() { - return true; - } + virtual bool enabled(); - virtual syncable::ModelType type() { - return syncable::PASSWORDS; - } + virtual syncable::ModelType type(); - virtual browser_sync::ModelSafeGroup model_safe_group() { - return browser_sync::GROUP_PASSWORD; - } + virtual browser_sync::ModelSafeGroup model_safe_group(); - virtual const char* name() const { - // For logging only. - return "password"; - } + virtual const char* name() const; - virtual State state() { - return state_; - } + virtual State state(); // UnrecoverableHandler implementation virtual void OnUnrecoverableError(const tracked_objects::Location& from_here, diff --git a/chrome/browser/sync/glue/password_model_associator.cc b/chrome/browser/sync/glue/password_model_associator.cc index 8615c5a..3c9d01a 100644 --- a/chrome/browser/sync/glue/password_model_associator.cc +++ b/chrome/browser/sync/glue/password_model_associator.cc @@ -198,6 +198,17 @@ void PasswordModelAssociator::AbortAssociation() { abort_association_pending_ = true; } +const std::string* PasswordModelAssociator::GetChromeNodeFromSyncId( + int64 sync_id) { + return NULL; +} + +bool PasswordModelAssociator::InitSyncNodeFromChromeId( + const std::string& node_id, + sync_api::BaseNode* sync_node) { + return false; +} + bool PasswordModelAssociator::IsAbortPending() { AutoLock lock(abort_association_pending_lock_); return abort_association_pending_; diff --git a/chrome/browser/sync/glue/password_model_associator.h b/chrome/browser/sync/glue/password_model_associator.h index 8bc40cc..15eb3724 100644 --- a/chrome/browser/sync/glue/password_model_associator.h +++ b/chrome/browser/sync/glue/password_model_associator.h @@ -72,15 +72,11 @@ class PasswordModelAssociator virtual void AbortAssociation(); // Not implemented. - virtual const std::string* GetChromeNodeFromSyncId(int64 sync_id) { - return NULL; - } + virtual const std::string* GetChromeNodeFromSyncId(int64 sync_id); // Not implemented. virtual bool InitSyncNodeFromChromeId(const std::string& node_id, - sync_api::BaseNode* sync_node) { - return false; - } + sync_api::BaseNode* sync_node); // Returns the sync id for the given password name, or sync_api::kInvalidId // if the password name is not associated to any sync id. diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi index d4cf08a..a5f5204 100644 --- a/chrome/chrome_browser.gypi +++ b/chrome/chrome_browser.gypi @@ -216,7 +216,9 @@ 'browser/autofill/phone_number.h', 'browser/autofill/select_control_handler.cc', 'browser/autofill/select_control_handler.h', + 'browser/automation/automation_autocomplete_edit_tracker.cc', 'browser/automation/automation_autocomplete_edit_tracker.h', + 'browser/automation/automation_browser_tracker.cc', 'browser/automation/automation_browser_tracker.h', 'browser/automation/extension_automation_constants.h', 'browser/automation/extension_automation_constants.cc', @@ -2172,6 +2174,7 @@ 'browser/renderer_host/render_widget_host.cc', 'browser/renderer_host/render_widget_host.h', 'browser/renderer_host/render_widget_host_painting_observer.h', + 'browser/renderer_host/render_widget_host_view.cc', 'browser/renderer_host/render_widget_host_view.h', 'browser/renderer_host/render_widget_host_view_gtk.cc', 'browser/renderer_host/render_widget_host_view_gtk.h', diff --git a/chrome/chrome_common.gypi b/chrome/chrome_common.gypi index 3dd3e61..aaffc32 100644 --- a/chrome/chrome_common.gypi +++ b/chrome/chrome_common.gypi @@ -299,6 +299,7 @@ 'common/plugin_messages.h', 'common/plugin_messages_internal.h', 'common/persistent_pref_store.h', + 'common/pref_store.cc', 'common/pref_store.h', 'common/render_messages.cc', 'common/render_messages.h', diff --git a/chrome/common/automation_messages.cc b/chrome/common/automation_messages.cc index 6a5ca82..b472f13 100644 --- a/chrome/common/automation_messages.cc +++ b/chrome/common/automation_messages.cc @@ -4,3 +4,670 @@ #define IPC_MESSAGE_IMPL #include "chrome/common/automation_messages.h" + +namespace IPC { + +// static +void ParamTraits<AutomationMsg_Find_Params>::Write(Message* m, + const param_type& p) { + WriteParam(m, p.unused); + WriteParam(m, p.search_string); + WriteParam(m, p.forward); + WriteParam(m, p.match_case); + WriteParam(m, p.find_next); +} + +// static +bool ParamTraits<AutomationMsg_Find_Params>::Read(const Message* m, + void** iter, + param_type* p) { + return + ReadParam(m, iter, &p->unused) && + ReadParam(m, iter, &p->search_string) && + ReadParam(m, iter, &p->forward) && + ReadParam(m, iter, &p->match_case) && + ReadParam(m, iter, &p->find_next); +} + +// static +void ParamTraits<AutomationMsg_Find_Params>::Log(const param_type& p, + std::string* l) { + l->append("<AutomationMsg_Find_Params>"); +} + +// static +void ParamTraits<AutomationMsg_NavigationResponseValues>::Write( + Message* m, + const param_type& p) { + m->WriteInt(p); +} + +// static +bool ParamTraits<AutomationMsg_NavigationResponseValues>::Read(const Message* m, + void** iter, + param_type* p) { + int type; + if (!m->ReadInt(iter, &type)) + return false; + *p = static_cast<AutomationMsg_NavigationResponseValues>(type); + return true; +} + +// static +void ParamTraits<AutomationMsg_NavigationResponseValues>::Log( + const param_type& p, std::string* l) { + std::string control; + switch (p) { + case AUTOMATION_MSG_NAVIGATION_ERROR: + control = "AUTOMATION_MSG_NAVIGATION_ERROR"; + break; + case AUTOMATION_MSG_NAVIGATION_SUCCESS: + control = "AUTOMATION_MSG_NAVIGATION_SUCCESS"; + break; + case AUTOMATION_MSG_NAVIGATION_AUTH_NEEDED: + control = "AUTOMATION_MSG_NAVIGATION_AUTH_NEEDED"; + break; + default: + control = "UNKNOWN"; + break; + } + + LogParam(control, l); +} + +// static +void ParamTraits<AutomationMsg_ExtensionResponseValues>::Write( + Message* m, + const param_type& p) { + m->WriteInt(p); +} + +// static +bool ParamTraits<AutomationMsg_ExtensionResponseValues>::Read( + const Message* m, + void** iter, + param_type* p) { + int type; + if (!m->ReadInt(iter, &type)) + return false; + *p = static_cast<AutomationMsg_ExtensionResponseValues>(type); + return true; +} + +// static +void ParamTraits<AutomationMsg_ExtensionResponseValues>::Log( + const param_type& p, + std::string* l) { + std::string control; + switch (p) { + case AUTOMATION_MSG_EXTENSION_INSTALL_SUCCEEDED: + control = "AUTOMATION_MSG_EXTENSION_INSTALL_SUCCEEDED"; + break; + case AUTOMATION_MSG_EXTENSION_INSTALL_FAILED: + control = "AUTOMATION_MSG_EXTENSION_INSTALL_FAILED"; + break; + default: + control = "UNKNOWN"; + break; + } + + LogParam(control, l); +} + +// static +void ParamTraits<AutomationMsg_ExtensionProperty>::Write(Message* m, + const param_type& p) { + m->WriteInt(p); +} + +// static +bool ParamTraits<AutomationMsg_ExtensionProperty>::Read(const Message* m, + void** iter, + param_type* p) { + int type; + if (!m->ReadInt(iter, &type)) + return false; + *p = static_cast<AutomationMsg_ExtensionProperty>(type); + return true; +} + +// static +void ParamTraits<AutomationMsg_ExtensionProperty>::Log(const param_type& p, + std::string* l) { + std::string control; + switch (p) { + case AUTOMATION_MSG_EXTENSION_ID: + control = "AUTOMATION_MSG_EXTENSION_ID"; + break; + case AUTOMATION_MSG_EXTENSION_NAME: + control = "AUTOMATION_MSG_EXTENSION_NAME"; + break; + case AUTOMATION_MSG_EXTENSION_VERSION: + control = "AUTOMATION_MSG_EXTENSION_VERSION"; + break; + case AUTOMATION_MSG_EXTENSION_BROWSER_ACTION_INDEX: + control = "AUTOMATION_MSG_EXTENSION_BROWSER_ACTION_INDEX"; + break; + default: + control = "UNKNOWN"; + break; + } + + LogParam(control, l); +} + +// static +void ParamTraits<SecurityStyle>::Write(Message* m, const param_type& p) { + m->WriteInt(p); +} + +// static +bool ParamTraits<SecurityStyle>::Read(const Message* m, + void** iter, + param_type* p) { + int type; + if (!m->ReadInt(iter, &type)) + return false; + *p = static_cast<SecurityStyle>(type); + return true; +} + +// static +void ParamTraits<SecurityStyle>::Log(const param_type& p, std::string* l) { + std::string control; + switch (p) { + case SECURITY_STYLE_UNKNOWN: + control = "SECURITY_STYLE_UNKNOWN"; + break; + case SECURITY_STYLE_UNAUTHENTICATED: + control = "SECURITY_STYLE_UNAUTHENTICATED"; + break; + case SECURITY_STYLE_AUTHENTICATION_BROKEN: + control = "SECURITY_STYLE_AUTHENTICATION_BROKEN"; + break; + case SECURITY_STYLE_AUTHENTICATED: + control = "SECURITY_STYLE_AUTHENTICATED"; + break; + default: + control = "UNKNOWN"; + break; + } + + LogParam(control, l); +} + +// static +void ParamTraits<PageType>::Write(Message* m, const param_type& p) { + m->WriteInt(p); +} + +// static +bool ParamTraits<PageType>::Read(const Message* m, void** iter, param_type* p) { + int type; + if (!m->ReadInt(iter, &type)) + return false; + *p = static_cast<PageType>(type); + return true; +} + +// static +void ParamTraits<PageType>::Log(const param_type& p, std::string* l) { + std::string control; + switch (p) { + case NORMAL_PAGE: + control = "NORMAL_PAGE"; + break; + case ERROR_PAGE: + control = "ERROR_PAGE"; + break; + case INTERSTITIAL_PAGE: + control = "INTERSTITIAL_PAGE"; + break; + default: + control = "UNKNOWN"; + break; + } + + LogParam(control, l); +} + +AutomationURLRequest::AutomationURLRequest() + : resource_type(0), + load_flags(0) { +} + +AutomationURLRequest::AutomationURLRequest( + const std::string& in_url, + const std::string& in_method, + const std::string& in_referrer, + const std::string& in_extra_request_headers, + scoped_refptr<net::UploadData> in_upload_data, + int in_resource_type, + int in_load_flags) + : url(in_url), + method(in_method), + referrer(in_referrer), + extra_request_headers(in_extra_request_headers), + upload_data(in_upload_data), + resource_type(in_resource_type), + load_flags(in_load_flags) { +} + +AutomationURLRequest::~AutomationURLRequest() {} + +// static +void ParamTraits<AutomationURLRequest>::Write(Message* m, const param_type& p) { + WriteParam(m, p.url); + WriteParam(m, p.method); + WriteParam(m, p.referrer); + WriteParam(m, p.extra_request_headers); + WriteParam(m, p.upload_data); + WriteParam(m, p.resource_type); + WriteParam(m, p.load_flags); +} + +// static +bool ParamTraits<AutomationURLRequest>::Read(const Message* m, + void** iter, + param_type* p) { + return ReadParam(m, iter, &p->url) && + ReadParam(m, iter, &p->method) && + ReadParam(m, iter, &p->referrer) && + ReadParam(m, iter, &p->extra_request_headers) && + ReadParam(m, iter, &p->upload_data) && + ReadParam(m, iter, &p->resource_type) && + ReadParam(m, iter, &p->load_flags); +} + +// static +void ParamTraits<AutomationURLRequest>::Log(const param_type& p, + std::string* l) { + l->append("("); + LogParam(p.url, l); + l->append(", "); + LogParam(p.method, l); + l->append(", "); + LogParam(p.referrer, l); + l->append(", "); + LogParam(p.extra_request_headers, l); + l->append(", "); + LogParam(p.upload_data, l); + l->append(", "); + LogParam(p.resource_type, l); + l->append(", "); + LogParam(p.load_flags, l); + l->append(")"); +} + +AutomationURLResponse::AutomationURLResponse() + : content_length(0), + redirect_status(0) { +} + +AutomationURLResponse::AutomationURLResponse(const std::string& in_mime_type, + const std::string& in_headers, + int64 in_content_length, + const base::Time& in_last_modified, + const std::string& in_redirect_url, + int in_redirect_status) + : mime_type(in_mime_type), + headers(in_headers), + content_length(in_content_length), + last_modified(in_last_modified), + redirect_url(in_redirect_url), + redirect_status(in_redirect_status) { +} + + +AutomationURLResponse::~AutomationURLResponse() {} + +// static +void ParamTraits<AutomationURLResponse>::Write(Message* m, + const param_type& p) { + WriteParam(m, p.mime_type); + WriteParam(m, p.headers); + WriteParam(m, p.content_length); + WriteParam(m, p.last_modified); + WriteParam(m, p.redirect_url); + WriteParam(m, p.redirect_status); +} + +// static +bool ParamTraits<AutomationURLResponse>::Read(const Message* m, + void** iter, + param_type* p) { + return ReadParam(m, iter, &p->mime_type) && + ReadParam(m, iter, &p->headers) && + ReadParam(m, iter, &p->content_length) && + ReadParam(m, iter, &p->last_modified) && + ReadParam(m, iter, &p->redirect_url) && + ReadParam(m, iter, &p->redirect_status); +} + +// static +void ParamTraits<AutomationURLResponse>::Log(const param_type& p, + std::string* l) { + l->append("("); + LogParam(p.mime_type, l); + l->append(", "); + LogParam(p.headers, l); + l->append(", "); + LogParam(p.content_length, l); + l->append(", "); + LogParam(p.last_modified, l); + l->append(", "); + LogParam(p.redirect_url, l); + l->append(", "); + LogParam(p.redirect_status, l); + l->append(")"); +} + +ExternalTabSettings::ExternalTabSettings() + : parent(NULL), + dimensions(), + style(0), + is_off_the_record(false), + load_requests_via_automation(false), + handle_top_level_requests(false), + initial_url(), + referrer(), + infobars_enabled(false), + route_all_top_level_navigations(false) { +} + +ExternalTabSettings::ExternalTabSettings( + gfx::NativeWindow in_parent, + const gfx::Rect& in_dimensions, + unsigned int in_style, + bool in_is_off_the_record, + bool in_load_requests_via_automation, + bool in_handle_top_level_requests, + const GURL& in_initial_url, + const GURL& in_referrer, + bool in_infobars_enabled, + bool in_route_all_top_level_navigations) + : parent(in_parent), + dimensions(in_dimensions), + style(in_style), + is_off_the_record(in_is_off_the_record), + load_requests_via_automation(in_load_requests_via_automation), + handle_top_level_requests(in_handle_top_level_requests), + initial_url(in_initial_url), + referrer(in_referrer), + infobars_enabled(in_infobars_enabled), + route_all_top_level_navigations(in_route_all_top_level_navigations) { +} + +ExternalTabSettings::~ExternalTabSettings() {} + +// static +void ParamTraits<ExternalTabSettings>::Write(Message* m, + const param_type& p) { + WriteParam(m, p.parent); + WriteParam(m, p.dimensions); + WriteParam(m, p.style); + WriteParam(m, p.is_off_the_record); + WriteParam(m, p.load_requests_via_automation); + WriteParam(m, p.handle_top_level_requests); + WriteParam(m, p.initial_url); + WriteParam(m, p.referrer); + WriteParam(m, p.infobars_enabled); + WriteParam(m, p.route_all_top_level_navigations); +} + +// static +bool ParamTraits<ExternalTabSettings>::Read(const Message* m, + void** iter, + param_type* p) { + return ReadParam(m, iter, &p->parent) && + ReadParam(m, iter, &p->dimensions) && + ReadParam(m, iter, &p->style) && + ReadParam(m, iter, &p->is_off_the_record) && + ReadParam(m, iter, &p->load_requests_via_automation) && + ReadParam(m, iter, &p->handle_top_level_requests) && + ReadParam(m, iter, &p->initial_url) && + ReadParam(m, iter, &p->referrer) && + ReadParam(m, iter, &p->infobars_enabled) && + ReadParam(m, iter, &p->route_all_top_level_navigations); +} + +// static +void ParamTraits<ExternalTabSettings>::Log(const param_type& p, + std::string* l) { + l->append("("); + LogParam(p.parent, l); + l->append(", "); + LogParam(p.dimensions, l); + l->append(", "); + LogParam(p.style, l); + l->append(", "); + LogParam(p.is_off_the_record, l); + l->append(", "); + LogParam(p.load_requests_via_automation, l); + l->append(", "); + LogParam(p.handle_top_level_requests, l); + l->append(", "); + LogParam(p.initial_url, l); + l->append(", "); + LogParam(p.referrer, l); + l->append(", "); + LogParam(p.infobars_enabled, l); + l->append(", "); + LogParam(p.route_all_top_level_navigations, l); + l->append(")"); +} + +NavigationInfo::NavigationInfo() + : navigation_type(0), + relative_offset(0), + navigation_index(0), + displayed_insecure_content(0), + ran_insecure_content(0) { +} + +NavigationInfo::NavigationInfo(int in_navigation_type, + int in_relative_offset, + int in_navigation_index, + const std::wstring& in_title, + const GURL& in_url, + const GURL& in_referrer, + SecurityStyle in_security_style, + bool in_displayed_insecure_content, + bool in_ran_insecure_content) + : navigation_type(in_navigation_type), + relative_offset(in_relative_offset), + navigation_index(in_navigation_index), + title(in_title), + url(in_url), + referrer(in_referrer), + security_style(in_security_style), + displayed_insecure_content(in_displayed_insecure_content), + ran_insecure_content(in_ran_insecure_content) { +} + +NavigationInfo::~NavigationInfo() {} + +// static +void ParamTraits<NavigationInfo>::Write(Message* m, const param_type& p) { + WriteParam(m, p.navigation_type); + WriteParam(m, p.relative_offset); + WriteParam(m, p.navigation_index); + WriteParam(m, p.title); + WriteParam(m, p.url); + WriteParam(m, p.referrer); + WriteParam(m, p.security_style); + WriteParam(m, p.displayed_insecure_content); + WriteParam(m, p.ran_insecure_content); +} + +// static +bool ParamTraits<NavigationInfo>::Read(const Message* m, + void** iter, + param_type* p) { + return ReadParam(m, iter, &p->navigation_type) && + ReadParam(m, iter, &p->relative_offset) && + ReadParam(m, iter, &p->navigation_index) && + ReadParam(m, iter, &p->title) && + ReadParam(m, iter, &p->url) && + ReadParam(m, iter, &p->referrer) && + ReadParam(m, iter, &p->security_style) && + ReadParam(m, iter, &p->displayed_insecure_content) && + ReadParam(m, iter, &p->ran_insecure_content); +} + +// static +void ParamTraits<NavigationInfo>::Log(const param_type& p, std::string* l) { + l->append("("); + LogParam(p.navigation_type, l); + l->append(", "); + LogParam(p.relative_offset, l); + l->append(", "); + LogParam(p.navigation_index, l); + l->append(", "); + LogParam(p.title, l); + l->append(", "); + LogParam(p.url, l); + l->append(", "); + LogParam(p.referrer, l); + l->append(", "); + LogParam(p.security_style, l); + l->append(", "); + LogParam(p.displayed_insecure_content, l); + l->append(", "); + LogParam(p.ran_insecure_content, l); + l->append(")"); +} + +MiniContextMenuParams::MiniContextMenuParams() + : screen_x(0), + screen_y(0) { +} + +MiniContextMenuParams::MiniContextMenuParams(int in_screen_x, + int in_screen_y, + const GURL& in_link_url, + const GURL& in_unfiltered_link_url, + const GURL& in_src_url, + const GURL& in_page_url, + const GURL& in_frame_url) + : screen_x(in_screen_x), + screen_y(in_screen_y), + link_url(in_link_url), + unfiltered_link_url(in_unfiltered_link_url), + src_url(in_src_url), + page_url(in_page_url), + frame_url(in_frame_url) { +} + +MiniContextMenuParams::~MiniContextMenuParams() {} + +// static +void ParamTraits<MiniContextMenuParams>::Write(Message* m, + const param_type& p) { + WriteParam(m, p.screen_x); + WriteParam(m, p.screen_y); + WriteParam(m, p.link_url); + WriteParam(m, p.unfiltered_link_url); + WriteParam(m, p.src_url); + WriteParam(m, p.page_url); + WriteParam(m, p.frame_url); +} + +// static +bool ParamTraits<MiniContextMenuParams>::Read(const Message* m, + void** iter, + param_type* p) { + return ReadParam(m, iter, &p->screen_x) && + ReadParam(m, iter, &p->screen_y) && + ReadParam(m, iter, &p->link_url) && + ReadParam(m, iter, &p->unfiltered_link_url) && + ReadParam(m, iter, &p->src_url) && + ReadParam(m, iter, &p->page_url) && + ReadParam(m, iter, &p->frame_url); +} + +// static +void ParamTraits<MiniContextMenuParams>::Log(const param_type& p, + std::string* l) { + l->append("("); + LogParam(p.screen_x, l); + l->append(", "); + LogParam(p.screen_y, l); + l->append(", "); + LogParam(p.link_url, l); + l->append(", "); + LogParam(p.unfiltered_link_url, l); + l->append(", "); + LogParam(p.src_url, l); + l->append(", "); + LogParam(p.page_url, l); + l->append(", "); + LogParam(p.frame_url, l); + l->append(")"); +} + +AttachExternalTabParams::AttachExternalTabParams() + : cookie(0), + disposition(0), + user_gesture(false) { +} + +AttachExternalTabParams::AttachExternalTabParams( + uint64 in_cookie, + const GURL& in_url, + const gfx::Rect& in_dimensions, + int in_disposition, + bool in_user_gesture, + const std::string& in_profile_name) + : cookie(in_cookie), + url(in_url), + dimensions(in_dimensions), + disposition(in_disposition), + user_gesture(in_user_gesture), + profile_name(in_profile_name) { +} + +AttachExternalTabParams::~AttachExternalTabParams() {} + +// static +void ParamTraits<AttachExternalTabParams>::Write(Message* m, + const param_type& p) { + WriteParam(m, p.cookie); + WriteParam(m, p.url); + WriteParam(m, p.dimensions); + WriteParam(m, p.disposition); + WriteParam(m, p.user_gesture); + WriteParam(m, p.profile_name); +} + +// static +bool ParamTraits<AttachExternalTabParams>::Read(const Message* m, + void** iter, + param_type* p) { + return ReadParam(m, iter, &p->cookie) && + ReadParam(m, iter, &p->url) && + ReadParam(m, iter, &p->dimensions) && + ReadParam(m, iter, &p->disposition) && + ReadParam(m, iter, &p->user_gesture) && + ReadParam(m, iter, &p->profile_name); +} + +// static +void ParamTraits<AttachExternalTabParams>::Log(const param_type& p, + std::string* l) { + l->append("("); + LogParam(p.cookie, l); + l->append(", "); + LogParam(p.url, l); + l->append(", "); + LogParam(p.dimensions, l); + l->append(", "); + LogParam(p.disposition, l); + l->append(", "); + LogParam(p.user_gesture, l); + l->append(","); + LogParam(p.profile_name, l); + l->append(")"); +} + +} // namespace IPC diff --git a/chrome/common/automation_messages.h b/chrome/common/automation_messages.h index 42f1932..ac3c4628 100644 --- a/chrome/common/automation_messages.h +++ b/chrome/common/automation_messages.h @@ -39,197 +39,49 @@ namespace IPC { template <> struct ParamTraits<AutomationMsg_Find_Params> { typedef AutomationMsg_Find_Params param_type; - static void Write(Message* m, const param_type& p) { - WriteParam(m, p.unused); - WriteParam(m, p.search_string); - WriteParam(m, p.forward); - WriteParam(m, p.match_case); - WriteParam(m, p.find_next); - } - static bool Read(const Message* m, void** iter, param_type* p) { - return - ReadParam(m, iter, &p->unused) && - ReadParam(m, iter, &p->search_string) && - ReadParam(m, iter, &p->forward) && - ReadParam(m, iter, &p->match_case) && - ReadParam(m, iter, &p->find_next); - } - static void Log(const param_type& p, std::string* l) { - l->append("<AutomationMsg_Find_Params>"); - } + static void Write(Message* m, const param_type& p); + static bool Read(const Message* m, void** iter, param_type* p); + static void Log(const param_type& p, std::string* l); }; template <> struct ParamTraits<AutomationMsg_NavigationResponseValues> { typedef AutomationMsg_NavigationResponseValues param_type; - static void Write(Message* m, const param_type& p) { - m->WriteInt(p); - } - static bool Read(const Message* m, void** iter, param_type* p) { - int type; - if (!m->ReadInt(iter, &type)) - return false; - *p = static_cast<AutomationMsg_NavigationResponseValues>(type); - return true; - } - static void Log(const param_type& p, std::string* l) { - std::string control; - switch (p) { - case AUTOMATION_MSG_NAVIGATION_ERROR: - control = "AUTOMATION_MSG_NAVIGATION_ERROR"; - break; - case AUTOMATION_MSG_NAVIGATION_SUCCESS: - control = "AUTOMATION_MSG_NAVIGATION_SUCCESS"; - break; - case AUTOMATION_MSG_NAVIGATION_AUTH_NEEDED: - control = "AUTOMATION_MSG_NAVIGATION_AUTH_NEEDED"; - break; - default: - control = "UNKNOWN"; - break; - } - - LogParam(control, l); - } + static void Write(Message* m, const param_type& p); + static bool Read(const Message* m, void** iter, param_type* p); + static void Log(const param_type& p, std::string* l); }; template <> struct ParamTraits<AutomationMsg_ExtensionResponseValues> { typedef AutomationMsg_ExtensionResponseValues param_type; - static void Write(Message* m, const param_type& p) { - m->WriteInt(p); - } - static bool Read(const Message* m, void** iter, param_type* p) { - int type; - if (!m->ReadInt(iter, &type)) - return false; - *p = static_cast<AutomationMsg_ExtensionResponseValues>(type); - return true; - } - static void Log(const param_type& p, std::string* l) { - std::string control; - switch (p) { - case AUTOMATION_MSG_EXTENSION_INSTALL_SUCCEEDED: - control = "AUTOMATION_MSG_EXTENSION_INSTALL_SUCCEEDED"; - break; - case AUTOMATION_MSG_EXTENSION_INSTALL_FAILED: - control = "AUTOMATION_MSG_EXTENSION_INSTALL_FAILED"; - break; - default: - control = "UNKNOWN"; - break; - } - - LogParam(control, l); - } + static void Write(Message* m, const param_type& p); + static bool Read(const Message* m, void** iter, param_type* p); + static void Log(const param_type& p, std::string* l); }; template <> struct ParamTraits<AutomationMsg_ExtensionProperty> { typedef AutomationMsg_ExtensionProperty param_type; - static void Write(Message* m, const param_type& p) { - m->WriteInt(p); - } - static bool Read(const Message* m, void** iter, param_type* p) { - int type; - if (!m->ReadInt(iter, &type)) - return false; - *p = static_cast<AutomationMsg_ExtensionProperty>(type); - return true; - } - static void Log(const param_type& p, std::string* l) { - std::string control; - switch (p) { - case AUTOMATION_MSG_EXTENSION_ID: - control = "AUTOMATION_MSG_EXTENSION_ID"; - break; - case AUTOMATION_MSG_EXTENSION_NAME: - control = "AUTOMATION_MSG_EXTENSION_NAME"; - break; - case AUTOMATION_MSG_EXTENSION_VERSION: - control = "AUTOMATION_MSG_EXTENSION_VERSION"; - break; - case AUTOMATION_MSG_EXTENSION_BROWSER_ACTION_INDEX: - control = "AUTOMATION_MSG_EXTENSION_BROWSER_ACTION_INDEX"; - break; - default: - control = "UNKNOWN"; - break; - } - - LogParam(control, l); - } + static void Write(Message* m, const param_type& p); + static bool Read(const Message* m, void** iter, param_type* p); + static void Log(const param_type& p, std::string* l); }; template <> struct ParamTraits<SecurityStyle> { typedef SecurityStyle param_type; - static void Write(Message* m, const param_type& p) { - m->WriteInt(p); - } - static bool Read(const Message* m, void** iter, param_type* p) { - int type; - if (!m->ReadInt(iter, &type)) - return false; - *p = static_cast<SecurityStyle>(type); - return true; - } - static void Log(const param_type& p, std::string* l) { - std::string control; - switch (p) { - case SECURITY_STYLE_UNKNOWN: - control = "SECURITY_STYLE_UNKNOWN"; - break; - case SECURITY_STYLE_UNAUTHENTICATED: - control = "SECURITY_STYLE_UNAUTHENTICATED"; - break; - case SECURITY_STYLE_AUTHENTICATION_BROKEN: - control = "SECURITY_STYLE_AUTHENTICATION_BROKEN"; - break; - case SECURITY_STYLE_AUTHENTICATED: - control = "SECURITY_STYLE_AUTHENTICATED"; - break; - default: - control = "UNKNOWN"; - break; - } - - LogParam(control, l); - } + static void Write(Message* m, const param_type& p); + static bool Read(const Message* m, void** iter, param_type* p); + static void Log(const param_type& p, std::string* l); }; template <> struct ParamTraits<PageType> { typedef PageType param_type; - static void Write(Message* m, const param_type& p) { - m->WriteInt(p); - } - static bool Read(const Message* m, void** iter, param_type* p) { - int type; - if (!m->ReadInt(iter, &type)) - return false; - *p = static_cast<PageType>(type); - return true; - } - static void Log(const param_type& p, std::string* l) { - std::string control; - switch (p) { - case NORMAL_PAGE: - control = "NORMAL_PAGE"; - break; - case ERROR_PAGE: - control = "ERROR_PAGE"; - break; - case INTERSTITIAL_PAGE: - control = "INTERSTITIAL_PAGE"; - break; - default: - control = "UNKNOWN"; - break; - } - - LogParam(control, l); - } + static void Write(Message* m, const param_type& p); + static bool Read(const Message* m, void** iter, param_type* p); + static void Log(const param_type& p, std::string* l); }; #if defined(OS_WIN) @@ -296,6 +148,16 @@ struct ParamTraits<Reposition_Params> { #endif // defined(OS_WIN) struct AutomationURLRequest { + AutomationURLRequest(); + AutomationURLRequest(const std::string& url, + const std::string& method, + const std::string& referrer, + const std::string& extra_request_headers, + scoped_refptr<net::UploadData> upload_data, + int resource_type, + int load_flags); + ~AutomationURLRequest(); + std::string url; std::string method; std::string referrer; @@ -309,44 +171,21 @@ struct AutomationURLRequest { template <> struct ParamTraits<AutomationURLRequest> { typedef AutomationURLRequest param_type; - static void Write(Message* m, const param_type& p) { - WriteParam(m, p.url); - WriteParam(m, p.method); - WriteParam(m, p.referrer); - WriteParam(m, p.extra_request_headers); - WriteParam(m, p.upload_data); - WriteParam(m, p.resource_type); - WriteParam(m, p.load_flags); - } - static bool Read(const Message* m, void** iter, param_type* p) { - return ReadParam(m, iter, &p->url) && - ReadParam(m, iter, &p->method) && - ReadParam(m, iter, &p->referrer) && - ReadParam(m, iter, &p->extra_request_headers) && - ReadParam(m, iter, &p->upload_data) && - ReadParam(m, iter, &p->resource_type) && - ReadParam(m, iter, &p->load_flags); - } - static void Log(const param_type& p, std::string* l) { - l->append("("); - LogParam(p.url, l); - l->append(", "); - LogParam(p.method, l); - l->append(", "); - LogParam(p.referrer, l); - l->append(", "); - LogParam(p.extra_request_headers, l); - l->append(", "); - LogParam(p.upload_data, l); - l->append(", "); - LogParam(p.resource_type, l); - l->append(", "); - LogParam(p.load_flags, l); - l->append(")"); - } + static void Write(Message* m, const param_type& p); + static bool Read(const Message* m, void** iter, param_type* p); + static void Log(const param_type& p, std::string* l); }; struct AutomationURLResponse { + AutomationURLResponse(); + AutomationURLResponse(const std::string& mime_type, + const std::string& headers, + int64 content_length, + const base::Time& last_modified, + const std::string& redirect_url, + int redirect_status); + ~AutomationURLResponse(); + std::string mime_type; std::string headers; int64 content_length; @@ -359,40 +198,25 @@ struct AutomationURLResponse { template <> struct ParamTraits<AutomationURLResponse> { typedef AutomationURLResponse param_type; - static void Write(Message* m, const param_type& p) { - WriteParam(m, p.mime_type); - WriteParam(m, p.headers); - WriteParam(m, p.content_length); - WriteParam(m, p.last_modified); - WriteParam(m, p.redirect_url); - WriteParam(m, p.redirect_status); - } - static bool Read(const Message* m, void** iter, param_type* p) { - return ReadParam(m, iter, &p->mime_type) && - ReadParam(m, iter, &p->headers) && - ReadParam(m, iter, &p->content_length) && - ReadParam(m, iter, &p->last_modified) && - ReadParam(m, iter, &p->redirect_url) && - ReadParam(m, iter, &p->redirect_status); - } - static void Log(const param_type& p, std::string* l) { - l->append("("); - LogParam(p.mime_type, l); - l->append(", "); - LogParam(p.headers, l); - l->append(", "); - LogParam(p.content_length, l); - l->append(", "); - LogParam(p.last_modified, l); - l->append(", "); - LogParam(p.redirect_url, l); - l->append(", "); - LogParam(p.redirect_status, l); - l->append(")"); - } + static void Write(Message* m, const param_type& p); + static bool Read(const Message* m, void** iter, param_type* p); + static void Log(const param_type& p, std::string* l); }; struct ExternalTabSettings { + ExternalTabSettings(); + ExternalTabSettings(gfx::NativeWindow parent, + const gfx::Rect& dimensions, + unsigned int style, + bool is_off_the_record, + bool load_requests_via_automation, + bool handle_top_level_requests, + const GURL& initial_url, + const GURL& referrer, + bool infobars_enabled, + bool route_all_top_level_navigations); + ~ExternalTabSettings(); + gfx::NativeWindow parent; gfx::Rect dimensions; unsigned int style; @@ -409,56 +233,24 @@ struct ExternalTabSettings { template <> struct ParamTraits<ExternalTabSettings> { typedef ExternalTabSettings param_type; - static void Write(Message* m, const param_type& p) { - WriteParam(m, p.parent); - WriteParam(m, p.dimensions); - WriteParam(m, p.style); - WriteParam(m, p.is_off_the_record); - WriteParam(m, p.load_requests_via_automation); - WriteParam(m, p.handle_top_level_requests); - WriteParam(m, p.initial_url); - WriteParam(m, p.referrer); - WriteParam(m, p.infobars_enabled); - WriteParam(m, p.route_all_top_level_navigations); - } - static bool Read(const Message* m, void** iter, param_type* p) { - return ReadParam(m, iter, &p->parent) && - ReadParam(m, iter, &p->dimensions) && - ReadParam(m, iter, &p->style) && - ReadParam(m, iter, &p->is_off_the_record) && - ReadParam(m, iter, &p->load_requests_via_automation) && - ReadParam(m, iter, &p->handle_top_level_requests) && - ReadParam(m, iter, &p->initial_url) && - ReadParam(m, iter, &p->referrer) && - ReadParam(m, iter, &p->infobars_enabled) && - ReadParam(m, iter, &p->route_all_top_level_navigations); - } - static void Log(const param_type& p, std::string* l) { - l->append("("); - LogParam(p.parent, l); - l->append(", "); - LogParam(p.dimensions, l); - l->append(", "); - LogParam(p.style, l); - l->append(", "); - LogParam(p.is_off_the_record, l); - l->append(", "); - LogParam(p.load_requests_via_automation, l); - l->append(", "); - LogParam(p.handle_top_level_requests, l); - l->append(", "); - LogParam(p.initial_url, l); - l->append(", "); - LogParam(p.referrer, l); - l->append(", "); - LogParam(p.infobars_enabled, l); - l->append(", "); - LogParam(p.route_all_top_level_navigations, l); - l->append(")"); - } + static void Write(Message* m, const param_type& p); + static bool Read(const Message* m, void** iter, param_type* p); + static void Log(const param_type& p, std::string* l); }; struct NavigationInfo { + NavigationInfo(); + NavigationInfo(int navigation_type, + int relative_offset, + int navigation_index, + const std::wstring& title, + const GURL& url, + const GURL& referrer, + SecurityStyle security_style, + bool displayed_insecure_content, + bool ran_insecure_content); + ~NavigationInfo(); + int navigation_type; int relative_offset; int navigation_index; @@ -474,53 +266,23 @@ struct NavigationInfo { template <> struct ParamTraits<NavigationInfo> { typedef NavigationInfo param_type; - static void Write(Message* m, const param_type& p) { - WriteParam(m, p.navigation_type); - WriteParam(m, p.relative_offset); - WriteParam(m, p.navigation_index); - WriteParam(m, p.title); - WriteParam(m, p.url); - WriteParam(m, p.referrer); - WriteParam(m, p.security_style); - WriteParam(m, p.displayed_insecure_content); - WriteParam(m, p.ran_insecure_content); - } - static bool Read(const Message* m, void** iter, param_type* p) { - return ReadParam(m, iter, &p->navigation_type) && - ReadParam(m, iter, &p->relative_offset) && - ReadParam(m, iter, &p->navigation_index) && - ReadParam(m, iter, &p->title) && - ReadParam(m, iter, &p->url) && - ReadParam(m, iter, &p->referrer) && - ReadParam(m, iter, &p->security_style) && - ReadParam(m, iter, &p->displayed_insecure_content) && - ReadParam(m, iter, &p->ran_insecure_content); - } - static void Log(const param_type& p, std::string* l) { - l->append("("); - LogParam(p.navigation_type, l); - l->append(", "); - LogParam(p.relative_offset, l); - l->append(", "); - LogParam(p.navigation_index, l); - l->append(", "); - LogParam(p.title, l); - l->append(", "); - LogParam(p.url, l); - l->append(", "); - LogParam(p.referrer, l); - l->append(", "); - LogParam(p.security_style, l); - l->append(", "); - LogParam(p.displayed_insecure_content, l); - l->append(", "); - LogParam(p.ran_insecure_content, l); - l->append(")"); - } + static void Write(Message* m, const param_type& p); + static bool Read(const Message* m, void** iter, param_type* p); + static void Log(const param_type& p, std::string* l); }; // A stripped down version of ContextMenuParams in webkit/glue/context_menu.h. struct MiniContextMenuParams { + MiniContextMenuParams(); + MiniContextMenuParams(int screen_x, + int screen_y, + const GURL& link_url, + const GURL& unfiltered_link_url, + const GURL& src_url, + const GURL& page_url, + const GURL& frame_url); + ~MiniContextMenuParams(); + // The x coordinate for displaying the menu. int screen_x; @@ -552,44 +314,21 @@ struct MiniContextMenuParams { template <> struct ParamTraits<MiniContextMenuParams> { typedef MiniContextMenuParams param_type; - static void Write(Message* m, const param_type& p) { - WriteParam(m, p.screen_x); - WriteParam(m, p.screen_y); - WriteParam(m, p.link_url); - WriteParam(m, p.unfiltered_link_url); - WriteParam(m, p.src_url); - WriteParam(m, p.page_url); - WriteParam(m, p.frame_url); - } - static bool Read(const Message* m, void** iter, param_type* p) { - return ReadParam(m, iter, &p->screen_x) && - ReadParam(m, iter, &p->screen_y) && - ReadParam(m, iter, &p->link_url) && - ReadParam(m, iter, &p->unfiltered_link_url) && - ReadParam(m, iter, &p->src_url) && - ReadParam(m, iter, &p->page_url) && - ReadParam(m, iter, &p->frame_url); - } - static void Log(const param_type& p, std::string* l) { - l->append("("); - LogParam(p.screen_x, l); - l->append(", "); - LogParam(p.screen_y, l); - l->append(", "); - LogParam(p.link_url, l); - l->append(", "); - LogParam(p.unfiltered_link_url, l); - l->append(", "); - LogParam(p.src_url, l); - l->append(", "); - LogParam(p.page_url, l); - l->append(", "); - LogParam(p.frame_url, l); - l->append(")"); - } + static void Write(Message* m, const param_type& p); + static bool Read(const Message* m, void** iter, param_type* p); + static void Log(const param_type& p, std::string* l); }; struct AttachExternalTabParams { + AttachExternalTabParams(); + AttachExternalTabParams(uint64 cookie, + const GURL& url, + const gfx::Rect& dimensions, + int disposition, + bool user_gesture, + const std::string& profile_name); + ~AttachExternalTabParams(); + uint64 cookie; GURL url; gfx::Rect dimensions; @@ -601,39 +340,9 @@ struct AttachExternalTabParams { template <> struct ParamTraits<AttachExternalTabParams> { typedef AttachExternalTabParams param_type; - static void Write(Message* m, const param_type& p) { - WriteParam(m, p.cookie); - WriteParam(m, p.url); - WriteParam(m, p.dimensions); - WriteParam(m, p.disposition); - WriteParam(m, p.user_gesture); - WriteParam(m, p.profile_name); - } - - static bool Read(const Message* m, void** iter, param_type* p) { - return ReadParam(m, iter, &p->cookie) && - ReadParam(m, iter, &p->url) && - ReadParam(m, iter, &p->dimensions) && - ReadParam(m, iter, &p->disposition) && - ReadParam(m, iter, &p->user_gesture) && - ReadParam(m, iter, &p->profile_name); - } - - static void Log(const param_type& p, std::string* l) { - l->append("("); - LogParam(p.cookie, l); - l->append(", "); - LogParam(p.url, l); - l->append(", "); - LogParam(p.dimensions, l); - l->append(", "); - LogParam(p.disposition, l); - l->append(", "); - LogParam(p.user_gesture, l); - l->append(","); - LogParam(p.profile_name, l); - l->append(")"); - } + static void Write(Message* m, const param_type& p); + static bool Read(const Message* m, void** iter, param_type* p); + static void Log(const param_type& p, std::string* l); }; } // namespace IPC diff --git a/chrome/common/pref_store.cc b/chrome/common/pref_store.cc new file mode 100644 index 0000000..47e7c38 --- /dev/null +++ b/chrome/common/pref_store.cc @@ -0,0 +1,9 @@ +// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/common/pref_store.h" + +bool PrefStore::IsInitializationComplete() const { + return true; +} diff --git a/chrome/common/pref_store.h b/chrome/common/pref_store.h index 745eff7..35818a0 100644 --- a/chrome/common/pref_store.h +++ b/chrome/common/pref_store.h @@ -50,7 +50,7 @@ class PrefStore { virtual void RemoveObserver(Observer* observer) {} // Whether the store has completed all asynchronous initialization. - virtual bool IsInitializationComplete() const { return true; } + virtual bool IsInitializationComplete() const; // Get the value for a given preference |key| and stores it in |result|. // |result| is only modified if the return value is READ_OK. Ownership of the diff --git a/chrome/test/automation/automation_proxy_uitest.cc b/chrome/test/automation/automation_proxy_uitest.cc index f25ce10..76c22d5 100644 --- a/chrome/test/automation/automation_proxy_uitest.cc +++ b/chrome/test/automation/automation_proxy_uitest.cc @@ -637,6 +637,10 @@ ExternalTabUITestMockClient::ExternalTabUITestMockClient(int execution_timeout) host_window_(NULL) { } +ExternalTabUITestMockClient::~ExternalTabUITestMockClient() { + EXPECT_TRUE(host_window_ == NULL); +} + void ExternalTabUITestMockClient::ReplyStarted( const IPC::AutomationURLResponse* response, int tab_handle, int request_id) { @@ -661,7 +665,8 @@ void ExternalTabUITestMockClient::ReplyEnd(const URLRequestStatus& status, } void ExternalTabUITestMockClient::Reply404(int tab_handle, int request_id) { - const IPC::AutomationURLResponse notfound = {"", "HTTP/1.1 404\r\n\r\n"}; + const IPC::AutomationURLResponse notfound("", "HTTP/1.1 404\r\n\r\n", 0, + base::Time(), "", 0); ReplyStarted(¬found, tab_handle, request_id); ReplyEOF(tab_handle, request_id); } @@ -708,18 +713,25 @@ void ExternalTabUITestMockClient::InvalidateHandle( } // Most of the time we need external tab with these settings. -const IPC::ExternalTabSettings ExternalTabUITestMockClient::default_settings = { - NULL, gfx::Rect(), // will be replaced by CreateHostWindowAndTab - WS_CHILD | WS_VISIBLE, - false, // is_off_the_record - true, // load_requests_via_automation - true, // handle_top_level_requests - GURL() // initial_url -}; +const IPC::ExternalTabSettings ExternalTabUITestMockClient::default_settings( + NULL, gfx::Rect(), // will be replaced by CreateHostWindowAndTab + WS_CHILD | WS_VISIBLE, + false, // is_off_the_record + true, // load_requests_via_automation + true, // handle_top_level_requests + GURL(), // initial_url + GURL(), // referrer + false, // infobars_enabled + false); // route_all_top_level_navigations // static -const IPC::AutomationURLResponse ExternalTabUITestMockClient::http_200 = - {"", "HTTP/0.9 200\r\n\r\n", }; +const IPC::AutomationURLResponse ExternalTabUITestMockClient::http_200( + "", + "HTTP/0.9 200\r\n\r\n", + 0, + base::Time(), + "", + 0); void ExternalTabUITestMockClient::OnMessageReceived(const IPC::Message& msg) { IPC_BEGIN_MESSAGE_MAP(ExternalTabUITestMockClient, msg) @@ -1102,7 +1114,6 @@ TEST_F(ExternalTabUITest, FLAKY_HostNetworkStackAbortRequest) { .Times(testing::AnyNumber()); std::string url = "http://placetogo.org"; - const IPC::AutomationURLResponse http_200 = {"", "HTTP/0.9 200\r\n\r\n", }; testing::InSequence sequence; EXPECT_CALL(*mock_, OnRequestStart(1, 2, testing::AllOf( @@ -1112,7 +1123,8 @@ TEST_F(ExternalTabUITest, FLAKY_HostNetworkStackAbortRequest) { // We can simply do CreateFunctor(1, 2, &http_200) since we know the // tab handle and request id, but using WithArgs<> is much more fancy :) .WillOnce(testing::WithArgs<0, 1>(testing::Invoke(CreateFunctor(mock_, - &ExternalTabUITestMockClient::ReplyStarted, &http_200)))); + &ExternalTabUITestMockClient::ReplyStarted, + &ExternalTabUITestMockClient::http_200)))); // Return some trivial page, that have a link to a "logo.gif" image const std::string data = "<!DOCTYPE html><title>Hello"; @@ -1145,7 +1157,6 @@ TEST_F(ExternalTabUITest, FLAKY_HostNetworkStackUnresponsiveRenderer) { EXPECT_CALL(*mock_, OnLoad(_, _)).Times(testing::AnyNumber()); std::string url = "http://placetogo.org"; - const IPC::AutomationURLResponse http_200 = {"", "HTTP/0.9 200\r\n\r\n", }; EXPECT_CALL(*mock_, OnRequestStart(1, 3, testing::_)) .Times(testing::AnyNumber()); @@ -1159,7 +1170,8 @@ TEST_F(ExternalTabUITest, FLAKY_HostNetworkStackUnresponsiveRenderer) { // We can simply do CreateFunctor(1, 2, &http_200) since we know the // tab handle and request id, but using WithArgs<> is much more fancy :) .WillOnce(testing::WithArgs<0, 1>(testing::Invoke(CreateFunctor(mock_, - &ExternalTabUITestMockClient::ReplyStarted, &http_200)))); + &ExternalTabUITestMockClient::ReplyStarted, + &ExternalTabUITestMockClient::http_200)))); const std::string head = "<html><title>Hello</title><body>"; diff --git a/chrome/test/automation/automation_proxy_uitest.h b/chrome/test/automation/automation_proxy_uitest.h index 55da8cc..1f2c9f3 100644 --- a/chrome/test/automation/automation_proxy_uitest.h +++ b/chrome/test/automation/automation_proxy_uitest.h @@ -35,9 +35,7 @@ class AutomationProxyVisibleTest : public UITest { class ExternalTabUITestMockClient : public AutomationProxy { public: explicit ExternalTabUITestMockClient(int execution_timeout); - ~ExternalTabUITestMockClient() { - EXPECT_TRUE(host_window_ == NULL); - } + virtual ~ExternalTabUITestMockClient(); MOCK_METHOD2(OnDidNavigate, void(int tab_handle, const IPC::NavigationInfo& nav_info)); diff --git a/chrome_frame/cfproxy_test.cc b/chrome_frame/cfproxy_test.cc index 3a99b92..ab615f7 100644 --- a/chrome_frame/cfproxy_test.cc +++ b/chrome_frame/cfproxy_test.cc @@ -432,8 +432,8 @@ TEST(Deserialize, DispatchTabMessage) { // Tuple3<int, int, IPC::NavigationInfo> int flags = 2; - IPC::NavigationInfo ni = {2, 3, 4, L"title", url, - ref, SECURITY_STYLE_AUTHENTICATION_BROKEN, true, true}; + IPC::NavigationInfo ni(2, 3, 4, L"title", url, + ref, SECURITY_STYLE_AUTHENTICATION_BROKEN, true, true); AutomationMsg_NavigationStateChanged m1(0, 1, flags, ni); EXPECT_CALL(delegate, NavigationStateChanged(flags, EqNavigationInfo(ni))); EXPECT_TRUE(DispatchTabMessageToDelegate(&delegate, m1)); @@ -486,9 +486,9 @@ TEST(Deserialize, DispatchTabMessage) { EXPECT_TRUE(DispatchTabMessageToDelegate(&delegate, m9)); // Tuple4<int, HANDLE, int, IPC::ContextMenuParams> - IPC::MiniContextMenuParams ctxmenu = { 711, 512, GURL("http://link_src"), + IPC::MiniContextMenuParams ctxmenu(711, 512, GURL("http://link_src"), GURL("http://unfiltered_link_url"), GURL("http://src_url"), - GURL("http://page_url"), GURL("http://frame_url") }; + GURL("http://page_url"), GURL("http://frame_url")); AutomationMsg_ForwardContextMenuToExternalHost m10(0, 1, HANDLE(7), 4, ctxmenu); EXPECT_CALL(delegate, HandleContextMenu(HANDLE(7), 4, @@ -496,8 +496,8 @@ TEST(Deserialize, DispatchTabMessage) { EXPECT_TRUE(DispatchTabMessageToDelegate(&delegate, m10)); // Tuple3<int, int, IPC::AutomationURLRequest> - IPC::AutomationURLRequest url_request = {"url", "post", "referer", - "extra_headers", 0, 3 }; + IPC::AutomationURLRequest url_request("url", "post", "referer", + "extra_headers", 0, 3, 0); AutomationMsg_RequestStart m11(0, 1, 7, url_request); EXPECT_CALL(delegate, Network_Start(7, EqURLRequest(url_request))); EXPECT_TRUE(DispatchTabMessageToDelegate(&delegate, m11)); @@ -523,8 +523,9 @@ TEST(Deserialize, DispatchTabMessage) { EXPECT_TRUE(DispatchTabMessageToDelegate(&delegate, m15)); // Tuple2<int, IPC::AttachExternalTabParams> - IPC::AttachExternalTabParams ext_tab = { 0xFEDCBA0987654321i64, url, - gfx::Rect(6, 9, 123, 999), 1, false, "theprofile" }; + IPC::AttachExternalTabParams ext_tab(0xFEDCBA0987654321i64, url, + gfx::Rect(6, 9, 123, 999), 1, + false, "theprofile"); AutomationMsg_AttachExternalTab m16(0, 1, ext_tab); EXPECT_CALL(delegate, AttachTab(EqAttachExternalTab(ext_tab))); EXPECT_TRUE(DispatchTabMessageToDelegate(&delegate, m16)); diff --git a/chrome_frame/chrome_frame_automation.cc b/chrome_frame/chrome_frame_automation.cc index 7294e6f..e0cab31 100644 --- a/chrome_frame/chrome_frame_automation.cc +++ b/chrome_frame/chrome_frame_automation.cc @@ -952,19 +952,18 @@ void ChromeFrameAutomationClient::CreateExternalTab() { navigate_after_initialization_ = false; } - const IPC::ExternalTabSettings settings = { - m_hWnd, - gfx::Rect(), - WS_CHILD, - chrome_launch_params_->incognito(), - !use_chrome_network_, - handle_top_level_requests_, - chrome_launch_params_->url(), - chrome_launch_params_->referrer(), - // Infobars disabled in widget mode. - !chrome_launch_params_->widget_mode(), - chrome_launch_params_->route_all_top_level_navigations(), - }; + const IPC::ExternalTabSettings settings( + m_hWnd, + gfx::Rect(), + WS_CHILD, + chrome_launch_params_->incognito(), + !use_chrome_network_, + handle_top_level_requests_, + chrome_launch_params_->url(), + chrome_launch_params_->referrer(), + // Infobars disabled in widget mode. + !chrome_launch_params_->widget_mode(), + chrome_launch_params_->route_all_top_level_navigations()); THREAD_SAFE_UMA_HISTOGRAM_CUSTOM_COUNTS( "ChromeFrame.HostNetworking", !use_chrome_network_, 0, 1, 2); @@ -1441,14 +1440,13 @@ void ChromeFrameAutomationClient::OnResponseStarted(int request_id, const char* mime_type, const char* headers, int size, base::Time last_modified, const std::string& redirect_url, int redirect_status) { - const IPC::AutomationURLResponse response = { + const IPC::AutomationURLResponse response( mime_type, headers ? headers : "", size, last_modified, redirect_url, - redirect_status - }; + redirect_status); automation_server_->Send(new AutomationMsg_RequestStarted(0, tab_->handle(), request_id, response)); diff --git a/chrome_frame/test/url_request_test.cc b/chrome_frame/test/url_request_test.cc index 127bec2..95b8969 100644 --- a/chrome_frame/test/url_request_test.cc +++ b/chrome_frame/test/url_request_test.cc @@ -260,9 +260,9 @@ TEST(UrlmonUrlRequestManagerTest, Simple1) { scoped_ptr<UrlmonUrlRequestManager> mgr(new UrlmonUrlRequestManager()); mgr->set_delegate(&mock); - IPC::AutomationURLRequest r1 = { + IPC::AutomationURLRequest r1( WideToUTF8(mock_server.Resolve(L"chrome_frame_window_open.html")), - "get" }; + "get", "", "", NULL, 0, 0); EXPECT_CALL(mock, OnResponseStarted(1, testing::_, testing::_, testing::_, testing::_, testing::_, testing::_)) @@ -293,9 +293,9 @@ TEST(UrlmonUrlRequestManagerTest, Abort1) { scoped_ptr<UrlmonUrlRequestManager> mgr(new UrlmonUrlRequestManager()); mgr->set_delegate(&mock); - IPC::AutomationURLRequest r1 = { + IPC::AutomationURLRequest r1( WideToUTF8(mock_server.Resolve(L"chrome_frame_window_open.html")), - "get" }; + "get", "", "", NULL, 0, 0); EXPECT_CALL(mock, OnResponseStarted(1, testing::_, testing::_, testing::_, testing::_, testing::_, testing::_)) @@ -314,4 +314,3 @@ TEST(UrlmonUrlRequestManagerTest, Abort1) { loop.RunFor(kChromeFrameLongNavigationTimeoutInSeconds); mgr.reset(); } - diff --git a/gfx/canvas.cc b/gfx/canvas.cc new file mode 100644 index 0000000..28e6a8a --- /dev/null +++ b/gfx/canvas.cc @@ -0,0 +1,17 @@ +// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "gfx/canvas.h" + +namespace gfx { + +CanvasSkia* Canvas::AsCanvasSkia() { + return NULL; +} + +const CanvasSkia* Canvas::AsCanvasSkia() const { + return NULL; +} + +} // namespace gfx; diff --git a/gfx/canvas.h b/gfx/canvas.h index c68cdab..b64c926 100644 --- a/gfx/canvas.h +++ b/gfx/canvas.h @@ -210,8 +210,8 @@ class Canvas { // TODO(beng): remove this once we don't need to use any skia-specific methods // through this interface. // A quick and dirty way to obtain the underlying SkCanvas. - virtual CanvasSkia* AsCanvasSkia() { return NULL; } - virtual const CanvasSkia* AsCanvasSkia() const { return NULL; } + virtual CanvasSkia* AsCanvasSkia(); + virtual const CanvasSkia* AsCanvasSkia() const; }; class CanvasPaint { diff --git a/gfx/gfx.gyp b/gfx/gfx.gyp index 706f9ba..76aea87 100644 --- a/gfx/gfx.gyp +++ b/gfx/gfx.gyp @@ -88,6 +88,7 @@ 'blit.cc', 'blit.h', 'brush.h', + 'canvas.cc', 'canvas.h', 'canvas_skia.h', 'canvas_skia.cc', diff --git a/webkit/glue/plugins/webplugin_impl.cc b/webkit/glue/plugins/webplugin_impl.cc index 3891563..666775b 100644 --- a/webkit/glue/plugins/webplugin_impl.cc +++ b/webkit/glue/plugins/webplugin_impl.cc @@ -562,6 +562,10 @@ void WebPluginImpl::SetWindow(gfx::PluginWindowHandle window) { #endif } +void WebPluginImpl::SetAcceptsInputEvents(bool accepts) { + accepts_input_events_ = accepts; +} + void WebPluginImpl::WillDestroyWindow(gfx::PluginWindowHandle window) { DCHECK_EQ(window, window_); window_ = gfx::kNullPluginWindow; @@ -623,6 +627,10 @@ bool WebPluginImpl::SetPostData(WebURLRequest* request, return rv; } +WebPluginDelegate* WebPluginImpl::delegate() { + return delegate_; +} + bool WebPluginImpl::IsValidUrl(const GURL& url, Referrer referrer_flag) { if (referrer_flag == PLUGIN_SRC && mime_type_ == "application/x-shockwave-flash" && @@ -1250,6 +1258,10 @@ void WebPluginImpl::SetDeferResourceLoading(unsigned long resource_id, } } +bool WebPluginImpl::IsOffTheRecord() { + return false; +} + void WebPluginImpl::HandleHttpMultipartResponse( const WebURLResponse& response, WebPluginResourceClient* client) { std::string multipart_boundary; diff --git a/webkit/glue/plugins/webplugin_impl.h b/webkit/glue/plugins/webplugin_impl.h index d319df1..27a692b 100644 --- a/webkit/glue/plugins/webplugin_impl.h +++ b/webkit/glue/plugins/webplugin_impl.h @@ -60,7 +60,7 @@ class WebPluginImpl : public WebPlugin, const char* buf, uint32 length); - virtual WebPluginDelegate* delegate() { return delegate_; } + virtual WebPluginDelegate* delegate(); private: // WebKit::WebPlugin methods: @@ -105,9 +105,7 @@ class WebPluginImpl : public WebPlugin, // WebPlugin implementation: virtual void SetWindow(gfx::PluginWindowHandle window); - virtual void SetAcceptsInputEvents(bool accepts) { - accepts_input_events_ = accepts; - } + virtual void SetAcceptsInputEvents(bool accepts); virtual void WillDestroyWindow(gfx::PluginWindowHandle window); #if defined(OS_WIN) void SetWindowlessPumpEvent(HANDLE pump_messages_event) { } @@ -237,7 +235,7 @@ class WebPluginImpl : public WebPlugin, virtual void SetDeferResourceLoading(unsigned long resource_id, bool defer); // Ignore in-process plugins mode for this flag. - virtual bool IsOffTheRecord() { return false; } + virtual bool IsOffTheRecord(); // Handles HTTP multipart responses, i.e. responses received with a HTTP // status code of 206. diff --git a/webkit/glue/plugins/webplugin_print_delegate.cc b/webkit/glue/plugins/webplugin_print_delegate.cc new file mode 100644 index 0000000..07bf9b8 --- /dev/null +++ b/webkit/glue/plugins/webplugin_print_delegate.cc @@ -0,0 +1,26 @@ +// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "webkit/glue/plugins/webplugin_print_delegate.h" + +namespace webkit_glue { + +bool WebPluginPrintDelegate::PrintSupportsPrintExtension() { + return false; +} + +int WebPluginPrintDelegate::PrintBegin(const gfx::Rect& printable_area, + int printer_dpi) { + return 0; +} + +bool WebPluginPrintDelegate::PrintPage(int page_number, + WebKit::WebCanvas* canvas) { + return false; +} + +void WebPluginPrintDelegate::PrintEnd() { +} + +} // namespace webkit_glue diff --git a/webkit/glue/plugins/webplugin_print_delegate.h b/webkit/glue/plugins/webplugin_print_delegate.h index 040e58f..24298e8 100644 --- a/webkit/glue/plugins/webplugin_print_delegate.h +++ b/webkit/glue/plugins/webplugin_print_delegate.h @@ -7,6 +7,7 @@ #include "base/basictypes.h" #include "third_party/npapi/bindings/npapi_extensions.h" +#include "third_party/WebKit/WebKit/chromium/public/WebCanvas.h" namespace gfx { class Rect; @@ -22,21 +23,14 @@ class WebPluginPrintDelegate { // If a plugin supports print extensions, then it gets to participate fully // in the browser's print workflow by specifying the number of pages to be // printed and providing a print output for specified pages. - virtual bool PrintSupportsPrintExtension() { - return false; - } + virtual bool PrintSupportsPrintExtension(); // Note: printable_area is in points (a point is 1/72 of an inch). - virtual int PrintBegin(const gfx::Rect& printable_area, int printer_dpi) { - return 0; - } + virtual int PrintBegin(const gfx::Rect& printable_area, int printer_dpi); - virtual bool PrintPage(int page_number, WebKit::WebCanvas* canvas) { - return false; - } + virtual bool PrintPage(int page_number, WebKit::WebCanvas* canvas); - virtual void PrintEnd() { - } + virtual void PrintEnd(); protected: WebPluginPrintDelegate() {} diff --git a/webkit/glue/webkit_glue.gypi b/webkit/glue/webkit_glue.gypi index 5292fbe..53ad0dd 100644 --- a/webkit/glue/webkit_glue.gypi +++ b/webkit/glue/webkit_glue.gypi @@ -313,6 +313,8 @@ 'plugins/webplugin_delegate_impl_win.cc', 'plugins/webplugin_impl.cc', 'plugins/webplugin_impl.h', + 'plugins/webplugin_print_delegate.cc', + 'plugins/webplugin_print_delegate.h', 'plugins/webplugininfo.cc', 'plugins/webplugininfo.h', 'alt_error_page_resource_fetcher.cc', |