Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1027)

Unified Diff: chrome/browser/ui/views/browser_actions_container.cc

Issue 10387047: views: Refactor the way we register BrowserActionsContainer prefs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/views/browser_actions_container.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/views/browser_actions_container.cc
diff --git a/chrome/browser/ui/views/browser_actions_container.cc b/chrome/browser/ui/views/browser_actions_container.cc
index b61c67cfb3aa76065db6de7b2100c3088f5f369d..29971f0a4c674dd573ee5b6c52d0d16fe73e36d9 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_ &&
« no previous file with comments | « chrome/browser/ui/views/browser_actions_container.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698