OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 | 12 |
13 void RegisterTabStripLayoutTypePrefs(PrefRegistrySimple* registry) { | 13 // The following values are persisted in prefs: |
14 // This value is device dependant, so it goes in local state. | 14 // 0 - Tabs shrink to accommodate the available space. This is the default. |
15 registry->RegisterIntegerPref(prefs::kTabStripLayoutType, | 15 // 1 - The tabs are always sized to their ideal size and stacked on top of each |
16 static_cast<int>(TAB_STRIP_LAYOUT_SHRINK)); | 16 // other so that only a certain set of tabs are visible. This is used when |
17 // the user uses a touch device. | |
Peter Kasting
2014/05/23 17:48:46
Don't use an integer pref for this, use a boolean
varkha
2014/05/23 17:51:57
That would be great but don't we want to preserve
varkha
2014/05/23 21:45:48
Done. The file is still there (unmodified) since i
| |
18 | |
19 void TabStripLayoutTypePrefs::Register(PrefRegistrySimple* registry) { | |
20 // This value is device dependent, so it goes in local state. | |
21 // 0 is the default (not stacked) layout type in prefs. | |
22 registry->RegisterIntegerPref(prefs::kTabStripLayoutType, 0); | |
23 } | |
24 | |
25 bool TabStripLayoutTypePrefs::GetStackedLayout(PrefService* prefs) { | |
26 return prefs->GetInteger(prefs::kTabStripLayoutType) != 0; | |
27 } | |
28 | |
29 void TabStripLayoutTypePrefs::SetStackedLayout(PrefService* prefs, | |
30 bool stacked_layout) { | |
31 prefs->SetInteger(prefs::kTabStripLayoutType, stacked_layout ? 0 : 1); | |
Peter Kasting
2014/05/23 17:48:46
Isn't this backwards? Using a bool pref with a go
varkha
2014/05/23 21:45:48
Exactly! That's why getting rid of this in favour
| |
17 } | 32 } |
18 | 33 |
19 } // namespace chrome | 34 } // namespace chrome |
OLD | NEW |