summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorian@chromium.org <ian@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-10 19:45:29 +0000
committerian@chromium.org <ian@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-10 19:45:29 +0000
commit25cbe2b831886e21a6425ab43b5f77e7f5625a38 (patch)
tree63965e5aca03d50e4f126875a01c2d0593bc933a
parent02fdc003c7fcecac964c5c855f733a899459f533 (diff)
downloadchromium_src-25cbe2b831886e21a6425ab43b5f77e7f5625a38.zip
chromium_src-25cbe2b831886e21a6425ab43b5f77e7f5625a38.tar.gz
chromium_src-25cbe2b831886e21a6425ab43b5f77e7f5625a38.tar.bz2
Merging issue 2067023 for bryner@google.com
BUG=none TEST=safe_browsing_blocking_page_unittest.cc Review URL: http://codereview.chromium.org/2737005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@49437 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/safe_browsing/safe_browsing_blocking_page.cc60
-rw-r--r--chrome/browser/safe_browsing/safe_browsing_blocking_page.h9
-rwxr-xr-xchrome/chrome_tests.gypi1
-rw-r--r--chrome/tools/chromeactions.txt16
-rwxr-xr-xchrome/tools/extract_actions.py12
5 files changed, 76 insertions, 22 deletions
diff --git a/chrome/browser/safe_browsing/safe_browsing_blocking_page.cc b/chrome/browser/safe_browsing/safe_browsing_blocking_page.cc
index f5ef76e..c3481fc 100644
--- a/chrome/browser/safe_browsing/safe_browsing_blocking_page.cc
+++ b/chrome/browser/safe_browsing/safe_browsing_blocking_page.cc
@@ -10,7 +10,6 @@
#include "app/l10n_util.h"
#include "app/resource_bundle.h"
-#include "base/histogram.h"
#include "base/i18n/rtl.h"
#include "base/utf_string_conversions.h"
#include "base/values.h"
@@ -18,6 +17,7 @@
#include "chrome/browser/dom_operation_notification_details.h"
#include "chrome/browser/dom_ui/new_tab_ui.h"
#include "chrome/browser/google_util.h"
+#include "chrome/browser/metrics/user_metrics.h"
#include "chrome/browser/safe_browsing/safe_browsing_service.h"
#include "chrome/browser/tab_contents/navigation_controller.h"
#include "chrome/browser/tab_contents/navigation_entry.h"
@@ -63,20 +63,6 @@ static const char* const kLearnMoreCommand = "learnMore";
static const char* const kProceedCommand = "proceed";
static const char* const kTakeMeBackCommand = "takeMeBack";
-namespace {
-
-enum SafeBrowsingBlockingPageEvent {
- SHOW,
- PROCEED,
- DONT_PROCEED,
- UNUSED_ENUM,
-};
-
-void RecordSafeBrowsingBlockingPageStats(SafeBrowsingBlockingPageEvent event) {
- UMA_HISTOGRAM_ENUMERATION("interstial.safe_browsing", event, UNUSED_ENUM);
-}
-
-} // namespace
// static
SafeBrowsingBlockingPageFactory* SafeBrowsingBlockingPage::factory_ = NULL;
@@ -111,7 +97,7 @@ SafeBrowsingBlockingPage::SafeBrowsingBlockingPage(
sb_service_(sb_service),
is_main_frame_(IsMainPage(unsafe_resources)),
unsafe_resources_(unsafe_resources) {
- RecordSafeBrowsingBlockingPageStats(SHOW);
+ RecordUserAction(SHOW);
if (!is_main_frame_) {
navigation_entry_index_to_remove_ =
tab()->controller().last_committed_entry_index();
@@ -385,7 +371,7 @@ void SafeBrowsingBlockingPage::CommandReceived(const std::string& cmd) {
}
void SafeBrowsingBlockingPage::Proceed() {
- RecordSafeBrowsingBlockingPageStats(PROCEED);
+ RecordUserAction(PROCEED);
NotifySafeBrowsingService(sb_service_, unsafe_resources_, true);
@@ -422,7 +408,7 @@ void SafeBrowsingBlockingPage::DontProceed() {
return;
}
- RecordSafeBrowsingBlockingPageStats(DONT_PROCEED);
+ RecordUserAction(DONT_PROCEED);
NotifySafeBrowsingService(sb_service_, unsafe_resources_, false);
@@ -447,6 +433,44 @@ void SafeBrowsingBlockingPage::DontProceed() {
// We are now deleted.
}
+void SafeBrowsingBlockingPage::RecordUserAction(BlockingPageEvent event) {
+ // Determine the interstitial type from the blocked resources.
+ // This is the same logic that is used to actually construct the
+ // page contents; we can look at the title to see which type of
+ // interstitial is being displayed.
+ DictionaryValue strings;
+ PopulateMultipleThreatStringDictionary(&strings);
+
+ std::wstring title;
+ DCHECK(strings.GetString(L"title", &title));
+
+ std::string action = "SBInterstitial";
+ if (title == l10n_util::GetString(IDS_SAFE_BROWSING_MULTI_THREAT_TITLE)) {
+ action.append("Multiple");
+ } else if (title == l10n_util::GetString(IDS_SAFE_BROWSING_MALWARE_TITLE)) {
+ action.append("Malware");
+ } else {
+ DCHECK_EQ(title, l10n_util::GetString(IDS_SAFE_BROWSING_PHISHING_TITLE));
+ action.append("Phishing");
+ }
+
+ switch (event) {
+ case SHOW:
+ action.append("Show");
+ break;
+ case PROCEED:
+ action.append("Proceed");
+ break;
+ case DONT_PROCEED:
+ action.append("DontProceed");
+ break;
+ default:
+ NOTREACHED() << "Unexpected event: " << event;
+ }
+
+ UserMetrics::RecordComputedAction(action);
+}
+
// static
void SafeBrowsingBlockingPage::NotifySafeBrowsingService(
SafeBrowsingService* sb_service,
diff --git a/chrome/browser/safe_browsing/safe_browsing_blocking_page.h b/chrome/browser/safe_browsing/safe_browsing_blocking_page.h
index 280ffbb..644e76d 100644
--- a/chrome/browser/safe_browsing/safe_browsing_blocking_page.h
+++ b/chrome/browser/safe_browsing/safe_browsing_blocking_page.h
@@ -77,6 +77,12 @@ class SafeBrowsingBlockingPage : public InterstitialPage {
const UnsafeResourceList& unsafe_resources);
private:
+ enum BlockingPageEvent {
+ SHOW,
+ PROCEED,
+ DONT_PROCEED,
+ };
+
// Fills the passed dictionary with the strings passed to JS Template when
// creating the HTML.
void PopulateMultipleThreatStringDictionary(DictionaryValue* strings);
@@ -92,6 +98,9 @@ class SafeBrowsingBlockingPage : public InterstitialPage {
const std::wstring& description2,
const std::wstring& description3);
+ // Records a user action for this interstitial, using the form
+ // SBInterstitial[Phishing|Malware|Multiple][Show|Proceed|DontProceed].
+ void RecordUserAction(BlockingPageEvent event);
// A list of SafeBrowsingService::UnsafeResource for a tab that the user
// should be warned about. They are queued when displaying more than one
diff --git a/chrome/chrome_tests.gypi b/chrome/chrome_tests.gypi
index 3239dd2..49690b4 100755
--- a/chrome/chrome_tests.gypi
+++ b/chrome/chrome_tests.gypi
@@ -1241,7 +1241,6 @@
'browser/login_prompt_unittest.cc',
'browser/printing/print_job_unittest.cc',
'browser/rlz/rlz_unittest.cc',
- 'browser/safe_browsing/safe_browsing_blocking_page_unittest.cc',
'browser/search_engines/template_url_scraper_unittest.cc',
'browser/translate/translate_manager2_unittest.cc',
'browser/views/bookmark_editor_view_unittest.cc',
diff --git a/chrome/tools/chromeactions.txt b/chrome/tools/chromeactions.txt
index f205801..e00955f 100644
--- a/chrome/tools/chromeactions.txt
+++ b/chrome/tools/chromeactions.txt
@@ -251,6 +251,8 @@
0x576b4b3570828783 MostVisited7
0x7e2c4d68af709827 MostVisited8
0x1b40c6b1b5dd7106 MostVisited9
+0x9c6a4ef293d946ca MostVisited_BlacklistCleared
+0xa90e38146e0a4399 MostVisited_UrlRemoved
0xf812385dfcc1a683 MoveBackward
0xd5980f1362f718dd MoveBackwardAndModifySelection
0x8c95fa949833ae3c MoveDown
@@ -357,6 +359,8 @@
0x1747b98bb0705d52 Options_Startup_LastSession
0x24301fc721f3f091 Options_TLS1_Disable
0x1c669fc919a6eccb Options_TLS1_Enable
+0x0e213ca8fa03d268 Options_TabsToLinks_Disable
+0x60adcbc1d31d59a2 Options_TabsToLinks_Enable
0x01c2684695fc839e Options_TapToClickCheckbox_Disable
0x6f37e83ce98b3082 Options_TapToClickCheckbox_Enable
0x73defd4825af2700 Options_ThemesGallery
@@ -389,6 +393,15 @@
0xbcc54eb67cab2ae9 RemoveFormat
0xa728f2892204aabc ReportBug
0x8f83bd601e845bc1 RestoreTab
+0x665cc78aff3f37f5 SBInterstitialMalwareDontProceed
+0xf02ed35cab0dcf4b SBInterstitialMalwareProceed
+0x09af23846e454261 SBInterstitialMalwareShow
+0xc81645e63b16cb44 SBInterstitialMultipleDontProceed
+0x866cc35d2bcdf71d SBInterstitialMultipleProceed
+0x6dbe9571062fcfde SBInterstitialMultipleShow
+0x60578de80374e115 SBInterstitialPhishingDontProceed
+0x340331e81b86f933 SBInterstitialPhishingProceed
+0xf8af4ff865669301 SBInterstitialPhishingShow
0xc9cc8cce247e49ba Save
0xfc7723f7c10f79d5 SavePage
0x702bbdc91c8e399d SelectAll
@@ -420,6 +433,8 @@
0x658963e1a47a5018 ShowOptions
0x564171f658dcb78e ShowPageMenu
0xecf70e5f5be34681 ShowRecentlyViewed
+0xfd243b004d004e00 ShowSections_RecentSitesDisabled
+0x3b86156dcf560cdb ShowSections_RecentSitesEnabled
0x5118181c3ece5e84 ShowSessions
0x26f93e6e68e28a69 Star
0x11a755d598c0c417 Stop
@@ -438,6 +453,7 @@
0xdcc35326aa8a5aeb TabContextMenu_TogglePinned
0xdd2b0058433af670 TabContextMenu_UseDestinationsTab_Off
0xe5f9f328f5d86b51 TabContextMenu_UseDestinationsTab_On
+0x3fe88a1365e8dc47 TabContextMenu_UseVerticalTabs
0xb5ffa70ecb67b6f3 TabOverview_DetachCell
0x060f1f68f262b152 TabOverview_DragCell
0xad9c26360444768c TabOverview_DragOverMiniWindow
diff --git a/chrome/tools/extract_actions.py b/chrome/tools/extract_actions.py
index 1caa022..6b448d6 100755
--- a/chrome/tools/extract_actions.py
+++ b/chrome/tools/extract_actions.py
@@ -35,14 +35,15 @@ from google import path_utils
# they require special handling code in this script.
# To add a new file, add it to this list and add the appropriate logic to
# generate the known actions to AddComputedActions() below.
-KNOWN_COMPUTED_USERS = [
+KNOWN_COMPUTED_USERS = (
'back_forward_menu_model.cc',
'options_page_view.cc',
'render_view_host.cc', # called using webkit identifiers
'user_metrics.cc', # method definition
'new_tab_ui.cc', # most visited clicks 1-9
'extension_metrics_module.cc', # extensions hook for user metrics
-]
+ 'safe_browsing_blocking_page.cc', # various interstitial types and actions
+)
number_of_files_total = 0
@@ -55,7 +56,7 @@ def AddComputedActions(actions):
"""
# Actions for back_forward_menu_model.cc.
- for dir in ['BackMenu_', 'ForwardMenu_']:
+ for dir in ('BackMenu_', 'ForwardMenu_'):
actions.add(dir + 'ShowFullHistory')
actions.add(dir + 'Popup')
for i in range(1, 20):
@@ -66,6 +67,11 @@ def AddComputedActions(actions):
for i in range(1, 10):
actions.add('MostVisited%d' % i)
+ # Actions for safe_browsing_blocking_page.cc.
+ for interstitial in ('Phishing', 'Malware', 'Multiple'):
+ for action in ('Show', 'Proceed', 'DontProceed'):
+ actions.add('SBInterstitial%s%s' % (interstitial, action))
+
def AddWebKitEditorActions(actions):
"""Add editor actions from editor_client_impl.cc.