diff options
author | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-19 22:21:26 +0000 |
---|---|---|
committer | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-19 22:21:26 +0000 |
commit | 216813957f67962e1c50fcbbad0d3e8fcd17760e (patch) | |
tree | 273740c80787aa384f3271aae447b8b2a135e65f | |
parent | 061c8a500fdcd398614a369093d1f80d7ac8190d (diff) | |
download | chromium_src-216813957f67962e1c50fcbbad0d3e8fcd17760e.zip chromium_src-216813957f67962e1c50fcbbad0d3e8fcd17760e.tar.gz chromium_src-216813957f67962e1c50fcbbad0d3e8fcd17760e.tar.bz2 |
Remove functions in RenderViewHost and RenderWidgetHost that just send an IPC message and are called by one or two places. Have the callers send the message instead. Also remove functions which dispatch an IPC only to call TabContents. Dispatch in TabContents instead.
Review URL: http://codereview.chromium.org/7037041
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@85990 0039d316-1c4b-4281-b951-d872f2087c98
36 files changed, 255 insertions, 507 deletions
diff --git a/chrome/browser/automation/automation_provider.cc b/chrome/browser/automation/automation_provider.cc index c032eb5..4fa3d5c 100644 --- a/chrome/browser/automation/automation_provider.cc +++ b/chrome/browser/automation/automation_provider.cc @@ -92,16 +92,19 @@ #include "content/browser/tab_contents/tab_contents.h" #include "content/browser/tab_contents/tab_contents_view.h" #include "content/common/json_value_serializer.h" +#include "content/common/view_messages.h" #include "net/proxy/proxy_config_service_fixed.h" #include "net/proxy/proxy_service.h" #include "net/url_request/url_request_context.h" #include "net/url_request/url_request_context_getter.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebFindOptions.h" #include "webkit/glue/password_form.h" #if defined(OS_WIN) #include "chrome/browser/external_tab_container_win.h" #endif // defined(OS_WIN) +using WebKit::WebFindOptions; using base::Time; AutomationProvider::AutomationProvider(Profile* profile) @@ -502,12 +505,14 @@ void AutomationProvider::SendFindRequest( if (wrapper) wrapper->find_tab_helper()->set_current_find_request_id(request_id); - tab_contents->render_view_host()->StartFinding( - FindInPageNotificationObserver::kFindInPageRequestId, - search_string, - forward, - match_case, - find_next); + WebFindOptions options; + options.forward = forward; + options.matchCase = match_case; + options.findNext = find_next; + tab_contents->render_view_host()->Send(new ViewMsg_Find( + tab_contents->render_view_host()->routing_id(), + FindInPageNotificationObserver::kFindInPageRequestId, search_string, + options)); } class SetProxyConfigTask : public Task { @@ -704,7 +709,7 @@ void AutomationProvider::StopAsync(int tab_handle) { return; } - view->Stop(); + view->Send(new ViewMsg_Stop(view->routing_id())); } void AutomationProvider::OnSetPageFontSize(int tab_handle, diff --git a/chrome/browser/automation/automation_provider_win.cc b/chrome/browser/automation/automation_provider_win.cc index 495a874..365ad54 100644 --- a/chrome/browser/automation/automation_provider_win.cc +++ b/chrome/browser/automation/automation_provider_win.cc @@ -22,6 +22,7 @@ #include "content/browser/renderer_host/render_view_host.h" #include "content/browser/tab_contents/tab_contents.h" #include "content/common/page_zoom.h" +#include "content/common/view_messages.h" #include "ui/base/keycodes/keyboard_codes.h" #include "views/focus/accelerator_handler.h" #include "views/widget/root_view.h" @@ -461,8 +462,9 @@ void AutomationProvider::OnSetZoomLevel(int handle, int zoom_level) { if (tab_tracker_->ContainsHandle(handle)) { NavigationController* tab = tab_tracker_->GetResource(handle); if (tab->tab_contents() && tab->tab_contents()->render_view_host()) { - tab->tab_contents()->render_view_host()->Zoom( - static_cast<PageZoom::Function>(zoom_level)); + RenderViewHost* host = tab->tab_contents()->render_view_host(); + PageZoom::Function zoom = static_cast<PageZoom::Function>(zoom_level); + host->Send(new ViewMsg_Zoom(host->routing_id(), zoom)); } } } diff --git a/chrome/browser/browser_focus_uitest.cc b/chrome/browser/browser_focus_uitest.cc index 4ef0bec..6e9e102 100644 --- a/chrome/browser/browser_focus_uitest.cc +++ b/chrome/browser/browser_focus_uitest.cc @@ -24,6 +24,7 @@ #include "content/browser/tab_contents/interstitial_page.h" #include "content/browser/tab_contents/tab_contents.h" #include "content/browser/tab_contents/tab_contents_view.h" +#include "content/common/view_messages.h" #include "net/test/test_server.h" #if defined(TOOLKIT_VIEWS) || defined(OS_WIN) @@ -170,7 +171,16 @@ class TestInterstitialPage : public InterstitialPage { } protected: - virtual void FocusedNodeChanged(bool is_editable_node) { + bool OnMessageReceived(const IPC::Message& message) { + bool handled = true; + IPC_BEGIN_MESSAGE_MAP(TestInterstitialPage, message) + IPC_MESSAGE_HANDLER(ViewHostMsg_FocusedNodeChanged, OnFocusedNodeChanged) + IPC_MESSAGE_UNHANDLED(handled = false) + IPC_END_MESSAGE_MAP() + return handled; + } + + void OnFocusedNodeChanged(bool is_editable_node) { NotificationService::current()->Notify( NotificationType::FOCUS_CHANGED_IN_PAGE, Source<TabContents>(tab()), diff --git a/chrome/browser/chromeos/login/account_screen.cc b/chrome/browser/chromeos/login/account_screen.cc index e916b58..7aa1486 100644 --- a/chrome/browser/chromeos/login/account_screen.cc +++ b/chrome/browser/chromeos/login/account_screen.cc @@ -15,6 +15,7 @@ #include "content/browser/renderer_host/render_view_host.h" #include "content/browser/site_instance.h" #include "content/browser/tab_contents/tab_contents.h" +#include "content/common/view_messages.h" #include "googleurl/src/gurl.h" #include "views/events/event.h" @@ -124,9 +125,10 @@ void AccountScreen::LoadingStateChanged(TabContents* source) { void AccountScreen::NavigationStateChanged(const TabContents* source, unsigned changed_flags) { if (source->render_view_host()) { - source->render_view_host()->InsertCSSInWebFrame( - L"", kCreateAccountCSS, ""); - source->render_view_host()->ExecuteJavascriptInWebFrame( + RenderViewHost* host = source->render_view_host(); + host->Send(new ViewMsg_CSSInsertRequest( + host->routing_id(), L"", kCreateAccountCSS, "")); + host->ExecuteJavascriptInWebFrame( string16(), ASCIIToUTF16(kCreateAccountJS)); } } diff --git a/chrome/browser/extensions/extension_host.cc b/chrome/browser/extensions/extension_host.cc index 8a40faf..0a8c7e2 100644 --- a/chrome/browser/extensions/extension_host.cc +++ b/chrome/browser/extensions/extension_host.cc @@ -336,8 +336,9 @@ void ExtensionHost::InsertInfobarCSS() { ResourceBundle::GetSharedInstance().GetRawDataResource( IDR_EXTENSIONS_INFOBAR_CSS)); - render_view_host()->InsertCSSInWebFrame( - L"", css.as_string(), "InfobarThemeCSS"); + render_view_host()->Send(new ViewMsg_CSSInsertRequest( + render_view_host()->routing_id(), L"", css.as_string(), + "InfobarThemeCSS")); } void ExtensionHost::DisableScrollbarsForSmallWindows( @@ -778,8 +779,9 @@ void ExtensionHost::RenderViewCreated(RenderViewHost* render_view_host) { if (extension_host_type_ == ViewType::EXTENSION_POPUP || extension_host_type_ == ViewType::EXTENSION_INFOBAR) { - render_view_host->EnablePreferredSizeChangedMode( - kPreferredSizeWidth | kPreferredSizeHeightThisIsSlow); + render_view_host->Send(new ViewMsg_EnablePreferredSizeChangedMode( + render_view_host->routing_id(), + kPreferredSizeWidth | kPreferredSizeHeightThisIsSlow)); } } diff --git a/chrome/browser/external_tab_container_win.cc b/chrome/browser/external_tab_container_win.cc index 8111d18..7c9d7b3 100644 --- a/chrome/browser/external_tab_container_win.cc +++ b/chrome/browser/external_tab_container_win.cc @@ -42,6 +42,7 @@ #include "content/common/native_web_keyboard_event.h" #include "content/common/notification_service.h" #include "content/common/page_transition_types.h" +#include "content/common/page_zoom.h" #include "content/common/view_messages.h" #include "grit/generated_resources.h" #include "grit/locale_settings.h" @@ -959,16 +960,17 @@ bool ExternalTabContainer::AcceleratorPressed( return false; } + RenderViewHost* host = tab_contents_->render_view_host(); int command_id = iter->second; switch (command_id) { case IDC_ZOOM_PLUS: - tab_contents_->render_view_host()->Zoom(PageZoom::ZOOM_IN); + host->Send(new ViewMsg_Zoom(host->routing_id(), PageZoom::ZOOM_IN)); break; case IDC_ZOOM_NORMAL: - tab_contents_->render_view_host()->Zoom(PageZoom::RESET); + host->Send(new ViewMsg_Zoom(host->routing_id(), PageZoom::RESET)); break; case IDC_ZOOM_MINUS: - tab_contents_->render_view_host()->Zoom(PageZoom::ZOOM_OUT); + host->Send(new ViewMsg_Zoom(host->routing_id(), PageZoom::ZOOM_OUT)); break; case IDC_DEV_TOOLS: DevToolsManager::GetInstance()->ToggleDevToolsWindow( diff --git a/chrome/browser/notifications/balloon_host.cc b/chrome/browser/notifications/balloon_host.cc index 250309d..2118928 100644 --- a/chrome/browser/notifications/balloon_host.cc +++ b/chrome/browser/notifications/balloon_host.cc @@ -95,8 +95,9 @@ void BalloonHost::RenderViewCreated(RenderViewHost* render_view_host) { #if !defined(OS_MACOSX) // TODO(levin): Make all of the code that went in originally with this change // to be cross-platform. See http://crbug.com/64720 - render_view_host->EnablePreferredSizeChangedMode( - kPreferredSizeWidth | kPreferredSizeHeightThisIsSlow); + render_view_host->Send(new ViewMsg_EnablePreferredSizeChangedMode( + render_view_host->routing_id(), + kPreferredSizeWidth | kPreferredSizeHeightThisIsSlow)); #endif } @@ -235,8 +236,9 @@ void BalloonHost::Observe(NotificationType type, const NotificationDetails& details) { if (type == NotificationType::RENDER_WIDGET_HOST_DID_PAINT) { registrar_.RemoveAll(); - render_view_host_->EnablePreferredSizeChangedMode( - kPreferredSizeWidth | kPreferredSizeHeightThisIsSlow); + render_view_host_->Send(new ViewMsg_EnablePreferredSizeChangedMode( + render_view_host_->routing_id(), + kPreferredSizeWidth | kPreferredSizeHeightThisIsSlow)); } } diff --git a/chrome/browser/pdf_unsupported_feature.cc b/chrome/browser/pdf_unsupported_feature.cc index 2f28c74..0e68c0a 100644 --- a/chrome/browser/pdf_unsupported_feature.cc +++ b/chrome/browser/pdf_unsupported_feature.cc @@ -19,6 +19,7 @@ #include "content/browser/renderer_host/render_process_host.h" #include "content/browser/renderer_host/render_view_host.h" #include "content/browser/user_metrics.h" +#include "content/common/view_messages.h" #include "grit/browser_resources.h" #include "grit/generated_resources.h" #include "ui/base/l10n/l10n_util.h" @@ -142,7 +143,8 @@ void OpenUsingReader(TabContentsWrapper* tab, plugin.plugin.version = ASCIIToUTF16("11.0.0.0"); PluginService::GetInstance()->OverridePluginForTab(plugin); - tab->render_view_host()->ReloadFrame(); + tab->render_view_host()->Send(new ViewMsg_ReloadFrame( + tab->render_view_host()->routing_id())); if (new_delegate) { if (old_delegate) { diff --git a/chrome/browser/printing/print_dialog_cloud.cc b/chrome/browser/printing/print_dialog_cloud.cc index 052aa9a..6cb1932 100644 --- a/chrome/browser/printing/print_dialog_cloud.cc +++ b/chrome/browser/printing/print_dialog_cloud.cc @@ -29,6 +29,7 @@ #include "content/common/notification_registrar.h" #include "content/common/notification_source.h" #include "content/common/notification_type.h" +#include "content/common/view_messages.h" #include "ui/base/l10n/l10n_util.h" #include "webkit/glue/webpreferences.h" @@ -269,7 +270,8 @@ void CloudPrintFlowHandler::RegisterMessages() { if (rvh && rvh->delegate()) { WebPreferences webkit_prefs = rvh->delegate()->GetWebkitPrefs(); webkit_prefs.allow_scripts_to_close_windows = true; - rvh->UpdateWebPreferences(webkit_prefs); + rvh->Send(new ViewMsg_UpdateWebPreferences( + rvh->routing_id(), webkit_prefs)); } // Register for appropriate notifications, and re-direct the URL diff --git a/chrome/browser/renderer_host/render_widget_host_view_gtk.cc b/chrome/browser/renderer_host/render_widget_host_view_gtk.cc index d4c9781a..2970a7f 100644 --- a/chrome/browser/renderer_host/render_widget_host_view_gtk.cc +++ b/chrome/browser/renderer_host/render_widget_host_view_gtk.cc @@ -1147,7 +1147,8 @@ void RenderWidgetHostViewGtk::ForwardKeyboardEvent( EditCommands edit_commands; if (!event.skip_in_browser && key_bindings_handler_->Match(event, &edit_commands)) { - host_->ForwardEditCommandsForNextKeyEvent(edit_commands); + host_->Send(new ViewMsg_SetEditCommandsForNextKeyEvent( + host_->routing_id(), edit_commands)); NativeWebKeyboardEvent copy_event(event); copy_event.match_edit_command = true; host_->ForwardKeyboardEvent(copy_event); diff --git a/chrome/browser/renderer_host/render_widget_host_view_mac.mm b/chrome/browser/renderer_host/render_widget_host_view_mac.mm index 507b92a..b01742b 100644 --- a/chrome/browser/renderer_host/render_widget_host_view_mac.mm +++ b/chrome/browser/renderer_host/render_widget_host_view_mac.mm @@ -974,8 +974,10 @@ gfx::Rect RenderWidgetHostViewMac::GetRootWindowRect() { } void RenderWidgetHostViewMac::SetActive(bool active) { - if (render_widget_host_) - render_widget_host_->SetActive(active); + if (render_widget_host_) { + render_widget_host_->Send(new ViewMsg_SetActive( + render_widget_host_->routing_id(), active)); + } if (HasFocus()) SetTextInputActive(active); if (!active) @@ -1305,8 +1307,10 @@ void RenderWidgetHostViewMac::SetTextInputActive(bool active) { if (hasEditCommands_ && !hasMarkedText_) delayEventUntilAfterImeCompostion = YES; } else { - if (!editCommands_.empty()) - widgetHost->ForwardEditCommandsForNextKeyEvent(editCommands_); + if (!editCommands_.empty()) { + widgetHost->Send(new ViewMsg_SetEditCommandsForNextKeyEvent( + widgetHost->routing_id(), editCommands_)); + } widgetHost->ForwardKeyboardEvent(event); } @@ -1369,8 +1373,10 @@ void RenderWidgetHostViewMac::SetTextInputActive(bool active) { // a key event with |skip_in_browser| == true won't be handled by browser, // thus it won't destroy the widget. - if (!editCommands_.empty()) - widgetHost->ForwardEditCommandsForNextKeyEvent(editCommands_); + if (!editCommands_.empty()) { + widgetHost->Send(new ViewMsg_SetEditCommandsForNextKeyEvent( + widgetHost->routing_id(), editCommands_)); + } widgetHost->ForwardKeyboardEvent(event); // Calling ForwardKeyboardEvent() could have destroyed the widget. When the @@ -1808,8 +1814,9 @@ void RenderWidgetHostViewMac::SetTextInputActive(bool active) { } - (void)doDefaultAction:(int32)accessibilityObjectId { - renderWidgetHostView_->render_widget_host_-> - AccessibilityDoDefaultAction(accessibilityObjectId); + RenderWidgetHost* rwh = renderWidgetHostView_->render_widget_host; + rwh_->Send(new ViewMsg_AccessibilityDoDefaultAction( + rwh->routing_id(), accessibilityObjectId)); } // Convert a web accessibility's location in web coordinates into a cocoa @@ -1828,8 +1835,9 @@ void RenderWidgetHostViewMac::SetTextInputActive(bool active) { - (void)setAccessibilityFocus:(BOOL)focus accessibilityId:(int32)accessibilityObjectId { if (focus) { - renderWidgetHostView_->render_widget_host_-> - SetAccessibilityFocus(accessibilityObjectId); + RenderWidgetHost* rwh = renderWidgetHostView_->render_widget_host_; + rwh->Send(new ViewMsg_SetAccessibilityFocus( + rwh->routing_id(), accessibilityObjectId)); } } @@ -2322,7 +2330,8 @@ extern NSString *NSTextInputReplacementRangeAttributeName; if (!StartsWithASCII(command, "insert", false)) editCommands_.push_back(EditCommand(command, "")); } else { - renderWidgetHostView_->render_widget_host_->ForwardEditCommand(command, ""); + RenderWidgetHost* rwh = renderWidgetHostView_->render_widget_host_; + rwh->Send(new ViewMsg_ExecuteEditCommand(rwh->routing_id(), command, "")); } } @@ -2428,8 +2437,9 @@ extern NSString *NSTextInputReplacementRangeAttributeName; - (void)pasteAsPlainText:(id)sender { if (renderWidgetHostView_->render_widget_host_->IsRenderView()) { - static_cast<RenderViewHost*>(renderWidgetHostView_->render_widget_host_)-> - ForwardEditCommand("PasteAndMatchStyle", ""); + RenderWidgetHost* rwh = renderWidgetHostView_->render_widget_host_; + rwh->Send(new ViewMsg_ExecuteEditCommand( + rwh->routing_id(), "PasteAndMatchStyle", "")); } } diff --git a/chrome/browser/renderer_host/render_widget_host_view_win.cc b/chrome/browser/renderer_host/render_widget_host_view_win.cc index 171748f..407bc1d3 100644 --- a/chrome/browser/renderer_host/render_widget_host_view_win.cc +++ b/chrome/browser/renderer_host/render_widget_host_view_win.cc @@ -1065,8 +1065,10 @@ void RenderWidgetHostViewWin::OnInputLangChange(DWORD character_set, } void RenderWidgetHostViewWin::OnThemeChanged() { - if (render_widget_host_) - render_widget_host_->SystemThemeChanged(); + if (!render_widget_host_) + return; + render_widget_host_->Send(new ViewMsg_ThemeChanged( + render_widget_host_->routing_id())); } LRESULT RenderWidgetHostViewWin::OnNotify(int w_param, NMHDR* header) { @@ -1581,25 +1583,19 @@ void RenderWidgetHostViewWin::ShowCompositorHostWindow(bool show) { } void RenderWidgetHostViewWin::SetAccessibilityFocus(int acc_obj_id) { - if (!browser_accessibility_manager_.get() || - !render_widget_host_ || - !render_widget_host_->process() || - !render_widget_host_->process()->HasConnection()) { + if (!render_widget_host_) return; - } - render_widget_host_->SetAccessibilityFocus(acc_obj_id); + render_widget_host_->Send(new ViewMsg_SetAccessibilityFocus( + render_widget_host_->routing_id(), acc_obj_id)); } void RenderWidgetHostViewWin::AccessibilityDoDefaultAction(int acc_obj_id) { - if (!browser_accessibility_manager_.get() || - !render_widget_host_ || - !render_widget_host_->process() || - !render_widget_host_->process()->HasConnection()) { + if (!render_widget_host_) return; - } - render_widget_host_->AccessibilityDoDefaultAction(acc_obj_id); + render_widget_host_->Send(new ViewMsg_AccessibilityDoDefaultAction( + render_widget_host_->routing_id(), acc_obj_id)); } LRESULT RenderWidgetHostViewWin::OnGetObject(UINT message, WPARAM wparam, diff --git a/chrome/browser/tab_contents/render_view_context_menu.cc b/chrome/browser/tab_contents/render_view_context_menu.cc index cf6be89..8d9969f 100644 --- a/chrome/browser/tab_contents/render_view_context_menu.cc +++ b/chrome/browser/tab_contents/render_view_context_menu.cc @@ -56,6 +56,7 @@ #include "content/browser/tab_contents/tab_contents.h" #include "content/browser/user_metrics.h" #include "content/common/content_restriction.h" +#include "content/common/view_messages.h" #include "grit/generated_resources.h" #include "net/base/escape.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebContextMenuData.h" @@ -1203,12 +1204,14 @@ void RenderViewContextMenu::ExecuteCommand(int id) { return; } + RenderViewHost* rvh = source_tab_contents_->render_view_host(); + // Process custom actions range. if (id >= IDC_CONTENT_CONTEXT_CUSTOM_FIRST && id <= IDC_CONTENT_CONTEXT_CUSTOM_LAST) { unsigned action = id - IDC_CONTENT_CONTEXT_CUSTOM_FIRST; - source_tab_contents_->render_view_host()->PerformCustomContextMenuAction( - params_.custom_context, action); + rvh->Send(new ViewMsg_CustomContextMenuAction( + rvh->routing_id(), params_.custom_context, action)); return; } @@ -1226,7 +1229,6 @@ void RenderViewContextMenu::ExecuteCommand(int id) { return; } - switch (id) { case IDC_CONTENT_CONTEXT_OPENLINKNEWTAB: OpenURL( @@ -1367,7 +1369,6 @@ void RenderViewContextMenu::ExecuteCommand(int id) { tab_contents_wrapper->print_view_manager()->PrintNow(); } } else { - RenderViewHost* rvh = source_tab_contents_->render_view_host(); rvh->Send(new PrintMsg_PrintNodeUnderContextMenu(rvh->routing_id())); } break; @@ -1415,7 +1416,7 @@ void RenderViewContextMenu::ExecuteCommand(int id) { } case IDC_CONTENT_CONTEXT_RELOADFRAME: - source_tab_contents_->render_view_host()->ReloadFrame(); + rvh->Send(new ViewMsg_ReloadFrame(rvh->routing_id())); break; case IDC_CONTENT_CONTEXT_VIEWFRAMESOURCE: @@ -1444,31 +1445,31 @@ void RenderViewContextMenu::ExecuteCommand(int id) { } case IDC_CONTENT_CONTEXT_UNDO: - source_tab_contents_->render_view_host()->Undo(); + rvh->Undo(); break; case IDC_CONTENT_CONTEXT_REDO: - source_tab_contents_->render_view_host()->Redo(); + rvh->Redo(); break; case IDC_CONTENT_CONTEXT_CUT: - source_tab_contents_->render_view_host()->Cut(); + rvh->Cut(); break; case IDC_CONTENT_CONTEXT_COPY: - source_tab_contents_->render_view_host()->Copy(); + rvh->Copy(); break; case IDC_CONTENT_CONTEXT_PASTE: - source_tab_contents_->render_view_host()->Paste(); + rvh->Paste(); break; case IDC_CONTENT_CONTEXT_DELETE: - source_tab_contents_->render_view_host()->Delete(); + rvh->Delete(); break; case IDC_CONTENT_CONTEXT_SELECTALL: - source_tab_contents_->render_view_host()->SelectAll(); + rvh->SelectAll(); break; case IDC_CONTENT_CONTEXT_SEARCHWEBFOR: @@ -1483,7 +1484,7 @@ void RenderViewContextMenu::ExecuteCommand(int id) { case IDC_SPELLCHECK_SUGGESTION_2: case IDC_SPELLCHECK_SUGGESTION_3: case IDC_SPELLCHECK_SUGGESTION_4: { - source_tab_contents_->render_view_host()->Replace( + rvh->Replace( params_.dictionary_suggestions[id - IDC_SPELLCHECK_SUGGESTION_0]); SpellCheckHost* spellcheck_host = profile_->GetSpellCheckHost(); if (!spellcheck_host) { @@ -1494,8 +1495,7 @@ void RenderViewContextMenu::ExecuteCommand(int id) { break; } case IDC_CHECK_SPELLING_OF_THIS_FIELD: { - RenderViewHost* view = source_tab_contents_->render_view_host(); - view->Send(new SpellCheckMsg_ToggleSpellCheck(view->routing_id())); + rvh->Send(new SpellCheckMsg_ToggleSpellCheck(rvh->routing_id())); break; } case IDC_SPELLCHECK_ADD_TO_DICTIONARY: { @@ -1517,9 +1517,8 @@ void RenderViewContextMenu::ExecuteCommand(int id) { } case IDC_SPELLPANEL_TOGGLE: { - RenderViewHost* view = source_tab_contents_->render_view_host(); - view->Send(new SpellCheckMsg_ToggleSpellPanel( - view->routing_id(), SpellCheckerPlatform::SpellingPanelVisible())); + rvh->Send(new SpellCheckMsg_ToggleSpellPanel( + rvh->routing_id(), SpellCheckerPlatform::SpellingPanelVisible())); break; } @@ -1533,8 +1532,8 @@ void RenderViewContextMenu::ExecuteCommand(int id) { WebKit::WebTextDirection dir = WebKit::WebTextDirectionLeftToRight; if (id == IDC_WRITING_DIRECTION_RTL) dir = WebKit::WebTextDirectionRightToLeft; - source_tab_contents_->render_view_host()->UpdateTextDirection(dir); - source_tab_contents_->render_view_host()->NotifyTextDirection(); + rvh->UpdateTextDirection(dir); + rvh->NotifyTextDirection(); break; } case IDC_CONTENT_CONTEXT_LOOK_UP_IN_DICTIONARY: @@ -1558,9 +1557,10 @@ void RenderViewContextMenu::MenuClosed() { RenderWidgetHostView* view = source_tab_contents_->GetRenderWidgetHostView(); if (view) view->ShowingContextMenu(false); - if (source_tab_contents_->render_view_host()) { - source_tab_contents_->render_view_host()->ContextMenuClosed( - params_.custom_context); + RenderViewHost* rvh = source_tab_contents_->render_view_host(); + if (rvh) { + rvh->Send(new ViewMsg_ContextMenuClosed( + rvh->routing_id(), params_.custom_context)); } } @@ -1614,7 +1614,8 @@ void RenderViewContextMenu::OpenURL( } void RenderViewContextMenu::CopyImageAt(int x, int y) { - source_tab_contents_->render_view_host()->CopyImageAt(x, y); + RenderViewHost* rvh = source_tab_contents_->render_view_host(); + rvh->Send(new ViewMsg_CopyImageAt(rvh->routing_id(), x, y)); } void RenderViewContextMenu::Inspect(int x, int y) { @@ -1633,6 +1634,7 @@ void RenderViewContextMenu::WriteURLToClipboard(const GURL& url) { void RenderViewContextMenu::MediaPlayerActionAt( const gfx::Point& location, const WebMediaPlayerAction& action) { - source_tab_contents_->render_view_host()->MediaPlayerActionAt( - location, action); + RenderViewHost* rvh = source_tab_contents_->render_view_host(); + rvh->Send(new ViewMsg_MediaPlayerActionAt( + rvh->routing_id(), location, action)); } diff --git a/chrome/browser/tab_contents/tab_contents_view_mac.mm b/chrome/browser/tab_contents/tab_contents_view_mac.mm index f5dee54..d583621 100644 --- a/chrome/browser/tab_contents/tab_contents_view_mac.mm +++ b/chrome/browser/tab_contents/tab_contents_view_mac.mm @@ -169,7 +169,8 @@ void TabContentsViewMac::RenderViewCreated(RenderViewHost* host) { // We want updates whenever the intrinsic width of the webpage changes. // Put the RenderView into that mode. The preferred width is used for example // when the "zoom" button in the browser window is clicked. - host->EnablePreferredSizeChangedMode(kPreferredSizeWidth); + host->Send(new ViewMsg_EnablePreferredSizeChangedMode( + host->routing_id(), kPreferredSizeWidth)); } void TabContentsViewMac::SetPageTitle(const std::wstring& title) { diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc index 8eb0b53..c423f67 100644 --- a/chrome/browser/ui/browser.cc +++ b/chrome/browser/ui/browser.cc @@ -118,6 +118,8 @@ #include "content/common/content_restriction.h" #include "content/common/notification_service.h" #include "content/common/page_transition_types.h" +#include "content/common/page_zoom.h" +#include "content/common/view_messages.h" #include "grit/chromium_strings.h" #include "grit/generated_resources.h" #include "grit/locale_settings.h" @@ -1763,14 +1765,15 @@ void Browser::FindPrevious() { void Browser::Zoom(PageZoom::Function zoom_function) { static const UserMetricsAction kActions[] = { - UserMetricsAction("ZoomMinus"), - UserMetricsAction("ZoomNormal"), - UserMetricsAction("ZoomPlus") - }; + UserMetricsAction("ZoomMinus"), + UserMetricsAction("ZoomNormal"), + UserMetricsAction("ZoomPlus") + }; UserMetrics::RecordAction(kActions[zoom_function - PageZoom::ZOOM_OUT]); TabContentsWrapper* tab_contents = GetSelectedTabContentsWrapper(); - tab_contents->render_view_host()->Zoom(zoom_function); + RenderViewHost* host = tab_contents->render_view_host(); + host->Send(new ViewMsg_Zoom(host->routing_id(), zoom_function)); } void Browser::FocusToolbar() { @@ -3061,7 +3064,8 @@ void Browser::AddNewContents(TabContents* source, return; } - new_contents->DisassociateFromPopupCount(); + RenderViewHost* view = new_contents->render_view_host(); + view->Send(new ViewMsg_DisassociateFromPopupCount(view->routing_id())); } browser::NavigateParams params(this, new_wrapper); diff --git a/chrome/browser/ui/cocoa/applescript/tab_applescript.mm b/chrome/browser/ui/cocoa/applescript/tab_applescript.mm index 401eb6b..151e74b 100644 --- a/chrome/browser/ui/cocoa/applescript/tab_applescript.mm +++ b/chrome/browser/ui/cocoa/applescript/tab_applescript.mm @@ -18,6 +18,7 @@ #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" +#include "content/common/view_messages.h" #include "googleurl/src/gurl.h" @interface TabAppleScript() @@ -224,7 +225,7 @@ return; } - view->Stop(); + view->Send(new ViewMsg_Stop(view->routing_id())); } - (void)handlesPrintScriptCommand:(NSScriptCommand*)command { diff --git a/chrome/browser/ui/cocoa/rwhvm_editcommand_helper.mm b/chrome/browser/ui/cocoa/rwhvm_editcommand_helper.mm index 0f74200..35e74d5 100644 --- a/chrome/browser/ui/cocoa/rwhvm_editcommand_helper.mm +++ b/chrome/browser/ui/cocoa/rwhvm_editcommand_helper.mm @@ -8,6 +8,7 @@ #import "chrome/browser/renderer_host/render_widget_host_view_mac.h" #include "content/browser/renderer_host/render_widget_host.h" +#include "content/common/view_messages.h" namespace { // The names of all the objc selectors w/o ':'s added to an object by @@ -130,7 +131,7 @@ void EditCommandImp(id self, SEL _cmd, id sender) { // SEL -> command name string. NSString* command_name_ns = RWHVMEditCommandHelper::CommandNameForSelector(_cmd); - std::string edit_command([command_name_ns UTF8String]); + std::string command([command_name_ns UTF8String]); // Forward the edit command string down the pipeline. RenderWidgetHostViewMac* rwhv = [(id<RenderWidgetHostViewMacOwner>)self @@ -138,7 +139,8 @@ void EditCommandImp(id self, SEL _cmd, id sender) { DCHECK(rwhv); // The second parameter is the core command value which isn't used here. - rwhv->GetRenderWidgetHost()->ForwardEditCommand(edit_command, ""); + RenderWidgetHost* rwh = rwhv->GetRenderWidgetHost(); + rwh->Send(new ViewMsg_ExecuteEditCommand(rwh->routing_id(), command, "")); } } // namespace diff --git a/chrome/browser/ui/find_bar/find_tab_helper.cc b/chrome/browser/ui/find_bar/find_tab_helper.cc index a44a11a..9b66bd9 100644 --- a/chrome/browser/ui/find_bar/find_tab_helper.cc +++ b/chrome/browser/ui/find_bar/find_tab_helper.cc @@ -12,6 +12,9 @@ #include "content/browser/tab_contents/tab_contents.h" #include "content/common/notification_service.h" #include "content/common/view_messages.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebFindOptions.h" + +using WebKit::WebFindOptions; // static int FindTabHelper::find_request_id_counter_ = -1; @@ -71,11 +74,14 @@ void FindTabHelper::StartFinding(string16 search_string, // Keep track of what the last search was across the tabs. FindBarState* find_bar_state = tab_contents()->profile()->GetFindBarState(); find_bar_state->set_last_prepopulate_text(find_text_); - tab_contents()->render_view_host()->StartFinding(current_find_request_id_, - find_text_, - forward_direction, - case_sensitive, - find_next); + + WebFindOptions options; + options.forward = forward_direction; + options.matchCase = case_sensitive; + options.findNext = find_next; + tab_contents()->render_view_host()->Send(new ViewMsg_Find( + tab_contents()->render_view_host()->routing_id(), + current_find_request_id_, find_text_, options)); } void FindTabHelper::StopFinding( @@ -93,7 +99,24 @@ void FindTabHelper::StopFinding( find_text_.clear(); find_op_aborted_ = true; last_search_result_ = FindNotificationDetails(); - tab_contents()->render_view_host()->StopFinding(selection_action); + + ViewMsg_StopFinding_Params params; + switch (selection_action) { + case FindBarController::kClearSelection: + params.action = ViewMsg_StopFinding_Params::kClearSelection; + break; + case FindBarController::kKeepSelection: + params.action = ViewMsg_StopFinding_Params::kKeepSelection; + break; + case FindBarController::kActivateSelection: + params.action = ViewMsg_StopFinding_Params::kActivateSelection; + break; + default: + NOTREACHED(); + params.action = ViewMsg_StopFinding_Params::kKeepSelection; + } + tab_contents()->render_view_host()->Send(new ViewMsg_StopFinding( + tab_contents()->render_view_host()->routing_id(), params)); } bool FindTabHelper::OnMessageReceived(const IPC::Message& message) { diff --git a/chrome/browser/ui/gtk/browser_window_gtk.cc b/chrome/browser/ui/gtk/browser_window_gtk.cc index fca910d..cdb8b01 100644 --- a/chrome/browser/ui/gtk/browser_window_gtk.cc +++ b/chrome/browser/ui/gtk/browser_window_gtk.cc @@ -78,10 +78,12 @@ #include "chrome/common/chrome_switches.h" #include "chrome/common/pref_names.h" #include "content/browser/renderer_host/render_widget_host_view.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_view.h" #include "content/common/native_web_keyboard_event.h" #include "content/common/notification_service.h" +#include "content/common/view_messages.h" #include "grit/app_resources.h" #include "grit/chromium_strings.h" #include "grit/generated_resources.h" @@ -1324,8 +1326,10 @@ gboolean BrowserWindowGtk::OnConfigure(GtkWidget* widget, GetLocationBar()->location_entry()->ClosePopup(); TabContents* tab_contents = GetDisplayedTabContents(); - if (tab_contents) - tab_contents->WindowMoveOrResizeStarted(); + if (tab_contents) { + RenderViewHost* rvh = tab_contents->render_view_host(); + rvh->Send(new ViewMsg_MoveOrResizeStarted(rvh->routing_id())); + } if (bounds_.size() != bounds.size()) OnSizeChanged(bounds.width(), bounds.height()); diff --git a/chrome/browser/ui/gtk/find_bar_gtk.cc b/chrome/browser/ui/gtk/find_bar_gtk.cc index ed7e21f..f524862 100644 --- a/chrome/browser/ui/gtk/find_bar_gtk.cc +++ b/chrome/browser/ui/gtk/find_bar_gtk.cc @@ -36,6 +36,7 @@ #include "content/browser/tab_contents/tab_contents.h" #include "content/common/native_web_keyboard_event.h" #include "content/common/notification_service.h" +#include "content/common/view_messages.h" #include "grit/generated_resources.h" #include "grit/theme_resources.h" #include "grit/theme_resources_standard.h" @@ -669,7 +670,8 @@ bool FindBarGtk::MaybeForwardKeyEventToRenderer(GdkEventKey* event) { // Make sure we don't have a text field element interfering with keyboard // input. Otherwise Up and Down arrow key strokes get eaten. "Nom Nom Nom". - render_view_host->ClearFocusedNode(); + render_view_host->Send( + new ViewMsg_ClearFocusedNode(render_view_host->routing_id())); NativeWebKeyboardEvent wke(event); render_view_host->ForwardKeyboardEvent(wke); diff --git a/chrome/browser/ui/touch/frame/touch_browser_frame_view.cc b/chrome/browser/ui/touch/frame/touch_browser_frame_view.cc index 5457b1a..c497e40 100644 --- a/chrome/browser/ui/touch/frame/touch_browser_frame_view.cc +++ b/chrome/browser/ui/touch/frame/touch_browser_frame_view.cc @@ -300,7 +300,8 @@ void TouchBrowserFrameView::AnimationEnded(const ui::Animation* animation) { // the renderer scrolls when necessary to keep the textfield visible. RenderViewHost* host = browser_view()->browser()->GetSelectedTabContents()->render_view_host(); - host->ScrollFocusedEditableNodeIntoView(); + host->Send(new ViewMsg_ScrollFocusedEditableNodeIntoView( + host->routing_id())); } SchedulePaint(); } diff --git a/chrome/browser/ui/views/find_bar_host.cc b/chrome/browser/ui/views/find_bar_host.cc index 26bed98..5d8fa70 100644 --- a/chrome/browser/ui/views/find_bar_host.cc +++ b/chrome/browser/ui/views/find_bar_host.cc @@ -15,6 +15,7 @@ #include "content/browser/renderer_host/render_view_host.h" #include "content/browser/tab_contents/tab_contents.h" #include "content/browser/tab_contents/tab_contents_view.h" +#include "content/common/view_messages.h" #include "ui/base/keycodes/keyboard_codes.h" #include "views/focus/external_focus_tracker.h" #include "views/focus/view_storage.h" @@ -73,7 +74,8 @@ bool FindBarHost::MaybeForwardKeyEventToWebpage( // Make sure we don't have a text field element interfering with keyboard // input. Otherwise Up and Down arrow key strokes get eaten. "Nom Nom Nom". - render_view_host->ClearFocusedNode(); + render_view_host->Send( + new ViewMsg_ClearFocusedNode(render_view_host->routing_id())); NativeWebKeyboardEvent event = GetKeyboardEvent(contents->tab_contents(), key_event); render_view_host->ForwardKeyboardEvent(event); diff --git a/chrome/browser/ui/views/frame/browser_view.cc b/chrome/browser/ui/views/frame/browser_view.cc index cfa881f..af396d7 100644 --- a/chrome/browser/ui/views/frame/browser_view.cc +++ b/chrome/browser/ui/views/frame/browser_view.cc @@ -73,11 +73,13 @@ #include "chrome/common/native_window_notification_source.h" #include "chrome/common/pref_names.h" #include "chrome/common/url_constants.h" +#include "content/browser/renderer_host/render_view_host.h" #include "content/browser/renderer_host/render_widget_host_view.h" #include "content/browser/tab_contents/tab_contents.h" #include "content/browser/tab_contents/tab_contents_view.h" #include "content/browser/user_metrics.h" #include "content/common/notification_service.h" +#include "content/common/view_messages.h" #include "grit/app_resources.h" #include "grit/chromium_strings.h" #include "grit/generated_resources.h" @@ -1642,8 +1644,10 @@ void BrowserView::OnWindowActivationChanged(bool active) { void BrowserView::OnWindowBeginUserBoundsChange() { TabContents* tab_contents = GetSelectedTabContents(); - if (tab_contents) - tab_contents->WindowMoveOrResizeStarted(); + if (!tab_contents) + return; + RenderViewHost* rvh = tab_contents->render_view_host(); + rvh->Send(new ViewMsg_MoveOrResizeStarted(rvh->routing_id())); } void BrowserView::OnWidgetMove() { diff --git a/content/browser/DEPS b/content/browser/DEPS index 11ecfed..055ff1a 100644 --- a/content/browser/DEPS +++ b/content/browser/DEPS @@ -93,7 +93,6 @@ include_rules = [ "+chrome/browser/ui/app_modal_dialogs/message_box_handler.h",
"+chrome/browser/ui/browser_dialogs.h",
"+chrome/browser/ui/crypto_module_password_dialog.h",
- "+chrome/browser/ui/find_bar/find_bar_controller.h",
"+chrome/browser/ui/login/login_prompt.h",
"+chrome/common/chrome_constants.h",
diff --git a/content/browser/renderer_host/render_view_host.cc b/content/browser/renderer_host/render_view_host.cc index 0e2f955..df67cb4 100644 --- a/content/browser/renderer_host/render_view_host.cc +++ b/content/browser/renderer_host/render_view_host.cc @@ -44,7 +44,6 @@ #include "net/base/net_util.h" #include "net/url_request/url_request_context_getter.h" #include "third_party/skia/include/core/SkBitmap.h" -#include "third_party/WebKit/Source/WebKit/chromium/public/WebFindOptions.h" #include "ui/gfx/native_widget_types.h" #include "webkit/glue/context_menu.h" #include "webkit/glue/webaccessibility.h" @@ -55,7 +54,6 @@ using WebKit::WebConsoleMessage; using WebKit::WebDragOperation; using WebKit::WebDragOperationNone; using WebKit::WebDragOperationsMask; -using WebKit::WebFindOptions; using WebKit::WebInputEvent; using WebKit::WebMediaPlayerAction; using WebKit::WebTextDirection; @@ -174,7 +172,7 @@ bool RenderViewHost::CreateRenderView(const string16& frame_name) { // Set the alternate error page, which is profile specific, in the renderer. GURL url = delegate_->GetAlternateErrorPageURL(); - SetAlternateErrorPageURL(url); + Send(new ViewMsg_SetAltErrorPageURL(routing_id(), url)); // If it's enabled, tell the renderer to set up the Javascript bindings for // sending messages back to the browser. @@ -389,73 +387,6 @@ int RenderViewHost::GetPendingRequestId() { return pending_request_id_; } -void RenderViewHost::Stop() { - Send(new ViewMsg_Stop(routing_id())); -} - -void RenderViewHost::ReloadFrame() { - Send(new ViewMsg_ReloadFrame(routing_id())); -} - -void RenderViewHost::StartFinding(int request_id, - const string16& search_text, - bool forward, - bool match_case, - bool find_next) { - if (search_text.empty()) - return; - - WebFindOptions options; - options.forward = forward; - options.matchCase = match_case; - options.findNext = find_next; - Send(new ViewMsg_Find(routing_id(), request_id, search_text, options)); - - // This call is asynchronous and returns immediately. - // The result of the search is sent as a notification message by the renderer. -} - -void RenderViewHost::StopFinding( - FindBarController::SelectionAction selection_action) { - ViewMsg_StopFinding_Params params; - - switch (selection_action) { - case FindBarController::kClearSelection: - params.action = ViewMsg_StopFinding_Params::kClearSelection; - break; - case FindBarController::kKeepSelection: - params.action = ViewMsg_StopFinding_Params::kKeepSelection; - break; - case FindBarController::kActivateSelection: - params.action = ViewMsg_StopFinding_Params::kActivateSelection; - break; - default: - NOTREACHED(); - params.action = ViewMsg_StopFinding_Params::kKeepSelection; - } - Send(new ViewMsg_StopFinding(routing_id(), params)); -} - -void RenderViewHost::Zoom(PageZoom::Function function) { - Send(new ViewMsg_Zoom(routing_id(), function)); -} - -void RenderViewHost::SetZoomLevel(double zoom_level) { - Send(new ViewMsg_SetZoomLevel(routing_id(), zoom_level)); -} - -void RenderViewHost::SetPageEncoding(const std::string& encoding_name) { - Send(new ViewMsg_SetPageEncoding(routing_id(), encoding_name)); -} - -void RenderViewHost::ResetPageEncodingToDefault() { - Send(new ViewMsg_ResetPageEncodingToDefault(routing_id())); -} - -void RenderViewHost::SetAlternateErrorPageURL(const GURL& url) { - Send(new ViewMsg_SetAltErrorPageURL(routing_id(), url)); -} - void RenderViewHost::DragTargetDragEnter( const WebDropData& drop_data, const gfx::Point& client_pt, @@ -496,10 +427,6 @@ void RenderViewHost::DragTargetDrop( Send(new DragMsg_TargetDrop(routing_id(), client_pt, screen_pt)); } -void RenderViewHost::ReservePageIDRange(int size) { - Send(new ViewMsg_ReservePageIDRange(routing_id(), size)); -} - void RenderViewHost::ExecuteJavascriptInWebFrame( const string16& frame_xpath, const string16& jscript) { @@ -516,13 +443,6 @@ int RenderViewHost::ExecuteJavascriptInWebFrameNotifyResult( return next_id++; } -void RenderViewHost::InsertCSSInWebFrame( - const std::wstring& frame_xpath, - const std::string& css, - const std::string& id) { - Send(new ViewMsg_CSSInsertRequest(routing_id(), frame_xpath, css, id)); -} - void RenderViewHost::Undo() { Send(new ViewMsg_Undo(routing_id())); UserMetrics::RecordAction(UserMetricsAction("Undo")); @@ -589,10 +509,6 @@ void RenderViewHost::JavaScriptMessageBoxClosed(IPC::Message* reply_msg, delegate_->RendererUnresponsive(this, is_waiting); } -void RenderViewHost::CopyImageAt(int x, int y) { - Send(new ViewMsg_CopyImageAt(routing_id(), x, y)); -} - void RenderViewHost::DragSourceEndedAt( int client_x, int client_y, int screen_x, int screen_y, WebDragOperation operation) { @@ -647,18 +563,6 @@ void RenderViewHost::SetInitialFocus(bool reverse) { Send(new ViewMsg_SetInitialFocus(routing_id(), reverse)); } -void RenderViewHost::ClearFocusedNode() { - Send(new ViewMsg_ClearFocusedNode(routing_id())); -} - -void RenderViewHost::ScrollFocusedEditableNodeIntoView() { - Send(new ViewMsg_ScrollFocusedEditableNodeIntoView(routing_id())); -} - -void RenderViewHost::UpdateWebPreferences(const WebPreferences& prefs) { - Send(new ViewMsg_UpdateWebPreferences(routing_id(), prefs)); -} - void RenderViewHost::FilesSelectedInChooser( const std::vector<FilePath>& files) { // Grant the security access requested to the given files. @@ -767,15 +671,14 @@ bool RenderViewHost::OnMessageReceived(const IPC::Message& msg) { IPC_MESSAGE_HANDLER(ViewHostMsg_SelectionChanged, OnMsgSelectionChanged) IPC_MESSAGE_HANDLER(ViewHostMsg_AccessibilityNotifications, OnAccessibilityNotifications) - IPC_MESSAGE_HANDLER(ViewHostMsg_OnCSSInserted, OnCSSInserted) - IPC_MESSAGE_HANDLER(ViewHostMsg_FocusedNodeChanged, OnMsgFocusedNodeChanged) - IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateZoomLimits, OnUpdateZoomLimits) IPC_MESSAGE_HANDLER(ViewHostMsg_ScriptEvalResponse, OnScriptEvalResponse) #if defined(OS_MACOSX) IPC_MESSAGE_HANDLER(ViewHostMsg_ShowPopup, OnMsgShowPopup) #endif // Have the super handle all other messages. IPC_MESSAGE_UNHANDLED(handled = RenderWidgetHost::OnMessageReceived(msg)) + // NOTE: Do not add a message handler that just calls the delegate! + // Dispatch the message directly there instead. IPC_END_MESSAGE_MAP_EX() if (!msg_is_ok) { @@ -1058,10 +961,6 @@ void RenderViewHost::OnMsgDidContentsPreferredSizeChange( view->UpdatePreferredSize(new_size); } -void RenderViewHost::DisassociateFromPopupCount() { - Send(new ViewMsg_DisassociateFromPopupCount(routing_id())); -} - void RenderViewHost::OnMsgSetTooltipText( const std::wstring& tooltip_text, WebTextDirection text_direction_hint) { @@ -1125,17 +1024,6 @@ void RenderViewHost::OnMsgRunBeforeUnloadConfirm(const GURL& frame_url, delegate_->RunBeforeUnloadConfirm(this, message, reply_msg); } -void RenderViewHost::MediaPlayerActionAt(const gfx::Point& location, - const WebMediaPlayerAction& action) { - // TODO(ajwong): Which thread should run this? Does it matter? - Send(new ViewMsg_MediaPlayerActionAt(routing_id(), location, action)); -} - -void RenderViewHost::ContextMenuClosed( - const webkit_glue::CustomContextMenuContext& custom_context) { - Send(new ViewMsg_ContextMenuClosed(routing_id(), custom_context)); -} - void RenderViewHost::OnMsgStartDragging( const WebDropData& drop_data, WebDragOperationsMask drag_operations_mask, @@ -1221,10 +1109,6 @@ void RenderViewHost::OnMsgClosePageACK() { ClosePageIgnoringUnloadEvents(); } -void RenderViewHost::WindowMoveOrResizeStarted() { - Send(new ViewMsg_MoveOrResizeStarted(routing_id())); -} - void RenderViewHost::NotifyRendererUnresponsive() { delegate_->RendererUnresponsive( this, is_waiting_for_beforeunload_ack_ || is_waiting_for_unload_ack_); @@ -1234,10 +1118,6 @@ void RenderViewHost::NotifyRendererResponsive() { delegate_->RendererResponsive(this); } -void RenderViewHost::OnMsgFocusedNodeChanged(bool is_editable_node) { - delegate_->FocusedNodeChanged(is_editable_node); -} - void RenderViewHost::OnMsgFocus() { RenderViewHostDelegate::View* view = delegate_->GetViewDelegate(); if (view) @@ -1299,28 +1179,6 @@ void RenderViewHost::ForwardKeyboardEvent( RenderWidgetHost::ForwardKeyboardEvent(key_event); } -void RenderViewHost::ForwardEditCommand(const std::string& name, - const std::string& value) { - Send(new ViewMsg_ExecuteEditCommand(routing_id(), name, value)); -} - -void RenderViewHost::ForwardEditCommandsForNextKeyEvent( - const EditCommands& edit_commands) { - Send(new ViewMsg_SetEditCommandsForNextKeyEvent(routing_id(), edit_commands)); -} - -void RenderViewHost::PerformCustomContextMenuAction( - const webkit_glue::CustomContextMenuContext& custom_context, - unsigned action) { - Send(new ViewMsg_CustomContextMenuAction(routing_id(), - custom_context, - action)); -} - -void RenderViewHost::EnablePreferredSizeChangedMode(int flags) { - Send(new ViewMsg_EnablePreferredSizeChangedMode(routing_id(), flags)); -} - #if defined(OS_MACOSX) void RenderViewHost::DidSelectPopupMenuItem(int selected_index) { Send(new ViewMsg_SelectPopupMenuItem(routing_id(), selected_index)); @@ -1379,17 +1237,7 @@ void RenderViewHost::OnAccessibilityNotifications( NotificationService::NoDetails()); } - AccessibilityNotificationsAck(); -} - -void RenderViewHost::OnCSSInserted() { - delegate_->DidInsertCSS(); -} - -void RenderViewHost::OnUpdateZoomLimits(int minimum_percent, - int maximum_percent, - bool remember) { - delegate_->UpdateZoomLimits(minimum_percent, maximum_percent, remember); + Send(new ViewMsg_AccessibilityNotifications_ACK(routing_id())); } void RenderViewHost::OnScriptEvalResponse(int id, const ListValue& result) { diff --git a/content/browser/renderer_host/render_view_host.h b/content/browser/renderer_host/render_view_host.h index 8df9eaf..0cf0803 100644 --- a/content/browser/renderer_host/render_view_host.h +++ b/content/browser/renderer_host/render_view_host.h @@ -12,9 +12,7 @@ #include "base/memory/scoped_ptr.h" #include "base/observer_list.h" #include "base/process_util.h" -#include "chrome/browser/ui/find_bar/find_bar_controller.h" #include "content/browser/renderer_host/render_widget_host.h" -#include "content/common/page_zoom.h" #include "content/common/window_container_type.h" #include "net/base/load_states.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebConsoleMessage.h" @@ -41,7 +39,6 @@ struct ViewHostMsg_CreateWindow_Params; struct ViewHostMsg_ShowPopup_Params; struct ViewMsg_Navigate_Params; struct WebDropData; -struct WebPreferences; struct UserMetricsAction; namespace gfx { @@ -53,7 +50,6 @@ class Range; } // namespace ui namespace webkit_glue { -struct CustomContextMenuContext; struct WebAccessibility; } // namespace webkit_glue @@ -219,39 +215,6 @@ class RenderViewHost : public RenderWidgetHost { // hangs, in which case we need to swap to the pending RenderViewHost. int GetPendingRequestId(); - // Stops the current load. - void Stop(); - - // Reloads the current frame. - void ReloadFrame(); - - // Start looking for a string within the content of the page, with the - // specified options. - void StartFinding(int request_id, - const string16& search_string, - bool forward, - bool match_case, - bool find_next); - - // Cancel a pending find operation. - void StopFinding(FindBarController::SelectionAction selection_action); - - // Increment, decrement, or reset the zoom level of a page. - void Zoom(PageZoom::Function function); - - // Change the zoom level of a page to a specific value. - void SetZoomLevel(double zoom_level); - - // Change the encoding of the page. - void SetPageEncoding(const std::string& encoding); - - // Reset any override encoding on the page and change back to default. - void ResetPageEncodingToDefault(); - - // Change the alternate error page URL. An empty GURL disables the use of - // alternate error pages. - void SetAlternateErrorPageURL(const GURL& url); - // D&d drop target messages that get sent to WebKit. void DragTargetDragEnter(const WebDropData& drop_data, const gfx::Point& client_pt, @@ -264,9 +227,6 @@ class RenderViewHost : public RenderWidgetHost { void DragTargetDrop(const gfx::Point& client_pt, const gfx::Point& screen_pt); - // Tell the RenderView to reserve a range of page ids of the given size. - void ReservePageIDRange(int size); - // Runs some javascript within the context of a frame in the page. void ExecuteJavascriptInWebFrame(const string16& frame_xpath, const string16& jscript); @@ -276,12 +236,6 @@ class RenderViewHost : public RenderWidgetHost { int ExecuteJavascriptInWebFrameNotifyResult(const string16& frame_xpath, const string16& jscript); - // Insert some css into a frame in the page. |id| is optional, and specifies - // the element id given when inserting/replacing the style element. - void InsertCSSInWebFrame(const std::wstring& frame_xpath, - const std::string& css, - const std::string& id); - // Edit operations. void Undo(); void Redo(); @@ -298,17 +252,6 @@ class RenderViewHost : public RenderWidgetHost { bool success, const std::wstring& prompt); - // Send an action to the media player element located at |location|. - void MediaPlayerActionAt(const gfx::Point& location, - const WebKit::WebMediaPlayerAction& action); - - // Notifies the renderer that the context menu has closed. - void ContextMenuClosed( - const webkit_glue::CustomContextMenuContext& custom_context); - - // Copies the image at the specified point. - void CopyImageAt(int x, int y); - // Notifies the renderer that a a drag operation that it started has ended, // either in a drop or by being cancelled. void DragSourceEndedAt( @@ -339,15 +282,6 @@ class RenderViewHost : public RenderWidgetHost { // Tells the renderer view to focus the first (last if reverse is true) node. void SetInitialFocus(bool reverse); - // Clears the node that is currently focused (if any). - void ClearFocusedNode(); - - // Tells the renderer view to scroll to the focused node. - void ScrollFocusedEditableNodeIntoView(); - - // Update render view specific (WebKit) preferences. - void UpdateWebPreferences(const WebPreferences& prefs); - // 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. @@ -381,10 +315,6 @@ class RenderViewHost : public RenderWidgetHost { // as a popup. void DisassociateFromPopupCount(); - // Notifies the Renderer that a move or resize of its containing window has - // started (this is used to hide the autocomplete popups if any). - void WindowMoveOrResizeStarted(); - // RenderWidgetHost public overrides. virtual void Shutdown(); virtual bool IsRenderView() const; @@ -394,10 +324,6 @@ class RenderViewHost : public RenderWidgetHost { virtual void ForwardMouseEvent(const WebKit::WebMouseEvent& mouse_event); virtual void OnMouseActivate(); virtual void ForwardKeyboardEvent(const NativeWebKeyboardEvent& key_event); - virtual void ForwardEditCommand(const std::string& name, - const std::string& value); - virtual void ForwardEditCommandsForNextKeyEvent( - const EditCommands& edit_commands); // Creates a new RenderView with the given route id. void CreateNewWindow(int route_id, @@ -410,17 +336,6 @@ class RenderViewHost : public RenderWidgetHost { // Creates a full screen RenderWidget. void CreateNewFullscreenWidget(int route_id); - // Tells the render view that a custom context action has been selected. - void PerformCustomContextMenuAction( - const webkit_glue::CustomContextMenuContext& custom_context, - unsigned action); - - // Tells the renderer to notify us when the page contents preferred size - // changed. |flags| is a combination of - // |ViewHostMsg_EnablePreferredSizeChangedMode_Flags| values, which is defined - // in render_messages.h. - void EnablePreferredSizeChangedMode(int flags); - #if defined(OS_MACOSX) // Select popup menu related methods (for external popup menus). void DidSelectPopupMenuItem(int selected_index); @@ -447,6 +362,9 @@ class RenderViewHost : public RenderWidgetHost { int renderer_id, GURL* url); + // NOTE: Do not add functions that just send an IPC message that are called in + // one or two places. Have the caller send the IPC message directly. + protected: friend class RenderViewHostObserver; @@ -462,7 +380,6 @@ class RenderViewHost : public RenderWidgetHost { virtual void OnUserGesture(); virtual void NotifyRendererUnresponsive(); virtual void NotifyRendererResponsive(); - virtual void OnMsgFocusedNodeChanged(bool is_editable_node); virtual void OnMsgFocus(); virtual void OnMsgBlur(); @@ -522,10 +439,6 @@ class RenderViewHost : public RenderWidgetHost { void OnAccessibilityNotifications( const std::vector<ViewHostMsg_AccessibilityNotification_Params>& params); - void OnCSSInserted(); - void OnUpdateZoomLimits(int minimum_percent, - int maximum_percent, - bool remember); void OnScriptEvalResponse(int id, const ListValue& result); #if defined(OS_MACOSX) diff --git a/content/browser/renderer_host/render_view_host_delegate.h b/content/browser/renderer_host/render_view_host_delegate.h index 7a62fbc..0eded02 100644 --- a/content/browser/renderer_host/render_view_host_delegate.h +++ b/content/browser/renderer_host/render_view_host_delegate.h @@ -415,17 +415,6 @@ class RenderViewHostDelegate : public IPC::Channel::Listener { // Returns true if this view is used to host an external tab container. virtual bool IsExternalTabContainer() const; - // The RenderView has inserted one css file into page. - virtual void DidInsertCSS() {} - - // A different node in the page got focused. - virtual void FocusedNodeChanged(bool is_editable_node) {} - - // Updates the minimum and maximum zoom percentages. - virtual void UpdateZoomLimits(int minimum_percent, - int maximum_percent, - bool remember) {} - // Notification that a worker process has crashed. void WorkerCrashed() {} diff --git a/content/browser/renderer_host/render_widget_host.cc b/content/browser/renderer_host/render_widget_host.cc index 34881ce..2ca9173 100644 --- a/content/browser/renderer_host/render_widget_host.cc +++ b/content/browser/renderer_host/render_widget_host.cc @@ -502,10 +502,6 @@ void RenderWidgetHost::StopHangMonitorTimeout() { // started again shortly, which happens to be the common use case. } -void RenderWidgetHost::SystemThemeChanged() { - Send(new ViewMsg_ThemeChanged(routing_id_)); -} - void RenderWidgetHost::ForwardMouseEvent(const WebMouseEvent& mouse_event) { TRACE_EVENT0("renderer_host", "RenderWidgetHost::ForwardMouseEvent"); if (ignore_input_events_ || process_->ignore_input_events()) @@ -659,19 +655,6 @@ void RenderWidgetHost::ForwardInputEvent(const WebInputEvent& input_event, StartHangMonitorTimeout(TimeDelta::FromMilliseconds(kHungRendererDelayMs)); } -void RenderWidgetHost::ForwardEditCommand(const std::string& name, - const std::string& value) { - // We don't need an implementation of this function here since the - // only place we use this is for the case of dropdown menus and other - // edge cases for which edit commands don't make sense. -} - -void RenderWidgetHost::ForwardEditCommandsForNextKeyEvent( - const EditCommands& edit_commands) { - // We don't need an implementation of this function here since this message is - // only handled by RenderView. -} - #if defined(TOUCH_UI) void RenderWidgetHost::ForwardTouchEvent( const WebKit::WebTouchEvent& touch_event) { @@ -761,10 +744,6 @@ void RenderWidgetHost::ImeCancelComposition() { std::vector<WebKit::WebCompositionUnderline>(), 0, 0)); } -void RenderWidgetHost::SetActive(bool active) { - Send(new ViewMsg_SetActive(routing_id(), active)); -} - void RenderWidgetHost::Destroy() { NotificationService::current()->Notify( NotificationType::RENDER_WIDGET_HOST_DESTROYED, @@ -1248,18 +1227,6 @@ void RenderWidgetHost::EnableRendererAccessibility() { } } -void RenderWidgetHost::SetAccessibilityFocus(int acc_obj_id) { - Send(new ViewMsg_SetAccessibilityFocus(routing_id(), acc_obj_id)); -} - -void RenderWidgetHost::AccessibilityDoDefaultAction(int acc_obj_id) { - Send(new ViewMsg_AccessibilityDoDefaultAction(routing_id(), acc_obj_id)); -} - -void RenderWidgetHost::AccessibilityNotificationsAck() { - Send(new ViewMsg_AccessibilityNotifications_ACK(routing_id())); -} - void RenderWidgetHost::ProcessKeyboardEventAck(int type, bool processed) { if (key_queue_.empty()) { LOG(ERROR) << "Got a KeyEvent back from the renderer but we " diff --git a/content/browser/renderer_host/render_widget_host.h b/content/browser/renderer_host/render_widget_host.h index 13aa909..a275b58 100644 --- a/content/browser/renderer_host/render_widget_host.h +++ b/content/browser/renderer_host/render_widget_host.h @@ -15,7 +15,6 @@ #include "base/process_util.h" #include "base/string16.h" #include "base/timer.h" -#include "content/common/edit_command.h" #include "content/common/native_web_keyboard_event.h" #include "content/common/property_bag.h" #include "ipc/ipc_channel.h" @@ -255,11 +254,6 @@ class RenderWidgetHost : public IPC::Channel::Listener, // responsive. void StopHangMonitorTimeout(); - // Called when the system theme changes. At this time all existing native - // theme handles are invalid and the renderer must obtain new ones and - // repaint. - void SystemThemeChanged(); - // Forwards the given message to the renderer. These are called by the view // when it has received a message. virtual void ForwardMouseEvent(const WebKit::WebMouseEvent& mouse_event); @@ -267,10 +261,6 @@ class RenderWidgetHost : public IPC::Channel::Listener, virtual void OnMouseActivate(); void ForwardWheelEvent(const WebKit::WebMouseWheelEvent& wheel_event); virtual void ForwardKeyboardEvent(const NativeWebKeyboardEvent& key_event); - virtual void ForwardEditCommand(const std::string& name, - const std::string& value); - virtual void ForwardEditCommandsForNextKeyEvent( - const EditCommands& edit_commands); #if defined(TOUCH_UI) virtual void ForwardTouchEvent(const WebKit::WebTouchEvent& touch_event); #endif @@ -367,20 +357,6 @@ class RenderWidgetHost : public IPC::Channel::Listener, // screenreader is detected. void EnableRendererAccessibility(); - // Relays a request from assistive technology to set focus to the - // node with this accessibility object id. - void SetAccessibilityFocus(int acc_obj_id); - - // Relays a request from assistive technology to perform the default action - // on a node with this accessibility object id. - void AccessibilityDoDefaultAction(int acc_obj_id); - - // Acknowledges a ViewHostMsg_AccessibilityNotifications message. - void AccessibilityNotificationsAck(); - - // Sets the active state (i.e., control tints). - virtual void SetActive(bool active); - void set_ignore_input_events(bool ignore_input_events) { ignore_input_events_ = ignore_input_events; } @@ -396,7 +372,7 @@ class RenderWidgetHost : public IPC::Channel::Listener, // Notification that the user has made some kind of input that could // perform an action. See OnUserGesture for more details. void StartUserGesture(); - + protected: // Internal implementation of the public Forward*Event() methods. void ForwardInputEvent(const WebKit::WebInputEvent& input_event, diff --git a/content/browser/renderer_host/render_widget_host_unittest.cc b/content/browser/renderer_host/render_widget_host_unittest.cc index 40c6fe3..2daeac7 100644 --- a/content/browser/renderer_host/render_widget_host_unittest.cc +++ b/content/browser/renderer_host/render_widget_host_unittest.cc @@ -13,6 +13,8 @@ #include "content/browser/renderer_host/backing_store.h" #include "content/browser/renderer_host/test_render_view_host.h" #include "content/common/notification_details.h" +#include "content/common/notification_observer.h" +#include "content/common/notification_registrar.h" #include "content/common/notification_source.h" #include "content/common/view_messages.h" #include "testing/gtest/include/gtest/gtest.h" diff --git a/content/browser/tab_contents/render_view_host_manager.cc b/content/browser/tab_contents/render_view_host_manager.cc index 0226385..accb225 100644 --- a/content/browser/tab_contents/render_view_host_manager.cc +++ b/content/browser/tab_contents/render_view_host_manager.cc @@ -127,12 +127,14 @@ RenderViewHost* RenderViewHostManager::Navigate(const NavigationEntry& entry) { } void RenderViewHostManager::Stop() { - render_view_host_->Stop(); + render_view_host_->Send(new ViewMsg_Stop(render_view_host_->routing_id())); // If we are cross-navigating, we should stop the pending renderers. This // will lead to a DidFailProvisionalLoad, which will properly destroy them. - if (cross_navigation_pending_) - pending_render_view_host_->Stop(); + if (cross_navigation_pending_) { + pending_render_view_host_->Send( + new ViewMsg_Stop(pending_render_view_host_->routing_id())); + } } void RenderViewHostManager::SetIsLoading(bool is_loading) { @@ -692,7 +694,7 @@ RenderViewHost* RenderViewHostManager::UpdateRendererStateForNavigate( // Otherwise, it's safe to treat this as a pending cross-site transition. // Make sure the old render view stops, in case a load is in progress. - render_view_host_->Stop(); + render_view_host_->Send(new ViewMsg_Stop(render_view_host_->routing_id())); // Suspend the new render view (i.e., don't let it send the cross-site // Navigate message) until we hear back from the old renderer's diff --git a/content/browser/tab_contents/tab_contents.cc b/content/browser/tab_contents/tab_contents.cc index 1d2c347..d990a23 100644 --- a/content/browser/tab_contents/tab_contents.cc +++ b/content/browser/tab_contents/tab_contents.cc @@ -351,6 +351,8 @@ bool TabContents::OnMessageReceived(const IPC::Message& message) { IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateContentRestrictions, OnUpdateContentRestrictions) IPC_MESSAGE_HANDLER(ViewHostMsg_GoToEntryAtOffset, OnGoToEntryAtOffset) + IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateZoomLimits, OnUpdateZoomLimits) + IPC_MESSAGE_HANDLER(ViewHostMsg_FocusedNodeChanged, OnFocusedNodeChanged) IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP_EX() @@ -559,8 +561,9 @@ bool TabContents::NavigateToEntry( return false; // Unable to create the desired render view host. if (delegate_ && delegate_->ShouldEnablePreferredSizeNotifications()) { - dest_render_view_host->EnablePreferredSizeChangedMode( - kPreferredSizeWidth | kPreferredSizeHeightThisIsSlow); + dest_render_view_host->Send(new ViewMsg_EnablePreferredSizeChangedMode( + dest_render_view_host->routing_id(), + kPreferredSizeWidth | kPreferredSizeHeightThisIsSlow)); } // For security, we should never send non-Web-UI URLs to a Web UI renderer. @@ -615,10 +618,6 @@ void TabContents::Stop() { FOR_EACH_OBSERVER(TabContentsObserver, observers_, StopNavigation()); } -void TabContents::DisassociateFromPopupCount() { - render_view_host()->DisassociateFromPopupCount(); -} - TabContents* TabContents::Clone() { // We create a new SiteInstance so that the new tab won't share processes // with the old one. This can be changed in the future if we need it to share @@ -780,16 +779,14 @@ bool TabContents::IsActiveEntry(int32 page_id) { void TabContents::SetOverrideEncoding(const std::string& encoding) { set_encoding(encoding); - render_view_host()->SetPageEncoding(encoding); + render_view_host()->Send(new ViewMsg_SetPageEncoding( + render_view_host()->routing_id(), encoding)); } void TabContents::ResetOverrideEncoding() { reset_encoding(); - render_view_host()->ResetPageEncodingToDefault(); -} - -void TabContents::WindowMoveOrResizeStarted() { - render_view_host()->WindowMoveOrResizeStarted(); + render_view_host()->Send(new ViewMsg_ResetPageEncodingToDefault( + render_view_host()->routing_id())); } void TabContents::OnCloseStarted() { @@ -1044,6 +1041,35 @@ void TabContents::OnUpdateContentRestrictions(int restrictions) { SetContentRestrictions(restrictions); } +void TabContents::OnGoToEntryAtOffset(int offset) { + if (!delegate_ || delegate_->OnGoToEntryOffset(offset)) { + NavigationEntry* entry = controller_.GetEntryAtOffset(offset); + if (!entry) + return; + // Note that we don't call NavigationController::GotToOffset() as we don't + // want to create a pending navigation entry (it might end up lingering + // http://crbug.com/51680). + entry->set_transition_type(entry->transition_type() | + PageTransition::FORWARD_BACK); + NavigateToEntry(*entry, NavigationController::NO_RELOAD); + } +} + +void TabContents::OnUpdateZoomLimits(int minimum_percent, + int maximum_percent, + bool remember) { + minimum_zoom_percent_ = minimum_percent; + maximum_zoom_percent_ = maximum_percent; + temporary_zoom_settings_ = !remember; +} + +void TabContents::OnFocusedNodeChanged(bool is_editable_node) { + NotificationService::current()->Notify( + NotificationType::FOCUS_CHANGED_IN_PAGE, + Source<TabContents>(this), + Details<const bool>(&is_editable_node)); +} + // Notifies the RenderWidgetHost instance about the fact that the page is // loading, or done loading and calls the base implementation. void TabContents::SetIsLoading(bool is_loading, @@ -1202,15 +1228,18 @@ void TabContents::CloseConstrainedWindows() { void TabContents::UpdateAlternateErrorPageURL() { GURL url = GetAlternateErrorPageURL(); - render_view_host()->SetAlternateErrorPageURL(url); + render_view_host()->Send(new ViewMsg_SetAltErrorPageURL( + render_view_host()->routing_id(), url)); } void TabContents::UpdateWebPreferences() { - render_view_host()->UpdateWebPreferences(GetWebkitPrefs()); + render_view_host()->Send(new ViewMsg_UpdateWebPreferences( + render_view_host()->routing_id(), GetWebkitPrefs())); } void TabContents::UpdateZoomLevel() { - render_view_host()->SetZoomLevel(GetZoomLevel()); + render_view_host()->Send(new ViewMsg_SetZoomLevel( + render_view_host()->routing_id(), GetZoomLevel())); } void TabContents::UpdateMaxPageIDIfNecessary(SiteInstance* site_instance, @@ -1233,7 +1262,8 @@ void TabContents::UpdateMaxPageIDIfNecessary(SiteInstance* site_instance, // the max. if (curr_max_page_id < 0) curr_max_page_id = 0; - rvh->ReservePageIDRange(max_restored_page_id - curr_max_page_id); + rvh->Send(new ViewMsg_ReservePageIDRange( + rvh->routing_id(), max_restored_page_id - curr_max_page_id)); } } } @@ -1329,20 +1359,6 @@ void TabContents::NotifyDisconnected() { NotificationService::NoDetails()); } -void TabContents::OnGoToEntryAtOffset(int offset) { - if (!delegate_ || delegate_->OnGoToEntryOffset(offset)) { - NavigationEntry* entry = controller_.GetEntryAtOffset(offset); - if (!entry) - return; - // Note that we don't call NavigationController::GotToOffset() as we don't - // want to create a pending navigation entry (it might end up lingering - // http://crbug.com/51680). - entry->set_transition_type(entry->transition_type() | - PageTransition::FORWARD_BACK); - NavigateToEntry(*entry, NavigationController::NO_RELOAD); - } -} - RenderViewHostDelegate::View* TabContents::GetViewDelegate() { return view_.get(); } @@ -1868,25 +1884,6 @@ bool TabContents::IsExternalTabContainer() const { return delegate()->IsExternalTabContainer(); } -void TabContents::DidInsertCSS() { - // This RVHDelegate function is used for extensions and not us. -} - -void TabContents::FocusedNodeChanged(bool is_editable_node) { - NotificationService::current()->Notify( - NotificationType::FOCUS_CHANGED_IN_PAGE, - Source<TabContents>(this), - Details<const bool>(&is_editable_node)); -} - -void TabContents::UpdateZoomLimits(int minimum_percent, - int maximum_percent, - bool remember) { - minimum_zoom_percent_ = minimum_percent; - maximum_zoom_percent_ = maximum_percent; - temporary_zoom_settings_ = !remember; -} - void TabContents::WorkerCrashed() { if (delegate()) delegate()->WorkerCrashed(); diff --git a/content/browser/tab_contents/tab_contents.h b/content/browser/tab_contents/tab_contents.h index 5a3f5fd..a1e70ee 100644 --- a/content/browser/tab_contents/tab_contents.h +++ b/content/browser/tab_contents/tab_contents.h @@ -281,9 +281,6 @@ class TabContents : public PageNavigator, // Stop any pending navigation. virtual void Stop(); - // Called on a TabContents when it isn't a popup, but a new window. - virtual void DisassociateFromPopupCount(); - // Creates a new TabContents with the same state as this one. The returned // heap-allocated pointer is owned by the caller. virtual TabContents* Clone(); @@ -424,8 +421,6 @@ class TabContents : public PageNavigator, // ViewMsg_ResetPageEncodingToDefault to the renderer. void ResetOverrideEncoding(); - void WindowMoveOrResizeStarted(); - RendererPreferences* GetMutableRendererPrefs() { return &renderer_preferences_; } @@ -586,8 +581,11 @@ class TabContents : public PageNavigator, void OnDocumentLoadedInFrame(int64 frame_id); void OnDidFinishLoad(int64 frame_id); void OnUpdateContentRestrictions(int restrictions); - void OnGoToEntryAtOffset(int offset); + void OnUpdateZoomLimits(int minimum_percent, + int maximum_percent, + bool remember); + void OnFocusedNodeChanged(bool is_editable_node); // Changes the IsLoading state and notifies delegate as needed // |details| is used to provide details on the load that just finished @@ -730,11 +728,6 @@ class TabContents : public PageNavigator, virtual void LoadStateChanged(const GURL& url, net::LoadState load_state, uint64 upload_position, uint64 upload_size); virtual bool IsExternalTabContainer() const; - virtual void DidInsertCSS(); - virtual void FocusedNodeChanged(bool is_editable_node); - virtual void UpdateZoomLimits(int minimum_percent, - int maximum_percent, - bool remember); virtual void WorkerCrashed(); virtual void RequestDesktopNotificationPermission(const GURL& source_origin, int callback_context); diff --git a/content/common/view_messages.h b/content/common/view_messages.h index 10388c0..ff79557 100644 --- a/content/common/view_messages.h +++ b/content/common/view_messages.h @@ -1280,10 +1280,6 @@ IPC_MESSAGE_ROUTED2(ViewHostMsg_ScriptEvalResponse, int /* id */, ListValue /* result */) -// Sent by the renderer process to acknowledge receipt of a -// ViewMsg_CSSInsertRequest message and css has been inserted into the frame. -IPC_MESSAGE_ROUTED0(ViewHostMsg_OnCSSInserted) - // Result of string search in the page. // Response to ViewMsg_Find with the results of the requested find-in-page // search, the number of matches found and the selection rect (in screen diff --git a/content/renderer/render_view.cc b/content/renderer/render_view.cc index a252ac0..0b1a474 100644 --- a/content/renderer/render_view.cc +++ b/content/renderer/render_view.cc @@ -3288,16 +3288,6 @@ void RenderView::EvaluateScript(const string16& frame_xpath, } } -void RenderView::InsertCSS(const std::wstring& frame_xpath, - const std::string& css, - const std::string& id) { - WebFrame* web_frame = GetChildFrame(frame_xpath); - if (!web_frame) - return; - - web_frame->insertStyleText(WebString::fromUTF8(css), WebString::fromUTF8(id)); -} - void RenderView::OnScriptEvalRequest(const string16& frame_xpath, const string16& jscript, int id, @@ -3308,10 +3298,11 @@ void RenderView::OnScriptEvalRequest(const string16& frame_xpath, void RenderView::OnCSSInsertRequest(const std::wstring& frame_xpath, const std::string& css, const std::string& id) { - InsertCSS(frame_xpath, css, id); + WebFrame* web_frame = GetChildFrame(frame_xpath); + if (!web_frame) + return; - // Notify RenderViewHost that css has been inserted into the frame. - Send(new ViewHostMsg_OnCSSInserted(routing_id_)); + web_frame->insertStyleText(WebString::fromUTF8(css), WebString::fromUTF8(id)); } void RenderView::OnAllowBindings(int enabled_bindings_flags) { diff --git a/content/renderer/render_view.h b/content/renderer/render_view.h index 57ee4c6..ac79586 100644 --- a/content/renderer/render_view.h +++ b/content/renderer/render_view.h @@ -855,13 +855,6 @@ class RenderView : public RenderWidget, // Should only be called if this object wraps a PluginDocument. WebKit::WebPlugin* GetWebPluginFromPluginDocument(); - // Inserts a string of CSS in a particular frame. |id| can be specified to - // give the CSS style element an id, and (if specified) will replace the - // element with the same id. - void InsertCSS(const std::wstring& frame_xpath, - const std::string& css, - const std::string& id); - // Returns false unless this is a top-level navigation that crosses origins. bool IsNonLocalTopLevelNavigation(const GURL& url, WebKit::WebFrame* frame, |