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/ash/chrome_launcher_prefs.h" | 5 #include "chrome/browser/ui/ash/chrome_launcher_prefs.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 | 10 |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 registry->RegisterIntegerPref(prefs::kLogoutDialogDurationMs, 20000); | 70 registry->RegisterIntegerPref(prefs::kLogoutDialogDurationMs, 20000); |
71 registry->RegisterBooleanPref(prefs::kShowLogoutButtonInTray, false); | 71 registry->RegisterBooleanPref(prefs::kShowLogoutButtonInTray, false); |
72 } | 72 } |
73 | 73 |
74 base::DictionaryValue* CreateAppDict(const std::string& app_id) { | 74 base::DictionaryValue* CreateAppDict(const std::string& app_id) { |
75 std::unique_ptr<base::DictionaryValue> app_value(new base::DictionaryValue); | 75 std::unique_ptr<base::DictionaryValue> app_value(new base::DictionaryValue); |
76 app_value->SetString(kPinnedAppsPrefAppIDPath, app_id); | 76 app_value->SetString(kPinnedAppsPrefAppIDPath, app_id); |
77 return app_value.release(); | 77 return app_value.release(); |
78 } | 78 } |
79 | 79 |
| 80 ash::ShelfAlignment AlignmentFromPref(const std::string& value) { |
| 81 if (value == ash::kShelfAlignmentLeft) |
| 82 return ash::SHELF_ALIGNMENT_LEFT; |
| 83 else if (value == ash::kShelfAlignmentRight) |
| 84 return ash::SHELF_ALIGNMENT_RIGHT; |
| 85 // Default to bottom. |
| 86 return ash::SHELF_ALIGNMENT_BOTTOM; |
| 87 } |
| 88 |
| 89 const char* AlignmentToPref(ash::ShelfAlignment alignment) { |
| 90 switch (alignment) { |
| 91 case ash::SHELF_ALIGNMENT_BOTTOM: |
| 92 return ash::kShelfAlignmentBottom; |
| 93 case ash::SHELF_ALIGNMENT_LEFT: |
| 94 return ash::kShelfAlignmentLeft; |
| 95 case ash::SHELF_ALIGNMENT_RIGHT: |
| 96 return ash::kShelfAlignmentRight; |
| 97 } |
| 98 NOTREACHED(); |
| 99 return nullptr; |
| 100 } |
| 101 |
| 102 ash::ShelfAutoHideBehavior AutoHideBehaviorFromPref(const std::string& value) { |
| 103 // Note: To maintain sync compatibility with old images of chrome/chromeos |
| 104 // the set of values that may be encountered includes the now-extinct |
| 105 // "Default" as well as "Never" and "Always", "Default" should now |
| 106 // be treated as "Never" (http://crbug.com/146773). |
| 107 if (value == ash::kShelfAutoHideBehaviorAlways) |
| 108 return ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS; |
| 109 return ash::SHELF_AUTO_HIDE_BEHAVIOR_NEVER; |
| 110 } |
| 111 |
| 112 const char* AutoHideBehaviorToPref(ash::ShelfAutoHideBehavior behavior) { |
| 113 switch (behavior) { |
| 114 case ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS: |
| 115 return ash::kShelfAutoHideBehaviorAlways; |
| 116 case ash::SHELF_AUTO_HIDE_BEHAVIOR_NEVER: |
| 117 return ash::kShelfAutoHideBehaviorNever; |
| 118 case ash::SHELF_AUTO_HIDE_ALWAYS_HIDDEN: |
| 119 // This one should not be a valid preference option for now. We only want |
| 120 // to completely hide it when we run in app mode - or while we temporarily |
| 121 // hide the shelf as part of an animation (e.g. the multi user change). |
| 122 return nullptr; |
| 123 } |
| 124 NOTREACHED(); |
| 125 return nullptr; |
| 126 } |
| 127 |
80 } // namespace ash | 128 } // namespace ash |
OLD | NEW |