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
3 // found in the LICENSE file.
5 #include "chrome/browser/ui/browser_view_prefs.h"
7 #include "base/prefs/pref_registry_simple.h"
8 #include "base/prefs/pref_service.h"
9 #include "chrome/common/pref_names.h"
10 #include "components/pref_registry/pref_registry_syncable.h"
12 #if defined(OS_LINUX) && !defined(OS_CHROMEOS)
13 #include "ui/base/x/x11_util.h"
18 // How long do we wait before we consider a window hung (in ms).
19 const int kDefaultPluginMessageResponseTimeout
= 25000;
21 // How frequently we check for hung plugin windows.
22 const int kDefaultHungPluginDetectFrequency
= 2000;
24 // DEPRECATED: this is replaced by kTabStripStackedLayout and exists for
25 // backwards compatibility.
26 // Old values: 0 = SHRINK (default), 1 = STACKED.
27 const char kTabStripLayoutType
[] = "tab_strip_layout_type";
33 void RegisterBrowserViewLocalPrefs(PrefRegistrySimple
* registry
) {
34 registry
->RegisterIntegerPref(prefs::kPluginMessageResponseTimeout
,
35 kDefaultPluginMessageResponseTimeout
);
36 registry
->RegisterIntegerPref(prefs::kHungPluginDetectFrequency
,
37 kDefaultHungPluginDetectFrequency
);
38 registry
->RegisterIntegerPref(kTabStripLayoutType
, 0);
39 registry
->RegisterBooleanPref(prefs::kTabStripStackedLayout
, false);
42 void RegisterBrowserViewProfilePrefs(
43 user_prefs::PrefRegistrySyncable
* registry
) {
44 bool custom_frame_default
= false;
45 #if defined(OS_LINUX) && !defined(OS_CHROMEOS)
46 custom_frame_default
= ui::GetCustomFramePrefDefault();
49 registry
->RegisterBooleanPref(
50 prefs::kUseCustomChromeFrame
,
52 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF
);
55 void MigrateBrowserTabStripPrefs(PrefService
* prefs
) {
56 if (prefs
->HasPrefPath(kTabStripLayoutType
)) {
57 prefs
->SetBoolean(prefs::kTabStripStackedLayout
,
58 prefs
->GetInteger(kTabStripLayoutType
) != 0);
59 prefs
->ClearPref(kTabStripLayoutType
);