diff options
author | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-28 02:09:33 +0000 |
---|---|---|
committer | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-28 02:09:33 +0000 |
commit | 53a0afa4218c19221e2df65b664a7d42f72fc2e0 (patch) | |
tree | 5655172bbc9f1d756c5d2c2cf65119679255715c | |
parent | f4d5e1ae2530667dc52bcce555e70e47bdc37371 (diff) | |
download | chromium_src-53a0afa4218c19221e2df65b664a7d42f72fc2e0.zip chromium_src-53a0afa4218c19221e2df65b664a7d42f72fc2e0.tar.gz chromium_src-53a0afa4218c19221e2df65b664a7d42f72fc2e0.tar.bz2 |
Move a few Chrome messages out of RenderViewHost. I added ChromeRenderViewHostObserver, to be the browser equivalent of the renderer's ChromeRenderViewObserver, where we have a place to dispatch RV messages specific to Chrome.
Review URL: http://codereview.chromium.org/6883177
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@83283 0039d316-1c4b-4281-b951-d872f2087c98
25 files changed, 156 insertions, 211 deletions
diff --git a/chrome/browser/automation/automation_provider.cc b/chrome/browser/automation/automation_provider.cc index 0239d65..4770701 100644 --- a/chrome/browser/automation/automation_provider.cc +++ b/chrome/browser/automation/automation_provider.cc @@ -83,6 +83,7 @@ #include "chrome/common/chrome_version_info.h" #include "chrome/common/extensions/extension.h" #include "chrome/common/pref_names.h" +#include "chrome/common/render_messages.h" #include "chrome/common/url_constants.h" #include "chrome/test/automation/tab_proxy.h" #include "content/browser/browser_thread.h" @@ -738,7 +739,8 @@ void AutomationProvider::JavaScriptStressTestControl(int tab_handle, return; } - view->JavaScriptStressTestControl(cmd, param); + view->Send(new ViewMsg_JavaScriptStressTestControl( + view->routing_id(), cmd, param)); } RenderViewHost* AutomationProvider::GetViewForTab(int tab_handle) { diff --git a/chrome/browser/automation/automation_provider_win.cc b/chrome/browser/automation/automation_provider_win.cc index b188c04..c764004 100644 --- a/chrome/browser/automation/automation_provider_win.cc +++ b/chrome/browser/automation/automation_provider_win.cc @@ -18,6 +18,7 @@ #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" #include "chrome/browser/ui/views/bookmarks/bookmark_bar_view.h" #include "chrome/common/automation_messages.h" +#include "chrome/common/render_messages.h" #include "content/browser/renderer_host/render_view_host.h" #include "content/browser/tab_contents/tab_contents.h" #include "content/common/page_zoom.h" @@ -421,7 +422,8 @@ void AutomationProvider::OnMessageFromExternalHost(int handle, if (!view_host) return; - view_host->ForwardMessageFromExternalHost(message, origin, target); + view_host->Send(new ViewMsg_HandleMessageFromExternalHost( + view_host->routing_id(), message, origin, target)); } void AutomationProvider::NavigateInExternalTab( diff --git a/chrome/browser/automation/testing_automation_provider.cc b/chrome/browser/automation/testing_automation_provider.cc index 615297d..65eb3a8 100644 --- a/chrome/browser/automation/testing_automation_provider.cc +++ b/chrome/browser/automation/testing_automation_provider.cc @@ -89,6 +89,7 @@ #include "chrome/common/extensions/extension_extent.h" #include "chrome/common/extensions/url_pattern.h" #include "chrome/common/pref_names.h" +#include "chrome/common/render_messages.h" #include "chrome/common/url_constants.h" #include "content/browser/renderer_host/render_process_host.h" #include "content/browser/renderer_host/render_view_host.h" @@ -5613,7 +5614,8 @@ void TestingAutomationProvider::LoadBlockedPlugins(int tab_handle, TabContents* contents = nav->tab_contents(); if (!contents) return; - contents->render_view_host()->LoadBlockedPlugins(); + RenderViewHost* host = contents->render_view_host(); + host->Send(new ViewMsg_LoadBlockedPlugins(host->routing_id())); *success = true; } } diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc index 4a1264d..4a6a335 100644 --- a/chrome/browser/chrome_content_browser_client.cc +++ b/chrome/browser/chrome_content_browser_client.cc @@ -11,6 +11,7 @@ #include "chrome/browser/printing/printing_message_filter.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/renderer_host/chrome_render_message_filter.h" +#include "chrome/browser/renderer_host/chrome_render_view_host_observer.h" #include "chrome/browser/search_engines/search_provider_install_state_message_filter.h" #include "chrome/browser/spellcheck_message_filter.h" #include "chrome/browser/ui/webui/chrome_web_ui_factory.h" @@ -21,6 +22,7 @@ namespace chrome { void ChromeContentBrowserClient::RenderViewHostCreated( RenderViewHost* render_view_host) { + new ChromeRenderViewHostObserver(render_view_host); new DesktopNotificationHandler(render_view_host); new DevToolsHandler(render_view_host); new ExtensionMessageHandler(render_view_host); diff --git a/chrome/browser/download/save_package.cc b/chrome/browser/download/save_package.cc index c120e83..2ed5739 100644 --- a/chrome/browser/download/save_package.cc +++ b/chrome/browser/download/save_package.cc @@ -993,9 +993,8 @@ void SavePackage::GetSerializedHtmlDataForCurrentPageWithLocalLinks() { // Get the relative directory name. FilePath relative_dir_name = saved_main_directory_path_.BaseName(); - tab_contents()->render_view_host()-> - GetSerializedHtmlDataForCurrentPageWithLocalLinks( - saved_links, saved_file_paths, relative_dir_name); + Send(new ViewMsg_GetSerializedHtmlDataForCurrentPageWithLocalLinks( + routing_id(), saved_links, saved_file_paths, relative_dir_name)); } // Process the serialized HTML content data of a specified web page @@ -1074,8 +1073,8 @@ void SavePackage::GetAllSavableResourceLinksForCurrentPage() { return; wait_state_ = RESOURCES_LIST; - tab_contents()->render_view_host()-> - GetAllSavableResourceLinksForCurrentPage(page_url_); + Send(new ViewMsg_GetAllSavableResourceLinksForCurrentPage(routing_id(), + page_url_)); } // Give backend the lists which contain all resource links that have local diff --git a/chrome/browser/extensions/extension_tabs_module.cc b/chrome/browser/extensions/extension_tabs_module.cc index 9c636ac..df2baf2 100644 --- a/chrome/browser/extensions/extension_tabs_module.cc +++ b/chrome/browser/extensions/extension_tabs_module.cc @@ -1129,10 +1129,11 @@ bool CaptureVisibleTabFunction::RunImpl() { return true; // Ask the renderer for a snapshot of the tab. - render_view_host->CaptureSnapshot(); + TabContentsWrapper* wrapper = browser->GetSelectedTabContentsWrapper(); + wrapper->CaptureSnapshot(); registrar_.Add(this, NotificationType::TAB_SNAPSHOT_TAKEN, - Source<RenderViewHost>(render_view_host)); + Source<TabContentsWrapper>(wrapper)); AddRef(); // Balanced in CaptureVisibleTabFunction::Observe(). return true; diff --git a/chrome/browser/favicon_handler.cc b/chrome/browser/favicon_handler.cc index 90d01bb..0ae2063 100644 --- a/chrome/browser/favicon_handler.cc +++ b/chrome/browser/favicon_handler.cc @@ -12,6 +12,7 @@ #include "base/memory/ref_counted_memory.h" #include "chrome/browser/bookmarks/bookmark_model.h" #include "chrome/browser/profiles/profile.h" +#include "chrome/common/icon_messages.h" #include "content/browser/renderer_host/render_view_host.h" #include "content/browser/tab_contents/navigation_controller.h" #include "content/browser/tab_contents/navigation_entry.h" @@ -250,8 +251,16 @@ NavigationEntry* FaviconHandler::GetEntry() { } int FaviconHandler::DownloadFavicon(const GURL& image_url, int image_size) { - return tab_contents()->render_view_host()->DownloadFavicon(image_url, - image_size); + if (!image_url.is_valid()) { + NOTREACHED(); + return 0; + } + static int next_id = 1; + int id = next_id++; + RenderViewHost* host = tab_contents()->render_view_host(); + host->Send(new IconMsg_DownloadFavicon( + host->routing_id(), id, image_url, image_size)); + return id; } void FaviconHandler::UpdateFaviconMappingAndFetch( diff --git a/chrome/browser/instant/instant_loader.cc b/chrome/browser/instant/instant_loader.cc index 6616b48..f83b50a 100644 --- a/chrome/browser/instant/instant_loader.cc +++ b/chrome/browser/instant/instant_loader.cc @@ -125,8 +125,9 @@ void InstantLoader::FrameLoadObserver::Observe( loader_->SendBoundsToPage(true); // TODO: support real cursor position. int text_length = static_cast<int>(text_.size()); - tab_contents_->render_view_host()->DetermineIfPageSupportsInstant( - text_, verbatim_, text_length, text_length); + RenderViewHost* host = tab_contents_->render_view_host(); + host->Send(new ViewMsg_DetermineIfPageSupportsInstant( + host->routing_id(), text_, verbatim_, text_length, text_length)); break; } default: @@ -680,8 +681,9 @@ bool InstantLoader::Update(TabContentsWrapper* tab_contents, } // TODO: support real cursor position. int text_length = static_cast<int>(user_text_.size()); - preview_contents_->render_view_host()->SearchBoxChange( - user_text_, verbatim, text_length, text_length); + RenderViewHost* host = preview_contents_->render_view_host(); + host->Send(new ViewMsg_SearchBoxChange( + host->routing_id(), user_text_, verbatim, text_length, text_length)); string16 complete_suggested_text_lower = l10n_util::ToLower( complete_suggested_text_); @@ -712,8 +714,9 @@ bool InstantLoader::Update(TabContentsWrapper* tab_contents, instant_url = GURL(cl->GetSwitchValueASCII(switches::kInstantURL)); preview_contents_->controller().LoadURL( instant_url, GURL(), transition_type); - preview_contents_->render_view_host()->SearchBoxChange( - user_text_, verbatim, 0, 0); + RenderViewHost* host = preview_contents_->render_view_host(); + host->Send(new ViewMsg_SearchBoxChange( + host->routing_id(), user_text_, verbatim, 0, 0)); frame_load_observer_.reset( new FrameLoadObserver(this, preview_contents()->tab_contents(), @@ -770,11 +773,14 @@ TabContentsWrapper* InstantLoader::ReleasePreviewContents( DCHECK(type == INSTANT_COMMIT_DESTROY || !frame_load_observer_.get()); if (type != INSTANT_COMMIT_DESTROY && is_showing_instant()) { - if (type == INSTANT_COMMIT_FOCUS_LOST) - preview_contents_->render_view_host()->SearchBoxCancel(); - else - preview_contents_->render_view_host()->SearchBoxSubmit( - user_text_, type == INSTANT_COMMIT_PRESSED_ENTER); + RenderViewHost* host = preview_contents_->render_view_host(); + if (type == INSTANT_COMMIT_FOCUS_LOST) { + host->Send(new ViewMsg_SearchBoxCancel(host->routing_id())); + } else { + host->Send(new ViewMsg_SearchBoxSubmit( + host->routing_id(), user_text_, + type == INSTANT_COMMIT_PRESSED_ENTER)); + } } omnibox_bounds_ = gfx::Rect(); last_omnibox_bounds_ = gfx::Rect(); @@ -965,8 +971,9 @@ void InstantLoader::SendBoundsToPage(bool force_if_waiting) { if (preview_contents_.get() && is_showing_instant() && (force_if_waiting || !is_waiting_for_load())) { last_omnibox_bounds_ = omnibox_bounds_; - preview_contents_->render_view_host()->SearchBoxResize( - GetOmniboxBoundsInTermsOfPreview()); + RenderViewHost*host = preview_contents_->render_view_host(); + host->Send(new ViewMsg_SearchBoxResize( + host->routing_id(), GetOmniboxBoundsInTermsOfPreview())); } } diff --git a/chrome/browser/plugin_installer_infobar_delegate.cc b/chrome/browser/plugin_installer_infobar_delegate.cc index 2eac72e..1fca1fb 100644 --- a/chrome/browser/plugin_installer_infobar_delegate.cc +++ b/chrome/browser/plugin_installer_infobar_delegate.cc @@ -6,6 +6,7 @@ #include "content/browser/renderer_host/render_view_host.h" #include "content/browser/tab_contents/tab_contents.h" +#include "content/common/view_messages.h" #include "grit/generated_resources.h" #include "grit/locale_settings.h" #include "grit/theme_resources.h" @@ -46,7 +47,8 @@ string16 PluginInstallerInfoBarDelegate::GetButtonLabel( } bool PluginInstallerInfoBarDelegate::Accept() { - tab_contents_->render_view_host()->InstallMissingPlugin(); + RenderViewHost* host = tab_contents_->render_view_host(); + host->Send(new ViewMsg_InstallMissingPlugin(host->routing_id())); return true; } diff --git a/chrome/browser/plugin_observer.cc b/chrome/browser/plugin_observer.cc index 248cf478..3026902 100644 --- a/chrome/browser/plugin_observer.cc +++ b/chrome/browser/plugin_observer.cc @@ -70,7 +70,8 @@ void PluginInfoBarDelegate::InfoBarClosed() { } bool PluginInfoBarDelegate::Cancel() { - tab_contents_->render_view_host()->LoadBlockedPlugins(); + tab_contents_->render_view_host()->Send(new ViewMsg_LoadBlockedPlugins( + tab_contents_->render_view_host()->routing_id())); return true; } diff --git a/chrome/browser/renderer_host/chrome_render_view_host_observer.cc b/chrome/browser/renderer_host/chrome_render_view_host_observer.cc new file mode 100644 index 0000000..bc68b84 --- /dev/null +++ b/chrome/browser/renderer_host/chrome_render_view_host_observer.cc @@ -0,0 +1,37 @@ +// Copyright (c) 2011 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/chrome_render_view_host_observer.h" + +#include "chrome/browser/dom_operation_notification_details.h" +#include "chrome/common/render_messages.h" +#include "content/common/notification_service.h" + +ChromeRenderViewHostObserver::ChromeRenderViewHostObserver( + RenderViewHost* render_view_host) + : RenderViewHostObserver(render_view_host) { +} + +ChromeRenderViewHostObserver::~ChromeRenderViewHostObserver() { +} + +bool ChromeRenderViewHostObserver::OnMessageReceived( + const IPC::Message& message) { + bool handled = true; + IPC_BEGIN_MESSAGE_MAP(ChromeRenderViewHostObserver, message) + IPC_MESSAGE_HANDLER(ViewHostMsg_DomOperationResponse, + OnDomOperationResponse) + IPC_MESSAGE_UNHANDLED(handled = false) + IPC_END_MESSAGE_MAP() + return handled; +} + +void ChromeRenderViewHostObserver::OnDomOperationResponse( + const std::string& json_string, int automation_id) { + DomOperationNotificationDetails details(json_string, automation_id); + NotificationService::current()->Notify( + NotificationType::DOM_OPERATION_RESPONSE, + Source<RenderViewHost>(render_view_host()), + Details<DomOperationNotificationDetails>(&details)); +} diff --git a/chrome/browser/renderer_host/chrome_render_view_host_observer.h b/chrome/browser/renderer_host/chrome_render_view_host_observer.h new file mode 100644 index 0000000..eac1b84d --- /dev/null +++ b/chrome/browser/renderer_host/chrome_render_view_host_observer.h @@ -0,0 +1,28 @@ +// Copyright (c) 2011 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. + +#ifndef CHROME_BROWSER_RENDERER_HOST_CHROME_RENDER_VIEW_HOST_OBSERVER_H_ +#define CHROME_BROWSER_RENDERER_HOST_CHROME_RENDER_VIEW_HOST_OBSERVER_H_ +#pragma once + +#include "content/browser/renderer_host/render_view_host_observer.h" + +// This class holds the Chrome specific parts of RenderViewHost, and has the +// same lifetime. +class ChromeRenderViewHostObserver : public RenderViewHostObserver { + public: + explicit ChromeRenderViewHostObserver(RenderViewHost* render_view_host); + virtual ~ChromeRenderViewHostObserver(); + + // RenderViewHostObserver overrides. + virtual bool OnMessageReceived(const IPC::Message& message); + + private: + void OnDomOperationResponse(const std::string& json_string, + int automation_id); + + DISALLOW_COPY_AND_ASSIGN(ChromeRenderViewHostObserver); +}; + +#endif // CHROME_BROWSER_RENDERER_HOST_CHROME_RENDER_VIEW_HOST_OBSERVER_H_ diff --git a/chrome/browser/ui/content_settings/content_setting_bubble_model.cc b/chrome/browser/ui/content_settings/content_setting_bubble_model.cc index b01b1b3..eaceb51 100644 --- a/chrome/browser/ui/content_settings/content_setting_bubble_model.cc +++ b/chrome/browser/ui/content_settings/content_setting_bubble_model.cc @@ -16,6 +16,7 @@ #include "chrome/browser/ui/collected_cookies_infobar_delegate.h" #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" #include "chrome/common/pref_names.h" +#include "chrome/common/render_messages.h" #include "content/browser/renderer_host/render_view_host.h" #include "content/browser/tab_contents/tab_contents.h" #include "content/browser/tab_contents/tab_contents_delegate.h" @@ -361,7 +362,8 @@ class ContentSettingPluginBubbleModel : public ContentSettingSingleRadioGroup { virtual void OnCustomLinkClicked() OVERRIDE { UserMetrics::RecordAction(UserMetricsAction("ClickToPlay_LoadAll_Bubble")); DCHECK(tab_contents()); - tab_contents()->render_view_host()->LoadBlockedPlugins(); + RenderViewHost* host = tab_contents()->render_view_host(); + host->Send(new ViewMsg_LoadBlockedPlugins(host->routing_id())); set_custom_link_enabled(false); tab_contents()->tab_contents()->GetTabSpecificContentSettings()-> set_load_plugins_link_enabled(false); diff --git a/chrome/browser/ui/tab_contents/tab_contents_wrapper.cc b/chrome/browser/ui/tab_contents/tab_contents_wrapper.cc index e217d12..7e9fe49 100644 --- a/chrome/browser/ui/tab_contents/tab_contents_wrapper.cc +++ b/chrome/browser/ui/tab_contents/tab_contents_wrapper.cc @@ -214,6 +214,10 @@ TabContentsWrapper* TabContentsWrapper::Clone() { return new_wrapper; } +void TabContentsWrapper::CaptureSnapshot() { + Send(new ViewMsg_CaptureSnapshot(routing_id())); +} + TabContentsWrapper* TabContentsWrapper::GetCurrentWrapperForContents( TabContents* contents) { TabContentsWrapper** wrapper = @@ -238,7 +242,8 @@ bool TabContentsWrapper::OnMessageReceived(const IPC::Message& message) { IPC_MESSAGE_HANDLER(ViewHostMsg_JSOutOfMemory, OnJSOutOfMemory) IPC_MESSAGE_HANDLER(ViewHostMsg_RegisterProtocolHandler, OnRegisterProtocolHandler) - IPC_MESSAGE_HANDLER(ViewHostMsg_Thumbnail, OnMsgThumbnail) + IPC_MESSAGE_HANDLER(ViewHostMsg_Thumbnail, OnThumbnail) + IPC_MESSAGE_HANDLER(ViewHostMsg_Snapshot, OnSnapshot) IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() return handled; @@ -318,9 +323,9 @@ void TabContentsWrapper::OnRegisterProtocolHandler(const std::string& protocol, } } -void TabContentsWrapper::OnMsgThumbnail(const GURL& url, - const ThumbnailScore& score, - const SkBitmap& bitmap) { +void TabContentsWrapper::OnThumbnail(const GURL& url, + const ThumbnailScore& score, + const SkBitmap& bitmap) { if (profile()->IsOffTheRecord()) return; @@ -330,6 +335,13 @@ void TabContentsWrapper::OnMsgThumbnail(const GURL& url, ts->SetPageThumbnail(url, bitmap, score); } +void TabContentsWrapper::OnSnapshot(const SkBitmap& bitmap) { + NotificationService::current()->Notify( + NotificationType::TAB_SNAPSHOT_TAKEN, + Source<TabContentsWrapper>(this), + Details<const SkBitmap>(&bitmap)); +} + void TabContentsWrapper::UpdateStarredStateForCurrentURL() { BookmarkModel* model = tab_contents()->profile()->GetBookmarkModel(); const bool old_state = is_starred_; diff --git a/chrome/browser/ui/tab_contents/tab_contents_wrapper.h b/chrome/browser/ui/tab_contents/tab_contents_wrapper.h index b802cf5..dc2072d 100644 --- a/chrome/browser/ui/tab_contents/tab_contents_wrapper.h +++ b/chrome/browser/ui/tab_contents/tab_contents_wrapper.h @@ -72,6 +72,9 @@ class TabContentsWrapper : public NotificationObserver, // heap-allocated pointer is owned by the caller. TabContentsWrapper* Clone(); + // Captures a snapshot of the page. + void CaptureSnapshot(); + // Helper to retrieve the existing instance that wraps a given TabContents. // Returns NULL if there is no such existing instance. // NOTE: This is not intended for general use. It is intended for situations @@ -160,9 +163,10 @@ class TabContentsWrapper : public NotificationObserver, void OnRegisterProtocolHandler(const std::string& protocol, const GURL& url, const string16& title); - void OnMsgThumbnail(const GURL& url, - const ThumbnailScore& score, - const SkBitmap& bitmap); + void OnThumbnail(const GURL& url, + const ThumbnailScore& score, + const SkBitmap& bitmap); + void OnSnapshot(const SkBitmap& bitmap); // Updates the starred state from the bookmark bar model. If the state has // changed, the delegate is notified. diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi index b5df721..1d52ea8 100644 --- a/chrome/chrome_browser.gypi +++ b/chrome/chrome_browser.gypi @@ -1696,6 +1696,8 @@ 'browser/remove_rows_table_model.h', 'browser/renderer_host/chrome_render_message_filter.cc', 'browser/renderer_host/chrome_render_message_filter.h', + 'browser/renderer_host/chrome_render_view_host_observer.cc', + 'browser/renderer_host/chrome_render_view_host_observer.h', 'browser/renderer_host/download_resource_handler.cc', 'browser/renderer_host/download_resource_handler.h', 'browser/renderer_host/download_throttling_resource_handler.cc', diff --git a/chrome/test/plugin/pdf_browsertest.cc b/chrome/test/plugin/pdf_browsertest.cc index d96ec87..53dd9af 100644 --- a/chrome/test/plugin/pdf_browsertest.cc +++ b/chrome/test/plugin/pdf_browsertest.cc @@ -9,6 +9,7 @@ #include "base/utf_string_conversions.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_window.h" +#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" #include "chrome/browser/ui/window_sizer.h" #include "chrome/common/chrome_paths.h" #include "chrome/test/in_process_browser_test.h" @@ -77,13 +78,11 @@ class PDFBrowserTest : public InProcessBrowserTest, void VerifySnapshot(const std::string& expected_filename) { snapshot_different_ = true; expected_filename_ = expected_filename; - RenderViewHost* host = - browser()->GetSelectedTabContents()->render_view_host(); - - host->CaptureSnapshot(); + TabContentsWrapper* wrapper = browser()->GetSelectedTabContentsWrapper(); + wrapper->CaptureSnapshot(); ui_test_utils::RegisterAndWait(this, NotificationType::TAB_SNAPSHOT_TAKEN, - Source<RenderViewHost>(host)); + Source<TabContentsWrapper>(wrapper)); ASSERT_FALSE(snapshot_different_) << "Rendering didn't match, see result " "at " << snapshot_filename_.value().c_str(); } diff --git a/content/browser/renderer_host/render_view_host.cc b/content/browser/renderer_host/render_view_host.cc index be3942b..2d661ed 100644 --- a/content/browser/renderer_host/render_view_host.cc +++ b/content/browser/renderer_host/render_view_host.cc @@ -15,15 +15,10 @@ #include "base/time.h" #include "base/utf_string_conversions.h" #include "base/values.h" -#include "chrome/browser/dom_operation_notification_details.h" #include "chrome/browser/net/predictor_api.h" #include "chrome/browser/profiles/profile.h" -#include "chrome/common/chrome_constants.h" #include "chrome/common/chrome_switches.h" -#include "chrome/common/icon_messages.h" #include "chrome/common/render_messages.h" -#include "chrome/common/translate_errors.h" -#include "chrome/common/url_constants.h" #include "content/browser/browser_message_filter.h" #include "content/browser/child_process_security_policy.h" #include "content/browser/content_browser_client.h" @@ -44,6 +39,7 @@ #include "content/common/notification_service.h" #include "content/common/notification_type.h" #include "content/common/result_codes.h" +#include "content/common/url_constants.h" #include "content/common/view_messages.h" #include "net/base/net_util.h" #include "net/url_request/url_request_context_getter.h" @@ -555,21 +551,6 @@ void RenderViewHost::SelectAll() { UserMetrics::RecordAction(UserMetricsAction("SelectAll")); } -int RenderViewHost::DownloadFavicon(const GURL& url, int image_size) { - if (!url.is_valid()) { - NOTREACHED(); - return 0; - } - static int next_id = 1; - int id = next_id++; - Send(new IconMsg_DownloadFavicon(routing_id(), id, url, image_size)); - return id; -} - -void RenderViewHost::CaptureSnapshot() { - Send(new ViewMsg_CaptureSnapshot(routing_id())); -} - void RenderViewHost::JavaScriptMessageBoxClosed(IPC::Message* reply_msg, bool success, const std::wstring& prompt) { @@ -663,14 +644,6 @@ void RenderViewHost::UpdateWebPreferences(const WebPreferences& prefs) { Send(new ViewMsg_UpdateWebPreferences(routing_id(), prefs)); } -void RenderViewHost::InstallMissingPlugin() { - Send(new ViewMsg_InstallMissingPlugin(routing_id())); -} - -void RenderViewHost::LoadBlockedPlugins() { - Send(new ViewMsg_LoadBlockedPlugins(routing_id())); -} - void RenderViewHost::FilesSelectedInChooser( const std::vector<FilePath>& files) { // Grant the security access requested to the given files. @@ -743,7 +716,6 @@ bool RenderViewHost::OnMessageReceived(const IPC::Message& msg) { IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateTitle, OnMsgUpdateTitle) IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateEncoding, OnMsgUpdateEncoding) IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateTargetURL, OnMsgUpdateTargetURL) - IPC_MESSAGE_HANDLER(ViewHostMsg_Snapshot, OnMsgScreenshot) IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateInspectorSetting, OnUpdateInspectorSetting) IPC_MESSAGE_HANDLER(ViewHostMsg_Close, OnMsgClose) @@ -760,8 +732,6 @@ bool RenderViewHost::OnMessageReceived(const IPC::Message& msg) { IPC_MESSAGE_HANDLER(ViewHostMsg_OpenURL, OnMsgOpenURL) IPC_MESSAGE_HANDLER(ViewHostMsg_DidContentsPreferredSizeChange, OnMsgDidContentsPreferredSizeChange) - IPC_MESSAGE_HANDLER(ViewHostMsg_DomOperationResponse, - OnMsgDomOperationResponse) IPC_MESSAGE_HANDLER(ViewHostMsg_ForwardMessageToExternalHost, OnMsgForwardMessageToExternalHost) IPC_MESSAGE_HANDLER(ViewHostMsg_SetTooltipText, OnMsgSetTooltipText) @@ -992,13 +962,6 @@ void RenderViewHost::OnMsgUpdateTargetURL(int32 page_id, Send(new ViewMsg_UpdateTargetURL_ACK(routing_id())); } -void RenderViewHost::OnMsgScreenshot(const SkBitmap& bitmap) { - NotificationService::current()->Notify( - NotificationType::TAB_SNAPSHOT_TAKEN, - Source<RenderViewHost>(this), - Details<const SkBitmap>(&bitmap)); -} - void RenderViewHost::OnUpdateInspectorSetting( const std::string& key, const std::string& value) { delegate_->UpdateInspectorSetting(key, value); @@ -1075,17 +1038,6 @@ void RenderViewHost::OnMsgDidContentsPreferredSizeChange( view->UpdatePreferredSize(new_size); } -void RenderViewHost::OnMsgDomOperationResponse( - const std::string& json_string, int automation_id) { - delegate_->DomOperationResponse(json_string, automation_id); - - // We also fire a notification for more loosely-coupled use cases. - DomOperationNotificationDetails details(json_string, automation_id); - NotificationService::current()->Notify( - NotificationType::DOM_OPERATION_RESPONSE, Source<RenderViewHost>(this), - Details<DomOperationNotificationDetails>(&details)); -} - void RenderViewHost::OnMsgForwardMessageToExternalHost( const std::string& message, const std::string& origin, const std::string& target) { @@ -1228,20 +1180,6 @@ void RenderViewHost::OnUserGesture() { delegate_->OnUserGesture(); } -void RenderViewHost::GetAllSavableResourceLinksForCurrentPage( - const GURL& page_url) { - Send(new ViewMsg_GetAllSavableResourceLinksForCurrentPage(routing_id(), - page_url)); -} - -void RenderViewHost::GetSerializedHtmlDataForCurrentPageWithLocalLinks( - const std::vector<GURL>& links, - const std::vector<FilePath>& local_paths, - const FilePath& local_directory_name) { - Send(new ViewMsg_GetSerializedHtmlDataForCurrentPageWithLocalLinks( - routing_id(), links, local_paths, local_directory_name)); -} - void RenderViewHost::OnMsgShouldCloseACK(bool proceed) { StopHangMonitorTimeout(); // If this renderer navigated while the beforeunload request was in flight, we @@ -1348,13 +1286,6 @@ void RenderViewHost::ForwardEditCommandsForNextKeyEvent( Send(new ViewMsg_SetEditCommandsForNextKeyEvent(routing_id(), edit_commands)); } -void RenderViewHost::ForwardMessageFromExternalHost(const std::string& message, - const std::string& origin, - const std::string& target) { - Send(new ViewMsg_HandleMessageFromExternalHost(routing_id(), message, origin, - target)); -} - void RenderViewHost::UpdateBrowserWindowId(int window_id) { Send(new ViewMsg_UpdateBrowserWindowId(routing_id(), window_id)); } @@ -1386,35 +1317,6 @@ void RenderViewHost::DidCancelPopupMenu() { } #endif -void RenderViewHost::SearchBoxChange(const string16& value, - bool verbatim, - int selection_start, - int selection_end) { - Send(new ViewMsg_SearchBoxChange( - routing_id(), value, verbatim, selection_start, selection_end)); -} - -void RenderViewHost::SearchBoxSubmit(const string16& value, - bool verbatim) { - Send(new ViewMsg_SearchBoxSubmit(routing_id(), value, verbatim)); -} - -void RenderViewHost::SearchBoxCancel() { - Send(new ViewMsg_SearchBoxCancel(routing_id())); -} - -void RenderViewHost::SearchBoxResize(const gfx::Rect& search_box_bounds) { - Send(new ViewMsg_SearchBoxResize(routing_id(), search_box_bounds)); -} - -void RenderViewHost::DetermineIfPageSupportsInstant(const string16& value, - bool verbatim, - int selection_start, - int selection_end) { - Send(new ViewMsg_DetermineIfPageSupportsInstant( - routing_id(), value, verbatim, selection_start, selection_end)); -} - void RenderViewHost::FilterURL(ChildProcessSecurityPolicy* policy, int renderer_id, GURL* url) { @@ -1436,10 +1338,6 @@ void RenderViewHost::FilterURL(ChildProcessSecurityPolicy* policy, } } -void RenderViewHost::JavaScriptStressTestControl(int cmd, int param) { - Send(new ViewMsg_JavaScriptStressTestControl(routing_id(), cmd, param)); -} - void RenderViewHost::OnAccessibilityNotifications( const std::vector<ViewHostMsg_AccessibilityNotification_Params>& params) { if (view()) diff --git a/content/browser/renderer_host/render_view_host.h b/content/browser/renderer_host/render_view_host.h index 281bfeb..904fe4c 100644 --- a/content/browser/renderer_host/render_view_host.h +++ b/content/browser/renderer_host/render_view_host.h @@ -278,14 +278,6 @@ class RenderViewHost : public RenderWidgetHost { void Delete(); void SelectAll(); - // Downloads an image notifying the favicon delegate appropriately. The - // returned integer uniquely identifies the download for the lifetime of the - // browser. - int DownloadFavicon(const GURL& url, int image_size); - - // Captures a snapshot of the page. - void CaptureSnapshot(); - // Notifies the RenderView that the JavaScript message that was shown was // closed by the user. void JavaScriptMessageBoxClosed(IPC::Message* reply_msg, @@ -348,17 +340,6 @@ class RenderViewHost : public RenderWidgetHost { // Update render view specific (WebKit) preferences. void UpdateWebPreferences(const WebPreferences& prefs); - // Request the Renderer to ask the default plugin to start installation of - // missing plugin. Called by PluginInstallerInfoBarDelegate. - void InstallMissingPlugin(); - - // Load all blocked plugins in the RenderView. - void LoadBlockedPlugins(); - - // Get all savable resource links from current webpage, include main - // frame and sub-frame. - void GetAllSavableResourceLinksForCurrentPage(const GURL& page_url); - // Get html data by serializing all frames of current page with lists // which contain all resource links that have local copy. // The parameter links contain original URLs of all saved links. @@ -388,11 +369,6 @@ class RenderViewHost : public RenderWidgetHost { sudden_termination_allowed_ = enabled; } - // Forward a message from external host to chrome renderer. - void ForwardMessageFromExternalHost(const std::string& message, - const std::string& origin, - const std::string& target); - // Message the renderer that we should be counted as a new document and not // as a popup. void DisassociateFromPopupCount(); @@ -450,26 +426,6 @@ class RenderViewHost : public RenderWidgetHost { void DidCancelPopupMenu(); #endif - // SearchBox notifications. - void SearchBoxChange(const string16& value, - bool verbatim, - int selection_start, - int selection_end); - void SearchBoxSubmit(const string16& value, - bool verbatim); - void SearchBoxCancel(); - void SearchBoxResize(const gfx::Rect& search_box_bounds); - void DetermineIfPageSupportsInstant(const string16& value, - bool verbatim, - int selection_start, - int selection_end); - - // Send a notification to the V8 JavaScript engine to change its parameters - // while performing stress testing. |cmd| is one of the values defined by - // |ViewHostMsg_JavaScriptStressTestControl_Commands|, which is defined - // in render_messages.h. - void JavaScriptStressTestControl(int cmd, int param); - #if defined(UNIT_TEST) // These functions shouldn't be necessary outside of testing. @@ -525,7 +481,6 @@ class RenderViewHost : public RenderWidgetHost { void OnMsgUpdateTitle(int32 page_id, const std::wstring& title); void OnMsgUpdateEncoding(const std::string& encoding); void OnMsgUpdateTargetURL(int32 page_id, const GURL& url); - void OnMsgScreenshot(const SkBitmap& bitmap); void OnMsgClose(); void OnMsgRequestMove(const gfx::Rect& pos); void OnMsgDidStartLoading(); @@ -533,17 +488,10 @@ class RenderViewHost : public RenderWidgetHost { void OnMsgDidChangeLoadProgress(double load_progress); void OnMsgDocumentAvailableInMainFrame(); void OnMsgDocumentOnLoadCompletedInMainFrame(int32 page_id); - void OnMsgUpdateFaviconURL(int32 page_id, const GURL& icon_url); - void OnMsgDidDownloadFavicon(int id, - const GURL& image_url, - bool errored, - const SkBitmap& image_data); void OnMsgContextMenu(const ContextMenuParams& params); void OnMsgOpenURL(const GURL& url, const GURL& referrer, WindowOpenDisposition disposition); void OnMsgDidContentsPreferredSizeChange(const gfx::Size& new_size); - void OnMsgDomOperationResponse(const std::string& json_string, - int automation_id); void OnMsgForwardMessageToExternalHost(const std::string& message, const std::string& origin, const std::string& target); diff --git a/content/browser/renderer_host/render_view_host_delegate.h b/content/browser/renderer_host/render_view_host_delegate.h index f95a76d..e4319c5 100644 --- a/content/browser/renderer_host/render_view_host_delegate.h +++ b/content/browser/renderer_host/render_view_host_delegate.h @@ -483,11 +483,6 @@ class RenderViewHostDelegate : public IPC::Channel::Listener { const GURL& referrer, WindowOpenDisposition disposition) {} - // A DOM automation operation completed. The result of the operation is - // expressed in a json string. - virtual void DomOperationResponse(const std::string& json_string, - int automation_id) {} - // A message for external host. By default we ignore such messages. // |receiver| can be a receiving script and |message| is any // arbitrary string that makes sense to the receiver. diff --git a/content/browser/renderer_host/render_widget_host.cc b/content/browser/renderer_host/render_widget_host.cc index 63ddd40..77db54b 100644 --- a/content/browser/renderer_host/render_widget_host.cc +++ b/content/browser/renderer_host/render_widget_host.cc @@ -10,7 +10,6 @@ #include "base/metrics/histogram.h" #include "chrome/browser/accessibility/browser_accessibility_state.h" #include "chrome/common/chrome_switches.h" -#include "chrome/common/render_messages.h" #include "content/browser/gpu_process_host.h" #include "content/browser/renderer_host/backing_store.h" #include "content/browser/renderer_host/backing_store_manager.h" diff --git a/content/browser/tab_contents/tab_contents.cc b/content/browser/tab_contents/tab_contents.cc index 2490930..677eb27 100644 --- a/content/browser/tab_contents/tab_contents.cc +++ b/content/browser/tab_contents/tab_contents.cc @@ -2005,10 +2005,6 @@ void TabContents::RequestOpenURL(const GURL& url, const GURL& referrer, } } -void TabContents::DomOperationResponse(const std::string& json_string, - int automation_id) { -} - void TabContents::ProcessExternalHostMessage(const std::string& message, const std::string& origin, const std::string& target) { diff --git a/content/browser/tab_contents/tab_contents.h b/content/browser/tab_contents/tab_contents.h index f690393..0d54825 100644 --- a/content/browser/tab_contents/tab_contents.h +++ b/content/browser/tab_contents/tab_contents.h @@ -804,8 +804,6 @@ class TabContents : public PageNavigator, int32 page_id); virtual void RequestOpenURL(const GURL& url, const GURL& referrer, WindowOpenDisposition disposition); - virtual void DomOperationResponse(const std::string& json_string, - int automation_id); virtual void ProcessExternalHostMessage(const std::string& message, const std::string& origin, const std::string& target); diff --git a/content/common/notification_type.h b/content/common/notification_type.h index f0cf976..d887d40 100644 --- a/content/common/notification_type.h +++ b/content/common/notification_type.h @@ -263,9 +263,9 @@ class NotificationType { PAGE_TRANSLATED, // Sent after the renderer returns a snapshot of tab contents. - // The source (Source<RenderViewHost>) is the RenderViewHost for which the - // snapshot was generated and the details (Details<const SkBitmap>) is the - // actual snapshot. + // The source (Source<TabContentsWrapper>) is the RenderViewHost for which + // the snapshot was generated and the details (Details<const SkBitmap>) is + // the actual snapshot. TAB_SNAPSHOT_TAKEN, // The user has changed the browser theme. There are no details. diff --git a/content/common/view_messages.h b/content/common/view_messages.h index c7658126..f8be887 100644 --- a/content/common/view_messages.h +++ b/content/common/view_messages.h @@ -1571,7 +1571,7 @@ IPC_MESSAGE_CONTROL1(ViewHostMsg_ForwardToWorker, IPC_MESSAGE_CONTROL1(ViewHostMsg_CancelCreateDedicatedWorker, int /* route_id */) -// Tells the browser that a specific Appcache manifest in the current page +// Tells the browser that a specific Appcache manifest in the current page // was accessed. IPC_MESSAGE_ROUTED2(ViewHostMsg_AppCacheAccessed, GURL /* manifest url */, |