diff options
Diffstat (limited to 'chrome/browser')
23 files changed, 185 insertions, 103 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() { |