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" |
(...skipping 10 matching lines...) Expand all Loading... |
21 #include "chrome/common/chrome_switches.h" | 21 #include "chrome/common/chrome_switches.h" |
22 #include "content/public/browser/navigation_details.h" | 22 #include "content/public/browser/navigation_details.h" |
23 #include "content/public/browser/navigation_entry.h" | 23 #include "content/public/browser/navigation_entry.h" |
24 #include "content/public/browser/notification_service.h" | 24 #include "content/public/browser/notification_service.h" |
25 #include "content/public/browser/render_view_host.h" | 25 #include "content/public/browser/render_view_host.h" |
26 #include "content/public/browser/render_widget_host_view.h" | 26 #include "content/public/browser/render_widget_host_view.h" |
27 #include "content/public/browser/user_metrics.h" | 27 #include "content/public/browser/user_metrics.h" |
28 #include "content/public/browser/web_contents.h" | 28 #include "content/public/browser/web_contents.h" |
29 #include "content/public/browser/web_contents_view.h" | 29 #include "content/public/browser/web_contents_view.h" |
30 #include "extensions/common/extension.h" | 30 #include "extensions/common/extension.h" |
| 31 #include "ui/gfx/layout_util.h" |
31 | 32 |
32 #if defined(OS_MACOSX) | 33 #if defined(OS_MACOSX) |
33 #include "base/mac/mac_util.h" | 34 #include "base/mac/mac_util.h" |
34 #else | 35 #else |
35 #include "base/prefs/pref_service.h" | 36 #include "base/prefs/pref_service.h" |
36 #include "chrome/common/pref_names.h" | 37 #include "chrome/common/pref_names.h" |
37 #endif | 38 #endif |
38 | 39 |
39 using base::UserMetricsAction; | 40 using base::UserMetricsAction; |
40 using content::RenderViewHost; | 41 using content::RenderViewHost; |
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
305 // size was never specified by the capturer. | 306 // size was never specified by the capturer. |
306 if (old_contents->GetCapturerCount() == 0 || | 307 if (old_contents->GetCapturerCount() == 0 || |
307 old_contents->GetPreferredSize().IsEmpty()) { | 308 old_contents->GetPreferredSize().IsEmpty()) { |
308 return; | 309 return; |
309 } | 310 } |
310 | 311 |
311 content::RenderWidgetHostView* const current_fs_view = | 312 content::RenderWidgetHostView* const current_fs_view = |
312 old_contents->GetFullscreenRenderWidgetHostView(); | 313 old_contents->GetFullscreenRenderWidgetHostView(); |
313 if (current_fs_view) | 314 if (current_fs_view) |
314 current_fs_view->SetSize(old_contents->GetPreferredSize()); | 315 current_fs_view->SetSize(old_contents->GetPreferredSize()); |
315 old_contents->GetView()->SizeContents(old_contents->GetPreferredSize()); | 316 gfx::ResizeWebContents(old_contents, old_contents->GetPreferredSize()); |
316 } | 317 } |
317 | 318 |
318 void FullscreenController::OnTabClosing(WebContents* web_contents) { | 319 void FullscreenController::OnTabClosing(WebContents* web_contents) { |
319 if (IsFullscreenForCapturedTab(web_contents)) { | 320 if (IsFullscreenForCapturedTab(web_contents)) { |
320 RenderViewHost* const rvh = web_contents->GetRenderViewHost(); | 321 RenderViewHost* const rvh = web_contents->GetRenderViewHost(); |
321 if (rvh) | 322 if (rvh) |
322 rvh->ExitFullscreen(); | 323 rvh->ExitFullscreen(); |
323 } else if (web_contents == fullscreened_tab_ || | 324 } else if (web_contents == fullscreened_tab_ || |
324 web_contents == mouse_lock_tab_) { | 325 web_contents == mouse_lock_tab_) { |
325 ExitTabFullscreenOrMouseLockIfNecessary(); | 326 ExitTabFullscreenOrMouseLockIfNecessary(); |
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
769 (fullscreened_tab_ == mouse_lock_tab_ && IsPrivilegedFullscreenForTab()) ? | 770 (fullscreened_tab_ == mouse_lock_tab_ && IsPrivilegedFullscreenForTab()) ? |
770 mouse_lock_tab_->GetFullscreenRenderWidgetHostView() : NULL; | 771 mouse_lock_tab_->GetFullscreenRenderWidgetHostView() : NULL; |
771 if (!mouse_lock_view) { | 772 if (!mouse_lock_view) { |
772 RenderViewHost* const rvh = mouse_lock_tab_->GetRenderViewHost(); | 773 RenderViewHost* const rvh = mouse_lock_tab_->GetRenderViewHost(); |
773 if (rvh) | 774 if (rvh) |
774 mouse_lock_view = rvh->GetView(); | 775 mouse_lock_view = rvh->GetView(); |
775 } | 776 } |
776 if (mouse_lock_view) | 777 if (mouse_lock_view) |
777 mouse_lock_view->UnlockMouse(); | 778 mouse_lock_view->UnlockMouse(); |
778 } | 779 } |
OLD | NEW |