| OLD | NEW |
| (Empty) | |
| 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. |
| 4 |
| 5 #include "chrome/browser/ui/ash/chrome_launcher_prefs.h" |
| 6 |
| 7 #include "base/basictypes.h" |
| 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/values.h" |
| 10 #include "chrome/browser/prefs/pref_service.h" |
| 11 #include "chrome/common/pref_names.h" |
| 12 |
| 13 namespace { |
| 14 |
| 15 // App ID of default pinned apps. |
| 16 const char* kDefaultPinnedApps[] = { |
| 17 "pjkljhegncpnkpknbcohdijeoejaedia", // Gmail |
| 18 "coobgpohoikkiipiblmjeljniedjpjpf", // Search |
| 19 "apdfllckaahabafndbhieahigkjlhalf", // Doc |
| 20 "blpcfgokakmgnkcojhhkbfbldkacnbeo", // YouTube |
| 21 }; |
| 22 |
| 23 base::ListValue* CreateDefaultPinnedAppsList() { |
| 24 scoped_ptr<base::ListValue> apps(new base::ListValue); |
| 25 for (size_t i = 0; i < arraysize(kDefaultPinnedApps); ++i) |
| 26 apps->Append(ash::CreateAppDict(kDefaultPinnedApps[i])); |
| 27 |
| 28 return apps.release(); |
| 29 } |
| 30 |
| 31 } // namespace |
| 32 |
| 33 namespace ash { |
| 34 |
| 35 const char kPinnedAppsPrefAppIDPath[] = "id"; |
| 36 |
| 37 // Values used for prefs::kShelfAutoHideBehavior. |
| 38 const char kShelfAutoHideBehaviorAlways[] = "Always"; |
| 39 const char kShelfAutoHideBehaviorDefault[] = "Default"; |
| 40 const char kShelfAutoHideBehaviorNever[] = "Never"; |
| 41 |
| 42 void RegisterChromeLauncherUserPrefs(PrefService* user_prefs) { |
| 43 // TODO: If we want to support multiple profiles this will likely need to be |
| 44 // pushed to local state and we'll need to track profile per item. |
| 45 user_prefs->RegisterBooleanPref(prefs::kUseDefaultPinnedApps, |
| 46 true, |
| 47 PrefService::SYNCABLE_PREF); |
| 48 user_prefs->RegisterListPref(prefs::kPinnedLauncherApps, |
| 49 CreateDefaultPinnedAppsList(), |
| 50 PrefService::SYNCABLE_PREF); |
| 51 user_prefs->RegisterStringPref(prefs::kShelfAutoHideBehavior, |
| 52 kShelfAutoHideBehaviorDefault, |
| 53 PrefService::SYNCABLE_PREF); |
| 54 } |
| 55 |
| 56 base::DictionaryValue* CreateAppDict(const std::string& app_id) { |
| 57 scoped_ptr<base::DictionaryValue> app_value(new base::DictionaryValue); |
| 58 app_value->SetString(kPinnedAppsPrefAppIDPath, app_id); |
| 59 return app_value.release(); |
| 60 } |
| 61 |
| 62 } // namespace ash |
| OLD | NEW |