OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/browser/content_settings/host_content_settings_map.h" | 9 #include "chrome/browser/content_settings/host_content_settings_map.h" |
10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
11 #include "chrome/browser/ui/browser.h" | 11 #include "chrome/browser/ui/browser.h" |
12 #include "chrome/browser/ui/browser_window.h" | 12 #include "chrome/browser/ui/browser_window.h" |
13 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 13 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
14 #include "chrome/common/chrome_notification_types.h" | 14 #include "chrome/common/chrome_notification_types.h" |
15 #include "chrome/common/chrome_switches.h" | 15 #include "chrome/common/chrome_switches.h" |
| 16 #include "content/browser/renderer_host/render_view_host.h" |
16 #include "content/browser/user_metrics.h" | 17 #include "content/browser/user_metrics.h" |
17 #include "content/public/browser/notification_service.h" | 18 #include "content/public/browser/notification_service.h" |
18 | 19 |
19 FullscreenController::FullscreenController(BrowserWindow* window, | 20 FullscreenController::FullscreenController(BrowserWindow* window, |
20 Profile* profile, | 21 Profile* profile, |
21 Browser* browser) | 22 Browser* browser) |
22 : window_(window), | 23 : window_(window), |
23 profile_(profile), | 24 profile_(profile), |
24 browser_(browser), | 25 browser_(browser), |
25 fullscreened_tab_(NULL), | 26 fullscreened_tab_(NULL), |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 } | 270 } |
270 | 271 |
271 bool FullscreenController::HandleUserPressedEscape() { | 272 bool FullscreenController::HandleUserPressedEscape() { |
272 if (!IsFullscreenForTab()) | 273 if (!IsFullscreenForTab()) |
273 return false; | 274 return false; |
274 ExitTabbedFullscreenModeIfNecessary(); | 275 ExitTabbedFullscreenModeIfNecessary(); |
275 return true; | 276 return true; |
276 } | 277 } |
277 | 278 |
278 void FullscreenController::NotifyTabOfFullscreenExitIfNecessary() { | 279 void FullscreenController::NotifyTabOfFullscreenExitIfNecessary() { |
279 if (fullscreened_tab_) | 280 if (fullscreened_tab_ && |
280 fullscreened_tab_->ExitFullscreenMode(); | 281 fullscreened_tab_->tab_contents()->render_view_host()) { |
281 else | 282 fullscreened_tab_->tab_contents()->render_view_host()->ExitFullscreen(); |
| 283 } else { |
282 DCHECK_EQ(mouse_lock_state_, MOUSELOCK_NOT_REQUESTED); | 284 DCHECK_EQ(mouse_lock_state_, MOUSELOCK_NOT_REQUESTED); |
| 285 } |
283 | 286 |
284 fullscreened_tab_ = NULL; | 287 fullscreened_tab_ = NULL; |
285 tab_caused_fullscreen_ = false; | 288 tab_caused_fullscreen_ = false; |
286 tab_fullscreen_accepted_ = false; | 289 tab_fullscreen_accepted_ = false; |
287 mouse_lock_state_ = MOUSELOCK_NOT_REQUESTED; | 290 mouse_lock_state_ = MOUSELOCK_NOT_REQUESTED; |
288 | 291 |
289 UpdateFullscreenExitBubbleContent(); | 292 UpdateFullscreenExitBubbleContent(); |
290 } | 293 } |
291 | 294 |
292 void FullscreenController::ExitTabbedFullscreenModeIfNecessary() { | 295 void FullscreenController::ExitTabbedFullscreenModeIfNecessary() { |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
342 | 345 |
343 ContentSetting | 346 ContentSetting |
344 FullscreenController::GetMouseLockSetting(const GURL& url) const { | 347 FullscreenController::GetMouseLockSetting(const GURL& url) const { |
345 if (url.SchemeIsFile()) | 348 if (url.SchemeIsFile()) |
346 return CONTENT_SETTING_ALLOW; | 349 return CONTENT_SETTING_ALLOW; |
347 | 350 |
348 HostContentSettingsMap* settings_map = profile_->GetHostContentSettingsMap(); | 351 HostContentSettingsMap* settings_map = profile_->GetHostContentSettingsMap(); |
349 return settings_map->GetContentSetting(url, url, | 352 return settings_map->GetContentSetting(url, url, |
350 CONTENT_SETTINGS_TYPE_MOUSELOCK, std::string()); | 353 CONTENT_SETTINGS_TYPE_MOUSELOCK, std::string()); |
351 } | 354 } |
OLD | NEW |