Commit c6329150 authored by Ramin Halavati's avatar Ramin Halavati Committed by Commit Bot

Move BrowserProfileType enum to //components/profile_metrics.

BrowserProfileType is needed to be used in component metrics (like in
navigation_metrics and autofil). To avoid layering issues, it's moved
from //chrome/browser/profile_metrics.h
to //components/profile_metrics/browser_profile_type.h

Bug: 966747
Change-Id: Ica7616315303ca816ebfd8eed3ab07317386fdec
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1655390
Commit-Queue: Peter Kasting <pkasting@chromium.org>
Reviewed-by: default avatarMihai Sardarescu <msarda@chromium.org>
Reviewed-by: default avataranthonyvd <anthonyvd@chromium.org>
Reviewed-by: default avatarPeter Kasting <pkasting@chromium.org>
Cr-Commit-Position: refs/heads/master@{#669706}
parent f88c9640
......@@ -20,6 +20,7 @@
#include "chrome/browser/signin/chrome_signin_helper.h"
#include "chrome/common/chrome_constants.h"
#include "chrome/installer/util/google_update_settings.h"
#include "components/profile_metrics/browser_profile_type.h"
#include "components/profile_metrics/counts.h"
#include "content/public/browser/browser_thread.h"
......@@ -213,24 +214,25 @@ bool ProfileMetrics::CountProfileInformation(ProfileManager* manager,
return true;
}
ProfileMetrics::BrowserProfileType ProfileMetrics::GetBrowserProfileType(
profile_metrics::BrowserProfileType ProfileMetrics::GetBrowserProfileType(
Profile* profile) {
if (profile->IsSystemProfile())
return BrowserProfileType::kSystem;
return profile_metrics::BrowserProfileType::kSystem;
if (profile->IsGuestSession())
return BrowserProfileType::kGuest;
return profile_metrics::BrowserProfileType::kGuest;
// A regular profile can be in a guest session or a system profile. Hence it
// should be checked after them.
if (profile->IsRegularProfile())
return BrowserProfileType::kRegular;
return profile_metrics::BrowserProfileType::kRegular;
if (profile->IsIncognitoProfile()) {
return profile->IsIndependentOffTheRecordProfile()
? BrowserProfileType::kIndependentIncognitoProfile
: BrowserProfileType::kIncognito;
? profile_metrics::BrowserProfileType::
kIndependentIncognitoProfile
: profile_metrics::BrowserProfileType::kIncognito;
}
NOTREACHED();
return BrowserProfileType::kMaxValue;
return profile_metrics::BrowserProfileType::kMaxValue;
}
#if !defined(OS_ANDROID)
......
......@@ -20,6 +20,7 @@ class FilePath;
}
namespace profile_metrics {
enum class BrowserProfileType;
struct Counts;
}
......@@ -111,17 +112,6 @@ class ProfileMetrics {
NUM_PROFILE_AUTH_METRICS
};
// These values are persisted to logs. Entries should not be renumbered and
// numeric values should never be reused.
enum class BrowserProfileType {
kRegular = 0,
kIncognito = 1,
kGuest = 2,
kSystem = 3,
kIndependentIncognitoProfile = 4,
kMaxValue = kIndependentIncognitoProfile,
};
// Enum for tracking user interactions with the user menu and user manager.
// Interactions initiated from the content area are logged into a different
// histogram from those that were initiated from the avatar button.
......@@ -187,7 +177,8 @@ class ProfileMetrics {
#endif
// Returns profile type for logging.
static BrowserProfileType GetBrowserProfileType(Profile* profile);
static profile_metrics::BrowserProfileType GetBrowserProfileType(
Profile* profile);
static void LogNumberOfProfiles(ProfileManager* manager);
static void LogProfileAddNewUser(ProfileAdd metric);
......
......@@ -1338,6 +1338,7 @@ jumbo_split_static_library("ui") {
"//components/feedback/proto",
"//components/keep_alive_registry",
"//components/network_session_configurator/common",
"//components/profile_metrics",
"//components/ui_metrics",
"//components/url_formatter",
"//components/vector_icons",
......
......@@ -37,7 +37,7 @@ bool IsBookmarkBarLocation(BookmarkLaunchLocation location) {
void RecordBookmarkLaunch(const BookmarkNode* node,
BookmarkLaunchLocation location,
ProfileMetrics::BrowserProfileType profile_type) {
profile_metrics::BrowserProfileType profile_type) {
if (IsBookmarkBarLocation(location)) {
base::RecordAction(base::UserMetricsAction("ClickedBookmarkBarURLButton"));
} else if (location == BOOKMARK_LAUNCH_LOCATION_APP_MENU) {
......
......@@ -5,7 +5,7 @@
#ifndef CHROME_BROWSER_UI_BOOKMARKS_BOOKMARK_STATS_H_
#define CHROME_BROWSER_UI_BOOKMARKS_BOOKMARK_STATS_H_
#include "chrome/browser/profiles/profile_metrics.h"
#include "components/profile_metrics/browser_profile_type.h"
namespace bookmarks {
class BookmarkNode;
......@@ -48,7 +48,7 @@ enum BookmarkLaunchLocation {
// Records the launch of a bookmark for UMA purposes.
void RecordBookmarkLaunch(const bookmarks::BookmarkNode* node,
BookmarkLaunchLocation location,
ProfileMetrics::BrowserProfileType profile_type);
profile_metrics::BrowserProfileType profile_type);
// Records the user launching all bookmarks in a folder (via middle-click, etc.)
// for UMA purposes.
......
......@@ -4,6 +4,7 @@
static_library("profile_metrics") {
sources = [
"browser_profile_type.h",
"counts.cc",
"counts.h",
]
......
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef COMPONENTS_PROFILE_METRICS_BROWSER_PROFILE_TYPE_H_
#define COMPONENTS_PROFILE_METRICS_BROWSER_PROFILE_TYPE_H_
namespace profile_metrics {
// These values are persisted to logs. Entries should not be renumbered and
// numeric values should never be reused.
enum class BrowserProfileType {
kRegular = 0,
kIncognito = 1,
kGuest = 2,
kSystem = 3,
kIndependentIncognitoProfile = 4,
kMaxValue = kIndependentIncognitoProfile,
};
} // namespace profile_metrics
#endif // COMPONENTS_PROFILE_METRICS_BROWSER_PROFILE_TYPE_H_
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment