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_per_browser.
h" | 5 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller_per_browser.
h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "ash/launcher/launcher_model.h" | 9 #include "ash/launcher/launcher_model.h" |
10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 #include "chrome/browser/ui/browser.h" | 31 #include "chrome/browser/ui/browser.h" |
32 #include "chrome/browser/ui/browser_commands.h" | 32 #include "chrome/browser/ui/browser_commands.h" |
33 #include "chrome/browser/ui/browser_finder.h" | 33 #include "chrome/browser/ui/browser_finder.h" |
34 #include "chrome/browser/ui/browser_tabstrip.h" | 34 #include "chrome/browser/ui/browser_tabstrip.h" |
35 #include "chrome/browser/ui/browser_window.h" | 35 #include "chrome/browser/ui/browser_window.h" |
36 #include "chrome/browser/ui/extensions/application_launch.h" | 36 #include "chrome/browser/ui/extensions/application_launch.h" |
37 #include "chrome/browser/ui/extensions/extension_enable_flow.h" | 37 #include "chrome/browser/ui/extensions/extension_enable_flow.h" |
38 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 38 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
39 #include "chrome/browser/web_applications/web_app.h" | 39 #include "chrome/browser/web_applications/web_app.h" |
40 #include "chrome/common/chrome_notification_types.h" | 40 #include "chrome/common/chrome_notification_types.h" |
| 41 #include "chrome/common/chrome_switches.h" |
41 #include "chrome/common/extensions/extension.h" | 42 #include "chrome/common/extensions/extension.h" |
42 #include "chrome/common/extensions/extension_resource.h" | 43 #include "chrome/common/extensions/extension_resource.h" |
43 #include "chrome/common/pref_names.h" | 44 #include "chrome/common/pref_names.h" |
44 #include "chrome/common/url_constants.h" | 45 #include "chrome/common/url_constants.h" |
45 #include "content/public/browser/navigation_entry.h" | 46 #include "content/public/browser/navigation_entry.h" |
46 #include "content/public/browser/notification_service.h" | 47 #include "content/public/browser/notification_service.h" |
47 #include "content/public/browser/web_contents.h" | 48 #include "content/public/browser/web_contents.h" |
48 #include "extensions/common/url_pattern.h" | 49 #include "extensions/common/url_pattern.h" |
49 #include "grit/theme_resources.h" | 50 #include "grit/theme_resources.h" |
50 #include "ui/aura/root_window.h" | 51 #include "ui/aura/root_window.h" |
(...skipping 600 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
651 | 652 |
652 bool ChromeLauncherControllerPerBrowser::CanPin() const { | 653 bool ChromeLauncherControllerPerBrowser::CanPin() const { |
653 const PrefService::Preference* pref = | 654 const PrefService::Preference* pref = |
654 profile_->GetPrefs()->FindPreference(prefs::kPinnedLauncherApps); | 655 profile_->GetPrefs()->FindPreference(prefs::kPinnedLauncherApps); |
655 return pref && pref->IsUserModifiable(); | 656 return pref && pref->IsUserModifiable(); |
656 } | 657 } |
657 | 658 |
658 ash::ShelfAutoHideBehavior | 659 ash::ShelfAutoHideBehavior |
659 ChromeLauncherControllerPerBrowser::GetShelfAutoHideBehavior( | 660 ChromeLauncherControllerPerBrowser::GetShelfAutoHideBehavior( |
660 aura::RootWindow* root_window) const { | 661 aura::RootWindow* root_window) const { |
| 662 // Don't show the shelf in the app mode. |
| 663 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
| 664 if (command_line->HasSwitch(switches::kAppId) && |
| 665 command_line->HasSwitch(switches::kForceAppMode)) { |
| 666 return ash::SHELF_AUTO_HIDE_ALWAYS_HIDDEN; |
| 667 } |
| 668 |
661 // See comment in |kShelfAlignment| as to why we consider two prefs. | 669 // See comment in |kShelfAlignment| as to why we consider two prefs. |
662 const std::string behavior_value( | 670 const std::string behavior_value( |
663 GetPrefForRootWindow(profile_->GetPrefs(), | 671 GetPrefForRootWindow(profile_->GetPrefs(), |
664 root_window, | 672 root_window, |
665 prefs::kShelfAutoHideBehaviorLocal, | 673 prefs::kShelfAutoHideBehaviorLocal, |
666 prefs::kShelfAutoHideBehavior)); | 674 prefs::kShelfAutoHideBehavior)); |
667 | 675 |
668 // Note: To maintain sync compatibility with old images of chrome/chromeos | 676 // Note: To maintain sync compatibility with old images of chrome/chromeos |
669 // the set of values that may be encountered includes the now-extinct | 677 // the set of values that may be encountered includes the now-extinct |
670 // "Default" as well as "Never" and "Always", "Default" should now | 678 // "Default" as well as "Never" and "Always", "Default" should now |
(...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1123 ash::ShelfAutoHideBehavior behavior, | 1131 ash::ShelfAutoHideBehavior behavior, |
1124 aura::RootWindow* root_window) { | 1132 aura::RootWindow* root_window) { |
1125 const char* value = NULL; | 1133 const char* value = NULL; |
1126 switch (behavior) { | 1134 switch (behavior) { |
1127 case ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS: | 1135 case ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS: |
1128 value = ash::kShelfAutoHideBehaviorAlways; | 1136 value = ash::kShelfAutoHideBehaviorAlways; |
1129 break; | 1137 break; |
1130 case ash::SHELF_AUTO_HIDE_BEHAVIOR_NEVER: | 1138 case ash::SHELF_AUTO_HIDE_BEHAVIOR_NEVER: |
1131 value = ash::kShelfAutoHideBehaviorNever; | 1139 value = ash::kShelfAutoHideBehaviorNever; |
1132 break; | 1140 break; |
| 1141 case ash::SHELF_AUTO_HIDE_ALWAYS_HIDDEN: |
| 1142 // This one should not be a valid preference option for now. We only want |
| 1143 // to completely hide it when we run app mode. |
| 1144 return; |
1133 } | 1145 } |
1134 | 1146 |
1135 UpdatePerDisplayPref( | 1147 UpdatePerDisplayPref( |
1136 profile_->GetPrefs(), root_window, prefs::kShelfAutoHideBehavior, value); | 1148 profile_->GetPrefs(), root_window, prefs::kShelfAutoHideBehavior, value); |
1137 | 1149 |
1138 if (root_window == ash::Shell::GetPrimaryRootWindow()) { | 1150 if (root_window == ash::Shell::GetPrimaryRootWindow()) { |
1139 // See comment in |kShelfAlignment| about why we have two prefs here. | 1151 // See comment in |kShelfAlignment| about why we have two prefs here. |
1140 profile_->GetPrefs()->SetString(prefs::kShelfAutoHideBehaviorLocal, value); | 1152 profile_->GetPrefs()->SetString(prefs::kShelfAutoHideBehaviorLocal, value); |
1141 profile_->GetPrefs()->SetString(prefs::kShelfAutoHideBehavior, value); | 1153 profile_->GetPrefs()->SetString(prefs::kShelfAutoHideBehavior, value); |
1142 } | 1154 } |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1252 void ChromeLauncherControllerPerBrowser::SetAppIconLoaderForTest( | 1264 void ChromeLauncherControllerPerBrowser::SetAppIconLoaderForTest( |
1253 ash::AppIconLoader* loader) { | 1265 ash::AppIconLoader* loader) { |
1254 app_icon_loader_.reset(loader); | 1266 app_icon_loader_.reset(loader); |
1255 } | 1267 } |
1256 | 1268 |
1257 const std::string& | 1269 const std::string& |
1258 ChromeLauncherControllerPerBrowser::GetAppIdFromLauncherIdForTest( | 1270 ChromeLauncherControllerPerBrowser::GetAppIdFromLauncherIdForTest( |
1259 ash::LauncherID id) { | 1271 ash::LauncherID id) { |
1260 return id_to_item_controller_map_[id]->app_id(); | 1272 return id_to_item_controller_map_[id]->app_id(); |
1261 } | 1273 } |
OLD | NEW |