OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/ui/tabs/tab_strip_layout_type_prefs.h" | 5 #include "chrome/browser/ui/tabs/tab_strip_layout_type_prefs.h" |
6 | 6 |
7 #include "base/prefs/pref_registry_simple.h" | 7 #include "base/prefs/pref_registry_simple.h" |
8 #include "chrome/browser/ui/tabs/tab_strip_layout_type.h" | 8 #include "base/prefs/pref_service.h" |
9 #include "chrome/common/pref_names.h" | 9 #include "chrome/common/pref_names.h" |
10 | 10 |
11 namespace chrome { | 11 namespace chrome { |
12 namespace tab_strip_layout_type_prefs { | |
12 | 13 |
13 void RegisterTabStripLayoutTypePrefs(PrefRegistrySimple* registry) { | 14 namespace { |
14 // This value is device dependant, so it goes in local state. | 15 |
15 registry->RegisterIntegerPref(prefs::kTabStripLayoutType, | 16 // DEPRECATED: this is replaced by kTabStripStackedLayout and exists for |
16 static_cast<int>(TAB_STRIP_LAYOUT_SHRINK)); | 17 // backwards compatibility. |
18 // Old values: 0 = SHRINK (default), 1 = STACKED | |
Peter Kasting
2014/05/23 22:38:43
This comment will be obvious once this constant is
varkha
2014/05/23 22:50:56
See my next comment.
| |
19 const char kTabStripLayoutType[] = "tab_strip_layout_type"; | |
Peter Kasting
2014/05/23 22:38:43
Declare constants as locally as possible, in this
varkha
2014/05/23 22:50:56
There are two functions that use the constant.
| |
20 | |
21 } // namespace | |
22 | |
23 void RegisterPrefs(PrefRegistrySimple* registry) { | |
24 // This value is device dependent, so it goes in local state. | |
Peter Kasting
2014/05/23 22:38:43
This function doesn't necessarily know whether |re
varkha
2014/05/23 22:50:56
Done (removed).
| |
25 registry->RegisterIntegerPref(kTabStripLayoutType, 0); | |
26 registry->RegisterBooleanPref(prefs::kTabStripStackedLayout, false); | |
17 } | 27 } |
18 | 28 |
29 void MigratePrefs(PrefService* pref) { | |
Peter Kasting
2014/05/23 22:38:43
Nit: Call this "prefs" -- "pref" sounds like one p
varkha
2014/05/23 22:50:56
Done.
| |
30 // Convert possibly existing non-default value for tabstrip layout type into | |
31 // boolean value indicating stacked layout preference. | |
Peter Kasting
2014/05/23 22:38:43
This comment is confusing and redundant with the c
varkha
2014/05/23 22:50:56
Moved to header and simplified.
| |
32 if (pref->HasPrefPath(kTabStripLayoutType)) { | |
33 if (pref->GetInteger(kTabStripLayoutType) != 0) | |
34 pref->SetBoolean(prefs::kTabStripStackedLayout, true); | |
Peter Kasting
2014/05/23 22:38:43
Nit: Should we just do:
pref->SetBoolean(pref
varkha
2014/05/23 22:50:56
Done.
| |
35 pref->ClearPref(kTabStripLayoutType); | |
36 } | |
37 } | |
38 | |
39 } // namespace tab_strip_layout_type_prefs | |
19 } // namespace chrome | 40 } // namespace chrome |
OLD | NEW |