Record scheme of URLs that set Secure cookies

This CL histograms the type of scheme (cryptographic or not
cryptographic) for URLs that set or overwrite Secure cookies. The goal
is to measure whether we can remove the ability for http:// URLs to set
Secure cookies.

BUG=522261

Review URL: https://codereview.chromium.org/1303593002

Cr-Commit-Position: refs/heads/master@{#344907}
diff --git a/net/cookies/cookie_monster.h b/net/cookies/cookie_monster.h
index 0367343..ced1c23 100644
--- a/net/cookies/cookie_monster.h
+++ b/net/cookies/cookie_monster.h
@@ -360,6 +360,9 @@
   // For ComputeCookieDiff.
   FRIEND_TEST_ALL_PREFIXES(CookieMonsterTest, ComputeCookieDiff);
 
+  // For CookieSource histogram enum.
+  FRIEND_TEST_ALL_PREFIXES(CookieMonsterTest, CookieSourceHistogram);
+
   // Internal reasons for deletion, used to populate informative histograms
   // and to provide a public cause for onCookieChange notifications.
   //
@@ -410,6 +413,26 @@
     COOKIE_TYPE_LAST_ENTRY
   };
 
+  // Used to populate a histogram containing information about the
+  // sources of Secure and non-Secure cookies: that is, whether such
+  // cookies are set by origins with cryptographic or non-cryptographic
+  // schemes. Please do not reorder the list when adding new
+  // entries. New items MUST be added at the end of the list, just
+  // before COOKIE_SOURCE_LAST_ENTRY.
+  //
+  // COOKIE_SOURCE_(NON)SECURE_COOKIE_(NON)CRYPTOGRAPHIC_SCHEME means
+  // that a cookie was set or overwritten from a URL with the given type
+  // of scheme. This enum should not be used when cookies are *cleared*,
+  // because its purpose is to understand if Chrome can deprecate the
+  // ability of HTTP urls to set/overwrite Secure cookies.
+  enum CookieSource {
+    COOKIE_SOURCE_SECURE_COOKIE_CRYPTOGRAPHIC_SCHEME = 0,
+    COOKIE_SOURCE_SECURE_COOKIE_NONCRYPTOGRAPHIC_SCHEME,
+    COOKIE_SOURCE_NONSECURE_COOKIE_CRYPTOGRAPHIC_SCHEME,
+    COOKIE_SOURCE_NONSECURE_COOKIE_NONCRYPTOGRAPHIC_SCHEME,
+    COOKIE_SOURCE_LAST_ENTRY
+  };
+
   // The strategy for fetching cookies. Controlled by Finch experiment.
   enum FetchStrategy {
     // Fetches all cookies only when they're needed.
@@ -658,6 +681,7 @@
   base::HistogramBase* histogram_count_;
   base::HistogramBase* histogram_cookie_deletion_cause_;
   base::HistogramBase* histogram_cookie_type_;
+  base::HistogramBase* histogram_cookie_source_scheme_;
   base::HistogramBase* histogram_time_blocked_on_load_;
 
   CookieMap cookies_;