summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbeaudoin@chromium.org <beaudoin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-07-21 14:43:51 +0000
committerbeaudoin@chromium.org <beaudoin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-07-21 14:43:51 +0000
commitf5d978cfcc87e29ac3284d9c518770d24c529699 (patch)
treef10f4a851d5a86499792ba525522456ce2da1b42
parent4f27ff905f70604752d3365d813405a5122282de (diff)
downloadchromium_src-f5d978cfcc87e29ac3284d9c518770d24c529699.zip
chromium_src-f5d978cfcc87e29ac3284d9c518770d24c529699.tar.gz
chromium_src-f5d978cfcc87e29ac3284d9c518770d24c529699.tar.bz2
Ensures history tab displays a throbber when searching.
When performing a long running search in the history, turn on the tab thobber to indicate that an operation is in progress. BUG=14730 TEST=Ensure you have a large browsing history, go to chrome://history, search for something, notice the throbber come on. Review URL: http://codereview.chromium.org/7399007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@93392 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/aeropeek_manager.cc2
-rw-r--r--chrome/browser/automation/automation_provider_observers.cc4
-rw-r--r--chrome/browser/automation/testing_automation_provider.cc2
-rw-r--r--chrome/browser/browser_browsertest.cc4
-rw-r--r--chrome/browser/debugger/devtools_sanity_unittest.cc2
-rw-r--r--chrome/browser/extensions/extension_browser_event_router.cc2
-rw-r--r--chrome/browser/extensions/extension_tabs_module.cc5
-rw-r--r--chrome/browser/resources/history.js2
-rw-r--r--chrome/browser/tab_contents/thumbnail_generator.cc2
-rw-r--r--chrome/browser/tabs/tab_strip_model.cc2
-rw-r--r--chrome/browser/ui/browser.cc10
-rw-r--r--chrome/browser/ui/cocoa/applescript/tab_applescript.mm2
-rw-r--r--chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm2
-rw-r--r--chrome/browser/ui/gtk/browser_titlebar.cc2
-rw-r--r--chrome/browser/ui/gtk/tabs/tab_renderer_gtk.cc2
-rw-r--r--chrome/browser/ui/gtk/tabs/tab_strip_gtk.cc2
-rw-r--r--chrome/browser/ui/panels/panel_browser_frame_view.cc2
-rw-r--r--chrome/browser/ui/tab_contents/tab_contents_wrapper.cc2
-rw-r--r--chrome/browser/ui/views/compact_nav/compact_location_bar_view_host.cc6
-rw-r--r--chrome/browser/ui/views/frame/app_panel_browser_frame_view.cc2
-rw-r--r--chrome/browser/ui/views/frame/browser_view.cc2
-rw-r--r--chrome/browser/ui/views/frame/opaque_browser_frame_view.cc2
-rw-r--r--chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc4
-rw-r--r--chrome/browser/ui/webui/history_ui.cc1
-rw-r--r--chrome/test/ui_test_utils.cc2
-rw-r--r--content/browser/tab_contents/interstitial_page.cc2
-rw-r--r--content/browser/tab_contents/tab_contents.cc6
-rw-r--r--content/browser/tab_contents/tab_contents.h5
-rw-r--r--content/browser/tab_contents/tab_contents_delegate.h2
-rw-r--r--content/browser/tab_contents/tab_contents_observer.h2
-rw-r--r--content/browser/webui/generic_handler.cc29
-rw-r--r--content/browser/webui/generic_handler.h11
-rw-r--r--content/browser/webui/web_ui.cc13
-rw-r--r--content/browser/webui/web_ui.h8
34 files changed, 107 insertions, 41 deletions
diff --git a/chrome/browser/aeropeek_manager.cc b/chrome/browser/aeropeek_manager.cc
index d0fc5e1..a704712 100644
--- a/chrome/browser/aeropeek_manager.cc
+++ b/chrome/browser/aeropeek_manager.cc
@@ -1170,7 +1170,7 @@ void AeroPeekManager::TabChangedAt(TabContentsWrapper* contents,
// information needed for handling update requests from Windows.)
window->SetTitle(contents->tab_contents()->GetTitle());
window->SetFavicon(contents->favicon_tab_helper()->GetFavicon());
- window->Update(contents->tab_contents()->is_loading());
+ window->Update(contents->tab_contents()->IsLoading());
}
///////////////////////////////////////////////////////////////////////////////
diff --git a/chrome/browser/automation/automation_provider_observers.cc b/chrome/browser/automation/automation_provider_observers.cc
index 8af0a99..daf411c 100644
--- a/chrome/browser/automation/automation_provider_observers.cc
+++ b/chrome/browser/automation/automation_provider_observers.cc
@@ -212,7 +212,7 @@ void NavigationControllerRestoredObserver::Observe(
bool NavigationControllerRestoredObserver::FinishedRestoring() {
return (!controller_->needs_reload() && !controller_->pending_entry() &&
- !controller_->tab_contents()->is_loading());
+ !controller_->tab_contents()->IsLoading());
}
void NavigationControllerRestoredObserver::SendDone() {
@@ -246,7 +246,7 @@ NavigationNotificationObserver::NavigationNotificationObserver(
registrar_.Add(this, chrome::NOTIFICATION_AUTH_SUPPLIED, source);
registrar_.Add(this, chrome::NOTIFICATION_AUTH_CANCELLED, source);
- if (include_current_navigation && controller->tab_contents()->is_loading())
+ if (include_current_navigation && controller->tab_contents()->IsLoading())
navigation_started_ = true;
}
diff --git a/chrome/browser/automation/testing_automation_provider.cc b/chrome/browser/automation/testing_automation_provider.cc
index 8c956cf..80763cf 100644
--- a/chrome/browser/automation/testing_automation_provider.cc
+++ b/chrome/browser/automation/testing_automation_provider.cc
@@ -3318,7 +3318,7 @@ void TestingAutomationProvider::GetInstantInfo(Browser* browser,
if (instant->GetPreviewContents() &&
instant->GetPreviewContents()->tab_contents()) {
TabContents* contents = instant->GetPreviewContents()->tab_contents();
- info->SetBoolean("loading", contents->is_loading());
+ info->SetBoolean("loading", contents->IsLoading());
info->SetString("location", contents->GetURL().spec());
info->SetString("title", contents->GetTitle());
}
diff --git a/chrome/browser/browser_browsertest.cc b/chrome/browser/browser_browsertest.cc
index 0580737..9c191c2b 100644
--- a/chrome/browser/browser_browsertest.cc
+++ b/chrome/browser/browser_browsertest.cc
@@ -271,7 +271,7 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, ReloadThenCancelBeforeUnload) {
browser()->Reload(CURRENT_TAB);
AppModalDialog* alert = ui_test_utils::WaitForAppModalDialog();
alert->CloseModalDialog();
- EXPECT_FALSE(browser()->GetSelectedTabContents()->is_loading());
+ EXPECT_FALSE(browser()->GetSelectedTabContents()->IsLoading());
// Clear the beforeunload handler so the test can easily exit.
browser()->GetSelectedTabContents()->render_view_host()->
@@ -294,7 +294,7 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, CancelBeforeUnloadResetsURL) {
// Cancel the dialog.
AppModalDialog* alert = ui_test_utils::WaitForAppModalDialog();
alert->CloseModalDialog();
- EXPECT_FALSE(browser()->GetSelectedTabContents()->is_loading());
+ EXPECT_FALSE(browser()->GetSelectedTabContents()->IsLoading());
// Wait for the ShouldClose_ACK to arrive. We can detect it by waiting for
// the pending RVH to be destroyed.
diff --git a/chrome/browser/debugger/devtools_sanity_unittest.cc b/chrome/browser/debugger/devtools_sanity_unittest.cc
index 4decdc2..a63e75e 100644
--- a/chrome/browser/debugger/devtools_sanity_unittest.cc
+++ b/chrome/browser/debugger/devtools_sanity_unittest.cc
@@ -340,7 +340,7 @@ class WorkerDevToolsSanityTest : public InProcessBrowserTest {
RenderViewHost* client_rvh = window_->GetRenderViewHost();
TabContents* client_contents = client_rvh->delegate()->GetAsTabContents();
- if (client_contents->is_loading()) {
+ if (client_contents->IsLoading()) {
LoadStopObserver(
Source<NavigationController>(&client_contents->controller()));
}
diff --git a/chrome/browser/extensions/extension_browser_event_router.cc b/chrome/browser/extensions/extension_browser_event_router.cc
index 9b723d3..fb9f6ba 100644
--- a/chrome/browser/extensions/extension_browser_event_router.cc
+++ b/chrome/browser/extensions/extension_browser_event_router.cc
@@ -35,7 +35,7 @@ DictionaryValue* ExtensionBrowserEventRouter::TabEntry::UpdateLoadState(
// The tab may go in & out of loading (for instance if iframes navigate).
// We only want to respond to the first change from loading to !loading after
// the NAV_ENTRY_COMMITTED was fired.
- if (!complete_waiting_on_load_ || contents->is_loading())
+ if (!complete_waiting_on_load_ || contents->IsLoading())
return NULL;
// Send "complete" state change.
diff --git a/chrome/browser/extensions/extension_tabs_module.cc b/chrome/browser/extensions/extension_tabs_module.cc
index e1f0361..c546adf 100644
--- a/chrome/browser/extensions/extension_tabs_module.cc
+++ b/chrome/browser/extensions/extension_tabs_module.cc
@@ -187,12 +187,13 @@ DictionaryValue* ExtensionTabUtil::CreateTabValue(const TabContents* contents,
TabStripModel* tab_strip,
int tab_index) {
DictionaryValue* result = new DictionaryValue();
+ bool is_loading = contents->IsLoading();
result->SetInteger(keys::kIdKey, ExtensionTabUtil::GetTabId(contents));
result->SetInteger(keys::kIndexKey, tab_index);
result->SetInteger(keys::kWindowIdKey,
ExtensionTabUtil::GetWindowIdOfTab(contents));
result->SetString(keys::kUrlKey, contents->GetURL().spec());
- result->SetString(keys::kStatusKey, GetTabStatusText(contents->is_loading()));
+ result->SetString(keys::kStatusKey, GetTabStatusText(is_loading));
result->SetBoolean(keys::kSelectedKey,
tab_strip && tab_index == tab_strip->active_index());
result->SetBoolean(keys::kPinnedKey,
@@ -201,7 +202,7 @@ DictionaryValue* ExtensionTabUtil::CreateTabValue(const TabContents* contents,
result->SetBoolean(keys::kIncognitoKey,
contents->profile()->IsOffTheRecord());
- if (!contents->is_loading()) {
+ if (!is_loading) {
NavigationEntry* entry = contents->controller().GetActiveEntry();
if (entry) {
if (entry->favicon().is_valid())
diff --git a/chrome/browser/resources/history.js b/chrome/browser/resources/history.js
index b7964c3..044fd4e 100644
--- a/chrome/browser/resources/history.js
+++ b/chrome/browser/resources/history.js
@@ -386,6 +386,7 @@ HistoryModel.prototype.updateSearch_ = function(finished) {
this.complete_ = true;
this.view_.onModelReady();
this.changed = false;
+ chrome.send('setIsLoading', ['false']);
} else {
// If we can't fill the requested page, ask for more data unless a request
// is still in-flight.
@@ -423,6 +424,7 @@ HistoryModel.prototype.getSearchResults_ = function(depth) {
}
this.inFlight_ = true;
+ chrome.send('setIsLoading', ['true']);
};
/**
diff --git a/chrome/browser/tab_contents/thumbnail_generator.cc b/chrome/browser/tab_contents/thumbnail_generator.cc
index e2ec603..8e26877 100644
--- a/chrome/browser/tab_contents/thumbnail_generator.cc
+++ b/chrome/browser/tab_contents/thumbnail_generator.cc
@@ -461,7 +461,7 @@ void ThumbnailGenerator::UpdateThumbnailIfNecessary(
score.good_clipping =
(clip_result == ThumbnailGenerator::kTallerThanWide ||
clip_result == ThumbnailGenerator::kNotClipped);
- score.load_completed = (!tab_contents->is_loading() && !load_interrupted_);
+ score.load_completed = (!load_interrupted_ && !tab_contents->IsLoading());
top_sites->SetPageThumbnail(url, thumbnail, score);
VLOG(1) << "Thumbnail taken for " << url << ": " << score.ToString();
diff --git a/chrome/browser/tabs/tab_strip_model.cc b/chrome/browser/tabs/tab_strip_model.cc
index 95679c4..b4fc124 100644
--- a/chrome/browser/tabs/tab_strip_model.cc
+++ b/chrome/browser/tabs/tab_strip_model.cc
@@ -383,7 +383,7 @@ bool TabStripModel::CloseTabContentsAt(int index, uint32 close_types) {
bool TabStripModel::TabsAreLoading() const {
TabContentsDataVector::const_iterator iter = contents_data_.begin();
for (; iter != contents_data_.end(); ++iter) {
- if ((*iter)->contents->tab_contents()->is_loading())
+ if ((*iter)->contents->tab_contents()->IsLoading())
return true;
}
return false;
diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc
index e84ce48..f5475ce 100644
--- a/chrome/browser/ui/browser.cc
+++ b/chrome/browser/ui/browser.cc
@@ -2940,7 +2940,7 @@ void Browser::ActiveTabChanged(TabContentsWrapper* old_contents,
UpdateToolbar(true);
// Update reload/stop state.
- UpdateReloadStopState(new_contents->tab_contents()->is_loading(), true);
+ UpdateReloadStopState(new_contents->tab_contents()->IsLoading(), true);
// Update commands to reflect current state.
UpdateCommandsForTabState();
@@ -3150,14 +3150,14 @@ void Browser::LoadingStateChanged(TabContents* source) {
TabContents* selected_contents = GetSelectedTabContents();
if (source == selected_contents) {
- UpdateReloadStopState(source->is_loading(), false);
+ bool is_loading = source->IsLoading();
+ UpdateReloadStopState(is_loading, false);
if (GetStatusBubble()) {
GetStatusBubble()->SetStatus(
GetSelectedTabContentsWrapper()->GetStatusText());
}
- if (!source->is_loading() &&
- pending_web_app_action_ == UPDATE_SHORTCUT) {
+ if (!is_loading && pending_web_app_action_ == UPDATE_SHORTCUT) {
// Schedule a shortcut update when web application info is available if
// last committed entry is not NULL. Last committed entry could be NULL
// when an interstitial page is injected (e.g. bad https certificate,
@@ -4169,7 +4169,7 @@ void Browser::ScheduleUIUpdate(const TabContents* source,
// changed_flags.
}
- if (changed_flags & TabContents::INVALIDATE_TITLE && !source->is_loading()) {
+ if (changed_flags & TabContents::INVALIDATE_TITLE && !source->IsLoading()) {
// To correctly calculate whether the title changed while not loading
// we need to process the update synchronously. This state only matters for
// the TabStripModel, so we notify the TabStripModel now and notify others
diff --git a/chrome/browser/ui/cocoa/applescript/tab_applescript.mm b/chrome/browser/ui/cocoa/applescript/tab_applescript.mm
index 3d10924..2e694ba 100644
--- a/chrome/browser/ui/cocoa/applescript/tab_applescript.mm
+++ b/chrome/browser/ui/cocoa/applescript/tab_applescript.mm
@@ -135,7 +135,7 @@
}
- (NSNumber*)loading {
- BOOL loadingValue = tabContents_->tab_contents()->is_loading() ? YES : NO;
+ BOOL loadingValue = tabContents_->tab_contents()->IsLoading() ? YES : NO;
return [NSNumber numberWithBool:loadingValue];
}
diff --git a/chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm b/chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm
index 27c1e20..3a7da38 100644
--- a/chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm
+++ b/chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm
@@ -1378,7 +1378,7 @@ private:
} else if (contents->tab_contents()->waiting_for_response()) {
newState = kTabWaiting;
throbberImage = throbberWaitingImage;
- } else if (contents->tab_contents()->is_loading()) {
+ } else if (contents->tab_contents()->IsLoading()) {
newState = kTabLoading;
throbberImage = throbberLoadingImage;
}
diff --git a/chrome/browser/ui/gtk/browser_titlebar.cc b/chrome/browser/ui/gtk/browser_titlebar.cc
index 2c210d3..4157650 100644
--- a/chrome/browser/ui/gtk/browser_titlebar.cc
+++ b/chrome/browser/ui/gtk/browser_titlebar.cc
@@ -625,7 +625,7 @@ void BrowserTitlebar::UpdateTitleAndIcon() {
void BrowserTitlebar::UpdateThrobber(TabContents* tab_contents) {
DCHECK(app_mode_favicon_);
- if (tab_contents && tab_contents->is_loading()) {
+ if (tab_contents && tab_contents->IsLoading()) {
GdkPixbuf* icon_pixbuf =
throbber_.GetNextFrame(tab_contents->waiting_for_response());
gtk_image_set_from_pixbuf(GTK_IMAGE(app_mode_favicon_), icon_pixbuf);
diff --git a/chrome/browser/ui/gtk/tabs/tab_renderer_gtk.cc b/chrome/browser/ui/gtk/tabs/tab_renderer_gtk.cc
index bae6b79..30d4dbc 100644
--- a/chrome/browser/ui/gtk/tabs/tab_renderer_gtk.cc
+++ b/chrome/browser/ui/gtk/tabs/tab_renderer_gtk.cc
@@ -320,7 +320,7 @@ void TabRendererGtk::UpdateData(TabContents* contents,
// Loading state also involves whether we show the favicon, since that's where
// we display the throbber.
- data_.loading = contents->is_loading();
+ data_.loading = contents->IsLoading();
data_.show_icon = wrapper->favicon_tab_helper()->ShouldDisplayFavicon();
}
diff --git a/chrome/browser/ui/gtk/tabs/tab_strip_gtk.cc b/chrome/browser/ui/gtk/tabs/tab_strip_gtk.cc
index f01809d..5a57b9a 100644
--- a/chrome/browser/ui/gtk/tabs/tab_strip_gtk.cc
+++ b/chrome/browser/ui/gtk/tabs/tab_strip_gtk.cc
@@ -834,7 +834,7 @@ void TabStripGtk::UpdateLoadingAnimations() {
} else {
TabRendererGtk::AnimationState state;
TabContentsWrapper* contents = model_->GetTabContentsAt(index);
- if (!contents || !contents->tab_contents()->is_loading()) {
+ if (!contents || !contents->tab_contents()->IsLoading()) {
state = TabGtk::ANIMATION_NONE;
} else if (contents->tab_contents()->waiting_for_response()) {
state = TabGtk::ANIMATION_WAITING;
diff --git a/chrome/browser/ui/panels/panel_browser_frame_view.cc b/chrome/browser/ui/panels/panel_browser_frame_view.cc
index af5dc83..cf904ed 100644
--- a/chrome/browser/ui/panels/panel_browser_frame_view.cc
+++ b/chrome/browser/ui/panels/panel_browser_frame_view.cc
@@ -533,7 +533,7 @@ bool PanelBrowserFrameView::ShouldTabIconViewAnimate() const {
// TabIconView we host is initialized, so we need to NULL check the selected
// TabContents because in this condition there is not yet a selected tab.
TabContents* current_tab = browser_view_->GetSelectedTabContents();
- return current_tab ? current_tab->is_loading() : false;
+ return current_tab ? current_tab->IsLoading() : false;
}
SkBitmap PanelBrowserFrameView::GetFaviconForTabIconView() {
diff --git a/chrome/browser/ui/tab_contents/tab_contents_wrapper.cc b/chrome/browser/ui/tab_contents/tab_contents_wrapper.cc
index f02f3c2..0487089 100644
--- a/chrome/browser/ui/tab_contents/tab_contents_wrapper.cc
+++ b/chrome/browser/ui/tab_contents/tab_contents_wrapper.cc
@@ -296,7 +296,7 @@ string16 TabContentsWrapper::GetDefaultTitle() {
}
string16 TabContentsWrapper::GetStatusText() const {
- if (!tab_contents()->is_loading() ||
+ if (!tab_contents()->IsLoading() ||
tab_contents()->load_state() == net::LOAD_STATE_IDLE) {
return string16();
}
diff --git a/chrome/browser/ui/views/compact_nav/compact_location_bar_view_host.cc b/chrome/browser/ui/views/compact_nav/compact_location_bar_view_host.cc
index 8e46fd9..88e8194 100644
--- a/chrome/browser/ui/views/compact_nav/compact_location_bar_view_host.cc
+++ b/chrome/browser/ui/views/compact_nav/compact_location_bar_view_host.cc
@@ -314,7 +314,7 @@ void CompactLocationBarViewHost::ActiveTabChanged(
int index,
bool user_gesture) {
current_tab_model_index_ = index;
- if (new_contents && new_contents->tab_contents()->is_loading()) {
+ if (new_contents && new_contents->tab_contents()->IsLoading()) {
Show(false);
} else {
Hide(false);
@@ -349,7 +349,7 @@ void CompactLocationBarViewHost::TabChangedAt(TabContentsWrapper* contents,
}
Update(tab_contents, false);
if (was_not_visible) {
- if (tab_contents->is_loading()) {
+ if (tab_contents->IsLoading()) {
// Register to NavigationController LOAD_STOP so that we can autohide
// when loading is done.
if (!registrar_.IsRegistered(this, content::NOTIFICATION_LOAD_STOP,
@@ -452,7 +452,7 @@ void CompactLocationBarViewHost::Update(TabContents* contents, bool animate) {
GetCompactLocationBarView()->Update(contents);
Show(animate && !showing_in_same_tab);
// If the tab is loading, we must wait for the notification that it is done.
- if (contents && !contents->is_loading()) {
+ if (contents && !contents->IsLoading()) {
// This will be a NOOP if we have focus.
// We never want to stay up, unless we have focus.
StartAutoHideTimer();
diff --git a/chrome/browser/ui/views/frame/app_panel_browser_frame_view.cc b/chrome/browser/ui/views/frame/app_panel_browser_frame_view.cc
index 1977a94..1450d90 100644
--- a/chrome/browser/ui/views/frame/app_panel_browser_frame_view.cc
+++ b/chrome/browser/ui/views/frame/app_panel_browser_frame_view.cc
@@ -245,7 +245,7 @@ bool AppPanelBrowserFrameView::ShouldTabIconViewAnimate() const {
// TabIconView we host is initialized, so we need to NULL check the selected
// TabContents because in this condition there is not yet a selected tab.
TabContents* current_tab = browser_view_->GetSelectedTabContents();
- return current_tab ? current_tab->is_loading() : false;
+ return current_tab ? current_tab->IsLoading() : false;
}
SkBitmap AppPanelBrowserFrameView::GetFaviconForTabIconView() {
diff --git a/chrome/browser/ui/views/frame/browser_view.cc b/chrome/browser/ui/views/frame/browser_view.cc
index 3ffac6e..77d8134 100644
--- a/chrome/browser/ui/views/frame/browser_view.cc
+++ b/chrome/browser/ui/views/frame/browser_view.cc
@@ -2038,7 +2038,7 @@ void BrowserView::LoadingAnimationCallback() {
// GetSelectedTabContents can return NULL for example under Purify when
// the animations are running slowly and this function is called on a timer
// through LoadingAnimationCallback.
- frame_->UpdateThrobber(tab_contents && tab_contents->is_loading());
+ frame_->UpdateThrobber(tab_contents && tab_contents->IsLoading());
}
}
diff --git a/chrome/browser/ui/views/frame/opaque_browser_frame_view.cc b/chrome/browser/ui/views/frame/opaque_browser_frame_view.cc
index 1920b04..2a70291 100644
--- a/chrome/browser/ui/views/frame/opaque_browser_frame_view.cc
+++ b/chrome/browser/ui/views/frame/opaque_browser_frame_view.cc
@@ -493,7 +493,7 @@ bool OpaqueBrowserFrameView::ShouldTabIconViewAnimate() const {
// TabIconView we host is initialized, so we need to NULL check the selected
// TabContents because in this condition there is not yet a selected tab.
TabContents* current_tab = browser_view_->GetSelectedTabContents();
- return current_tab ? current_tab->is_loading() : false;
+ return current_tab ? current_tab->IsLoading() : false;
}
SkBitmap OpaqueBrowserFrameView::GetFaviconForTabIconView() {
diff --git a/chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc b/chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc
index b6cb10c..d6179f2 100644
--- a/chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc
+++ b/chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc
@@ -30,7 +30,7 @@
static TabRendererData::NetworkState TabContentsNetworkState(
TabContents* contents) {
- if (!contents || !contents->is_loading())
+ if (!contents || !contents->IsLoading())
return TabRendererData::NETWORK_STATE_NONE;
if (contents->waiting_for_response())
return TabRendererData::NETWORK_STATE_WAITING;
@@ -449,7 +449,7 @@ void BrowserTabStripController::SetTabRendererDataFromModel(
data->network_state = TabContentsNetworkState(contents);
data->title = contents->GetTitle();
data->url = contents->GetURL();
- data->loading = contents->is_loading();
+ data->loading = contents->IsLoading();
data->crashed_status = contents->crashed_status();
data->incognito = contents->profile()->IsOffTheRecord();
data->show_icon = wrapper->favicon_tab_helper()->ShouldDisplayFavicon();
diff --git a/chrome/browser/ui/webui/history_ui.cc b/chrome/browser/ui/webui/history_ui.cc
index cefc2a7..e1b25a2 100644
--- a/chrome/browser/ui/webui/history_ui.cc
+++ b/chrome/browser/ui/webui/history_ui.cc
@@ -78,7 +78,6 @@ HistoryUIHTMLSource::HistoryUIHTMLSource()
: ChromeWebUIDataSource(chrome::kChromeUIHistoryHost) {
AddLocalizedString("loading", IDS_HISTORY_LOADING);
AddLocalizedString("title", IDS_HISTORY_TITLE);
- AddLocalizedString("loading", IDS_HISTORY_LOADING);
AddLocalizedString("newest", IDS_HISTORY_NEWEST);
AddLocalizedString("newer", IDS_HISTORY_NEWER);
AddLocalizedString("older", IDS_HISTORY_OLDER);
diff --git a/chrome/test/ui_test_utils.cc b/chrome/test/ui_test_utils.cc
index 4031dfb..b899034 100644
--- a/chrome/test/ui_test_utils.cc
+++ b/chrome/test/ui_test_utils.cc
@@ -356,7 +356,7 @@ void WaitForBrowserActionUpdated(ExtensionAction* browser_action) {
void WaitForLoadStop(TabContents* tab) {
// In many cases, the load may have finished before we get here. Only wait if
// the tab still has a pending navigation.
- if (!tab->is_loading() && !tab->render_manager()->pending_render_view_host())
+ if (!tab->IsLoading() && !tab->render_manager()->pending_render_view_host())
return;
TestNotificationObserver observer;
RegisterAndWait(&observer, content::NOTIFICATION_LOAD_STOP,
diff --git a/content/browser/tab_contents/interstitial_page.cc b/content/browser/tab_contents/interstitial_page.cc
index 97357bb..6a28800 100644
--- a/content/browser/tab_contents/interstitial_page.cc
+++ b/content/browser/tab_contents/interstitial_page.cc
@@ -369,7 +369,7 @@ void InterstitialPage::DidNavigate(
// by the UI tests) expects to consider a navigation as complete. Without
// this, navigating in a UI test to a URL that triggers an interstitial would
// hang.
- tab_was_loading_ = tab_->is_loading();
+ tab_was_loading_ = tab_->IsLoading();
tab_->SetIsLoading(false, NULL);
}
diff --git a/content/browser/tab_contents/tab_contents.cc b/content/browser/tab_contents/tab_contents.cc
index 6034c9c..bbc1e7e 100644
--- a/content/browser/tab_contents/tab_contents.cc
+++ b/content/browser/tab_contents/tab_contents.cc
@@ -389,6 +389,10 @@ bool TabContents::ShouldDisplayURL() {
return true;
}
+bool TabContents::IsLoading() const {
+ return is_loading_ || (web_ui() && web_ui()->IsLoading());
+}
+
void TabContents::AddObserver(TabContentsObserver* observer) {
observers_.AddObserver(observer);
}
@@ -1773,7 +1777,7 @@ void TabContents::LoadStateChanged(const GURL& url,
content::GetContentClient()->browser()->GetAcceptLangs(this));
if (load_state_ == net::LOAD_STATE_READING_RESPONSE)
SetNotWaitingForResponse();
- if (is_loading())
+ if (IsLoading())
NotifyNavigationStateChanged(INVALIDATE_LOAD | INVALIDATE_TAB);
}
diff --git a/content/browser/tab_contents/tab_contents.h b/content/browser/tab_contents/tab_contents.h
index 4671cca..5d60b26 100644
--- a/content/browser/tab_contents/tab_contents.h
+++ b/content/browser/tab_contents/tab_contents.h
@@ -164,8 +164,9 @@ class TabContents : public PageNavigator,
// the user is invited to type into it.
virtual bool ShouldDisplayURL();
- // Return whether this tab contents is loading a resource.
- bool is_loading() const { return is_loading_; }
+ // Return whether this tab contents is loading a resource, or whether its
+ // web_ui is.
+ bool IsLoading() const;
// 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/tab_contents/tab_contents_delegate.h b/content/browser/tab_contents/tab_contents_delegate.h
index cc6eb45..52bc318 100644
--- a/content/browser/tab_contents/tab_contents_delegate.h
+++ b/content/browser/tab_contents/tab_contents_delegate.h
@@ -90,7 +90,7 @@ class TabContentsDelegate {
// 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::is_loading()
+ // loading feedback. See TabContents::IsLoading()
virtual void LoadingStateChanged(TabContents* source);
// Notifies the delegate that the page has made some progress loading.
diff --git a/content/browser/tab_contents/tab_contents_observer.h b/content/browser/tab_contents/tab_contents_observer.h
index 3ddd0e4..1700cf4 100644
--- a/content/browser/tab_contents/tab_contents_observer.h
+++ b/content/browser/tab_contents/tab_contents_observer.h
@@ -67,7 +67,7 @@ class TabContentsObserver : public IPC::Channel::Listener,
// 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::is_loading()
+ // loading feedback. See TabContents::IsLoading()
virtual void LoadingStateChanged(TabContents* contents) { }
// Called to inform the delegate that the tab content's navigation state
// changed. The |changed_flags| indicates the parts of the navigation state
diff --git a/content/browser/webui/generic_handler.cc b/content/browser/webui/generic_handler.cc
index bad0584..bfc0940 100644
--- a/content/browser/webui/generic_handler.cc
+++ b/content/browser/webui/generic_handler.cc
@@ -8,9 +8,11 @@
#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() {
+GenericHandler::GenericHandler()
+ : is_loading_(false) {
}
GenericHandler::~GenericHandler() {
@@ -19,6 +21,12 @@ GenericHandler::~GenericHandler() {
void GenericHandler::RegisterMessages() {
web_ui_->RegisterMessageCallback("navigateToUrl",
NewCallback(this, &GenericHandler::HandleNavigateToUrl));
+ web_ui_->RegisterMessageCallback("setIsLoading",
+ NewCallback(this, &GenericHandler::HandleSetIsLoading));
+}
+
+bool GenericHandler::IsLoading() const {
+ return is_loading_;
}
void GenericHandler::HandleNavigateToUrl(const ListValue* args) {
@@ -52,3 +60,22 @@ 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 c4ed317..4e668a5 100644
--- a/content/browser/webui/generic_handler.h
+++ b/content/browser/webui/generic_handler.h
@@ -20,10 +20,21 @@ class GenericHandler : public WebUIMessageHandler {
// WebUIMessageHandler implementation.
virtual void RegisterMessages();
+ 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 4fed4da..37af425 100644
--- a/content/browser/webui/web_ui.cc
+++ b/content/browser/webui/web_ui.cc
@@ -165,6 +165,15 @@ RenderViewHost* WebUI::GetRenderViewHost() const {
return tab_contents()->render_view_host();
}
+bool WebUI::IsLoading() const {
+ std::vector<WebUIMessageHandler*>::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) {
@@ -190,6 +199,10 @@ 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 66ee230..d0462ac 100644
--- a/content/browser/webui/web_ui.h
+++ b/content/browser/webui/web_ui.h
@@ -149,6 +149,10 @@ class 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,6 +214,10 @@ class 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.