diff options
author | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-06 05:16:50 +0000 |
---|---|---|
committer | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-06 05:16:50 +0000 |
commit | c9cd22294bf1ef854e41c547d7c9f722b13593f6 (patch) | |
tree | f6fa6d01d068631718ef36f32470a22386bc6cec /chrome | |
parent | 2ac844349bbe511cf17e597bfc3e8a0aaab9ceab (diff) | |
download | chromium_src-c9cd22294bf1ef854e41c547d7c9f722b13593f6.zip chromium_src-c9cd22294bf1ef854e41c547d7c9f722b13593f6.tar.gz chromium_src-c9cd22294bf1ef854e41c547d7c9f722b13593f6.tar.bz2 |
Merge two TabContents::InvalidateTypes types and properly update tab download icon.
INVALIDATE_FAVICON and INVALIDATE_TITLE become INVALIDATE_TAB. Also removed some dead code.
TEST=starting a download in a tab should show the download icon. Closing the dshelf should make the icon disappear.
Review URL: http://codereview.chromium.org/109050
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@15387 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/browser.cc | 20 | ||||
-rw-r--r-- | chrome/browser/browser.h | 1 | ||||
-rw-r--r-- | chrome/browser/fav_icon_helper.cc | 5 | ||||
-rw-r--r-- | chrome/browser/gtk/download_shelf_gtk.cc | 1 | ||||
-rw-r--r-- | chrome/browser/tab_contents/interstitial_page.cc | 4 | ||||
-rw-r--r-- | chrome/browser/tab_contents/tab_contents.cc | 10 | ||||
-rw-r--r-- | chrome/browser/tab_contents/tab_contents.h | 7 | ||||
-rw-r--r-- | chrome/browser/tab_contents/tab_contents_delegate.h | 4 | ||||
-rw-r--r-- | chrome/browser/views/constrained_window_impl.cc | 5 | ||||
-rw-r--r-- | chrome/browser/views/constrained_window_impl.h | 3 | ||||
-rw-r--r-- | chrome/browser/views/tabs/tab_renderer.cc | 6 |
11 files changed, 13 insertions, 53 deletions
diff --git a/chrome/browser/browser.cc b/chrome/browser/browser.cc index efee083..c2e3bf8 100644 --- a/chrome/browser/browser.cc +++ b/chrome/browser/browser.cc @@ -1918,12 +1918,6 @@ void Browser::ConvertContentsToApplication(TabContents* contents) { browser->window()->Show(); } -void Browser::ContentsStateChanged(TabContents* source) { - int index = tabstrip_model_.GetIndexOfTabContents(source); - if (index != TabStripModel::kNoTab) - tabstrip_model_.UpdateTabContentsStateAt(index, true); -} - bool Browser::ShouldDisplayURLField() { return !IsApplication(); } @@ -2338,18 +2332,6 @@ void Browser::ProcessPendingUIUpdates() { updated_stuff[contents] = flags; } - // Updates to the title or favicon require a tab repaint. However, the - // inverse is not true since updates to the title also update the window - // title. - bool invalidate_tab = false; - if (flags & TabContents::INVALIDATE_TITLE || - flags & TabContents::INVALIDATE_FAVICON) { - invalidate_tab = true; - - // Anything that repaints the tab means the favicon is updated. - updated_stuff[contents] |= TabContents::INVALIDATE_FAVICON; - } - if (flags & TabContents::INVALIDATE_PAGE_ACTIONS) window()->GetLocationBar()->UpdatePageActions(); @@ -2358,7 +2340,7 @@ void Browser::ProcessPendingUIUpdates() { if (flags & TabContents::INVALIDATE_LOAD && GetStatusBubble()) GetStatusBubble()->SetStatus(GetSelectedTabContents()->GetStatusText()); - if (invalidate_tab) { // INVALIDATE_TITLE or INVALIDATE_FAVICON. + if (flags & TabContents::INVALIDATE_TAB) { tabstrip_model_.UpdateTabContentsStateAt( tabstrip_model_.GetIndexOfController(&contents->controller()), false); window_->UpdateTitleBar(); diff --git a/chrome/browser/browser.h b/chrome/browser/browser.h index d89337c..7e2a435 100644 --- a/chrome/browser/browser.h +++ b/chrome/browser/browser.h @@ -477,7 +477,6 @@ class Browser : public TabStripModelDelegate, virtual void ContentsZoomChange(bool zoom_in); virtual bool IsApplication() const; virtual void ConvertContentsToApplication(TabContents* source); - virtual void ContentsStateChanged(TabContents* source); virtual bool ShouldDisplayURLField(); virtual void BeforeUnloadFired(TabContents* source, bool proceed, diff --git a/chrome/browser/fav_icon_helper.cc b/chrome/browser/fav_icon_helper.cc index 3cf5af5..f29f68c 100644 --- a/chrome/browser/fav_icon_helper.cc +++ b/chrome/browser/fav_icon_helper.cc @@ -122,10 +122,7 @@ void FavIconHelper::UpdateFavIcon(NavigationEntry* entry, return; entry->favicon().set_bitmap(image); - if (tab_contents_->delegate()) { - tab_contents_->delegate()->NavigationStateChanged( - tab_contents_, TabContents::INVALIDATE_FAVICON); - } + tab_contents_->NotifyNavigationStateChanged(TabContents::INVALIDATE_TAB); } NavigationEntry* FavIconHelper::GetEntry() { diff --git a/chrome/browser/gtk/download_shelf_gtk.cc b/chrome/browser/gtk/download_shelf_gtk.cc index bf27bbd..d6d96ff 100644 --- a/chrome/browser/gtk/download_shelf_gtk.cc +++ b/chrome/browser/gtk/download_shelf_gtk.cc @@ -164,6 +164,7 @@ void DownloadShelfGtk::OnButtonClick(GtkWidget* button, DownloadShelfGtk* shelf) { if (button == shelf->close_button_->widget()) { shelf->slide_widget_->Close(); + shelf->tab_contents_->SetDownloadShelfVisible(false); } else { // The link button was clicked. shelf->ShowAllDownloads(); diff --git a/chrome/browser/tab_contents/interstitial_page.cc b/chrome/browser/tab_contents/interstitial_page.cc index e0106aa..c913ce0 100644 --- a/chrome/browser/tab_contents/interstitial_page.cc +++ b/chrome/browser/tab_contents/interstitial_page.cc @@ -208,7 +208,7 @@ void InterstitialPage::Hide() { NavigationEntry* entry = tab_->controller().GetActiveEntry(); if (!new_navigation_ && should_revert_tab_title_) { entry->set_title(WideToUTF16Hack(original_tab_title_)); - tab_->NotifyNavigationStateChanged(TabContents::INVALIDATE_TITLE); + tab_->NotifyNavigationStateChanged(TabContents::INVALIDATE_TAB); } delete this; } @@ -402,7 +402,7 @@ void InterstitialPage::UpdateTitle(RenderViewHost* render_view_host, should_revert_tab_title_ = true; } entry->set_title(WideToUTF16Hack(title)); - tab_->NotifyNavigationStateChanged(TabContents::INVALIDATE_TITLE); + tab_->NotifyNavigationStateChanged(TabContents::INVALIDATE_TAB); } RenderViewHostDelegate::View* InterstitialPage::GetViewDelegate() const { diff --git a/chrome/browser/tab_contents/tab_contents.cc b/chrome/browser/tab_contents/tab_contents.cc index d673f43..83c49c6 100644 --- a/chrome/browser/tab_contents/tab_contents.cc +++ b/chrome/browser/tab_contents/tab_contents.cc @@ -580,8 +580,7 @@ void TabContents::SetIsCrashed(bool state) { return; is_crashed_ = state; - if (delegate_) - delegate_->ContentsStateChanged(this); + NotifyNavigationStateChanged(INVALIDATE_TAB); } void TabContents::NotifyNavigationStateChanged(unsigned changed_flags) { @@ -932,8 +931,7 @@ void TabContents::SetDownloadShelfVisible(bool visible) { } shelf_visible_ = visible; - if (delegate_) - delegate_->ContentsStateChanged(this); + NotifyNavigationStateChanged(INVALIDATE_TAB); } // SetShelfVisible can force-close the shelf, so make sure we lay out @@ -1724,7 +1722,7 @@ void TabContents::UpdateTitle(RenderViewHost* rvh, // Broadcast notifications when the UI should be updated. if (entry == controller_.GetEntryAtOffset(0)) - NotifyNavigationStateChanged(INVALIDATE_TITLE); + NotifyNavigationStateChanged(INVALIDATE_TAB); } void TabContents::UpdateEncoding(RenderViewHost* render_view_host, @@ -2257,7 +2255,7 @@ void TabContents::LoadStateChanged(const GURL& url, if (load_state_ == net::LOAD_STATE_READING_RESPONSE) SetNotWaitingForResponse(); if (is_loading()) - NotifyNavigationStateChanged(INVALIDATE_LOAD | INVALIDATE_FAVICON); + NotifyNavigationStateChanged(INVALIDATE_LOAD | INVALIDATE_TAB); } void TabContents::OnDidGetApplicationInfo( diff --git a/chrome/browser/tab_contents/tab_contents.h b/chrome/browser/tab_contents/tab_contents.h index cb7e589..1a83d8c 100644 --- a/chrome/browser/tab_contents/tab_contents.h +++ b/chrome/browser/tab_contents/tab_contents.h @@ -93,10 +93,9 @@ class TabContents : public PageNavigator, // what has changed. Combine them to update more than one thing. enum InvalidateTypes { INVALIDATE_URL = 1, // The URL has changed. - INVALIDATE_TITLE = 2, // The title has changed. - INVALIDATE_FAVICON = 4, // The favicon has changed. - INVALIDATE_LOAD = 8, // The loading state has changed. - INVALIDATE_PAGE_ACTIONS = 16, // Page action icons have changed. + INVALIDATE_TAB = 2, // The tab (favicon, title, etc.) has changed + INVALIDATE_LOAD = 4, // The loading state has changed. + INVALIDATE_PAGE_ACTIONS = 8, // Page action icons have changed. // Helper for forcing a refresh. INVALIDATE_EVERYTHING = 0xFFFFFFFF }; diff --git a/chrome/browser/tab_contents/tab_contents_delegate.h b/chrome/browser/tab_contents/tab_contents_delegate.h index 6eff8d26..ad7ac1e 100644 --- a/chrome/browser/tab_contents/tab_contents_delegate.h +++ b/chrome/browser/tab_contents/tab_contents_delegate.h @@ -97,10 +97,6 @@ class TabContentsDelegate { // a TabContents with a valid WebApp set. virtual void ConvertContentsToApplication(TabContents* source) { } - // Informs the TabContentsDelegate that some of our state has changed - // for this tab. - virtual void ContentsStateChanged(TabContents* source) {} - // Return whether this tab contents should have a URL bar. Only web contents // opened with a minimal chrome and their popups can be displayed without a // URL bar. diff --git a/chrome/browser/views/constrained_window_impl.cc b/chrome/browser/views/constrained_window_impl.cc index cdcd078..11ab3b5 100644 --- a/chrome/browser/views/constrained_window_impl.cc +++ b/chrome/browser/views/constrained_window_impl.cc @@ -683,11 +683,6 @@ void ConstrainedWindowImpl::InitAsDialog(const gfx::Rect& initial_bounds) { ActivateConstrainedWindow(); } -void ConstrainedWindowImpl::UpdateUI(unsigned int changed_flags) { - if (changed_flags & TabContents::INVALIDATE_TITLE) - UpdateWindowTitle(); -} - //////////////////////////////////////////////////////////////////////////////// // ConstrainedWindowImpl, views::WidgetWin overrides: diff --git a/chrome/browser/views/constrained_window_impl.h b/chrome/browser/views/constrained_window_impl.h index 4afec31..a4ff2bd 100644 --- a/chrome/browser/views/constrained_window_impl.h +++ b/chrome/browser/views/constrained_window_impl.h @@ -64,9 +64,6 @@ class ConstrainedWindowImpl : public ConstrainedWindow, // views::View client area. void InitAsDialog(const gfx::Rect& initial_bounds); - // Updates the portions of the UI as specified in |changed_flags|. - void UpdateUI(unsigned int changed_flags); - // The TabContents that owns and constrains this ConstrainedWindow. TabContents* owner_; diff --git a/chrome/browser/views/tabs/tab_renderer.cc b/chrome/browser/views/tabs/tab_renderer.cc index 285ebcc..ca69bdd 100644 --- a/chrome/browser/views/tabs/tab_renderer.cc +++ b/chrome/browser/views/tabs/tab_renderer.cc @@ -242,6 +242,7 @@ void TabRenderer::UpdateData(TabContents* contents, bool loading_only) { data_.title = UTF16ToWideHack(contents->GetTitle()); data_.off_the_record = contents->profile()->IsOffTheRecord(); data_.show_download_icon = contents->IsDownloadShelfVisible(); + data_.crashed = contents->is_crashed(); data_.favicon = contents->GetFavIcon(); } @@ -249,11 +250,6 @@ void TabRenderer::UpdateData(TabContents* contents, bool loading_only) { // we display the throbber. data_.loading = contents->is_loading(); data_.show_icon = contents->ShouldDisplayFavIcon(); - - // Because the crashed notification comes through the tab contents, it - // appears as a loading_only change. This is fine, since the crashed flag is - // trivial to update unlike the title and favicon. - data_.crashed = contents->is_crashed(); } void TabRenderer::UpdateFromModel() { |