diff options
author | cevans@chromium.org <cevans@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-06-27 23:50:30 +0000 |
---|---|---|
committer | cevans@chromium.org <cevans@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-06-27 23:50:30 +0000 |
commit | 95343df7917bc58e87e6455449fbfa2461ceb37c (patch) | |
tree | dae82d10b4485ceb6261cd3f318470b3f97c90a6 /chrome/renderer | |
parent | 44e50eb0e4b1678778945a4bd47c65b6fe32a37b (diff) | |
download | chromium_src-95343df7917bc58e87e6455449fbfa2461ceb37c.zip chromium_src-95343df7917bc58e87e6455449fbfa2461ceb37c.tar.gz chromium_src-95343df7917bc58e87e6455449fbfa2461ceb37c.tar.bz2 |
Add a histogram to try and work out a little bit about the high-level breakdown
of mixed content on the web.
These can be removed after a dev channel or two.
Review URL: http://codereview.chromium.org/7261015
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@90680 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer')
-rw-r--r-- | chrome/renderer/chrome_render_view_observer.cc | 81 |
1 files changed, 77 insertions, 4 deletions
diff --git a/chrome/renderer/chrome_render_view_observer.cc b/chrome/renderer/chrome_render_view_observer.cc index 141fb07..0cca0c2 100644 --- a/chrome/renderer/chrome_render_view_observer.cc +++ b/chrome/renderer/chrome_render_view_observer.cc @@ -7,6 +7,7 @@ #include "base/command_line.h" #include "base/message_loop.h" #include "base/metrics/histogram.h" +#include "base/string_util.h" #include "chrome/common/chrome_constants.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/icon_messages.h" @@ -86,6 +87,30 @@ static const size_t kMaxIndexChars = 65535; static const int kThumbnailWidth = 212; static const int kThumbnailHeight = 132; +// Constants for UMA statistic collection. +static const char kSSLInsecureContent[] = "SSL.InsecureContent"; +static const char kDotGoogleDotCom[] = ".google.com"; +static const char kWWWDotGoogleDotCom[] = "www.google.com"; +static const char kWWWDotYoutubeDotCom[] = "www.youtube.com"; +static const char kDotJS[] = ".js"; +static const char kDotCSS[] = ".css"; +static const char kDotSWF[] = ".swf"; +static const char kDotHTML[] = ".html"; +enum { + INSECURE_CONTENT_DISPLAY = 0, + INSECURE_CONTENT_DISPLAY_HOST_GOOGLE, + INSECURE_CONTENT_DISPLAY_HOST_WWW_GOOGLE, + 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_JS, + INSECURE_CONTENT_RUN_CSS, + INSECURE_CONTENT_RUN_SWF, + INSECURE_CONTENT_NUM_EVENTS +}; + static bool PaintViewIntoCanvas(WebView* view, skia::PlatformCanvas& canvas) { view->layout(); @@ -388,8 +413,26 @@ bool ChromeRenderViewObserver::allowWriteToClipboard(WebFrame* frame, bool ChromeRenderViewObserver::allowDisplayingInsecureContent( WebKit::WebFrame*, bool allowed_per_settings, - const WebKit::WebSecurityOrigin&, - const WebKit::WebURL&) { + const WebKit::WebSecurityOrigin& origin, + const WebKit::WebURL& url) { + UMA_HISTOGRAM_ENUMERATION(kSSLInsecureContent, + INSECURE_CONTENT_DISPLAY, + INSECURE_CONTENT_NUM_EVENTS); + std::string host(origin.host().utf8()); + if (EndsWith(host, kDotGoogleDotCom, false)) + UMA_HISTOGRAM_ENUMERATION(kSSLInsecureContent, + INSECURE_CONTENT_DISPLAY_HOST_GOOGLE, + INSECURE_CONTENT_NUM_EVENTS); + if (host == kWWWDotGoogleDotCom) + UMA_HISTOGRAM_ENUMERATION(kSSLInsecureContent, + INSECURE_CONTENT_DISPLAY_HOST_WWW_GOOGLE, + INSECURE_CONTENT_NUM_EVENTS); + GURL gurl(url); + if (EndsWith(gurl.path(), kDotHTML, false)) + UMA_HISTOGRAM_ENUMERATION(kSSLInsecureContent, + INSECURE_CONTENT_DISPLAY_HTML, + INSECURE_CONTENT_NUM_EVENTS); + if (allowed_per_settings || allow_displaying_insecure_content_) return true; @@ -400,8 +443,38 @@ bool ChromeRenderViewObserver::allowDisplayingInsecureContent( bool ChromeRenderViewObserver::allowRunningInsecureContent( WebKit::WebFrame*, bool allowed_per_settings, - const WebKit::WebSecurityOrigin&, - const WebKit::WebURL&) { + const WebKit::WebSecurityOrigin& origin, + const WebKit::WebURL& url) { + UMA_HISTOGRAM_ENUMERATION(kSSLInsecureContent, + INSECURE_CONTENT_RUN, + INSECURE_CONTENT_NUM_EVENTS); + std::string host(origin.host().utf8()); + if (EndsWith(host, kDotGoogleDotCom, false)) + UMA_HISTOGRAM_ENUMERATION(kSSLInsecureContent, + INSECURE_CONTENT_RUN_HOST_GOOGLE, + INSECURE_CONTENT_NUM_EVENTS); + if (host == kWWWDotGoogleDotCom) + UMA_HISTOGRAM_ENUMERATION(kSSLInsecureContent, + INSECURE_CONTENT_RUN_HOST_WWW_GOOGLE, + INSECURE_CONTENT_NUM_EVENTS); + GURL gurl(url); + if (gurl.host() == kWWWDotYoutubeDotCom) + UMA_HISTOGRAM_ENUMERATION(kSSLInsecureContent, + INSECURE_CONTENT_RUN_TARGET_YOUTUBE, + INSECURE_CONTENT_NUM_EVENTS); + if (EndsWith(gurl.path(), kDotJS, false)) + UMA_HISTOGRAM_ENUMERATION(kSSLInsecureContent, + INSECURE_CONTENT_RUN_JS, + INSECURE_CONTENT_NUM_EVENTS); + else if (EndsWith(gurl.path(), kDotCSS, false)) + UMA_HISTOGRAM_ENUMERATION(kSSLInsecureContent, + INSECURE_CONTENT_RUN_CSS, + INSECURE_CONTENT_NUM_EVENTS); + else if (EndsWith(gurl.path(), kDotSWF, false)) + UMA_HISTOGRAM_ENUMERATION(kSSLInsecureContent, + INSECURE_CONTENT_RUN_SWF, + INSECURE_CONTENT_NUM_EVENTS); + if (allowed_per_settings || allow_running_insecure_content_) return true; |