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

Unified Diff: chrome/browser/ui/ash/launcher/chrome_launcher_controller.cc

Issue 1839223003: Add basic Chrome interaction with the mash shelf. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Sync and rebase. Created 4 years, 8 months 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/ash/launcher/chrome_launcher_controller.cc
diff --git a/chrome/browser/ui/ash/launcher/chrome_launcher_controller.cc b/chrome/browser/ui/ash/launcher/chrome_launcher_controller.cc
index f7b747d0e6debdc473c13c07f86e89a486d0bbff..0ae3bab2989fd498a070d4043a3e493dd50c3514 100644
--- a/chrome/browser/ui/ash/launcher/chrome_launcher_controller.cc
+++ b/chrome/browser/ui/ash/launcher/chrome_launcher_controller.cc
@@ -221,19 +221,9 @@ ash::ShelfAutoHideBehavior GetShelfAutoHideBehaviorFromPrefs(
return ash::SHELF_AUTO_HIDE_ALWAYS_HIDDEN;
// See comment in |kShelfAlignment| as to why we consider two prefs.
- const std::string behavior_value(
- GetPrefForRootWindow(profile->GetPrefs(),
- root_window,
- prefs::kShelfAutoHideBehaviorLocal,
- prefs::kShelfAutoHideBehavior));
-
- // Note: To maintain sync compatibility with old images of chrome/chromeos
- // the set of values that may be encountered includes the now-extinct
- // "Default" as well as "Never" and "Always", "Default" should now
- // be treated as "Never" (http://crbug.com/146773).
- if (behavior_value == ash::kShelfAutoHideBehaviorAlways)
- return ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS;
- return ash::SHELF_AUTO_HIDE_BEHAVIOR_NEVER;
+ return ash::AutoHideBehaviorFromPref(GetPrefForRootWindow(
+ profile->GetPrefs(), root_window, prefs::kShelfAutoHideBehaviorLocal,
+ prefs::kShelfAutoHideBehavior));
}
// Gets the shelf alignment from prefs for a root window.
@@ -242,17 +232,9 @@ ash::ShelfAlignment GetShelfAlignmentFromPrefs(Profile* profile,
DCHECK(profile);
// See comment in |kShelfAlignment| as to why we consider two prefs.
- const std::string alignment_value(
- GetPrefForRootWindow(profile->GetPrefs(),
- root_window,
- prefs::kShelfAlignmentLocal,
- prefs::kShelfAlignment));
- if (alignment_value == ash::kShelfAlignmentLeft)
- return ash::SHELF_ALIGNMENT_LEFT;
- else if (alignment_value == ash::kShelfAlignmentRight)
- return ash::SHELF_ALIGNMENT_RIGHT;
- // Default to bottom.
- return ash::SHELF_ALIGNMENT_BOTTOM;
+ return ash::AlignmentFromPref(GetPrefForRootWindow(
+ profile->GetPrefs(), root_window, prefs::kShelfAlignmentLocal,
+ prefs::kShelfAlignment));
}
// If prefs have synced and no user-set value exists at |local_path|, the value
@@ -1153,19 +1135,7 @@ void ChromeLauncherController::OnShelfCreated(ash::Shelf* shelf) {
void ChromeLauncherController::OnShelfDestroyed(ash::Shelf* shelf) {}
void ChromeLauncherController::OnShelfAlignmentChanged(ash::Shelf* shelf) {
- const char* value = nullptr;
- switch (shelf->GetAlignment()) {
- case ash::SHELF_ALIGNMENT_BOTTOM:
- value = ash::kShelfAlignmentBottom;
- break;
- case ash::SHELF_ALIGNMENT_LEFT:
- value = ash::kShelfAlignmentLeft;
- break;
- case ash::SHELF_ALIGNMENT_RIGHT:
- value = ash::kShelfAlignmentRight;
- break;
- }
-
+ const char* value = ash::AlignmentToPref(shelf->GetAlignment());
aura::Window* root_window =
shelf->shelf_widget()->GetNativeWindow()->GetRootWindow();
@@ -1181,20 +1151,9 @@ void ChromeLauncherController::OnShelfAlignmentChanged(ash::Shelf* shelf) {
void ChromeLauncherController::OnShelfAutoHideBehaviorChanged(
ash::Shelf* shelf) {
- const char* value = nullptr;
- switch (shelf->GetAutoHideBehavior()) {
- case ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS:
- value = ash::kShelfAutoHideBehaviorAlways;
- break;
- case ash::SHELF_AUTO_HIDE_BEHAVIOR_NEVER:
- value = ash::kShelfAutoHideBehaviorNever;
- break;
- case ash::SHELF_AUTO_HIDE_ALWAYS_HIDDEN:
- // This one should not be a valid preference option for now. We only want
- // to completely hide it when we run in app mode - or while we temporarily
- // hide the shelf as part of an animation (e.g. the multi user change).
- return;
- }
+ const char* value = ash::AutoHideBehaviorToPref(shelf->GetAutoHideBehavior());
+ if (!value)
+ return;
aura::Window* root_window =
shelf->shelf_widget()->GetNativeWindow()->GetRootWindow();
« no previous file with comments | « chrome/browser/ui/ash/chrome_launcher_prefs.cc ('k') | chrome/browser/ui/ash/launcher/chrome_mash_shelf_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698