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)) { | |
Mr4D (OOO till 08-26)
2013/01/30 00:55:00
Please create a utility query for the command line
zel
2013/01/30 01:46:32
Where do you guys think I should place such utilit
Mr4D (OOO till 08-26)
2013/01/30 02:11:41
Maybe chrome/browser/ui/ash/ash_util.cc?
zel
2013/01/30 03:03:44
Done.
zel
2013/01/30 03:03:44
Done.
| |
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. | |
1216 NOTREACHED(); | |
1217 return; | |
1205 } | 1218 } |
1206 | 1219 |
1207 UpdatePerDisplayPref( | 1220 UpdatePerDisplayPref( |
1208 profile_->GetPrefs(), root_window, prefs::kShelfAutoHideBehavior, value); | 1221 profile_->GetPrefs(), root_window, prefs::kShelfAutoHideBehavior, value); |
1209 | 1222 |
1210 if (root_window == ash::Shell::GetPrimaryRootWindow()) { | 1223 if (root_window == ash::Shell::GetPrimaryRootWindow()) { |
1211 // See comment in |kShelfAlignment| about why we have two prefs here. | 1224 // See comment in |kShelfAlignment| about why we have two prefs here. |
1212 profile_->GetPrefs()->SetString(prefs::kShelfAutoHideBehaviorLocal, value); | 1225 profile_->GetPrefs()->SetString(prefs::kShelfAutoHideBehaviorLocal, value); |
1213 profile_->GetPrefs()->SetString(prefs::kShelfAutoHideBehavior, value); | 1226 profile_->GetPrefs()->SetString(prefs::kShelfAutoHideBehavior, value); |
1214 } | 1227 } |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1329 WebContents* web_contents = | 1342 WebContents* web_contents = |
1330 tab_strip->GetWebContentsAt(tab_strip->active_index()); | 1343 tab_strip->GetWebContentsAt(tab_strip->active_index()); |
1331 gfx::Image app_icon = GetAppListIcon(web_contents); | 1344 gfx::Image app_icon = GetAppListIcon(web_contents); |
1332 items->push_back(new ChromeLauncherAppMenuItemBrowser( | 1345 items->push_back(new ChromeLauncherAppMenuItemBrowser( |
1333 web_contents->GetTitle(), | 1346 web_contents->GetTitle(), |
1334 app_icon.IsEmpty() ? NULL : &app_icon, | 1347 app_icon.IsEmpty() ? NULL : &app_icon, |
1335 browser)); | 1348 browser)); |
1336 } | 1349 } |
1337 return items; | 1350 return items; |
1338 } | 1351 } |
OLD | NEW |