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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 // 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 |
57 // diagnostic page. | 57 // diagnostic page. |
58 #if defined(GOOGLE_CHROME_BUILD) | 58 #if defined(GOOGLE_CHROME_BUILD) |
59 const char* const kSbDiagnosticUrl = | 59 const char* const kSbDiagnosticUrl = |
60 "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"; |
61 #else | 61 #else |
62 const char* const kSbDiagnosticUrl = | 62 const char* const kSbDiagnosticUrl = |
63 "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"; |
64 #endif | 64 #endif |
65 | 65 |
66 const char* const kSbReportPhishingErrorUrl = | 66 const char kSbReportPhishingErrorUrl[] = |
67 "http://www.google.com/safebrowsing/report_error/"; | 67 "http://www.google.com/safebrowsing/report_error/"; |
68 | 68 |
69 // 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. |
70 const char* const kLearnMoreMalwareUrl = | 70 const char kLearnMoreMalwareUrl[] = |
71 "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" |
72 "&sa=X&oi=malwarewarninglink&resnum=1&ct=help"; | 72 "&sa=X&oi=malwarewarninglink&resnum=1&ct=help"; |
73 const char* const kLearnMoreMalwareUrlV2 = | 73 const char kLearnMoreMalwareUrlV2[] = |
74 "https://www.google.com/goodtoknow/online-safety/malware/"; | 74 "https://www.google.com/goodtoknow/online-safety/malware/"; |
75 const char* const kLearnMorePhishingUrlV2 = | 75 const char kLearnMorePhishingUrlV2[] = |
76 "https://www.google.com/goodtoknow/online-safety/phishing/"; | 76 "https://www.google.com/goodtoknow/online-safety/phishing/"; |
77 | 77 |
78 // URL for the "Learn more" link on the phishing blocking page. | 78 // URL for the "Learn more" link on the phishing blocking page. |
79 const char* const kLearnMorePhishingUrl = | 79 const char kLearnMorePhishingUrl[] = |
80 "https://www.google.com/support/bin/answer.py?answer=106318"; | 80 "https://www.google.com/support/bin/answer.py?answer=106318"; |
81 | 81 |
82 const char* const kSbDiagnosticHtml = | 82 const char kPrivacyLinkHtml[] = |
83 "<a href=\"\" onclick=\"sendCommand('showDiagnostic'); return false;\" " | |
84 "onmousedown=\"return false;\">%s</a>"; | |
85 | |
86 const char* const kPLinkHtml = | |
87 "<a href=\"\" onclick=\"sendCommand('proceed'); return false;\" " | |
88 "onmousedown=\"return false;\">%s</a>"; | |
89 | |
90 const char* const kPrivacyLinkHtml = | |
91 "<a id=\"privacy-link\" href=\"\" onclick=\"sendCommand('showPrivacy'); " | 83 "<a id=\"privacy-link\" href=\"\" onclick=\"sendCommand('showPrivacy'); " |
92 "return false;\" onmousedown=\"return false;\">%s</a>"; | 84 "return false;\" onmousedown=\"return false;\">%s</a>"; |
93 | 85 |
94 // After a malware interstitial where the user opted-in to the report | 86 // After a malware interstitial where the user opted-in to the report |
95 // but clicked "proceed anyway", we delay the call to | 87 // but clicked "proceed anyway", we delay the call to |
96 // MalwareDetails::FinishCollection() by this much time (in | 88 // MalwareDetails::FinishCollection() by this much time (in |
97 // milliseconds). | 89 // milliseconds). |
98 const int64 kMalwareDetailsProceedDelayMilliSeconds = 3000; | 90 const int64 kMalwareDetailsProceedDelayMilliSeconds = 3000; |
99 | 91 |
100 // The commands returned by the page when the user performs an action. | 92 // The commands returned by the page when the user performs an action. |
101 const char* const kShowDiagnosticCommand = "showDiagnostic"; | 93 const char kShowDiagnosticCommand[] = "showDiagnostic"; |
102 const char* const kReportErrorCommand = "reportError"; | 94 const char kReportErrorCommand[] = "reportError"; |
103 const char* const kLearnMoreCommand = "learnMore"; | 95 const char kLearnMoreCommand[] = "learnMore"; |
104 const char* const kLearnMoreCommandV2 = "learnMore2"; | 96 const char kLearnMoreCommandV2[] = "learnMore2"; |
105 const char* const kShowPrivacyCommand = "showPrivacy"; | 97 const char kShowPrivacyCommand[] = "showPrivacy"; |
106 const char* const kProceedCommand = "proceed"; | 98 const char kProceedCommand[] = "proceed"; |
107 const char* const kTakeMeBackCommand = "takeMeBack"; | 99 const char kTakeMeBackCommand[] = "takeMeBack"; |
108 const char* const kDoReportCommand = "doReport"; | 100 const char kDoReportCommand[] = "doReport"; |
109 const char* const kDontReportCommand = "dontReport"; | 101 const char kDontReportCommand[] = "dontReport"; |
110 const char* const kDisplayCheckBox = "displaycheckbox"; | 102 const char kDisplayCheckBox[] = "displaycheckbox"; |
111 const char* const kBoxChecked = "boxchecked"; | 103 const char kBoxChecked[] = "boxchecked"; |
112 const char* const kExpandedSeeMore = "expandedSeeMore"; | 104 const char kExpandedSeeMore[] = "expandedSeeMore"; |
113 // Special command that we use when the user navigated away from the | 105 // Special command that we use when the user navigated away from the |
114 // page. E.g., closed the tab or the window. This is only used by | 106 // page. E.g., closed the tab or the window. This is only used by |
115 // RecordUserReactionTime. | 107 // RecordUserReactionTime. |
116 const char* const kNavigatedAwayMetaCommand = "closed"; | 108 const char kNavigatedAwayMetaCommand[] = "closed"; |
117 | 109 |
118 base::LazyInstance<SafeBrowsingBlockingPage::UnsafeResourceMap> | 110 base::LazyInstance<SafeBrowsingBlockingPage::UnsafeResourceMap> |
119 g_unsafe_resource_map = LAZY_INSTANCE_INITIALIZER; | 111 g_unsafe_resource_map = LAZY_INSTANCE_INITIALIZER; |
120 | 112 |
121 // These are the conditions for the summer 2013 Finch experiment. | 113 // These are the conditions for the summer 2013 Finch experiment. |
122 const char* const kMalwareStudyName = "InterstitialMalware310"; | 114 const char kMalwareStudyName[] = "InterstitialMalware310"; |
123 const char* const kPhishingStudyName = "InterstitialPhishing564"; | 115 const char kPhishingStudyName[] = "InterstitialPhishing564"; |
124 const char* const kCond1MalwareControl = "cond1MalwareControl"; | 116 const char kCond7MalwareFearMsg[] = "cond7MalwareFearMsg"; |
125 const char* const kCond2MalwareNoBrand = "cond2MalwareNoBrand"; | 117 const char kCond8PhishingFearMsg[] = "cond8PhishingFearMsg"; |
126 const char* const kCond3PhishingControl = "cond3PhishingControl"; | 118 const char kCond9MalwareCollabMsg[] = "cond9MalwareCollabMsg"; |
127 const char* const kCond4PhishingNoBrand = "cond4PhishingNoBrand"; | 119 const char kCond10PhishingCollabMsg[] = "cond10PhishingCollabMsg"; |
128 const char* const kCond5MalwareOneStep = "cond5MalwareOneStep"; | 120 const char kCond11MalwareQuestion[] = "cond11MalwareQuestion"; |
129 const char* const kCond6PhishingOneStep = "cond6PhishingOneStep"; | 121 const char kCond12PhishingQuestion[] = "cond12PhishingQuestion"; |
130 const char* const kCond7MalwareFearMsg = "cond7MalwareFearMsg"; | 122 const char kCond13MalwareGoBack[] = "cond13MalwareGoBack"; |
131 const char* const kCond8PhishingFearMsg = "cond8PhishingFearMsg"; | 123 const char kCond14PhishingGoBack[] = "cond14PhishingGoBack"; |
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 | 124 |
139 } // namespace | 125 } // namespace |
140 | 126 |
141 // static | 127 // static |
142 SafeBrowsingBlockingPageFactory* SafeBrowsingBlockingPage::factory_ = NULL; | 128 SafeBrowsingBlockingPageFactory* SafeBrowsingBlockingPage::factory_ = NULL; |
143 | 129 |
144 // The default SafeBrowsingBlockingPageFactory. Global, made a singleton so we | 130 // The default SafeBrowsingBlockingPageFactory. Global, made a singleton so we |
145 // don't leak it. | 131 // don't leak it. |
146 class SafeBrowsingBlockingPageFactoryImpl | 132 class SafeBrowsingBlockingPageFactoryImpl |
147 : public SafeBrowsingBlockingPageFactory { | 133 : public SafeBrowsingBlockingPageFactory { |
(...skipping 984 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1132 strings->SetString("details", std::string()); | 1118 strings->SetString("details", std::string()); |
1133 strings->SetString("confirm_text", std::string()); | 1119 strings->SetString("confirm_text", std::string()); |
1134 strings->SetString(kBoxChecked, std::string()); | 1120 strings->SetString(kBoxChecked, std::string()); |
1135 strings->SetString( | 1121 strings->SetString( |
1136 "report_error", | 1122 "report_error", |
1137 l10n_util::GetStringUTF16(IDS_SAFE_BROWSING_PHISHING_V2_REPORT_ERROR)); | 1123 l10n_util::GetStringUTF16(IDS_SAFE_BROWSING_PHISHING_V2_REPORT_ERROR)); |
1138 strings->SetBoolean(kDisplayCheckBox, false); | 1124 strings->SetBoolean(kDisplayCheckBox, false); |
1139 strings->SetString("learnMore", | 1125 strings->SetString("learnMore", |
1140 l10n_util::GetStringUTF16(IDS_SAFE_BROWSING_MALWARE_V2_LEARN_MORE)); | 1126 l10n_util::GetStringUTF16(IDS_SAFE_BROWSING_MALWARE_V2_LEARN_MORE)); |
1141 } | 1127 } |
OLD | NEW |