| 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..3f5073e3c96c4608032a10c474cf17a2f3df5f16 100644
|
| --- a/chrome/renderer/content_settings_observer.cc
|
| +++ b/chrome/renderer/content_settings_observer.cc
|
| @@ -43,6 +43,7 @@ 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,
|
| @@ -84,35 +85,11 @@ enum {
|
| };
|
|
|
| // 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);
|
|
|