diff options
author | mpcomplete@chromium.org <mpcomplete@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-25 17:42:22 +0000 |
---|---|---|
committer | mpcomplete@chromium.org <mpcomplete@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-25 17:42:22 +0000 |
commit | 199a703cb6a0127e1159c0571d0111b9fa7665cd (patch) | |
tree | bace11700aaecbcb641f0b1bcf1ceccf676759ae | |
parent | 8131d7b56f3496d17f616598f0474bf6cf336864 (diff) | |
download | chromium_src-199a703cb6a0127e1159c0571d0111b9fa7665cd.zip chromium_src-199a703cb6a0127e1159c0571d0111b9fa7665cd.tar.gz chromium_src-199a703cb6a0127e1159c0571d0111b9fa7665cd.tar.bz2 |
Fix BrowserActionsContainerTest.Visibility for chromeos and reenable it.
BUG=38992
Review URL: http://codereview.chromium.org/1310001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@42636 0039d316-1c4b-4281-b951-d872f2087c98
5 files changed, 16 insertions, 9 deletions
diff --git a/chrome/browser/chromeos/compact_location_bar_view.cc b/chrome/browser/chromeos/compact_location_bar_view.cc index 28faefc..03434ea 100644 --- a/chrome/browser/chromeos/compact_location_bar_view.cc +++ b/chrome/browser/chromeos/compact_location_bar_view.cc @@ -130,7 +130,10 @@ void CompactLocationBarView::Init() { location_entry_->Update(browser()->GetSelectedTabContents()); - browser_actions_ = new BrowserActionsContainer(browser(), this); + // Note: we tell the BrowserActionsContainer not to save its size because + // the main container is part of the ToolbarView, and we don't want them + // fighting. See http://code.google.com/p/chromium/issues/detail?id=38992 + browser_actions_ = new BrowserActionsContainer(browser(), this, false); AddChildView(browser_actions_); } diff --git a/chrome/browser/views/browser_actions_container.cc b/chrome/browser/views/browser_actions_container.cc index 088b0ed..b23cb76 100644 --- a/chrome/browser/views/browser_actions_container.cc +++ b/chrome/browser/views/browser_actions_container.cc @@ -338,10 +338,11 @@ void BrowserActionView::PaintChildren(gfx::Canvas* canvas) { // BrowserActionsContainer BrowserActionsContainer::BrowserActionsContainer( - Browser* browser, View* owner_view) + Browser* browser, View* owner_view, bool should_save_size) : profile_(browser->profile()), browser_(browser), owner_view_(owner_view), + should_save_size_(should_save_size), popup_(NULL), popup_button_(NULL), model_(NULL), @@ -1096,7 +1097,7 @@ void BrowserActionsContainer::AnimationEnded(const Animation* animation) { // Don't save the icon count in incognito because there may be fewer icons // in that mode. The result is that the container in a normal window is always // at least as wide as in an incognito window. - if (!profile_->IsOffTheRecord()) + if (!profile_->IsOffTheRecord() && should_save_size_) model_->SetVisibleIconCount(VisibleBrowserActions()); } diff --git a/chrome/browser/views/browser_actions_container.h b/chrome/browser/views/browser_actions_container.h index 58ec5ed..45cfaf9 100644 --- a/chrome/browser/views/browser_actions_container.h +++ b/chrome/browser/views/browser_actions_container.h @@ -246,7 +246,10 @@ class BrowserActionsContainer public ExtensionContextMenuModel::PopupDelegate, public ExtensionPopup::Observer { public: - BrowserActionsContainer(Browser* browser, views::View* owner_view); + // If |should_save_size| is false, container resizes will not persist across + // browser restarts. + BrowserActionsContainer(Browser* browser, views::View* owner_view, + bool should_save_size); virtual ~BrowserActionsContainer(); static void RegisterUserPrefs(PrefService* prefs); @@ -435,6 +438,9 @@ class BrowserActionsContainer // The view that owns us. views::View* owner_view_; + // True if we should save the size of the container to the global prefs. + bool should_save_size_; + // The current popup and the button it came from. NULL if no popup. ExtensionPopup* popup_; diff --git a/chrome/browser/views/browser_actions_container_unittest.cc b/chrome/browser/views/browser_actions_container_unittest.cc index 11dc160..9612314 100644 --- a/chrome/browser/views/browser_actions_container_unittest.cc +++ b/chrome/browser/views/browser_actions_container_unittest.cc @@ -62,11 +62,7 @@ IN_PROC_BROWSER_TEST_F(BrowserActionsContainerTest, Basic) { } // TODO(mpcomplete): http://code.google.com/p/chromium/issues/detail?id=38992 -#if defined(OS_CHROMEOS) -IN_PROC_BROWSER_TEST_F(BrowserActionsContainerTest, DISABLED_Visibility) { -#else IN_PROC_BROWSER_TEST_F(BrowserActionsContainerTest, Visibility) { -#endif BrowserActionsContainer::disable_animations_during_testing_ = true; // Load extension A (contains browser action). diff --git a/chrome/browser/views/toolbar_view.cc b/chrome/browser/views/toolbar_view.cc index 47ca0e0..b0cffa6 100644 --- a/chrome/browser/views/toolbar_view.cc +++ b/chrome/browser/views/toolbar_view.cc @@ -723,7 +723,8 @@ void ToolbarView::CreateCenterStack(Profile *profile) { } void ToolbarView::CreateRightSideControls(Profile* profile) { - browser_actions_ = new BrowserActionsContainer(browser_, this); + browser_actions_ = new BrowserActionsContainer(browser_, this, + true); // should_save_size page_menu_ = new views::MenuButton(NULL, std::wstring(), this, false); page_menu_->SetAccessibleName(l10n_util::GetString(IDS_ACCNAME_PAGE)); |