Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(313)

Side by Side Diff: chrome/browser/ui/fullscreen_controller.cc

Issue 8919017: Split UserMetrics into API vs. implementation. Move API to content/public. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Version for commit (merged again). Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/tab_contents/tab_contents.h" 17 #include "content/browser/tab_contents/tab_contents.h"
18 #include "content/browser/user_metrics.h"
19 #include "content/public/browser/notification_service.h" 18 #include "content/public/browser/notification_service.h"
19 #include "content/public/browser/user_metrics.h"
20
21 using content::UserMetricsAction;
20 22
21 FullscreenController::FullscreenController(BrowserWindow* window, 23 FullscreenController::FullscreenController(BrowserWindow* window,
22 Profile* profile, 24 Profile* profile,
23 Browser* browser) 25 Browser* browser)
24 : window_(window), 26 : window_(window),
25 profile_(profile), 27 profile_(profile),
26 browser_(browser), 28 browser_(browser),
27 fullscreened_tab_(NULL), 29 fullscreened_tab_(NULL),
28 tab_caused_fullscreen_(false), 30 tab_caused_fullscreen_(false),
29 tab_fullscreen_accepted_(false), 31 tab_fullscreen_accepted_(false),
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 window_->IsFullscreen()) 161 window_->IsFullscreen())
160 return; 162 return;
161 #endif 163 #endif
162 164
163 GURL url; 165 GURL url;
164 if (for_tab) { 166 if (for_tab) {
165 url = browser_->GetSelectedTabContents()->GetURL(); 167 url = browser_->GetSelectedTabContents()->GetURL();
166 tab_fullscreen_accepted_ = entering_fullscreen && 168 tab_fullscreen_accepted_ = entering_fullscreen &&
167 GetFullscreenSetting(url) == CONTENT_SETTING_ALLOW; 169 GetFullscreenSetting(url) == CONTENT_SETTING_ALLOW;
168 } else { 170 } else {
169 UserMetrics::RecordAction(UserMetricsAction("ToggleFullscreen")); 171 content::RecordAction(UserMetricsAction("ToggleFullscreen"));
170 } 172 }
171 if (entering_fullscreen) 173 if (entering_fullscreen)
172 window_->EnterFullscreen(url, GetFullscreenExitBubbleType()); 174 window_->EnterFullscreen(url, GetFullscreenExitBubbleType());
173 else 175 else
174 window_->ExitFullscreen(); 176 window_->ExitFullscreen();
175 177
176 // Once the window has become fullscreen it'll call back to 178 // Once the window has become fullscreen it'll call back to
177 // WindowFullscreenStateChanged(). We don't do this immediately as 179 // WindowFullscreenStateChanged(). We don't do this immediately as
178 // BrowserWindow::EnterFullscreen() asks for bookmark_bar_state_, so we let 180 // BrowserWindow::EnterFullscreen() asks for bookmark_bar_state_, so we let
179 // the BrowserWindow invoke WindowFullscreenStateChanged when appropriate. 181 // the BrowserWindow invoke WindowFullscreenStateChanged when appropriate.
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 348
347 ContentSetting 349 ContentSetting
348 FullscreenController::GetMouseLockSetting(const GURL& url) const { 350 FullscreenController::GetMouseLockSetting(const GURL& url) const {
349 if (url.SchemeIsFile()) 351 if (url.SchemeIsFile())
350 return CONTENT_SETTING_ALLOW; 352 return CONTENT_SETTING_ALLOW;
351 353
352 HostContentSettingsMap* settings_map = profile_->GetHostContentSettingsMap(); 354 HostContentSettingsMap* settings_map = profile_->GetHostContentSettingsMap();
353 return settings_map->GetContentSetting(url, url, 355 return settings_map->GetContentSetting(url, url,
354 CONTENT_SETTINGS_TYPE_MOUSELOCK, std::string()); 356 CONTENT_SETTINGS_TYPE_MOUSELOCK, std::string());
355 } 357 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698