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/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 Loading... |
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; |
485 case ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS: | 488 case ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS: |
486 value = ash::kShelfAutoHideBehaviorAlways; | 489 value = ash::kShelfAutoHideBehaviorAlways; |
487 break; | 490 break; |
488 case ash::SHELF_AUTO_HIDE_BEHAVIOR_NEVER: | 491 case ash::SHELF_AUTO_HIDE_BEHAVIOR_NEVER: |
489 value = ash::kShelfAutoHideBehaviorNever; | 492 value = ash::kShelfAutoHideBehaviorNever; |
490 break; | 493 break; |
491 } | 494 } |
492 profile_->GetPrefs()->SetString(prefs::kShelfAutoHideBehavior, value); | 495 profile_->GetPrefs()->SetString(prefs::kShelfAutoHideBehavior, value); |
493 } | 496 } |
494 | 497 |
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
842 else | 845 else |
843 ++index; | 846 ++index; |
844 } | 847 } |
845 | 848 |
846 // Append unprocessed items from the pref to the end of the model. | 849 // Append unprocessed items from the pref to the end of the model. |
847 for (; pref_app_id != pinned_apps.end(); ++pref_app_id) | 850 for (; pref_app_id != pinned_apps.end(); ++pref_app_id) |
848 DoPinAppWithID(*pref_app_id); | 851 DoPinAppWithID(*pref_app_id); |
849 } | 852 } |
850 | 853 |
851 void ChromeLauncherController::SetShelfAutoHideBehaviorFromPrefs() { | 854 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) | |
857 const std::string behavior_value( | 855 const std::string behavior_value( |
858 profile_->GetPrefs()->GetString(prefs::kShelfAutoHideBehavior)); | 856 profile_->GetPrefs()->GetString(prefs::kShelfAutoHideBehavior)); |
859 ash::ShelfAutoHideBehavior behavior = | 857 ash::ShelfAutoHideBehavior behavior = |
860 ash::SHELF_AUTO_HIDE_BEHAVIOR_NEVER; | 858 ash::SHELF_AUTO_HIDE_BEHAVIOR_DEFAULT; |
861 if (behavior_value == ash::kShelfAutoHideBehaviorAlways) | 859 if (behavior_value == ash::kShelfAutoHideBehaviorNever) |
| 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 Loading... |
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 |
OLD | NEW |