From 755d174bcd4a2e9f3fbc0a4fd6ab6096981d3377 Mon Sep 17 00:00:00 2001 From: "jochen@chromium.org" Date: Mon, 7 Nov 2011 23:33:30 +0000 Subject: Don't trigger the tab's throbber for webui pages BUG=103080 TEST=none Review URL: http://codereview.chromium.org/8467027 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@108937 0039d316-1c4b-4281-b951-d872f2087c98 --- content/browser/tab_contents/tab_contents.cc | 4 ---- content/browser/tab_contents/tab_contents.h | 5 ++--- content/browser/webui/generic_handler.cc | 29 +--------------------------- content/browser/webui/generic_handler.h | 11 ----------- content/browser/webui/web_ui.cc | 13 ------------- content/browser/webui/web_ui.h | 8 -------- 6 files changed, 3 insertions(+), 67 deletions(-) (limited to 'content') diff --git a/content/browser/tab_contents/tab_contents.cc b/content/browser/tab_contents/tab_contents.cc index e920f98..5e76850 100644 --- a/content/browser/tab_contents/tab_contents.cc +++ b/content/browser/tab_contents/tab_contents.cc @@ -403,10 +403,6 @@ SiteInstance* TabContents::GetPendingSiteInstance() const { return dest_rvh->site_instance(); } -bool TabContents::IsLoading() const { - return is_loading_ || (web_ui() && web_ui()->IsLoading()); -} - void TabContents::AddObserver(TabContentsObserver* observer) { observers_.AddObserver(observer); } diff --git a/content/browser/tab_contents/tab_contents.h b/content/browser/tab_contents/tab_contents.h index 9c7d2b4..64eec1e 100644 --- a/content/browser/tab_contents/tab_contents.h +++ b/content/browser/tab_contents/tab_contents.h @@ -162,9 +162,8 @@ class CONTENT_EXPORT TabContents : public PageNavigator, // returns the current SiteInstance. SiteInstance* GetPendingSiteInstance() const; - // Return whether this tab contents is loading a resource, or whether its - // web_ui is. - bool IsLoading() const; + // Return whether this tab contents is loading a resource. + bool IsLoading() const { return is_loading_; } // Returns whether this tab contents is waiting for a first-response for the // main resource of the page. This controls whether the throbber state is diff --git a/content/browser/webui/generic_handler.cc b/content/browser/webui/generic_handler.cc index ab4b121..f8ce3d4 100644 --- a/content/browser/webui/generic_handler.cc +++ b/content/browser/webui/generic_handler.cc @@ -10,11 +10,9 @@ #include "base/values.h" #include "content/browser/disposition_utils.h" #include "content/browser/tab_contents/tab_contents.h" -#include "content/browser/tab_contents/tab_contents_delegate.h" #include "googleurl/src/gurl.h" -GenericHandler::GenericHandler() - : is_loading_(false) { +GenericHandler::GenericHandler() { } GenericHandler::~GenericHandler() { @@ -23,12 +21,6 @@ GenericHandler::~GenericHandler() { void GenericHandler::RegisterMessages() { web_ui_->RegisterMessageCallback("navigateToUrl", base::Bind(&GenericHandler::HandleNavigateToUrl, base::Unretained(this))); - web_ui_->RegisterMessageCallback("setIsLoading", - base::Bind(&GenericHandler::HandleSetIsLoading, base::Unretained(this))); -} - -bool GenericHandler::IsLoading() const { - return is_loading_; } void GenericHandler::HandleNavigateToUrl(const ListValue* args) { @@ -62,22 +54,3 @@ void GenericHandler::HandleNavigateToUrl(const ListValue* args) { // This may delete us! } - -void GenericHandler::HandleSetIsLoading(const base::ListValue* args) { - CHECK(args->GetSize() == 1); - std::string is_loading; - CHECK(args->GetString(0, &is_loading)); - - SetIsLoading(is_loading == "true"); -} - -void GenericHandler::SetIsLoading(bool is_loading) { - DCHECK(web_ui_); - - TabContents* contents = web_ui_->tab_contents(); - bool was_loading = contents->IsLoading(); - - is_loading_ = is_loading; - if (was_loading != contents->IsLoading()) - contents->delegate()->LoadingStateChanged(contents); -} diff --git a/content/browser/webui/generic_handler.h b/content/browser/webui/generic_handler.h index 7aa6a67..1f57e4d 100644 --- a/content/browser/webui/generic_handler.h +++ b/content/browser/webui/generic_handler.h @@ -20,21 +20,10 @@ class GenericHandler : public WebUIMessageHandler { // WebUIMessageHandler implementation. virtual void RegisterMessages() OVERRIDE; - virtual bool IsLoading() const OVERRIDE; private: void HandleNavigateToUrl(const base::ListValue* args); - // Javascript hook to indicate whether or not a long running operation is in - // progress. - void HandleSetIsLoading(const base::ListValue* args); - - // Indicates whether or not this WebUI is performing a long running operation - // and that the throbber should reflect this. - void SetIsLoading(bool is_loading); - - bool is_loading_; - DISALLOW_COPY_AND_ASSIGN(GenericHandler); }; diff --git a/content/browser/webui/web_ui.cc b/content/browser/webui/web_ui.cc index b92c1e4..2096194 100644 --- a/content/browser/webui/web_ui.cc +++ b/content/browser/webui/web_ui.cc @@ -166,15 +166,6 @@ void WebUI::RegisterMessageCallback(const std::string &message, result.first->second = callback; } -bool WebUI::IsLoading() const { - std::vector::const_iterator iter; - for (iter = handlers_.begin(); iter != handlers_.end(); ++iter) { - if ((*iter)->IsLoading()) - return true; - } - return false; -} - // WebUI, protected: ---------------------------------------------------------- void WebUI::AddMessageHandler(WebUIMessageHandler* handler) { @@ -200,10 +191,6 @@ WebUIMessageHandler* WebUIMessageHandler::Attach(WebUI* web_ui) { return this; } -bool WebUIMessageHandler::IsLoading() const { - return false; -} - // WebUIMessageHandler, protected: --------------------------------------------- void WebUIMessageHandler::SetURLAndTitle(DictionaryValue* dictionary, diff --git a/content/browser/webui/web_ui.h b/content/browser/webui/web_ui.h index 0e4a9dd..998513f 100644 --- a/content/browser/webui/web_ui.h +++ b/content/browser/webui/web_ui.h @@ -144,10 +144,6 @@ class CONTENT_EXPORT WebUI : public IPC::Channel::Listener { TabContents* tab_contents() const { return tab_contents_; } - // Returns true to indicate that the WebUI is performing a long running - // operation and wants the tab throbber to run. - virtual bool IsLoading() const; - // An opaque identifier used to identify a WebUI. This can only be compared to // kNoWebUI or other WebUI types. See GetWebUIType. typedef void* TypeID; @@ -210,10 +206,6 @@ class CONTENT_EXPORT WebUIMessageHandler { // is provided. Returns |this| for convenience. virtual WebUIMessageHandler* Attach(WebUI* web_ui); - // Returns true to indicate that a long running operation is in progress and - // the tab throbber should be active. - virtual bool IsLoading() const; - protected: // Adds "url" and "title" keys on incoming dictionary, setting title // as the url as a fallback on empty title. -- cgit v1.1