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

Side by Side Diff: chrome/browser/ui/ash/launcher/chrome_launcher_controller.cc

Issue 10987005: Autohide behavior simplified to always/never (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 2 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/ash/chrome_launcher_prefs.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/launcher/chrome_launcher_controller.h" 5 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h"
6 6
7 #include <set> 7 #include <set>
8 #include <vector> 8 #include <vector>
9 9
10 #include "ash/launcher/launcher_model.h" 10 #include "ash/launcher/launcher_model.h"
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after
475 const PrefService::Preference* pref = 475 const PrefService::Preference* pref =
476 profile_->GetPrefs()->FindPreference(prefs::kPinnedLauncherApps); 476 profile_->GetPrefs()->FindPreference(prefs::kPinnedLauncherApps);
477 return pref && pref->IsUserModifiable(); 477 return pref && pref->IsUserModifiable();
478 } 478 }
479 479
480 void ChromeLauncherController::SetAutoHideBehavior( 480 void ChromeLauncherController::SetAutoHideBehavior(
481 ash::ShelfAutoHideBehavior behavior) { 481 ash::ShelfAutoHideBehavior behavior) {
482 ash::Shell::GetInstance()->SetShelfAutoHideBehavior(behavior); 482 ash::Shell::GetInstance()->SetShelfAutoHideBehavior(behavior);
483 const char* value = NULL; 483 const char* value = NULL;
484 switch (behavior) { 484 switch (behavior) {
485 case ash::SHELF_AUTO_HIDE_BEHAVIOR_DEFAULT:
486 value = ash::kShelfAutoHideBehaviorDefault;
487 break;
488 case ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS: 485 case ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS:
489 value = ash::kShelfAutoHideBehaviorAlways; 486 value = ash::kShelfAutoHideBehaviorAlways;
490 break; 487 break;
491 case ash::SHELF_AUTO_HIDE_BEHAVIOR_NEVER: 488 case ash::SHELF_AUTO_HIDE_BEHAVIOR_NEVER:
492 value = ash::kShelfAutoHideBehaviorNever; 489 value = ash::kShelfAutoHideBehaviorNever;
493 break; 490 break;
494 } 491 }
495 profile_->GetPrefs()->SetString(prefs::kShelfAutoHideBehavior, value); 492 profile_->GetPrefs()->SetString(prefs::kShelfAutoHideBehavior, value);
496 } 493 }
497 494
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after
845 else 842 else
846 ++index; 843 ++index;
847 } 844 }
848 845
849 // Append unprocessed items from the pref to the end of the model. 846 // Append unprocessed items from the pref to the end of the model.
850 for (; pref_app_id != pinned_apps.end(); ++pref_app_id) 847 for (; pref_app_id != pinned_apps.end(); ++pref_app_id)
851 DoPinAppWithID(*pref_app_id); 848 DoPinAppWithID(*pref_app_id);
852 } 849 }
853 850
854 void ChromeLauncherController::SetShelfAutoHideBehaviorFromPrefs() { 851 void ChromeLauncherController::SetShelfAutoHideBehaviorFromPrefs() {
852 // Note: To maintain sync compatibility with old images of chrome/chromeos
853 // the set of values that may be encountered includes the now-extinct
854 // "Default" as well as "Never" and "Always", "Default" should now
855 // be treated as "Never".
856 // (http://code.google.com/p/chromium/issues/detail?id=146773)
855 const std::string behavior_value( 857 const std::string behavior_value(
856 profile_->GetPrefs()->GetString(prefs::kShelfAutoHideBehavior)); 858 profile_->GetPrefs()->GetString(prefs::kShelfAutoHideBehavior));
857 ash::ShelfAutoHideBehavior behavior = 859 ash::ShelfAutoHideBehavior behavior =
858 ash::SHELF_AUTO_HIDE_BEHAVIOR_DEFAULT; 860 ash::SHELF_AUTO_HIDE_BEHAVIOR_NEVER;
859 if (behavior_value == ash::kShelfAutoHideBehaviorNever) 861 if (behavior_value == ash::kShelfAutoHideBehaviorAlways)
860 behavior = ash::SHELF_AUTO_HIDE_BEHAVIOR_NEVER;
861 else if (behavior_value == ash::kShelfAutoHideBehaviorAlways)
862 behavior = ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS; 862 behavior = ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS;
863 ash::Shell::GetInstance()->SetShelfAutoHideBehavior(behavior); 863 ash::Shell::GetInstance()->SetShelfAutoHideBehavior(behavior);
864 } 864 }
865 865
866 void ChromeLauncherController::SetShelfAlignmentFromPrefs() { 866 void ChromeLauncherController::SetShelfAlignmentFromPrefs() {
867 if (!CommandLine::ForCurrentProcess()->HasSwitch( 867 if (!CommandLine::ForCurrentProcess()->HasSwitch(
868 switches::kShowLauncherAlignmentMenu)) 868 switches::kShowLauncherAlignmentMenu))
869 return; 869 return;
870 870
871 const std::string alignment_value( 871 const std::string alignment_value(
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
981 if (current_tab) { 981 if (current_tab) {
982 content::NavigationEntry* active_entry = 982 content::NavigationEntry* active_entry =
983 current_tab->GetController().GetActiveEntry(); 983 current_tab->GetController().GetActiveEntry();
984 if (active_entry && 984 if (active_entry &&
985 active_entry->GetURL() == GURL(chrome::kChromeUINewTabURL)) 985 active_entry->GetURL() == GURL(chrome::kChromeUINewTabURL))
986 return true; 986 return true;
987 } 987 }
988 return false; 988 return false;
989 } 989 }
990 990
OLDNEW
« no previous file with comments | « chrome/browser/ui/ash/chrome_launcher_prefs.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698