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 "apps/ui/web_contents_sizer.h" | |
8 #include "base/bind.h" | 7 #include "base/bind.h" |
9 #include "base/command_line.h" | 8 #include "base/command_line.h" |
10 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
11 #include "chrome/browser/app_mode/app_mode_utils.h" | 10 #include "chrome/browser/app_mode/app_mode_utils.h" |
12 #include "chrome/browser/chrome_notification_types.h" | 11 #include "chrome/browser/chrome_notification_types.h" |
13 #include "chrome/browser/content_settings/host_content_settings_map.h" | 12 #include "chrome/browser/content_settings/host_content_settings_map.h" |
14 #include "chrome/browser/download/download_shelf.h" | 13 #include "chrome/browser/download/download_shelf.h" |
15 #include "chrome/browser/fullscreen.h" | 14 #include "chrome/browser/fullscreen.h" |
16 #include "chrome/browser/profiles/profile.h" | 15 #include "chrome/browser/profiles/profile.h" |
17 #include "chrome/browser/ui/browser.h" | 16 #include "chrome/browser/ui/browser.h" |
18 #include "chrome/browser/ui/browser_window.h" | 17 #include "chrome/browser/ui/browser_window.h" |
19 #include "chrome/browser/ui/fullscreen/fullscreen_within_tab_helper.h" | 18 #include "chrome/browser/ui/fullscreen/fullscreen_within_tab_helper.h" |
20 #include "chrome/browser/ui/status_bubble.h" | 19 #include "chrome/browser/ui/status_bubble.h" |
21 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 20 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 21 #include "chrome/browser/ui/web_contents_sizer.h" |
22 #include "chrome/common/chrome_switches.h" | 22 #include "chrome/common/chrome_switches.h" |
23 #include "content/public/browser/navigation_details.h" | 23 #include "content/public/browser/navigation_details.h" |
24 #include "content/public/browser/navigation_entry.h" | 24 #include "content/public/browser/navigation_entry.h" |
25 #include "content/public/browser/notification_service.h" | 25 #include "content/public/browser/notification_service.h" |
26 #include "content/public/browser/render_view_host.h" | 26 #include "content/public/browser/render_view_host.h" |
27 #include "content/public/browser/render_widget_host_view.h" | 27 #include "content/public/browser/render_widget_host_view.h" |
28 #include "content/public/browser/user_metrics.h" | 28 #include "content/public/browser/user_metrics.h" |
29 #include "content/public/browser/web_contents.h" | 29 #include "content/public/browser/web_contents.h" |
30 #include "extensions/common/extension.h" | 30 #include "extensions/common/extension.h" |
31 | 31 |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
304 // size was never specified by the capturer. | 304 // size was never specified by the capturer. |
305 if (old_contents->GetCapturerCount() == 0 || | 305 if (old_contents->GetCapturerCount() == 0 || |
306 old_contents->GetPreferredSize().IsEmpty()) { | 306 old_contents->GetPreferredSize().IsEmpty()) { |
307 return; | 307 return; |
308 } | 308 } |
309 | 309 |
310 content::RenderWidgetHostView* const current_fs_view = | 310 content::RenderWidgetHostView* const current_fs_view = |
311 old_contents->GetFullscreenRenderWidgetHostView(); | 311 old_contents->GetFullscreenRenderWidgetHostView(); |
312 if (current_fs_view) | 312 if (current_fs_view) |
313 current_fs_view->SetSize(old_contents->GetPreferredSize()); | 313 current_fs_view->SetSize(old_contents->GetPreferredSize()); |
314 apps::ResizeWebContents(old_contents, old_contents->GetPreferredSize()); | 314 ResizeWebContents(old_contents, old_contents->GetPreferredSize()); |
315 } | 315 } |
316 | 316 |
317 void FullscreenController::OnTabClosing(WebContents* web_contents) { | 317 void FullscreenController::OnTabClosing(WebContents* web_contents) { |
318 if (IsFullscreenForCapturedTab(web_contents)) { | 318 if (IsFullscreenForCapturedTab(web_contents)) { |
319 RenderViewHost* const rvh = web_contents->GetRenderViewHost(); | 319 RenderViewHost* const rvh = web_contents->GetRenderViewHost(); |
320 if (rvh) | 320 if (rvh) |
321 rvh->ExitFullscreen(); | 321 rvh->ExitFullscreen(); |
322 } else if (web_contents == fullscreened_tab_ || | 322 } else if (web_contents == fullscreened_tab_ || |
323 web_contents == mouse_lock_tab_) { | 323 web_contents == mouse_lock_tab_) { |
324 ExitTabFullscreenOrMouseLockIfNecessary(); | 324 ExitTabFullscreenOrMouseLockIfNecessary(); |
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
758 (fullscreened_tab_ == mouse_lock_tab_ && IsPrivilegedFullscreenForTab()) ? | 758 (fullscreened_tab_ == mouse_lock_tab_ && IsPrivilegedFullscreenForTab()) ? |
759 mouse_lock_tab_->GetFullscreenRenderWidgetHostView() : NULL; | 759 mouse_lock_tab_->GetFullscreenRenderWidgetHostView() : NULL; |
760 if (!mouse_lock_view) { | 760 if (!mouse_lock_view) { |
761 RenderViewHost* const rvh = mouse_lock_tab_->GetRenderViewHost(); | 761 RenderViewHost* const rvh = mouse_lock_tab_->GetRenderViewHost(); |
762 if (rvh) | 762 if (rvh) |
763 mouse_lock_view = rvh->GetView(); | 763 mouse_lock_view = rvh->GetView(); |
764 } | 764 } |
765 if (mouse_lock_view) | 765 if (mouse_lock_view) |
766 mouse_lock_view->UnlockMouse(); | 766 mouse_lock_view->UnlockMouse(); |
767 } | 767 } |
OLD | NEW |