Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(863)

Side by Side Diff: chrome/browser/ui/ash/chrome_shell_delegate.cc

Issue 25536010: Make packaged apps use AppNonClientFrameViewAsh when maximized (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "apps/native_app_window.h" 7 #include "apps/native_app_window.h"
8 #include "apps/shell_window.h" 8 #include "apps/shell_window.h"
9 #include "apps/shell_window_registry.h" 9 #include "apps/shell_window_registry.h"
10 #include "ash/ash_switches.h"
10 #include "ash/host/root_window_host_factory.h" 11 #include "ash/host/root_window_host_factory.h"
11 #include "ash/magnifier/magnifier_constants.h" 12 #include "ash/magnifier/magnifier_constants.h"
12 #include "ash/session_state_delegate.h" 13 #include "ash/session_state_delegate.h"
13 #include "ash/system/tray/system_tray_delegate.h" 14 #include "ash/system/tray/system_tray_delegate.h"
14 #include "ash/wm/window_state.h" 15 #include "ash/wm/window_state.h"
15 #include "ash/wm/window_util.h" 16 #include "ash/wm/window_util.h"
16 #include "base/command_line.h" 17 #include "base/command_line.h"
17 #include "base/prefs/pref_service.h" 18 #include "base/prefs/pref_service.h"
18 #include "chrome/browser/app_mode/app_mode_utils.h" 19 #include "chrome/browser/app_mode/app_mode_utils.h"
19 #include "chrome/browser/lifetime/application_lifetime.h" 20 #include "chrome/browser/lifetime/application_lifetime.h"
20 #include "chrome/browser/profiles/profile_manager.h" 21 #include "chrome/browser/profiles/profile_manager.h"
21 #include "chrome/browser/sessions/tab_restore_service.h" 22 #include "chrome/browser/sessions/tab_restore_service.h"
22 #include "chrome/browser/sessions/tab_restore_service_factory.h" 23 #include "chrome/browser/sessions/tab_restore_service_factory.h"
23 #include "chrome/browser/sessions/tab_restore_service_observer.h" 24 #include "chrome/browser/sessions/tab_restore_service_observer.h"
24 #include "chrome/browser/ui/app_list/app_list_view_delegate.h" 25 #include "chrome/browser/ui/app_list/app_list_view_delegate.h"
25 #include "chrome/browser/ui/ash/app_list/app_list_controller_ash.h" 26 #include "chrome/browser/ui/ash/app_list/app_list_controller_ash.h"
26 #include "chrome/browser/ui/ash/ash_keyboard_controller_proxy.h" 27 #include "chrome/browser/ui/ash/ash_keyboard_controller_proxy.h"
28 #include "chrome/browser/ui/ash/ash_util.h"
27 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" 29 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h"
28 #include "chrome/browser/ui/ash/launcher/launcher_context_menu.h" 30 #include "chrome/browser/ui/ash/launcher/launcher_context_menu.h"
29 #include "chrome/browser/ui/ash/user_action_handler.h" 31 #include "chrome/browser/ui/ash/user_action_handler.h"
30 #include "chrome/browser/ui/ash/window_positioner.h" 32 #include "chrome/browser/ui/ash/window_positioner.h"
31 #include "chrome/browser/ui/browser.h" 33 #include "chrome/browser/ui/browser.h"
32 #include "chrome/browser/ui/browser_commands.h" 34 #include "chrome/browser/ui/browser_commands.h"
33 #include "chrome/browser/ui/browser_finder.h" 35 #include "chrome/browser/ui/browser_finder.h"
34 #include "chrome/browser/ui/browser_window.h" 36 #include "chrome/browser/ui/browser_window.h"
35 #include "chrome/browser/ui/host_desktop.h" 37 #include "chrome/browser/ui/host_desktop.h"
36 #include "chrome/common/chrome_switches.h" 38 #include "chrome/common/chrome_switches.h"
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 return; 170 return;
169 171
170 Browser* browser = chrome::FindBrowserWithWindow(window); 172 Browser* browser = chrome::FindBrowserWithWindow(window);
171 if (browser) { 173 if (browser) {
172 // If a window is fullscreen, exit fullscreen. 174 // If a window is fullscreen, exit fullscreen.
173 if (is_fullscreen) { 175 if (is_fullscreen) {
174 chrome::ToggleFullscreenMode(browser); 176 chrome::ToggleFullscreenMode(browser);
175 return; 177 return;
176 } 178 }
177 179
178 // AppNonClientFrameViewAsh shows only the window controls and no other 180 // AppBrowserFrameViewAsh shows only the window controls and no other
179 // window decorations which is pretty close to fullscreen. Put v1 apps 181 // window decorations which is pretty close to fullscreen. Put v1 apps
180 // into maximized mode instead of fullscreen to avoid showing the ugly 182 // into maximized mode instead of fullscreen to avoid showing the ugly
181 // fullscreen exit bubble. 183 // fullscreen exit bubble.
182 #if defined(OS_WIN) 184 if (chrome::IsNativeViewInAsh(window) &&
183 if (browser->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_NATIVE) { 185 browser->is_app() &&
186 browser->app_type() != Browser::APP_TYPE_CHILD) {
187 window_state->ToggleMaximized();
188 } else {
184 chrome::ToggleFullscreenMode(browser); 189 chrome::ToggleFullscreenMode(browser);
185 return;
186 } 190 }
187 #endif // OS_WIN
188 if (browser->is_app() && browser->app_type() != Browser::APP_TYPE_CHILD)
189 window_state->ToggleMaximized();
190 else
191 chrome::ToggleFullscreenMode(browser);
192 return; 191 return;
193 } 192 }
194 193
195 // |window| may belong to a shell window. 194 // |window| may belong to a shell window.
196 apps::ShellWindow* shell_window = apps::ShellWindowRegistry:: 195 apps::ShellWindow* shell_window = apps::ShellWindowRegistry::
197 GetShellWindowForNativeWindowAnyProfile(window); 196 GetShellWindowForNativeWindowAnyProfile(window);
198 if (shell_window) { 197 if (shell_window) {
199 if (is_fullscreen) 198 if (is_fullscreen) {
200 shell_window->Restore(); 199 shell_window->Restore();
201 else 200 } else if (chrome::IsNativeViewInAsh(window) &&
201 ash::switches::UseSameFrameForV1AndV2Apps()) {
202 // AppNonClientFrameViewAsh shows only the window controls and no other
203 // window decorations which is close to fullscreen and is more useful than
204 // fullscreen. Put shell windows into maximized mode instead of
205 // fullscreen.
206 shell_window->Maximize();
207 } else {
202 shell_window->Fullscreen(); 208 shell_window->Fullscreen();
209 }
203 } 210 }
204 } 211 }
205 212
206 void ChromeShellDelegate::ToggleMaximized() { 213 void ChromeShellDelegate::ToggleMaximized() {
207 // Only toggle if the user has a window open. 214 // Only toggle if the user has a window open.
208 aura::Window* window = ash::wm::GetActiveWindow(); 215 aura::Window* window = ash::wm::GetActiveWindow();
209 if (!window) 216 if (!window)
210 return; 217 return;
211 218
212 ash::wm::WindowState* window_state = ash::wm::GetWindowState(window); 219 ash::wm::WindowState* window_state = ash::wm::GetWindowState(window);
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
458 } 465 }
459 466
460 Browser* ChromeShellDelegate::GetTargetBrowserIfAvailable() { 467 Browser* ChromeShellDelegate::GetTargetBrowserIfAvailable() {
461 return chrome::FindBrowserWithWindow(ash::wm::GetActiveWindow()); 468 return chrome::FindBrowserWithWindow(ash::wm::GetActiveWindow());
462 } 469 }
463 470
464 keyboard::KeyboardControllerProxy* 471 keyboard::KeyboardControllerProxy*
465 ChromeShellDelegate::CreateKeyboardControllerProxy() { 472 ChromeShellDelegate::CreateKeyboardControllerProxy() {
466 return new AshKeyboardControllerProxy(); 473 return new AshKeyboardControllerProxy();
467 } 474 }
OLDNEW
« no previous file with comments | « chrome/browser/about_flags.cc ('k') | chrome/browser/ui/ash/chrome_shell_delegate_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698