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/ui/native_app_window.h" | 8 #include "apps/ui/native_app_window.h" |
9 #include "ash/accelerators/accelerator_commands.h" | 9 #include "ash/accelerators/accelerator_commands.h" |
10 #include "ash/ash_switches.h" | 10 #include "ash/ash_switches.h" |
11 #include "ash/shell.h" | 11 #include "ash/shell.h" |
12 #include "ash/shell_delegate.h" | 12 #include "ash/shell_delegate.h" |
13 #include "ash/wm/window_properties.h" | |
14 #include "ash/wm/window_state.h" | 13 #include "ash/wm/window_state.h" |
15 #include "base/command_line.h" | 14 #include "base/command_line.h" |
16 #include "chrome/browser/apps/app_browsertest_util.h" | 15 #include "chrome/browser/apps/app_browsertest_util.h" |
17 #include "chrome/browser/ui/browser.h" | 16 #include "chrome/browser/ui/browser.h" |
18 #include "chrome/browser/ui/browser_commands.h" | 17 #include "chrome/browser/ui/browser_commands.h" |
19 #include "chrome/browser/ui/browser_finder.h" | 18 #include "chrome/browser/ui/browser_finder.h" |
20 #include "chrome/browser/ui/browser_window.h" | 19 #include "chrome/browser/ui/browser_window.h" |
21 #include "chrome/test/base/in_process_browser_test.h" | 20 #include "chrome/test/base/in_process_browser_test.h" |
22 #include "ui/aura/client/aura_constants.h" | 21 #include "ui/aura/client/aura_constants.h" |
23 | 22 |
24 namespace { | 23 namespace { |
25 | 24 |
26 // Returns true if |window| is in immersive fullscreen. Infer whether |window| | 25 // Returns true if |window| is in immersive fullscreen. Infer whether |window| |
27 // is in immersive fullscreen based on whether kFullscreenUsesMinimalChromeKey | 26 // is in immersive fullscreen based on whether the shelf is hidden when |
28 // is set for |window| because DEPS does not allow the test to use BrowserView. | 27 // |window| is fullscreen because DEPS does not allow the test to use |
29 // (This is not quite right because if a window is in both immersive browser | 28 // BrowserView. (This is not quite right because the shelf is hidden if a window |
30 // fullscreen and in tab fullscreen, kFullScreenUsesMinimalChromeKey will | 29 // is in both immersive fullscreen and tab fullscreen.) |
31 // not be set). | |
32 bool IsInImmersiveFullscreen(BrowserWindow* browser_window) { | 30 bool IsInImmersiveFullscreen(BrowserWindow* browser_window) { |
33 return browser_window->IsFullscreen() && | 31 ash::wm::WindowState* window_state = ash::wm::GetWindowState( |
34 browser_window->GetNativeWindow()->GetProperty( | 32 browser_window->GetNativeWindow()); |
35 ash::internal::kFullscreenUsesMinimalChromeKey); | 33 return window_state->IsFullscreen() && |
| 34 !window_state->hide_shelf_when_fullscreen(); |
36 } | 35 } |
37 | 36 |
38 } // namespace | 37 } // namespace |
39 | 38 |
40 typedef InProcessBrowserTest ChromeShellDelegateBrowserTest; | 39 typedef InProcessBrowserTest ChromeShellDelegateBrowserTest; |
41 | 40 |
42 // TODO(oshima): Move these tests to ash once ToggleFullscreen is moved | 41 // TODO(oshima): Move these tests to ash once ToggleFullscreen is moved |
43 // to ash. crbug.com/309837. | 42 // to ash. crbug.com/309837. |
44 | 43 |
45 // Confirm that toggling window miximized works properly | 44 // Confirm that toggling window miximized works properly |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 | 183 |
185 shell_delegate->ToggleFullscreen(); | 184 shell_delegate->ToggleFullscreen(); |
186 EXPECT_TRUE(app_window->IsFullscreen()); | 185 EXPECT_TRUE(app_window->IsFullscreen()); |
187 | 186 |
188 shell_delegate->ToggleFullscreen(); | 187 shell_delegate->ToggleFullscreen(); |
189 EXPECT_FALSE(app_window->IsMaximized()); | 188 EXPECT_FALSE(app_window->IsMaximized()); |
190 EXPECT_FALSE(app_window->IsFullscreen()); | 189 EXPECT_FALSE(app_window->IsFullscreen()); |
191 | 190 |
192 CloseShellWindow(shell_window); | 191 CloseShellWindow(shell_window); |
193 } | 192 } |
OLD | NEW |