summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
authortfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-05-10 21:28:11 +0000
committertfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-05-10 21:28:11 +0000
commit346fbcf8e3a48b3e3daf9cd3cc8166cdde70ae31 (patch)
treea92311417c1efc947f5fa93628b0282bcef9e81c /chrome/browser
parentd1ca226e6dd4091918844d44f9c7c6503406f676 (diff)
downloadchromium_src-346fbcf8e3a48b3e3daf9cd3cc8166cdde70ae31.zip
chromium_src-346fbcf8e3a48b3e3daf9cd3cc8166cdde70ae31.tar.gz
chromium_src-346fbcf8e3a48b3e3daf9cd3cc8166cdde70ae31.tar.bz2
views: Refactor the way we register BrowserActionsContainer prefs.
This is similar to the way cocoa does. BUG=125846 R=ben@chromium.org Review URL: https://chromiumcodereview.appspot.com/10387047 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@136394 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/prefs/browser_prefs.cc2
-rw-r--r--chrome/browser/ui/views/browser_actions_container.cc26
-rw-r--r--chrome/browser/ui/views/browser_actions_container.h2
3 files changed, 17 insertions, 13 deletions
diff --git a/chrome/browser/prefs/browser_prefs.cc b/chrome/browser/prefs/browser_prefs.cc
index c7cfc77..f3be9ad 100644
--- a/chrome/browser/prefs/browser_prefs.cc
+++ b/chrome/browser/prefs/browser_prefs.cc
@@ -79,7 +79,6 @@
#if defined(TOOLKIT_VIEWS) // TODO(port): whittle this down as we port
#include "chrome/browser/accessibility/invert_bubble_views.h"
-#include "chrome/browser/ui/views/browser_actions_container.h"
#endif
#if defined(TOOLKIT_GTK)
@@ -210,7 +209,6 @@ void RegisterUserPrefs(PrefService* user_prefs) {
#endif
#if defined(TOOLKIT_VIEWS)
- BrowserActionsContainer::RegisterUserPrefs(user_prefs);
InvertBubble::RegisterUserPrefs(user_prefs);
#elif defined(TOOLKIT_GTK)
BrowserWindowGtk::RegisterUserPrefs(user_prefs);
diff --git a/chrome/browser/ui/views/browser_actions_container.cc b/chrome/browser/ui/views/browser_actions_container.cc
index b61c67c..29971f0 100644
--- a/chrome/browser/ui/views/browser_actions_container.cc
+++ b/chrome/browser/ui/views/browser_actions_container.cc
@@ -55,11 +55,22 @@
#include "ui/views/controls/resize_area.h"
#include "ui/views/metrics.h"
+namespace {
+
// Horizontal spacing between most items in the container, as well as after the
// last item or chevron (if visible).
-static const int kItemSpacing = ToolbarView::kStandardSpacing;
+const int kItemSpacing = ToolbarView::kStandardSpacing;
+
// Horizontal spacing before the chevron (if visible).
-static const int kChevronSpacing = kItemSpacing - 2;
+const int kChevronSpacing = kItemSpacing - 2;
+
+void RegisterUserPrefs(PrefService* prefs) {
+ prefs->RegisterIntegerPref(prefs::kBrowserActionContainerWidth,
+ 0,
+ PrefService::UNSYNCABLE_PREF);
+}
+
+} // namespace
// static
bool BrowserActionsContainer::disable_animations_during_testing_ = false;
@@ -425,16 +436,13 @@ BrowserActionsContainer::~BrowserActionsContainer() {
DeleteBrowserActionViews();
}
-// Static.
-void BrowserActionsContainer::RegisterUserPrefs(PrefService* prefs) {
- prefs->RegisterIntegerPref(prefs::kBrowserActionContainerWidth,
- 0,
- PrefService::UNSYNCABLE_PREF);
-}
-
void BrowserActionsContainer::Init() {
LoadImages();
+ if (!profile_->GetPrefs()->FindPreference(
+ prefs::kBrowserActionContainerWidth))
+ RegisterUserPrefs(profile_->GetPrefs());
+
// We wait to set the container width until now so that the chevron images
// will be loaded. The width calculation needs to know the chevron size.
if (model_ &&
diff --git a/chrome/browser/ui/views/browser_actions_container.h b/chrome/browser/ui/views/browser_actions_container.h
index 566e908..d1677f7 100644
--- a/chrome/browser/ui/views/browser_actions_container.h
+++ b/chrome/browser/ui/views/browser_actions_container.h
@@ -275,8 +275,6 @@ class BrowserActionsContainer
BrowserActionsContainer(Browser* browser, views::View* owner_view);
virtual ~BrowserActionsContainer();
- static void RegisterUserPrefs(PrefService* prefs);
-
void Init();
// Get the number of browser actions being displayed.