Chromium Code Reviews| 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_app.h" | 5 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller_per_app.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/launcher/launcher_util.h" | 10 #include "ash/launcher/launcher_util.h" |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 38 #include "chrome/browser/ui/browser_commands.h" | 38 #include "chrome/browser/ui/browser_commands.h" |
| 39 #include "chrome/browser/ui/browser_finder.h" | 39 #include "chrome/browser/ui/browser_finder.h" |
| 40 #include "chrome/browser/ui/browser_list.h" | 40 #include "chrome/browser/ui/browser_list.h" |
| 41 #include "chrome/browser/ui/browser_tabstrip.h" | 41 #include "chrome/browser/ui/browser_tabstrip.h" |
| 42 #include "chrome/browser/ui/browser_window.h" | 42 #include "chrome/browser/ui/browser_window.h" |
| 43 #include "chrome/browser/ui/extensions/application_launch.h" | 43 #include "chrome/browser/ui/extensions/application_launch.h" |
| 44 #include "chrome/browser/ui/extensions/extension_enable_flow.h" | 44 #include "chrome/browser/ui/extensions/extension_enable_flow.h" |
| 45 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 45 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 46 #include "chrome/browser/web_applications/web_app.h" | 46 #include "chrome/browser/web_applications/web_app.h" |
| 47 #include "chrome/common/chrome_notification_types.h" | 47 #include "chrome/common/chrome_notification_types.h" |
| 48 #include "chrome/common/chrome_switches.h" | |
| 48 #include "chrome/common/extensions/extension.h" | 49 #include "chrome/common/extensions/extension.h" |
| 49 #include "chrome/common/extensions/extension_resource.h" | 50 #include "chrome/common/extensions/extension_resource.h" |
| 50 #include "chrome/common/pref_names.h" | 51 #include "chrome/common/pref_names.h" |
| 51 #include "chrome/common/url_constants.h" | 52 #include "chrome/common/url_constants.h" |
| 52 #include "content/public/browser/navigation_entry.h" | 53 #include "content/public/browser/navigation_entry.h" |
| 53 #include "content/public/browser/notification_service.h" | 54 #include "content/public/browser/notification_service.h" |
| 54 #include "content/public/browser/web_contents.h" | 55 #include "content/public/browser/web_contents.h" |
| 55 #include "extensions/common/url_pattern.h" | 56 #include "extensions/common/url_pattern.h" |
| 56 #include "grit/ash_resources.h" | 57 #include "grit/ash_resources.h" |
| 57 #include "grit/chromium_strings.h" | 58 #include "grit/chromium_strings.h" |
| (...skipping 566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 624 return model_; | 625 return model_; |
| 625 } | 626 } |
| 626 | 627 |
| 627 Profile* ChromeLauncherControllerPerApp::profile() { | 628 Profile* ChromeLauncherControllerPerApp::profile() { |
| 628 return profile_; | 629 return profile_; |
| 629 } | 630 } |
| 630 | 631 |
| 631 ash::ShelfAutoHideBehavior | 632 ash::ShelfAutoHideBehavior |
| 632 ChromeLauncherControllerPerApp::GetShelfAutoHideBehavior( | 633 ChromeLauncherControllerPerApp::GetShelfAutoHideBehavior( |
| 633 aura::RootWindow* root_window) const { | 634 aura::RootWindow* root_window) const { |
| 635 // Don't show the shelf in app mode. | |
| 636 CommandLine* command_line = CommandLine::ForCurrentProcess(); | |
| 637 if (command_line->HasSwitch(switches::kAppId) && | |
| 638 command_line->HasSwitch(switches::kForceAppMode)) { | |
| 639 return ash::SHELF_AUTO_HIDE_ALWAYS_HIDDEN; | |
| 640 } | |
| 641 | |
| 634 // See comment in |kShelfAlignment| as to why we consider two prefs. | 642 // See comment in |kShelfAlignment| as to why we consider two prefs. |
| 635 const std::string behavior_value( | 643 const std::string behavior_value( |
| 636 GetPrefForRootWindow(profile_->GetPrefs(), | 644 GetPrefForRootWindow(profile_->GetPrefs(), |
| 637 root_window, | 645 root_window, |
| 638 prefs::kShelfAutoHideBehaviorLocal, | 646 prefs::kShelfAutoHideBehaviorLocal, |
| 639 prefs::kShelfAutoHideBehavior)); | 647 prefs::kShelfAutoHideBehavior)); |
| 640 | 648 |
| 641 // Note: To maintain sync compatibility with old images of chrome/chromeos | 649 // Note: To maintain sync compatibility with old images of chrome/chromeos |
| 642 // the set of values that may be encountered includes the now-extinct | 650 // the set of values that may be encountered includes the now-extinct |
| 643 // "Default" as well as "Never" and "Always", "Default" should now | 651 // "Default" as well as "Never" and "Always", "Default" should now |
| (...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1195 ash::ShelfAutoHideBehavior behavior, | 1203 ash::ShelfAutoHideBehavior behavior, |
| 1196 aura::RootWindow* root_window) { | 1204 aura::RootWindow* root_window) { |
| 1197 const char* value = NULL; | 1205 const char* value = NULL; |
| 1198 switch (behavior) { | 1206 switch (behavior) { |
| 1199 case ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS: | 1207 case ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS: |
| 1200 value = ash::kShelfAutoHideBehaviorAlways; | 1208 value = ash::kShelfAutoHideBehaviorAlways; |
| 1201 break; | 1209 break; |
| 1202 case ash::SHELF_AUTO_HIDE_BEHAVIOR_NEVER: | 1210 case ash::SHELF_AUTO_HIDE_BEHAVIOR_NEVER: |
| 1203 value = ash::kShelfAutoHideBehaviorNever; | 1211 value = ash::kShelfAutoHideBehaviorNever; |
| 1204 break; | 1212 break; |
| 1213 case ash::SHELF_AUTO_HIDE_ALWAYS_HIDDEN: | |
| 1214 // This one should not be a valid preference option for now. We only want | |
| 1215 // to completely hide it when we run app mode. | |
|
oshima
2013/01/30 00:28:31
NOTREACHED()
zel
2013/01/30 01:01:34
Done.
| |
| 1216 return; | |
| 1205 } | 1217 } |
| 1206 | 1218 |
| 1207 UpdatePerDisplayPref( | 1219 UpdatePerDisplayPref( |
| 1208 profile_->GetPrefs(), root_window, prefs::kShelfAutoHideBehavior, value); | 1220 profile_->GetPrefs(), root_window, prefs::kShelfAutoHideBehavior, value); |
| 1209 | 1221 |
| 1210 if (root_window == ash::Shell::GetPrimaryRootWindow()) { | 1222 if (root_window == ash::Shell::GetPrimaryRootWindow()) { |
| 1211 // See comment in |kShelfAlignment| about why we have two prefs here. | 1223 // See comment in |kShelfAlignment| about why we have two prefs here. |
| 1212 profile_->GetPrefs()->SetString(prefs::kShelfAutoHideBehaviorLocal, value); | 1224 profile_->GetPrefs()->SetString(prefs::kShelfAutoHideBehaviorLocal, value); |
| 1213 profile_->GetPrefs()->SetString(prefs::kShelfAutoHideBehavior, value); | 1225 profile_->GetPrefs()->SetString(prefs::kShelfAutoHideBehavior, value); |
| 1214 } | 1226 } |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1329 WebContents* web_contents = | 1341 WebContents* web_contents = |
| 1330 tab_strip->GetWebContentsAt(tab_strip->active_index()); | 1342 tab_strip->GetWebContentsAt(tab_strip->active_index()); |
| 1331 gfx::Image app_icon = GetAppListIcon(web_contents); | 1343 gfx::Image app_icon = GetAppListIcon(web_contents); |
| 1332 items->push_back(new ChromeLauncherAppMenuItemBrowser( | 1344 items->push_back(new ChromeLauncherAppMenuItemBrowser( |
| 1333 web_contents->GetTitle(), | 1345 web_contents->GetTitle(), |
| 1334 app_icon.IsEmpty() ? NULL : &app_icon, | 1346 app_icon.IsEmpty() ? NULL : &app_icon, |
| 1335 browser)); | 1347 browser)); |
| 1336 } | 1348 } |
| 1337 return items; | 1349 return items; |
| 1338 } | 1350 } |
| OLD | NEW |