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 19 matching lines...) Expand all Loading... |
30 Browser* browser) | 30 Browser* browser) |
31 : window_(window), | 31 : window_(window), |
32 profile_(profile), | 32 profile_(profile), |
33 browser_(browser), | 33 browser_(browser), |
34 fullscreened_tab_(NULL), | 34 fullscreened_tab_(NULL), |
35 tab_caused_fullscreen_(false), | 35 tab_caused_fullscreen_(false), |
36 tab_fullscreen_accepted_(false), | 36 tab_fullscreen_accepted_(false), |
37 mouse_lock_state_(MOUSELOCK_NOT_REQUESTED) { | 37 mouse_lock_state_(MOUSELOCK_NOT_REQUESTED) { |
38 } | 38 } |
39 | 39 |
40 FullscreenController::~FullscreenController() {} | |
41 | |
42 bool FullscreenController::IsFullscreenForBrowser() const { | 40 bool FullscreenController::IsFullscreenForBrowser() const { |
43 return window_->IsFullscreen() && !tab_caused_fullscreen_; | 41 return window_->IsFullscreen() && !tab_caused_fullscreen_; |
44 } | 42 } |
45 | 43 |
46 bool FullscreenController::IsFullscreenForTabOrPending() const { | 44 bool FullscreenController::IsFullscreenForTabOrPending() const { |
47 return fullscreened_tab_ != NULL; | 45 return fullscreened_tab_ != NULL; |
48 } | 46 } |
49 | 47 |
50 bool FullscreenController::IsFullscreenForTabOrPending( | 48 bool FullscreenController::IsFullscreenForTabOrPending( |
51 const WebContents* tab) const { | 49 const WebContents* tab) const { |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 #endif | 262 #endif |
265 } | 263 } |
266 | 264 |
267 bool FullscreenController::HandleUserPressedEscape() { | 265 bool FullscreenController::HandleUserPressedEscape() { |
268 if (!IsFullscreenForTabOrPending()) | 266 if (!IsFullscreenForTabOrPending()) |
269 return false; | 267 return false; |
270 ExitTabbedFullscreenModeIfNecessary(); | 268 ExitTabbedFullscreenModeIfNecessary(); |
271 return true; | 269 return true; |
272 } | 270 } |
273 | 271 |
| 272 FullscreenController::~FullscreenController() {} |
| 273 |
274 void FullscreenController::NotifyTabOfFullscreenExitIfNecessary() { | 274 void FullscreenController::NotifyTabOfFullscreenExitIfNecessary() { |
275 if (fullscreened_tab_) { | 275 if (fullscreened_tab_) { |
276 RenderViewHost* rvh = | 276 RenderViewHost* rvh = |
277 fullscreened_tab_->web_contents()->GetRenderViewHost(); | 277 fullscreened_tab_->web_contents()->GetRenderViewHost(); |
278 fullscreened_tab_ = NULL; | 278 fullscreened_tab_ = NULL; |
279 tab_caused_fullscreen_ = false; | 279 tab_caused_fullscreen_ = false; |
280 tab_fullscreen_accepted_ = false; | 280 tab_fullscreen_accepted_ = false; |
281 mouse_lock_state_ = MOUSELOCK_NOT_REQUESTED; | 281 mouse_lock_state_ = MOUSELOCK_NOT_REQUESTED; |
282 if (rvh) | 282 if (rvh) |
283 rvh->ExitFullscreen(); | 283 rvh->ExitFullscreen(); |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
403 // WindowFullscreenStateChanged(). We don't do this immediately as | 403 // WindowFullscreenStateChanged(). We don't do this immediately as |
404 // BrowserWindow::EnterFullscreen() asks for bookmark_bar_state_, so we let | 404 // BrowserWindow::EnterFullscreen() asks for bookmark_bar_state_, so we let |
405 // the BrowserWindow invoke WindowFullscreenStateChanged when appropriate. | 405 // the BrowserWindow invoke WindowFullscreenStateChanged when appropriate. |
406 | 406 |
407 // TODO: convert mac to invoke WindowFullscreenStateChanged once it updates | 407 // TODO: convert mac to invoke WindowFullscreenStateChanged once it updates |
408 // the necessary state of the frame. | 408 // the necessary state of the frame. |
409 #if defined(OS_MACOSX) | 409 #if defined(OS_MACOSX) |
410 WindowFullscreenStateChanged(); | 410 WindowFullscreenStateChanged(); |
411 #endif | 411 #endif |
412 } | 412 } |
OLD | NEW |