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