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 |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "base/strings/string_number_conversions.h" | 12 #include "base/strings/string_number_conversions.h" |
13 #include "base/values.h" | 13 #include "base/values.h" |
14 #include "chrome/browser/app_mode/app_mode_utils.h" | 14 #include "chrome/browser/app_mode/app_mode_utils.h" |
15 #include "chrome/common/extensions/extension_constants.h" | 15 #include "chrome/common/extensions/extension_constants.h" |
16 #include "chrome/common/pref_names.h" | 16 #include "chrome/common/pref_names.h" |
17 #include "components/pref_registry/pref_registry_syncable.h" | 17 #include "components/pref_registry/pref_registry_syncable.h" |
18 #include "components/prefs/pref_service.h" | 18 #include "components/prefs/pref_service.h" |
19 #include "components/prefs/scoped_user_pref_update.h" | 19 #include "components/prefs/scoped_user_pref_update.h" |
20 #include "ui/gfx/screen.h" | 20 #include "ui/display/screen.h" |
21 | 21 |
22 namespace ash { | 22 namespace ash { |
23 | 23 |
24 namespace { | 24 namespace { |
25 | 25 |
26 // App ID of default pinned apps. | 26 // App ID of default pinned apps. |
27 const char* kDefaultPinnedApps[] = { | 27 const char* kDefaultPinnedApps[] = { |
28 extension_misc::kGmailAppId, | 28 extension_misc::kGmailAppId, |
29 extension_misc::kGoogleDocAppId, | 29 extension_misc::kGoogleDocAppId, |
30 extension_misc::kYoutubeAppId, | 30 extension_misc::kYoutubeAppId, |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 void SetShelfAutoHideBehaviorPref(PrefService* prefs, | 228 void SetShelfAutoHideBehaviorPref(PrefService* prefs, |
229 int64_t display_id, | 229 int64_t display_id, |
230 ShelfAutoHideBehavior behavior) { | 230 ShelfAutoHideBehavior behavior) { |
231 DCHECK_GE(display_id, 0); | 231 DCHECK_GE(display_id, 0); |
232 | 232 |
233 const char* value = AutoHideBehaviorToPref(behavior); | 233 const char* value = AutoHideBehaviorToPref(behavior); |
234 if (!value) | 234 if (!value) |
235 return; | 235 return; |
236 | 236 |
237 SetPerDisplayPref(prefs, display_id, prefs::kShelfAutoHideBehavior, value); | 237 SetPerDisplayPref(prefs, display_id, prefs::kShelfAutoHideBehavior, value); |
238 if (display_id == gfx::Screen::GetScreen()->GetPrimaryDisplay().id()) { | 238 if (display_id == display::Screen::GetScreen()->GetPrimaryDisplay().id()) { |
239 // See comment in |kShelfAlignment| about why we have two prefs here. | 239 // See comment in |kShelfAlignment| about why we have two prefs here. |
240 prefs->SetString(prefs::kShelfAutoHideBehaviorLocal, value); | 240 prefs->SetString(prefs::kShelfAutoHideBehaviorLocal, value); |
241 prefs->SetString(prefs::kShelfAutoHideBehavior, value); | 241 prefs->SetString(prefs::kShelfAutoHideBehavior, value); |
242 } | 242 } |
243 } | 243 } |
244 | 244 |
245 wm::ShelfAlignment GetShelfAlignmentPref(PrefService* prefs, | 245 wm::ShelfAlignment GetShelfAlignmentPref(PrefService* prefs, |
246 int64_t display_id) { | 246 int64_t display_id) { |
247 DCHECK_GE(display_id, 0); | 247 DCHECK_GE(display_id, 0); |
248 | 248 |
249 // See comment in |kShelfAlignment| as to why we consider two prefs. | 249 // See comment in |kShelfAlignment| as to why we consider two prefs. |
250 return AlignmentFromPref(GetPerDisplayPref( | 250 return AlignmentFromPref(GetPerDisplayPref( |
251 prefs, display_id, prefs::kShelfAlignmentLocal, prefs::kShelfAlignment)); | 251 prefs, display_id, prefs::kShelfAlignmentLocal, prefs::kShelfAlignment)); |
252 } | 252 } |
253 | 253 |
254 void SetShelfAlignmentPref(PrefService* prefs, | 254 void SetShelfAlignmentPref(PrefService* prefs, |
255 int64_t display_id, | 255 int64_t display_id, |
256 wm::ShelfAlignment alignment) { | 256 wm::ShelfAlignment alignment) { |
257 DCHECK_GE(display_id, 0); | 257 DCHECK_GE(display_id, 0); |
258 | 258 |
259 const char* value = AlignmentToPref(alignment); | 259 const char* value = AlignmentToPref(alignment); |
260 if (!value) | 260 if (!value) |
261 return; | 261 return; |
262 | 262 |
263 SetPerDisplayPref(prefs, display_id, prefs::kShelfAlignment, value); | 263 SetPerDisplayPref(prefs, display_id, prefs::kShelfAlignment, value); |
264 if (display_id == gfx::Screen::GetScreen()->GetPrimaryDisplay().id()) { | 264 if (display_id == display::Screen::GetScreen()->GetPrimaryDisplay().id()) { |
265 // See comment in |kShelfAlignment| as to why we consider two prefs. | 265 // See comment in |kShelfAlignment| as to why we consider two prefs. |
266 prefs->SetString(prefs::kShelfAlignmentLocal, value); | 266 prefs->SetString(prefs::kShelfAlignmentLocal, value); |
267 prefs->SetString(prefs::kShelfAlignment, value); | 267 prefs->SetString(prefs::kShelfAlignment, value); |
268 } | 268 } |
269 } | 269 } |
270 | 270 |
271 } // namespace ash | 271 } // namespace ash |
OLD | NEW |