diff options
author | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-28 23:51:33 +0000 |
---|---|---|
committer | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-28 23:51:33 +0000 |
commit | 2a6bc3e61c13a82f1a61c552d5a940c14b0a9db1 (patch) | |
tree | 51e2f19bdc45bd87c9a378ee4d7d113431f6b9f5 /content/public | |
parent | 50dbc0376d825c59d08d3c0a4f3ea34fad30e960 (diff) | |
download | chromium_src-2a6bc3e61c13a82f1a61c552d5a940c14b0a9db1.zip chromium_src-2a6bc3e61c13a82f1a61c552d5a940c14b0a9db1.tar.gz chromium_src-2a6bc3e61c13a82f1a61c552d5a940c14b0a9db1.tar.bz2 |
Convert all of the WebContentsDelegate to use WebContents instead of TabContents, and update all the dependent code.
BUG=98716
TBR=joi
Review URL: http://codereview.chromium.org/9008047
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@115932 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/public')
-rw-r--r-- | content/public/browser/web_contents.h | 2 | ||||
-rw-r--r-- | content/public/browser/web_contents_delegate.cc | 34 | ||||
-rw-r--r-- | content/public/browser/web_contents_delegate.h | 110 |
3 files changed, 73 insertions, 73 deletions
diff --git a/content/public/browser/web_contents.h b/content/public/browser/web_contents.h index 0c6df16..1e80d76 100644 --- a/content/public/browser/web_contents.h +++ b/content/public/browser/web_contents.h @@ -221,7 +221,7 @@ class WebContents : public PageNavigator { // Window management --------------------------------------------------------- // Adds a new tab or window with the given already-created contents. - virtual void AddNewContents(TabContents* new_contents, + virtual void AddNewContents(WebContents* new_contents, WindowOpenDisposition disposition, const gfx::Rect& initial_pos, bool user_gesture) = 0; diff --git a/content/public/browser/web_contents_delegate.cc b/content/public/browser/web_contents_delegate.cc index 766af90..371242b 100644 --- a/content/public/browser/web_contents_delegate.cc +++ b/content/public/browser/web_contents_delegate.cc @@ -8,9 +8,9 @@ #include "base/logging.h" #include "base/memory/singleton.h" #include "content/browser/javascript_dialogs.h" -#include "content/browser/tab_contents/tab_contents.h" #include "content/public/browser/notification_service.h" #include "content/public/browser/notification_types.h" +#include "content/public/browser/web_contents.h" #include "content/public/browser/web_intents_dispatcher.h" #include "content/public/common/url_constants.h" #include "ui/gfx/rect.h" @@ -26,13 +26,13 @@ WebContents* WebContentsDelegate::OpenURLFromTab(WebContents* source, return NULL; } -bool WebContentsDelegate::IsPopupOrPanel(const TabContents* source) const { +bool WebContentsDelegate::IsPopupOrPanel(const WebContents* source) const { return false; } bool WebContentsDelegate::IsApplication() const { return false; } -bool WebContentsDelegate::CanReloadContents(TabContents* source) const { +bool WebContentsDelegate::CanReloadContents(WebContents* source) const { return true; } @@ -40,7 +40,7 @@ bool WebContentsDelegate::ShouldSuppressDialogs() { return false; } -void WebContentsDelegate::BeforeUnloadFired(TabContents* tab, +void WebContentsDelegate::BeforeUnloadFired(WebContents* tab, bool proceed, bool* proceed_to_fire_unload) { *proceed_to_fire_unload = true; @@ -58,7 +58,7 @@ int WebContentsDelegate::GetExtraRenderViewHeight() const { return 0; } -bool WebContentsDelegate::CanDownload(TabContents* source, int request_id) { +bool WebContentsDelegate::CanDownload(WebContents* source, int request_id) { return true; } @@ -70,7 +70,7 @@ bool WebContentsDelegate::ExecuteContextMenuCommand(int command) { return false; } -void WebContentsDelegate::ViewSourceForTab(TabContents* source, +void WebContentsDelegate::ViewSourceForTab(WebContents* source, const GURL& page_url) { // Fall back implementation based entirely on the view-source scheme. // It suffers from http://crbug.com/523 and that is why browser overrides @@ -82,7 +82,7 @@ void WebContentsDelegate::ViewSourceForTab(TabContents* source, PAGE_TRANSITION_LINK, false)); } -void WebContentsDelegate::ViewSourceForFrame(TabContents* source, +void WebContentsDelegate::ViewSourceForFrame(WebContents* source, const GURL& frame_url, const std::string& content_state) { // Same as ViewSourceForTab, but for given subframe. @@ -150,12 +150,12 @@ JavaScriptDialogCreator* WebContentsDelegate::GetJavaScriptDialogCreator() { return JavaScriptDialogCreatorStub::GetInstance(); } -bool WebContentsDelegate::IsFullscreenForTab(const TabContents* tab) const { +bool WebContentsDelegate::IsFullscreenForTab(const WebContents* tab) const { return false; } void WebContentsDelegate::WebIntentDispatch( - TabContents* tab, + WebContents* tab, WebIntentsDispatcher* intents_dispatcher) { // The caller passes this method ownership of the |intents_dispatcher|, but // this empty implementation will not use it, so we delete it immediately. @@ -164,8 +164,8 @@ void WebContentsDelegate::WebIntentDispatch( WebContentsDelegate::~WebContentsDelegate() { while (!attached_contents_.empty()) { - TabContents* tab_contents = *attached_contents_.begin(); - tab_contents->SetDelegate(NULL); + WebContents* web_contents = *attached_contents_.begin(); + web_contents->SetDelegate(NULL); } DCHECK(attached_contents_.empty()); NotificationService::current()->Notify( @@ -174,14 +174,14 @@ WebContentsDelegate::~WebContentsDelegate() { NotificationService::NoDetails()); } -void WebContentsDelegate::Attach(TabContents* tab_contents) { - DCHECK(attached_contents_.find(tab_contents) == attached_contents_.end()); - attached_contents_.insert(tab_contents); +void WebContentsDelegate::Attach(WebContents* web_contents) { + DCHECK(attached_contents_.find(web_contents) == attached_contents_.end()); + attached_contents_.insert(web_contents); } -void WebContentsDelegate::Detach(TabContents* tab_contents) { - DCHECK(attached_contents_.find(tab_contents) != attached_contents_.end()); - attached_contents_.erase(tab_contents); +void WebContentsDelegate::Detach(WebContents* web_contents) { + DCHECK(attached_contents_.find(web_contents) != attached_contents_.end()); + attached_contents_.erase(web_contents); } } // namespace content diff --git a/content/public/browser/web_contents_delegate.h b/content/public/browser/web_contents_delegate.h index e2fef31..1426c65 100644 --- a/content/public/browser/web_contents_delegate.h +++ b/content/public/browser/web_contents_delegate.h @@ -56,7 +56,7 @@ namespace content { struct OpenURLParams; // Objects implement this interface to get notified about changes in the -// TabContents and to provide necessary functionality. +// WebContents and to provide necessary functionality. class CONTENT_EXPORT WebContentsDelegate { public: WebContentsDelegate(); @@ -76,35 +76,35 @@ class CONTENT_EXPORT WebContentsDelegate { // Called to inform the delegate that the tab content's navigation state // changed. The |changed_flags| indicates the parts of the navigation state // that have been updated, and is any combination of the - // |TabContents::InvalidateTypes| bits. - virtual void NavigationStateChanged(const TabContents* source, + // |WebContents::InvalidateTypes| bits. + virtual void NavigationStateChanged(const WebContents* source, unsigned changed_flags) {} // Adds the navigation request headers to |headers|. Use // net::HttpUtil::AppendHeaderIfMissing to build the set of headers. virtual void AddNavigationHeaders(const GURL& url, std::string* headers) {} - // Creates a new tab with the already-created TabContents 'new_contents'. + // Creates a new tab with the already-created WebContents 'new_contents'. // The window for the added contents should be reparented correctly when this // method returns. If |disposition| is NEW_POPUP, |pos| should hold the // initial position. - virtual void AddNewContents(TabContents* source, - TabContents* new_contents, + virtual void AddNewContents(WebContents* source, + WebContents* new_contents, WindowOpenDisposition disposition, const gfx::Rect& initial_pos, bool user_gesture) {} // Selects the specified contents, bringing its container to the front. - virtual void ActivateContents(TabContents* contents) {} + virtual void ActivateContents(WebContents* contents) {} // Deactivates the specified contents by deactivating its container and // potentialy moving it to the back of the Z order. - virtual void DeactivateContents(TabContents* contents) {} + virtual void DeactivateContents(WebContents* contents) {} // Notifies the delegate that this contents is starting or is done loading // some resource. The delegate should use this notification to represent - // loading feedback. See TabContents::IsLoading() - virtual void LoadingStateChanged(TabContents* source) {} + // loading feedback. See WebContents::IsLoading() + virtual void LoadingStateChanged(WebContents* source) {} // Notifies the delegate that the page has made some progress loading. // |progress| is a value between 0.0 (nothing loaded) to 1.0 (page fully @@ -113,36 +113,36 @@ class CONTENT_EXPORT WebContentsDelegate { // SetReportLoadProgressEnabled(true) in the render view. virtual void LoadProgressChanged(double progress) {} - // Request the delegate to close this tab contents, and do whatever cleanup + // Request the delegate to close this web contents, and do whatever cleanup // it needs to do. virtual void CloseContents(WebContents* source) {} // Informs the delegate that the underlying RenderViewHost has been swapped // out so it can perform any cleanup necessary. - virtual void SwappedOut(TabContents* source) {} + virtual void SwappedOut(WebContents* source) {} // Request the delegate to move this tab contents to the specified position // in screen coordinates. - virtual void MoveContents(TabContents* source, const gfx::Rect& pos) {} + virtual void MoveContents(WebContents* source, const gfx::Rect& pos) {} // Causes the delegate to detach |source| and clean up any internal data // pointing to it. After this call ownership of |source| passes to the // caller, and it is safe to call "source->set_delegate(someone_else);". - virtual void DetachContents(TabContents* source) {} + virtual void DetachContents(WebContents* source) {} - // Called to determine if the TabContents is contained in a popup window + // Called to determine if the WebContents is contained in a popup window // or a panel window. - virtual bool IsPopupOrPanel(const TabContents* source) const; + virtual bool IsPopupOrPanel(const WebContents* source) const; // Notification that the target URL has changed. - virtual void UpdateTargetURL(TabContents* source, + virtual void UpdateTargetURL(WebContents* source, int32 page_id, const GURL& url) {} // Notification that there was a mouse event, along with the absolute // coordinates of the mouse pointer and whether it was a normal motion event // (otherwise, the pointer left the contents area). - virtual void ContentsMouseEvent(TabContents* source, + virtual void ContentsMouseEvent(WebContents* source, const gfx::Point& location, bool motion) {} @@ -154,12 +154,12 @@ class CONTENT_EXPORT WebContentsDelegate { virtual bool IsApplication() const; // Detach the given tab and convert it to a "webapp" view. The tab must be - // a TabContents with a valid WebApp set. - virtual void ConvertContentsToApplication(TabContents* source) {} + // a WebContents with a valid WebApp set. + virtual void ConvertContentsToApplication(WebContents* source) {} // Whether the specified tab can be reloaded. // Reloading can be disabled e. g. for the DevTools window. - virtual bool CanReloadContents(TabContents* source) const; + virtual bool CanReloadContents(WebContents* source) const; // Invoked prior to showing before unload handler confirmation dialog. virtual void WillRunBeforeUnloadConfirm() {} @@ -173,7 +173,7 @@ class CONTENT_EXPORT WebContentsDelegate { // tab. Returns true if the tab can continue on firing it's unload event. // If we're closing the entire browser, then we'll want to delay firing // unload events until all the beforeunload events have fired. - virtual void BeforeUnloadFired(TabContents* tab, + virtual void BeforeUnloadFired(WebContents* tab, bool proceed, bool* proceed_to_fire_unload); @@ -199,14 +199,14 @@ class CONTENT_EXPORT WebContentsDelegate { // Invoked when the page loses mouse capture. virtual void LostCapture() {} - // Notification that |tab_contents| has gained focus. - virtual void TabContentsFocused(TabContents* tab_content) {} + // Notification that |contents| has gained focus. + virtual void WebContentsFocused(WebContents* contents) {} // Asks the delegate if the given tab can download. - virtual bool CanDownload(TabContents* source, int request_id); + virtual bool CanDownload(WebContents* source, int request_id); // Notifies the delegate that a download is starting. - virtual void OnStartDownload(TabContents* source, DownloadItem* download) {} + virtual void OnStartDownload(WebContents* source, DownloadItem* download) {} // Return much extra vertical space should be allotted to the // render view widget during various animations (e.g. infobar closing). @@ -230,10 +230,10 @@ class CONTENT_EXPORT WebContentsDelegate { // Opens source view for given tab contents that is navigated to the given // page url. - virtual void ViewSourceForTab(TabContents* source, const GURL& page_url); + virtual void ViewSourceForTab(WebContents* source, const GURL& page_url); // Opens source view for the given subframe. - virtual void ViewSourceForFrame(TabContents* source, + virtual void ViewSourceForFrame(WebContents* source, const GURL& url, const std::string& content_state); @@ -256,10 +256,10 @@ class CONTENT_EXPORT WebContentsDelegate { virtual void DragEnded() {} // Shows the repost form confirmation dialog box. - virtual void ShowRepostFormWarningDialog(TabContents* tab_contents) {} + virtual void ShowRepostFormWarningDialog(WebContents* source) {} // Allows delegate to override navigation to the history entries. - // Returns true to allow TabContents to continue with the default processing. + // Returns true to allow WebContents to continue with the default processing. virtual bool OnGoToEntryOffset(int offset); // Returns whether this tab contents should add the specified navigation to @@ -271,30 +271,30 @@ class CONTENT_EXPORT WebContentsDelegate { // Returns the native window framing the view containing the tab contents. virtual gfx::NativeWindow GetFrameNativeWindow(); - // Notifies the delegate about the creation of a new TabContents. This + // Notifies the delegate about the creation of a new WebContents. This // typically happens when popups are created. - virtual void TabContentsCreated(TabContents* new_contents) {} + virtual void WebContentsCreated(WebContents* new_contents) {} // Notifies the delegate that the content restrictions for this tab has // changed. - virtual void ContentRestrictionsChanged(TabContents* source) {} + virtual void ContentRestrictionsChanged(WebContents* source) {} // Notification that the tab is hung. - virtual void RendererUnresponsive(TabContents* source) {} + virtual void RendererUnresponsive(WebContents* source) {} // Notification that the tab is no longer hung. - virtual void RendererResponsive(TabContents* source) {} + virtual void RendererResponsive(WebContents* source) {} // Notification that a worker associated with this tab has crashed. - virtual void WorkerCrashed(TabContents* source) {} + virtual void WorkerCrashed(WebContents* source) {} // Invoked when a main fram navigation occurs. - virtual void DidNavigateMainFramePostCommit(TabContents* tab) {} + virtual void DidNavigateMainFramePostCommit(WebContents* tab) {} // Invoked when navigating to a pending entry. When invoked the // NavigationController has configured its pending entry, but it has not yet // been committed. - virtual void DidNavigateToPendingEntry(TabContents* tab) {} + virtual void DidNavigateToPendingEntry(WebContents* tab) {} // Returns a pointer to a service to create JavaScript dialogs. The default // pointer returned is to a stub service that marks all dialogs as suppressed @@ -302,32 +302,32 @@ class CONTENT_EXPORT WebContentsDelegate { virtual JavaScriptDialogCreator* GetJavaScriptDialogCreator(); // Called when a file selection is to be done. - virtual void RunFileChooser(TabContents* tab, + virtual void RunFileChooser(WebContents* tab, const FileChooserParams& params) {} // Request to enumerate a directory. This is equivalent to running the file // chooser in directory-enumeration mode and having the user select the given // directory. - virtual void EnumerateDirectory(TabContents* tab, + virtual void EnumerateDirectory(WebContents* tab, int request_id, const FilePath& path) {} // Called when the renderer puts a tab into or out of fullscreen mode. - virtual void ToggleFullscreenModeForTab(TabContents* tab, + virtual void ToggleFullscreenModeForTab(WebContents* tab, bool enter_fullscreen) {} - virtual bool IsFullscreenForTab(const TabContents* tab) const; + virtual bool IsFullscreenForTab(const WebContents* tab) const; // Called when a Javascript out of memory notification is received. - virtual void JSOutOfMemory(TabContents* tab) {} + virtual void JSOutOfMemory(WebContents* tab) {} // Register a new handler for URL requests with the given scheme. - virtual void RegisterProtocolHandler(TabContents* tab, + virtual void RegisterProtocolHandler(WebContents* tab, const std::string& protocol, const GURL& url, const string16& title) {} // Register a new handler for Intents with the given action and type filter. - virtual void RegisterIntentHandler(TabContents* tab, + virtual void RegisterIntentHandler(WebContents* tab, const string16& action, const string16& type, const string16& href, @@ -336,13 +336,13 @@ class CONTENT_EXPORT WebContentsDelegate { // Web Intents notification handler. Takes ownership of the // |intents_dispatcher|. - virtual void WebIntentDispatch(TabContents* tab, + virtual void WebIntentDispatch(WebContents* tab, WebIntentsDispatcher* intents_dispatcher); // Result of string search in the page. This includes the number of matches // found and the selection rect (in screen coordinates) for the string found. // If |final_update| is false, it indicates that more results follow. - virtual void FindReply(TabContents* tab, + virtual void FindReply(WebContents* tab, int request_id, int number_of_matches, const gfx::Rect& selection_rect, @@ -350,14 +350,14 @@ class CONTENT_EXPORT WebContentsDelegate { bool final_update) {} // Notification that a plugin has crashed. - virtual void CrashedPlugin(TabContents* tab, const FilePath& plugin_path) {} + virtual void CrashedPlugin(WebContents* tab, const FilePath& plugin_path) {} // Invoked when the preferred size of the contents has been changed. - virtual void UpdatePreferredSize(TabContents* tab, + virtual void UpdatePreferredSize(WebContents* tab, const gfx::Size& pref_size) {} // Notification message from HTML UI. - virtual void WebUISend(TabContents* tab, + virtual void WebUISend(WebContents* tab, const GURL& source_url, const std::string& name, const base::ListValue& args) {} @@ -365,7 +365,7 @@ class CONTENT_EXPORT WebContentsDelegate { // Requests to lock the mouse. Once the request is approved or rejected, // GotResponseToLockMouseRequest() will be called on the requesting tab // contents. - virtual void RequestToLockMouse(TabContents* tab) {} + virtual void RequestToLockMouse(WebContents* tab) {} // Notification that the page has lost the mouse lock. virtual void LostMouseLock() {} @@ -377,13 +377,13 @@ class CONTENT_EXPORT WebContentsDelegate { friend class ::TabContents; // Called when |this| becomes the WebContentsDelegate for |source|. - void Attach(TabContents* source); + void Attach(WebContents* source); // Called when |this| is no longer the WebContentsDelegate for |source|. - void Detach(TabContents* source); + void Detach(WebContents* source); - // The TabContents that this is currently a delegate for. - std::set<TabContents*> attached_contents_; + // The WebContents that this is currently a delegate for. + std::set<WebContents*> attached_contents_; }; } // namespace content |