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

Unified Diff: chrome/browser/ui/cocoa/browser_window_controller_private.mm

Issue 600303003: mac: Add metrics for fullscreen entry. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add INVALID enum values. Created 6 years, 2 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/cocoa/browser_window_controller_private.mm
diff --git a/chrome/browser/ui/cocoa/browser_window_controller_private.mm b/chrome/browser/ui/cocoa/browser_window_controller_private.mm
index 8dd4f36cd8f3e6637a4dc67edcc605b3db301b24..a28c8b0a966154c9280e70a32202826e6f3297df 100644
--- a/chrome/browser/ui/cocoa/browser_window_controller_private.mm
+++ b/chrome/browser/ui/cocoa/browser_window_controller_private.mm
@@ -10,6 +10,7 @@
#include "base/mac/mac_util.h"
#import "base/mac/scoped_nsobject.h"
#import "base/mac/sdk_forward_declarations.h"
+#include "base/metrics/histogram.h"
#include "base/prefs/pref_service.h"
#include "base/prefs/scoped_user_pref_update.h"
#include "chrome/browser/browser_process.h"
@@ -50,6 +51,75 @@
using content::RenderWidgetHostView;
using content::WebContents;
+namespace {
+
+// Each time the user enters fullscreen, a single histogram enumeration is
+// recorded. There are several relevant parameters, whose values are mapped
+// directly into individual bits of the enumeration.
+//
+// + Fullscreen Mechanism: The mechanism by which the window's size is changed
+// to encompass the entire screen. Bit 0.
+// - AppKit (value of bit: 1)
+// - Immersive (value of bit: 0)
+//
+// + Primary Screen: Whether the window is located on the screen at index 0.
+// Depending on OSX version, this has different implications for menu bar
+// visibility. Bit 1.
+// - Primary (value of bit: 1)
+// - Secondary (value of bit: 0)
+//
+// + Displays have separate spaces: An option available in Mission Control in
+// OSX 10.9+. Bit 2.
+// - On (value of bit: 1)
+// - Off (value of bit: 0)
+//
+// + Multiple screens: Whether the user has multiple screens. If the window is
+// located on a secondary screen, then there must be multiple screens. Bit 3.
+// - Yes (value of bit: 1)
+// - No (value of bit: 0)
+
+enum FullscreenMechanism {
+ IMMERSIVE_FULLSCREEN_MECHANISM,
+ APPKIT_FULLSCREEN_MECHANISM,
+};
+
+enum {
+ FULLSCREEN_MECHANISM_BIT = 0,
+ PRIMARY_SCREEN_BIT = 1,
+ DISPLAYS_SEPARATE_SPACES_BIT = 2,
+ MULTIPLE_SCREENS_BIT = 3,
+ BIT_COUNT
+};
+
+// Emits a histogram entry indicating that |window| is being made fullscreen.
+void RecordFullscreenHistogram(FullscreenMechanism mechanism,
+ NSWindow* window) {
+ NSArray* screens = [NSScreen screens];
+ bool primary_screen = ([[window screen] isEqual:[screens objectAtIndex:0]]);
+ bool displays_have_separate_spaces =
+ [NSScreen respondsToSelector:@selector(screensHaveSeparateSpaces)] &&
+ [NSScreen screensHaveSeparateSpaces];
+ bool multiple_screens = [screens count] > 1;
+
+ int output = 0;
+ if (mechanism == APPKIT_FULLSCREEN_MECHANISM)
+ output += 1 << FULLSCREEN_MECHANISM_BIT;
+
+ if (primary_screen)
+ output += 1 << PRIMARY_SCREEN_BIT;
+
+ if (displays_have_separate_spaces)
+ output += 1 << DISPLAYS_SEPARATE_SPACES_BIT;
+
+ if (multiple_screens)
+ output += 1 << MULTIPLE_SCREENS_BIT;
+
+ int max_output = 1 << BIT_COUNT;
+ UMA_HISTOGRAM_ENUMERATION("OSX.Fullscreen.Enter", output, max_output);
+}
+
+} // namespace
+
@implementation BrowserWindowController(Private)
// Create the tab strip controller.
@@ -449,6 +519,8 @@ willPositionSheet:(NSWindow*)sheet
}
- (void)enterImmersiveFullscreen {
+ RecordFullscreenHistogram(IMMERSIVE_FULLSCREEN_MECHANISM, [self window]);
+
// Set to NO by |-windowDidEnterFullScreen:|.
enteringImmersiveFullscreen_ = YES;
@@ -601,6 +673,8 @@ willPositionSheet:(NSWindow*)sheet
}
- (void)windowWillEnterFullScreen:(NSNotification*)notification {
+ RecordFullscreenHistogram(APPKIT_FULLSCREEN_MECHANISM, [self window]);
+
if (notification) // For System Fullscreen when non-nil.
[self registerForContentViewResizeNotifications];
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698