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/fullscreen_controller.h" | 5 #include "chrome/browser/ui/fullscreen/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/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "chrome/browser/app_mode/app_mode_utils.h" | 10 #include "chrome/browser/app_mode/app_mode_utils.h" |
11 #include "chrome/browser/chrome_notification_types.h" | 11 #include "chrome/browser/chrome_notification_types.h" |
12 #include "chrome/browser/content_settings/host_content_settings_map.h" | 12 #include "chrome/browser/content_settings/host_content_settings_map.h" |
13 #include "chrome/browser/download/download_shelf.h" | 13 #include "chrome/browser/download/download_shelf.h" |
14 #include "chrome/browser/fullscreen.h" | 14 #include "chrome/browser/fullscreen.h" |
15 #include "chrome/browser/profiles/profile.h" | 15 #include "chrome/browser/profiles/profile.h" |
16 #include "chrome/browser/ui/browser.h" | 16 #include "chrome/browser/ui/browser.h" |
17 #include "chrome/browser/ui/browser_window.h" | 17 #include "chrome/browser/ui/browser_window.h" |
| 18 #include "chrome/browser/ui/status_bubble.h" |
18 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 19 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
19 #include "chrome/common/chrome_switches.h" | 20 #include "chrome/common/chrome_switches.h" |
20 #include "chrome/common/extensions/extension.h" | 21 #include "chrome/common/extensions/extension.h" |
21 #include "content/public/browser/navigation_details.h" | 22 #include "content/public/browser/navigation_details.h" |
22 #include "content/public/browser/navigation_entry.h" | 23 #include "content/public/browser/navigation_entry.h" |
23 #include "content/public/browser/notification_service.h" | 24 #include "content/public/browser/notification_service.h" |
24 #include "content/public/browser/render_view_host.h" | 25 #include "content/public/browser/render_view_host.h" |
25 #include "content/public/browser/render_widget_host_view.h" | 26 #include "content/public/browser/render_widget_host_view.h" |
26 #include "content/public/browser/user_metrics.h" | 27 #include "content/public/browser/user_metrics.h" |
27 #include "content/public/browser/web_contents.h" | 28 #include "content/public/browser/web_contents.h" |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 reentrant_window_state_change_call_check_ = true; | 294 reentrant_window_state_change_call_check_ = true; |
294 | 295 |
295 bool exiting_fullscreen = !window_->IsFullscreen(); | 296 bool exiting_fullscreen = !window_->IsFullscreen(); |
296 | 297 |
297 PostFullscreenChangeNotification(!exiting_fullscreen); | 298 PostFullscreenChangeNotification(!exiting_fullscreen); |
298 if (exiting_fullscreen) { | 299 if (exiting_fullscreen) { |
299 toggled_into_fullscreen_ = false; | 300 toggled_into_fullscreen_ = false; |
300 extension_caused_fullscreen_ = GURL(); | 301 extension_caused_fullscreen_ = GURL(); |
301 NotifyTabOfExitIfNecessary(); | 302 NotifyTabOfExitIfNecessary(); |
302 } | 303 } |
303 if (exiting_fullscreen) | 304 if (exiting_fullscreen) { |
304 window_->GetDownloadShelf()->Unhide(); | 305 window_->GetDownloadShelf()->Unhide(); |
305 else | 306 } else { |
306 window_->GetDownloadShelf()->Hide(); | 307 window_->GetDownloadShelf()->Hide(); |
| 308 if (window_->GetStatusBubble()) |
| 309 window_->GetStatusBubble()->Hide(); |
| 310 } |
307 } | 311 } |
308 | 312 |
309 bool FullscreenController::HandleUserPressedEscape() { | 313 bool FullscreenController::HandleUserPressedEscape() { |
310 if (IsFullscreenForTabOrPending() || | 314 if (IsFullscreenForTabOrPending() || |
311 IsMouseLocked() || IsMouseLockRequested()) { | 315 IsMouseLocked() || IsMouseLockRequested()) { |
312 ExitTabFullscreenOrMouseLockIfNecessary(); | 316 ExitTabFullscreenOrMouseLockIfNecessary(); |
313 return true; | 317 return true; |
314 } | 318 } |
315 | 319 |
316 return false; | 320 return false; |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
434 #if !defined(OS_MACOSX) // App mode (kiosk) is not available on Mac yet. | 438 #if !defined(OS_MACOSX) // App mode (kiosk) is not available on Mac yet. |
435 app_mode = chrome::IsRunningInAppMode(); | 439 app_mode = chrome::IsRunningInAppMode(); |
436 #endif | 440 #endif |
437 | 441 |
438 if (mouse_lock_state_ == MOUSELOCK_ACCEPTED_SILENTLY) { | 442 if (mouse_lock_state_ == MOUSELOCK_ACCEPTED_SILENTLY) { |
439 return FEB_TYPE_NONE; | 443 return FEB_TYPE_NONE; |
440 } | 444 } |
441 | 445 |
442 if (fullscreened_tab_) { | 446 if (fullscreened_tab_) { |
443 if (tab_fullscreen_accepted_) { | 447 if (tab_fullscreen_accepted_) { |
444 if (IsMouseLocked()) { | 448 if (IsPrivilegedFullscreenForTab()) { |
| 449 return FEB_TYPE_NONE; |
| 450 } else if (IsMouseLocked()) { |
445 return FEB_TYPE_FULLSCREEN_MOUSELOCK_EXIT_INSTRUCTION; | 451 return FEB_TYPE_FULLSCREEN_MOUSELOCK_EXIT_INSTRUCTION; |
446 } else if (IsMouseLockRequested()) { | 452 } else if (IsMouseLockRequested()) { |
447 return FEB_TYPE_MOUSELOCK_BUTTONS; | 453 return FEB_TYPE_MOUSELOCK_BUTTONS; |
448 } else { | 454 } else { |
449 return FEB_TYPE_FULLSCREEN_EXIT_INSTRUCTION; | 455 return FEB_TYPE_FULLSCREEN_EXIT_INSTRUCTION; |
450 } | 456 } |
451 } else { // Full screen not yet accepted. | 457 } else { // Full screen not yet accepted. |
452 if (IsMouseLockRequested()) { | 458 if (IsMouseLockRequested()) { |
453 return FEB_TYPE_FULLSCREEN_MOUSELOCK_BUTTONS; | 459 return FEB_TYPE_FULLSCREEN_MOUSELOCK_BUTTONS; |
454 } else { | 460 } else { |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
710 (fullscreened_tab_ == mouse_lock_tab_ && IsPrivilegedFullscreenForTab()) ? | 716 (fullscreened_tab_ == mouse_lock_tab_ && IsPrivilegedFullscreenForTab()) ? |
711 mouse_lock_tab_->GetFullscreenRenderWidgetHostView() : NULL; | 717 mouse_lock_tab_->GetFullscreenRenderWidgetHostView() : NULL; |
712 if (!mouse_lock_view) { | 718 if (!mouse_lock_view) { |
713 RenderViewHost* const rvh = mouse_lock_tab_->GetRenderViewHost(); | 719 RenderViewHost* const rvh = mouse_lock_tab_->GetRenderViewHost(); |
714 if (rvh) | 720 if (rvh) |
715 mouse_lock_view = rvh->GetView(); | 721 mouse_lock_view = rvh->GetView(); |
716 } | 722 } |
717 if (mouse_lock_view) | 723 if (mouse_lock_view) |
718 mouse_lock_view->UnlockMouse(); | 724 mouse_lock_view->UnlockMouse(); |
719 } | 725 } |
OLD | NEW |