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

Unified Diff: chrome/renderer/content_settings_observer.cc

Issue 1583813003: Remove obsolete histogram values from SSL.InsecureContent (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: mpearson comment Created 4 years, 11 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 | « chrome/renderer/content_settings_observer.h ('k') | components/test_runner/web_content_settings.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/renderer/content_settings_observer.cc
diff --git a/chrome/renderer/content_settings_observer.cc b/chrome/renderer/content_settings_observer.cc
index 2a2ba4e6cf144eb5547e8a4c234bb805f0fafd17..f90a0cafa506ba8ab8bc5cf4caef1cc141ee12a6 100644
--- a/chrome/renderer/content_settings_observer.cc
+++ b/chrome/renderer/content_settings_observer.cc
@@ -43,76 +43,53 @@ using content::NavigationState;
namespace {
+// This enum is histogrammed, so do not add, reorder, or remove values.
enum {
INSECURE_CONTENT_DISPLAY = 0,
- INSECURE_CONTENT_DISPLAY_HOST_GOOGLE,
- INSECURE_CONTENT_DISPLAY_HOST_WWW_GOOGLE,
+ INSECURE_CONTENT_DISPLAY_HOST_GOOGLE, // deprecated
+ INSECURE_CONTENT_DISPLAY_HOST_WWW_GOOGLE, // deprecated
INSECURE_CONTENT_DISPLAY_HTML,
INSECURE_CONTENT_RUN,
- INSECURE_CONTENT_RUN_HOST_GOOGLE,
- INSECURE_CONTENT_RUN_HOST_WWW_GOOGLE,
- INSECURE_CONTENT_RUN_TARGET_YOUTUBE,
+ INSECURE_CONTENT_RUN_HOST_GOOGLE, // deprecated
+ INSECURE_CONTENT_RUN_HOST_WWW_GOOGLE, // deprecated
+ INSECURE_CONTENT_RUN_TARGET_YOUTUBE, // deprecated
INSECURE_CONTENT_RUN_JS,
INSECURE_CONTENT_RUN_CSS,
INSECURE_CONTENT_RUN_SWF,
- INSECURE_CONTENT_DISPLAY_HOST_YOUTUBE,
- INSECURE_CONTENT_RUN_HOST_YOUTUBE,
- INSECURE_CONTENT_RUN_HOST_GOOGLEUSERCONTENT,
- INSECURE_CONTENT_DISPLAY_HOST_MAIL_GOOGLE,
- INSECURE_CONTENT_RUN_HOST_MAIL_GOOGLE,
- INSECURE_CONTENT_DISPLAY_HOST_PLUS_GOOGLE,
- INSECURE_CONTENT_RUN_HOST_PLUS_GOOGLE,
- INSECURE_CONTENT_DISPLAY_HOST_DOCS_GOOGLE,
- INSECURE_CONTENT_RUN_HOST_DOCS_GOOGLE,
- INSECURE_CONTENT_DISPLAY_HOST_SITES_GOOGLE,
- INSECURE_CONTENT_RUN_HOST_SITES_GOOGLE,
- INSECURE_CONTENT_DISPLAY_HOST_PICASAWEB_GOOGLE,
- INSECURE_CONTENT_RUN_HOST_PICASAWEB_GOOGLE,
- INSECURE_CONTENT_DISPLAY_HOST_GOOGLE_READER,
- INSECURE_CONTENT_RUN_HOST_GOOGLE_READER,
- INSECURE_CONTENT_DISPLAY_HOST_CODE_GOOGLE,
- INSECURE_CONTENT_RUN_HOST_CODE_GOOGLE,
- INSECURE_CONTENT_DISPLAY_HOST_GROUPS_GOOGLE,
- INSECURE_CONTENT_RUN_HOST_GROUPS_GOOGLE,
- INSECURE_CONTENT_DISPLAY_HOST_MAPS_GOOGLE,
- INSECURE_CONTENT_RUN_HOST_MAPS_GOOGLE,
- INSECURE_CONTENT_DISPLAY_HOST_GOOGLE_SUPPORT,
- INSECURE_CONTENT_RUN_HOST_GOOGLE_SUPPORT,
- INSECURE_CONTENT_DISPLAY_HOST_GOOGLE_INTL,
- INSECURE_CONTENT_RUN_HOST_GOOGLE_INTL,
+ INSECURE_CONTENT_DISPLAY_HOST_YOUTUBE, // deprecated
+ INSECURE_CONTENT_RUN_HOST_YOUTUBE, // deprecated
+ INSECURE_CONTENT_RUN_HOST_GOOGLEUSERCONTENT, // deprecated
+ INSECURE_CONTENT_DISPLAY_HOST_MAIL_GOOGLE, // deprecated
+ INSECURE_CONTENT_RUN_HOST_MAIL_GOOGLE, // deprecated
+ INSECURE_CONTENT_DISPLAY_HOST_PLUS_GOOGLE, // deprecated
+ INSECURE_CONTENT_RUN_HOST_PLUS_GOOGLE, // deprecated
+ INSECURE_CONTENT_DISPLAY_HOST_DOCS_GOOGLE, // deprecated
+ INSECURE_CONTENT_RUN_HOST_DOCS_GOOGLE, // deprecated
+ INSECURE_CONTENT_DISPLAY_HOST_SITES_GOOGLE, // deprecated
+ INSECURE_CONTENT_RUN_HOST_SITES_GOOGLE, // deprecated
+ INSECURE_CONTENT_DISPLAY_HOST_PICASAWEB_GOOGLE, // deprecated
+ INSECURE_CONTENT_RUN_HOST_PICASAWEB_GOOGLE, // deprecated
+ INSECURE_CONTENT_DISPLAY_HOST_GOOGLE_READER, // deprecated
+ INSECURE_CONTENT_RUN_HOST_GOOGLE_READER, // deprecated
+ INSECURE_CONTENT_DISPLAY_HOST_CODE_GOOGLE, // deprecated
+ INSECURE_CONTENT_RUN_HOST_CODE_GOOGLE, // deprecated
+ INSECURE_CONTENT_DISPLAY_HOST_GROUPS_GOOGLE, // deprecated
+ INSECURE_CONTENT_RUN_HOST_GROUPS_GOOGLE, // deprecated
+ INSECURE_CONTENT_DISPLAY_HOST_MAPS_GOOGLE, // deprecated
+ INSECURE_CONTENT_RUN_HOST_MAPS_GOOGLE, // deprecated
+ INSECURE_CONTENT_DISPLAY_HOST_GOOGLE_SUPPORT, // deprecated
+ INSECURE_CONTENT_RUN_HOST_GOOGLE_SUPPORT, // deprecated
+ INSECURE_CONTENT_DISPLAY_HOST_GOOGLE_INTL, // deprecated
+ INSECURE_CONTENT_RUN_HOST_GOOGLE_INTL, // deprecated
INSECURE_CONTENT_NUM_EVENTS
};
// Constants for UMA statistic collection.
-static const char kWWWDotGoogleDotCom[] = "www.google.com";
-static const char kMailDotGoogleDotCom[] = "mail.google.com";
-static const char kPlusDotGoogleDotCom[] = "plus.google.com";
-static const char kDocsDotGoogleDotCom[] = "docs.google.com";
-static const char kSitesDotGoogleDotCom[] = "sites.google.com";
-static const char kPicasawebDotGoogleDotCom[] = "picasaweb.google.com";
-static const char kCodeDotGoogleDotCom[] = "code.google.com";
-static const char kGroupsDotGoogleDotCom[] = "groups.google.com";
-static const char kMapsDotGoogleDotCom[] = "maps.google.com";
-static const char kWWWDotYoutubeDotCom[] = "www.youtube.com";
-static const char kDotGoogleUserContentDotCom[] = ".googleusercontent.com";
-static const char kGoogleReaderPathPrefix[] = "/reader/";
-static const char kGoogleSupportPathPrefix[] = "/support/";
-static const char kGoogleIntlPathPrefix[] = "/intl/";
static const char kDotJS[] = ".js";
static const char kDotCSS[] = ".css";
static const char kDotSWF[] = ".swf";
static const char kDotHTML[] = ".html";
-// Constants for mixed-content blocking.
-static const char kGoogleDotCom[] = "google.com";
-
-static bool IsHostInDomain(const std::string& host, const std::string& domain) {
- return (base::EndsWith(host, domain, base::CompareCase::INSENSITIVE_ASCII) &&
- (host.length() == domain.length() ||
- (host.length() > domain.length() &&
- host[host.length() - domain.length() - 1] == '.')));
-}
-
GURL GetOriginOrURL(const WebFrame* frame) {
WebString top_origin = frame->top()->securityOrigin().toString();
// The |top_origin| is unique ("null") e.g., for file:// URLs. Use the
@@ -466,49 +443,9 @@ static void SendInsecureContentSignal(int signal) {
bool ContentSettingsObserver::allowDisplayingInsecureContent(
bool allowed_per_settings,
- const blink::WebSecurityOrigin& origin,
const blink::WebURL& resource_url) {
SendInsecureContentSignal(INSECURE_CONTENT_DISPLAY);
- std::string origin_host(origin.host().utf8());
- WebFrame* frame = render_frame()->GetWebFrame();
- GURL frame_gurl(frame->document().url());
- if (IsHostInDomain(origin_host, kGoogleDotCom)) {
- SendInsecureContentSignal(INSECURE_CONTENT_DISPLAY_HOST_GOOGLE);
- if (base::StartsWith(frame_gurl.path(), kGoogleSupportPathPrefix,
- base::CompareCase::INSENSITIVE_ASCII)) {
- SendInsecureContentSignal(INSECURE_CONTENT_DISPLAY_HOST_GOOGLE_SUPPORT);
- } else if (base::StartsWith(frame_gurl.path(), kGoogleIntlPathPrefix,
- base::CompareCase::INSENSITIVE_ASCII)) {
- SendInsecureContentSignal(INSECURE_CONTENT_DISPLAY_HOST_GOOGLE_INTL);
- }
- }
-
- if (origin_host == kWWWDotGoogleDotCom) {
- SendInsecureContentSignal(INSECURE_CONTENT_DISPLAY_HOST_WWW_GOOGLE);
- if (base::StartsWith(frame_gurl.path(), kGoogleReaderPathPrefix,
- base::CompareCase::INSENSITIVE_ASCII))
- SendInsecureContentSignal(INSECURE_CONTENT_DISPLAY_HOST_GOOGLE_READER);
- } else if (origin_host == kMailDotGoogleDotCom) {
- SendInsecureContentSignal(INSECURE_CONTENT_DISPLAY_HOST_MAIL_GOOGLE);
- } else if (origin_host == kPlusDotGoogleDotCom) {
- SendInsecureContentSignal(INSECURE_CONTENT_DISPLAY_HOST_PLUS_GOOGLE);
- } else if (origin_host == kDocsDotGoogleDotCom) {
- SendInsecureContentSignal(INSECURE_CONTENT_DISPLAY_HOST_DOCS_GOOGLE);
- } else if (origin_host == kSitesDotGoogleDotCom) {
- SendInsecureContentSignal(INSECURE_CONTENT_DISPLAY_HOST_SITES_GOOGLE);
- } else if (origin_host == kPicasawebDotGoogleDotCom) {
- SendInsecureContentSignal(INSECURE_CONTENT_DISPLAY_HOST_PICASAWEB_GOOGLE);
- } else if (origin_host == kCodeDotGoogleDotCom) {
- SendInsecureContentSignal(INSECURE_CONTENT_DISPLAY_HOST_CODE_GOOGLE);
- } else if (origin_host == kGroupsDotGoogleDotCom) {
- SendInsecureContentSignal(INSECURE_CONTENT_DISPLAY_HOST_GROUPS_GOOGLE);
- } else if (origin_host == kMapsDotGoogleDotCom) {
- SendInsecureContentSignal(INSECURE_CONTENT_DISPLAY_HOST_MAPS_GOOGLE);
- } else if (origin_host == kWWWDotYoutubeDotCom) {
- SendInsecureContentSignal(INSECURE_CONTENT_DISPLAY_HOST_YOUTUBE);
- }
-
GURL resource_gurl(resource_url);
if (base::EndsWith(resource_gurl.path(), kDotHTML,
base::CompareCase::INSENSITIVE_ASCII))
@@ -526,55 +463,7 @@ bool ContentSettingsObserver::allowRunningInsecureContent(
bool allowed_per_settings,
const blink::WebSecurityOrigin& origin,
const blink::WebURL& resource_url) {
- std::string origin_host(origin.host().utf8());
- WebFrame* frame = render_frame()->GetWebFrame();
- GURL frame_gurl(frame->document().url());
- DCHECK_EQ(frame_gurl.host(), origin_host);
-
- bool is_google = IsHostInDomain(origin_host, kGoogleDotCom);
- if (is_google) {
- SendInsecureContentSignal(INSECURE_CONTENT_RUN_HOST_GOOGLE);
- if (base::StartsWith(frame_gurl.path(), kGoogleSupportPathPrefix,
- base::CompareCase::INSENSITIVE_ASCII)) {
- SendInsecureContentSignal(INSECURE_CONTENT_RUN_HOST_GOOGLE_SUPPORT);
- } else if (base::StartsWith(frame_gurl.path(), kGoogleIntlPathPrefix,
- base::CompareCase::INSENSITIVE_ASCII)) {
- SendInsecureContentSignal(INSECURE_CONTENT_RUN_HOST_GOOGLE_INTL);
- }
- }
-
- if (origin_host == kWWWDotGoogleDotCom) {
- SendInsecureContentSignal(INSECURE_CONTENT_RUN_HOST_WWW_GOOGLE);
- if (base::StartsWith(frame_gurl.path(), kGoogleReaderPathPrefix,
- base::CompareCase::INSENSITIVE_ASCII))
- SendInsecureContentSignal(INSECURE_CONTENT_RUN_HOST_GOOGLE_READER);
- } else if (origin_host == kMailDotGoogleDotCom) {
- SendInsecureContentSignal(INSECURE_CONTENT_RUN_HOST_MAIL_GOOGLE);
- } else if (origin_host == kPlusDotGoogleDotCom) {
- SendInsecureContentSignal(INSECURE_CONTENT_RUN_HOST_PLUS_GOOGLE);
- } else if (origin_host == kDocsDotGoogleDotCom) {
- SendInsecureContentSignal(INSECURE_CONTENT_RUN_HOST_DOCS_GOOGLE);
- } else if (origin_host == kSitesDotGoogleDotCom) {
- SendInsecureContentSignal(INSECURE_CONTENT_RUN_HOST_SITES_GOOGLE);
- } else if (origin_host == kPicasawebDotGoogleDotCom) {
- SendInsecureContentSignal(INSECURE_CONTENT_RUN_HOST_PICASAWEB_GOOGLE);
- } else if (origin_host == kCodeDotGoogleDotCom) {
- SendInsecureContentSignal(INSECURE_CONTENT_RUN_HOST_CODE_GOOGLE);
- } else if (origin_host == kGroupsDotGoogleDotCom) {
- SendInsecureContentSignal(INSECURE_CONTENT_RUN_HOST_GROUPS_GOOGLE);
- } else if (origin_host == kMapsDotGoogleDotCom) {
- SendInsecureContentSignal(INSECURE_CONTENT_RUN_HOST_MAPS_GOOGLE);
- } else if (origin_host == kWWWDotYoutubeDotCom) {
- SendInsecureContentSignal(INSECURE_CONTENT_RUN_HOST_YOUTUBE);
- } else if (base::EndsWith(origin_host, kDotGoogleUserContentDotCom,
- base::CompareCase::INSENSITIVE_ASCII)) {
- SendInsecureContentSignal(INSECURE_CONTENT_RUN_HOST_GOOGLEUSERCONTENT);
- }
-
GURL resource_gurl(resource_url);
- if (resource_gurl.host() == kWWWDotYoutubeDotCom)
- SendInsecureContentSignal(INSECURE_CONTENT_RUN_TARGET_YOUTUBE);
-
if (base::EndsWith(resource_gurl.path(), kDotJS,
base::CompareCase::INSENSITIVE_ASCII))
SendInsecureContentSignal(INSECURE_CONTENT_RUN_JS);
« no previous file with comments | « chrome/renderer/content_settings_observer.h ('k') | components/test_runner/web_content_settings.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698