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/fullscreen_controller.h" | 5 #include "chrome/browser/ui/fullscreen_controller.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "chrome/browser/content_settings/host_content_settings_map.h" | 10 #include "chrome/browser/content_settings/host_content_settings_map.h" |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 bool FullscreenController::IsFullscreenForTabOrPending( | 51 bool FullscreenController::IsFullscreenForTabOrPending( |
52 const WebContents* web_contents) const { | 52 const WebContents* web_contents) const { |
53 const TabContents* tab_contents = | 53 const TabContents* tab_contents = |
54 TabContents::FromWebContents(web_contents); | 54 TabContents::FromWebContents(web_contents); |
55 if (!tab_contents || (tab_contents != fullscreened_tab_)) | 55 if (!tab_contents || (tab_contents != fullscreened_tab_)) |
56 return false; | 56 return false; |
57 DCHECK(web_contents == browser_->GetActiveWebContents()); | 57 DCHECK(web_contents == browser_->GetActiveWebContents()); |
58 return true; | 58 return true; |
59 } | 59 } |
60 | 60 |
61 #if defined(OS_WIN) | |
62 bool FullscreenController::IsInMetroSnapMode() { | |
63 return window_->IsInMetroSnapMode(); | |
64 } | |
65 #endif | |
66 | |
67 bool FullscreenController::IsMouseLockRequested() const { | 61 bool FullscreenController::IsMouseLockRequested() const { |
68 return mouse_lock_state_ == MOUSELOCK_REQUESTED; | 62 return mouse_lock_state_ == MOUSELOCK_REQUESTED; |
69 } | 63 } |
70 | 64 |
71 bool FullscreenController::IsMouseLocked() const { | 65 bool FullscreenController::IsMouseLocked() const { |
72 return mouse_lock_state_ == MOUSELOCK_ACCEPTED || | 66 return mouse_lock_state_ == MOUSELOCK_ACCEPTED || |
73 mouse_lock_state_ == MOUSELOCK_ACCEPTED_SILENTLY; | 67 mouse_lock_state_ == MOUSELOCK_ACCEPTED_SILENTLY; |
74 } | 68 } |
75 | 69 |
76 void FullscreenController::RequestToLockMouse(WebContents* web_contents, | 70 void FullscreenController::RequestToLockMouse(WebContents* web_contents, |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 // was not caused by it (i.e., previously it was in "browser fullscreen" | 163 // was not caused by it (i.e., previously it was in "browser fullscreen" |
170 // mode), we need to switch back to "browser fullscreen" mode. In this | 164 // mode), we need to switch back to "browser fullscreen" mode. In this |
171 // case, all we have to do is notifying the tab that it has exited "tab | 165 // case, all we have to do is notifying the tab that it has exited "tab |
172 // fullscreen" mode. | 166 // fullscreen" mode. |
173 NotifyTabOfExitIfNecessary(); | 167 NotifyTabOfExitIfNecessary(); |
174 } | 168 } |
175 } | 169 } |
176 } | 170 } |
177 } | 171 } |
178 | 172 |
179 #if defined(OS_WIN) | |
180 void FullscreenController::SetMetroSnapMode(bool enable) { | |
181 window_->SetMetroSnapMode(enable); | |
182 } | |
183 #endif | |
184 | |
185 #if defined(OS_MACOSX) | 173 #if defined(OS_MACOSX) |
186 void FullscreenController::TogglePresentationMode() { | 174 void FullscreenController::TogglePresentationMode() { |
187 TogglePresentationModeInternal(false); | 175 TogglePresentationModeInternal(false); |
188 } | 176 } |
189 #endif | 177 #endif |
190 | 178 |
191 void FullscreenController::ToggleFullscreenMode() { | 179 void FullscreenController::ToggleFullscreenMode() { |
192 extension_caused_fullscreen_ = GURL(); | 180 extension_caused_fullscreen_ = GURL(); |
193 ToggleFullscreenModeInternal(false); | 181 ToggleFullscreenModeInternal(false); |
194 } | 182 } |
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
518 window_->ExitFullscreen(); | 506 window_->ExitFullscreen(); |
519 extension_caused_fullscreen_ = GURL(); | 507 extension_caused_fullscreen_ = GURL(); |
520 } | 508 } |
521 UpdateFullscreenExitBubbleContent(); | 509 UpdateFullscreenExitBubbleContent(); |
522 | 510 |
523 // Once the window has become fullscreen it'll call back to | 511 // Once the window has become fullscreen it'll call back to |
524 // WindowFullscreenStateChanged(). We don't do this immediately as | 512 // WindowFullscreenStateChanged(). We don't do this immediately as |
525 // BrowserWindow::EnterFullscreen() asks for bookmark_bar_state_, so we let | 513 // BrowserWindow::EnterFullscreen() asks for bookmark_bar_state_, so we let |
526 // the BrowserWindow invoke WindowFullscreenStateChanged when appropriate. | 514 // the BrowserWindow invoke WindowFullscreenStateChanged when appropriate. |
527 } | 515 } |
OLD | NEW |