Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / chrome / browser / metrics / chrome_browser_main_extra_parts_metrics_mac.mm
blob2b515c317ba14dd76f489eaf0579647141141aae
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "chrome/browser/metrics/chrome_browser_main_extra_parts_metrics.h"
7 #include "base/mac/sdk_forward_declarations.h"
8 #include "base/metrics/histogram.h"
10 namespace {
12 // The possible values of the setting "Screens Have Separate Spaces".
13 enum ScreenSpacesConfiguration {
14   SCREENS_CANNOT_HAVE_SEPARATE_SPACES = 0,
15   SCREENS_HAVE_SEPARATE_SPACES = 1,
16   SCREENS_HAVE_SHARED_SPACES = 2,
17   SCREEN_SPACES_CONFIGURATION_COUNT = 3
20 }  // namespace
22 void ChromeBrowserMainExtraPartsMetrics::RecordMacMetrics() {
23   ScreenSpacesConfiguration separate_spaces =
24       SCREENS_CANNOT_HAVE_SEPARATE_SPACES;
26   if ([NSScreen respondsToSelector:@selector(screensHaveSeparateSpaces)]) {
27     BOOL screens_have_separate_spaces = [NSScreen screensHaveSeparateSpaces];
28     separate_spaces = screens_have_separate_spaces
29                           ? SCREENS_HAVE_SEPARATE_SPACES
30                           : SCREENS_HAVE_SHARED_SPACES;
31   }
32   UMA_HISTOGRAM_ENUMERATION("OSX.Settings.ScreensHaveSeparateSpaces",
33                             separate_spaces,
34                             SCREEN_SPACES_CONFIGURATION_COUNT);