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: Mihai Sardarescu <msarda@chromium.org>
Reviewed-by: anthonyvd <anthonyvd@chromium.org>
Reviewed-by: Peter Kasting <pkasting@chromium.org>
Cr-Commit-Position: refs/heads/master@{#669706}
diff --git a/chrome/browser/profiles/profile_metrics.cc b/chrome/browser/profiles/profile_metrics.cc
index a34826b..99e998de 100644
--- a/chrome/browser/profiles/profile_metrics.cc
+++ b/chrome/browser/profiles/profile_metrics.cc
@@ -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 @@
   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)
diff --git a/chrome/browser/profiles/profile_metrics.h b/chrome/browser/profiles/profile_metrics.h
index 675727f7..72fedfc 100644
--- a/chrome/browser/profiles/profile_metrics.h
+++ b/chrome/browser/profiles/profile_metrics.h
@@ -20,6 +20,7 @@
 }
 
 namespace profile_metrics {
+enum class BrowserProfileType;
 struct Counts;
 }
 
@@ -111,17 +112,6 @@
     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 @@
 #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);
diff --git a/chrome/browser/ui/BUILD.gn b/chrome/browser/ui/BUILD.gn
index be73aa2..ed529c07a 100644
--- a/chrome/browser/ui/BUILD.gn
+++ b/chrome/browser/ui/BUILD.gn
@@ -1338,6 +1338,7 @@
       "//components/feedback/proto",
       "//components/keep_alive_registry",
       "//components/network_session_configurator/common",
+      "//components/profile_metrics",
       "//components/ui_metrics",
       "//components/url_formatter",
       "//components/vector_icons",
diff --git a/chrome/browser/ui/bookmarks/bookmark_stats.cc b/chrome/browser/ui/bookmarks/bookmark_stats.cc
index 647fc43f..aca328d 100644
--- a/chrome/browser/ui/bookmarks/bookmark_stats.cc
+++ b/chrome/browser/ui/bookmarks/bookmark_stats.cc
@@ -37,7 +37,7 @@
 
 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) {
diff --git a/chrome/browser/ui/bookmarks/bookmark_stats.h b/chrome/browser/ui/bookmarks/bookmark_stats.h
index d8adeec8..32717631 100644
--- a/chrome/browser/ui/bookmarks/bookmark_stats.h
+++ b/chrome/browser/ui/bookmarks/bookmark_stats.h
@@ -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 @@
 // 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.
diff --git a/components/profile_metrics/BUILD.gn b/components/profile_metrics/BUILD.gn
index fe85cf6..6f4666d8 100644
--- a/components/profile_metrics/BUILD.gn
+++ b/components/profile_metrics/BUILD.gn
@@ -4,6 +4,7 @@
 
 static_library("profile_metrics") {
   sources = [
+    "browser_profile_type.h",
     "counts.cc",
     "counts.h",
   ]
diff --git a/components/profile_metrics/browser_profile_type.h b/components/profile_metrics/browser_profile_type.h
new file mode 100644
index 0000000..916972c
--- /dev/null
+++ b/components/profile_metrics/browser_profile_type.h
@@ -0,0 +1,23 @@
+// 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