| 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/renderer_host/render_view_host.h" |
| 17 #include "content/browser/user_metrics.h" | |
| 18 #include "content/public/browser/notification_service.h" | 17 #include "content/public/browser/notification_service.h" |
| 18 #include "content/public/browser/user_metrics.h" |
| 19 |
| 20 using content::UserMetricsAction; |
| 19 | 21 |
| 20 FullscreenController::FullscreenController(BrowserWindow* window, | 22 FullscreenController::FullscreenController(BrowserWindow* window, |
| 21 Profile* profile, | 23 Profile* profile, |
| 22 Browser* browser) | 24 Browser* browser) |
| 23 : window_(window), | 25 : window_(window), |
| 24 profile_(profile), | 26 profile_(profile), |
| 25 browser_(browser), | 27 browser_(browser), |
| 26 fullscreened_tab_(NULL), | 28 fullscreened_tab_(NULL), |
| 27 tab_caused_fullscreen_(false), | 29 tab_caused_fullscreen_(false), |
| 28 tab_fullscreen_accepted_(false), | 30 tab_fullscreen_accepted_(false), |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 window_->IsFullscreen()) | 160 window_->IsFullscreen()) |
| 159 return; | 161 return; |
| 160 #endif | 162 #endif |
| 161 | 163 |
| 162 GURL url; | 164 GURL url; |
| 163 if (for_tab) { | 165 if (for_tab) { |
| 164 url = browser_->GetSelectedTabContents()->GetURL(); | 166 url = browser_->GetSelectedTabContents()->GetURL(); |
| 165 tab_fullscreen_accepted_ = entering_fullscreen && | 167 tab_fullscreen_accepted_ = entering_fullscreen && |
| 166 GetFullscreenSetting(url) == CONTENT_SETTING_ALLOW; | 168 GetFullscreenSetting(url) == CONTENT_SETTING_ALLOW; |
| 167 } else { | 169 } else { |
| 168 UserMetrics::RecordAction(UserMetricsAction("ToggleFullscreen")); | 170 content::RecordAction(UserMetricsAction("ToggleFullscreen")); |
| 169 } | 171 } |
| 170 if (entering_fullscreen) | 172 if (entering_fullscreen) |
| 171 window_->EnterFullscreen(url, GetFullscreenExitBubbleType()); | 173 window_->EnterFullscreen(url, GetFullscreenExitBubbleType()); |
| 172 else | 174 else |
| 173 window_->ExitFullscreen(); | 175 window_->ExitFullscreen(); |
| 174 | 176 |
| 175 // Once the window has become fullscreen it'll call back to | 177 // Once the window has become fullscreen it'll call back to |
| 176 // WindowFullscreenStateChanged(). We don't do this immediately as | 178 // WindowFullscreenStateChanged(). We don't do this immediately as |
| 177 // BrowserWindow::EnterFullscreen() asks for bookmark_bar_state_, so we let | 179 // BrowserWindow::EnterFullscreen() asks for bookmark_bar_state_, so we let |
| 178 // the BrowserWindow invoke WindowFullscreenStateChanged when appropriate. | 180 // the BrowserWindow invoke WindowFullscreenStateChanged when appropriate. |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 345 | 347 |
| 346 ContentSetting | 348 ContentSetting |
| 347 FullscreenController::GetMouseLockSetting(const GURL& url) const { | 349 FullscreenController::GetMouseLockSetting(const GURL& url) const { |
| 348 if (url.SchemeIsFile()) | 350 if (url.SchemeIsFile()) |
| 349 return CONTENT_SETTING_ALLOW; | 351 return CONTENT_SETTING_ALLOW; |
| 350 | 352 |
| 351 HostContentSettingsMap* settings_map = profile_->GetHostContentSettingsMap(); | 353 HostContentSettingsMap* settings_map = profile_->GetHostContentSettingsMap(); |
| 352 return settings_map->GetContentSetting(url, url, | 354 return settings_map->GetContentSetting(url, url, |
| 353 CONTENT_SETTINGS_TYPE_MOUSELOCK, std::string()); | 355 CONTENT_SETTINGS_TYPE_MOUSELOCK, std::string()); |
| 354 } | 356 } |
| OLD | NEW |