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/chrome_shell_delegate.h" | 5 #include "chrome/browser/ui/ash/chrome_shell_delegate.h" |
6 | 6 |
7 #include "ash/ash_switches.h" | 7 #include "ash/ash_switches.h" |
8 #include "ash/host/root_window_host_factory.h" | 8 #include "ash/host/root_window_host_factory.h" |
9 #include "ash/launcher/launcher_types.h" | 9 #include "ash/launcher/launcher_types.h" |
10 #include "ash/magnifier/magnifier_constants.h" | 10 #include "ash/magnifier/magnifier_constants.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" | 28 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" |
29 #include "chrome/browser/ui/ash/launcher/launcher_context_menu.h" | 29 #include "chrome/browser/ui/ash/launcher/launcher_context_menu.h" |
30 #include "chrome/browser/ui/ash/session_state_delegate.h" | 30 #include "chrome/browser/ui/ash/session_state_delegate.h" |
31 #include "chrome/browser/ui/ash/user_action_handler.h" | 31 #include "chrome/browser/ui/ash/user_action_handler.h" |
32 #include "chrome/browser/ui/ash/window_positioner.h" | 32 #include "chrome/browser/ui/ash/window_positioner.h" |
33 #include "chrome/browser/ui/browser.h" | 33 #include "chrome/browser/ui/browser.h" |
34 #include "chrome/browser/ui/browser_commands.h" | 34 #include "chrome/browser/ui/browser_commands.h" |
35 #include "chrome/browser/ui/browser_finder.h" | 35 #include "chrome/browser/ui/browser_finder.h" |
36 #include "chrome/browser/ui/browser_window.h" | 36 #include "chrome/browser/ui/browser_window.h" |
37 #include "chrome/browser/ui/host_desktop.h" | 37 #include "chrome/browser/ui/host_desktop.h" |
| 38 #include "chrome/browser/ui/views/frame/immersive_mode_controller.h" |
38 #include "chrome/common/chrome_notification_types.h" | 39 #include "chrome/common/chrome_notification_types.h" |
39 #include "chrome/common/chrome_switches.h" | 40 #include "chrome/common/chrome_switches.h" |
40 #include "chrome/common/time_format.h" | 41 #include "chrome/common/time_format.h" |
41 #include "content/public/browser/notification_service.h" | 42 #include "content/public/browser/notification_service.h" |
42 #include "content/public/browser/user_metrics.h" | 43 #include "content/public/browser/user_metrics.h" |
43 #include "grit/chromium_strings.h" | 44 #include "grit/chromium_strings.h" |
44 #include "grit/generated_resources.h" | 45 #include "grit/generated_resources.h" |
45 #include "ui/aura/client/user_action_client.h" | 46 #include "ui/aura/client/user_action_client.h" |
46 #include "ui/aura/window.h" | 47 #include "ui/aura/window.h" |
47 #include "ui/base/l10n/l10n_util.h" | 48 #include "ui/base/l10n/l10n_util.h" |
48 | 49 |
49 // static | 50 // static |
50 ChromeShellDelegate* ChromeShellDelegate::instance_ = NULL; | 51 ChromeShellDelegate* ChromeShellDelegate::instance_ = NULL; |
51 | 52 |
52 ChromeShellDelegate::ChromeShellDelegate() | 53 ChromeShellDelegate::ChromeShellDelegate() |
53 : window_positioner_(new ash::WindowPositioner()), | 54 : window_positioner_(new ash::WindowPositioner()), |
54 ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)), | 55 ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)), |
55 launcher_delegate_(NULL) { | 56 launcher_delegate_(NULL) { |
56 instance_ = this; | 57 instance_ = this; |
57 PlatformInit(); | 58 PlatformInit(); |
58 } | 59 } |
59 | 60 |
60 ChromeShellDelegate::~ChromeShellDelegate() { | 61 ChromeShellDelegate::~ChromeShellDelegate() { |
61 if (instance_ == this) | 62 if (instance_ == this) |
62 instance_ = NULL; | 63 instance_ = NULL; |
63 } | 64 } |
64 | 65 |
65 // static | |
66 bool ChromeShellDelegate::UseImmersiveFullscreen() { | |
67 #if defined(OS_CHROMEOS) | |
68 // Kiosk mode needs the whole screen. | |
69 CommandLine* command_line = CommandLine::ForCurrentProcess(); | |
70 return !command_line->HasSwitch(switches::kKioskMode) && | |
71 command_line->HasSwitch(ash::switches::kAshImmersiveFullscreen); | |
72 #endif | |
73 return false; | |
74 } | |
75 | |
76 bool ChromeShellDelegate::IsMultiProfilesEnabled() const { | 66 bool ChromeShellDelegate::IsMultiProfilesEnabled() const { |
77 return CommandLine::ForCurrentProcess()->HasSwitch(switches::kMultiProfiles); | 67 return CommandLine::ForCurrentProcess()->HasSwitch(switches::kMultiProfiles); |
78 } | 68 } |
79 | 69 |
80 bool ChromeShellDelegate::IsRunningInForcedAppMode() const { | 70 bool ChromeShellDelegate::IsRunningInForcedAppMode() const { |
81 return chrome::IsRunningInForcedAppMode(); | 71 return chrome::IsRunningInForcedAppMode(); |
82 } | 72 } |
83 | 73 |
84 void ChromeShellDelegate::Exit() { | 74 void ChromeShellDelegate::Exit() { |
85 chrome::AttemptUserExit(); | 75 chrome::AttemptUserExit(); |
(...skipping 17 matching lines...) Expand all Loading... |
103 } | 93 } |
104 | 94 |
105 void ChromeShellDelegate::ToggleMaximized() { | 95 void ChromeShellDelegate::ToggleMaximized() { |
106 // Only toggle if the user has a window open. | 96 // Only toggle if the user has a window open. |
107 aura::Window* window = ash::wm::GetActiveWindow(); | 97 aura::Window* window = ash::wm::GetActiveWindow(); |
108 if (!window) | 98 if (!window) |
109 return; | 99 return; |
110 | 100 |
111 // TODO(jamescook): If immersive mode replaces fullscreen, rename this | 101 // TODO(jamescook): If immersive mode replaces fullscreen, rename this |
112 // function and the interface to ToggleFullscreen. | 102 // function and the interface to ToggleFullscreen. |
113 if (UseImmersiveFullscreen()) { | 103 if (chrome::UseImmersiveFullscreen()) { |
114 chrome::ToggleFullscreenMode(GetTargetBrowser()); | 104 chrome::ToggleFullscreenMode(GetTargetBrowser()); |
115 return; | 105 return; |
116 } | 106 } |
117 | 107 |
118 // Get out of fullscreen when in fullscreen mode. | 108 // Get out of fullscreen when in fullscreen mode. |
119 if (ash::wm::IsWindowFullscreen(window)) { | 109 if (ash::wm::IsWindowFullscreen(window)) { |
120 chrome::ToggleFullscreenMode(GetTargetBrowser()); | 110 chrome::ToggleFullscreenMode(GetTargetBrowser()); |
121 return; | 111 return; |
122 } | 112 } |
123 ash::wm::ToggleMaximizedWindow(window); | 113 ash::wm::ToggleMaximizedWindow(window); |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
364 return browser; | 354 return browser; |
365 return chrome::FindOrCreateTabbedBrowser( | 355 return chrome::FindOrCreateTabbedBrowser( |
366 ProfileManager::GetDefaultProfileOrOffTheRecord(), | 356 ProfileManager::GetDefaultProfileOrOffTheRecord(), |
367 chrome::HOST_DESKTOP_TYPE_ASH); | 357 chrome::HOST_DESKTOP_TYPE_ASH); |
368 } | 358 } |
369 | 359 |
370 keyboard::KeyboardControllerProxy* | 360 keyboard::KeyboardControllerProxy* |
371 ChromeShellDelegate::CreateKeyboardControllerProxy() { | 361 ChromeShellDelegate::CreateKeyboardControllerProxy() { |
372 return new AshKeyboardControllerProxy(); | 362 return new AshKeyboardControllerProxy(); |
373 } | 363 } |
OLD | NEW |