Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / chrome / browser / ui / ash / chrome_launcher_prefs.cc
blob24bd3932a187843cae58b01c7e7fb4d3e86608b9
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/ash/chrome_launcher_prefs.h"
7 #include "base/basictypes.h"
8 #include "base/memory/scoped_ptr.h"
9 #include "base/values.h"
10 #include "chrome/common/extensions/extension_constants.h"
11 #include "chrome/common/pref_names.h"
12 #include "components/pref_registry/pref_registry_syncable.h"
14 namespace {
16 // App ID of default pinned apps.
17 const char* kDefaultPinnedApps[] = {
18 extension_misc::kGmailAppId,
19 extension_misc::kGoogleSearchAppId,
20 extension_misc::kGoogleDocAppId,
21 extension_misc::kYoutubeAppId,
24 base::ListValue* CreateDefaultPinnedAppsList() {
25 scoped_ptr<base::ListValue> apps(new base::ListValue);
26 for (size_t i = 0; i < arraysize(kDefaultPinnedApps); ++i)
27 apps->Append(ash::CreateAppDict(kDefaultPinnedApps[i]));
29 return apps.release();
32 } // namespace
34 namespace ash {
36 const char kPinnedAppsPrefAppIDPath[] = "id";
38 const char kShelfAutoHideBehaviorAlways[] = "Always";
39 const char kShelfAutoHideBehaviorNever[] = "Never";
41 const char kShelfAlignmentBottom[] = "Bottom";
42 const char kShelfAlignmentLeft[] = "Left";
43 const char kShelfAlignmentRight[] = "Right";
44 const char kShelfAlignmentTop[] = "Top";
46 void RegisterChromeLauncherUserPrefs(
47 user_prefs::PrefRegistrySyncable* registry) {
48 // TODO: If we want to support multiple profiles this will likely need to be
49 // pushed to local state and we'll need to track profile per item.
50 registry->RegisterIntegerPref(
51 prefs::kShelfChromeIconIndex,
53 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF);
54 registry->RegisterListPref(prefs::kPinnedLauncherApps,
55 CreateDefaultPinnedAppsList(),
56 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF);
57 registry->RegisterStringPref(prefs::kShelfAutoHideBehavior,
58 kShelfAutoHideBehaviorNever,
59 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF);
60 registry->RegisterStringPref(prefs::kShelfAutoHideBehaviorLocal,
61 std::string());
62 registry->RegisterStringPref(prefs::kShelfAlignment,
63 kShelfAlignmentBottom,
64 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF);
65 registry->RegisterStringPref(prefs::kShelfAlignmentLocal, std::string());
66 registry->RegisterDictionaryPref(prefs::kShelfPreferences);
67 registry->RegisterIntegerPref(prefs::kLogoutDialogDurationMs, 20000);
68 registry->RegisterBooleanPref(prefs::kShowLogoutButtonInTray, false);
71 base::DictionaryValue* CreateAppDict(const std::string& app_id) {
72 scoped_ptr<base::DictionaryValue> app_value(new base::DictionaryValue);
73 app_value->SetString(kPinnedAppsPrefAppIDPath, app_id);
74 return app_value.release();
77 } // namespace ash