Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(137)

Side by Side Diff: chrome/browser/ui/ash/chrome_launcher_prefs.cc

Issue 2523723002: Update display::Display::kInvalidDisplayID constant. (Closed)
Patch Set: Fix includes. Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <set> 9 #include <set>
10 10
(...skipping 10 matching lines...) Expand all
21 #include "chrome/browser/ui/ash/launcher/launcher_controller_helper.h" 21 #include "chrome/browser/ui/ash/launcher/launcher_controller_helper.h"
22 #include "chrome/common/extensions/extension_constants.h" 22 #include "chrome/common/extensions/extension_constants.h"
23 #include "chrome/common/pref_names.h" 23 #include "chrome/common/pref_names.h"
24 #include "components/pref_registry/pref_registry_syncable.h" 24 #include "components/pref_registry/pref_registry_syncable.h"
25 #include "components/prefs/pref_service.h" 25 #include "components/prefs/pref_service.h"
26 #include "components/prefs/scoped_user_pref_update.h" 26 #include "components/prefs/scoped_user_pref_update.h"
27 #include "components/sync/model/string_ordinal.h" 27 #include "components/sync/model/string_ordinal.h"
28 #include "components/sync_preferences/pref_service_syncable.h" 28 #include "components/sync_preferences/pref_service_syncable.h"
29 #include "ui/display/display.h" 29 #include "ui/display/display.h"
30 #include "ui/display/screen.h" 30 #include "ui/display/screen.h"
31 #include "ui/display/types/display_constants.h"
31 32
32 namespace ash { 33 namespace ash {
33 namespace launcher { 34 namespace launcher {
34 35
35 namespace { 36 namespace {
36 37
37 // App ID of default pinned apps. 38 // App ID of default pinned apps.
38 const char* kDefaultPinnedApps[] = { 39 const char* kDefaultPinnedApps[] = {
39 extension_misc::kGmailAppId, extension_misc::kGoogleDocAppId, 40 extension_misc::kGmailAppId, extension_misc::kGoogleDocAppId,
40 extension_misc::kYoutubeAppId, ArcSupportHost::kHostAppId}; 41 extension_misc::kYoutubeAppId, ArcSupportHost::kHostAppId};
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 335
335 std::unique_ptr<base::DictionaryValue> CreateAppDict( 336 std::unique_ptr<base::DictionaryValue> CreateAppDict(
336 const AppLauncherId& app_launcher_id) { 337 const AppLauncherId& app_launcher_id) {
337 auto app_value = base::MakeUnique<base::DictionaryValue>(); 338 auto app_value = base::MakeUnique<base::DictionaryValue>();
338 app_value->SetString(kPinnedAppsPrefAppIDPath, app_launcher_id.ToString()); 339 app_value->SetString(kPinnedAppsPrefAppIDPath, app_launcher_id.ToString());
339 return app_value; 340 return app_value;
340 } 341 }
341 342
342 ShelfAutoHideBehavior GetShelfAutoHideBehaviorPref(PrefService* prefs, 343 ShelfAutoHideBehavior GetShelfAutoHideBehaviorPref(PrefService* prefs,
343 int64_t display_id) { 344 int64_t display_id) {
344 DCHECK_NE(display_id, display::Display::kInvalidDisplayID); 345 DCHECK_NE(display_id, display::kInvalidDisplayId);
345 346
346 // Don't show the shelf in app mode. 347 // Don't show the shelf in app mode.
347 if (chrome::IsRunningInAppMode()) 348 if (chrome::IsRunningInAppMode())
348 return SHELF_AUTO_HIDE_ALWAYS_HIDDEN; 349 return SHELF_AUTO_HIDE_ALWAYS_HIDDEN;
349 350
350 // See comment in |kShelfAlignment| as to why we consider two prefs. 351 // See comment in |kShelfAlignment| as to why we consider two prefs.
351 return AutoHideBehaviorFromPref( 352 return AutoHideBehaviorFromPref(
352 GetPerDisplayPref(prefs, display_id, prefs::kShelfAutoHideBehaviorLocal, 353 GetPerDisplayPref(prefs, display_id, prefs::kShelfAutoHideBehaviorLocal,
353 prefs::kShelfAutoHideBehavior)); 354 prefs::kShelfAutoHideBehavior));
354 } 355 }
355 356
356 void SetShelfAutoHideBehaviorPref(PrefService* prefs, 357 void SetShelfAutoHideBehaviorPref(PrefService* prefs,
357 int64_t display_id, 358 int64_t display_id,
358 ShelfAutoHideBehavior behavior) { 359 ShelfAutoHideBehavior behavior) {
359 DCHECK_NE(display_id, display::Display::kInvalidDisplayID); 360 DCHECK_NE(display_id, display::kInvalidDisplayId);
360 361
361 const char* value = AutoHideBehaviorToPref(behavior); 362 const char* value = AutoHideBehaviorToPref(behavior);
362 if (!value) 363 if (!value)
363 return; 364 return;
364 365
365 SetPerDisplayPref(prefs, display_id, prefs::kShelfAutoHideBehavior, value); 366 SetPerDisplayPref(prefs, display_id, prefs::kShelfAutoHideBehavior, value);
366 if (display_id == display::Screen::GetScreen()->GetPrimaryDisplay().id()) { 367 if (display_id == display::Screen::GetScreen()->GetPrimaryDisplay().id()) {
367 // See comment in |kShelfAlignment| about why we have two prefs here. 368 // See comment in |kShelfAlignment| about why we have two prefs here.
368 prefs->SetString(prefs::kShelfAutoHideBehaviorLocal, value); 369 prefs->SetString(prefs::kShelfAutoHideBehaviorLocal, value);
369 prefs->SetString(prefs::kShelfAutoHideBehavior, value); 370 prefs->SetString(prefs::kShelfAutoHideBehavior, value);
370 } 371 }
371 } 372 }
372 373
373 ShelfAlignment GetShelfAlignmentPref(PrefService* prefs, int64_t display_id) { 374 ShelfAlignment GetShelfAlignmentPref(PrefService* prefs, int64_t display_id) {
374 DCHECK_NE(display_id, display::Display::kInvalidDisplayID); 375 DCHECK_NE(display_id, display::kInvalidDisplayId);
375 376
376 // See comment in |kShelfAlignment| as to why we consider two prefs. 377 // See comment in |kShelfAlignment| as to why we consider two prefs.
377 return AlignmentFromPref(GetPerDisplayPref( 378 return AlignmentFromPref(GetPerDisplayPref(
378 prefs, display_id, prefs::kShelfAlignmentLocal, prefs::kShelfAlignment)); 379 prefs, display_id, prefs::kShelfAlignmentLocal, prefs::kShelfAlignment));
379 } 380 }
380 381
381 void SetShelfAlignmentPref(PrefService* prefs, 382 void SetShelfAlignmentPref(PrefService* prefs,
382 int64_t display_id, 383 int64_t display_id,
383 ShelfAlignment alignment) { 384 ShelfAlignment alignment) {
384 DCHECK_NE(display_id, display::Display::kInvalidDisplayID); 385 DCHECK_NE(display_id, display::kInvalidDisplayId);
385 386
386 const char* value = AlignmentToPref(alignment); 387 const char* value = AlignmentToPref(alignment);
387 if (!value) 388 if (!value)
388 return; 389 return;
389 390
390 SetPerDisplayPref(prefs, display_id, prefs::kShelfAlignment, value); 391 SetPerDisplayPref(prefs, display_id, prefs::kShelfAlignment, value);
391 if (display_id == display::Screen::GetScreen()->GetPrimaryDisplay().id()) { 392 if (display_id == display::Screen::GetScreen()->GetPrimaryDisplay().id()) {
392 // See comment in |kShelfAlignment| as to why we consider two prefs. 393 // See comment in |kShelfAlignment| as to why we consider two prefs.
393 prefs->SetString(prefs::kShelfAlignmentLocal, value); 394 prefs->SetString(prefs::kShelfAlignmentLocal, value);
394 prefs->SetString(prefs::kShelfAlignment, value); 395 prefs->SetString(prefs::kShelfAlignment, value);
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after
738 pin_position = position_before.CreateAfter(); 739 pin_position = position_before.CreateAfter();
739 else if (position_after.IsValid()) 740 else if (position_after.IsValid())
740 pin_position = position_after.CreateBefore(); 741 pin_position = position_after.CreateBefore();
741 else 742 else
742 pin_position = syncer::StringOrdinal::CreateInitialOrdinal(); 743 pin_position = syncer::StringOrdinal::CreateInitialOrdinal();
743 app_service->SetPinPosition(app_launcher_id_str, pin_position); 744 app_service->SetPinPosition(app_launcher_id_str, pin_position);
744 } 745 }
745 746
746 } // namespace launcher 747 } // namespace launcher
747 } // namespace ash 748 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698