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