diff options
author | avi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-10 17:05:26 +0000 |
---|---|---|
committer | avi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-10 17:05:26 +0000 |
commit | b172aee74fde14b0a79e144572a959b8b436c473 (patch) | |
tree | 45216b5f334088e8ab5a9097555e047bae8eea32 | |
parent | 33190c88674bc70d431bafe9eba88cbe05652b60 (diff) | |
download | chromium_src-b172aee74fde14b0a79e144572a959b8b436c473.zip chromium_src-b172aee74fde14b0a79e144572a959b8b436c473.tar.gz chromium_src-b172aee74fde14b0a79e144572a959b8b436c473.tar.bz2 |
TabContents -> WebContentsImpl, part 1.
BUG=105875
TEST=no change
Review URL: http://codereview.chromium.org/10024034
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@131571 0039d316-1c4b-4281-b951-d872f2087c98
38 files changed, 512 insertions, 511 deletions
diff --git a/chrome/test/base/ui_test_utils.h b/chrome/test/base/ui_test_utils.h index 96816b8..9588efa 100644 --- a/chrome/test/base/ui_test_utils.h +++ b/chrome/test/base/ui_test_utils.h @@ -49,7 +49,6 @@ class MessageLoop; class Profile; class ScopedTempDir; class SkBitmap; -class TabContents; class TabContentsWrapper; class TemplateURLService; diff --git a/content/browser/browser_plugin/browser_plugin_web_contents_observer.h b/content/browser/browser_plugin/browser_plugin_web_contents_observer.h index fc7722f..09aee49 100644 --- a/content/browser/browser_plugin/browser_plugin_web_contents_observer.h +++ b/content/browser/browser_plugin/browser_plugin_web_contents_observer.h @@ -13,27 +13,27 @@ #include "content/public/browser/web_contents_observer.h" #include "ui/gfx/size.h" -class TabContents; +class WebContentsImpl; namespace content { class BrowserPluginWebContentsObserver: public WebContentsObserver, public NotificationObserver { public: - BrowserPluginWebContentsObserver(TabContents* web_contents); + BrowserPluginWebContentsObserver(WebContentsImpl* web_contents); virtual ~BrowserPluginWebContentsObserver(); // A Host BrowserPluginWebContentsObserver keeps track of // its guests so that if it navigates away, its associated RenderView // crashes or it is hidden, it takes appropriate action on the guest. - void AddGuest(TabContents* guest, int64 frame_id); + void AddGuest(WebContentsImpl* guest, int64 frame_id); - void RemoveGuest(TabContents* guest); + void RemoveGuest(WebContentsImpl* guest); - TabContents* host() const { return host_; } + WebContentsImpl* host() const { return host_; } - void set_host(TabContents* host) { host_ = host; } + void set_host(WebContentsImpl* host) { host_ = host; } int instance_id() const { return instance_id_; } @@ -57,7 +57,7 @@ class BrowserPluginWebContentsObserver: public WebContentsObserver, virtual void WebContentsDestroyed(WebContents* tab) OVERRIDE; private: - typedef std::map<TabContents*, int64> GuestMap; + typedef std::map<WebContentsImpl*, int64> GuestMap; void OnOpenChannelToBrowserPlugin(int32 instance_id, long long frame_id, @@ -80,7 +80,7 @@ class BrowserPluginWebContentsObserver: public WebContentsObserver, // A scoped container for notification registries. NotificationRegistrar registrar_; - TabContents* host_; + WebContentsImpl* host_; // An identifier that uniquely identifies a browser plugin container // within a host. diff --git a/content/browser/debugger/devtools_frontend_host.h b/content/browser/debugger/devtools_frontend_host.h index 4b3b18a..d60b093 100644 --- a/content/browser/debugger/devtools_frontend_host.h +++ b/content/browser/debugger/devtools_frontend_host.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -12,7 +12,7 @@ #include "content/public/browser/devtools_client_host.h" #include "content/public/browser/render_view_host_observer.h" -class TabContents; +class WebContentsImpl; namespace content { @@ -25,7 +25,7 @@ class DevToolsFrontendHostDelegate; class DevToolsFrontendHost : public DevToolsClientHost, public RenderViewHostObserver { public: - DevToolsFrontendHost(TabContents* tab_contents, + DevToolsFrontendHost(WebContentsImpl* web_contents, DevToolsFrontendHostDelegate* delegate); private: @@ -52,7 +52,7 @@ class DevToolsFrontendHost : public DevToolsClientHost, const std::string& content, bool save_as); - TabContents* tab_contents_; + WebContentsImpl* tab_contents_; DevToolsFrontendHostDelegate* delegate_; DISALLOW_COPY_AND_ASSIGN(DevToolsFrontendHost); }; diff --git a/content/browser/debugger/devtools_manager_impl.h b/content/browser/debugger/devtools_manager_impl.h index 3efab10..b78d352 100644 --- a/content/browser/debugger/devtools_manager_impl.h +++ b/content/browser/debugger/devtools_manager_impl.h @@ -17,7 +17,6 @@ #include "content/public/browser/devtools_manager.h" class GURL; -class TabContents; namespace IPC { class Message; diff --git a/content/browser/debugger/render_view_devtools_agent_host.h b/content/browser/debugger/render_view_devtools_agent_host.h index b05e7df..912f787 100644 --- a/content/browser/debugger/render_view_devtools_agent_host.h +++ b/content/browser/debugger/render_view_devtools_agent_host.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -13,8 +13,6 @@ #include "content/common/content_export.h" #include "content/public/browser/render_view_host_observer.h" -class TabContents; - namespace content { class RenderViewHost; diff --git a/content/browser/download/download_item_impl.cc b/content/browser/download/download_item_impl.cc index 726d7f3..893b486 100644 --- a/content/browser/download/download_item_impl.cc +++ b/content/browser/download/download_item_impl.cc @@ -106,7 +106,7 @@ class NullDownloadRequestHandle : public DownloadRequestHandleInterface { NullDownloadRequestHandle() {} // DownloadRequestHandleInterface calls - virtual TabContents* GetTabContents() const OVERRIDE { + virtual WebContents* GetWebContents() const OVERRIDE { return NULL; } virtual DownloadManager* GetDownloadManager() const OVERRIDE { @@ -853,7 +853,7 @@ WebContents* DownloadItemImpl::GetWebContents() const { // Currently such items have null request_handle_s, where other items // (regular and SavePackage downloads) have actual objects off the pointer. if (request_handle_.get()) - return request_handle_->GetTabContents(); + return request_handle_->GetWebContents(); return NULL; } diff --git a/content/browser/download/download_item_impl_unittest.cc b/content/browser/download/download_item_impl_unittest.cc index 01ade4b..d4c62a0 100644 --- a/content/browser/download/download_item_impl_unittest.cc +++ b/content/browser/download/download_item_impl_unittest.cc @@ -20,6 +20,7 @@ using content::DownloadId; using content::DownloadItem; using content::DownloadManager; using content::MockDownloadItem; +using content::WebContents; DownloadId::Domain kValidDownloadItemIdDomain = "valid DownloadId::Domain"; @@ -40,7 +41,7 @@ class MockDelegate : public DownloadItemImpl::Delegate { class MockRequestHandle : public DownloadRequestHandleInterface { public: - MOCK_CONST_METHOD0(GetTabContents, TabContents*()); + MOCK_CONST_METHOD0(GetWebContents, WebContents*()); MOCK_CONST_METHOD0(GetDownloadManager, DownloadManager*()); MOCK_CONST_METHOD0(PauseRequest, void()); MOCK_CONST_METHOD0(ResumeRequest, void()); diff --git a/content/browser/download/download_request_handle.cc b/content/browser/download/download_request_handle.cc index 861027b..ad71ec7 100644 --- a/content/browser/download/download_request_handle.cc +++ b/content/browser/download/download_request_handle.cc @@ -56,14 +56,13 @@ DownloadRequestHandle::DownloadRequestHandle(int child_id, DCHECK(ResourceDispatcherHostImpl::Get()); } -TabContents* DownloadRequestHandle::GetTabContents() const { +content::WebContents* DownloadRequestHandle::GetWebContents() const { RenderViewHostImpl* render_view_host = RenderViewHostImpl::FromID(child_id_, render_view_id_); if (!render_view_host) return NULL; - return static_cast<TabContents*>( - render_view_host->GetDelegate()->GetAsWebContents()); + return render_view_host->GetDelegate()->GetAsWebContents(); } DownloadManager* DownloadRequestHandle::GetDownloadManager() const { diff --git a/content/browser/download/download_request_handle.h b/content/browser/download/download_request_handle.h index 92e826d..bd2f9d9 100644 --- a/content/browser/download/download_request_handle.h +++ b/content/browser/download/download_request_handle.h @@ -11,14 +11,13 @@ #include "base/compiler_specific.h" #include "content/common/content_export.h" -class TabContents; - namespace content { class DownloadManager; +class WebContents; } // A handle used by the download system for operations on the URLRequest -// or objects conditional on it (e.g. TabContents). +// or objects conditional on it (e.g. WebContentsImpl). // This class needs to be copyable, so we can pass it across threads and not // worry about lifetime or const-ness. // @@ -28,7 +27,7 @@ class CONTENT_EXPORT DownloadRequestHandleInterface { virtual ~DownloadRequestHandleInterface() {} // These functions must be called on the UI thread. - virtual TabContents* GetTabContents() const = 0; + virtual content::WebContents* GetWebContents() const = 0; virtual content::DownloadManager* GetDownloadManager() const = 0; // Pauses or resumes the matching URL request. @@ -61,7 +60,7 @@ class CONTENT_EXPORT DownloadRequestHandle int request_id); // Implement DownloadRequestHandleInterface interface. - virtual TabContents* GetTabContents() const OVERRIDE; + virtual content::WebContents* GetWebContents() const OVERRIDE; virtual content::DownloadManager* GetDownloadManager() const OVERRIDE; virtual void PauseRequest() const OVERRIDE; virtual void ResumeRequest() const OVERRIDE; diff --git a/content/browser/download/save_package.cc b/content/browser/download/save_package.cc index 407a340..62721507 100644 --- a/content/browser/download/save_package.cc +++ b/content/browser/download/save_package.cc @@ -27,7 +27,6 @@ #include "content/browser/renderer_host/render_process_host_impl.h" #include "content/browser/renderer_host/render_view_host_impl.h" #include "content/browser/renderer_host/resource_dispatcher_host_impl.h" -#include "content/browser/tab_contents/tab_contents.h" #include "content/common/view_messages.h" #include "content/public/browser/browser_context.h" #include "content/public/browser/browser_thread.h" @@ -37,6 +36,7 @@ #include "content/public/browser/navigation_entry.h" #include "content/public/browser/render_view_host_delegate.h" #include "content/public/browser/resource_context.h" +#include "content/public/browser/web_contents.h" #include "content/public/common/url_constants.h" #include "net/base/io_buffer.h" #include "net/base/mime_util.h" @@ -150,13 +150,13 @@ SavePackage::SavePackage(WebContents* web_contents, InternalInit(); } -SavePackage::SavePackage(TabContents* tab_contents) - : content::WebContentsObserver(tab_contents), +SavePackage::SavePackage(WebContents* web_contents) + : content::WebContentsObserver(web_contents), file_manager_(NULL), download_manager_(NULL), download_(NULL), page_url_(GetUrlToBeSaved()), - title_(tab_contents->GetTitle()), + title_(web_contents->GetTitle()), start_tick_(base::TimeTicks::Now()), finished_(false), user_canceled_(false), @@ -164,7 +164,7 @@ SavePackage::SavePackage(TabContents* tab_contents) save_type_(content::SAVE_PAGE_TYPE_UNKNOWN), all_save_items_count_(0), wait_state_(INITIALIZE), - tab_id_(tab_contents->GetRenderProcessHost()->GetID()), + tab_id_(web_contents->GetRenderProcessHost()->GetID()), unique_id_(g_save_package_id++), wrote_to_completed_file_(false), wrote_to_failed_file_(false) { @@ -175,10 +175,10 @@ SavePackage::SavePackage(TabContents* tab_contents) // This is for testing use. Set |finished_| as true because we don't want // method Cancel to be be called in destructor in test mode. // We also don't call InternalInit(). -SavePackage::SavePackage(TabContents* tab_contents, +SavePackage::SavePackage(WebContents* web_contents, const FilePath& file_full_path, const FilePath& directory_full_path) - : content::WebContentsObserver(tab_contents), + : content::WebContentsObserver(web_contents), file_manager_(NULL), download_manager_(NULL), download_(NULL), @@ -1100,7 +1100,7 @@ FilePath SavePackage::GetSuggestedNameForSaveAs( // component or if there is none, the domain as the file name. // Normally we want to base the filename on the page title, or if it doesn't // exist, on the URL. It's not easy to tell if the page has no title, because - // if the page has no title, TabContents::GetTitle() will return the page's + // if the page has no title, WebContents::GetTitle() will return the page's // URL (adjusted for display purposes). Therefore, we convert the "title" // back to a URL, and if it matches the original page URL, we know the page // had no title (or had a title equal to its URL, which is fine to treat @@ -1189,13 +1189,8 @@ const FilePath::CharType* SavePackage::ExtensionForMimeType( return FILE_PATH_LITERAL(""); } -TabContents* SavePackage::tab_contents() const { - return - static_cast<TabContents*>(content::WebContentsObserver::web_contents()); -} - WebContents* SavePackage::web_contents() const { - return tab_contents(); + return content::WebContentsObserver::web_contents(); } void SavePackage::GetSaveInfo() { @@ -1204,7 +1199,7 @@ void SavePackage::GetSaveInfo() { FilePath website_save_dir, download_save_dir; DCHECK(download_manager_); download_manager_->delegate()->GetSaveDir( - tab_contents(), &website_save_dir, &download_save_dir); + web_contents(), &website_save_dir, &download_save_dir); std::string mime_type = web_contents()->GetContentsMimeType(); std::string accept_languages = content::GetContentClient()->browser()->GetAcceptLangs( @@ -1263,7 +1258,7 @@ void SavePackage::CreateDirectoryOnFileThread( void SavePackage::ContinueGetSaveInfo(const FilePath& suggested_path, bool can_save_as_complete) { - // The TabContents which owns this SavePackage may have disappeared during + // The WebContents which owns this SavePackage may have disappeared during // the UI->FILE->UI thread hop of // GetSaveInfo->CreateDirectoryOnFileThread->ContinueGetSaveInfo. if (!web_contents()) diff --git a/content/browser/download/save_package.h b/content/browser/download/save_package.h index bd76aa7..9fa5d87 100644 --- a/content/browser/download/save_package.h +++ b/content/browser/download/save_package.h @@ -74,7 +74,7 @@ class CONTENT_EXPORT SavePackage // Constructor for user initiated page saving. This constructor results in a // SavePackage that will generate and sanitize a suggested name for the user // in the "Save As" dialog box. - explicit SavePackage(TabContents* tab_contents); + explicit SavePackage(content::WebContents* tab_contents); // This contructor is used only for testing. We can bypass the file and // directory name generation / sanitization by providing well known paths @@ -111,7 +111,6 @@ class CONTENT_EXPORT SavePackage content::SavePageType save_type() const { return save_type_; } int tab_id() const { return tab_id_; } int id() const { return unique_id_; } - TabContents* tab_contents() const; content::WebContents* web_contents() const; void GetSaveInfo(); @@ -120,7 +119,7 @@ class CONTENT_EXPORT SavePackage friend class base::RefCountedThreadSafe<SavePackage>; // For testing only. - SavePackage(TabContents* tab_contents, + SavePackage(content::WebContents* web_contents, const FilePath& file_full_path, const FilePath& directory_full_path); @@ -177,7 +176,7 @@ class CONTENT_EXPORT SavePackage // Remove SaveItem from in progress map and put it to saved map. void PutInProgressItemToSavedMap(SaveItem* save_item); - // Retrieves the URL to be saved from the TabContents. + // Retrieves the URL to be saved from the WebContents. GURL GetUrlToBeSaved(); void CreateDirectoryOnFileThread(const FilePath& website_save_dir, diff --git a/content/browser/intents/web_intents_dispatcher_impl.cc b/content/browser/intents/web_intents_dispatcher_impl.cc index ad8e096..71c0a45 100644 --- a/content/browser/intents/web_intents_dispatcher_impl.cc +++ b/content/browser/intents/web_intents_dispatcher_impl.cc @@ -24,10 +24,10 @@ WebIntentsDispatcher* WebIntentsDispatcher::Create( WebIntentsDispatcherImpl::WebIntentsDispatcherImpl( - TabContents* source_tab, + content::WebContents* source_contents, const webkit_glue::WebIntentData& intent, int intent_id) - : content::WebContentsObserver(source_tab), + : content::WebContentsObserver(source_contents), intent_(intent), intent_id_(intent_id), intent_injector_(NULL) {} diff --git a/content/browser/intents/web_intents_dispatcher_impl.h b/content/browser/intents/web_intents_dispatcher_impl.h index b4bc551..97042e9 100644 --- a/content/browser/intents/web_intents_dispatcher_impl.h +++ b/content/browser/intents/web_intents_dispatcher_impl.h @@ -26,7 +26,7 @@ class WebIntentsDispatcherImpl : public content::WebIntentsDispatcher, // |intent| is the intent payload created by that page. // |intent_id| is the identifier assigned by WebKit to direct replies back to // the correct Javascript callback. - WebIntentsDispatcherImpl(TabContents* source_tab, + WebIntentsDispatcherImpl(content::WebContents* source_contents, const webkit_glue::WebIntentData& intent, int intent_id); virtual ~WebIntentsDispatcherImpl(); diff --git a/content/browser/renderer_host/resource_dispatcher_host_impl.cc b/content/browser/renderer_host/resource_dispatcher_host_impl.cc index d7ea8ad..373a792 100644 --- a/content/browser/renderer_host/resource_dispatcher_host_impl.cc +++ b/content/browser/renderer_host/resource_dispatcher_host_impl.cc @@ -1986,7 +1986,7 @@ void ResourceDispatcherHostImpl::ContinueSSLRequest( request->ContinueDespiteLastError(); } -void ResourceDispatcherHostImpl::OnUserGesture(TabContents* tab) { +void ResourceDispatcherHostImpl::OnUserGesture(WebContentsImpl* contents) { last_user_gesture_time_ = TimeTicks::Now(); } diff --git a/content/browser/renderer_host/resource_dispatcher_host_impl.h b/content/browser/renderer_host/resource_dispatcher_host_impl.h index eab5e78..d4b1c3c 100644 --- a/content/browser/renderer_host/resource_dispatcher_host_impl.h +++ b/content/browser/renderer_host/resource_dispatcher_host_impl.h @@ -37,7 +37,7 @@ class DownloadFileManager; class ResourceHandler; class ResourceMessageFilter; class SaveFileManager; -class TabContents; +class WebContentsImpl; struct ResourceHostMsg_Request; struct ViewMsg_SwapOut_Params; @@ -199,7 +199,7 @@ class CONTENT_EXPORT ResourceDispatcherHostImpl const net::SSLInfo* ssl_info) OVERRIDE; virtual void ContinueSSLRequest(const content::GlobalRequestID& id) OVERRIDE; - void OnUserGesture(TabContents* tab); + void OnUserGesture(WebContentsImpl* contents); // Retrieves a net::URLRequest. Must be called from the IO thread. net::URLRequest* GetURLRequest( diff --git a/content/browser/ssl/ssl_policy.h b/content/browser/ssl/ssl_policy.h index 8302645..686d5c2 100644 --- a/content/browser/ssl/ssl_policy.h +++ b/content/browser/ssl/ssl_policy.h @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -14,7 +14,7 @@ class SSLCertErrorHandler; class SSLPolicyBackend; class SSLRequestInfo; -class TabContents; +class WebContentsImpl; namespace content { class NavigationEntryImpl; @@ -42,7 +42,7 @@ class SSLPolicy { // Update the SSL information in |entry| to match the current state. // |tab_contents| is the TabContents associated with this entry. void UpdateEntry(content::NavigationEntryImpl* entry, - TabContents* tab_contents); + WebContentsImpl* web_contents); SSLPolicyBackend* backend() const { return backend_; } diff --git a/content/browser/tab_contents/interstitial_page_impl.h b/content/browser/tab_contents/interstitial_page_impl.h index 0bfdbf8..9d53af0 100644 --- a/content/browser/tab_contents/interstitial_page_impl.h +++ b/content/browser/tab_contents/interstitial_page_impl.h @@ -16,7 +16,7 @@ #include "content/public/common/renderer_preferences.h" #include "googleurl/src/gurl.h" -class TabContents; +class WebContentsImpl; namespace content { class NavigationEntry; @@ -131,8 +131,8 @@ class CONTENT_EXPORT InterstitialPageImpl // interstitial. void TakeActionOnResourceDispatcher(ResourceRequestAction action); - // The tab in which we are displayed. - TabContents* tab_; + // The contents in which we are displayed. + WebContentsImpl* tab_; // The URL that is shown when the interstitial is showing. GURL url_; diff --git a/content/browser/tab_contents/navigation_controller_impl.h b/content/browser/tab_contents/navigation_controller_impl.h index e02e8a9..46a682f 100644 --- a/content/browser/tab_contents/navigation_controller_impl.h +++ b/content/browser/tab_contents/navigation_controller_impl.h @@ -15,8 +15,8 @@ #include "content/public/browser/navigation_type.h" class SessionStorageNamespaceImpl; -class TabContents; struct ViewHostMsg_FrameNavigate_Params; +class WebContentsImpl; namespace content { class NavigationEntryImpl; @@ -28,7 +28,7 @@ class CONTENT_EXPORT NavigationControllerImpl : public NON_EXPORTED_BASE(content::NavigationController) { public: NavigationControllerImpl( - TabContents* tab_contents, + WebContentsImpl* tab_contents, content::BrowserContext* browser_context, SessionStorageNamespaceImpl* session_storage_namespace); virtual ~NavigationControllerImpl(); @@ -122,9 +122,9 @@ class CONTENT_EXPORT NavigationControllerImpl // Note that adding a transient entry does not change the active contents. void AddTransientEntry(content::NavigationEntryImpl* entry); - // TabContents --------------------------------------------------------------- + // WebContentsImpl ----------------------------------------------------------- - TabContents* tab_contents() const { + WebContentsImpl* tab_contents() const { // This currently returns the active tab contents which should be renamed to // tab_contents. return tab_contents_; @@ -133,10 +133,10 @@ class CONTENT_EXPORT NavigationControllerImpl // Called when a document has been loaded in a frame. void DocumentLoadedInFrame(); - // For use by TabContents ---------------------------------------------------- + // For use by WebContentsImpl ------------------------------------------------ // Handles updating the navigation state after the renderer has navigated. - // This is used by the TabContents. + // This is used by the WebContentsImpl. // // If a new entry is created, it will return true and will have filled the // given details structure and broadcast the NOTIFY_NAV_ENTRY_COMMITTED @@ -148,7 +148,7 @@ class CONTENT_EXPORT NavigationControllerImpl bool RendererDidNavigate(const ViewHostMsg_FrameNavigate_Params& params, content::LoadCommittedDetails* details); - // Notifies us that we just became active. This is used by the TabContents + // Notifies us that we just became active. This is used by the WebContentsImpl // so that we know to load URLs that were pending as "lazy" loads. void SetActive(bool is_active); @@ -179,7 +179,7 @@ class CONTENT_EXPORT NavigationControllerImpl private: class RestoreHelper; friend class RestoreHelper; - friend class TabContents; // For invoking OnReservedPageIDRange. + friend class WebContentsImpl; // For invoking OnReservedPageIDRange. // Classifies the given renderer navigation (see the NavigationType enum). content::NavigationType ClassifyNavigation( @@ -300,11 +300,11 @@ class CONTENT_EXPORT NavigationControllerImpl // The tab contents associated with the controller. Possibly NULL during // setup. - TabContents* tab_contents_; + WebContentsImpl* tab_contents_; // The max restored page ID in this controller, if it was restored. We must - // store this so that TabContents can tell any renderer in charge of one of - // the restored entries to update its max page ID. + // store this so that WebContentsImpl can tell any renderer in charge of one + // of the restored entries to update its max page ID. int32 max_restored_page_id_; // Manages the SSL security UI diff --git a/content/browser/tab_contents/tab_contents.cc b/content/browser/tab_contents/tab_contents.cc index bbaf198..a63d178 100644 --- a/content/browser/tab_contents/tab_contents.cc +++ b/content/browser/tab_contents/tab_contents.cc @@ -80,9 +80,10 @@ // Cross-Site Navigations // -// If a TabContents is told to navigate to a different web site (as determined -// by SiteInstance), it will replace its current RenderViewHost with a new -// RenderViewHost dedicated to the new SiteInstance. This works as follows: +// If a WebContentsImpl is told to navigate to a different web site (as +// determined by SiteInstance), it will replace its current RenderViewHost with +// a new RenderViewHost dedicated to the new SiteInstance. This works as +// follows: // // - Navigate determines whether the destination is cross-site, and if so, // it creates a pending_render_view_host_. @@ -102,12 +103,12 @@ // - When RDH receives a response, the BufferedResourceHandler determines // whether it is a download. If so, it sends a message to the new renderer // causing it to cancel the request, and the download proceeds. For now, the -// pending RVH remains until the next DidNavigate event for this TabContents. -// This isn't ideal, but it doesn't affect any functionality. +// pending RVH remains until the next DidNavigate event for this +// WebContentsImpl. This isn't ideal, but it doesn't affect any functionality. // - After RDH receives a response and determines that it is safe and not a // download, it pauses the response to first run the old page's onunload // handler. It does this by asynchronously calling the OnCrossSiteResponse -// method of TabContents on the UI thread, which sends a SwapOut message +// method of WebContentsImpl on the UI thread, which sends a SwapOut message // to the current RVH. // - Once the onunload handler is finished, a SwapOut_ACK message is sent to // the ResourceDispatcherHost, who unpauses the response. Data is then sent @@ -227,24 +228,25 @@ WebContents* WebContents::Create( BrowserContext* browser_context, SiteInstance* site_instance, int routing_id, - const WebContents* base_tab_contents, + const WebContents* base_web_contents, SessionStorageNamespace* session_storage_namespace) { - return new TabContents( + return new WebContentsImpl( browser_context, site_instance, routing_id, - static_cast<const TabContents*>(base_tab_contents), + static_cast<const WebContentsImpl*>(base_web_contents), static_cast<SessionStorageNamespaceImpl*>(session_storage_namespace)); } } -// TabContents ---------------------------------------------------------------- +// WebContentsImpl ------------------------------------------------------------- -TabContents::TabContents(content::BrowserContext* browser_context, - SiteInstance* site_instance, - int routing_id, - const TabContents* base_tab_contents, - SessionStorageNamespaceImpl* session_storage_namespace) +WebContentsImpl::WebContentsImpl( + content::BrowserContext* browser_context, + SiteInstance* site_instance, + int routing_id, + const WebContentsImpl* base_web_contents, + SessionStorageNamespaceImpl* session_storage_namespace) : delegate_(NULL), ALLOW_THIS_IN_INITIALIZER_LIST(controller_( this, browser_context, session_storage_namespace)), @@ -301,8 +303,8 @@ TabContents::TabContents(content::BrowserContext* browser_context, // We have the initial size of the view be based on the size of the passed in // tab contents (normally a tab from the same window). - view_->CreateView(base_tab_contents ? - base_tab_contents->GetView()->GetContainerSize() : gfx::Size()); + view_->CreateView(base_web_contents ? + base_web_contents->GetView()->GetContainerSize() : gfx::Size()); #if defined(ENABLE_JAVA_BRIDGE) java_bridge_dispatcher_host_manager_.reset( @@ -313,7 +315,7 @@ TabContents::TabContents(content::BrowserContext* browser_context, new content::BrowserPluginWebContentsObserver(this)); } -TabContents::~TabContents() { +WebContentsImpl::~WebContentsImpl() { is_being_destroyed_ = true; // Clear out any JavaScript state. @@ -353,8 +355,8 @@ TabContents::~TabContents() { SetDelegate(NULL); } -WebPreferences TabContents::GetWebkitPrefs(RenderViewHost* rvh, - const GURL& url) { +WebPreferences WebContentsImpl::GetWebkitPrefs(RenderViewHost* rvh, + const GURL& url) { WebPreferences prefs; const CommandLine& command_line = *CommandLine::ForCurrentProcess(); @@ -514,15 +516,15 @@ WebPreferences TabContents::GetWebkitPrefs(RenderViewHost* rvh, return prefs; } -NavigationControllerImpl& TabContents::GetControllerImpl() { +NavigationControllerImpl& WebContentsImpl::GetControllerImpl() { return controller_; } -RenderViewHostManager* TabContents::GetRenderManagerForTesting() { +RenderViewHostManager* WebContentsImpl::GetRenderManagerForTesting() { return &render_manager_; } -bool TabContents::OnMessageReceived(const IPC::Message& message) { +bool WebContentsImpl::OnMessageReceived(const IPC::Message& message) { if (GetWebUI() && static_cast<WebUIImpl*>(GetWebUI())->OnMessageReceived(message)) { return true; @@ -536,7 +538,7 @@ bool TabContents::OnMessageReceived(const IPC::Message& message) { bool handled = true; bool message_is_ok = true; - IPC_BEGIN_MESSAGE_MAP_EX(TabContents, message, message_is_ok) + IPC_BEGIN_MESSAGE_MAP_EX(WebContentsImpl, message, message_is_ok) IPC_MESSAGE_HANDLER(IntentsHostMsg_RegisterIntentService, OnRegisterIntentService) IPC_MESSAGE_HANDLER(IntentsHostMsg_WebIntentDispatch, @@ -583,52 +585,52 @@ bool TabContents::OnMessageReceived(const IPC::Message& message) { return handled; } -void TabContents::RunFileChooser( +void WebContentsImpl::RunFileChooser( RenderViewHost* render_view_host, const content::FileChooserParams& params) { delegate_->RunFileChooser(this, params); } -NavigationController& TabContents::GetController() { +NavigationController& WebContentsImpl::GetController() { return controller_; } -const NavigationController& TabContents::GetController() const { +const NavigationController& WebContentsImpl::GetController() const { return controller_; } -content::BrowserContext* TabContents::GetBrowserContext() const { +content::BrowserContext* WebContentsImpl::GetBrowserContext() const { return controller_.GetBrowserContext(); } -void TabContents::SetViewType(content::ViewType type) { +void WebContentsImpl::SetViewType(content::ViewType type) { view_type_ = type; } -content::ViewType TabContents::GetViewType() const { +content::ViewType WebContentsImpl::GetViewType() const { return view_type_; } -const GURL& TabContents::GetURL() const { +const GURL& WebContentsImpl::GetURL() const { // We may not have a navigation entry yet NavigationEntry* entry = controller_.GetActiveEntry(); return entry ? entry->GetVirtualURL() : GURL::EmptyGURL(); } -const base::PropertyBag* TabContents::GetPropertyBag() const { +const base::PropertyBag* WebContentsImpl::GetPropertyBag() const { return &property_bag_; } -base::PropertyBag* TabContents::GetPropertyBag() { +base::PropertyBag* WebContentsImpl::GetPropertyBag() { return &property_bag_; } -content::WebContentsDelegate* TabContents::GetDelegate() { +content::WebContentsDelegate* WebContentsImpl::GetDelegate() { return delegate_; } -void TabContents::SetDelegate(content::WebContentsDelegate* delegate) { +void WebContentsImpl::SetDelegate(content::WebContentsDelegate* delegate) { // TODO(cbentzel): remove this debugging code? if (delegate == delegate_) return; @@ -639,24 +641,24 @@ void TabContents::SetDelegate(content::WebContentsDelegate* delegate) { delegate_->Attach(this); } -content::RenderProcessHost* TabContents::GetRenderProcessHost() const { +content::RenderProcessHost* WebContentsImpl::GetRenderProcessHost() const { RenderViewHostImpl* host = render_manager_.current_host(); return host ? host->GetProcess() : NULL; } -RenderViewHost* TabContents::GetRenderViewHost() const { +RenderViewHost* WebContentsImpl::GetRenderViewHost() const { return render_manager_.current_host(); } -RenderWidgetHostView* TabContents::GetRenderWidgetHostView() const { +RenderWidgetHostView* WebContentsImpl::GetRenderWidgetHostView() const { return render_manager_.GetRenderWidgetHostView(); } -content::WebContentsView* TabContents::GetView() const { +content::WebContentsView* WebContentsImpl::GetView() const { return view_.get(); } -content::WebUI* TabContents::CreateWebUI(const GURL& url) { +content::WebUI* WebContentsImpl::CreateWebUI(const GURL& url) { WebUIControllerFactory* factory = content::GetContentClient()->browser()->GetWebUIControllerFactory(); if (!factory) @@ -673,16 +675,16 @@ content::WebUI* TabContents::CreateWebUI(const GURL& url) { return NULL; } -content::WebUI* TabContents::GetWebUI() const { +content::WebUI* WebContentsImpl::GetWebUI() const { return render_manager_.web_ui() ? render_manager_.web_ui() : render_manager_.pending_web_ui(); } -content::WebUI* TabContents::GetCommittedWebUI() const { +content::WebUI* WebContentsImpl::GetCommittedWebUI() const { return render_manager_.web_ui(); } -const string16& TabContents::GetTitle() const { +const string16& WebContentsImpl::GetTitle() const { // Transient entries take precedence. They are used for interstitial pages // that are shown on top of existing pages. NavigationEntry* entry = controller_.GetTransientEntry(); @@ -719,85 +721,87 @@ const string16& TabContents::GetTitle() const { return page_title_when_no_navigation_entry_; } -int32 TabContents::GetMaxPageID() { +int32 WebContentsImpl::GetMaxPageID() { return GetMaxPageIDForSiteInstance(GetSiteInstance()); } -int32 TabContents::GetMaxPageIDForSiteInstance(SiteInstance* site_instance) { +int32 WebContentsImpl::GetMaxPageIDForSiteInstance( + SiteInstance* site_instance) { if (max_page_ids_.find(site_instance->GetId()) == max_page_ids_.end()) max_page_ids_[site_instance->GetId()] = -1; return max_page_ids_[site_instance->GetId()]; } -void TabContents::UpdateMaxPageID(int32 page_id) { +void WebContentsImpl::UpdateMaxPageID(int32 page_id) { UpdateMaxPageIDForSiteInstance(GetSiteInstance(), page_id); } -void TabContents::UpdateMaxPageIDForSiteInstance( +void WebContentsImpl::UpdateMaxPageIDForSiteInstance( SiteInstance* site_instance, int32 page_id) { if (GetMaxPageIDForSiteInstance(site_instance) < page_id) max_page_ids_[site_instance->GetId()] = page_id; } -void TabContents::CopyMaxPageIDsFrom(TabContents* tab_contents) { - max_page_ids_ = tab_contents->max_page_ids_; +void WebContentsImpl::CopyMaxPageIDsFrom(WebContentsImpl* web_contents) { + max_page_ids_ = web_contents->max_page_ids_; } -SiteInstance* TabContents::GetSiteInstance() const { +SiteInstance* WebContentsImpl::GetSiteInstance() const { return render_manager_.current_host()->GetSiteInstance(); } -SiteInstance* TabContents::GetPendingSiteInstance() const { +SiteInstance* WebContentsImpl::GetPendingSiteInstance() const { RenderViewHost* dest_rvh = render_manager_.pending_render_view_host() ? render_manager_.pending_render_view_host() : render_manager_.current_host(); return dest_rvh->GetSiteInstance(); } -bool TabContents::IsLoading() const { +bool WebContentsImpl::IsLoading() const { return is_loading_; } -bool TabContents::IsWaitingForResponse() const { +bool WebContentsImpl::IsWaitingForResponse() const { return waiting_for_response_; } -const net::LoadStateWithParam& TabContents::GetLoadState() const { +const net::LoadStateWithParam& WebContentsImpl::GetLoadState() const { return load_state_; } -const string16& TabContents::GetLoadStateHost() const { +const string16& WebContentsImpl::GetLoadStateHost() const { return load_state_host_; } -uint64 TabContents::GetUploadSize() const { +uint64 WebContentsImpl::GetUploadSize() const { return upload_size_; } -uint64 TabContents::GetUploadPosition() const { +uint64 WebContentsImpl::GetUploadPosition() const { return upload_position_; } -const std::string& TabContents::GetEncoding() const { +const std::string& WebContentsImpl::GetEncoding() const { return encoding_; } -bool TabContents::DisplayedInsecureContent() const { +bool WebContentsImpl::DisplayedInsecureContent() const { return displayed_insecure_content_; } -void TabContents::SetCapturingContents(bool cap) { +void WebContentsImpl::SetCapturingContents(bool cap) { capturing_contents_ = cap; } -bool TabContents::IsCrashed() const { +bool WebContentsImpl::IsCrashed() const { return (crashed_status_ == base::TERMINATION_STATUS_PROCESS_CRASHED || crashed_status_ == base::TERMINATION_STATUS_ABNORMAL_TERMINATION || crashed_status_ == base::TERMINATION_STATUS_PROCESS_WAS_KILLED); } -void TabContents::SetIsCrashed(base::TerminationStatus status, int error_code) { +void WebContentsImpl::SetIsCrashed(base::TerminationStatus status, + int error_code) { if (status == crashed_status_) return; @@ -806,20 +810,20 @@ void TabContents::SetIsCrashed(base::TerminationStatus status, int error_code) { NotifyNavigationStateChanged(content::INVALIDATE_TYPE_TAB); } -base::TerminationStatus TabContents::GetCrashedStatus() const { +base::TerminationStatus WebContentsImpl::GetCrashedStatus() const { return crashed_status_; } -bool TabContents::IsBeingDestroyed() const { +bool WebContentsImpl::IsBeingDestroyed() const { return is_being_destroyed_; } -void TabContents::NotifyNavigationStateChanged(unsigned changed_flags) { +void WebContentsImpl::NotifyNavigationStateChanged(unsigned changed_flags) { if (delegate_) delegate_->NavigationStateChanged(this, changed_flags); } -void TabContents::DidBecomeSelected() { +void WebContentsImpl::DidBecomeSelected() { controller_.SetActive(true); RenderWidgetHostViewPort* rwhv = RenderWidgetHostViewPort::FromRWHV(GetRenderWidgetHostView()); @@ -844,15 +848,15 @@ void TabContents::DidBecomeSelected() { } -base::TimeTicks TabContents::GetLastSelectedTime() const { +base::TimeTicks WebContentsImpl::GetLastSelectedTime() const { return last_selected_time_; } -void TabContents::WasHidden() { +void WebContentsImpl::WasHidden() { if (!capturing_contents_) { // |GetRenderViewHost()| can be NULL if the user middle clicks a link to // open a tab in then background, then closes the tab before selecting it. - // This is because closing the tab calls TabContents::Destroy(), which + // This is because closing the tab calls WebContentsImpl::Destroy(), which // removes the |GetRenderViewHost()|; then when we actually destroy the // window, OnWindowPosChanged() notices and calls HideContents() (which // calls us). @@ -868,24 +872,24 @@ void TabContents::WasHidden() { content::NotificationService::NoDetails()); } -void TabContents::ShowContents() { +void WebContentsImpl::ShowContents() { RenderWidgetHostViewPort* rwhv = RenderWidgetHostViewPort::FromRWHV(GetRenderWidgetHostView()); if (rwhv) rwhv->DidBecomeSelected(); } -void TabContents::HideContents() { +void WebContentsImpl::HideContents() { // TODO(pkasting): http://b/1239839 Right now we purposefully don't call // our superclass HideContents(), because some callers want to be very picky // about the order in which these get called. In addition to making the code // here practically impossible to understand, this also means we end up - // calling TabContents::WasHidden() twice if callers call both versions of - // HideContents() on a TabContents. + // calling WebContentsImpl::WasHidden() twice if callers call both versions of + // HideContents() on a WebContentsImpl. WasHidden(); } -bool TabContents::NeedToFireBeforeUnload() { +bool WebContentsImpl::NeedToFireBeforeUnload() { // TODO(creis): Should we fire even for interstitial pages? return WillNotifyDisconnection() && !ShowingInterstitialPage() && @@ -893,16 +897,16 @@ bool TabContents::NeedToFireBeforeUnload() { GetRenderViewHost())->SuddenTerminationAllowed(); } -void TabContents::Stop() { +void WebContentsImpl::Stop() { render_manager_.Stop(); FOR_EACH_OBSERVER(WebContentsObserver, observers_, StopNavigation()); } -WebContents* TabContents::Clone() { +WebContents* WebContentsImpl::Clone() { // We create a new SiteInstance so that the new tab won't share processes // with the old one. This can be changed in the future if we need it to share // processes for some reason. - TabContents* tc = new TabContents( + WebContentsImpl* tc = new WebContentsImpl( GetBrowserContext(), SiteInstance::Create(GetBrowserContext()), MSG_ROUTING_NONE, this, NULL); @@ -910,10 +914,10 @@ WebContents* TabContents::Clone() { return tc; } -void TabContents::AddNewContents(WebContents* new_contents, - WindowOpenDisposition disposition, - const gfx::Rect& initial_pos, - bool user_gesture) { +void WebContentsImpl::AddNewContents(WebContents* new_contents, + WindowOpenDisposition disposition, + const gfx::Rect& initial_pos, + bool user_gesture) { if (!delegate_) return; @@ -921,81 +925,82 @@ void TabContents::AddNewContents(WebContents* new_contents, user_gesture); } -gfx::NativeView TabContents::GetContentNativeView() const { +gfx::NativeView WebContentsImpl::GetContentNativeView() const { return view_->GetContentNativeView(); } -gfx::NativeView TabContents::GetNativeView() const { +gfx::NativeView WebContentsImpl::GetNativeView() const { return view_->GetNativeView(); } -void TabContents::GetContainerBounds(gfx::Rect* out) const { +void WebContentsImpl::GetContainerBounds(gfx::Rect* out) const { view_->GetContainerBounds(out); } -void TabContents::Focus() { +void WebContentsImpl::Focus() { view_->Focus(); } -void TabContents::AddObserver(WebContentsObserver* observer) { +void WebContentsImpl::AddObserver(WebContentsObserver* observer) { observers_.AddObserver(observer); } -void TabContents::RemoveObserver(WebContentsObserver* observer) { +void WebContentsImpl::RemoveObserver(WebContentsObserver* observer) { observers_.RemoveObserver(observer); } -void TabContents::Activate() { +void WebContentsImpl::Activate() { if (delegate_) delegate_->ActivateContents(this); } -void TabContents::Deactivate() { +void WebContentsImpl::Deactivate() { if (delegate_) delegate_->DeactivateContents(this); } -void TabContents::LostCapture() { +void WebContentsImpl::LostCapture() { if (delegate_) delegate_->LostCapture(); } -bool TabContents::PreHandleKeyboardEvent(const NativeWebKeyboardEvent& event, - bool* is_keyboard_shortcut) { +bool WebContentsImpl::PreHandleKeyboardEvent( + const NativeWebKeyboardEvent& event, + bool* is_keyboard_shortcut) { return delegate_ && delegate_->PreHandleKeyboardEvent(event, is_keyboard_shortcut); } -void TabContents::HandleKeyboardEvent(const NativeWebKeyboardEvent& event) { +void WebContentsImpl::HandleKeyboardEvent(const NativeWebKeyboardEvent& event) { if (delegate_) delegate_->HandleKeyboardEvent(event); } -void TabContents::HandleMouseDown() { +void WebContentsImpl::HandleMouseDown() { if (delegate_) delegate_->HandleMouseDown(); } -void TabContents::HandleMouseUp() { +void WebContentsImpl::HandleMouseUp() { if (delegate_) delegate_->HandleMouseUp(); } -void TabContents::HandleMouseActivate() { +void WebContentsImpl::HandleMouseActivate() { if (delegate_) delegate_->HandleMouseActivate(); } -void TabContents::ToggleFullscreenMode(bool enter_fullscreen) { +void WebContentsImpl::ToggleFullscreenMode(bool enter_fullscreen) { if (delegate_) delegate_->ToggleFullscreenModeForTab(this, enter_fullscreen); } -bool TabContents::IsFullscreenForCurrentTab() const { +bool WebContentsImpl::IsFullscreenForCurrentTab() const { return delegate_ ? delegate_->IsFullscreenForTabOrPending(this) : false; } -void TabContents::RequestToLockMouse() { +void WebContentsImpl::RequestToLockMouse() { if (delegate_) { delegate_->RequestToLockMouse(this); } else { @@ -1003,31 +1008,31 @@ void TabContents::RequestToLockMouse() { } } -void TabContents::LostMouseLock() { +void WebContentsImpl::LostMouseLock() { if (delegate_) delegate_->LostMouseLock(); } -void TabContents::UpdatePreferredSize(const gfx::Size& pref_size) { +void WebContentsImpl::UpdatePreferredSize(const gfx::Size& pref_size) { preferred_size_ = pref_size; if (delegate_) delegate_->UpdatePreferredSize(this, pref_size); } -void TabContents::ResizeDueToAutoResize(const gfx::Size& new_size) { +void WebContentsImpl::ResizeDueToAutoResize(const gfx::Size& new_size) { if (delegate_) delegate_->ResizeDueToAutoResize(this, new_size); } -void TabContents::WebUISend(RenderViewHost* render_view_host, - const GURL& source_url, - const std::string& name, - const base::ListValue& args) { +void WebContentsImpl::WebUISend(RenderViewHost* render_view_host, + const GURL& source_url, + const std::string& name, + const base::ListValue& args) { if (delegate_) delegate_->WebUISend(this, source_url, name, args); } -WebContents* TabContents::OpenURL(const OpenURLParams& params) { +WebContents* WebContentsImpl::OpenURL(const OpenURLParams& params) { if (!delegate_) return NULL; @@ -1039,14 +1044,14 @@ WebContents* TabContents::OpenURL(const OpenURLParams& params) { return new_contents; } -bool TabContents::NavigateToPendingEntry( +bool WebContentsImpl::NavigateToPendingEntry( NavigationController::ReloadType reload_type) { return NavigateToEntry( *NavigationEntryImpl::FromNavigationEntry(controller_.GetPendingEntry()), reload_type); } -bool TabContents::NavigateToEntry( +bool WebContentsImpl::NavigateToEntry( const NavigationEntryImpl& entry, NavigationController::ReloadType reload_type) { // The renderer will reject IPC messages with URLs longer than @@ -1113,7 +1118,7 @@ bool TabContents::NavigateToEntry( return true; } -void TabContents::SetHistoryLengthAndPrune( +void WebContentsImpl::SetHistoryLengthAndPrune( const SiteInstance* site_instance, int history_length, int32 minimum_page_id) { @@ -1137,7 +1142,7 @@ void TabContents::SetHistoryLengthAndPrune( minimum_page_id)); } -void TabContents::FocusThroughTabTraversal(bool reverse) { +void WebContentsImpl::FocusThroughTabTraversal(bool reverse) { if (ShowingInterstitialPage()) { render_manager_.interstitial_page()->FocusThroughTabTraversal(reverse); return; @@ -1145,15 +1150,15 @@ void TabContents::FocusThroughTabTraversal(bool reverse) { GetRenderViewHostImpl()->SetInitialFocus(reverse); } -bool TabContents::ShowingInterstitialPage() const { +bool WebContentsImpl::ShowingInterstitialPage() const { return render_manager_.interstitial_page() != NULL; } -InterstitialPage* TabContents::GetInterstitialPage() const { +InterstitialPage* WebContentsImpl::GetInterstitialPage() const { return render_manager_.interstitial_page(); } -bool TabContents::IsSavable() { +bool WebContentsImpl::IsSavable() { // WebKit creates Document object when MIME type is application/xhtml+xml, // so we also support this MIME type. return contents_mime_type_ == "text/html" || @@ -1164,7 +1169,7 @@ bool TabContents::IsSavable() { net::IsSupportedJavascriptMimeType(contents_mime_type_.c_str()); } -void TabContents::OnSavePage() { +void WebContentsImpl::OnSavePage() { // If we can not save the page, try to download it. if (!IsSavable()) { download_stats::RecordDownloadSource( @@ -1185,8 +1190,9 @@ void TabContents::OnSavePage() { // Used in automated testing to bypass prompting the user for file names. // Instead, the names and paths are hard coded rather than running them through // file name sanitation and extension / mime checking. -bool TabContents::SavePage(const FilePath& main_file, const FilePath& dir_path, - content::SavePageType save_type) { +bool WebContentsImpl::SavePage(const FilePath& main_file, + const FilePath& dir_path, + content::SavePageType save_type) { // Stop the page from navigating. Stop(); @@ -1194,13 +1200,13 @@ bool TabContents::SavePage(const FilePath& main_file, const FilePath& dir_path, return save_package_->Init(); } -void TabContents::GenerateMHTML( +void WebContentsImpl::GenerateMHTML( const FilePath& file, const base::Callback<void(const FilePath&, int64)>& callback) { MHTMLGenerationManager::GetInstance()->GenerateMHTML(this, file, callback); } -bool TabContents::IsActiveEntry(int32 page_id) { +bool WebContentsImpl::IsActiveEntry(int32 page_id) { NavigationEntryImpl* active_entry = NavigationEntryImpl::FromNavigationEntry(controller_.GetActiveEntry()); return (active_entry != NULL && @@ -1208,44 +1214,44 @@ bool TabContents::IsActiveEntry(int32 page_id) { active_entry->GetPageID() == page_id); } -const std::string& TabContents::GetContentsMimeType() const { +const std::string& WebContentsImpl::GetContentsMimeType() const { return contents_mime_type_; } -bool TabContents::WillNotifyDisconnection() const { +bool WebContentsImpl::WillNotifyDisconnection() const { return notify_disconnection_; } -void TabContents::SetOverrideEncoding(const std::string& encoding) { +void WebContentsImpl::SetOverrideEncoding(const std::string& encoding) { SetEncoding(encoding); GetRenderViewHostImpl()->Send(new ViewMsg_SetPageEncoding( GetRenderViewHost()->GetRoutingID(), encoding)); } -void TabContents::ResetOverrideEncoding() { +void WebContentsImpl::ResetOverrideEncoding() { encoding_.clear(); GetRenderViewHostImpl()->Send(new ViewMsg_ResetPageEncodingToDefault( GetRenderViewHost()->GetRoutingID())); } -content::RendererPreferences* TabContents::GetMutableRendererPrefs() { +content::RendererPreferences* WebContentsImpl::GetMutableRendererPrefs() { return &renderer_preferences_; } -void TabContents::SetNewTabStartTime(const base::TimeTicks& time) { +void WebContentsImpl::SetNewTabStartTime(const base::TimeTicks& time) { new_tab_start_time_ = time; } -base::TimeTicks TabContents::GetNewTabStartTime() const { +base::TimeTicks WebContentsImpl::GetNewTabStartTime() const { return new_tab_start_time_; } -void TabContents::OnCloseStarted() { +void WebContentsImpl::OnCloseStarted() { if (tab_close_start_time_.is_null()) tab_close_start_time_ = base::TimeTicks::Now(); } -bool TabContents::ShouldAcceptDragAndDrop() const { +bool WebContentsImpl::ShouldAcceptDragAndDrop() const { #if defined(OS_CHROMEOS) // ChromeOS panels (pop-ups) do not take drag-n-drop. // See http://crosbug.com/2413 @@ -1257,22 +1263,22 @@ bool TabContents::ShouldAcceptDragAndDrop() const { #endif } -void TabContents::SystemDragEnded() { +void WebContentsImpl::SystemDragEnded() { if (GetRenderViewHost()) GetRenderViewHostImpl()->DragSourceSystemDragEnded(); if (delegate_) delegate_->DragEnded(); } -void TabContents::SetClosedByUserGesture(bool value) { +void WebContentsImpl::SetClosedByUserGesture(bool value) { closed_by_user_gesture_ = value; } -bool TabContents::GetClosedByUserGesture() const { +bool WebContentsImpl::GetClosedByUserGesture() const { return closed_by_user_gesture_; } -double TabContents::GetZoomLevel() const { +double WebContentsImpl::GetZoomLevel() const { HostZoomMapImpl* zoom_map = static_cast<HostZoomMapImpl*>( HostZoomMap::GetForBrowserContext(GetBrowserContext())); if (!zoom_map) @@ -1293,8 +1299,8 @@ double TabContents::GetZoomLevel() const { return zoom_level; } -int TabContents::GetZoomPercent(bool* enable_increment, - bool* enable_decrement) { +int WebContentsImpl::GetZoomPercent(bool* enable_increment, + bool* enable_decrement) { *enable_decrement = *enable_increment = false; // Calculate the zoom percent from the factor. Round up to the nearest whole // number. @@ -1305,7 +1311,7 @@ int TabContents::GetZoomPercent(bool* enable_increment, return percent; } -void TabContents::ViewSource() { +void WebContentsImpl::ViewSource() { if (!delegate_) return; @@ -1316,31 +1322,31 @@ void TabContents::ViewSource() { delegate_->ViewSourceForTab(this, active_entry->GetURL()); } -void TabContents::ViewFrameSource(const GURL& url, - const std::string& content_state) { +void WebContentsImpl::ViewFrameSource(const GURL& url, + const std::string& content_state) { if (!delegate_) return; delegate_->ViewSourceForFrame(this, url, content_state); } -int TabContents::GetMinimumZoomPercent() const { +int WebContentsImpl::GetMinimumZoomPercent() const { return minimum_zoom_percent_; } -int TabContents::GetMaximumZoomPercent() const { +int WebContentsImpl::GetMaximumZoomPercent() const { return maximum_zoom_percent_; } -gfx::Size TabContents::GetPreferredSize() const { +gfx::Size WebContentsImpl::GetPreferredSize() const { return preferred_size_; } -int TabContents::GetContentRestrictions() const { +int WebContentsImpl::GetContentRestrictions() const { return content_restrictions_; } -WebUI::TypeID TabContents::GetWebUITypeForCurrentState() { +WebUI::TypeID WebContentsImpl::GetWebUITypeForCurrentState() { WebUIControllerFactory* factory = content::GetContentClient()->browser()->GetWebUIControllerFactory(); if (!factory) @@ -1348,7 +1354,7 @@ WebUI::TypeID TabContents::GetWebUITypeForCurrentState() { return factory->GetWebUIType(GetBrowserContext(), GetURL()); } -content::WebUI* TabContents::GetWebUIForCurrentState() { +content::WebUI* WebContentsImpl::GetWebUIForCurrentState() { // When there is a pending navigation entry, we want to use the pending WebUI // that goes along with it to control the basic flags. For example, we want to // show the pending URL in the URL bar, so we want the display_url flag to @@ -1388,22 +1394,22 @@ content::WebUI* TabContents::GetWebUIForCurrentState() { return render_manager_.web_ui(); } -bool TabContents::GotResponseToLockMouseRequest(bool allowed) { +bool WebContentsImpl::GotResponseToLockMouseRequest(bool allowed) { return GetRenderViewHost() ? GetRenderViewHostImpl()->GotResponseToLockMouseRequest(allowed) : false; } -bool TabContents::HasOpener() const { +bool WebContentsImpl::HasOpener() const { return has_opener_; } -void TabContents::DidChooseColorInColorChooser(int color_chooser_id, - const SkColor& color) { +void WebContentsImpl::DidChooseColorInColorChooser(int color_chooser_id, + const SkColor& color) { GetRenderViewHost()->Send(new ViewMsg_DidChooseColorResponse( GetRenderViewHost()->GetRoutingID(), color_chooser_id, color)); } -void TabContents::DidEndColorChooser(int color_chooser_id) { +void WebContentsImpl::DidEndColorChooser(int color_chooser_id) { GetRenderViewHost()->Send(new ViewMsg_DidEndColorChooser( GetRenderViewHost()->GetRoutingID(), color_chooser_id)); if (delegate_) @@ -1411,7 +1417,7 @@ void TabContents::DidEndColorChooser(int color_chooser_id) { color_chooser_ = NULL; } -bool TabContents::FocusLocationBarByDefault() { +bool WebContentsImpl::FocusLocationBarByDefault() { content::WebUI* web_ui = GetWebUIForCurrentState(); if (web_ui) return web_ui->ShouldFocusLocationBarByDefault(); @@ -1419,31 +1425,32 @@ bool TabContents::FocusLocationBarByDefault() { return (entry && entry->GetURL() == GURL(chrome::kAboutBlankURL)); } -void TabContents::SetFocusToLocationBar(bool select_all) { +void WebContentsImpl::SetFocusToLocationBar(bool select_all) { if (delegate_) delegate_->SetFocusToLocationBar(select_all); } -void TabContents::OnRegisterIntentService(const string16& action, - const string16& type, - const string16& href, - const string16& title, - const string16& disposition) { +void WebContentsImpl::OnRegisterIntentService(const string16& action, + const string16& type, + const string16& href, + const string16& title, + const string16& disposition) { delegate_->RegisterIntentHandler( this, action, type, href, title, disposition); } -void TabContents::OnWebIntentDispatch(const webkit_glue::WebIntentData& intent, - int intent_id) { +void WebContentsImpl::OnWebIntentDispatch( + const webkit_glue::WebIntentData& intent, + int intent_id) { WebIntentsDispatcherImpl* intents_dispatcher = new WebIntentsDispatcherImpl(this, intent, intent_id); delegate_->WebIntentDispatch(this, intents_dispatcher); } -void TabContents::OnDidStartProvisionalLoadForFrame(int64 frame_id, - bool is_main_frame, - const GURL& opener_url, - const GURL& url) { +void WebContentsImpl::OnDidStartProvisionalLoadForFrame(int64 frame_id, + bool is_main_frame, + const GURL& opener_url, + const GURL& url) { bool is_error_page = (url.spec() == chrome::kUnreachableWebDataURL); GURL validated_url(url); GURL validated_opener_url(opener_url); @@ -1474,10 +1481,10 @@ void TabContents::OnDidStartProvisionalLoadForFrame(int64 frame_id, } } -void TabContents::OnDidRedirectProvisionalLoad(int32 page_id, - const GURL& opener_url, - const GURL& source_url, - const GURL& target_url) { +void WebContentsImpl::OnDidRedirectProvisionalLoad(int32 page_id, + const GURL& opener_url, + const GURL& source_url, + const GURL& target_url) { // TODO(creis): Remove this method and have the pre-rendering code listen to // the ResourceDispatcherHost's RESOURCE_RECEIVED_REDIRECT notification // instead. See http://crbug.com/78512. @@ -1513,7 +1520,7 @@ void TabContents::OnDidRedirectProvisionalLoad(int32 page_id, validated_opener_url)); } -void TabContents::OnDidFailProvisionalLoadWithError( +void WebContentsImpl::OnDidFailProvisionalLoadWithError( const ViewHostMsg_DidFailProvisionalLoadWithError_Params& params) { VLOG(1) << "Failed Provisional Load: " << params.url.possibly_invalid_spec() << ", error_code: " << params.error_code @@ -1576,7 +1583,7 @@ void TabContents::OnDidFailProvisionalLoadWithError( params.error_description)); } -void TabContents::OnDidLoadResourceFromMemoryCache( +void WebContentsImpl::OnDidLoadResourceFromMemoryCache( const GURL& url, const std::string& security_info, const std::string& http_method, @@ -1600,13 +1607,13 @@ void TabContents::OnDidLoadResourceFromMemoryCache( content::Details<LoadFromMemoryCacheDetails>(&details)); } -void TabContents::OnDidDisplayInsecureContent() { +void WebContentsImpl::OnDidDisplayInsecureContent() { content::RecordAction(UserMetricsAction("SSL.DisplayedInsecureContent")); displayed_insecure_content_ = true; SSLManager::NotifySSLInternalStateChanged(&GetControllerImpl()); } -void TabContents::OnDidRunInsecureContent( +void WebContentsImpl::OnDidRunInsecureContent( const std::string& security_origin, const GURL& target_url) { LOG(INFO) << security_origin << " ran insecure content from " << target_url.possibly_invalid_spec(); @@ -1618,13 +1625,13 @@ void TabContents::OnDidRunInsecureContent( SSLManager::NotifySSLInternalStateChanged(&GetControllerImpl()); } -void TabContents::OnDocumentLoadedInFrame(int64 frame_id) { +void WebContentsImpl::OnDocumentLoadedInFrame(int64 frame_id) { controller_.DocumentLoadedInFrame(); FOR_EACH_OBSERVER(WebContentsObserver, observers_, DocumentLoadedInFrame(frame_id)); } -void TabContents::OnDidFinishLoad( +void WebContentsImpl::OnDidFinishLoad( int64 frame_id, const GURL& validated_url, bool is_main_frame) { @@ -1632,22 +1639,23 @@ void TabContents::OnDidFinishLoad( DidFinishLoad(frame_id, validated_url, is_main_frame)); } -void TabContents::OnDidFailLoadWithError(int64 frame_id, - const GURL& validated_url, - bool is_main_frame, - int error_code, - const string16& error_description) { +void WebContentsImpl::OnDidFailLoadWithError( + int64 frame_id, + const GURL& validated_url, + bool is_main_frame, + int error_code, + const string16& error_description) { FOR_EACH_OBSERVER(WebContentsObserver, observers_, DidFailLoad(frame_id, validated_url, is_main_frame, error_code, error_description)); } -void TabContents::OnUpdateContentRestrictions(int restrictions) { +void WebContentsImpl::OnUpdateContentRestrictions(int restrictions) { content_restrictions_ = restrictions; delegate_->ContentRestrictionsChanged(this); } -void TabContents::OnGoToEntryAtOffset(int offset) { +void WebContentsImpl::OnGoToEntryAtOffset(int offset) { if (!delegate_ || delegate_->OnGoToEntryOffset(offset)) { NavigationEntryImpl* entry = NavigationEntryImpl::FromNavigationEntry( controller_.GetEntryAtOffset(offset)); @@ -1672,15 +1680,15 @@ void TabContents::OnGoToEntryAtOffset(int offset) { } } -void TabContents::OnUpdateZoomLimits(int minimum_percent, - int maximum_percent, - bool remember) { +void WebContentsImpl::OnUpdateZoomLimits(int minimum_percent, + int maximum_percent, + bool remember) { minimum_zoom_percent_ = minimum_percent; maximum_zoom_percent_ = maximum_percent; temporary_zoom_settings_ = !remember; } -void TabContents::OnSaveURL(const GURL& url) { +void WebContentsImpl::OnSaveURL(const GURL& url) { download_stats::RecordDownloadSource( download_stats::INITIATED_BY_PEPPER_SAVE); // Check if the URL to save matches the URL of the main frame. Since this @@ -1693,21 +1701,21 @@ void TabContents::OnSaveURL(const GURL& url) { SaveURL(url, main_frame_url, is_main_frame); } -void TabContents::OnEnumerateDirectory(int request_id, - const FilePath& path) { +void WebContentsImpl::OnEnumerateDirectory(int request_id, + const FilePath& path) { ChildProcessSecurityPolicyImpl* policy = ChildProcessSecurityPolicyImpl::GetInstance(); if (policy->CanReadDirectory(GetRenderProcessHost()->GetID(), path)) delegate_->EnumerateDirectory(this, request_id, path); } -void TabContents::OnJSOutOfMemory() { +void WebContentsImpl::OnJSOutOfMemory() { delegate_->JSOutOfMemory(this); } -void TabContents::OnRegisterProtocolHandler(const std::string& protocol, - const GURL& url, - const string16& title) { +void WebContentsImpl::OnRegisterProtocolHandler(const std::string& protocol, + const GURL& url, + const string16& title) { ChildProcessSecurityPolicyImpl* policy = ChildProcessSecurityPolicyImpl::GetInstance(); if (policy->IsPseudoScheme(protocol) || policy->IsDisabledScheme(protocol)) @@ -1715,11 +1723,11 @@ void TabContents::OnRegisterProtocolHandler(const std::string& protocol, delegate_->RegisterProtocolHandler(this, protocol, url, title); } -void TabContents::OnFindReply(int request_id, - int number_of_matches, - const gfx::Rect& selection_rect, - int active_match_ordinal, - bool final_update) { +void WebContentsImpl::OnFindReply(int request_id, + int number_of_matches, + const gfx::Rect& selection_rect, + int active_match_ordinal, + bool final_update) { delegate_->FindReply(this, request_id, number_of_matches, selection_rect, active_match_ordinal, final_update); // Send a notification to the renderer that we are ready to receive more @@ -1732,30 +1740,30 @@ void TabContents::OnFindReply(int request_id, new ViewMsg_FindReplyACK(GetRenderViewHost()->GetRoutingID())); } -void TabContents::OnCrashedPlugin(const FilePath& plugin_path) { +void WebContentsImpl::OnCrashedPlugin(const FilePath& plugin_path) { delegate_->CrashedPlugin(this, plugin_path); } -void TabContents::OnAppCacheAccessed(const GURL& manifest_url, - bool blocked_by_policy) { +void WebContentsImpl::OnAppCacheAccessed(const GURL& manifest_url, + bool blocked_by_policy) { // Notify observers about navigation. FOR_EACH_OBSERVER(WebContentsObserver, observers_, AppCacheAccessed(manifest_url, blocked_by_policy)); } -void TabContents::OnOpenColorChooser(int color_chooser_id, - const SkColor& color) { +void WebContentsImpl::OnOpenColorChooser(int color_chooser_id, + const SkColor& color) { color_chooser_ = delegate_->OpenColorChooser(this, color_chooser_id, color); } -void TabContents::OnEndColorChooser(int color_chooser_id) { +void WebContentsImpl::OnEndColorChooser(int color_chooser_id) { if (color_chooser_ && color_chooser_id == color_chooser_->identifier()) color_chooser_->End(); } -void TabContents::OnSetSelectedColorInColorChooser(int color_chooser_id, - const SkColor& color) { +void WebContentsImpl::OnSetSelectedColorInColorChooser(int color_chooser_id, + const SkColor& color) { if (color_chooser_ && color_chooser_id == color_chooser_->identifier()) color_chooser_->SetSelectedColor(color); @@ -1763,8 +1771,8 @@ void TabContents::OnSetSelectedColorInColorChooser(int color_chooser_id, // Notifies the RenderWidgetHost instance about the fact that the page is // loading, or done loading and calls the base implementation. -void TabContents::SetIsLoading(bool is_loading, - LoadNotificationDetails* details) { +void WebContentsImpl::SetIsLoading(bool is_loading, + LoadNotificationDetails* details) { if (is_loading == is_loading_) return; @@ -1794,7 +1802,7 @@ void TabContents::SetIsLoading(bool is_loading, det); } -void TabContents::DidNavigateMainFramePostCommit( +void WebContentsImpl::DidNavigateMainFramePostCommit( const content::LoadCommittedDetails& details, const ViewHostMsg_FrameNavigate_Params& params) { if (opener_web_ui_type_ != WebUI::kNoWebUI) { @@ -1833,7 +1841,7 @@ void TabContents::DidNavigateMainFramePostCommit( DidNavigateMainFrame(details, params)); } -void TabContents::DidNavigateAnyFramePostCommit( +void WebContentsImpl::DidNavigateAnyFramePostCommit( RenderViewHost* render_view_host, const content::LoadCommittedDetails& details, const ViewHostMsg_FrameNavigate_Params& params) { @@ -1850,7 +1858,7 @@ void TabContents::DidNavigateAnyFramePostCommit( DidNavigateAnyFrame(details, params)); } -void TabContents::UpdateMaxPageIDIfNecessary(RenderViewHost* rvh) { +void WebContentsImpl::UpdateMaxPageIDIfNecessary(RenderViewHost* rvh) { // If we are creating a RVH for a restored controller, then we need to make // sure the RenderView starts with a next_page_id_ larger than the number // of restored entries. This must be called before the RenderView starts @@ -1864,8 +1872,8 @@ void TabContents::UpdateMaxPageIDIfNecessary(RenderViewHost* rvh) { max_restored_page_id); } -bool TabContents::UpdateTitleForEntry(NavigationEntryImpl* entry, - const string16& title) { +bool WebContentsImpl::UpdateTitleForEntry(NavigationEntryImpl* entry, + const string16& title) { // For file URLs without a title, use the pathname instead. In the case of a // synthesized title, we don't want the update to count toward the "one set // per page of the title to history." @@ -1908,7 +1916,7 @@ bool TabContents::UpdateTitleForEntry(NavigationEntryImpl* entry, return true; } -void TabContents::NotifySwapped() { +void WebContentsImpl::NotifySwapped() { // After sending out a swap notification, we need to send a disconnect // notification so that clients that pick up a pointer to |this| can NULL the // pointer. See Bug 1230284. @@ -1919,7 +1927,7 @@ void TabContents::NotifySwapped() { content::NotificationService::NoDetails()); } -void TabContents::NotifyConnected() { +void WebContentsImpl::NotifyConnected() { notify_disconnection_ = true; content::NotificationService::current()->Notify( content::NOTIFICATION_WEB_CONTENTS_CONNECTED, @@ -1927,7 +1935,7 @@ void TabContents::NotifyConnected() { content::NotificationService::NoDetails()); } -void TabContents::NotifyDisconnected() { +void WebContentsImpl::NotifyDisconnected() { if (!notify_disconnection_) return; @@ -1938,35 +1946,35 @@ void TabContents::NotifyDisconnected() { content::NotificationService::NoDetails()); } -RenderViewHostDelegate::View* TabContents::GetViewDelegate() { +RenderViewHostDelegate::View* WebContentsImpl::GetViewDelegate() { return view_.get(); } RenderViewHostDelegate::RendererManagement* -TabContents::GetRendererManagementDelegate() { +WebContentsImpl::GetRendererManagementDelegate() { return &render_manager_; } -content::RendererPreferences TabContents::GetRendererPrefs( +content::RendererPreferences WebContentsImpl::GetRendererPrefs( content::BrowserContext* browser_context) const { return renderer_preferences_; } -WebContents* TabContents::GetAsWebContents() { +WebContents* WebContentsImpl::GetAsWebContents() { return this; } -content::ViewType TabContents::GetRenderViewType() const { +content::ViewType WebContentsImpl::GetRenderViewType() const { return view_type_; } -gfx::Rect TabContents::GetRootWindowResizerRect() const { +gfx::Rect WebContentsImpl::GetRootWindowResizerRect() const { if (delegate_) return delegate_->GetRootWindowResizerRect(); return gfx::Rect(); } -void TabContents::RenderViewCreated(RenderViewHost* render_view_host) { +void WebContentsImpl::RenderViewCreated(RenderViewHost* render_view_host) { content::NotificationService::current()->Notify( content::NOTIFICATION_RENDER_VIEW_HOST_CREATED_FOR_TAB, content::Source<WebContents>(this), @@ -1992,7 +2000,7 @@ void TabContents::RenderViewCreated(RenderViewHost* render_view_host) { WebContentsObserver, observers_, RenderViewCreated(render_view_host)); } -void TabContents::RenderViewReady(RenderViewHost* rvh) { +void WebContentsImpl::RenderViewReady(RenderViewHost* rvh) { if (rvh != GetRenderViewHost()) { // Don't notify the world, since this came from a renderer in the // background. @@ -2013,9 +2021,9 @@ void TabContents::RenderViewReady(RenderViewHost* rvh) { FOR_EACH_OBSERVER(WebContentsObserver, observers_, RenderViewReady()); } -void TabContents::RenderViewGone(RenderViewHost* rvh, - base::TerminationStatus status, - int error_code) { +void WebContentsImpl::RenderViewGone(RenderViewHost* rvh, + base::TerminationStatus status, + int error_code) { if (rvh != GetRenderViewHost()) { // The pending page's RenderViewHost is gone. return; @@ -2031,13 +2039,14 @@ void TabContents::RenderViewGone(RenderViewHost* rvh, RenderViewGone(GetCrashedStatus())); } -void TabContents::RenderViewDeleted(RenderViewHost* rvh) { +void WebContentsImpl::RenderViewDeleted(RenderViewHost* rvh) { render_manager_.RenderViewDeleted(rvh); FOR_EACH_OBSERVER(WebContentsObserver, observers_, RenderViewDeleted(rvh)); } -void TabContents::DidNavigate(RenderViewHost* rvh, - const ViewHostMsg_FrameNavigate_Params& params) { +void WebContentsImpl::DidNavigate( + RenderViewHost* rvh, + const ViewHostMsg_FrameNavigate_Params& params) { if (content::PageTransitionIsMainFrame(params.transition)) render_manager_.DidNavigateMainFrame(rvh); @@ -2105,9 +2114,9 @@ void TabContents::DidNavigate(RenderViewHost* rvh, DidNavigateAnyFramePostCommit(rvh, details, params); } -void TabContents::UpdateState(RenderViewHost* rvh, - int32 page_id, - const std::string& state) { +void WebContentsImpl::UpdateState(RenderViewHost* rvh, + int32 page_id, + const std::string& state) { // Ensure that this state update comes from either the active RVH or one of // the swapped out RVHs. We don't expect to hear from any other RVHs. DCHECK(rvh == GetRenderViewHost() || render_manager_.IsSwappedOut(rvh)); @@ -2130,10 +2139,10 @@ void TabContents::UpdateState(RenderViewHost* rvh, controller_.NotifyEntryChanged(entry, entry_index); } -void TabContents::UpdateTitle(RenderViewHost* rvh, - int32 page_id, - const string16& title, - base::i18n::TextDirection title_direction) { +void WebContentsImpl::UpdateTitle(RenderViewHost* rvh, + int32 page_id, + const string16& title, + base::i18n::TextDirection title_direction) { // If we have a title, that's a pretty good indication that we've started // getting useful data. SetNotWaitingForResponse(); @@ -2158,17 +2167,17 @@ void TabContents::UpdateTitle(RenderViewHost* rvh, NotifyNavigationStateChanged(content::INVALIDATE_TYPE_TITLE); } -void TabContents::UpdateEncoding(RenderViewHost* render_view_host, - const std::string& encoding) { +void WebContentsImpl::UpdateEncoding(RenderViewHost* render_view_host, + const std::string& encoding) { SetEncoding(encoding); } -void TabContents::UpdateTargetURL(int32 page_id, const GURL& url) { +void WebContentsImpl::UpdateTargetURL(int32 page_id, const GURL& url) { if (delegate_) delegate_->UpdateTargetURL(this, page_id, url); } -void TabContents::Close(RenderViewHost* rvh) { +void WebContentsImpl::Close(RenderViewHost* rvh) { // The UI may be in an event-tracking loop, such as between the // mouse-down and mouse-up in text selection or a button click. // Defer the close until after tracking is complete, so that we @@ -2196,17 +2205,17 @@ void TabContents::Close(RenderViewHost* rvh) { delegate_->CloseContents(this); } -void TabContents::SwappedOut(RenderViewHost* rvh) { +void WebContentsImpl::SwappedOut(RenderViewHost* rvh) { if (delegate_ && rvh == GetRenderViewHost()) delegate_->SwappedOut(this); } -void TabContents::RequestMove(const gfx::Rect& new_bounds) { +void WebContentsImpl::RequestMove(const gfx::Rect& new_bounds) { if (delegate_ && delegate_->IsPopupOrPanel(this)) delegate_->MoveContents(this, new_bounds); } -void TabContents::DidStartLoading() { +void WebContentsImpl::DidStartLoading() { SetIsLoading(true, NULL); if (delegate_ && content_restrictions_) @@ -2216,7 +2225,7 @@ void TabContents::DidStartLoading() { FOR_EACH_OBSERVER(WebContentsObserver, observers_, DidStartLoading()); } -void TabContents::DidStopLoading() { +void WebContentsImpl::DidStopLoading() { scoped_ptr<LoadNotificationDetails> details; NavigationEntry* entry = controller_.GetActiveEntry(); @@ -2239,25 +2248,25 @@ void TabContents::DidStopLoading() { FOR_EACH_OBSERVER(WebContentsObserver, observers_, DidStopLoading()); } -void TabContents::DidCancelLoading() { +void WebContentsImpl::DidCancelLoading() { controller_.DiscardNonCommittedEntries(); // Update the URL display. NotifyNavigationStateChanged(content::INVALIDATE_TYPE_URL); } -void TabContents::DidChangeLoadProgress(double progress) { +void WebContentsImpl::DidChangeLoadProgress(double progress) { if (delegate_) delegate_->LoadProgressChanged(progress); } -void TabContents::DocumentAvailableInMainFrame( +void WebContentsImpl::DocumentAvailableInMainFrame( RenderViewHost* render_view_host) { FOR_EACH_OBSERVER(WebContentsObserver, observers_, DocumentAvailableInMainFrame()); } -void TabContents::DocumentOnLoadCompletedInMainFrame( +void WebContentsImpl::DocumentOnLoadCompletedInMainFrame( RenderViewHost* render_view_host, int32 page_id) { content::NotificationService::current()->Notify( @@ -2266,21 +2275,22 @@ void TabContents::DocumentOnLoadCompletedInMainFrame( content::Details<int>(&page_id)); } -void TabContents::RequestOpenURL(const GURL& url, - const content::Referrer& referrer, - WindowOpenDisposition disposition, - int64 source_frame_id) { +void WebContentsImpl::RequestOpenURL(const GURL& url, + const content::Referrer& referrer, + WindowOpenDisposition disposition, + int64 source_frame_id) { // Delegate to RequestTransferURL because this is just the generic // case where |old_request_id| is empty. RequestTransferURL(url, referrer, disposition, source_frame_id, GlobalRequestID()); } -void TabContents::RequestTransferURL(const GURL& url, - const content::Referrer& referrer, - WindowOpenDisposition disposition, - int64 source_frame_id, - const GlobalRequestID& old_request_id) { +void WebContentsImpl::RequestTransferURL( + const GURL& url, + const content::Referrer& referrer, + WindowOpenDisposition disposition, + int64 source_frame_id, + const GlobalRequestID& old_request_id) { WebContents* new_contents = NULL; content::PageTransition transition_type = content::PAGE_TRANSITION_LINK; if (render_manager_.web_ui()) { @@ -2316,7 +2326,7 @@ void TabContents::RequestTransferURL(const GURL& url, } } -void TabContents::RunJavaScriptMessage( +void WebContentsImpl::RunJavaScriptMessage( RenderViewHost* rvh, const string16& message, const string16& default_prompt, @@ -2345,8 +2355,10 @@ void TabContents::RunJavaScriptMessage( javascript_message_type, message, default_prompt, - base::Bind(&TabContents::OnDialogClosed, base::Unretained(this), rvh, - reply_msg), + base::Bind(&WebContentsImpl::OnDialogClosed, + base::Unretained(this), + rvh, + reply_msg), &suppress_this_message); } @@ -2359,10 +2371,10 @@ void TabContents::RunJavaScriptMessage( *did_suppress_message = suppress_this_message; } -void TabContents::RunBeforeUnloadConfirm(RenderViewHost* rvh, - const string16& message, - bool is_reload, - IPC::Message* reply_msg) { +void WebContentsImpl::RunBeforeUnloadConfirm(RenderViewHost* rvh, + const string16& message, + bool is_reload, + IPC::Message* reply_msg) { RenderViewHostImpl* rvhi = static_cast<RenderViewHostImpl*>(rvh); if (delegate_) delegate_->WillRunBeforeUnloadConfirm(); @@ -2382,11 +2394,11 @@ void TabContents::RunBeforeUnloadConfirm(RenderViewHost* rvh, dialog_creator_ = delegate_->GetJavaScriptDialogCreator(); dialog_creator_->RunBeforeUnloadDialog( this, message, is_reload, - base::Bind(&TabContents::OnDialogClosed, base::Unretained(this), rvh, + base::Bind(&WebContentsImpl::OnDialogClosed, base::Unretained(this), rvh, reply_msg)); } -WebPreferences TabContents::GetWebkitPrefs() { +WebPreferences WebContentsImpl::GetWebkitPrefs() { // We want to base the page config off of the real URL, rather than the // display URL. GURL url = controller_.GetActiveEntry() @@ -2394,7 +2406,7 @@ WebPreferences TabContents::GetWebkitPrefs() { return GetWebkitPrefs(GetRenderViewHost(), url); } -void TabContents::OnUserGesture() { +void WebContentsImpl::OnUserGesture() { // Notify observers. FOR_EACH_OBSERVER(WebContentsObserver, observers_, DidGetUserGesture()); @@ -2403,13 +2415,13 @@ void TabContents::OnUserGesture() { rdh->OnUserGesture(this); } -void TabContents::OnIgnoredUIEvent() { +void WebContentsImpl::OnIgnoredUIEvent() { // Notify observers. FOR_EACH_OBSERVER(WebContentsObserver, observers_, DidGetIgnoredUIEvent()); } -void TabContents::RendererUnresponsive(RenderViewHost* rvh, - bool is_during_unload) { +void WebContentsImpl::RendererUnresponsive(RenderViewHost* rvh, + bool is_during_unload) { // Don't show hung renderer dialog for a swapped out RVH. if (rvh != GetRenderViewHost()) return; @@ -2448,15 +2460,16 @@ void TabContents::RendererUnresponsive(RenderViewHost* rvh, delegate_->RendererUnresponsive(this); } -void TabContents::RendererResponsive(RenderViewHost* render_view_host) { +void WebContentsImpl::RendererResponsive(RenderViewHost* render_view_host) { if (delegate_) delegate_->RendererResponsive(this); } -void TabContents::LoadStateChanged(const GURL& url, - const net::LoadStateWithParam& load_state, - uint64 upload_position, - uint64 upload_size) { +void WebContentsImpl::LoadStateChanged( + const GURL& url, + const net::LoadStateWithParam& load_state, + uint64 upload_position, + uint64 upload_size) { load_state_ = load_state; upload_position_ = upload_position; upload_size_ = upload_size; @@ -2471,30 +2484,30 @@ void TabContents::LoadStateChanged(const GURL& url, } } -void TabContents::WorkerCrashed() { +void WebContentsImpl::WorkerCrashed() { if (delegate_) delegate_->WorkerCrashed(this); } -void TabContents::BeforeUnloadFiredFromRenderManager( +void WebContentsImpl::BeforeUnloadFiredFromRenderManager( bool proceed, bool* proceed_to_fire_unload) { if (delegate_) delegate_->BeforeUnloadFired(this, proceed, proceed_to_fire_unload); } -void TabContents::DidStartLoadingFromRenderManager( +void WebContentsImpl::DidStartLoadingFromRenderManager( RenderViewHost* render_view_host) { DidStartLoading(); } -void TabContents::RenderViewGoneFromRenderManager( +void WebContentsImpl::RenderViewGoneFromRenderManager( RenderViewHost* render_view_host) { DCHECK(crashed_status_ != base::TERMINATION_STATUS_STILL_RUNNING); RenderViewGone(render_view_host, crashed_status_, crashed_error_code_); } -void TabContents::UpdateRenderViewSizeForRenderManager() { +void WebContentsImpl::UpdateRenderViewSizeForRenderManager() { // TODO(brettw) this is a hack. See WebContentsView::SizeContents. gfx::Size size = view_->GetContainerSize(); // 0x0 isn't a valid window size (minimal window size is 1x1) but it may be @@ -2505,24 +2518,24 @@ void TabContents::UpdateRenderViewSizeForRenderManager() { view_->SizeContents(size); } -void TabContents::NotifySwappedFromRenderManager() { +void WebContentsImpl::NotifySwappedFromRenderManager() { NotifySwapped(); } -NavigationControllerImpl& TabContents::GetControllerForRenderManager() { +NavigationControllerImpl& WebContentsImpl::GetControllerForRenderManager() { return GetControllerImpl(); } -WebUIImpl* TabContents::CreateWebUIForRenderManager(const GURL& url) { +WebUIImpl* WebContentsImpl::CreateWebUIForRenderManager(const GURL& url) { return static_cast<WebUIImpl*>(CreateWebUI(url)); } NavigationEntry* - TabContents::GetLastCommittedNavigationEntryForRenderManager() { + WebContentsImpl::GetLastCommittedNavigationEntryForRenderManager() { return controller_.GetLastCommittedEntry(); } -bool TabContents::CreateRenderViewForRenderManager( +bool WebContentsImpl::CreateRenderViewForRenderManager( RenderViewHost* render_view_host) { // Can be NULL during tests. RenderWidgetHostView* rwh_view = view_->CreateViewForWidget(render_view_host); @@ -2552,10 +2565,10 @@ bool TabContents::CreateRenderViewForRenderManager( return true; } -void TabContents::OnDialogClosed(RenderViewHost* rvh, - IPC::Message* reply_msg, - bool success, - const string16& user_input) { +void WebContentsImpl::OnDialogClosed(RenderViewHost* rvh, + IPC::Message* reply_msg, + bool success, + const string16& user_input) { if (is_showing_before_unload_dialog_ && !success) { // If a beforeunload dialog is canceled, we need to stop the throbber from // spinning, since we forced it to start spinning in Navigate. @@ -2568,14 +2581,14 @@ void TabContents::OnDialogClosed(RenderViewHost* rvh, rvh)->JavaScriptDialogClosed(reply_msg, success, user_input); } -void TabContents::SetEncoding(const std::string& encoding) { +void WebContentsImpl::SetEncoding(const std::string& encoding) { encoding_ = content::GetContentClient()->browser()-> GetCanonicalEncodingNameByAliasName(encoding); } -void TabContents::SaveURL(const GURL& url, - const GURL& referrer, - bool is_main_frame) { +void WebContentsImpl::SaveURL(const GURL& url, + const GURL& referrer, + bool is_main_frame) { DownloadManager* dlm = GetBrowserContext()->GetDownloadManager(); if (!dlm) return; @@ -2597,13 +2610,13 @@ void TabContents::SaveURL(const GURL& url, DownloadManager::OnStartedCallback()); } -void TabContents::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { +void WebContentsImpl::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { RenderWidgetHostView* rwh_view = GetView()->CreateViewForWidget(rvh); // Can be NULL during tests. if (rwh_view) rwh_view->SetSize(GetView()->GetContainerSize()); } -RenderViewHostImpl* TabContents::GetRenderViewHostImpl() { +RenderViewHostImpl* WebContentsImpl::GetRenderViewHostImpl() { return static_cast<RenderViewHostImpl*>(GetRenderViewHost()); } diff --git a/content/browser/tab_contents/tab_contents.h b/content/browser/tab_contents/tab_contents.h index 7110bf7..df83c8c 100644 --- a/content/browser/tab_contents/tab_contents.h +++ b/content/browser/tab_contents/tab_contents.h @@ -53,18 +53,18 @@ namespace webkit_glue { struct WebIntentData; } -class CONTENT_EXPORT TabContents +class CONTENT_EXPORT WebContentsImpl : public NON_EXPORTED_BASE(content::WebContents), public content::RenderViewHostDelegate, public RenderViewHostManager::Delegate { public: // See WebContents::Create for a description of these parameters. - TabContents(content::BrowserContext* browser_context, - content::SiteInstance* site_instance, - int routing_id, - const TabContents* base_tab_contents, - SessionStorageNamespaceImpl* session_storage_namespace); - virtual ~TabContents(); + WebContentsImpl(content::BrowserContext* browser_context, + content::SiteInstance* site_instance, + int routing_id, + const WebContentsImpl* base_web_contents, + SessionStorageNamespaceImpl* session_storage_namespace); + virtual ~WebContentsImpl(); // Returns the content specific prefs for the given RVH. static WebPreferences GetWebkitPrefs( @@ -73,23 +73,23 @@ class CONTENT_EXPORT TabContents // Returns the SavePackage which manages the page saving job. May be NULL. SavePackage* save_package() const { return save_package_.get(); } - // Updates the max page ID for the current SiteInstance in this TabContents - // to be at least |page_id|. + // Updates the max page ID for the current SiteInstance in this + // WebContentsImpl to be at least |page_id|. void UpdateMaxPageID(int32 page_id); - // Updates the max page ID for the given SiteInstance in this TabContents + // Updates the max page ID for the given SiteInstance in this WebContentsImpl // to be at least |page_id|. void UpdateMaxPageIDForSiteInstance(content::SiteInstance* site_instance, int32 page_id); // Copy the current map of SiteInstance ID to max page ID from another tab. // This is necessary when this tab adopts the NavigationEntries from - // |tab_contents|. - void CopyMaxPageIDsFrom(TabContents* tab_contents); + // |web_contents|. + void CopyMaxPageIDsFrom(WebContentsImpl* web_contents); - // Called by the NavigationController to cause the TabContents to navigate to - // the current pending entry. The NavigationController should be called back - // with RendererDidNavigate on success or DiscardPendingEntry on failure. + // Called by the NavigationController to cause the WebContentsImpl to navigate + // to the current pending entry. The NavigationController should be called + // back with RendererDidNavigate on success or DiscardPendingEntry on failure. // The callbacks can be inside of this function, or at some future time. // // The entry has a PageID of -1 if newly created (corresponding to navigation @@ -506,13 +506,13 @@ class CONTENT_EXPORT TabContents bool UpdateTitleForEntry(content::NavigationEntryImpl* entry, const string16& title); - // Causes the TabContents to navigate in the right renderer to |entry|, which - // must be already part of the entries in the navigation controller. + // Causes the WebContentsImpl to navigate in the right renderer to |entry|, + // which must be already part of the entries in the navigation controller. // This does not change the NavigationController state. bool NavigateToEntry(const content::NavigationEntryImpl& entry, content::NavigationController::ReloadType reload_type); - // Sets the history for this tab_contents to |history_length| entries, and + // Sets the history for this WebContentsImpl to |history_length| entries, and // moves the current page_id to the last entry in the list if it's valid. // This is mainly used when a prerendered page is swapped into the current // tab. The method is virtual for testing. @@ -562,7 +562,7 @@ class CONTENT_EXPORT TabContents RenderViewHostManager render_manager_; // Manages injecting Java objects into all RenderViewHosts associated with - // this TabContents. + // this WebContentsImpl. scoped_ptr<JavaBridgeDispatcherHostManager> java_bridge_dispatcher_host_manager_; @@ -587,7 +587,7 @@ class CONTENT_EXPORT TabContents // Map of SiteInstance ID to max page ID for this tab. A page ID is specific // to a given tab and SiteInstance, and must be valid for the lifetime of the - // TabContents. + // WebContentsImpl. std::map<int32, int32> max_page_ids_; // System time at which the current load was started. @@ -626,13 +626,13 @@ class CONTENT_EXPORT TabContents bool is_being_destroyed_; // Indicates whether we should notify about disconnection of this - // TabContents. This is used to ensure disconnection notifications only + // WebContentsImpl. This is used to ensure disconnection notifications only // happen if a connection notification has happened and that they happen only // once. bool notify_disconnection_; // Pointer to the JavaScript dialog creator, lazily assigned. Used because the - // delegate of this TabContents is nulled before its destructor is called. + // delegate of this WebContentsImpl is nulled before its destructor is called. content::JavaScriptDialogCreator* dialog_creator_; #if defined(OS_WIN) @@ -690,7 +690,9 @@ class CONTENT_EXPORT TabContents // Color chooser that was opened by this tab. content::ColorChooser* color_chooser_; - DISALLOW_COPY_AND_ASSIGN(TabContents); + DISALLOW_COPY_AND_ASSIGN(WebContentsImpl); }; +typedef class WebContentsImpl TabContents; + #endif // CONTENT_BROWSER_TAB_CONTENTS_TAB_CONTENTS_H_ diff --git a/content/browser/tab_contents/tab_contents_view_aura.h b/content/browser/tab_contents/tab_contents_view_aura.h index 21466ee..56b3ba8 100644 --- a/content/browser/tab_contents/tab_contents_view_aura.h +++ b/content/browser/tab_contents/tab_contents_view_aura.h @@ -28,7 +28,7 @@ class CONTENT_EXPORT TabContentsViewAura public aura::WindowDelegate, public aura::client::DragDropDelegate { public: - TabContentsViewAura(TabContents* tab_contents, + TabContentsViewAura(WebContentsImpl* web_contents, content::WebContentsViewDelegate* delegate); virtual ~TabContentsViewAura(); @@ -121,8 +121,8 @@ class CONTENT_EXPORT TabContentsViewAura scoped_ptr<aura::Window> window_; - // The TabContents whose contents we display. - TabContents* tab_contents_; + // The WebContentsImpl whose contents we display. + WebContentsImpl* tab_contents_; content::RenderWidgetHostView* view_; diff --git a/content/browser/tab_contents/tab_contents_view_gtk.h b/content/browser/tab_contents/tab_contents_view_gtk.h index a64dfd7..815d4a9 100644 --- a/content/browser/tab_contents/tab_contents_view_gtk.h +++ b/content/browser/tab_contents/tab_contents_view_gtk.h @@ -32,12 +32,11 @@ class CONTENT_EXPORT TabContentsViewGtk : public WebContentsView { // because that's what was easiest when they were split. We optionally take // |wrapper| which creates an intermediary widget layer for features from the // Embedding layer that lives with the WebContentsView. - TabContentsViewGtk(TabContents* tab_contents, + TabContentsViewGtk(WebContentsImpl* web_contents, WebContentsViewDelegate* delegate); virtual ~TabContentsViewGtk(); WebContentsViewDelegate* delegate() const { return delegate_.get(); } - TabContents* tab_contents() { return tab_contents_; } WebContents* web_contents(); // WebContentsView implementation -------------------------------------------- @@ -116,8 +115,8 @@ class CONTENT_EXPORT TabContentsViewGtk : public WebContentsView { CHROMEGTK_CALLBACK_1(TabContentsViewGtk, void, OnSizeAllocate, GtkAllocation*); - // The TabContents whose contents we display. - TabContents* tab_contents_; + // The WebContentsImpl whose contents we display. + WebContentsImpl* tab_contents_; // Common implementations of some WebContentsView methods. TabContentsViewHelper tab_contents_view_helper_; diff --git a/content/browser/tab_contents/tab_contents_view_helper.h b/content/browser/tab_contents/tab_contents_view_helper.h index bf254be..33fbd3c7 100644 --- a/content/browser/tab_contents/tab_contents_view_helper.h +++ b/content/browser/tab_contents/tab_contents_view_helper.h @@ -16,7 +16,7 @@ #include "third_party/WebKit/Source/WebKit/chromium/public/WebPopupType.h" #include "webkit/glue/window_open_disposition.h" -class TabContents; +class WebContentsImpl; struct ViewHostMsg_CreateWindow_Params; namespace content { @@ -41,9 +41,10 @@ class CONTENT_EXPORT TabContentsViewHelper virtual ~TabContentsViewHelper(); // Creates a new window; call |ShowCreatedWindow| below to show it. - TabContents* CreateNewWindow(content::WebContents* web_contents, - int route_id, - const ViewHostMsg_CreateWindow_Params& params); + WebContentsImpl* CreateNewWindow( + content::WebContents* web_contents, + int route_id, + const ViewHostMsg_CreateWindow_Params& params); // Creates a new popup or fullscreen widget; call |ShowCreatedWidget| below to // show it. If |is_fullscreen| is true it is a fullscreen widget, if not then @@ -55,11 +56,11 @@ class CONTENT_EXPORT TabContentsViewHelper WebKit::WebPopupType popup_type); // Shows a window created with |CreateNewWindow| above. - TabContents* ShowCreatedWindow(content::WebContents* web_contents, - int route_id, - WindowOpenDisposition disposition, - const gfx::Rect& initial_pos, - bool user_gesture); + WebContentsImpl* ShowCreatedWindow(content::WebContents* web_contents, + int route_id, + WindowOpenDisposition disposition, + const gfx::Rect& initial_pos, + bool user_gesture); // Shows a widget created with |CreateNewWidget| above. |initial_pos| is only // meaningful for non-fullscreen widgets. @@ -79,14 +80,14 @@ class CONTENT_EXPORT TabContentsViewHelper // called once as this call also removes it from the internal map. content::RenderWidgetHostView* GetCreatedWidget(int route_id); - // Finds the new TabContents by route_id, initializes it for + // Finds the new WebContentsImpl by route_id, initializes it for // renderer-initiated creation, and returns it. Note that this can only be // called once as this call also removes it from the internal map. - TabContents* GetCreatedWindow(int route_id); + WebContentsImpl* GetCreatedWindow(int route_id); - // Tracks created TabContents objects that have not been shown yet. They are - // identified by the route ID passed to CreateNewWindow. - typedef std::map<int, TabContents*> PendingContents; + // Tracks created WebContentsImpl objects that have not been shown yet. They + // are identified by the route ID passed to CreateNewWindow. + typedef std::map<int, WebContentsImpl*> PendingContents; PendingContents pending_contents_; // These maps hold on to the widgets that we created on behalf of the renderer diff --git a/content/browser/tab_contents/tab_contents_view_win.h b/content/browser/tab_contents/tab_contents_view_win.h index 5bfdf01..28ffee5 100644 --- a/content/browser/tab_contents/tab_contents_view_win.h +++ b/content/browser/tab_contents/tab_contents_view_win.h @@ -27,7 +27,7 @@ class WebContentsViewDelegate; class CONTENT_EXPORT TabContentsViewWin : public content::WebContentsView, public ui::WindowImpl { public: - TabContentsViewWin(TabContents* tab_contents, + TabContentsViewWin(WebContentsImpl* web_contents, content::WebContentsViewDelegate* delegate); virtual ~TabContentsViewWin(); @@ -99,7 +99,7 @@ class CONTENT_EXPORT TabContentsViewWin : public content::WebContentsView, virtual void GotFocus() OVERRIDE; virtual void TakeFocus(bool reverse) OVERRIDE; - TabContents* tab_contents() const { return tab_contents_; } + WebContentsImpl* tab_contents() const { return tab_contents_; } private: void EndDragging(); @@ -124,8 +124,8 @@ class CONTENT_EXPORT TabContentsViewWin : public content::WebContentsView, gfx::Size initial_size_; - // The TabContents whose contents we display. - TabContents* tab_contents_; + // The WebContentsImpl whose contents we display. + WebContentsImpl* tab_contents_; RenderWidgetHostViewWin* view_; diff --git a/content/browser/tab_contents/web_contents_view_mac.h b/content/browser/tab_contents/web_contents_view_mac.h index 2ee04bd..5b80c03 100644 --- a/content/browser/tab_contents/web_contents_view_mac.h +++ b/content/browser/tab_contents/web_contents_view_mac.h @@ -41,18 +41,19 @@ class Point; scoped_nsobject<WebDragDest> dragDest_; } -// Expose this, since sometimes one needs both the NSView and the TabContents. -- (TabContents*)tabContents; +// Expose this, since sometimes one needs both the NSView and the +// WebContentsImpl. +- (WebContentsImpl*)webContents; @end // Mac-specific implementation of the WebContentsView. It owns an NSView that // contains all of the contents of the tab and associated child views. class WebContentsViewMac : public content::WebContentsView { public: - // The corresponding TabContents is passed in the constructor, and manages our - // lifetime. This doesn't need to be the case, but is this way currently + // The corresponding WebContentsImpl is passed in the constructor, and manages + // our lifetime. This doesn't need to be the case, but is this way currently // because that's what was easiest when they were split. - WebContentsViewMac(TabContents* tab_contents, + WebContentsViewMac(WebContentsImpl* web_contents, content::WebContentsViewDelegate* delegate); virtual ~WebContentsViewMac(); @@ -114,12 +115,12 @@ class WebContentsViewMac : public content::WebContentsView { // CloseTabAfterEventTracking() implementation. void CloseTab(); - TabContents* tab_contents() { return tab_contents_; } + WebContentsImpl* web_contents() { return web_contents_; } content::WebContentsViewDelegate* delegate() { return delegate_.get(); } private: - // The TabContents whose contents we display. - TabContents* tab_contents_; + // The WebContentsImpl whose contents we display. + WebContentsImpl* web_contents_; // Common implementations of some WebContentsView methods. TabContentsViewHelper tab_contents_view_helper_; @@ -149,7 +150,7 @@ class WebContentsViewDelegate; namespace web_contents_view_mac { // Creates a WebContentsViewMac. Takes ownership of |delegate|. CONTENT_EXPORT content::WebContentsView* CreateWebContentsView( - TabContents* tab_contents, + WebContentsImpl* web_contents, content::WebContentsViewDelegate* delegate); } diff --git a/content/browser/tab_contents/web_contents_view_mac.mm b/content/browser/tab_contents/web_contents_view_mac.mm index 8659c26..c115bb2 100644 --- a/content/browser/tab_contents/web_contents_view_mac.mm +++ b/content/browser/tab_contents/web_contents_view_mac.mm @@ -65,9 +65,9 @@ content::WebContentsView* CreateWebContentsView( } WebContentsViewMac::WebContentsViewMac( - TabContents* tab_contents, + WebContentsImpl* web_contents, content::WebContentsViewDelegate* delegate) - : tab_contents_(tab_contents), + : web_contents_(web_contents), delegate_(delegate) { } @@ -133,7 +133,7 @@ gfx::NativeView WebContentsViewMac::GetNativeView() const { } gfx::NativeView WebContentsViewMac::GetContentNativeView() const { - RenderWidgetHostView* rwhv = tab_contents_->GetRenderWidgetHostView(); + RenderWidgetHostView* rwhv = web_contents_->GetRenderWidgetHostView(); if (!rwhv) return NULL; return rwhv->GetNativeView(); @@ -211,8 +211,8 @@ void WebContentsViewMac::Focus() { } void WebContentsViewMac::SetInitialFocus() { - if (tab_contents_->FocusLocationBarByDefault()) - tab_contents_->SetFocusToLocationBar(false); + if (web_contents_->FocusLocationBarByDefault()) + web_contents_->SetFocusToLocationBar(false); else [[cocoa_view_.get() window] makeFirstResponder:GetContentNativeView()]; } @@ -269,13 +269,13 @@ void WebContentsViewMac::TakeFocus(bool reverse) { void WebContentsViewMac::CreateNewWindow( int route_id, const ViewHostMsg_CreateWindow_Params& params) { - tab_contents_view_helper_.CreateNewWindow(tab_contents_, route_id, params); + tab_contents_view_helper_.CreateNewWindow(web_contents_, route_id, params); } void WebContentsViewMac::CreateNewWidget( int route_id, WebKit::WebPopupType popup_type) { RenderWidgetHostView* widget_view = - tab_contents_view_helper_.CreateNewWidget(tab_contents_, + tab_contents_view_helper_.CreateNewWidget(web_contents_, route_id, false, popup_type); @@ -289,7 +289,7 @@ void WebContentsViewMac::CreateNewWidget( void WebContentsViewMac::CreateNewFullscreenWidget(int route_id) { RenderWidgetHostView* widget_view = - tab_contents_view_helper_.CreateNewWidget(tab_contents_, + tab_contents_view_helper_.CreateNewWidget(web_contents_, route_id, true, WebKit::WebPopupTypeNone); @@ -306,13 +306,13 @@ void WebContentsViewMac::ShowCreatedWindow(int route_id, const gfx::Rect& initial_pos, bool user_gesture) { tab_contents_view_helper_.ShowCreatedWindow( - tab_contents_, route_id, disposition, initial_pos, user_gesture); + web_contents_, route_id, disposition, initial_pos, user_gesture); } void WebContentsViewMac::ShowCreatedWidget( int route_id, const gfx::Rect& initial_pos) { RenderWidgetHostView* widget_host_view = - tab_contents_view_helper_.ShowCreatedWidget(tab_contents_, + tab_contents_view_helper_.ShowCreatedWidget(web_contents_, route_id, false, initial_pos); @@ -327,7 +327,7 @@ void WebContentsViewMac::ShowCreatedWidget( void WebContentsViewMac::ShowCreatedFullscreenWidget(int route_id) { RenderWidgetHostView* widget_host_view = - tab_contents_view_helper_.ShowCreatedWidget(tab_contents_, + tab_contents_view_helper_.ShowCreatedWidget(web_contents_, route_id, true, gfx::Rect()); @@ -343,8 +343,8 @@ void WebContentsViewMac::ShowCreatedFullscreenWidget(int route_id) { void WebContentsViewMac::ShowContextMenu( const content::ContextMenuParams& params) { // Allow delegates to handle the context menu operation first. - if (tab_contents_->GetDelegate() && - tab_contents_->GetDelegate()->HandleContextMenu(params)) { + if (web_contents_->GetDelegate() && + web_contents_->GetDelegate()->HandleContextMenu(params)) { return; } @@ -362,7 +362,7 @@ void WebContentsViewMac::ShowPopupMenu( int selected_item, const std::vector<WebMenuItem>& items, bool right_aligned) { - PopupMenuHelper popup_menu_helper(tab_contents_->GetRenderViewHost()); + PopupMenuHelper popup_menu_helper(web_contents_->GetRenderViewHost()); popup_menu_helper.ShowPopupMenu(bounds, item_height, item_font_size, selected_item, items, right_aligned); } @@ -388,7 +388,7 @@ void WebContentsViewMac::GetViewBounds(gfx::Rect* out) const { } void WebContentsViewMac::CloseTab() { - tab_contents_->Close(tab_contents_->GetRenderViewHost()); + web_contents_->Close(web_contents_->GetRenderViewHost()); } @implementation WebContentsViewCocoa @@ -398,7 +398,7 @@ void WebContentsViewMac::CloseTab() { if (self != nil) { webContentsView_ = w; dragDest_.reset( - [[WebDragDest alloc] initWithTabContents:[self tabContents]]); + [[WebDragDest alloc] initWithWebContentsImpl:[self webContents]]); [self registerDragTypes]; [[NSNotificationCenter defaultCenter] @@ -442,22 +442,22 @@ void WebContentsViewMac::CloseTab() { [dragDest_ setCurrentOperation:operation]; } -- (TabContents*)tabContents { +- (WebContentsImpl*)webContents { if (webContentsView_ == NULL) return NULL; - return webContentsView_->tab_contents(); + return webContentsView_->web_contents(); } -- (void)mouseEvent:(NSEvent *)theEvent { - TabContents* tabContents = [self tabContents]; - if (tabContents && tabContents->GetDelegate()) { +- (void)mouseEvent:(NSEvent*)theEvent { + WebContentsImpl* webContents = [self webContents]; + if (webContents && webContents->GetDelegate()) { NSPoint location = [NSEvent mouseLocation]; if ([theEvent type] == NSMouseMoved) - tabContents->GetDelegate()->ContentsMouseEvent( - tabContents, gfx::Point(location.x, location.y), true); + webContents->GetDelegate()->ContentsMouseEvent( + webContents, gfx::Point(location.x, location.y), true); if ([theEvent type] == NSMouseExited) - tabContents->GetDelegate()->ContentsMouseEvent( - tabContents, gfx::Point(location.x, location.y), false); + webContents->GetDelegate()->ContentsMouseEvent( + webContents, gfx::Point(location.x, location.y), false); } } @@ -481,7 +481,7 @@ void WebContentsViewMac::CloseTab() { image:(NSImage*)image offset:(NSPoint)offset { dragSource_.reset([[WebDragSource alloc] - initWithContents:[self tabContents] + initWithContents:[self webContents] view:self dropData:&dropData image:image @@ -576,7 +576,7 @@ void WebContentsViewMac::CloseTab() { if (direction == NSDirectSelection) return; - [self tabContents]-> + [self webContents]-> FocusThroughTabTraversal(direction == NSSelectingPrevious); } diff --git a/content/browser/tab_contents/web_drag_dest_mac.h b/content/browser/tab_contents/web_drag_dest_mac.h index db55174..0e22fa0 100644 --- a/content/browser/tab_contents/web_drag_dest_mac.h +++ b/content/browser/tab_contents/web_drag_dest_mac.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -6,7 +6,7 @@ #include "base/string16.h" -class TabContents; +class WebContentsImpl; struct WebDropData; namespace content { @@ -23,8 +23,8 @@ typedef content::RenderViewHost* RenderViewHostIdentifier; @interface WebDragDest : NSObject { @private - // Our associated TabContents. Weak reference. - TabContents* tabContents_; + // Our associated WebContentsImpl. Weak reference. + WebContentsImpl* webContents_; // Delegate; weak. content::WebDragDestDelegate* delegate_; @@ -38,17 +38,17 @@ typedef content::RenderViewHost* RenderViewHostIdentifier; RenderViewHostIdentifier currentRVH_; } -// |contents| is the TabContents representing this tab, used to communicate +// |contents| is the WebContentsImpl representing this tab, used to communicate // drag&drop messages to WebCore and handle navigation on a successful drop // (if necessary). -- (id)initWithTabContents:(TabContents*)contents; +- (id)initWithWebContentsImpl:(WebContentsImpl*)contents; - (void)setDragDelegate:(content::WebDragDestDelegate*)delegate; // Sets the current operation negotiated by the source and destination, // which determines whether or not we should allow the drop. Takes effect the // next time |-draggingUpdated:| is called. -- (void)setCurrentOperation: (NSDragOperation)operation; +- (void)setCurrentOperation:(NSDragOperation)operation; // Messages to send during the tracking of a drag, ususally upon receiving // calls from the view system. Communicates the drag messages to WebCore. diff --git a/content/browser/tab_contents/web_drag_dest_mac.mm b/content/browser/tab_contents/web_drag_dest_mac.mm index 7ee4706..5db094a 100644 --- a/content/browser/tab_contents/web_drag_dest_mac.mm +++ b/content/browser/tab_contents/web_drag_dest_mac.mm @@ -20,12 +20,12 @@ using content::Referrer; @implementation WebDragDest -// |contents| is the TabContents representing this tab, used to communicate +// |contents| is the WebContentsImpl representing this tab, used to communicate // drag&drop messages to WebCore and handle navigation on a successful drop // (if necessary). -- (id)initWithTabContents:(TabContents*)contents { +- (id)initWithWebContentsImpl:(WebContentsImpl*)contents { if ((self = [super init])) { - tabContents_ = contents; + webContents_ = contents; } return self; } @@ -69,7 +69,7 @@ using content::Referrer; // entering and exiting). One example is an interstitial page (e.g., safe // browsing warning). - (BOOL)onlyAllowsNavigation { - return tabContents_->ShowingInterstitialPage(); + return webContents_->ShowingInterstitialPage(); } // Messages to send during the tracking of a drag, usually upon receiving @@ -79,7 +79,7 @@ using content::Referrer; view:(NSView*)view { // Save off the RVH so we can tell if it changes during a drag. If it does, // we need to send a new enter message in draggingUpdated:. - currentRVH_ = tabContents_->GetRenderViewHost(); + currentRVH_ = webContents_->GetRenderViewHost(); if ([self onlyAllowsNavigation]) { if ([[info draggingPasteboard] containsURLData]) @@ -88,7 +88,7 @@ using content::Referrer; } if (delegate_) { - delegate_->DragInitialize(tabContents_); + delegate_->DragInitialize(webContents_); delegate_->OnDragEnter(); } @@ -102,7 +102,8 @@ using content::Referrer; NSPoint viewPoint = [self flipWindowPointToView:windowPoint view:view]; NSPoint screenPoint = [self flipWindowPointToScreen:windowPoint view:view]; NSDragOperation mask = [info draggingSourceOperationMask]; - tabContents_->GetRenderViewHost()->DragTargetDragEnter(data, + webContents_->GetRenderViewHost()->DragTargetDragEnter( + data, gfx::Point(viewPoint.x, viewPoint.y), gfx::Point(screenPoint.x, screenPoint.y), static_cast<WebDragOperationsMask>(mask)); @@ -115,7 +116,7 @@ using content::Referrer; - (void)draggingExited:(id<NSDraggingInfo>)info { DCHECK(currentRVH_); - if (currentRVH_ != tabContents_->GetRenderViewHost()) + if (currentRVH_ != webContents_->GetRenderViewHost()) return; // Nothing to do in the interstitial case. @@ -123,13 +124,13 @@ using content::Referrer; if (delegate_) delegate_->OnDragLeave(); - tabContents_->GetRenderViewHost()->DragTargetDragLeave(); + webContents_->GetRenderViewHost()->DragTargetDragLeave(); } - (NSDragOperation)draggingUpdated:(id<NSDraggingInfo>)info view:(NSView*)view { DCHECK(currentRVH_); - if (currentRVH_ != tabContents_->GetRenderViewHost()) + if (currentRVH_ != webContents_->GetRenderViewHost()) [self draggingEntered:info view:view]; if ([self onlyAllowsNavigation]) { @@ -144,7 +145,7 @@ using content::Referrer; NSPoint viewPoint = [self flipWindowPointToView:windowPoint view:view]; NSPoint screenPoint = [self flipWindowPointToScreen:windowPoint view:view]; NSDragOperation mask = [info draggingSourceOperationMask]; - tabContents_->GetRenderViewHost()->DragTargetDragOver( + webContents_->GetRenderViewHost()->DragTargetDragOver( gfx::Point(viewPoint.x, viewPoint.y), gfx::Point(screenPoint.x, screenPoint.y), static_cast<WebDragOperationsMask>(mask)); @@ -157,7 +158,7 @@ using content::Referrer; - (BOOL)performDragOperation:(id<NSDraggingInfo>)info view:(NSView*)view { - if (currentRVH_ != tabContents_->GetRenderViewHost()) + if (currentRVH_ != webContents_->GetRenderViewHost()) [self draggingEntered:info view:view]; // Check if we only allow navigation and navigate to a url on the pasteboard. @@ -166,7 +167,7 @@ using content::Referrer; if ([pboard containsURLData]) { GURL url; ui::PopulateURLAndTitleFromPasteboard(&url, NULL, pboard, YES); - tabContents_->OpenURL(OpenURLParams( + webContents_->OpenURL(OpenURLParams( url, Referrer(), CURRENT_TAB, content::PAGE_TRANSITION_AUTO_BOOKMARK, false)); return YES; @@ -184,7 +185,7 @@ using content::Referrer; NSPoint windowPoint = [info draggingLocation]; NSPoint viewPoint = [self flipWindowPointToView:windowPoint view:view]; NSPoint screenPoint = [self flipWindowPointToScreen:windowPoint view:view]; - tabContents_->GetRenderViewHost()->DragTargetDrop( + webContents_->GetRenderViewHost()->DragTargetDrop( gfx::Point(viewPoint.x, viewPoint.y), gfx::Point(screenPoint.x, screenPoint.y)); diff --git a/content/browser/tab_contents/web_drag_dest_mac_unittest.mm b/content/browser/tab_contents/web_drag_dest_mac_unittest.mm index e04400c..92905a6 100644 --- a/content/browser/tab_contents/web_drag_dest_mac_unittest.mm +++ b/content/browser/tab_contents/web_drag_dest_mac_unittest.mm @@ -28,7 +28,7 @@ class WebDragDestTest : public RenderViewHostImplTestHarness { public: virtual void SetUp() { RenderViewHostImplTestHarness::SetUp(); - drag_dest_.reset([[WebDragDest alloc] initWithTabContents:contents()]); + drag_dest_.reset([[WebDragDest alloc] initWithWebContentsImpl:contents()]); } void PutURLOnPasteboard(NSString* urlString, NSPasteboard* pboard) { diff --git a/content/browser/tab_contents/web_drag_source_mac.h b/content/browser/tab_contents/web_drag_source_mac.h index f2e2cb4..6bb782f 100644 --- a/content/browser/tab_contents/web_drag_source_mac.h +++ b/content/browser/tab_contents/web_drag_source_mac.h @@ -9,15 +9,15 @@ #include "base/memory/scoped_ptr.h" #include "googleurl/src/gurl.h" -class TabContents; +class WebContentsImpl; struct WebDropData; // A class that handles tracking and event processing for a drag and drop // originating from the content area. @interface WebDragSource : NSObject { @private - // Our tab. Weak reference (owns or co-owns us). - TabContents* contents_; + // Our contents. Weak reference (owns or co-owns us). + WebContentsImpl* contents_; // The view from which the drag was initiated. Weak reference. NSView* contentsView_; @@ -50,7 +50,7 @@ struct WebDropData; // Initialize a WebDragSource object for a drag (originating on the given // contentsView and with the given dropData and pboard). Fill the pasteboard // with data types appropriate for dropData. -- (id)initWithContents:(TabContents*)contents +- (id)initWithContents:(WebContentsImpl*)contents view:(NSView*)contentsView dropData:(const WebDropData*)dropData image:(NSImage*)image diff --git a/content/public/browser/devtools_manager.h b/content/public/browser/devtools_manager.h index da3ec21..f6029ce 100644 --- a/content/public/browser/devtools_manager.h +++ b/content/public/browser/devtools_manager.h @@ -11,8 +11,6 @@ #include "content/common/content_export.h" #include "content/public/common/console_message_level.h" -class TabContents; - namespace IPC { class Message; } diff --git a/content/public/browser/download_manager.h b/content/public/browser/download_manager.h index 05c4938..d67a385 100644 --- a/content/public/browser/download_manager.h +++ b/content/public/browser/download_manager.h @@ -46,7 +46,6 @@ class DownloadRequestHandle; class GURL; -class TabContents; struct DownloadCreateInfo; struct DownloadRetrieveInfo; diff --git a/content/public/browser/render_view_host_delegate.h b/content/public/browser/render_view_host_delegate.h index bbb5cea..dd36549 100644 --- a/content/public/browser/render_view_host_delegate.h +++ b/content/public/browser/render_view_host_delegate.h @@ -24,7 +24,7 @@ class GURL; class SkBitmap; -class TabContents; +class WebContentsImpl; class WebKeyboardEvent; struct NativeWebKeyboardEvent; struct ViewHostMsg_CreateWindow_Params; diff --git a/content/public/browser/web_contents.h b/content/public/browser/web_contents.h index 80e4929..bf401c8c 100644 --- a/content/public/browser/web_contents.h +++ b/content/public/browser/web_contents.h @@ -61,7 +61,7 @@ class WebContents : public PageNavigator { BrowserContext* browser_context, SiteInstance* site_instance, int routing_id, - const WebContents* base_tab_contents, + const WebContents* base_web_contents, SessionStorageNamespace* session_storage_namespace); virtual ~WebContents() {} diff --git a/content/public/browser/web_contents_delegate.h b/content/public/browser/web_contents_delegate.h index 49e833d..3972c2d 100644 --- a/content/public/browser/web_contents_delegate.h +++ b/content/public/browser/web_contents_delegate.h @@ -21,7 +21,7 @@ class FilePath; class GURL; -class TabContents; +class WebContentsImpl; struct NativeWebKeyboardEvent; namespace base { @@ -398,7 +398,7 @@ class CONTENT_EXPORT WebContentsDelegate { virtual ~WebContentsDelegate(); private: - friend class ::TabContents; + friend class ::WebContentsImpl; // Called when |this| becomes the WebContentsDelegate for |source|. void Attach(WebContents* source); diff --git a/content/public/browser/web_contents_observer.cc b/content/public/browser/web_contents_observer.cc index bd39807..5ccab33 100644 --- a/content/public/browser/web_contents_observer.cc +++ b/content/public/browser/web_contents_observer.cc @@ -11,29 +11,29 @@ namespace content { WebContentsObserver::WebContentsObserver(WebContents* web_contents) - : tab_contents_(NULL) { + : web_contents_(NULL) { Observe(web_contents); } WebContentsObserver::WebContentsObserver() - : tab_contents_(NULL) { + : web_contents_(NULL) { } WebContentsObserver::~WebContentsObserver() { - if (tab_contents_) - tab_contents_->RemoveObserver(this); + if (web_contents_) + web_contents_->RemoveObserver(this); } WebContents* WebContentsObserver::web_contents() const { - return tab_contents_; + return web_contents_; } void WebContentsObserver::Observe(WebContents* web_contents) { - if (tab_contents_) - tab_contents_->RemoveObserver(this); - tab_contents_ = static_cast<TabContents*>(web_contents); - if (tab_contents_) { - tab_contents_->AddObserver(this); + if (web_contents_) + web_contents_->RemoveObserver(this); + web_contents_ = static_cast<WebContentsImpl*>(web_contents); + if (web_contents_) { + web_contents_->AddObserver(this); } } @@ -42,28 +42,28 @@ bool WebContentsObserver::OnMessageReceived(const IPC::Message& message) { } bool WebContentsObserver::Send(IPC::Message* message) { - if (!tab_contents_ || !tab_contents_->GetRenderViewHost()) { + if (!web_contents_ || !web_contents_->GetRenderViewHost()) { delete message; return false; } return static_cast<RenderViewHostImpl*>( - tab_contents_->GetRenderViewHost())->Send(message); + web_contents_->GetRenderViewHost())->Send(message); } int WebContentsObserver::routing_id() const { - if (!tab_contents_ || !tab_contents_->GetRenderViewHost()) + if (!web_contents_ || !web_contents_->GetRenderViewHost()) return MSG_ROUTING_NONE; - return tab_contents_->GetRenderViewHost()->GetRoutingID(); + return web_contents_->GetRenderViewHost()->GetRoutingID(); } void WebContentsObserver::TabContentsDestroyed() { // Do cleanup so that 'this' can safely be deleted from WebContentsDestroyed. - tab_contents_->RemoveObserver(this); - TabContents* tab = tab_contents_; - tab_contents_ = NULL; - WebContentsDestroyed(tab); + web_contents_->RemoveObserver(this); + WebContentsImpl* contents = web_contents_; + web_contents_ = NULL; + WebContentsDestroyed(contents); } } // namespace content diff --git a/content/public/browser/web_contents_observer.h b/content/public/browser/web_contents_observer.h index fe6dffa..f67b2a5 100644 --- a/content/public/browser/web_contents_observer.h +++ b/content/public/browser/web_contents_observer.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -12,7 +12,7 @@ #include "ipc/ipc_channel.h" #include "webkit/glue/window_open_disposition.h" -class TabContents; +class WebContentsImpl; namespace content { @@ -23,7 +23,7 @@ struct LoadCommittedDetails; struct Referrer; // An observer API implemented by classes which are interested in various page -// load events from TabContents. They also get a chance to filter IPC messages. +// load events from WebContents. They also get a chance to filter IPC messages. class CONTENT_EXPORT WebContentsObserver : public IPC::Channel::Listener, public IPC::Message::Sender { public: @@ -110,7 +110,7 @@ class CONTENT_EXPORT WebContentsObserver : public IPC::Channel::Listener, // its entire lifetime. explicit WebContentsObserver(WebContents* web_contents); - // Use this constructor when the object wants to observe a TabContents for + // Use this constructor when the object wants to observe a WebContents for // part of its lifetime. It can then call Observe() to start and stop // observing. WebContentsObserver(); @@ -123,13 +123,13 @@ class CONTENT_EXPORT WebContentsObserver : public IPC::Channel::Listener, WebContents* web_contents() const; private: - friend class ::TabContents; + friend class ::WebContentsImpl; - // Invoked from TabContents. Invokes TabContentsDestroyed and NULL out + // Invoked from WebContentsImpl. Invokes TabContentsDestroyed and NULL out // |tab_contents_|. void TabContentsDestroyed(); - TabContents* tab_contents_; + WebContentsImpl* web_contents_; DISALLOW_COPY_AND_ASSIGN(WebContentsObserver); }; diff --git a/content/public/browser/web_contents_view.h b/content/public/browser/web_contents_view.h index f89148c..d971b2e 100644 --- a/content/public/browser/web_contents_view.h +++ b/content/public/browser/web_contents_view.h @@ -15,8 +15,6 @@ #include "ui/gfx/rect.h" #include "ui/gfx/size.h" -class TabContents; - namespace content { class RenderViewHost; @@ -24,7 +22,7 @@ class RenderWidgetHost; class RenderWidgetHostView; // The WebContentsView is an interface that is implemented by the platform- -// dependent web contents views. The TabContents uses this interface to talk to +// dependent web contents views. The WebContents uses this interface to talk to // them. View-related messages will also get forwarded directly to this class // from RenderViewHost via RenderViewHostDelegate::View. class CONTENT_EXPORT WebContentsView @@ -37,7 +35,7 @@ class CONTENT_EXPORT WebContentsView // Sets up the View that holds the rendered web page, receives messages for // it and contains page plugins. The host view should be sized to the current - // size of the TabContents. + // size of the WebContents. virtual RenderWidgetHostView* CreateViewForWidget( RenderWidgetHost* render_widget_host) = 0; @@ -82,10 +80,10 @@ class CONTENT_EXPORT WebContentsView // // (1) will be fixed once interstitials are cleaned up. (2) seems like it // should be cleaned up or done some other way, since this works for normal - // TabContents without the special code. + // WebContents without the special code. virtual void SizeContents(const gfx::Size& size) = 0; - // Invoked when the TabContents is notified that the RenderView has been + // Invoked when the WebContents is notified that the RenderView has been // fully created. virtual void RenderViewCreated(RenderViewHost* host) = 0; @@ -111,7 +109,7 @@ class CONTENT_EXPORT WebContentsView // If we close the tab while a UI control is in an event-tracking // loop, the control may message freed objects and crash. - // TabContents::Close() calls IsEventTracking(), and if it returns + // WebContents::Close() calls IsEventTracking(), and if it returns // true CloseTabAfterEventTracking() is called and the close is not // completed. virtual bool IsEventTracking() const = 0; |