diff options
author | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-28 23:51:33 +0000 |
---|---|---|
committer | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-28 23:51:33 +0000 |
commit | 2a6bc3e61c13a82f1a61c552d5a940c14b0a9db1 (patch) | |
tree | 51e2f19bdc45bd87c9a378ee4d7d113431f6b9f5 /chrome | |
parent | 50dbc0376d825c59d08d3c0a4f3ea34fad30e960 (diff) | |
download | chromium_src-2a6bc3e61c13a82f1a61c552d5a940c14b0a9db1.zip chromium_src-2a6bc3e61c13a82f1a61c552d5a940c14b0a9db1.tar.gz chromium_src-2a6bc3e61c13a82f1a61c552d5a940c14b0a9db1.tar.bz2 |
Convert all of the WebContentsDelegate to use WebContents instead of TabContents, and update all the dependent code.
BUG=98716
TBR=joi
Review URL: http://codereview.chromium.org/9008047
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@115932 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
84 files changed, 503 insertions, 425 deletions
diff --git a/chrome/browser/aeropeek_manager.cc b/chrome/browser/aeropeek_manager.cc index 94d9fd7..367ca55 100644 --- a/chrome/browser/aeropeek_manager.cc +++ b/chrome/browser/aeropeek_manager.cc @@ -43,6 +43,7 @@ #pragma comment(lib, "dwmapi.lib") using content::BrowserThread; +using content::WebContents; namespace { @@ -947,7 +948,7 @@ void AeroPeekManager::ActivateTab(int tab_id) { // Ask TabStrip to activate this tab. // We don't have to update thumbnails now since TabStrip will call // ActiveTabChanged() when it actually activates this tab. - TabContents* contents = GetTabContents(tab_id); + WebContents* contents = GetTabContents(tab_id); if (contents && contents->GetDelegate()) contents->GetDelegate()->ActivateContents(contents); } diff --git a/chrome/browser/background/background_contents_service.cc b/chrome/browser/background/background_contents_service.cc index 47343b9..95333aa 100644 --- a/chrome/browser/background/background_contents_service.cc +++ b/chrome/browser/background/background_contents_service.cc @@ -33,6 +33,8 @@ #include "grit/generated_resources.h" #include "ui/base/l10n/l10n_util.h" +using content::WebContents; + namespace { const char kNotificationPrefix[] = "app.background.crashed."; @@ -566,8 +568,8 @@ const string16& BackgroundContentsService::GetParentApplicationId( return EmptyString16(); } -void BackgroundContentsService::AddTabContents( - TabContents* new_contents, +void BackgroundContentsService::AddWebContents( + WebContents* new_contents, WindowOpenDisposition disposition, const gfx::Rect& initial_pos, bool user_gesture) { @@ -575,5 +577,5 @@ void BackgroundContentsService::AddTabContents( Profile::FromBrowserContext(new_contents->GetBrowserContext())); if (!browser) return; - browser->AddTabContents(new_contents, disposition, initial_pos, user_gesture); + browser->AddWebContents(new_contents, disposition, initial_pos, user_gesture); } diff --git a/chrome/browser/background/background_contents_service.h b/chrome/browser/background/background_contents_service.h index 14adadc..5e8062a 100644 --- a/chrome/browser/background/background_contents_service.h +++ b/chrome/browser/background/background_contents_service.h @@ -59,7 +59,7 @@ class BackgroundContentsService : private content::NotificationObserver, std::vector<BackgroundContents*> GetBackgroundContents() const; // BackgroundContents::Delegate implementation. - virtual void AddTabContents(TabContents* new_contents, + virtual void AddWebContents(content::WebContents* new_contents, WindowOpenDisposition disposition, const gfx::Rect& initial_pos, bool user_gesture) OVERRIDE; diff --git a/chrome/browser/chromeos/login/webui_login_view.cc b/chrome/browser/chromeos/login/webui_login_view.cc index 9155e0f..267cc33 100644 --- a/chrome/browser/chromeos/login/webui_login_view.cc +++ b/chrome/browser/chromeos/login/webui_login_view.cc @@ -40,6 +40,8 @@ #include "chrome/browser/ui/views/aura/chrome_shell_delegate.h" #endif +using content::WebContents; + namespace { const char kViewClassName[] = "browser/chromeos/login/WebUILoginView"; @@ -381,7 +383,7 @@ bool WebUILoginView::HandleContextMenu(const ContextMenuParams& params) { #endif } -bool WebUILoginView::IsPopupOrPanel(const TabContents* source) const { +bool WebUILoginView::IsPopupOrPanel(const WebContents* source) const { return true; } diff --git a/chrome/browser/chromeos/login/webui_login_view.h b/chrome/browser/chromeos/login/webui_login_view.h index 6413476..becada8 100644 --- a/chrome/browser/chromeos/login/webui_login_view.h +++ b/chrome/browser/chromeos/login/webui_login_view.h @@ -111,7 +111,8 @@ class WebUILoginView : public views::WidgetDelegateView, virtual bool HandleContextMenu(const ContextMenuParams& params) OVERRIDE; virtual void HandleKeyboardEvent( const NativeWebKeyboardEvent& event) OVERRIDE; - virtual bool IsPopupOrPanel(const TabContents* source) const OVERRIDE; + virtual bool IsPopupOrPanel( + const content::WebContents* source) const OVERRIDE; virtual bool TakeFocus(bool reverse) OVERRIDE; // Called when focus is returned from status area. diff --git a/chrome/browser/chromeos/notifications/balloon_view_host.cc b/chrome/browser/chromeos/notifications/balloon_view_host.cc index bc05c34..e57f60d 100644 --- a/chrome/browser/chromeos/notifications/balloon_view_host.cc +++ b/chrome/browser/chromeos/notifications/balloon_view_host.cc @@ -13,6 +13,8 @@ #include "ipc/ipc_message.h" #include "ipc/ipc_message_macros.h" +using content::WebContents; + namespace chromeos { BalloonViewHost::BalloonViewHost(Balloon* balloon) @@ -30,7 +32,7 @@ bool BalloonViewHost::AddWebUIMessageCallback( return ret.second; } -void BalloonViewHost::WebUISend(TabContents* tab, +void BalloonViewHost::WebUISend(WebContents* tab, const GURL& source_url, const std::string& name, const ListValue& args) { diff --git a/chrome/browser/chromeos/notifications/balloon_view_host.h b/chrome/browser/chromeos/notifications/balloon_view_host.h index e975844..19fca89 100644 --- a/chrome/browser/chromeos/notifications/balloon_view_host.h +++ b/chrome/browser/chromeos/notifications/balloon_view_host.h @@ -39,7 +39,7 @@ class BalloonViewHost : public ::BalloonViewHost { private: // WebContentsDelegate - virtual void WebUISend(TabContents* tab, + virtual void WebUISend(content::WebContents* tab, const GURL& source_url, const std::string& name, const base::ListValue& args) OVERRIDE; diff --git a/chrome/browser/debugger/devtools_window.cc b/chrome/browser/debugger/devtools_window.cc index 513b08e..1ad7999 100644 --- a/chrome/browser/debugger/devtools_window.cc +++ b/chrome/browser/debugger/devtools_window.cc @@ -566,8 +566,8 @@ void DevToolsWindow::UpdateTheme() { ExecuteJavascriptInWebFrame(string16(), UTF8ToUTF16(command)); } -void DevToolsWindow::AddNewContents(TabContents* source, - TabContents* new_contents, +void DevToolsWindow::AddNewContents(WebContents* source, + WebContents* new_contents, WindowOpenDisposition disposition, const gfx::Rect& initial_pos, bool user_gesture) { @@ -577,7 +577,7 @@ void DevToolsWindow::AddNewContents(TabContents* source, } } -bool DevToolsWindow::CanReloadContents(TabContents* source) const { +bool DevToolsWindow::CanReloadContents(WebContents* source) const { return false; } diff --git a/chrome/browser/debugger/devtools_window.h b/chrome/browser/debugger/devtools_window.h index 920eab8..c52cabc 100644 --- a/chrome/browser/debugger/devtools_window.h +++ b/chrome/browser/debugger/devtools_window.h @@ -101,13 +101,13 @@ class DevToolsWindow : private content::NotificationObserver, virtual content::WebContents* OpenURLFromTab( content::WebContents* source, const content::OpenURLParams& params) OVERRIDE; - virtual void AddNewContents(TabContents* source, - TabContents* new_contents, + virtual void AddNewContents(content::WebContents* source, + content::WebContents* new_contents, WindowOpenDisposition disposition, const gfx::Rect& initial_pos, bool user_gesture) OVERRIDE; virtual void CloseContents(content::WebContents* source) OVERRIDE {} - virtual bool CanReloadContents(TabContents* source) const OVERRIDE; + virtual bool CanReloadContents(content::WebContents* source) const OVERRIDE; virtual bool PreHandleKeyboardEvent(const NativeWebKeyboardEvent& event, bool* is_keyboard_shortcut) OVERRIDE; virtual void HandleKeyboardEvent( diff --git a/chrome/browser/download/download_request_limiter.cc b/chrome/browser/download/download_request_limiter.cc index f2c35db..fbc1746 100644 --- a/chrome/browser/download/download_request_limiter.cc +++ b/chrome/browser/download/download_request_limiter.cc @@ -275,7 +275,7 @@ void DownloadRequestLimiter::CanDownloadImpl( // FYI: Chrome Frame overrides CanDownload in ExternalTabContainer in order // to cancel the download operation in chrome and let the host browser // take care of it. - TabContents* tab = originating_tab->tab_contents(); + WebContents* tab = originating_tab->web_contents(); if (tab->GetDelegate() && !tab->GetDelegate()->CanDownload(tab, request_id)) { ScheduleNotification(callback, false); return; diff --git a/chrome/browser/extensions/extension_host.cc b/chrome/browser/extensions/extension_host.cc index 4444d4e..d343f69 100644 --- a/chrome/browser/extensions/extension_host.cc +++ b/chrome/browser/extensions/extension_host.cc @@ -279,7 +279,7 @@ void ExtensionHost::Observe(int type, } } -void ExtensionHost::UpdatePreferredSize(TabContents* source, +void ExtensionHost::UpdatePreferredSize(WebContents* source, const gfx::Size& pref_size) { if (view_.get()) view_->UpdatePreferredSize(pref_size); @@ -489,13 +489,13 @@ content::JavaScriptDialogCreator* ExtensionHost::GetJavaScriptDialogCreator() { return GetJavaScriptDialogCreatorInstance(); } -void ExtensionHost::RunFileChooser(TabContents* tab, +void ExtensionHost::RunFileChooser(WebContents* tab, const content::FileChooserParams& params) { Browser::RunFileChooserHelper(tab, params); } -void ExtensionHost::AddNewContents(TabContents* source, - TabContents* new_contents, +void ExtensionHost::AddNewContents(WebContents* source, + WebContents* new_contents, WindowOpenDisposition disposition, const gfx::Rect& initial_pos, bool user_gesture) { @@ -524,7 +524,8 @@ void ExtensionHost::AddNewContents(TabContents* source, Profile::FromBrowserContext(new_contents->GetBrowserContext()); Browser* browser = BrowserList::FindTabbedBrowser( profile, false); // Match incognito exactly. - TabContentsWrapper* wrapper = new TabContentsWrapper(new_contents); + TabContentsWrapper* wrapper = new TabContentsWrapper( + static_cast<TabContents*>(new_contents)); browser::NavigateParams params(browser, wrapper); // The extension_app_id parameter ends up as app_name in the Browser diff --git a/chrome/browser/extensions/extension_host.h b/chrome/browser/extensions/extension_host.h index 8e9e74b..6d4f8fa 100644 --- a/chrome/browser/extensions/extension_host.h +++ b/chrome/browser/extensions/extension_host.h @@ -124,14 +124,15 @@ class ExtensionHost : public content::WebContentsDelegate, bool* is_keyboard_shortcut) OVERRIDE; virtual void HandleKeyboardEvent(const NativeWebKeyboardEvent& event) OVERRIDE; - virtual void UpdatePreferredSize(TabContents* source, + virtual void UpdatePreferredSize(content::WebContents* source, const gfx::Size& pref_size) OVERRIDE; virtual content::JavaScriptDialogCreator* GetJavaScriptDialogCreator() OVERRIDE; virtual void RunFileChooser( - TabContents* tab, const content::FileChooserParams& params) OVERRIDE; - virtual void AddNewContents(TabContents* source, - TabContents* new_contents, + content::WebContents* tab, + const content::FileChooserParams& params) OVERRIDE; + virtual void AddNewContents(content::WebContents* source, + content::WebContents* new_contents, WindowOpenDisposition disposition, const gfx::Rect& initial_pos, bool user_gesture) OVERRIDE; diff --git a/chrome/browser/external_tab_container_win.cc b/chrome/browser/external_tab_container_win.cc index a83e49d..49b0278 100644 --- a/chrome/browser/external_tab_container_win.cc +++ b/chrome/browser/external_tab_container_win.cc @@ -410,7 +410,7 @@ WebContents* ExternalTabContainer::OpenURLFromTab(WebContents* source, return NULL; } -void ExternalTabContainer::NavigationStateChanged(const TabContents* source, +void ExternalTabContainer::NavigationStateChanged(const WebContents* source, unsigned changed_flags) { if (automation_) { NavigationInfo nav_info; @@ -420,11 +420,11 @@ void ExternalTabContainer::NavigationStateChanged(const TabContents* source, } } -void ExternalTabContainer::AddNewContents(TabContents* source, - TabContents* new_contents, - WindowOpenDisposition disposition, - const gfx::Rect& initial_pos, - bool user_gesture) { +void ExternalTabContainer::AddNewContents(WebContents* source, + WebContents* new_contents, + WindowOpenDisposition disposition, + const gfx::Rect& initial_pos, + bool user_gesture) { if (!automation_) { DCHECK(pending_); LOG(ERROR) << "Invalid automation provider. Dropping new contents notify"; @@ -451,7 +451,8 @@ void ExternalTabContainer::AddNewContents(TabContents* source, // Make sure that ExternalTabContainer instance is initialized with // an unwrapped Profile. - scoped_ptr<TabContentsWrapper> wrapper(new TabContentsWrapper(new_contents)); + scoped_ptr<TabContentsWrapper> wrapper(new TabContentsWrapper( + static_cast<TabContents*>(new_contents))); bool result = new_container->Init( wrapper->profile()->GetOriginalProfile(), NULL, @@ -489,7 +490,7 @@ void ExternalTabContainer::AddNewContents(TabContents* source, } } -void ExternalTabContainer::TabContentsCreated(TabContents* new_contents) { +void ExternalTabContainer::WebContentsCreated(WebContents* new_contents) { RenderViewHost* rvh = new_contents->GetRenderViewHost(); DCHECK(rvh != NULL); @@ -513,7 +514,7 @@ void ExternalTabContainer::CloseContents(content::WebContents* source) { } } -void ExternalTabContainer::MoveContents(TabContents* source, +void ExternalTabContainer::MoveContents(WebContents* source, const gfx::Rect& pos) { if (automation_ && is_popup_window_) automation_->Send(new AutomationMsg_MoveWindow(tab_handle_, pos)); @@ -524,11 +525,11 @@ TabContentsWrapper* ExternalTabContainer::GetConstrainingContentsWrapper( return source; } -bool ExternalTabContainer::IsPopupOrPanel(const TabContents* source) const { +bool ExternalTabContainer::IsPopupOrPanel(const WebContents* source) const { return is_popup_window_; } -void ExternalTabContainer::UpdateTargetURL(TabContents* source, +void ExternalTabContainer::UpdateTargetURL(WebContents* source, int32 page_id, const GURL& url) { Browser::UpdateTargetURLHelper(source, page_id, url); @@ -555,7 +556,7 @@ bool ExternalTabContainer::TakeFocus(bool reverse) { return true; } -bool ExternalTabContainer::CanDownload(TabContents* source, int request_id) { +bool ExternalTabContainer::CanDownload(WebContents* source, int request_id) { if (load_requests_via_automation_) { if (automation_) { // In case the host needs to show UI that needs to take the focus. @@ -682,7 +683,7 @@ void ExternalTabContainer::HandleKeyboardEvent( event.os_event.wParam, event.os_event.lParam); } -void ExternalTabContainer::BeforeUnloadFired(TabContents* tab, +void ExternalTabContainer::BeforeUnloadFired(WebContents* tab, bool proceed, bool* proceed_to_fire_unload) { *proceed_to_fire_unload = true; @@ -708,34 +709,34 @@ void ExternalTabContainer::BeforeUnloadFired(TabContents* tab, } void ExternalTabContainer::ShowRepostFormWarningDialog( - TabContents* tab_contents) { + WebContents* source) { browser::ShowTabModalConfirmDialog( - new RepostFormWarningController(tab_contents), - TabContentsWrapper::GetCurrentWrapperForContents(tab_contents)); + new RepostFormWarningController(source), + TabContentsWrapper::GetCurrentWrapperForContents(source)); } void ExternalTabContainer::RunFileChooser( - TabContents* tab, const content::FileChooserParams& params) { + WebContents* tab, const content::FileChooserParams& params) { Browser::RunFileChooserHelper(tab, params); } -void ExternalTabContainer::EnumerateDirectory(TabContents* tab, int request_id, +void ExternalTabContainer::EnumerateDirectory(WebContents* tab, int request_id, const FilePath& path) { Browser::EnumerateDirectoryHelper(tab, request_id, path); } -void ExternalTabContainer::JSOutOfMemory(TabContents* tab) { +void ExternalTabContainer::JSOutOfMemory(WebContents* tab) { Browser::JSOutOfMemoryHelper(tab); } -void ExternalTabContainer::RegisterProtocolHandler(TabContents* tab, +void ExternalTabContainer::RegisterProtocolHandler(WebContents* tab, const std::string& protocol, const GURL& url, const string16& title) { Browser::RegisterProtocolHandlerHelper(tab, protocol, url, title); } -void ExternalTabContainer::RegisterIntentHandler(TabContents* tab, +void ExternalTabContainer::RegisterIntentHandler(WebContents* tab, const string16& action, const string16& type, const string16& href, @@ -746,14 +747,14 @@ void ExternalTabContainer::RegisterIntentHandler(TabContents* tab, } void ExternalTabContainer::WebIntentDispatch( - TabContents* tab, + WebContents* tab, content::WebIntentsDispatcher* intents_dispatcher) { // TODO(binji) How do we want to display the WebIntentPicker bubble if there // is no BrowserWindow? delete intents_dispatcher; } -void ExternalTabContainer::FindReply(TabContents* tab, +void ExternalTabContainer::FindReply(WebContents* tab, int request_id, int number_of_matches, const gfx::Rect& selection_rect, @@ -763,7 +764,7 @@ void ExternalTabContainer::FindReply(TabContents* tab, active_match_ordinal, final_update); } -void ExternalTabContainer::CrashedPlugin(TabContents* tab, +void ExternalTabContainer::CrashedPlugin(WebContents* tab, const FilePath& plugin_path) { Browser::CrashedPluginHelper(tab, plugin_path); } @@ -1129,7 +1130,7 @@ void ExternalTabContainer::OnReinitialize() { } } - NavigationStateChanged(tab_contents(), 0); + NavigationStateChanged(web_contents(), 0); ServicePendingOpenURLRequests(); } diff --git a/chrome/browser/external_tab_container_win.h b/chrome/browser/external_tab_container_win.h index 554e9ab..07729dc 100644 --- a/chrome/browser/external_tab_container_win.h +++ b/chrome/browser/external_tab_container_win.h @@ -123,62 +123,67 @@ class ExternalTabContainer : public content::WebContentsDelegate, virtual content::WebContents* OpenURLFromTab( content::WebContents* source, const content::OpenURLParams& params) OVERRIDE; - virtual void NavigationStateChanged(const TabContents* source, + virtual void NavigationStateChanged(const content::WebContents* source, unsigned changed_flags) OVERRIDE; - virtual void AddNewContents(TabContents* source, - TabContents* new_contents, + virtual void AddNewContents(content::WebContents* source, + content::WebContents* new_contents, WindowOpenDisposition disposition, const gfx::Rect& initial_pos, bool user_gesture) OVERRIDE; virtual void CloseContents(content::WebContents* source) OVERRIDE; - virtual void MoveContents(TabContents* source, const gfx::Rect& pos) OVERRIDE; - virtual bool IsPopupOrPanel(const TabContents* source) const OVERRIDE; - virtual void UpdateTargetURL(TabContents* source, int32 page_id, + virtual void MoveContents(content::WebContents* source, + const gfx::Rect& pos) OVERRIDE; + virtual bool IsPopupOrPanel( + const content::WebContents* source) const OVERRIDE; + virtual void UpdateTargetURL(content::WebContents* source, int32 page_id, const GURL& url) OVERRIDE; virtual void ContentsZoomChange(bool zoom_in) OVERRIDE; virtual gfx::NativeWindow GetFrameNativeWindow() OVERRIDE; + virtual void WebContentsCreated(content::WebContents* new_contents); virtual bool PreHandleKeyboardEvent(const NativeWebKeyboardEvent& event, bool* is_keyboard_shortcut) OVERRIDE; virtual void HandleKeyboardEvent( const NativeWebKeyboardEvent& event) OVERRIDE; virtual bool TakeFocus(bool reverse) OVERRIDE; - virtual bool CanDownload(TabContents* source, int request_id) OVERRIDE; + virtual bool CanDownload(content::WebContents* source, + int request_id) OVERRIDE; virtual bool OnGoToEntryOffset(int offset) OVERRIDE; virtual bool HandleContextMenu(const ContextMenuParams& params) OVERRIDE; virtual bool ExecuteContextMenuCommand(int command) OVERRIDE; - virtual void BeforeUnloadFired(TabContents* tab, + virtual void BeforeUnloadFired(content::WebContents* tab, bool proceed, bool* proceed_to_fire_unload) OVERRIDE; virtual content::JavaScriptDialogCreator* GetJavaScriptDialogCreator() OVERRIDE; - virtual void ShowRepostFormWarningDialog(TabContents* tab_contents) OVERRIDE; + virtual void ShowRepostFormWarningDialog( + content::WebContents* source) OVERRIDE; virtual void RunFileChooser( - TabContents* tab, + content::WebContents* tab, const content::FileChooserParams& params) OVERRIDE; - virtual void EnumerateDirectory(TabContents* tab, + virtual void EnumerateDirectory(content::WebContents* tab, int request_id, const FilePath& path) OVERRIDE; - virtual void JSOutOfMemory(TabContents* tab); - virtual void RegisterProtocolHandler(TabContents* tab, + virtual void JSOutOfMemory(content::WebContents* tab); + virtual void RegisterProtocolHandler(content::WebContents* tab, const std::string& protocol, const GURL& url, const string16& title) OVERRIDE; - virtual void RegisterIntentHandler(TabContents* tab, + virtual void RegisterIntentHandler(content::WebContents* tab, const string16& action, const string16& type, const string16& href, const string16& title, const string16& disposition) OVERRIDE; virtual void WebIntentDispatch( - TabContents* tab, + content::WebContents* tab, content::WebIntentsDispatcher* intents_dispatcher) OVERRIDE; - virtual void FindReply(TabContents* tab, + virtual void FindReply(content::WebContents* tab, int request_id, int number_of_matches, const gfx::Rect& selection_rect, int active_match_ordinal, bool final_update) OVERRIDE; - virtual void CrashedPlugin(TabContents* tab, + virtual void CrashedPlugin(content::WebContents* tab, const FilePath& plugin_path) OVERRIDE; void RegisterRenderViewHost(RenderViewHost* render_view_host); @@ -223,8 +228,6 @@ class ExternalTabContainer : public content::WebContentsDelegate, virtual void InfoBarContainerStateChanged(bool is_animating) OVERRIDE; virtual bool DrawInfoBarArrows(int* x) const OVERRIDE; - virtual void TabContentsCreated(TabContents* new_contents); - void RunUnloadHandlers(IPC::Message* reply_message); // Overridden from BlockedContentTabHelperDelegate: @@ -372,7 +375,7 @@ class TemporaryPopupExternalTabContainer : public ExternalTabContainer { content::WebContents* source, const content::OpenURLParams& params) OVERRIDE; - virtual void NavigationStateChanged(const TabContents* source, + virtual void NavigationStateChanged(const content::WebContents* source, unsigned changed_flags) { NOTREACHED(); } @@ -381,7 +384,7 @@ class TemporaryPopupExternalTabContainer : public ExternalTabContainer { NOTREACHED(); } - virtual void UpdateTargetURL(TabContents* source, int32 page_id, + virtual void UpdateTargetURL(content::WebContents* source, int32 page_id, const GURL& url) { NOTREACHED(); } @@ -402,7 +405,7 @@ class TemporaryPopupExternalTabContainer : public ExternalTabContainer { return false; } - virtual void BeforeUnloadFired(TabContents* tab, bool proceed, + virtual void BeforeUnloadFired(content::WebContents* tab, bool proceed, bool* proceed_to_fire_unload) { NOTREACHED(); } diff --git a/chrome/browser/instant/instant_loader.cc b/chrome/browser/instant/instant_loader.cc index c91cd4a1..5b7edbd 100644 --- a/chrome/browser/instant/instant_loader.cc +++ b/chrome/browser/instant/instant_loader.cc @@ -52,6 +52,7 @@ #include "ui/gfx/codec/png_codec.h" using content::NavigationEntry; +using content::WebContents; namespace { @@ -204,12 +205,12 @@ class InstantLoader::TabContentsDelegateImpl const content::NotificationDetails& details) OVERRIDE; // content::WebContentsDelegate: - virtual void NavigationStateChanged(const TabContents* source, + virtual void NavigationStateChanged(const WebContents* source, unsigned changed_flags) OVERRIDE; virtual void AddNavigationHeaders(const GURL& url, std::string* headers) OVERRIDE; virtual bool ShouldSuppressDialogs() OVERRIDE; - virtual void BeforeUnloadFired(TabContents* tab, + virtual void BeforeUnloadFired(content::WebContents* tab, bool proceed, bool* proceed_to_fire_unload) OVERRIDE; virtual void SetFocusToLocationBar(bool select_all) OVERRIDE; @@ -219,7 +220,8 @@ class InstantLoader::TabContentsDelegateImpl // instant result when the drag ends, so that during the drag the page won't // move around. virtual void DragEnded() OVERRIDE; - virtual bool CanDownload(TabContents* source, int request_id) OVERRIDE; + virtual bool CanDownload(content::WebContents* source, + int request_id) OVERRIDE; virtual void HandleMouseUp() OVERRIDE; virtual void HandleMouseActivate() OVERRIDE; virtual bool OnGoToEntryOffset(int offset) OVERRIDE; @@ -425,7 +427,7 @@ void InstantLoader::TabContentsDelegateImpl::Observe( } void InstantLoader::TabContentsDelegateImpl::NavigationStateChanged( - const TabContents* source, + const WebContents* source, unsigned changed_flags) { if (!loader_->ready() && !registered_render_widget_host_ && source->GetController().entry_count()) { @@ -455,7 +457,7 @@ bool InstantLoader::TabContentsDelegateImpl::ShouldSuppressDialogs() { } void InstantLoader::TabContentsDelegateImpl::BeforeUnloadFired( - TabContents* tab, + WebContents* tab, bool proceed, bool* proceed_to_fire_unload) { } @@ -476,7 +478,7 @@ void InstantLoader::TabContentsDelegateImpl::DragEnded() { CommitFromMouseReleaseIfNecessary(); } -bool InstantLoader::TabContentsDelegateImpl::CanDownload(TabContents* source, +bool InstantLoader::TabContentsDelegateImpl::CanDownload(WebContents* source, int request_id) { // Downloads are disabled. return false; diff --git a/chrome/browser/notifications/balloon_host.cc b/chrome/browser/notifications/balloon_host.cc index 6b47eea..b60249c 100644 --- a/chrome/browser/notifications/balloon_host.cc +++ b/chrome/browser/notifications/balloon_host.cc @@ -70,7 +70,7 @@ void BalloonHost::HandleMouseDown() { balloon_->OnClick(); } -void BalloonHost::UpdatePreferredSize(TabContents* source, +void BalloonHost::UpdatePreferredSize(WebContents* source, const gfx::Size& pref_size) { balloon_->SetContentPreferredSize(pref_size); } diff --git a/chrome/browser/notifications/balloon_host.h b/chrome/browser/notifications/balloon_host.h index 19c1145..81f8cf0 100644 --- a/chrome/browser/notifications/balloon_host.h +++ b/chrome/browser/notifications/balloon_host.h @@ -57,7 +57,7 @@ class BalloonHost : public content::WebContentsDelegate, // content::WebContentsDelegate implementation: virtual void CloseContents(content::WebContents* source) OVERRIDE; virtual void HandleMouseDown() OVERRIDE; - virtual void UpdatePreferredSize(TabContents* source, + virtual void UpdatePreferredSize(content::WebContents* source, const gfx::Size& pref_size) OVERRIDE; // content::WebContentsObserver implementation: diff --git a/chrome/browser/prerender/prerender_contents.cc b/chrome/browser/prerender/prerender_contents.cc index ac540af..6f3ef26 100644 --- a/chrome/browser/prerender/prerender_contents.cc +++ b/chrome/browser/prerender/prerender_contents.cc @@ -115,13 +115,13 @@ class PrerenderContents::TabContentsDelegateImpl return false; } - virtual bool CanDownload(TabContents* source, int request_id) OVERRIDE { + virtual bool CanDownload(WebContents* source, int request_id) OVERRIDE { prerender_contents_->Destroy(FINAL_STATUS_DOWNLOAD); // Cancel the download. return false; } - virtual void OnStartDownload(TabContents* source, + virtual void OnStartDownload(WebContents* source, DownloadItem* download) OVERRIDE { // Prerendered pages should never be able to download files. NOTREACHED(); @@ -136,7 +136,7 @@ class PrerenderContents::TabContentsDelegateImpl return false; } - virtual void JSOutOfMemory(TabContents* tab) OVERRIDE { + virtual void JSOutOfMemory(WebContents* tab) OVERRIDE { prerender_contents_->OnJSOutOfMemory(); } diff --git a/chrome/browser/prerender/prerender_manager.cc b/chrome/browser/prerender/prerender_manager.cc index 66cb974..8ce70ed 100644 --- a/chrome/browser/prerender/prerender_manager.cc +++ b/chrome/browser/prerender/prerender_manager.cc @@ -121,8 +121,8 @@ class PrerenderManager::OnCloseTabContentsDeleter ScheduleTabContentsForDeletion(false); } - virtual void SwappedOut(TabContents* source) OVERRIDE { - DCHECK_EQ(tab_->tab_contents(), source); + virtual void SwappedOut(WebContents* source) OVERRIDE { + DCHECK_EQ(tab_->web_contents(), source); ScheduleTabContentsForDeletion(false); } diff --git a/chrome/browser/repost_form_warning_controller.cc b/chrome/browser/repost_form_warning_controller.cc index 3578221..b7a49ad 100644 --- a/chrome/browser/repost_form_warning_controller.cc +++ b/chrome/browser/repost_form_warning_controller.cc @@ -11,16 +11,18 @@ #include "base/bind.h" #include "base/bind_helpers.h" #include "content/browser/tab_contents/navigation_controller.h" -#include "content/browser/tab_contents/tab_contents.h" #include "content/public/browser/notification_source.h" #include "content/public/browser/notification_types.h" +#include "content/public/browser/web_contents.h" #include "grit/generated_resources.h" #include "ui/base/l10n/l10n_util.h" +using content::WebContents; + RepostFormWarningController::RepostFormWarningController( - TabContents* tab_contents) - : TabModalConfirmDialogDelegate(tab_contents), - navigation_controller_(&tab_contents->GetController()) { + WebContents* web_contents) + : TabModalConfirmDialogDelegate(web_contents), + navigation_controller_(&web_contents->GetController()) { registrar_.Add(this, content::NOTIFICATION_REPOST_WARNING_SHOWN, content::Source<NavigationController>(navigation_controller_)); } diff --git a/chrome/browser/repost_form_warning_controller.h b/chrome/browser/repost_form_warning_controller.h index 808c9d3..ea693e90 100644 --- a/chrome/browser/repost_form_warning_controller.h +++ b/chrome/browser/repost_form_warning_controller.h @@ -10,14 +10,13 @@ #include "chrome/browser/ui/tab_modal_confirm_dialog_delegate.h" class NavigationController; -class TabContents; // This class is used to continue or cancel a pending reload when the // repost form warning is shown. It is owned by the platform-dependent // |RepostFormWarning{Gtk,Mac,View}| classes. class RepostFormWarningController : public TabModalConfirmDialogDelegate { public: - explicit RepostFormWarningController(TabContents* tab_contents); + explicit RepostFormWarningController(content::WebContents* web_contents); virtual ~RepostFormWarningController(); // TabModalConfirmDialogDelegate methods: @@ -36,7 +35,7 @@ class RepostFormWarningController : public TabModalConfirmDialogDelegate { const content::NotificationSource& source, const content::NotificationDetails& details) OVERRIDE; - // Weak pointer; this dialog is cancelled when the TabContents is closed. + // Weak pointer; this dialog is cancelled when the WebContents is closed. NavigationController* navigation_controller_; DISALLOW_COPY_AND_ASSIGN(RepostFormWarningController); diff --git a/chrome/browser/tab_contents/background_contents.cc b/chrome/browser/tab_contents/background_contents.cc index 45652d4..d0a0459 100644 --- a/chrome/browser/tab_contents/background_contents.cc +++ b/chrome/browser/tab_contents/background_contents.cc @@ -78,7 +78,7 @@ bool BackgroundContents::ShouldSuppressDialogs() { return true; } -void BackgroundContents::DidNavigateMainFramePostCommit(TabContents* tab) { +void BackgroundContents::DidNavigateMainFramePostCommit(WebContents* tab) { // Note: because BackgroundContents are only available to extension apps, // navigation is limited to urls within the app's extent. This is enforced in // RenderView::decidePolicyForNavigation. If BackgroundContents become @@ -93,12 +93,12 @@ void BackgroundContents::DidNavigateMainFramePostCommit(TabContents* tab) { } // Forward requests to add a new TabContents to our delegate. -void BackgroundContents::AddNewContents(TabContents* source, - TabContents* new_contents, +void BackgroundContents::AddNewContents(WebContents* source, + WebContents* new_contents, WindowOpenDisposition disposition, const gfx::Rect& initial_pos, bool user_gesture) { - delegate_->AddTabContents( + delegate_->AddWebContents( new_contents, disposition, initial_pos, user_gesture); } diff --git a/chrome/browser/tab_contents/background_contents.h b/chrome/browser/tab_contents/background_contents.h index 1da9704..eb80f2f 100644 --- a/chrome/browser/tab_contents/background_contents.h +++ b/chrome/browser/tab_contents/background_contents.h @@ -26,9 +26,9 @@ class BackgroundContents : public content::WebContentsDelegate, class Delegate { public: // Called by AddNewContents(). Asks the delegate to attach the opened - // TabContents to a suitable container (e.g. browser) or to show it if it's + // WebContents to a suitable container (e.g. browser) or to show it if it's // a popup window. - virtual void AddTabContents(TabContents* new_contents, + virtual void AddWebContents(content::WebContents* new_contents, WindowOpenDisposition disposition, const gfx::Rect& initial_pos, bool user_gesture) = 0; @@ -48,9 +48,10 @@ class BackgroundContents : public content::WebContentsDelegate, // content::WebContentsDelegate implementation: virtual void CloseContents(content::WebContents* source) OVERRIDE; virtual bool ShouldSuppressDialogs() OVERRIDE; - virtual void DidNavigateMainFramePostCommit(TabContents* tab) OVERRIDE; - virtual void AddNewContents(TabContents* source, - TabContents* new_contents, + virtual void DidNavigateMainFramePostCommit( + content::WebContents* tab) OVERRIDE; + virtual void AddNewContents(content::WebContents* source, + content::WebContents* new_contents, WindowOpenDisposition disposition, const gfx::Rect& initial_pos, bool user_gesture) OVERRIDE; diff --git a/chrome/browser/tab_contents/render_view_host_delegate_helper.cc b/chrome/browser/tab_contents/render_view_host_delegate_helper.cc index 86280cf..0842575 100644 --- a/chrome/browser/tab_contents/render_view_host_delegate_helper.cc +++ b/chrome/browser/tab_contents/render_view_host_delegate_helper.cc @@ -270,7 +270,7 @@ TabContents* RenderViewHostDelegateViewHelper::CreateNewWindowFromTabContents( if (new_contents) { if (tab_contents->GetDelegate()) - tab_contents->GetDelegate()->TabContentsCreated(new_contents); + tab_contents->GetDelegate()->WebContentsCreated(new_contents); RetargetingDetails details; details.source_web_contents = tab_contents; diff --git a/chrome/browser/tabs/tab_strip_model.cc b/chrome/browser/tabs/tab_strip_model.cc index 277aea6..d5bca5c 100644 --- a/chrome/browser/tabs/tab_strip_model.cc +++ b/chrome/browser/tabs/tab_strip_model.cc @@ -786,8 +786,8 @@ bool TabStripModel::IsContextMenuCommandEnabled( std::vector<int> indices = GetIndicesForCommand(context_index); for (size_t i = 0; i < indices.size(); ++i) { TabContentsWrapper* tab = GetTabContentsAt(indices[i]); - if (tab && tab->tab_contents()->GetDelegate()->CanReloadContents( - tab->tab_contents())) { + if (tab && tab->web_contents()->GetDelegate()->CanReloadContents( + tab->web_contents())) { return true; } } @@ -847,9 +847,9 @@ void TabStripModel::ExecuteContextMenuCommand( std::vector<int> indices = GetIndicesForCommand(context_index); for (size_t i = 0; i < indices.size(); ++i) { TabContentsWrapper* tab = GetTabContentsAt(indices[i]); - if (tab && tab->tab_contents()->GetDelegate()->CanReloadContents( - tab->tab_contents())) { - tab->tab_contents()->GetController().Reload(true); + if (tab && tab->web_contents()->GetDelegate()->CanReloadContents( + tab->web_contents())) { + tab->web_contents()->GetController().Reload(true); } } break; diff --git a/chrome/browser/ui/blocked_content/blocked_content_container.cc b/chrome/browser/ui/blocked_content/blocked_content_container.cc index bab9545..2529c7c 100644 --- a/chrome/browser/ui/blocked_content/blocked_content_container.cc +++ b/chrome/browser/ui/blocked_content/blocked_content_container.cc @@ -76,7 +76,7 @@ void BlockedContentContainer::LaunchForContents( // We needn't call WasRestored to change its status because the // TabContents::AddNewContents will do it. owner_->web_contents()->AddNewContents( - tab_contents->tab_contents(), + tab_contents->web_contents(), content.disposition, content.bounds, content.user_gesture); @@ -116,8 +116,8 @@ WebContents* BlockedContentContainer::OpenURLFromTab( return owner_->web_contents()->OpenURL(params); } -void BlockedContentContainer::AddNewContents(TabContents* source, - TabContents* new_contents, +void BlockedContentContainer::AddNewContents(WebContents* source, + WebContents* new_contents, WindowOpenDisposition disposition, const gfx::Rect& initial_position, bool user_gesture) { @@ -139,18 +139,18 @@ void BlockedContentContainer::CloseContents(WebContents* source) { } } -void BlockedContentContainer::MoveContents(TabContents* source, +void BlockedContentContainer::MoveContents(WebContents* source, const gfx::Rect& new_bounds) { for (BlockedContents::iterator i(blocked_contents_.begin()); i != blocked_contents_.end(); ++i) { - if (i->tab_contents->tab_contents() == source) { + if (i->tab_contents->web_contents() == source) { i->bounds = new_bounds; break; } } } -bool BlockedContentContainer::IsPopupOrPanel(const TabContents* source) const { +bool BlockedContentContainer::IsPopupOrPanel(const WebContents* source) const { // Assume everything added is a popup. This may turn out to be wrong, but // callers don't cache this information so it should be fine if the value ends // up changing. diff --git a/chrome/browser/ui/blocked_content/blocked_content_container.h b/chrome/browser/ui/blocked_content/blocked_content_container.h index 829ab46..b0637a9 100644 --- a/chrome/browser/ui/blocked_content/blocked_content_container.h +++ b/chrome/browser/ui/blocked_content/blocked_content_container.h @@ -62,8 +62,8 @@ class BlockedContentContainer : public BlockedContentTabHelperDelegate, const content::OpenURLParams& params) OVERRIDE; // Forwards AddNewContents to our |owner_|. - virtual void AddNewContents(TabContents* source, - TabContents* new_contents, + virtual void AddNewContents(content::WebContents* source, + content::WebContents* new_contents, WindowOpenDisposition disposition, const gfx::Rect& initial_position, bool user_gesture) OVERRIDE; @@ -72,10 +72,11 @@ class BlockedContentContainer : public BlockedContentTabHelperDelegate, virtual void CloseContents(content::WebContents* source) OVERRIDE; // Changes the opening rectangle associated with |source|. - virtual void MoveContents(TabContents* source, + virtual void MoveContents(content::WebContents* source, const gfx::Rect& new_bounds) OVERRIDE; - virtual bool IsPopupOrPanel(const TabContents* source) const OVERRIDE; + virtual bool IsPopupOrPanel( + const content::WebContents* source) const OVERRIDE; // Always returns true. virtual bool ShouldSuppressDialogs() OVERRIDE; diff --git a/chrome/browser/ui/blocked_content/blocked_content_tab_helper.cc b/chrome/browser/ui/blocked_content/blocked_content_tab_helper.cc index 908f4046..d6f66e9 100644 --- a/chrome/browser/ui/blocked_content/blocked_content_tab_helper.cc +++ b/chrome/browser/ui/blocked_content/blocked_content_tab_helper.cc @@ -95,7 +95,7 @@ void BlockedContentTabHelper::AddPopup(TabContentsWrapper* new_contents, creator, CONTENT_SETTINGS_TYPE_POPUPS, "") == CONTENT_SETTING_ALLOW) { - web_contents()->AddNewContents(new_contents->tab_contents(), + web_contents()->AddNewContents(new_contents->web_contents(), NEW_POPUP, initial_pos, true); // user_gesture diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc index eaba8b0..23fae44 100644 --- a/chrome/browser/ui/browser.cc +++ b/chrome/browser/ui/browser.cc @@ -1249,7 +1249,7 @@ TabContents* Browser::AddTab(TabContentsWrapper* tab_contents, return tab_contents->tab_contents(); } -void Browser::AddTabContents(TabContents* new_contents, +void Browser::AddWebContents(WebContents* new_contents, WindowOpenDisposition disposition, const gfx::Rect& initial_pos, bool user_gesture) { @@ -2540,7 +2540,7 @@ Browser* Browser::GetBrowserForController( // static void Browser::RunFileChooserHelper( - TabContents* tab, const content::FileChooserParams& params) { + WebContents* tab, const content::FileChooserParams& params) { Profile* profile = Profile::FromBrowserContext(tab->GetBrowserContext()); // FileSelectHelper adds a reference to itself and only releases it after @@ -2552,7 +2552,7 @@ void Browser::RunFileChooserHelper( } // static -void Browser::EnumerateDirectoryHelper(TabContents* tab, int request_id, +void Browser::EnumerateDirectoryHelper(WebContents* tab, int request_id, const FilePath& path) { ChildProcessSecurityPolicy* policy = ChildProcessSecurityPolicy::GetInstance(); @@ -2572,21 +2572,22 @@ void Browser::EnumerateDirectoryHelper(TabContents* tab, int request_id, } // static -void Browser::JSOutOfMemoryHelper(TabContents* tab) { +void Browser::JSOutOfMemoryHelper(WebContents* tab) { TabContentsWrapper* tcw = TabContentsWrapper::GetCurrentWrapperForContents( tab); - if (tcw) { - InfoBarTabHelper* infobar_helper = tcw->infobar_tab_helper(); - infobar_helper->AddInfoBar(new SimpleAlertInfoBarDelegate( - infobar_helper, - NULL, - l10n_util::GetStringUTF16(IDS_JS_OUT_OF_MEMORY_PROMPT), - true)); - } + if (!tcw) + return; + + InfoBarTabHelper* infobar_helper = tcw->infobar_tab_helper(); + infobar_helper->AddInfoBar(new SimpleAlertInfoBarDelegate( + infobar_helper, + NULL, + l10n_util::GetStringUTF16(IDS_JS_OUT_OF_MEMORY_PROMPT), + true)); } // static -void Browser::RegisterProtocolHandlerHelper(TabContents* tab, +void Browser::RegisterProtocolHandlerHelper(WebContents* tab, const std::string& protocol, const GURL& url, const string16& title) { @@ -2618,7 +2619,7 @@ void Browser::RegisterProtocolHandlerHelper(TabContents* tab, } // static -void Browser::RegisterIntentHandlerHelper(TabContents* tab, +void Browser::RegisterIntentHandlerHelper(WebContents* tab, const string16& action, const string16& type, const string16& href, @@ -2658,7 +2659,7 @@ void Browser::RegisterIntentHandlerHelper(TabContents* tab, } // static -void Browser::FindReplyHelper(TabContents* tab, +void Browser::FindReplyHelper(WebContents* tab, int request_id, int number_of_matches, const gfx::Rect& selection_rect, @@ -2675,7 +2676,7 @@ void Browser::FindReplyHelper(TabContents* tab, } // static -void Browser::CrashedPluginHelper(TabContents* tab, +void Browser::CrashedPluginHelper(WebContents* tab, const FilePath& plugin_path) { TabContentsWrapper* tcw = TabContentsWrapper::GetCurrentWrapperForContents( tab); @@ -2710,7 +2711,7 @@ void Browser::CrashedPluginHelper(TabContents* tab, } // static -void Browser::UpdateTargetURLHelper(TabContents* tab, int32 page_id, +void Browser::UpdateTargetURLHelper(WebContents* tab, int32 page_id, const GURL& url) { TabContentsWrapper* tcw = TabContentsWrapper::GetCurrentWrapperForContents( tab); @@ -3077,7 +3078,7 @@ Browser* Browser::CreateNewStripWithContents( browser->tabstrip_model()->AppendTabContents(detached_contents, true); // Make sure the loading state is updated correctly, otherwise the throbber // won't start if the page is loading. - browser->LoadingStateChanged(detached_contents->tab_contents()); + browser->LoadingStateChanged(detached_contents->web_contents()); return browser; } @@ -3192,7 +3193,7 @@ bool Browser::RunUnloadListenerBeforeClosing(TabContentsWrapper* contents) { return Browser::RunUnloadEventsHelper(contents->tab_contents()); } -bool Browser::CanReloadContents(TabContents* source) const { +bool Browser::CanReloadContents(WebContents* source) const { return !is_devtools(); } @@ -3254,7 +3255,7 @@ void Browser::TabInsertedAt(TabContentsWrapper* contents, // Make sure the loading state is updated correctly, otherwise the throbber // won't start if the page is loading. - LoadingStateChanged(contents->tab_contents()); + LoadingStateChanged(contents->web_contents()); // If the tab crashes in the beforeunload or unload handler, it won't be // able to ack. But we know we can close it. @@ -3443,7 +3444,7 @@ WebContents* Browser::OpenURLFromTab(WebContents* source, nav_params.target_contents->tab_contents() : NULL; } -void Browser::NavigationStateChanged(const TabContents* source, +void Browser::NavigationStateChanged(const WebContents* source, unsigned changed_flags) { // Only update the UI when something visible has changed. if (changed_flags) @@ -3458,8 +3459,8 @@ void Browser::NavigationStateChanged(const TabContents* source, UpdateCommandsForTabState(); } -void Browser::AddNewContents(TabContents* source, - TabContents* new_contents, +void Browser::AddNewContents(WebContents* source, + WebContents* new_contents, WindowOpenDisposition disposition, const gfx::Rect& initial_pos, bool user_gesture) { @@ -3472,8 +3473,10 @@ void Browser::AddNewContents(TabContents* source, BlockedContentTabHelper* source_blocked_content = NULL; TabContentsWrapper* new_wrapper = TabContentsWrapper::GetCurrentWrapperForContents(new_contents); - if (!new_wrapper) - new_wrapper = new TabContentsWrapper(new_contents); + if (!new_wrapper) { + new_wrapper = new TabContentsWrapper( + static_cast<TabContents*>(new_contents)); + } if (source) { source_wrapper = TabContentsWrapper::GetCurrentWrapperForContents(source); source_blocked_content = source_wrapper->blocked_content_tab_helper(); @@ -3516,22 +3519,22 @@ void Browser::AddNewContents(TabContents* source, browser::Navigate(¶ms); } -void Browser::ActivateContents(TabContents* contents) { +void Browser::ActivateContents(WebContents* contents) { tab_handler_->GetTabStripModel()->ActivateTabAt( tab_handler_->GetTabStripModel()->GetWrapperIndex(contents), false); window_->Activate(); } -void Browser::DeactivateContents(TabContents* contents) { +void Browser::DeactivateContents(WebContents* contents) { window_->Deactivate(); } -void Browser::LoadingStateChanged(TabContents* source) { +void Browser::LoadingStateChanged(WebContents* source) { window_->UpdateLoadingAnimations( tab_handler_->GetTabStripModel()->TabsAreLoading()); window_->UpdateTitleBar(); - TabContents* selected_contents = GetSelectedTabContents(); + WebContents* selected_contents = GetSelectedTabContents(); if (source == selected_contents) { bool is_loading = source->IsLoading(); UpdateReloadStopState(is_loading, false); @@ -3576,7 +3579,7 @@ void Browser::CloseContents(WebContents* source) { TabStripModel::CLOSE_CREATE_HISTORICAL_TAB); } -void Browser::MoveContents(TabContents* source, const gfx::Rect& pos) { +void Browser::MoveContents(WebContents* source, const gfx::Rect& pos) { if (!IsPopupOrPanel(source)) { NOTREACHED() << "moving invalid browser type"; return; @@ -3584,19 +3587,19 @@ void Browser::MoveContents(TabContents* source, const gfx::Rect& pos) { window_->SetBounds(pos); } -void Browser::DetachContents(TabContents* source) { +void Browser::DetachContents(WebContents* source) { int index = tab_handler_->GetTabStripModel()->GetWrapperIndex(source); if (index >= 0) tab_handler_->GetTabStripModel()->DetachTabContentsAt(index); } -bool Browser::IsPopupOrPanel(const TabContents* source) const { +bool Browser::IsPopupOrPanel(const WebContents* source) const { // A non-tabbed BROWSER is an unconstrained popup. return is_type_popup() || is_type_panel(); } void Browser::ContentsMouseEvent( - TabContents* source, const gfx::Point& location, bool motion) { + WebContents* source, const gfx::Point& location, bool motion) { if (!GetStatusBubble()) return; @@ -3607,7 +3610,7 @@ void Browser::ContentsMouseEvent( } } -void Browser::UpdateTargetURL(TabContents* source, int32 page_id, +void Browser::UpdateTargetURL(WebContents* source, int32 page_id, const GURL& url) { Browser::UpdateTargetURLHelper(source, page_id, url); @@ -3629,8 +3632,8 @@ void Browser::ContentsZoomChange(bool zoom_in) { ExecuteCommand(zoom_in ? IDC_ZOOM_PLUS : IDC_ZOOM_MINUS); } -void Browser::TabContentsFocused(TabContents* tab_content) { - window_->TabContentsFocused(tab_content); +void Browser::WebContentsFocused(WebContents* contents) { + window_->WebContentsFocused(contents); } bool Browser::TakeFocus(bool reverse) { @@ -3645,7 +3648,7 @@ bool Browser::IsApplication() const { return is_app(); } -void Browser::ConvertContentsToApplication(TabContents* contents) { +void Browser::ConvertContentsToApplication(WebContents* contents) { const GURL& url = contents->GetController().GetActiveEntry()->GetURL(); std::string app_name = web_app::GenerateApplicationNameFromURL(url); @@ -3655,7 +3658,7 @@ void Browser::ConvertContentsToApplication(TabContents* contents) { TabContentsWrapper* wrapper = TabContentsWrapper::GetCurrentWrapperForContents(contents); if (!wrapper) - wrapper = new TabContentsWrapper(contents); + wrapper = new TabContentsWrapper(static_cast<TabContents*>(contents)); app_browser->tabstrip_model()->AppendTabContents(wrapper, true); contents->GetMutableRendererPrefs()->can_accept_load_drops = false; @@ -3663,7 +3666,7 @@ void Browser::ConvertContentsToApplication(TabContents* contents) { app_browser->window()->Show(); } -void Browser::BeforeUnloadFired(TabContents* tab, +void Browser::BeforeUnloadFired(WebContents* tab, bool proceed, bool* proceed_to_fire_unload) { if (!is_attempting_to_close_browser_) { @@ -3723,7 +3726,7 @@ bool DisplayOldDownloadsUI() { } // anonymous namespace -void Browser::OnStartDownload(TabContents* source, +void Browser::OnStartDownload(WebContents* source, content::DownloadItem* download) { TabContentsWrapper* wrapper = TabContentsWrapper::GetCurrentWrapperForContents(source); @@ -3776,14 +3779,14 @@ void Browser::ShowPageInfo(content::BrowserContext* browser_context, window()->ShowPageInfo(profile, url, ssl, show_history); } -void Browser::ViewSourceForTab(TabContents* source, const GURL& page_url) { +void Browser::ViewSourceForTab(WebContents* source, const GURL& page_url) { DCHECK(source); int index = tabstrip_model()->GetWrapperIndex(source); TabContentsWrapper* wrapper = tabstrip_model()->GetTabContentsAt(index); ViewSource(wrapper); } -void Browser::ViewSourceForFrame(TabContents* source, +void Browser::ViewSourceForFrame(WebContents* source, const GURL& frame_url, const std::string& frame_content_state) { DCHECK(source); @@ -3807,10 +3810,10 @@ void Browser::HandleKeyboardEvent(const NativeWebKeyboardEvent& event) { window()->HandleKeyboardEvent(event); } -void Browser::ShowRepostFormWarningDialog(TabContents *tab_contents) { +void Browser:: ShowRepostFormWarningDialog(WebContents* source) { browser::ShowTabModalConfirmDialog( - new RepostFormWarningController(tab_contents), - TabContentsWrapper::GetCurrentWrapperForContents(tab_contents)); + new RepostFormWarningController(source), + TabContentsWrapper::GetCurrentWrapperForContents(source)); } void Browser::ShowContentSettingsPage(ContentSettingsType content_type) { @@ -3830,20 +3833,20 @@ bool Browser::ShouldAddNavigationToHistory( return !IsApplication(); } -void Browser::TabContentsCreated(TabContents* new_contents) { +void Browser::WebContentsCreated(WebContents* new_contents) { // Create a TabContentsWrapper now, so all observers are in place, as the // network requests for its initial navigation will start immediately. The // TabContents will later be inserted into this browser using // Browser::Navigate via AddNewContents. The latter will retrieve the newly // created TabContentsWrapper from TabContents object. - new TabContentsWrapper(new_contents); + new TabContentsWrapper(static_cast<TabContents*>(new_contents)); } -void Browser::ContentRestrictionsChanged(TabContents* source) { +void Browser::ContentRestrictionsChanged(WebContents* source) { UpdateCommandsForContentRestrictionState(); } -void Browser::RendererUnresponsive(TabContents* source) { +void Browser::RendererUnresponsive(WebContents* source) { // Ignore hangs if print preview is open. TabContentsWrapper* source_wrapper = TabContentsWrapper::GetCurrentWrapperForContents(source); @@ -3862,11 +3865,11 @@ void Browser::RendererUnresponsive(TabContents* source) { browser::ShowHungRendererDialog(source); } -void Browser::RendererResponsive(TabContents* source) { +void Browser::RendererResponsive(WebContents* source) { browser::HideHungRendererDialog(source); } -void Browser::WorkerCrashed(TabContents* source) { +void Browser::WorkerCrashed(WebContents* source) { TabContentsWrapper* wrapper = TabContentsWrapper::GetCurrentWrapperForContents(source); InfoBarTabHelper* infobar_helper = wrapper->infobar_tab_helper(); @@ -3877,12 +3880,12 @@ void Browser::WorkerCrashed(TabContents* source) { true)); } -void Browser::DidNavigateMainFramePostCommit(TabContents* tab) { +void Browser::DidNavigateMainFramePostCommit(WebContents* tab) { if (tab == GetSelectedTabContents()) UpdateBookmarkBarState(BOOKMARK_BAR_STATE_CHANGE_TAB_STATE); } -void Browser::DidNavigateToPendingEntry(TabContents* tab) { +void Browser::DidNavigateToPendingEntry(WebContents* tab) { if (tab == GetSelectedTabContents()) UpdateBookmarkBarState(BOOKMARK_BAR_STATE_CHANGE_TAB_STATE); } @@ -3891,37 +3894,37 @@ content::JavaScriptDialogCreator* Browser::GetJavaScriptDialogCreator() { return GetJavaScriptDialogCreatorInstance(); } -void Browser::RunFileChooser(TabContents* tab, +void Browser::RunFileChooser(WebContents* tab, const content::FileChooserParams& params) { RunFileChooserHelper(tab, params); } -void Browser::EnumerateDirectory(TabContents* tab, int request_id, +void Browser::EnumerateDirectory(WebContents* tab, int request_id, const FilePath& path) { EnumerateDirectoryHelper(tab, request_id, path); } -void Browser::ToggleFullscreenModeForTab(TabContents* tab, +void Browser::ToggleFullscreenModeForTab(WebContents* tab, bool enter_fullscreen) { fullscreen_controller_->ToggleFullscreenModeForTab(tab, enter_fullscreen); } -bool Browser::IsFullscreenForTab(const TabContents* tab) const { +bool Browser::IsFullscreenForTab(const WebContents* tab) const { return fullscreen_controller_->IsFullscreenForTab(tab); } -void Browser::JSOutOfMemory(TabContents* tab) { +void Browser::JSOutOfMemory(WebContents* tab) { JSOutOfMemoryHelper(tab); } -void Browser::RegisterProtocolHandler(TabContents* tab, +void Browser::RegisterProtocolHandler(WebContents* tab, const std::string& protocol, const GURL& url, const string16& title) { RegisterProtocolHandlerHelper(tab, protocol, url, title); } -void Browser::RegisterIntentHandler(TabContents* tab, +void Browser::RegisterIntentHandler(WebContents* tab, const string16& action, const string16& type, const string16& href, @@ -3931,7 +3934,7 @@ void Browser::RegisterIntentHandler(TabContents* tab, } void Browser::WebIntentDispatch( - TabContents* tab, content::WebIntentsDispatcher* intents_dispatcher) { + WebContents* tab, content::WebIntentsDispatcher* intents_dispatcher) { if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableWebIntents)) return; @@ -3944,7 +3947,7 @@ void Browser::WebIntentDispatch( intents_dispatcher->GetIntent().type); } -void Browser::FindReply(TabContents* tab, +void Browser::FindReply(WebContents* tab, int request_id, int number_of_matches, const gfx::Rect& selection_rect, @@ -3954,16 +3957,16 @@ void Browser::FindReply(TabContents* tab, active_match_ordinal, final_update); } -void Browser::CrashedPlugin(TabContents* tab, const FilePath& plugin_path) { +void Browser::CrashedPlugin(WebContents* tab, const FilePath& plugin_path) { CrashedPluginHelper(tab, plugin_path); } -void Browser::UpdatePreferredSize(TabContents* source, +void Browser::UpdatePreferredSize(WebContents* source, const gfx::Size& pref_size) { window_->UpdatePreferredSize(source, pref_size); } -void Browser::RequestToLockMouse(TabContents* tab) { +void Browser::RequestToLockMouse(WebContents* tab) { fullscreen_controller_->RequestToLockMouse(tab); } @@ -4737,7 +4740,7 @@ void Browser::UpdateToolbar(bool should_restore_state) { window_->UpdateToolbar(GetSelectedTabContentsWrapper(), should_restore_state); } -void Browser::ScheduleUIUpdate(const TabContents* source, +void Browser::ScheduleUIUpdate(const WebContents* source, unsigned changed_flags) { if (!source) return; @@ -4815,7 +4818,7 @@ void Browser::ProcessPendingUIUpdates() { for (UpdateMap::const_iterator i = scheduled_updates_.begin(); i != scheduled_updates_.end(); ++i) { // Do not dereference |contents|, it may be out-of-date! - const TabContents* contents = i->first; + const WebContents* contents = i->first; unsigned flags = i->second; if (contents == GetSelectedTabContents()) { diff --git a/chrome/browser/ui/browser.h b/chrome/browser/ui/browser.h index d388b05..20838e8 100644 --- a/chrome/browser/ui/browser.h +++ b/chrome/browser/ui/browser.h @@ -440,11 +440,11 @@ class Browser : public TabHandlerDelegate, bool pin, bool from_last_session, SessionStorageNamespace* storage_namespace); - // Creates a new tab with the already-created TabContents 'new_contents'. + // Creates a new tab with the already-created WebContents 'new_contents'. // The window for the added contents will be reparented correctly when this // method returns. If |disposition| is NEW_POPUP, |pos| should hold the // initial position. - void AddTabContents(TabContents* new_contents, + void AddWebContents(content::WebContents* new_contents, WindowOpenDisposition disposition, const gfx::Rect& initial_pos, bool user_gesture); @@ -679,23 +679,24 @@ class Browser : public TabHandlerDelegate, // Helper function to display the file selection dialog. static void RunFileChooserHelper( - TabContents* tab, const content::FileChooserParams& params); + content::WebContents* tab, const content::FileChooserParams& params); // Helper function to enumerate a directory. - static void EnumerateDirectoryHelper(TabContents* tab, int request_id, + static void EnumerateDirectoryHelper(content::WebContents* tab, + int request_id, const FilePath& path); // Helper function to handle JS out of memory notifications - static void JSOutOfMemoryHelper(TabContents* tab); + static void JSOutOfMemoryHelper(content::WebContents* tab); // Helper function to register a protocol handler. - static void RegisterProtocolHandlerHelper(TabContents* tab, + static void RegisterProtocolHandlerHelper(content::WebContents* tab, const std::string& protocol, const GURL& url, const string16& title); // Helper function to register an intent handler. - static void RegisterIntentHandlerHelper(TabContents* tab, + static void RegisterIntentHandlerHelper(content::WebContents* tab, const string16& action, const string16& type, const string16& href, @@ -703,7 +704,7 @@ class Browser : public TabHandlerDelegate, const string16& disposition); // Helper function to handle find results. - static void FindReplyHelper(TabContents* tab, + static void FindReplyHelper(content::WebContents* tab, int request_id, int number_of_matches, const gfx::Rect& selection_rect, @@ -711,11 +712,11 @@ class Browser : public TabHandlerDelegate, bool final_update); // Helper function to handle crashed plugin notifications. - static void CrashedPluginHelper(TabContents* tab, + static void CrashedPluginHelper(content::WebContents* tab, const FilePath& plugin_path); // Helper function to handle url update notifications. - static void UpdateTargetURLHelper(TabContents* tab, int32 page_id, + static void UpdateTargetURLHelper(content::WebContents* tab, int32 page_id, const GURL& url); // Calls ExecuteCommandWithDisposition with the given disposition. @@ -916,101 +917,109 @@ class Browser : public TabHandlerDelegate, virtual content::WebContents* OpenURLFromTab( content::WebContents* source, const content::OpenURLParams& params) OVERRIDE; - virtual void NavigationStateChanged(const TabContents* source, + virtual void NavigationStateChanged(const content::WebContents* source, unsigned changed_flags) OVERRIDE; - virtual void AddNewContents(TabContents* source, - TabContents* new_contents, + virtual void AddNewContents(content::WebContents* source, + content::WebContents* new_contents, WindowOpenDisposition disposition, const gfx::Rect& initial_pos, bool user_gesture) OVERRIDE; - virtual void ActivateContents(TabContents* contents) OVERRIDE; - virtual void DeactivateContents(TabContents* contents) OVERRIDE; - virtual void LoadingStateChanged(TabContents* source) OVERRIDE; + virtual void ActivateContents(content::WebContents* contents) OVERRIDE; + virtual void DeactivateContents(content::WebContents* contents) OVERRIDE; + virtual void LoadingStateChanged(content::WebContents* source) OVERRIDE; virtual void CloseContents(content::WebContents* source) OVERRIDE; - virtual void MoveContents(TabContents* source, const gfx::Rect& pos) OVERRIDE; - virtual void DetachContents(TabContents* source) OVERRIDE; - virtual bool IsPopupOrPanel(const TabContents* source) const OVERRIDE; - virtual bool CanReloadContents(TabContents* source) const OVERRIDE; - virtual void UpdateTargetURL(TabContents* source, int32 page_id, + virtual void MoveContents(content::WebContents* source, + const gfx::Rect& pos) OVERRIDE; + virtual void DetachContents(content::WebContents* source) OVERRIDE; + virtual bool IsPopupOrPanel( + const content::WebContents* source) const OVERRIDE; + virtual bool CanReloadContents(content::WebContents* source) const OVERRIDE; + virtual void UpdateTargetURL(content::WebContents* source, int32 page_id, const GURL& url) OVERRIDE; - virtual void ContentsMouseEvent( - TabContents* source, const gfx::Point& location, bool motion) OVERRIDE; + virtual void ContentsMouseEvent(content::WebContents* source, + const gfx::Point& location, + bool motion) OVERRIDE; virtual void ContentsZoomChange(bool zoom_in) OVERRIDE; - virtual void TabContentsFocused(TabContents* tab_content) OVERRIDE; + virtual void WebContentsFocused(content::WebContents* content) OVERRIDE; virtual bool TakeFocus(bool reverse) OVERRIDE; virtual bool IsApplication() const OVERRIDE; - virtual void ConvertContentsToApplication(TabContents* source) OVERRIDE; - virtual void BeforeUnloadFired(TabContents* source, + virtual void ConvertContentsToApplication( + content::WebContents* source) OVERRIDE; + virtual void BeforeUnloadFired(content::WebContents* source, bool proceed, bool* proceed_to_fire_unload) OVERRIDE; virtual void SetFocusToLocationBar(bool select_all) OVERRIDE; virtual void RenderWidgetShowing() OVERRIDE; virtual int GetExtraRenderViewHeight() const OVERRIDE; - virtual void OnStartDownload(TabContents* source, - content::DownloadItem* download) OVERRIDE; + virtual void OnStartDownload(content::WebContents* source, + content::DownloadItem* download) OVERRIDE; virtual void ShowPageInfo(content::BrowserContext* browser_context, const GURL& url, const content::SSLStatus& ssl, bool show_history) OVERRIDE; - virtual void ViewSourceForTab(TabContents* source, + virtual void ViewSourceForTab(content::WebContents* source, const GURL& page_url) OVERRIDE; virtual void ViewSourceForFrame( - TabContents* source, + content::WebContents* source, const GURL& frame_url, const std::string& frame_content_state) OVERRIDE; virtual bool PreHandleKeyboardEvent(const NativeWebKeyboardEvent& event, bool* is_keyboard_shortcut) OVERRIDE; virtual void HandleKeyboardEvent( const NativeWebKeyboardEvent& event) OVERRIDE; - virtual void ShowRepostFormWarningDialog(TabContents* tab_contents) OVERRIDE; + virtual void ShowRepostFormWarningDialog( + content::WebContents* source) OVERRIDE; virtual bool ShouldAddNavigationToHistory( const history::HistoryAddPageArgs& add_page_args, content::NavigationType navigation_type) OVERRIDE; - virtual void TabContentsCreated(TabContents* new_contents) OVERRIDE; - virtual void ContentRestrictionsChanged(TabContents* source) OVERRIDE; - virtual void RendererUnresponsive(TabContents* source) OVERRIDE; - virtual void RendererResponsive(TabContents* source) OVERRIDE; - virtual void WorkerCrashed(TabContents* source) OVERRIDE; - virtual void DidNavigateMainFramePostCommit(TabContents* tab) OVERRIDE; - virtual void DidNavigateToPendingEntry(TabContents* tab) OVERRIDE; + virtual void WebContentsCreated(content::WebContents* new_contents) OVERRIDE; + virtual void ContentRestrictionsChanged( + content::WebContents* source) OVERRIDE; + virtual void RendererUnresponsive(content::WebContents* source) OVERRIDE; + virtual void RendererResponsive(content::WebContents* source) OVERRIDE; + virtual void WorkerCrashed(content::WebContents* source) OVERRIDE; + virtual void DidNavigateMainFramePostCommit( + content::WebContents* tab) OVERRIDE; + virtual void DidNavigateToPendingEntry(content::WebContents* tab) OVERRIDE; virtual content::JavaScriptDialogCreator* - GetJavaScriptDialogCreator() OVERRIDE; + GetJavaScriptDialogCreator() OVERRIDE; virtual void RunFileChooser( - TabContents* tab, + content::WebContents* tab, const content::FileChooserParams& params) OVERRIDE; - virtual void EnumerateDirectory(TabContents* tab, int request_id, - const FilePath& path) OVERRIDE; - virtual void ToggleFullscreenModeForTab(TabContents* tab, + virtual void EnumerateDirectory(content::WebContents* tab, int request_id, + const FilePath& path) OVERRIDE; + virtual void ToggleFullscreenModeForTab(content::WebContents* tab, bool enter_fullscreen) OVERRIDE; - virtual bool IsFullscreenForTab(const TabContents* tab) const OVERRIDE; - virtual void JSOutOfMemory(TabContents* tab) OVERRIDE; - virtual void RegisterProtocolHandler(TabContents* tab, + virtual bool IsFullscreenForTab( + const content::WebContents* tab) const OVERRIDE; + virtual void JSOutOfMemory(content::WebContents* tab) OVERRIDE; + virtual void RegisterProtocolHandler(content::WebContents* tab, const std::string& protocol, const GURL& url, const string16& title) OVERRIDE; - virtual void RegisterIntentHandler(TabContents* tab, + virtual void RegisterIntentHandler(content::WebContents* tab, const string16& action, const string16& type, const string16& href, const string16& title, const string16& disposition) OVERRIDE; virtual void WebIntentDispatch( - TabContents* tab, + content::WebContents* tab, content::WebIntentsDispatcher* intents_dispatcher) OVERRIDE; - virtual void UpdatePreferredSize(TabContents* source, + virtual void UpdatePreferredSize(content::WebContents* source, const gfx::Size& pref_size) OVERRIDE; - virtual void FindReply(TabContents* tab, + virtual void FindReply(content::WebContents* tab, int request_id, int number_of_matches, const gfx::Rect& selection_rect, int active_match_ordinal, bool final_update) OVERRIDE; - virtual void CrashedPlugin(TabContents* tab, + virtual void CrashedPlugin(content::WebContents* tab, const FilePath& plugin_path) OVERRIDE; - virtual void RequestToLockMouse(TabContents* tab) OVERRIDE; + virtual void RequestToLockMouse(content::WebContents* tab) OVERRIDE; virtual void LostMouseLock() OVERRIDE; // Overridden from CoreTabHelperDelegate: @@ -1131,7 +1140,8 @@ class Browser : public TabHandlerDelegate, // updates), then scheduled_updates_ is updated for the |source| and update // pair and a task is scheduled (assuming it isn't running already) // that invokes ProcessPendingUIUpdates. - void ScheduleUIUpdate(const TabContents* source, unsigned changed_flags); + void ScheduleUIUpdate(const content::WebContents* source, + unsigned changed_flags); // Processes all pending updates to the UI that have been scheduled by // ScheduleUIUpdate in scheduled_updates_. @@ -1309,7 +1319,7 @@ class Browser : public TabHandlerDelegate, // UI update coalescing and handling //////////////////////////////////////// - typedef std::map<const TabContents*, int> UpdateMap; + typedef std::map<const content::WebContents*, int> UpdateMap; // Maps from TabContents to pending UI updates that need to be processed. // We don't update things like the URL or tab title right away to avoid diff --git a/chrome/browser/ui/browser_dialogs.h b/chrome/browser/ui/browser_dialogs.h index ae28046..e395ad1 100644 --- a/chrome/browser/ui/browser_dialogs.h +++ b/chrome/browser/ui/browser_dialogs.h @@ -20,6 +20,10 @@ class TabContentsWrapper; class TabModalConfirmDialogDelegate; class TemplateURL; +namespace content { +class WebContents; +} + namespace browser { #if defined(IPC_MESSAGE_LOG_ENABLED) @@ -50,15 +54,15 @@ void ShowExtensionInstalledBubble(const Extension* extension, const SkBitmap& icon, Profile* profile); -// Shows or hide the hung renderer dialog for the given TabContents. -// We need to pass the TabContents to the dialog, because multiple tabs can hang +// Shows or hide the hung renderer dialog for the given WebContents. +// We need to pass the WebContents to the dialog, because multiple tabs can hang // and it needs to keep track of which tabs are currently hung. -void ShowHungRendererDialog(TabContents* contents); -void HideHungRendererDialog(TabContents* contents); +void ShowHungRendererDialog(content::WebContents* contents); +void HideHungRendererDialog(content::WebContents* contents); // Native implementations of hung renderer dialogs. -void ShowNativeHungRendererDialog(TabContents* contents); -void HideNativeHungRendererDialog(TabContents* contents); +void ShowNativeHungRendererDialog(content::WebContents* contents); +void HideNativeHungRendererDialog(content::WebContents* contents); // Show the edit search engine dialog. void ConfirmAddSearchProvider(const TemplateURL* template_url, diff --git a/chrome/browser/ui/browser_window.h b/chrome/browser/ui/browser_window.h index 8ef62ac..1428f64 100644 --- a/chrome/browser/ui/browser_window.h +++ b/chrome/browser/ui/browser_window.h @@ -263,9 +263,9 @@ class BrowserWindow { // during infobar animations). virtual int GetExtraRenderViewHeight() const = 0; - // Notification that |tab_contents| got the focus through user action (click + // Notification that |contents| got the focus through user action (click // on the page). - virtual void TabContentsFocused(TabContents* tab_contents) = 0; + virtual void WebContentsFocused(content::WebContents* contents) = 0; // Shows the page info using the specified information. // |url| is the url of the page/frame the info applies to, |ssl| is the SSL @@ -347,7 +347,7 @@ class BrowserWindow { // changed. We might choose to update the window size to accomodate this // change. // Note that this won't be fired if we change tabs. - virtual void UpdatePreferredSize(TabContents* tab_contents, + virtual void UpdatePreferredSize(content::WebContents* web_contents, const gfx::Size& pref_size) {} // Construct a BrowserWindow implementation for the specified |browser|. diff --git a/chrome/browser/ui/cocoa/browser_window_cocoa.h b/chrome/browser/ui/cocoa/browser_window_cocoa.h index 41afe84..b0030fc 100644 --- a/chrome/browser/ui/cocoa/browser_window_cocoa.h +++ b/chrome/browser/ui/cocoa/browser_window_cocoa.h @@ -95,7 +95,7 @@ class BrowserWindowCocoa : public BrowserWindow, virtual void ConfirmBrowserCloseWithPendingDownloads() OVERRIDE; virtual void UserChangedTheme() OVERRIDE; virtual int GetExtraRenderViewHeight() const OVERRIDE; - virtual void TabContentsFocused(TabContents* tab_contents) OVERRIDE; + virtual void WebContentsFocused(content::WebContents* contents) OVERRIDE; virtual void ShowPageInfo(Profile* profile, const GURL& url, const content::SSLStatus& ssl, diff --git a/chrome/browser/ui/cocoa/browser_window_cocoa.mm b/chrome/browser/ui/cocoa/browser_window_cocoa.mm index 22e75fa..007e070 100644 --- a/chrome/browser/ui/cocoa/browser_window_cocoa.mm +++ b/chrome/browser/ui/cocoa/browser_window_cocoa.mm @@ -51,6 +51,7 @@ #include "ui/gfx/rect.h" using content::SSLStatus; +using content::WebContents; // Replicate specific 10.7 SDK declarations for building with prior SDKs. #if !defined(MAC_OS_X_VERSION_10_7) || \ @@ -457,7 +458,7 @@ int BrowserWindowCocoa::GetExtraRenderViewHeight() const { return 0; } -void BrowserWindowCocoa::TabContentsFocused(TabContents* tab_contents) { +void BrowserWindowCocoa::WebContentsFocused(WebContents* contents) { NOTIMPLEMENTED(); } diff --git a/chrome/browser/ui/cocoa/fullscreen_exit_bubble_controller_unittest.mm b/chrome/browser/ui/cocoa/fullscreen_exit_bubble_controller_unittest.mm index 5956602..f49e36f 100644 --- a/chrome/browser/ui/cocoa/fullscreen_exit_bubble_controller_unittest.mm +++ b/chrome/browser/ui/cocoa/fullscreen_exit_bubble_controller_unittest.mm @@ -13,6 +13,7 @@ #include "chrome/common/chrome_notification_types.h" #include "chrome/test/base/ui_test_utils.h" #include "content/browser/site_instance.h" +#include "content/browser/tab_contents/tab_contents.h" #include "content/public/browser/notification_service.h" #include "testing/gtest_mac.h" #include "ui/base/accelerators/accelerator_cocoa.h" diff --git a/chrome/browser/ui/cocoa/html_dialog_window_controller.mm b/chrome/browser/ui/cocoa/html_dialog_window_controller.mm index 1e57a5f..e13c5df 100644 --- a/chrome/browser/ui/cocoa/html_dialog_window_controller.mm +++ b/chrome/browser/ui/cocoa/html_dialog_window_controller.mm @@ -52,7 +52,7 @@ public: virtual bool ShouldShowDialogTitle() const OVERRIDE { return true; } // HtmlDialogTabContentsDelegate declarations. - virtual void MoveContents(TabContents* source, const gfx::Rect& pos); + virtual void MoveContents(WebContents* source, const gfx::Rect& pos); virtual void HandleKeyboardEvent(const NativeWebKeyboardEvent& event); virtual void CloseContents(WebContents* source) OVERRIDE; @@ -195,7 +195,7 @@ void HtmlDialogWindowDelegateBridge::CloseContents(WebContents* source) { OnDialogClosed(std::string()); } -void HtmlDialogWindowDelegateBridge::MoveContents(TabContents* source, +void HtmlDialogWindowDelegateBridge::MoveContents(WebContents* source, const gfx::Rect& pos) { // TODO(akalin): Actually set the window bounds. } diff --git a/chrome/browser/ui/cocoa/hung_renderer_controller.h b/chrome/browser/ui/cocoa/hung_renderer_controller.h index 250099a..3ae8267 100644 --- a/chrome/browser/ui/cocoa/hung_renderer_controller.h +++ b/chrome/browser/ui/cocoa/hung_renderer_controller.h @@ -12,11 +12,11 @@ // // The dialog itself displays a list of frozen tabs, all of which // share a render process. Since there can only be a single dialog -// open at a time, if showForTabContents is called for a different +// open at a time, if showForWebContents is called for a different // tab, the dialog is repurposed to show a warning for the new tab. // -// The caller is required to call endForTabContents before deleting -// any TabContents object. +// The caller is required to call endForWebContents before deleting +// any WebContents object. #import <Cocoa/Cocoa.h> @@ -25,9 +25,12 @@ #import "base/memory/scoped_ptr.h" @class MultiKeyEquivalentButton; -class TabContents; class WebContentsObserverBridge; +namespace content { +class WebContents; +} + @interface HungRendererController : NSWindowController<NSTableViewDataSource> { @private IBOutlet MultiKeyEquivalentButton* waitButton_; @@ -36,18 +39,18 @@ class WebContentsObserverBridge; IBOutlet NSImageView* imageView_; IBOutlet NSTextField* messageView_; - // The TabContents for which this dialog is open. Should never be + // The WebContents for which this dialog is open. Should never be // NULL while this dialog is open. - TabContents* hungContents_; + content::WebContents* hungContents_; // Observes |hungContents_| in case it closes while the panel is up. scoped_ptr<WebContentsObserverBridge> hungContentsObserver_; - // Backing data for |tableView_|. Titles of each TabContents that + // Backing data for |tableView_|. Titles of each WebContents that // shares a renderer process with |hungContents_|. scoped_nsobject<NSArray> hungTitles_; - // Favicons of each TabContents that shares a renderer process with + // Favicons of each WebContents that shares a renderer process with // |hungContents_|. scoped_nsobject<NSArray> hungFavicons_; } @@ -61,14 +64,14 @@ class WebContentsObserverBridge; // Modifies the dialog to show a warning for the given tab contents. // The dialog will contain a list of all tabs that share a renderer // process with |contents|. The caller must not delete any tab -// contents without first calling endForTabContents. -- (void)showForTabContents:(TabContents*)contents; +// contents without first calling endForWebContents. +- (void)showForWebContents:(content::WebContents*)contents; // Notifies the dialog that |contents| is either responsive or closed. // If |contents| shares the same render process as the tab contents // this dialog was created for, this function will close the dialog. // If |contents| has a different process, this function does nothing. -- (void)endForTabContents:(TabContents*)contents; +- (void)endForWebContents:(content::WebContents*)contents; // Called by |hungContentsObserver_| to indicate that |hungContents_| // has gone away. diff --git a/chrome/browser/ui/cocoa/hung_renderer_controller.mm b/chrome/browser/ui/cocoa/hung_renderer_controller.mm index 7d63db5..f9eeee9 100644 --- a/chrome/browser/ui/cocoa/hung_renderer_controller.mm +++ b/chrome/browser/ui/cocoa/hung_renderer_controller.mm @@ -41,9 +41,9 @@ HungRendererController* g_instance = NULL; class WebContentsObserverBridge : public content::WebContentsObserver { public: - WebContentsObserverBridge(TabContents* tab_contents, + WebContentsObserverBridge(WebContents* web_contents, HungRendererController* controller) - : content::WebContentsObserver(tab_contents), + : content::WebContentsObserver(web_contents), controller_(controller) { } @@ -165,7 +165,7 @@ class WebContentsObserverBridge : public content::WebContentsObserver { // Tabs closed by their renderer will close the dialog (that's // activity!), so it would not add much value. Also, the views // implementation only monitors the initiating tab. -- (void)showForTabContents:(TabContents*)contents { +- (void)showForWebContents:(WebContents*)contents { DCHECK(contents); hungContents_ = contents; hungContentsObserver_.reset(new WebContentsObserverBridge(contents, self)); @@ -189,7 +189,7 @@ class WebContentsObserverBridge : public content::WebContentsObserver { [self showWindow:self]; } -- (void)endForTabContents:(TabContents*)contents { +- (void)endForWebContents:(WebContents*)contents { DCHECK(contents); DCHECK(hungContents_); if (hungContents_ && hungContents_->GetRenderProcessHost() == @@ -218,18 +218,18 @@ class WebContentsObserverBridge : public content::WebContentsObserver { namespace browser { -void ShowNativeHungRendererDialog(TabContents* contents) { +void ShowNativeHungRendererDialog(WebContents* contents) { if (!logging::DialogsAreSuppressed()) { if (!g_instance) g_instance = [[HungRendererController alloc] initWithWindowNibName:@"HungRendererDialog"]; - [g_instance showForTabContents:contents]; + [g_instance showForWebContents:contents]; } } -void HideNativeHungRendererDialog(TabContents* contents) { +void HideNativeHungRendererDialog(WebContents* contents) { if (!logging::DialogsAreSuppressed() && g_instance) - [g_instance endForTabContents:contents]; + [g_instance endForWebContents:contents]; } } // namespace browser diff --git a/chrome/browser/ui/fullscreen_controller.cc b/chrome/browser/ui/fullscreen_controller.cc index 8f2ca4c..deef679 100644 --- a/chrome/browser/ui/fullscreen_controller.cc +++ b/chrome/browser/ui/fullscreen_controller.cc @@ -19,6 +19,7 @@ #include "content/public/browser/user_metrics.h" using content::UserMetricsAction; +using content::WebContents; FullscreenController::FullscreenController(BrowserWindow* window, Profile* profile, @@ -38,7 +39,7 @@ bool FullscreenController::IsFullscreenForTab() const { return fullscreened_tab_ != NULL; } -bool FullscreenController::IsFullscreenForTab(const TabContents* tab) const { +bool FullscreenController::IsFullscreenForTab(const WebContents* tab) const { const TabContentsWrapper* wrapper = TabContentsWrapper::GetCurrentWrapperForContents(tab); if (!wrapper || (wrapper != fullscreened_tab_)) @@ -48,7 +49,7 @@ bool FullscreenController::IsFullscreenForTab(const TabContents* tab) const { return true; } -void FullscreenController::RequestToLockMouse(TabContents* tab) { +void FullscreenController::RequestToLockMouse(WebContents* tab) { // Mouse Lock is only permitted when browser is in tab fullscreen. if (!IsFullscreenForTab(tab)) { tab->GotResponseToLockMouseRequest(false); @@ -82,7 +83,7 @@ void FullscreenController::RequestToLockMouse(TabContents* tab) { UpdateFullscreenExitBubbleContent(); } -void FullscreenController::ToggleFullscreenModeForTab(TabContents* tab, +void FullscreenController::ToggleFullscreenModeForTab(WebContents* tab, bool enter_fullscreen) { if (tab != browser_->GetSelectedTabContents()) return; diff --git a/chrome/browser/ui/fullscreen_controller.h b/chrome/browser/ui/fullscreen_controller.h index 6c707f7..8e95efc 100644 --- a/chrome/browser/ui/fullscreen_controller.h +++ b/chrome/browser/ui/fullscreen_controller.h @@ -19,6 +19,10 @@ class Profile; class TabContents; class TabContentsWrapper; +namespace content { +class WebContents; +} + // There are two different kinds of fullscreen mode - "tab fullscreen" and // "browser fullscreen". "Tab fullscreen" refers to when a tab enters // fullscreen mode via the JS fullscreen API, and "browser fullscreen" refers @@ -39,11 +43,12 @@ class FullscreenController : public base::RefCounted<FullscreenController> { // Querying. bool IsFullscreenForTab() const; - bool IsFullscreenForTab(const TabContents* tab) const; + bool IsFullscreenForTab(const content::WebContents* tab) const; // Requests. - void RequestToLockMouse(TabContents* tab); - void ToggleFullscreenModeForTab(TabContents* tab, bool enter_fullscreen); + void RequestToLockMouse(content::WebContents* tab); + void ToggleFullscreenModeForTab(content::WebContents* tab, + bool enter_fullscreen); #if defined(OS_MACOSX) void TogglePresentationMode(bool for_tab); #endif diff --git a/chrome/browser/ui/gtk/browser_window_gtk.cc b/chrome/browser/ui/gtk/browser_window_gtk.cc index ded53c9..b075d3c 100644 --- a/chrome/browser/ui/gtk/browser_window_gtk.cc +++ b/chrome/browser/ui/gtk/browser_window_gtk.cc @@ -103,6 +103,7 @@ #include "ui/gfx/skia_utils_gtk.h" using content::SSLStatus; +using content::WebContents; namespace { @@ -1066,7 +1067,7 @@ int BrowserWindowGtk::GetExtraRenderViewHeight() const { return sum; } -void BrowserWindowGtk::TabContentsFocused(TabContents* tab_contents) { +void BrowserWindowGtk::WebContentsFocused(WebContents* contents) { NOTIMPLEMENTED(); } diff --git a/chrome/browser/ui/gtk/browser_window_gtk.h b/chrome/browser/ui/gtk/browser_window_gtk.h index 47558c1..a0a7029a 100644 --- a/chrome/browser/ui/gtk/browser_window_gtk.h +++ b/chrome/browser/ui/gtk/browser_window_gtk.h @@ -133,7 +133,7 @@ class BrowserWindowGtk : public BrowserWindow, virtual void ConfirmBrowserCloseWithPendingDownloads() OVERRIDE; virtual void UserChangedTheme() OVERRIDE; virtual int GetExtraRenderViewHeight() const OVERRIDE; - virtual void TabContentsFocused(TabContents* tab_contents) OVERRIDE; + virtual void WebContentsFocused(content::WebContents* contents) OVERRIDE; virtual void ShowPageInfo(Profile* profile, const GURL& url, const content::SSLStatus& ssl, diff --git a/chrome/browser/ui/gtk/create_application_shortcuts_dialog_gtk.cc b/chrome/browser/ui/gtk/create_application_shortcuts_dialog_gtk.cc index d4607f1..176ef19 100644 --- a/chrome/browser/ui/gtk/create_application_shortcuts_dialog_gtk.cc +++ b/chrome/browser/ui/gtk/create_application_shortcuts_dialog_gtk.cc @@ -295,7 +295,7 @@ CreateWebApplicationShortcutsDialogGtk::CreateWebApplicationShortcutsDialogGtk( void CreateWebApplicationShortcutsDialogGtk::OnCreatedShortcut() { if (tab_contents_->tab_contents()->GetDelegate()) tab_contents_->tab_contents()->GetDelegate()->ConvertContentsToApplication( - tab_contents_->tab_contents()); + tab_contents_->web_contents()); } CreateChromeApplicationShortcutsDialogGtk:: diff --git a/chrome/browser/ui/gtk/hung_renderer_dialog_gtk.cc b/chrome/browser/ui/gtk/hung_renderer_dialog_gtk.cc index b9a26b1..f666d03 100644 --- a/chrome/browser/ui/gtk/hung_renderer_dialog_gtk.cc +++ b/chrome/browser/ui/gtk/hung_renderer_dialog_gtk.cc @@ -38,16 +38,16 @@ class HungRendererDialogGtk { public: HungRendererDialogGtk(); ~HungRendererDialogGtk() {} - void ShowForTabContents(TabContents* hung_contents); + void ShowForWebContents(WebContents* hung_contents); void Hide(); - void EndForTabContents(TabContents* hung_contents); + void EndForWebContents(WebContents* hung_contents); private: // Dismiss the panel if |contents_| is closed or its renderer exits. class WebContentsObserverImpl : public content::WebContentsObserver { public: WebContentsObserverImpl(HungRendererDialogGtk* dialog, - TabContents* contents) + WebContents* contents) : content::WebContentsObserver(contents), dialog_(dialog) { } @@ -80,7 +80,7 @@ class HungRendererDialogGtk { GtkDialog* dialog_; GtkListStore* model_; - TabContents* contents_; + WebContents* contents_; scoped_ptr<WebContentsObserverImpl> contents_observer_; DISALLOW_COPY_AND_ASSIGN(HungRendererDialogGtk); @@ -176,7 +176,7 @@ void HungRendererDialogGtk::Init() { gtk_container_add(GTK_CONTAINER(scroll_list), tree_view); } -void HungRendererDialogGtk::ShowForTabContents(TabContents* hung_contents) { +void HungRendererDialogGtk::ShowForWebContents(WebContents* hung_contents) { DCHECK(hung_contents && dialog_); contents_ = hung_contents; contents_observer_.reset(new WebContentsObserverImpl(this, contents_)); @@ -208,12 +208,12 @@ void HungRendererDialogGtk::ShowForTabContents(TabContents* hung_contents) { void HungRendererDialogGtk::Hide() { gtk_widget_hide(GTK_WIDGET(dialog_)); - // Since we're closing, we no longer need this TabContents. + // Since we're closing, we no longer need this WebContents. contents_observer_.reset(); contents_ = NULL; } -void HungRendererDialogGtk::EndForTabContents(TabContents* contents) { +void HungRendererDialogGtk::EndForWebContents(WebContents* contents) { DCHECK(contents); if (contents_ && contents_->GetRenderProcessHost() == contents->GetRenderProcessHost()) { @@ -253,17 +253,17 @@ void HungRendererDialogGtk::OnResponse(GtkWidget* dialog, int response_id) { namespace browser { -void ShowNativeHungRendererDialog(TabContents* contents) { +void ShowNativeHungRendererDialog(WebContents* contents) { if (!logging::DialogsAreSuppressed()) { if (!g_instance) g_instance = new HungRendererDialogGtk(); - g_instance->ShowForTabContents(contents); + g_instance->ShowForWebContents(contents); } } -void HideNativeHungRendererDialog(TabContents* contents) { +void HideNativeHungRendererDialog(WebContents* contents) { if (!logging::DialogsAreSuppressed() && g_instance) - g_instance->EndForTabContents(contents); + g_instance->EndForWebContents(contents); } } // namespace browser diff --git a/chrome/browser/ui/gtk/tabs/dragged_tab_controller_gtk.cc b/chrome/browser/ui/gtk/tabs/dragged_tab_controller_gtk.cc index dfd2b88..d80d4f7 100644 --- a/chrome/browser/ui/gtk/tabs/dragged_tab_controller_gtk.cc +++ b/chrome/browser/ui/gtk/tabs/dragged_tab_controller_gtk.cc @@ -186,14 +186,14 @@ WebContents* DraggedTabControllerGtk::OpenURLFromTab( return NULL; } -void DraggedTabControllerGtk::NavigationStateChanged(const TabContents* source, +void DraggedTabControllerGtk::NavigationStateChanged(const WebContents* source, unsigned changed_flags) { if (dragged_view_.get()) dragged_view_->Update(); } -void DraggedTabControllerGtk::AddNewContents(TabContents* source, - TabContents* new_contents, +void DraggedTabControllerGtk::AddNewContents(WebContents* source, + WebContents* new_contents, WindowOpenDisposition disposition, const gfx::Rect& initial_pos, bool user_gesture) { @@ -207,7 +207,7 @@ void DraggedTabControllerGtk::AddNewContents(TabContents* source, } } -void DraggedTabControllerGtk::LoadingStateChanged(TabContents* source) { +void DraggedTabControllerGtk::LoadingStateChanged(WebContents* source) { // TODO(jhawkins): It would be nice to respond to this message by changing the // screen shot in the dragged tab. if (dragged_view_.get()) diff --git a/chrome/browser/ui/gtk/tabs/dragged_tab_controller_gtk.h b/chrome/browser/ui/gtk/tabs/dragged_tab_controller_gtk.h index 45ec934..198b885 100644 --- a/chrome/browser/ui/gtk/tabs/dragged_tab_controller_gtk.h +++ b/chrome/browser/ui/gtk/tabs/dragged_tab_controller_gtk.h @@ -88,14 +88,14 @@ class DraggedTabControllerGtk : public content::NotificationObserver, virtual content::WebContents* OpenURLFromTab( content::WebContents* source, const content::OpenURLParams& params) OVERRIDE; - virtual void NavigationStateChanged(const TabContents* source, + virtual void NavigationStateChanged(const content::WebContents* source, unsigned changed_flags) OVERRIDE; - virtual void AddNewContents(TabContents* source, - TabContents* new_contents, + virtual void AddNewContents(content::WebContents* source, + content::WebContents* new_contents, WindowOpenDisposition disposition, const gfx::Rect& initial_pos, bool user_gesture) OVERRIDE; - virtual void LoadingStateChanged(TabContents* source) OVERRIDE; + virtual void LoadingStateChanged(content::WebContents* source) OVERRIDE; virtual content::JavaScriptDialogCreator* GetJavaScriptDialogCreator() OVERRIDE; diff --git a/chrome/browser/ui/gtk/web_intent_picker_gtk.cc b/chrome/browser/ui/gtk/web_intent_picker_gtk.cc index af40ebb..d9be02f 100644 --- a/chrome/browser/ui/gtk/web_intent_picker_gtk.cc +++ b/chrome/browser/ui/gtk/web_intent_picker_gtk.cc @@ -42,6 +42,8 @@ #include "ui/gfx/gtk_util.h" #include "ui/gfx/image/image.h" +using content::WebContents; + namespace { // The width in pixels of the area between the icon on the left and the close @@ -315,7 +317,7 @@ WebIntentPickerGtk::InlineDispositionDelegate::~InlineDispositionDelegate() {} bool WebIntentPickerGtk::InlineDispositionDelegate::IsPopupOrPanel( - const TabContents* source) const { + const WebContents* source) const { return true; } diff --git a/chrome/browser/ui/gtk/web_intent_picker_gtk.h b/chrome/browser/ui/gtk/web_intent_picker_gtk.h index ccf2571..c0020755 100644 --- a/chrome/browser/ui/gtk/web_intent_picker_gtk.h +++ b/chrome/browser/ui/gtk/web_intent_picker_gtk.h @@ -59,7 +59,8 @@ class WebIntentPickerGtk : public WebIntentPicker, public: InlineDispositionDelegate(); virtual ~InlineDispositionDelegate(); - virtual bool IsPopupOrPanel(const TabContents* source) const OVERRIDE; + virtual bool IsPopupOrPanel( + const content::WebContents* source) const OVERRIDE; virtual bool ShouldAddNavigationToHistory( const history::HistoryAddPageArgs& add_page_args, content::NavigationType navigation_type) OVERRIDE; diff --git a/chrome/browser/ui/panels/native_panel.h b/chrome/browser/ui/panels/native_panel.h index bac770a..0fa2d47 100644 --- a/chrome/browser/ui/panels/native_panel.h +++ b/chrome/browser/ui/panels/native_panel.h @@ -11,7 +11,10 @@ class FindBar; class NativePanelTesting; -class TabContents; + +namespace content { +class WebContents; +} namespace gfx { class Rect; @@ -49,7 +52,7 @@ class NativePanel { virtual void ShowTaskManagerForPanel() = 0; virtual FindBar* CreatePanelFindBar() = 0; virtual void NotifyPanelOnUserChangedTheme() = 0; - virtual void PanelTabContentsFocused(TabContents* tab_contents) = 0; + virtual void PanelWebContentsFocused(content::WebContents* contents) = 0; virtual void PanelCut() = 0; virtual void PanelCopy() = 0; virtual void PanelPaste() = 0; diff --git a/chrome/browser/ui/panels/panel.cc b/chrome/browser/ui/panels/panel.cc index e723deb..f4d896c 100644 --- a/chrome/browser/ui/panels/panel.cc +++ b/chrome/browser/ui/panels/panel.cc @@ -454,8 +454,8 @@ int Panel::GetExtraRenderViewHeight() const { return 0; } -void Panel::TabContentsFocused(TabContents* tab_contents) { - native_panel_->PanelTabContentsFocused(tab_contents); +void Panel::WebContentsFocused(WebContents* contents) { + native_panel_->PanelWebContentsFocused(contents); } void Panel::ShowPageInfo(Profile* profile, @@ -562,7 +562,7 @@ void Panel::ShowKeyboardOverlay(gfx::NativeWindow owning_window) { } #endif -void Panel::UpdatePreferredSize(TabContents* tab_contents, +void Panel::UpdatePreferredSize(WebContents* web_contents, const gfx::Size& pref_size) { if (auto_resizable_) { return manager()->OnPreferredWindowSizeChanged(this, diff --git a/chrome/browser/ui/panels/panel.h b/chrome/browser/ui/panels/panel.h index da377f1..c6d02e5 100644 --- a/chrome/browser/ui/panels/panel.h +++ b/chrome/browser/ui/panels/panel.h @@ -145,7 +145,7 @@ class Panel : public BrowserWindow, virtual void ConfirmBrowserCloseWithPendingDownloads() OVERRIDE; virtual void UserChangedTheme() OVERRIDE; virtual int GetExtraRenderViewHeight() const OVERRIDE; - virtual void TabContentsFocused(TabContents* tab_contents) OVERRIDE; + virtual void WebContentsFocused(content::WebContents* contents) OVERRIDE; virtual void ShowPageInfo(Profile* profile, const GURL& url, const content::SSLStatus& ssl, @@ -181,7 +181,7 @@ class Panel : public BrowserWindow, virtual void ShowMobileSetup() OVERRIDE; virtual void ShowKeyboardOverlay(gfx::NativeWindow owning_window) OVERRIDE; #endif - virtual void UpdatePreferredSize(TabContents* tab_contents, + virtual void UpdatePreferredSize(content::WebContents* web_contents, const gfx::Size& pref_size) OVERRIDE; virtual void ShowAvatarBubble(TabContents* tab_contents, const gfx::Rect& rect) OVERRIDE; diff --git a/chrome/browser/ui/panels/panel_browser_view.cc b/chrome/browser/ui/panels/panel_browser_view.cc index cf175cb..86a84ad 100644 --- a/chrome/browser/ui/panels/panel_browser_view.cc +++ b/chrome/browser/ui/panels/panel_browser_view.cc @@ -20,6 +20,8 @@ #include "ui/views/controls/label.h" #include "ui/views/widget/widget.h" +using content::WebContents; + namespace { // The threshold to differentiate the short click and long click. const int kShortClickThresholdMs = 200; @@ -299,8 +301,8 @@ void PanelBrowserView::NotifyPanelOnUserChangedTheme() { UserChangedTheme(); } -void PanelBrowserView::PanelTabContentsFocused(TabContents* tab_contents) { - TabContentsFocused(tab_contents); +void PanelBrowserView::PanelWebContentsFocused(WebContents* contents) { + WebContentsFocused(contents); } void PanelBrowserView::PanelCut() { diff --git a/chrome/browser/ui/panels/panel_browser_view.h b/chrome/browser/ui/panels/panel_browser_view.h index a21a923..4838190 100644 --- a/chrome/browser/ui/panels/panel_browser_view.h +++ b/chrome/browser/ui/panels/panel_browser_view.h @@ -90,7 +90,7 @@ class PanelBrowserView : public BrowserView, virtual void ShowTaskManagerForPanel() OVERRIDE; virtual FindBar* CreatePanelFindBar() OVERRIDE; virtual void NotifyPanelOnUserChangedTheme() OVERRIDE; - virtual void PanelTabContentsFocused(TabContents* tab_contents) OVERRIDE; + virtual void PanelWebContentsFocused(content::WebContents* contents) OVERRIDE; virtual void PanelCut() OVERRIDE; virtual void PanelCopy() OVERRIDE; virtual void PanelPaste() OVERRIDE; diff --git a/chrome/browser/ui/panels/panel_browser_window_cocoa.h b/chrome/browser/ui/panels/panel_browser_window_cocoa.h index 5b70a79..82c8b66 100644 --- a/chrome/browser/ui/panels/panel_browser_window_cocoa.h +++ b/chrome/browser/ui/panels/panel_browser_window_cocoa.h @@ -43,7 +43,7 @@ class PanelBrowserWindowCocoa : public NativePanel, virtual void ShowTaskManagerForPanel() OVERRIDE; virtual FindBar* CreatePanelFindBar() OVERRIDE; virtual void NotifyPanelOnUserChangedTheme() OVERRIDE; - virtual void PanelTabContentsFocused(TabContents* tab_contents) OVERRIDE; + virtual void PanelWebContentsFocused(content::WebContents* contents) OVERRIDE; virtual void PanelCut() OVERRIDE; virtual void PanelCopy() OVERRIDE; virtual void PanelPaste() OVERRIDE; diff --git a/chrome/browser/ui/panels/panel_browser_window_cocoa.mm b/chrome/browser/ui/panels/panel_browser_window_cocoa.mm index 12e7f27..d414b22 100644 --- a/chrome/browser/ui/panels/panel_browser_window_cocoa.mm +++ b/chrome/browser/ui/panels/panel_browser_window_cocoa.mm @@ -17,6 +17,8 @@ #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" #include "content/public/browser/native_web_keyboard_event.h" +using content::WebContents; + namespace { // Use this instead of 0 for minimum size of a window when doing opening and @@ -181,8 +183,8 @@ void PanelBrowserWindowCocoa::NotifyPanelOnUserChangedTheme() { NOTIMPLEMENTED(); } -void PanelBrowserWindowCocoa::PanelTabContentsFocused( - TabContents* tab_contents) { +void PanelBrowserWindowCocoa::PanelWebContentsFocused( + WebContents* contents) { // TODO(jianli): to be implemented. } diff --git a/chrome/browser/ui/panels/panel_browser_window_gtk.cc b/chrome/browser/ui/panels/panel_browser_window_gtk.cc index f8ed908..aa43765 100644 --- a/chrome/browser/ui/panels/panel_browser_window_gtk.cc +++ b/chrome/browser/ui/panels/panel_browser_window_gtk.cc @@ -15,6 +15,8 @@ #include "ui/base/dragdrop/gtk_dnd_util.h" #include "ui/base/x/work_area_watcher_x.h" +using content::WebContents; + namespace { // RGB values for titlebar in draw attention state. A shade of orange. @@ -325,8 +327,8 @@ void PanelBrowserWindowGtk::NotifyPanelOnUserChangedTheme() { UserChangedTheme(); } -void PanelBrowserWindowGtk::PanelTabContentsFocused(TabContents* tab_contents) { - TabContentsFocused(tab_contents); +void PanelBrowserWindowGtk::PanelWebContentsFocused(WebContents* contents) { + WebContentsFocused(contents); } void PanelBrowserWindowGtk::PanelCut() { diff --git a/chrome/browser/ui/panels/panel_browser_window_gtk.h b/chrome/browser/ui/panels/panel_browser_window_gtk.h index 83d3e70..6a1292d 100644 --- a/chrome/browser/ui/panels/panel_browser_window_gtk.h +++ b/chrome/browser/ui/panels/panel_browser_window_gtk.h @@ -75,7 +75,7 @@ class PanelBrowserWindowGtk : public BrowserWindowGtk, virtual void ShowTaskManagerForPanel() OVERRIDE; virtual FindBar* CreatePanelFindBar() OVERRIDE; virtual void NotifyPanelOnUserChangedTheme() OVERRIDE; - virtual void PanelTabContentsFocused(TabContents* tab_contents) OVERRIDE; + virtual void PanelWebContentsFocused(content::WebContents* contents) OVERRIDE; virtual void PanelCut() OVERRIDE; virtual void PanelCopy() OVERRIDE; virtual void PanelPaste() OVERRIDE; diff --git a/chrome/browser/ui/tab_modal_confirm_dialog_delegate.cc b/chrome/browser/ui/tab_modal_confirm_dialog_delegate.cc index 4b97bb4..5514905 100644 --- a/chrome/browser/ui/tab_modal_confirm_dialog_delegate.cc +++ b/chrome/browser/ui/tab_modal_confirm_dialog_delegate.cc @@ -11,11 +11,13 @@ #include "grit/generated_resources.h" #include "ui/base/l10n/l10n_util.h" +using content::WebContents; + TabModalConfirmDialogDelegate::TabModalConfirmDialogDelegate( - TabContents* tab_contents) + WebContents* web_contents) : window_(NULL), closing_(false) { - NavigationController* controller = &tab_contents->GetController(); + NavigationController* controller = &web_contents->GetController(); registrar_.Add(this, content::NOTIFICATION_LOAD_START, content::Source<NavigationController>(controller)); registrar_.Add(this, content::NOTIFICATION_TAB_CLOSING, diff --git a/chrome/browser/ui/tab_modal_confirm_dialog_delegate.h b/chrome/browser/ui/tab_modal_confirm_dialog_delegate.h index 7055a6f..3e105dc 100644 --- a/chrome/browser/ui/tab_modal_confirm_dialog_delegate.h +++ b/chrome/browser/ui/tab_modal_confirm_dialog_delegate.h @@ -12,17 +12,21 @@ #include "content/public/browser/notification_observer.h" #include "content/public/browser/notification_registrar.h" +class ConstrainedWindow; + +namespace content { +class WebContents; +} + namespace gfx { class Image; } -class ConstrainedWindow; -class TabContents; // This class acts as the delegate for a simple tab-modal dialog confirming // whether the user wants to execute a certain action. class TabModalConfirmDialogDelegate : public content::NotificationObserver { public: - explicit TabModalConfirmDialogDelegate(TabContents* tab_contents); + explicit TabModalConfirmDialogDelegate(content::WebContents* web_contents); virtual ~TabModalConfirmDialogDelegate(); void set_window(ConstrainedWindow* window) { window_ = window; } diff --git a/chrome/browser/ui/views/aura/app_list_window.cc b/chrome/browser/ui/views/aura/app_list_window.cc index e9fd69f..28cdda8 100644 --- a/chrome/browser/ui/views/aura/app_list_window.cc +++ b/chrome/browser/ui/views/aura/app_list_window.cc @@ -14,6 +14,8 @@ #include "content/browser/tab_contents/tab_contents.h" #include "ui/views/widget/widget.h" +using content::WebContents; + AppListWindow::AppListWindow(const gfx::Rect& bounds, const ash::ShellDelegate::SetWidgetCallback& callback) : widget_(NULL), @@ -63,7 +65,7 @@ bool AppListWindow::TakeFocus(bool reverse) { return true; } -bool AppListWindow::IsPopupOrPanel(const TabContents* source) const { +bool AppListWindow::IsPopupOrPanel(const WebContents* source) const { return true; } diff --git a/chrome/browser/ui/views/aura/app_list_window.h b/chrome/browser/ui/views/aura/app_list_window.h index f02b489..9fe5191 100644 --- a/chrome/browser/ui/views/aura/app_list_window.h +++ b/chrome/browser/ui/views/aura/app_list_window.h @@ -41,7 +41,8 @@ class AppListWindow : public views::WidgetDelegate, virtual bool HandleContextMenu(const ContextMenuParams& params) OVERRIDE; virtual void HandleKeyboardEvent( const NativeWebKeyboardEvent& event) OVERRIDE; - virtual bool IsPopupOrPanel(const TabContents* source) const OVERRIDE; + virtual bool IsPopupOrPanel( + const content::WebContents* source) const OVERRIDE; virtual bool TakeFocus(bool reverse) OVERRIDE; // TabFirstRenderWatcher::Delegate implementation: diff --git a/chrome/browser/ui/views/create_application_shortcut_view.cc b/chrome/browser/ui/views/create_application_shortcut_view.cc index 3cff6a3..a6c976c 100644 --- a/chrome/browser/ui/views/create_application_shortcut_view.cc +++ b/chrome/browser/ui/views/create_application_shortcut_view.cc @@ -438,7 +438,7 @@ bool CreateUrlApplicationShortcutView::Accept() { tab_contents_->extension_tab_helper()->SetAppIcon(shortcut_info_.favicon); if (tab_contents_->tab_contents()->GetDelegate()) { tab_contents_->tab_contents()->GetDelegate()->ConvertContentsToApplication( - tab_contents_->tab_contents()); + tab_contents_->web_contents()); } return true; } diff --git a/chrome/browser/ui/views/frame/browser_view.cc b/chrome/browser/ui/views/frame/browser_view.cc index 4726a8f..6bb16ed 100644 --- a/chrome/browser/ui/views/frame/browser_view.cc +++ b/chrome/browser/ui/views/frame/browser_view.cc @@ -1170,8 +1170,8 @@ int BrowserView::GetExtraRenderViewHeight() const { return 0; } -void BrowserView::TabContentsFocused(TabContents* tab_contents) { - contents_container_->TabContentsFocused(tab_contents); +void BrowserView::WebContentsFocused(WebContents* contents) { + contents_container_->WebContentsFocused(contents); } void BrowserView::ShowPageInfo(Profile* profile, diff --git a/chrome/browser/ui/views/frame/browser_view.h b/chrome/browser/ui/views/frame/browser_view.h index f50cb3d..0fcad51 100644 --- a/chrome/browser/ui/views/frame/browser_view.h +++ b/chrome/browser/ui/views/frame/browser_view.h @@ -312,7 +312,7 @@ class BrowserView : public BrowserWindow, virtual void ConfirmBrowserCloseWithPendingDownloads() OVERRIDE; virtual void UserChangedTheme() OVERRIDE; virtual int GetExtraRenderViewHeight() const OVERRIDE; - virtual void TabContentsFocused(TabContents* source) OVERRIDE; + virtual void WebContentsFocused(content::WebContents* contents) OVERRIDE; virtual void ShowPageInfo(Profile* profile, const GURL& url, const content::SSLStatus& ssl, diff --git a/chrome/browser/ui/views/html_dialog_view.cc b/chrome/browser/ui/views/html_dialog_view.cc index 92c4e5a..f0aedd9 100644 --- a/chrome/browser/ui/views/html_dialog_view.cc +++ b/chrome/browser/ui/views/html_dialog_view.cc @@ -210,7 +210,7 @@ bool HtmlDialogView::HandleContextMenu(const ContextMenuParams& params) { //////////////////////////////////////////////////////////////////////////////// // content::WebContentsDelegate implementation: -void HtmlDialogView::MoveContents(TabContents* source, const gfx::Rect& pos) { +void HtmlDialogView::MoveContents(WebContents* source, const gfx::Rect& pos) { // The contained web page wishes to resize itself. We let it do this because // if it's a dialog we know about, we trust it not to be mean to the user. GetWidget()->SetBounds(pos); diff --git a/chrome/browser/ui/views/html_dialog_view.h b/chrome/browser/ui/views/html_dialog_view.h index 5987650..9f651f3 100644 --- a/chrome/browser/ui/views/html_dialog_view.h +++ b/chrome/browser/ui/views/html_dialog_view.h @@ -79,7 +79,8 @@ class HtmlDialogView virtual bool HandleContextMenu(const ContextMenuParams& params) OVERRIDE; // Overridden from content::WebContentsDelegate: - virtual void MoveContents(TabContents* source, const gfx::Rect& pos) OVERRIDE; + virtual void MoveContents(content::WebContents* source, + const gfx::Rect& pos) OVERRIDE; virtual void HandleKeyboardEvent(const NativeWebKeyboardEvent& event) OVERRIDE; virtual void CloseContents(content::WebContents* source) OVERRIDE; diff --git a/chrome/browser/ui/views/hung_renderer_view.cc b/chrome/browser/ui/views/hung_renderer_view.cc index cc719bf..42df19f 100644 --- a/chrome/browser/ui/views/hung_renderer_view.cc +++ b/chrome/browser/ui/views/hung_renderer_view.cc @@ -47,7 +47,7 @@ HungRendererDialogView* g_instance = NULL; class HungPagesTableModel : public views::GroupTableModel { public: - // The Delegate is notified any time a TabContents the model is listening to + // The Delegate is notified any time a WebContents the model is listening to // is destroyed. class Delegate { public: @@ -60,13 +60,13 @@ class HungPagesTableModel : public views::GroupTableModel { explicit HungPagesTableModel(Delegate* delegate); virtual ~HungPagesTableModel(); - void InitForTabContents(TabContents* hung_contents); + void InitForWebContents(WebContents* hung_contents); // Returns the first RenderProcessHost, or NULL if there aren't any - // TabContents. + // WebContents. content::RenderProcessHost* GetRenderProcessHost(); - // Returns the first RenderViewHost, or NULL if there aren't any TabContents. + // Returns the first RenderViewHost, or NULL if there aren't any WebContents. RenderViewHost* GetRenderViewHost(); // Overridden from views::GroupTableModel: @@ -77,7 +77,7 @@ class HungPagesTableModel : public views::GroupTableModel { virtual void GetGroupRangeForItem(int item, views::GroupRange* range); private: - // Used to track a single TabContents. If the TabContents is destroyed + // Used to track a single WebContents. If the WebContents is destroyed // TabDestroyed() is invoked on the model. class WebContentsObserverImpl : public content::WebContentsObserver { public: @@ -103,7 +103,7 @@ class HungPagesTableModel : public views::GroupTableModel { DISALLOW_COPY_AND_ASSIGN(WebContentsObserverImpl); }; - // Invoked when a TabContents is destroyed. Cleans up |tab_observers_| and + // Invoked when a WebContents is destroyed. Cleans up |tab_observers_| and // notifies the observer and delegate. void TabDestroyed(WebContentsObserverImpl* tab); @@ -137,7 +137,7 @@ RenderViewHost* HungPagesTableModel::GetRenderViewHost() { tab_observers_[0]->web_contents()->GetRenderViewHost(); } -void HungPagesTableModel::InitForTabContents(TabContents* hung_contents) { +void HungPagesTableModel::InitForWebContents(WebContents* hung_contents) { tab_observers_.reset(); if (hung_contents) { // Force hung_contents to be first. @@ -235,8 +235,8 @@ class HungRendererDialogView : public views::DialogDelegateView, HungRendererDialogView(); ~HungRendererDialogView(); - void ShowForTabContents(TabContents* contents); - void EndForTabContents(TabContents* contents); + void ShowForWebContents(WebContents* contents); + void EndForWebContents(WebContents* contents); // views::DialogDelegateView overrides: virtual string16 GetWindowTitle() const OVERRIDE; @@ -266,8 +266,8 @@ class HungRendererDialogView : public views::DialogDelegateView, void CreateKillButtonView(); // Returns the bounds the dialog should be displayed at to be meaningfully - // associated with the specified TabContents. - gfx::Rect GetDisplayBounds(TabContents* contents); + // associated with the specified WebContents. + gfx::Rect GetDisplayBounds(WebContents* contents); static void InitClass(); @@ -323,7 +323,7 @@ HungRendererDialogView::~HungRendererDialogView() { hung_pages_table_->SetModel(NULL); } -void HungRendererDialogView::ShowForTabContents(TabContents* contents) { +void HungRendererDialogView::ShowForWebContents(WebContents* contents) { DCHECK(contents && GetWidget()); // Don't show the warning unless the foreground window is the frame, or this @@ -345,17 +345,17 @@ void HungRendererDialogView::ShowForTabContents(TabContents* contents) { GetWidget()->StackAboveWidget(insert_after); // We only do this if the window isn't active (i.e. hasn't been shown yet, - // or is currently shown but deactivated for another TabContents). This is + // or is currently shown but deactivated for another WebContents). This is // because this window is a singleton, and it's possible another active // renderer may hang while this one is showing, and we don't want to reset // the list of hung pages for a potentially unrelated renderer while this // one is showing. - hung_pages_table_model_->InitForTabContents(contents); + hung_pages_table_model_->InitForWebContents(contents); GetWidget()->Show(); } } -void HungRendererDialogView::EndForTabContents(TabContents* contents) { +void HungRendererDialogView::EndForWebContents(WebContents* contents) { DCHECK(contents); if (hung_pages_table_model_->RowCount() == 0 || hung_pages_table_model_->GetRenderProcessHost() == @@ -363,7 +363,7 @@ void HungRendererDialogView::EndForTabContents(TabContents* contents) { GetWidget()->Close(); // Close is async, make sure we drop our references to the tab immediately // (it may be going away). - hung_pages_table_model_->InitForTabContents(NULL); + hung_pages_table_model_->InitForWebContents(NULL); } } @@ -523,7 +523,7 @@ void HungRendererDialogView::CreateKillButtonView() { } gfx::Rect HungRendererDialogView::GetDisplayBounds( - TabContents* contents) { + WebContents* contents) { HWND contents_hwnd = contents->GetNativeView(); RECT contents_bounds_rect; GetWindowRect(contents_hwnd, &contents_bounds_rect); @@ -555,17 +555,17 @@ static HungRendererDialogView* CreateHungRendererDialogView() { namespace browser { -void ShowNativeHungRendererDialog(TabContents* contents) { +void ShowNativeHungRendererDialog(WebContents* contents) { if (!logging::DialogsAreSuppressed()) { if (!g_instance) g_instance = CreateHungRendererDialogView(); - g_instance->ShowForTabContents(contents); + g_instance->ShowForWebContents(contents); } } -void HideNativeHungRendererDialog(TabContents* contents) { +void HideNativeHungRendererDialog(WebContents* contents) { if (!logging::DialogsAreSuppressed() && g_instance) - g_instance->EndForTabContents(contents); + g_instance->EndForWebContents(contents); } } // namespace browser diff --git a/chrome/browser/ui/views/tab_contents/native_tab_contents_container.h b/chrome/browser/ui/views/tab_contents/native_tab_contents_container.h index 396fc71..cdb286c 100644 --- a/chrome/browser/ui/views/tab_contents/native_tab_contents_container.h +++ b/chrome/browser/ui/views/tab_contents/native_tab_contents_container.h @@ -9,23 +9,28 @@ class RenderViewHost; class TabContents; class TabContentsContainer; + +namespace content { +class WebContents; +} + namespace views { class View; } // An interface that the TabContentsContainer uses to talk to a platform- -// specific view that hosts the native handle of the TabContents' view. +// specific view that hosts the native handle of the WebContents' view. class NativeTabContentsContainer { public: // Creates an appropriate native container for the current platform. static NativeTabContentsContainer* CreateNativeContainer( TabContentsContainer* container); - // Attaches the new TabContents to the native container. - virtual void AttachContents(TabContents* contents) = 0; + // Attaches the new WebContents to the native container. + virtual void AttachContents(content::WebContents* contents) = 0; - // Detaches the old TabContents from the native container. - virtual void DetachContents(TabContents* contents) = 0; + // Detaches the old WebContents from the native container. + virtual void DetachContents(content::WebContents* contents) = 0; // Tells the container to update less frequently during resizing operations // so performance is better. @@ -35,13 +40,13 @@ class NativeTabContentsContainer { // Returns the value of GetFastResize() the last time layout occurred. virtual bool FastResizeAtLastLayout() const = 0; - // Tells the container that the RenderViewHost for the attached TabContents + // Tells the container that the RenderViewHost for the attached WebContents // has changed and it should update focus. virtual void RenderViewHostChanged(RenderViewHost* old_host, RenderViewHost* new_host) = 0; - // Tells the container that |tab_contents| got the focus. - virtual void TabContentsFocused(TabContents* tab_contents) = 0; + // Tells the container that |contents| got the focus. + virtual void WebContentsFocused(content::WebContents* contents) = 0; // Retrieves the views::View that hosts the TabContents. virtual views::View* GetView() = 0; diff --git a/chrome/browser/ui/views/tab_contents/native_tab_contents_container_aura.cc b/chrome/browser/ui/views/tab_contents/native_tab_contents_container_aura.cc index 9d0e980..b998388 100644 --- a/chrome/browser/ui/views/tab_contents/native_tab_contents_container_aura.cc +++ b/chrome/browser/ui/views/tab_contents/native_tab_contents_container_aura.cc @@ -15,6 +15,8 @@ #include "ui/views/focus/widget_focus_manager.h" #include "ui/views/views_delegate.h" +using content::WebContents; + //////////////////////////////////////////////////////////////////////////////// // NativeTabContentsContainerAura, public: @@ -30,7 +32,7 @@ NativeTabContentsContainerAura::~NativeTabContentsContainerAura() { //////////////////////////////////////////////////////////////////////////////// // NativeTabContentsContainerAura, NativeTabContentsContainer overrides: -void NativeTabContentsContainerAura::AttachContents(TabContents* contents) { +void NativeTabContentsContainerAura::AttachContents(WebContents* contents) { // We need to register the tab contents window with the BrowserContainer so // that the BrowserContainer is the focused view when the focus is on the // TabContents window (for the TabContents case). @@ -39,7 +41,7 @@ void NativeTabContentsContainerAura::AttachContents(TabContents* contents) { Attach(contents->GetNativeView()); } -void NativeTabContentsContainerAura::DetachContents(TabContents* contents) { +void NativeTabContentsContainerAura::DetachContents(WebContents* contents) { // Detach the TabContents. Do this before we unparent the // TabContentsViewViews so that the window hierarchy is intact for any // cleanup during Detach(). @@ -70,8 +72,7 @@ views::View* NativeTabContentsContainerAura::GetView() { return this; } -void NativeTabContentsContainerAura::TabContentsFocused( - TabContents* tab_contents) { +void NativeTabContentsContainerAura::WebContentsFocused(WebContents* contents) { views::FocusManager* focus_manager = GetFocusManager(); if (!focus_manager) { NOTREACHED(); diff --git a/chrome/browser/ui/views/tab_contents/native_tab_contents_container_aura.h b/chrome/browser/ui/views/tab_contents/native_tab_contents_container_aura.h index cdd967a..9c06bae 100644 --- a/chrome/browser/ui/views/tab_contents/native_tab_contents_container_aura.h +++ b/chrome/browser/ui/views/tab_contents/native_tab_contents_container_aura.h @@ -16,14 +16,14 @@ class NativeTabContentsContainerAura : public NativeTabContentsContainer, virtual ~NativeTabContentsContainerAura(); // Overridden from NativeTabContentsContainer: - virtual void AttachContents(TabContents* contents) OVERRIDE; - virtual void DetachContents(TabContents* contents) OVERRIDE; + virtual void AttachContents(content::WebContents* contents) OVERRIDE; + virtual void DetachContents(content::WebContents* contents) OVERRIDE; virtual void SetFastResize(bool fast_resize) OVERRIDE; virtual bool GetFastResize() const OVERRIDE; virtual bool FastResizeAtLastLayout() const OVERRIDE; virtual void RenderViewHostChanged(RenderViewHost* old_host, RenderViewHost* new_host) OVERRIDE; - virtual void TabContentsFocused(TabContents* tab_contents) OVERRIDE; + virtual void WebContentsFocused(content::WebContents* contents) OVERRIDE; virtual views::View* GetView() OVERRIDE; // Overridden from views::View: diff --git a/chrome/browser/ui/views/tab_contents/native_tab_contents_container_gtk.cc b/chrome/browser/ui/views/tab_contents/native_tab_contents_container_gtk.cc index bc26b95f..45539b8 100644 --- a/chrome/browser/ui/views/tab_contents/native_tab_contents_container_gtk.cc +++ b/chrome/browser/ui/views/tab_contents/native_tab_contents_container_gtk.cc @@ -13,6 +13,8 @@ #include "ui/base/accessibility/accessible_view_state.h" #include "ui/views/focus/focus_manager.h" +using content::WebContents; + //////////////////////////////////////////////////////////////////////////////// // NativeTabContentsContainerGtk, public: @@ -29,11 +31,11 @@ NativeTabContentsContainerGtk::~NativeTabContentsContainerGtk() { //////////////////////////////////////////////////////////////////////////////// // NativeTabContentsContainerGtk, NativeTabContentsContainer overrides: -void NativeTabContentsContainerGtk::AttachContents(TabContents* contents) { +void NativeTabContentsContainerGtk::AttachContents(WebContents* contents) { Attach(contents->GetNativeView()); } -void NativeTabContentsContainerGtk::DetachContents(TabContents* contents) { +void NativeTabContentsContainerGtk::DetachContents(WebContents* contents) { gtk_widget_hide(contents->GetNativeView()); // Now detach the TabContents. @@ -66,8 +68,7 @@ views::View* NativeTabContentsContainerGtk::GetView() { return this; } -void NativeTabContentsContainerGtk::TabContentsFocused( - TabContents* tab_contents) { +void NativeTabContentsContainerGtk::WebContentsFocused(WebContents* contents) { // Called when the tab contents native view gets focused (typically through a // user click). We make ourself the focused view, so the focus is restored // properly when the browser window is deactivated/reactivated. diff --git a/chrome/browser/ui/views/tab_contents/native_tab_contents_container_gtk.h b/chrome/browser/ui/views/tab_contents/native_tab_contents_container_gtk.h index 5d1c148..ac51fa1 100644 --- a/chrome/browser/ui/views/tab_contents/native_tab_contents_container_gtk.h +++ b/chrome/browser/ui/views/tab_contents/native_tab_contents_container_gtk.h @@ -18,14 +18,14 @@ class NativeTabContentsContainerGtk : public NativeTabContentsContainer, virtual ~NativeTabContentsContainerGtk(); // Overridden from NativeTabContentsContainer: - virtual void AttachContents(TabContents* contents) OVERRIDE; - virtual void DetachContents(TabContents* contents) OVERRIDE; + virtual void AttachContents(content::WebContents* contents) OVERRIDE; + virtual void DetachContents(content::WebContents* contents) OVERRIDE; virtual void SetFastResize(bool fast_resize) OVERRIDE; virtual bool GetFastResize() const OVERRIDE; virtual bool FastResizeAtLastLayout() const OVERRIDE; virtual void RenderViewHostChanged(RenderViewHost* old_host, RenderViewHost* new_host) OVERRIDE; - virtual void TabContentsFocused(TabContents* tab_contents) OVERRIDE; + virtual void WebContentsFocused(content::WebContents* contents) OVERRIDE; virtual views::View* GetView() OVERRIDE; // Overridden from views::View: diff --git a/chrome/browser/ui/views/tab_contents/native_tab_contents_container_win.cc b/chrome/browser/ui/views/tab_contents/native_tab_contents_container_win.cc index b369320..959667b 100644 --- a/chrome/browser/ui/views/tab_contents/native_tab_contents_container_win.cc +++ b/chrome/browser/ui/views/tab_contents/native_tab_contents_container_win.cc @@ -14,6 +14,8 @@ #include "ui/views/focus/focus_manager.h" #include "ui/views/focus/widget_focus_manager.h" +using content::WebContents; + //////////////////////////////////////////////////////////////////////////////// // NativeTabContentsContainerWin, public: @@ -29,7 +31,7 @@ NativeTabContentsContainerWin::~NativeTabContentsContainerWin() { //////////////////////////////////////////////////////////////////////////////// // NativeTabContentsContainerWin, NativeTabContentsContainer overrides: -void NativeTabContentsContainerWin::AttachContents(TabContents* contents) { +void NativeTabContentsContainerWin::AttachContents(WebContents* contents) { // We need to register the tab contents window with the BrowserContainer so // that the BrowserContainer is the focused view when the focus is on the // TabContents window (for the TabContents case). @@ -38,7 +40,7 @@ void NativeTabContentsContainerWin::AttachContents(TabContents* contents) { Attach(contents->GetNativeView()); } -void NativeTabContentsContainerWin::DetachContents(TabContents* contents) { +void NativeTabContentsContainerWin::DetachContents(WebContents* contents) { // Detach the TabContents. Do this before we unparent the // TabContentsViewViews so that the window hierarchy is intact for any // cleanup during Detach(). @@ -81,8 +83,7 @@ views::View* NativeTabContentsContainerWin::GetView() { return this; } -void NativeTabContentsContainerWin::TabContentsFocused( - TabContents* tab_contents) { +void NativeTabContentsContainerWin::WebContentsFocused(WebContents* contents) { views::FocusManager* focus_manager = GetFocusManager(); if (!focus_manager) { NOTREACHED(); diff --git a/chrome/browser/ui/views/tab_contents/native_tab_contents_container_win.h b/chrome/browser/ui/views/tab_contents/native_tab_contents_container_win.h index ee9e614..7481c31 100644 --- a/chrome/browser/ui/views/tab_contents/native_tab_contents_container_win.h +++ b/chrome/browser/ui/views/tab_contents/native_tab_contents_container_win.h @@ -16,14 +16,14 @@ class NativeTabContentsContainerWin : public NativeTabContentsContainer, virtual ~NativeTabContentsContainerWin(); // Overridden from NativeTabContentsContainer: - virtual void AttachContents(TabContents* contents) OVERRIDE; - virtual void DetachContents(TabContents* contents) OVERRIDE; + virtual void AttachContents(content::WebContents* contents) OVERRIDE; + virtual void DetachContents(content::WebContents* contents) OVERRIDE; virtual void SetFastResize(bool fast_resize) OVERRIDE; virtual bool GetFastResize() const OVERRIDE; virtual bool FastResizeAtLastLayout() const OVERRIDE; virtual void RenderViewHostChanged(RenderViewHost* old_host, RenderViewHost* new_host) OVERRIDE; - virtual void TabContentsFocused(TabContents* tab_contents) OVERRIDE; + virtual void WebContentsFocused(content::WebContents* contents) OVERRIDE; virtual views::View* GetView() OVERRIDE; // Overridden from views::View: diff --git a/chrome/browser/ui/views/tab_contents/tab_contents_container.cc b/chrome/browser/ui/views/tab_contents/tab_contents_container.cc index e80cff9..f3f89c9 100644 --- a/chrome/browser/ui/views/tab_contents/tab_contents_container.cc +++ b/chrome/browser/ui/views/tab_contents/tab_contents_container.cc @@ -47,8 +47,8 @@ void TabContentsContainer::ChangeTabContents(TabContents* contents) { } } -void TabContentsContainer::TabContentsFocused(TabContents* tab_contents) { - native_container_->TabContentsFocused(tab_contents); +void TabContentsContainer::WebContentsFocused(WebContents* contents) { + native_container_->WebContentsFocused(contents); } void TabContentsContainer::SetFastResize(bool fast_resize) { diff --git a/chrome/browser/ui/views/tab_contents/tab_contents_container.h b/chrome/browser/ui/views/tab_contents/tab_contents_container.h index 4bf1c04..4d04d54 100644 --- a/chrome/browser/ui/views/tab_contents/tab_contents_container.h +++ b/chrome/browser/ui/views/tab_contents/tab_contents_container.h @@ -34,8 +34,8 @@ class TabContentsContainer : public views::View, // Accessor for |tab_contents_|. TabContents* tab_contents() const { return tab_contents_; } - // Called by the BrowserView to notify that |tab_contents| got the focus. - void TabContentsFocused(TabContents* tab_contents); + // Called by the BrowserView to notify that |contents| got the focus. + void WebContentsFocused(content::WebContents* contents); // Tells the container to update less frequently during resizing operations // so performance is better. diff --git a/chrome/browser/ui/views/tab_contents/tab_contents_view_views.cc b/chrome/browser/ui/views/tab_contents/tab_contents_view_views.cc index a737ac0..4a1221e 100644 --- a/chrome/browser/ui/views/tab_contents/tab_contents_view_views.cc +++ b/chrome/browser/ui/views/tab_contents/tab_contents_view_views.cc @@ -277,7 +277,7 @@ void TabContentsViewViews::UpdateDragCursor(WebDragOperation operation) { void TabContentsViewViews::GotFocus() { if (tab_contents_->GetDelegate()) - tab_contents_->GetDelegate()->TabContentsFocused(tab_contents_); + tab_contents_->GetDelegate()->WebContentsFocused(tab_contents_); } void TabContentsViewViews::TakeFocus(bool reverse) { diff --git a/chrome/browser/ui/views/tabs/default_tab_drag_controller.cc b/chrome/browser/ui/views/tabs/default_tab_drag_controller.cc index 3f04a49..554dd8b 100644 --- a/chrome/browser/ui/views/tabs/default_tab_drag_controller.cc +++ b/chrome/browser/ui/views/tabs/default_tab_drag_controller.cc @@ -434,14 +434,14 @@ WebContents* DefaultTabDragController::OpenURLFromTab( /////////////////////////////////////////////////////////////////////////////// // DefaultTabDragController, content::WebContentsDelegate implementation: -void DefaultTabDragController::NavigationStateChanged(const TabContents* source, +void DefaultTabDragController::NavigationStateChanged(const WebContents* source, unsigned changed_flags) { if (view_.get()) view_->Update(); } -void DefaultTabDragController::AddNewContents(TabContents* source, - TabContents* new_contents, +void DefaultTabDragController::AddNewContents(WebContents* source, + WebContents* new_contents, WindowOpenDisposition disposition, const gfx::Rect& initial_pos, bool user_gesture) { @@ -455,7 +455,7 @@ void DefaultTabDragController::AddNewContents(TabContents* source, } } -void DefaultTabDragController::LoadingStateChanged(TabContents* source) { +void DefaultTabDragController::LoadingStateChanged(WebContents* source) { // It would be nice to respond to this message by changing the // screen shot in the dragged tab. if (view_.get()) diff --git a/chrome/browser/ui/views/tabs/default_tab_drag_controller.h b/chrome/browser/ui/views/tabs/default_tab_drag_controller.h index bda6490..410e3e0 100644 --- a/chrome/browser/ui/views/tabs/default_tab_drag_controller.h +++ b/chrome/browser/ui/views/tabs/default_tab_drag_controller.h @@ -117,14 +117,14 @@ class DefaultTabDragController : public TabDragController, virtual content::WebContents* OpenURLFromTab( content::WebContents* source, const content::OpenURLParams& params) OVERRIDE; - virtual void NavigationStateChanged(const TabContents* source, + virtual void NavigationStateChanged(const content::WebContents* source, unsigned changed_flags) OVERRIDE; - virtual void AddNewContents(TabContents* source, - TabContents* new_contents, + virtual void AddNewContents(content::WebContents* source, + content::WebContents* new_contents, WindowOpenDisposition disposition, const gfx::Rect& initial_pos, bool user_gesture) OVERRIDE; - virtual void LoadingStateChanged(TabContents* source) OVERRIDE; + virtual void LoadingStateChanged(content::WebContents* source) OVERRIDE; virtual bool ShouldSuppressDialogs() OVERRIDE; virtual content::JavaScriptDialogCreator* GetJavaScriptDialogCreator() OVERRIDE; diff --git a/chrome/browser/ui/webui/html_dialog_tab_contents_delegate.cc b/chrome/browser/ui/webui/html_dialog_tab_contents_delegate.cc index 44c0d19..171d680 100644 --- a/chrome/browser/ui/webui/html_dialog_tab_contents_delegate.cc +++ b/chrome/browser/ui/webui/html_dialog_tab_contents_delegate.cc @@ -56,7 +56,7 @@ WebContents* HtmlDialogTabContentsDelegate::OpenURLFromTab( } void HtmlDialogTabContentsDelegate::AddNewContents( - TabContents* source, TabContents* new_contents, + WebContents* source, WebContents* new_contents, WindowOpenDisposition disposition, const gfx::Rect& initial_pos, bool user_gesture) { if (profile_) { @@ -64,7 +64,8 @@ void HtmlDialogTabContentsDelegate::AddNewContents( // to find a browser matching params.profile or create a new one. Browser* browser = NULL; - TabContentsWrapper* wrapper = new TabContentsWrapper(new_contents); + TabContentsWrapper* wrapper = new TabContentsWrapper( + static_cast<TabContents*>(new_contents)); browser::NavigateParams params(browser, wrapper); params.profile = profile_; // TODO(pinkerton): no way to get a wrapper for this. @@ -78,7 +79,7 @@ void HtmlDialogTabContentsDelegate::AddNewContents( } bool HtmlDialogTabContentsDelegate::IsPopupOrPanel( - const TabContents* source) const { + const WebContents* source) const { // This needs to return true so that we are allowed to be resized by our // contents. return true; diff --git a/chrome/browser/ui/webui/html_dialog_tab_contents_delegate.h b/chrome/browser/ui/webui/html_dialog_tab_contents_delegate.h index 4aa45f4..198d90a 100644 --- a/chrome/browser/ui/webui/html_dialog_tab_contents_delegate.h +++ b/chrome/browser/ui/webui/html_dialog_tab_contents_delegate.h @@ -36,12 +36,13 @@ class HtmlDialogTabContentsDelegate : public content::WebContentsDelegate { content::WebContents* source, const content::OpenURLParams& params) OVERRIDE; - virtual void AddNewContents(TabContents* source, - TabContents* new_contents, + virtual void AddNewContents(content::WebContents* source, + content::WebContents* new_contents, WindowOpenDisposition disposition, const gfx::Rect& initial_pos, bool user_gesture) OVERRIDE; - virtual bool IsPopupOrPanel(const TabContents* source) const OVERRIDE; + virtual bool IsPopupOrPanel( + const content::WebContents* source) const OVERRIDE; virtual bool ShouldAddNavigationToHistory( const history::HistoryAddPageArgs& add_page_args, content::NavigationType navigation_type) OVERRIDE; diff --git a/chrome/browser/ui/webui/hung_renderer_dialog.cc b/chrome/browser/ui/webui/hung_renderer_dialog.cc index 13551ba..b210356 100644 --- a/chrome/browser/ui/webui/hung_renderer_dialog.cc +++ b/chrome/browser/ui/webui/hung_renderer_dialog.cc @@ -37,7 +37,7 @@ const int kHungRendererDialogHeight = 200; namespace browser { -void ShowHungRendererDialog(TabContents* contents) { +void ShowHungRendererDialog(WebContents* contents) { #if defined(OS_CHROMEOS) || defined(USE_AURA) HungRendererDialog::ShowHungRendererDialog(contents); #else @@ -50,7 +50,7 @@ void ShowHungRendererDialog(TabContents* contents) { #endif } -void HideHungRendererDialog(TabContents* contents) { +void HideHungRendererDialog(WebContents* contents) { #if defined(OS_CHROMEOS) || defined(USE_AURA) HungRendererDialog::HideHungRendererDialog(contents); #else @@ -66,11 +66,11 @@ void HideHungRendererDialog(TabContents* contents) { //////////////////////////////////////////////////////////////////////////////// // HungRendererDialog public static methods -void HungRendererDialog::ShowHungRendererDialog(TabContents* contents) { +void HungRendererDialog::ShowHungRendererDialog(WebContents* contents) { ShowHungRendererDialogInternal(contents, true); } -void HungRendererDialog::HideHungRendererDialog(TabContents* contents) { +void HungRendererDialog::HideHungRendererDialog(WebContents* contents) { if (!logging::DialogsAreSuppressed() && g_instance) g_instance->HideDialog(contents); } @@ -80,20 +80,19 @@ void HungRendererDialog::HideHungRendererDialog(TabContents* contents) { HungRendererDialog::WebContentsObserverImpl::WebContentsObserverImpl( HungRendererDialog* dialog, - TabContents* contents) + WebContents* contents) : content::WebContentsObserver(contents), - contents_(contents), dialog_(dialog) { } void HungRendererDialog::WebContentsObserverImpl::RenderViewGone( base::TerminationStatus status) { - dialog_->HideDialog(contents_); + dialog_->HideDialog(web_contents()); } void HungRendererDialog::WebContentsObserverImpl::WebContentsDestroyed( WebContents* tab) { - dialog_->HideDialog(contents_); + dialog_->HideDialog(tab); } //////////////////////////////////////////////////////////////////////////////// @@ -109,7 +108,7 @@ HungRendererDialog::HungRendererDialog(bool is_enabled) HungRendererDialog::~HungRendererDialog() { } -void HungRendererDialog::ShowHungRendererDialogInternal(TabContents* contents, +void HungRendererDialog::ShowHungRendererDialogInternal(WebContents* contents, bool is_enabled) { if (!logging::DialogsAreSuppressed()) { if (g_instance) @@ -119,7 +118,7 @@ void HungRendererDialog::ShowHungRendererDialogInternal(TabContents* contents, } } -void HungRendererDialog::ShowDialog(TabContents* contents) { +void HungRendererDialog::ShowDialog(WebContents* contents) { DCHECK(contents); contents_ = contents; Browser* browser = BrowserList::GetLastActive(); @@ -129,9 +128,9 @@ void HungRendererDialog::ShowDialog(TabContents* contents) { contents_observer_.reset(new WebContentsObserverImpl(this, contents_)); } -void HungRendererDialog::HideDialog(TabContents* contents) { +void HungRendererDialog::HideDialog(WebContents* contents) { DCHECK(contents); - // Don't close the dialog if it's a TabContents for some other renderer. + // Don't close the dialog if it's a WebContents for some other renderer. if (contents_ && contents_->GetRenderProcessHost() != contents->GetRenderProcessHost()) return; @@ -209,7 +208,7 @@ bool HungRendererDialog::ShouldShowDialogTitle() const { // HungRendererDialogHandler methods HungRendererDialogHandler::HungRendererDialogHandler( - TabContents* contents) + WebContents* contents) : contents_(contents) { } diff --git a/chrome/browser/ui/webui/hung_renderer_dialog.h b/chrome/browser/ui/webui/hung_renderer_dialog.h index ff954f2..b25419f 100644 --- a/chrome/browser/ui/webui/hung_renderer_dialog.h +++ b/chrome/browser/ui/webui/hung_renderer_dialog.h @@ -21,23 +21,22 @@ class HungRendererDialogHandler; class HungRendererDialog : private HtmlDialogUIDelegate { public: // Shows a hung renderer dialog. - static void ShowHungRendererDialog(TabContents* contents); + static void ShowHungRendererDialog(content::WebContents* contents); // Hides a hung renderer dialog. - static void HideHungRendererDialog(TabContents* contents); + static void HideHungRendererDialog(content::WebContents* contents); private: class WebContentsObserverImpl : public content::WebContentsObserver { public: WebContentsObserverImpl(HungRendererDialog* dialog, - TabContents* contents); + content::WebContents* contents); // content::WebContentsObserver overrides: virtual void RenderViewGone(base::TerminationStatus status) OVERRIDE; virtual void WebContentsDestroyed(content::WebContents* tab) OVERRIDE; private: - TabContents* contents_; // weak HungRendererDialog* dialog_; // weak DISALLOW_COPY_AND_ASSIGN(WebContentsObserverImpl); @@ -50,14 +49,14 @@ class HungRendererDialog : private HtmlDialogUIDelegate { // Shows a hung renderer dialog that, if not enabled, won't kill processes // or restart hang timers. - static void ShowHungRendererDialogInternal(TabContents* contents, + static void ShowHungRendererDialogInternal(content::WebContents* contents, bool is_enabled); // Shows the hung renderer dialog. - void ShowDialog(TabContents* contents); + void ShowDialog(content::WebContents* contents); // Hides the hung renderer dialog. - void HideDialog(TabContents* contents); + void HideDialog(content::WebContents* contents); // HtmlDialogUIDelegate methods virtual bool IsDialogModal() const OVERRIDE; @@ -72,8 +71,8 @@ class HungRendererDialog : private HtmlDialogUIDelegate { bool* out_close_dialog) OVERRIDE; virtual bool ShouldShowDialogTitle() const OVERRIDE; - // The tab contents. - TabContents* contents_; + // The web contents. + content::WebContents* contents_; // The dialog handler. HungRendererDialogHandler* handler_; @@ -96,7 +95,7 @@ class HungRendererDialog : private HtmlDialogUIDelegate { // of the list of frozen tabs. class HungRendererDialogHandler : public WebUIMessageHandler { public: - explicit HungRendererDialogHandler(TabContents* contents); + explicit HungRendererDialogHandler(content::WebContents* contents); void CloseDialog(); @@ -106,8 +105,8 @@ class HungRendererDialogHandler : public WebUIMessageHandler { private: void RequestTabContentsList(const base::ListValue* args); - // The tab contents. - TabContents* contents_; + // The web contents. + content::WebContents* contents_; DISALLOW_COPY_AND_ASSIGN(HungRendererDialogHandler); }; diff --git a/chrome/test/base/test_browser_window.h b/chrome/test/base/test_browser_window.h index a85f255..1806a8d 100644 --- a/chrome/test/base/test_browser_window.h +++ b/chrome/test/base/test_browser_window.h @@ -95,7 +95,7 @@ class TestBrowserWindow : public BrowserWindow { virtual void ConfirmBrowserCloseWithPendingDownloads() OVERRIDE {} virtual void UserChangedTheme() OVERRIDE {} virtual int GetExtraRenderViewHeight() const OVERRIDE; - virtual void TabContentsFocused(TabContents* tab_contents) OVERRIDE {} + virtual void WebContentsFocused(content::WebContents* contents) OVERRIDE {} virtual void ShowPageInfo(Profile* profile, const GURL& url, const content::SSLStatus& ssl, |