OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 // | 4 // |
5 // Implementation of the SafeBrowsingBlockingPage class. | 5 // Implementation of the SafeBrowsingBlockingPage class. |
6 | 6 |
7 #include "chrome/browser/safe_browsing/safe_browsing_blocking_page.h" | 7 #include "chrome/browser/safe_browsing/safe_browsing_blocking_page.h" |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
44 #include "ui/webui/jstemplate_builder.h" | 44 #include "ui/webui/jstemplate_builder.h" |
45 #include "ui/webui/web_ui_util.h" | 45 #include "ui/webui/web_ui_util.h" |
46 | 46 |
47 using content::BrowserThread; | 47 using content::BrowserThread; |
48 using content::InterstitialPage; | 48 using content::InterstitialPage; |
49 using content::OpenURLParams; | 49 using content::OpenURLParams; |
50 using content::Referrer; | 50 using content::Referrer; |
51 using content::UserMetricsAction; | 51 using content::UserMetricsAction; |
52 using content::WebContents; | 52 using content::WebContents; |
53 | 53 |
54 namespace { | |
55 | |
54 // For malware interstitial pages, we link the problematic URL to Google's | 56 // For malware interstitial pages, we link the problematic URL to Google's |
55 // diagnostic page. | 57 // diagnostic page. |
56 #if defined(GOOGLE_CHROME_BUILD) | 58 #if defined(GOOGLE_CHROME_BUILD) |
57 static const char* const kSbDiagnosticUrl = | 59 const char* const kSbDiagnosticUrl = |
Dan Beam
2013/05/07 08:07:16
why aren't you using
const char kSbDiagnosticUr
| |
58 "http://safebrowsing.clients.google.com/safebrowsing/diagnostic?site=%s&clie nt=googlechrome"; | 60 "http://safebrowsing.clients.google.com/safebrowsing/diagnostic?site=%s&clie nt=googlechrome"; |
59 #else | 61 #else |
60 static const char* const kSbDiagnosticUrl = | 62 const char* const kSbDiagnosticUrl = |
61 "http://safebrowsing.clients.google.com/safebrowsing/diagnostic?site=%s&clie nt=chromium"; | 63 "http://safebrowsing.clients.google.com/safebrowsing/diagnostic?site=%s&clie nt=chromium"; |
62 #endif | 64 #endif |
63 | 65 |
64 static const char* const kSbReportPhishingErrorUrl = | 66 const char* const kSbReportPhishingErrorUrl = |
65 "http://www.google.com/safebrowsing/report_error/"; | 67 "http://www.google.com/safebrowsing/report_error/"; |
66 | 68 |
67 // URL for the "Learn more" link on the multi threat malware blocking page. | 69 // URL for the "Learn more" link on the multi threat malware blocking page. |
68 static const char* const kLearnMoreMalwareUrl = | 70 const char* const kLearnMoreMalwareUrl = |
69 "https://www.google.com/support/bin/answer.py?answer=45449&topic=360" | 71 "https://www.google.com/support/bin/answer.py?answer=45449&topic=360" |
70 "&sa=X&oi=malwarewarninglink&resnum=1&ct=help"; | 72 "&sa=X&oi=malwarewarninglink&resnum=1&ct=help"; |
71 static const char* const kLearnMoreMalwareUrlV2 = | 73 const char* const kLearnMoreMalwareUrlV2 = |
72 "https://www.google.com/goodtoknow/online-safety/malware/"; | 74 "https://www.google.com/goodtoknow/online-safety/malware/"; |
73 static const char* const kLearnMorePhishingUrlV2 = | 75 const char* const kLearnMorePhishingUrlV2 = |
74 "https://www.google.com/goodtoknow/online-safety/phishing/"; | 76 "https://www.google.com/goodtoknow/online-safety/phishing/"; |
75 | 77 |
76 // URL for the "Learn more" link on the phishing blocking page. | 78 // URL for the "Learn more" link on the phishing blocking page. |
77 static const char* const kLearnMorePhishingUrl = | 79 const char* const kLearnMorePhishingUrl = |
78 "https://www.google.com/support/bin/answer.py?answer=106318"; | 80 "https://www.google.com/support/bin/answer.py?answer=106318"; |
79 | 81 |
80 static const char* const kSbDiagnosticHtml = | 82 const char* const kSbDiagnosticHtml = |
81 "<a href=\"\" onclick=\"sendCommand('showDiagnostic'); return false;\" " | 83 "<a href=\"\" onclick=\"sendCommand('showDiagnostic'); return false;\" " |
82 "onmousedown=\"return false;\">%s</a>"; | 84 "onmousedown=\"return false;\">%s</a>"; |
83 | 85 |
84 static const char* const kPLinkHtml = | 86 const char* const kPLinkHtml = |
85 "<a href=\"\" onclick=\"sendCommand('proceed'); return false;\" " | 87 "<a href=\"\" onclick=\"sendCommand('proceed'); return false;\" " |
86 "onmousedown=\"return false;\">%s</a>"; | 88 "onmousedown=\"return false;\">%s</a>"; |
87 | 89 |
88 static const char* const kPrivacyLinkHtml = | 90 const char* const kPrivacyLinkHtml = |
89 "<a id=\"privacy-link\" href=\"\" onclick=\"sendCommand('showPrivacy'); " | 91 "<a id=\"privacy-link\" href=\"\" onclick=\"sendCommand('showPrivacy'); " |
90 "return false;\" onmousedown=\"return false;\">%s</a>"; | 92 "return false;\" onmousedown=\"return false;\">%s</a>"; |
91 | 93 |
92 // After a malware interstitial where the user opted-in to the report | 94 // After a malware interstitial where the user opted-in to the report |
93 // but clicked "proceed anyway", we delay the call to | 95 // but clicked "proceed anyway", we delay the call to |
94 // MalwareDetails::FinishCollection() by this much time (in | 96 // MalwareDetails::FinishCollection() by this much time (in |
95 // milliseconds). | 97 // milliseconds). |
96 static const int64 kMalwareDetailsProceedDelayMilliSeconds = 3000; | 98 const int64 kMalwareDetailsProceedDelayMilliSeconds = 3000; |
97 | 99 |
98 // The commands returned by the page when the user performs an action. | 100 // The commands returned by the page when the user performs an action. |
99 static const char* const kShowDiagnosticCommand = "showDiagnostic"; | 101 const char* const kShowDiagnosticCommand = "showDiagnostic"; |
100 static const char* const kReportErrorCommand = "reportError"; | 102 const char* const kReportErrorCommand = "reportError"; |
101 static const char* const kLearnMoreCommand = "learnMore"; | 103 const char* const kLearnMoreCommand = "learnMore"; |
102 static const char* const kLearnMoreCommandV2 = "learnMore2"; | 104 const char* const kLearnMoreCommandV2 = "learnMore2"; |
103 static const char* const kShowPrivacyCommand = "showPrivacy"; | 105 const char* const kShowPrivacyCommand = "showPrivacy"; |
104 static const char* const kProceedCommand = "proceed"; | 106 const char* const kProceedCommand = "proceed"; |
105 static const char* const kTakeMeBackCommand = "takeMeBack"; | 107 const char* const kTakeMeBackCommand = "takeMeBack"; |
106 static const char* const kDoReportCommand = "doReport"; | 108 const char* const kDoReportCommand = "doReport"; |
107 static const char* const kDontReportCommand = "dontReport"; | 109 const char* const kDontReportCommand = "dontReport"; |
108 static const char* const kDisplayCheckBox = "displaycheckbox"; | 110 const char* const kDisplayCheckBox = "displaycheckbox"; |
109 static const char* const kBoxChecked = "boxchecked"; | 111 const char* const kBoxChecked = "boxchecked"; |
110 static const char* const kExpandedSeeMore = "expandedSeeMore"; | 112 const char* const kExpandedSeeMore = "expandedSeeMore"; |
111 // Special command that we use when the user navigated away from the | 113 // Special command that we use when the user navigated away from the |
112 // page. E.g., closed the tab or the window. This is only used by | 114 // page. E.g., closed the tab or the window. This is only used by |
113 // RecordUserReactionTime. | 115 // RecordUserReactionTime. |
114 static const char* const kNavigatedAwayMetaCommand = "closed"; | 116 const char* const kNavigatedAwayMetaCommand = "closed"; |
117 | |
118 base::LazyInstance<SafeBrowsingBlockingPage::UnsafeResourceMap> | |
119 g_unsafe_resource_map = LAZY_INSTANCE_INITIALIZER; | |
120 | |
121 // These are the conditions for the summer 2013 Finch experiment. | |
122 const char* const kMalwareStudyName = "InterstitialMalware310"; | |
123 const char* const kPhishingStudyName = "InterstitialPhishing564"; | |
124 const char* const kCond1MalwareControl = "cond1MalwareControl"; | |
125 const char* const kCond2MalwareNoBrand = "cond2MalwareNoBrand"; | |
126 const char* const kCond3PhishingControl = "cond3PhishingControl"; | |
127 const char* const kCond4PhishingNoBrand = "cond4PhishingNoBrand"; | |
128 const char* const kCond5MalwareOneStep = "cond5MalwareOneStep"; | |
129 const char* const kCond6PhishingOneStep = "cond6PhishingOneStep"; | |
130 const char* const kCond7MalwareFearMsg = "cond7MalwareFearMsg"; | |
131 const char* const kCond8PhishingFearMsg = "cond8PhishingFearMsg"; | |
132 const char* const kCond9MalwareCollabMsg = "cond9MalwareCollabMsg"; | |
133 const char* const kCond10PhishingCollabMsg = "cond10PhishingCollabMsg"; | |
134 const char* const kCond11MalwareQuestion = "cond11MalwareQuestion"; | |
135 const char* const kCond12PhishingQuestion = "cond12PhishingQuestion"; | |
136 const char* const kCond13MalwareGoBack = "cond13MalwareGoBack"; | |
137 const char* const kCond14PhishingGoBack = "cond14PhishingGoBack"; | |
138 | |
139 } // namespace | |
115 | 140 |
116 // static | 141 // static |
117 SafeBrowsingBlockingPageFactory* SafeBrowsingBlockingPage::factory_ = NULL; | 142 SafeBrowsingBlockingPageFactory* SafeBrowsingBlockingPage::factory_ = NULL; |
118 | 143 |
119 static base::LazyInstance<SafeBrowsingBlockingPage::UnsafeResourceMap> | |
120 g_unsafe_resource_map = LAZY_INSTANCE_INITIALIZER; | |
121 | |
122 // The default SafeBrowsingBlockingPageFactory. Global, made a singleton so we | 144 // The default SafeBrowsingBlockingPageFactory. Global, made a singleton so we |
123 // don't leak it. | 145 // don't leak it. |
124 class SafeBrowsingBlockingPageFactoryImpl | 146 class SafeBrowsingBlockingPageFactoryImpl |
125 : public SafeBrowsingBlockingPageFactory { | 147 : public SafeBrowsingBlockingPageFactory { |
126 public: | 148 public: |
127 virtual SafeBrowsingBlockingPage* CreateSafeBrowsingPage( | 149 virtual SafeBrowsingBlockingPage* CreateSafeBrowsingPage( |
128 SafeBrowsingUIManager* ui_manager, | 150 SafeBrowsingUIManager* ui_manager, |
129 WebContents* web_contents, | 151 WebContents* web_contents, |
130 const SafeBrowsingBlockingPage::UnsafeResourceList& unsafe_resources) | 152 const SafeBrowsingBlockingPage::UnsafeResourceList& unsafe_resources) |
131 OVERRIDE { | 153 OVERRIDE { |
132 // Only do the trial if the interstitial is for a single malware or | 154 // Only use the V2 page if the interstitial is for a single malware or |
133 // phishing resource, the multi-threat interstitial has not been updated to | 155 // phishing resource, the multi-threat interstitial has not been updated to |
134 // V2 yet. | 156 // V2 yet. |
135 if (unsafe_resources.size() == 1 && | 157 if (unsafe_resources.size() == 1 && |
136 (unsafe_resources[0].threat_type == SB_THREAT_TYPE_URL_MALWARE || | 158 (unsafe_resources[0].threat_type == SB_THREAT_TYPE_URL_MALWARE || |
137 unsafe_resources[0].threat_type == SB_THREAT_TYPE_URL_PHISHING)) { | 159 unsafe_resources[0].threat_type == SB_THREAT_TYPE_URL_PHISHING)) { |
138 return new SafeBrowsingBlockingPageV2(ui_manager, web_contents, | 160 return new SafeBrowsingBlockingPageV2(ui_manager, web_contents, |
139 unsafe_resources); | 161 unsafe_resources); |
140 } | 162 } |
141 return new SafeBrowsingBlockingPageV1(ui_manager, web_contents, | 163 return new SafeBrowsingBlockingPageV1(ui_manager, web_contents, |
142 unsafe_resources); | 164 unsafe_resources); |
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
476 MALWARE_FORCED_DONT_PROCEED, | 498 MALWARE_FORCED_DONT_PROCEED, |
477 MALWARE_PROCEED, | 499 MALWARE_PROCEED, |
478 MULTIPLE_SHOW, | 500 MULTIPLE_SHOW, |
479 MULTIPLE_DONT_PROCEED, | 501 MULTIPLE_DONT_PROCEED, |
480 MULTIPLE_FORCED_DONT_PROCEED, | 502 MULTIPLE_FORCED_DONT_PROCEED, |
481 MULTIPLE_PROCEED, | 503 MULTIPLE_PROCEED, |
482 PHISHING_SHOW, | 504 PHISHING_SHOW, |
483 PHISHING_DONT_PROCEED, | 505 PHISHING_DONT_PROCEED, |
484 PHISHING_FORCED_DONT_PROCEED, | 506 PHISHING_FORCED_DONT_PROCEED, |
485 PHISHING_PROCEED, | 507 PHISHING_PROCEED, |
508 MALWARE_SHOW_ADVANCED, | |
509 MULTIPLE_SHOW_ADVANCED, | |
510 PHISHING_SHOW_ADVANCED, | |
486 MAX_ACTION | 511 MAX_ACTION |
487 } histogram_action = MAX_ACTION; | 512 } histogram_action = MAX_ACTION; |
488 | 513 |
489 switch (event) { | 514 switch (event) { |
490 case SHOW: | 515 case SHOW: |
491 switch (interstitial_type_) { | 516 switch (interstitial_type_) { |
492 case TYPE_MALWARE_AND_PHISHING: | 517 case TYPE_MALWARE_AND_PHISHING: |
493 histogram_action = MULTIPLE_SHOW; | 518 histogram_action = MULTIPLE_SHOW; |
494 break; | 519 break; |
495 case TYPE_MALWARE: | 520 case TYPE_MALWARE: |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
533 break; | 558 break; |
534 case TYPE_MALWARE: | 559 case TYPE_MALWARE: |
535 histogram_action = MALWARE_DONT_PROCEED; | 560 histogram_action = MALWARE_DONT_PROCEED; |
536 break; | 561 break; |
537 case TYPE_PHISHING: | 562 case TYPE_PHISHING: |
538 histogram_action = PHISHING_DONT_PROCEED; | 563 histogram_action = PHISHING_DONT_PROCEED; |
539 break; | 564 break; |
540 } | 565 } |
541 } | 566 } |
542 break; | 567 break; |
568 case SHOW_ADVANCED: | |
569 switch (interstitial_type_) { | |
570 case TYPE_MALWARE_AND_PHISHING: | |
571 histogram_action = MULTIPLE_SHOW_ADVANCED; | |
572 break; | |
573 case TYPE_MALWARE: | |
574 histogram_action = MALWARE_SHOW_ADVANCED; | |
575 break; | |
576 case TYPE_PHISHING: | |
577 histogram_action = PHISHING_SHOW_ADVANCED; | |
578 break; | |
579 } | |
580 break; | |
543 default: | 581 default: |
544 NOTREACHED() << "Unexpected event: " << event; | 582 NOTREACHED() << "Unexpected event: " << event; |
545 } | 583 } |
546 if (histogram_action == MAX_ACTION) { | 584 if (histogram_action == MAX_ACTION) { |
547 NOTREACHED(); | 585 NOTREACHED(); |
548 } else { | 586 } else { |
549 UMA_HISTOGRAM_ENUMERATION("SB2.InterstitialAction", histogram_action, | 587 UMA_HISTOGRAM_ENUMERATION("SB2.InterstitialAction", histogram_action, |
550 MAX_ACTION); | 588 MAX_ACTION); |
551 } | 589 } |
552 | 590 |
(...skipping 18 matching lines...) Expand all Loading... | |
571 break; | 609 break; |
572 case PROCEED: | 610 case PROCEED: |
573 action.append("Proceed"); | 611 action.append("Proceed"); |
574 break; | 612 break; |
575 case DONT_PROCEED: | 613 case DONT_PROCEED: |
576 if (IsPrefEnabled(prefs::kSafeBrowsingProceedAnywayDisabled)) | 614 if (IsPrefEnabled(prefs::kSafeBrowsingProceedAnywayDisabled)) |
577 action.append("ForcedDontProceed"); | 615 action.append("ForcedDontProceed"); |
578 else | 616 else |
579 action.append("DontProceed"); | 617 action.append("DontProceed"); |
580 break; | 618 break; |
619 case SHOW_ADVANCED: | |
620 break; | |
581 default: | 621 default: |
582 NOTREACHED() << "Unexpected event: " << event; | 622 NOTREACHED() << "Unexpected event: " << event; |
583 } | 623 } |
584 | 624 |
585 content::RecordComputedAction(action); | 625 content::RecordComputedAction(action); |
586 } | 626 } |
587 | 627 |
588 void SafeBrowsingBlockingPage::RecordUserReactionTime( | 628 void SafeBrowsingBlockingPage::RecordUserReactionTime( |
589 const std::string& command) { | 629 const std::string& command) { |
590 if (interstitial_show_time_.is_null()) | 630 if (interstitial_show_time_.is_null()) |
(...skipping 21 matching lines...) Expand all Loading... | |
612 } else if (command == kLearnMoreCommand || command == kLearnMoreCommandV2) { | 652 } else if (command == kLearnMoreCommand || command == kLearnMoreCommandV2) { |
613 UMA_HISTOGRAM_MEDIUM_TIMES("SB2.MalwareInterstitialLearnMore", | 653 UMA_HISTOGRAM_MEDIUM_TIMES("SB2.MalwareInterstitialLearnMore", |
614 dt); | 654 dt); |
615 } else if (command == kNavigatedAwayMetaCommand) { | 655 } else if (command == kNavigatedAwayMetaCommand) { |
616 UMA_HISTOGRAM_MEDIUM_TIMES("SB2.MalwareInterstitialTimeClosed", dt); | 656 UMA_HISTOGRAM_MEDIUM_TIMES("SB2.MalwareInterstitialTimeClosed", dt); |
617 } else if (command == kExpandedSeeMore) { | 657 } else if (command == kExpandedSeeMore) { |
618 // Only record the expanded histogram once per display of the | 658 // Only record the expanded histogram once per display of the |
619 // interstitial. | 659 // interstitial. |
620 if (has_expanded_see_more_section_) | 660 if (has_expanded_see_more_section_) |
621 return; | 661 return; |
622 | 662 RecordUserAction(SHOW_ADVANCED); |
623 UMA_HISTOGRAM_MEDIUM_TIMES("SB2.MalwareInterstitialTimeExpandedSeeMore", | 663 UMA_HISTOGRAM_MEDIUM_TIMES("SB2.MalwareInterstitialTimeExpandedSeeMore", |
624 dt); | 664 dt); |
625 has_expanded_see_more_section_ = true; | 665 has_expanded_see_more_section_ = true; |
626 // Expanding the "See More" section doesn't finish the interstitial, so | 666 // Expanding the "See More" section doesn't finish the interstitial, so |
627 // don't mark the reaction time as recorded. | 667 // don't mark the reaction time as recorded. |
628 recorded = false; | 668 recorded = false; |
629 } else { | 669 } else { |
630 recorded = false; | 670 recorded = false; |
631 } | 671 } |
632 } else { | 672 } else { |
633 // Same as above but for phishing warnings. | 673 // Same as above but for phishing warnings. |
634 if (command == kProceedCommand) { | 674 if (command == kProceedCommand) { |
635 UMA_HISTOGRAM_MEDIUM_TIMES("SB2.PhishingInterstitialTimeProceed", dt); | 675 UMA_HISTOGRAM_MEDIUM_TIMES("SB2.PhishingInterstitialTimeProceed", dt); |
636 } else if (command == kTakeMeBackCommand) { | 676 } else if (command == kTakeMeBackCommand) { |
637 UMA_HISTOGRAM_MEDIUM_TIMES("SB2.PhishingInterstitialTimeTakeMeBack", dt); | 677 UMA_HISTOGRAM_MEDIUM_TIMES("SB2.PhishingInterstitialTimeTakeMeBack", dt); |
638 } else if (command == kShowDiagnosticCommand) { | 678 } else if (command == kShowDiagnosticCommand) { |
639 UMA_HISTOGRAM_MEDIUM_TIMES("SB2.PhishingInterstitialTimeReportError", dt); | 679 UMA_HISTOGRAM_MEDIUM_TIMES("SB2.PhishingInterstitialTimeReportError", dt); |
640 } else if (command == kLearnMoreCommand || command == kLearnMoreCommandV2) { | 680 } else if (command == kLearnMoreCommand || command == kLearnMoreCommandV2) { |
641 UMA_HISTOGRAM_MEDIUM_TIMES("SB2.PhishingInterstitialTimeLearnMore", dt); | 681 UMA_HISTOGRAM_MEDIUM_TIMES("SB2.PhishingInterstitialTimeLearnMore", dt); |
642 } else if (command == kNavigatedAwayMetaCommand) { | 682 } else if (command == kNavigatedAwayMetaCommand) { |
643 UMA_HISTOGRAM_MEDIUM_TIMES("SB2.PhishingInterstitialTimeClosed", dt); | 683 UMA_HISTOGRAM_MEDIUM_TIMES("SB2.PhishingInterstitialTimeClosed", dt); |
644 } else if (command == kExpandedSeeMore) { | 684 } else if (command == kExpandedSeeMore) { |
645 // Only record the expanded histogram once per display of the | 685 // Only record the expanded histogram once per display of the |
646 // interstitial. | 686 // interstitial. |
647 if (has_expanded_see_more_section_) | 687 if (has_expanded_see_more_section_) |
648 return; | 688 return; |
649 | 689 RecordUserAction(SHOW_ADVANCED); |
650 UMA_HISTOGRAM_MEDIUM_TIMES("SB2.PhishingInterstitialTimeExpandedSeeMore", | 690 UMA_HISTOGRAM_MEDIUM_TIMES("SB2.PhishingInterstitialTimeExpandedSeeMore", |
651 dt); | 691 dt); |
652 has_expanded_see_more_section_ = true; | 692 has_expanded_see_more_section_ = true; |
653 // Expanding the "See More" section doesn't finish the interstitial, so | 693 // Expanding the "See More" section doesn't finish the interstitial, so |
654 // don't mark the reaction time as recorded. | 694 // don't mark the reaction time as recorded. |
655 recorded = false; | 695 recorded = false; |
656 } else { | 696 } else { |
657 recorded = false; | 697 recorded = false; |
658 } | 698 } |
659 } | 699 } |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
884 void SafeBrowsingBlockingPageV1::PopulatePhishingStringDictionary( | 924 void SafeBrowsingBlockingPageV1::PopulatePhishingStringDictionary( |
885 DictionaryValue* strings) { | 925 DictionaryValue* strings) { |
886 NOTREACHED(); | 926 NOTREACHED(); |
887 } | 927 } |
888 | 928 |
889 SafeBrowsingBlockingPageV2::SafeBrowsingBlockingPageV2( | 929 SafeBrowsingBlockingPageV2::SafeBrowsingBlockingPageV2( |
890 SafeBrowsingUIManager* ui_manager, | 930 SafeBrowsingUIManager* ui_manager, |
891 WebContents* web_contents, | 931 WebContents* web_contents, |
892 const UnsafeResourceList& unsafe_resources) | 932 const UnsafeResourceList& unsafe_resources) |
893 : SafeBrowsingBlockingPage(ui_manager, web_contents, unsafe_resources) { | 933 : SafeBrowsingBlockingPage(ui_manager, web_contents, unsafe_resources) { |
934 if (unsafe_resources_[0].threat_type == SB_THREAT_TYPE_URL_MALWARE) { | |
Dan Beam
2013/05/07 08:07:16
indent off, can you be sure that unsafe_resources_
| |
935 trialCondition_ = | |
936 base::FieldTrialList::FindFullName(kMalwareStudyName); | |
937 } else if (unsafe_resources_[0].threat_type == | |
938 SB_THREAT_TYPE_URL_PHISHING || | |
939 unsafe_resources_[0].threat_type == | |
940 SB_THREAT_TYPE_CLIENT_SIDE_PHISHING_URL) { | |
941 trialCondition_ = | |
942 base::FieldTrialList::FindFullName(kPhishingStudyName); | |
943 } | |
894 } | 944 } |
895 | 945 |
896 std::string SafeBrowsingBlockingPageV2::GetHTMLContents() { | 946 std::string SafeBrowsingBlockingPageV2::GetHTMLContents() { |
897 // Load the HTML page and create the template components. | 947 // Load the HTML page and create the template components. |
898 DictionaryValue strings; | 948 DictionaryValue strings; |
899 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 949 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
900 std::string html; | 950 std::string html; |
901 | 951 |
902 if (unsafe_resources_.empty()) { | 952 if (unsafe_resources_.empty()) { |
903 NOTREACHED(); | 953 NOTREACHED(); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
941 strings->SetBoolean("isMainFrame", is_main_frame_load_blocked_); | 991 strings->SetBoolean("isMainFrame", is_main_frame_load_blocked_); |
942 strings->SetBoolean("isPhishing", interstitial_type_ == TYPE_PHISHING); | 992 strings->SetBoolean("isPhishing", interstitial_type_ == TYPE_PHISHING); |
943 | 993 |
944 strings->SetString("back_button", | 994 strings->SetString("back_button", |
945 l10n_util::GetStringUTF16(IDS_SAFE_BROWSING_MALWARE_BACK_BUTTON)); | 995 l10n_util::GetStringUTF16(IDS_SAFE_BROWSING_MALWARE_BACK_BUTTON)); |
946 strings->SetString("seeMore", l10n_util::GetStringUTF16( | 996 strings->SetString("seeMore", l10n_util::GetStringUTF16( |
947 IDS_SAFE_BROWSING_MALWARE_V2_SEE_MORE)); | 997 IDS_SAFE_BROWSING_MALWARE_V2_SEE_MORE)); |
948 strings->SetString("proceed", | 998 strings->SetString("proceed", |
949 l10n_util::GetStringUTF16(IDS_SAFE_BROWSING_MALWARE_V2_PROCEED_LINK)); | 999 l10n_util::GetStringUTF16(IDS_SAFE_BROWSING_MALWARE_V2_PROCEED_LINK)); |
950 | 1000 |
1001 // Field trial | |
Dan Beam
2013/05/07 08:07:16
end with .
| |
1002 strings->SetString("trialType", trialCondition_); | |
1003 if (trialCondition_ == kCond7MalwareFearMsg) { | |
1004 strings->SetString("headLine", | |
1005 l10n_util::GetStringUTF16(IDS_SAFE_BROWSING_MALWARE_FEAR_HEADLINE)); | |
1006 } else if (trialCondition_ == kCond8PhishingFearMsg) { | |
1007 strings->SetString("headLine", | |
1008 l10n_util::GetStringUTF16(IDS_SAFE_BROWSING_PHISHING_FEAR_HEADLINE)); | |
1009 } else if (trialCondition_ == kCond9MalwareCollabMsg) { | |
1010 strings->SetString("headLine", | |
1011 l10n_util::GetStringUTF16(IDS_SAFE_BROWSING_MALWARE_COLLAB_HEADLINE)); | |
1012 } else if (trialCondition_ == kCond10PhishingCollabMsg) { | |
1013 strings->SetString("headLine", | |
1014 l10n_util::GetStringUTF16(IDS_SAFE_BROWSING_PHISHING_COLLAB_HEADLINE)); | |
1015 } else if (trialCondition_ == kCond11MalwareQuestion) { | |
1016 strings->SetString("headLine", | |
1017 l10n_util::GetStringUTF16(IDS_SAFE_BROWSING_MALWARE_QUESTION_HEADLINE)); | |
1018 } else if (trialCondition_ == kCond12PhishingQuestion) { | |
1019 strings->SetString("headLine", | |
1020 l10n_util::GetStringUTF16( | |
1021 IDS_SAFE_BROWSING_PHISHING_QUESTION_HEADLINE)); | |
1022 } else if (trialCondition_ == kCond13MalwareGoBack) { | |
1023 strings->SetString("headLine", | |
1024 l10n_util::GetStringUTF16(IDS_SAFE_BROWSING_MALWARE_BACK_HEADLINE)); | |
1025 } else if (trialCondition_ == kCond14PhishingGoBack) { | |
1026 strings->SetString("headLine", | |
Dan Beam
2013/05/07 08:07:16
nit: arguably:
std::string headline;
if () {
| |
1027 l10n_util::GetStringUTF16(IDS_SAFE_BROWSING_PHISHING_BACK_HEADLINE)); | |
1028 } | |
1029 | |
951 webui::SetFontAndTextDirection(strings); | 1030 webui::SetFontAndTextDirection(strings); |
952 } | 1031 } |
953 | 1032 |
954 void SafeBrowsingBlockingPageV2::PopulateMultipleThreatStringDictionary( | 1033 void SafeBrowsingBlockingPageV2::PopulateMultipleThreatStringDictionary( |
955 DictionaryValue* strings) { | 1034 DictionaryValue* strings) { |
956 NOTREACHED(); | 1035 NOTREACHED(); |
957 } | 1036 } |
958 | 1037 |
959 void SafeBrowsingBlockingPageV2::PopulateMalwareStringDictionary( | 1038 void SafeBrowsingBlockingPageV2::PopulateMalwareStringDictionary( |
960 DictionaryValue* strings) { | 1039 DictionaryValue* strings) { |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1045 strings->SetString("details", std::string()); | 1124 strings->SetString("details", std::string()); |
1046 strings->SetString("confirm_text", std::string()); | 1125 strings->SetString("confirm_text", std::string()); |
1047 strings->SetString(kBoxChecked, std::string()); | 1126 strings->SetString(kBoxChecked, std::string()); |
1048 strings->SetString( | 1127 strings->SetString( |
1049 "report_error", | 1128 "report_error", |
1050 l10n_util::GetStringUTF16(IDS_SAFE_BROWSING_PHISHING_V2_REPORT_ERROR)); | 1129 l10n_util::GetStringUTF16(IDS_SAFE_BROWSING_PHISHING_V2_REPORT_ERROR)); |
1051 strings->SetBoolean(kDisplayCheckBox, false); | 1130 strings->SetBoolean(kDisplayCheckBox, false); |
1052 strings->SetString("learnMore", | 1131 strings->SetString("learnMore", |
1053 l10n_util::GetStringUTF16(IDS_SAFE_BROWSING_MALWARE_V2_LEARN_MORE)); | 1132 l10n_util::GetStringUTF16(IDS_SAFE_BROWSING_MALWARE_V2_LEARN_MORE)); |
1054 } | 1133 } |
OLD | NEW |