| 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 "apps/shell_window.h" | 7 #include "apps/shell_window.h" |
| 8 #include "apps/shell_window_registry.h" | 8 #include "apps/shell_window_registry.h" |
| 9 #include "apps/ui/native_app_window.h" | 9 #include "apps/ui/native_app_window.h" |
| 10 #include "ash/host/root_window_host_factory.h" | 10 #include "ash/host/root_window_host_factory.h" |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 ash::wm::WindowState* window_state = ash::wm::GetWindowState(window); | 159 ash::wm::WindowState* window_state = ash::wm::GetWindowState(window); |
| 160 | 160 |
| 161 bool is_fullscreen = window_state->IsFullscreen(); | 161 bool is_fullscreen = window_state->IsFullscreen(); |
| 162 | 162 |
| 163 // Windows which cannot be maximized should not be fullscreened. | 163 // Windows which cannot be maximized should not be fullscreened. |
| 164 if (!is_fullscreen && !window_state->CanMaximize()) | 164 if (!is_fullscreen && !window_state->CanMaximize()) |
| 165 return; | 165 return; |
| 166 | 166 |
| 167 Browser* browser = chrome::FindBrowserWithWindow(window); | 167 Browser* browser = chrome::FindBrowserWithWindow(window); |
| 168 if (browser) { | 168 if (browser) { |
| 169 // If a window is fullscreen, exit fullscreen. | 169 chrome::ToggleFullscreenMode(browser); |
| 170 if (is_fullscreen) { | |
| 171 chrome::ToggleFullscreenMode(browser); | |
| 172 return; | |
| 173 } | |
| 174 | |
| 175 // AppNonClientFrameViewAsh shows only the window controls and no other | |
| 176 // window decorations which is pretty close to fullscreen. Put v1 apps | |
| 177 // into maximized mode instead of fullscreen to avoid showing the ugly | |
| 178 // fullscreen exit bubble. | |
| 179 #if defined(OS_WIN) | |
| 180 if (browser->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_NATIVE) { | |
| 181 chrome::ToggleFullscreenMode(browser); | |
| 182 return; | |
| 183 } | |
| 184 #endif // OS_WIN | |
| 185 if (browser->is_app() && browser->app_type() != Browser::APP_TYPE_CHILD) | |
| 186 window_state->ToggleMaximized(); | |
| 187 else | |
| 188 chrome::ToggleFullscreenMode(browser); | |
| 189 return; | 170 return; |
| 190 } | 171 } |
| 191 | 172 |
| 192 // |window| may belong to a shell window. | 173 // |window| may belong to a shell window. |
| 193 apps::ShellWindow* shell_window = apps::ShellWindowRegistry:: | 174 apps::ShellWindow* shell_window = apps::ShellWindowRegistry:: |
| 194 GetShellWindowForNativeWindowAnyProfile(window); | 175 GetShellWindowForNativeWindowAnyProfile(window); |
| 195 if (shell_window) { | 176 if (shell_window) { |
| 196 if (is_fullscreen) | 177 if (is_fullscreen) |
| 197 shell_window->Restore(); | 178 shell_window->Restore(); |
| 198 else | 179 else |
| (...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 445 } | 426 } |
| 446 | 427 |
| 447 Browser* ChromeShellDelegate::GetTargetBrowserIfAvailable() { | 428 Browser* ChromeShellDelegate::GetTargetBrowserIfAvailable() { |
| 448 return chrome::FindBrowserWithWindow(ash::wm::GetActiveWindow()); | 429 return chrome::FindBrowserWithWindow(ash::wm::GetActiveWindow()); |
| 449 } | 430 } |
| 450 | 431 |
| 451 keyboard::KeyboardControllerProxy* | 432 keyboard::KeyboardControllerProxy* |
| 452 ChromeShellDelegate::CreateKeyboardControllerProxy() { | 433 ChromeShellDelegate::CreateKeyboardControllerProxy() { |
| 453 return new AshKeyboardControllerProxy(); | 434 return new AshKeyboardControllerProxy(); |
| 454 } | 435 } |
| OLD | NEW |