summaryrefslogtreecommitdiffstats
path: root/chrome/browser/ui/views/frame
diff options
context:
space:
mode:
authorsky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-06-24 19:18:48 +0000
committersky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-06-24 19:18:48 +0000
commit09b2934d0d6a35201ea68cc50eec2a4994c96c97 (patch)
treef981f471eac7b79a8bbca4062d16310bd78f0c04 /chrome/browser/ui/views/frame
parent2ac71f72077ecca92e97f050d0e1574046d44be5 (diff)
downloadchromium_src-09b2934d0d6a35201ea68cc50eec2a4994c96c97.zip
chromium_src-09b2934d0d6a35201ea68cc50eec2a4994c96c97.tar.gz
chromium_src-09b2934d0d6a35201ea68cc50eec2a4994c96c97.tar.bz2
Consolidates managing of bookmark bar state to browser. Browser now
pushes that state to the BrowserWindow when it changes (except during tab switches, when it's assumed the browserwindow polls). The problem with the current code is that as the BookmarkBar queries for state during painting and layout, it was possible for that state without the bookmarkbar being layed out. This resulted in the bookmark bar painting attached even when it was given the detached state. I'm also plumbing through one case of when the bookmark bar state changes that wasn't being handled. BUG=87137 TEST=see bug, but make sure you don't notice any problems with bookmark bar visibility changes (such as toggling visibility, or turning off and navigating back/to the new tab page). R=pkasting@chromium.org,brettw@chromium.org,estade@chromium.org TBR=pinkerton@chromium.org, dimich@google.com Review URL: http://codereview.chromium.org/7237001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@90405 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/ui/views/frame')
-rw-r--r--chrome/browser/ui/views/frame/browser_view.cc29
-rw-r--r--chrome/browser/ui/views/frame/browser_view.h3
2 files changed, 20 insertions, 12 deletions
diff --git a/chrome/browser/ui/views/frame/browser_view.cc b/chrome/browser/ui/views/frame/browser_view.cc
index 78a91cd..8bc2535 100644
--- a/chrome/browser/ui/views/frame/browser_view.cc
+++ b/chrome/browser/ui/views/frame/browser_view.cc
@@ -717,8 +717,14 @@ void BrowserView::UpdateTitleBar() {
frame_->UpdateWindowIcon();
}
-void BrowserView::ShelfVisibilityChanged() {
- Layout();
+void BrowserView::BookmarkBarStateChanged(
+ BookmarkBar::AnimateChangeType change_type) {
+ if (bookmark_bar_view_.get()) {
+ bookmark_bar_view_->SetBookmarkBarState(
+ browser_->bookmark_bar_state(), change_type);
+ }
+ if (MaybeShowBookmarkBar(browser_->GetSelectedTabContentsWrapper()))
+ Layout();
}
void BrowserView::UpdateDevTools() {
@@ -1369,13 +1375,6 @@ void BrowserView::Observe(NotificationType type,
const NotificationSource& source,
const NotificationDetails& details) {
switch (type.value) {
- case NotificationType::PREF_CHANGED:
- if (*Details<std::string>(details).ptr() == prefs::kShowBookmarkBar &&
- MaybeShowBookmarkBar(browser_->GetSelectedTabContentsWrapper())) {
- Layout();
- }
- break;
-
case NotificationType::SIDEBAR_CHANGED:
if (Details<SidebarContainer>(details)->tab_contents() ==
browser_->GetSelectedTabContents()) {
@@ -2045,8 +2044,8 @@ void BrowserView::LayoutStatusBubble() {
bool BrowserView::MaybeShowBookmarkBar(TabContentsWrapper* contents) {
views::View* new_bookmark_bar_view = NULL;
- if (browser_->SupportsWindowFeature(Browser::FEATURE_BOOKMARKBAR)
- && contents) {
+ if (browser_->SupportsWindowFeature(Browser::FEATURE_BOOKMARKBAR) &&
+ contents) {
if (!bookmark_bar_view_.get()) {
bookmark_bar_view_.reset(new BookmarkBarView(contents->profile(),
browser_.get()));
@@ -2054,6 +2053,9 @@ bool BrowserView::MaybeShowBookmarkBar(TabContentsWrapper* contents) {
bookmark_bar_view_->set_background(
new BookmarkExtensionBackground(this, bookmark_bar_view_.get(),
browser_.get()));
+ bookmark_bar_view_->SetBookmarkBarState(
+ browser_->bookmark_bar_state(),
+ BookmarkBar::DONT_ANIMATE_STATE_CHANGE);
} else {
bookmark_bar_view_->SetProfile(contents->profile());
}
@@ -2564,6 +2566,11 @@ void BrowserView::ProcessTabSelected(TabContentsWrapper* new_contents,
if (change_tab_contents)
contents_container_->ChangeTabContents(NULL);
infobar_container_->ChangeTabContents(new_contents);
+ if (bookmark_bar_view_.get()) {
+ bookmark_bar_view_->SetBookmarkBarState(
+ browser_->bookmark_bar_state(),
+ BookmarkBar::DONT_ANIMATE_STATE_CHANGE);
+ }
UpdateUIForContents(new_contents);
if (change_tab_contents)
contents_container_->ChangeTabContents(new_contents->tab_contents());
diff --git a/chrome/browser/ui/views/frame/browser_view.h b/chrome/browser/ui/views/frame/browser_view.h
index 2726d95..061d371 100644
--- a/chrome/browser/ui/views/frame/browser_view.h
+++ b/chrome/browser/ui/views/frame/browser_view.h
@@ -261,7 +261,8 @@ class BrowserView : public BrowserBubbleHost,
virtual StatusBubble* GetStatusBubble() OVERRIDE;
virtual void ToolbarSizeChanged(bool is_animating) OVERRIDE;
virtual void UpdateTitleBar() OVERRIDE;
- virtual void ShelfVisibilityChanged() OVERRIDE;
+ virtual void BookmarkBarStateChanged(
+ BookmarkBar::AnimateChangeType change_type) OVERRIDE;
virtual void UpdateDevTools() OVERRIDE;
virtual void UpdateLoadingAnimations(bool should_animate) OVERRIDE;
virtual void SetStarredState(bool is_starred) OVERRIDE;