Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(603)

Side by Side Diff: chrome/browser/safe_browsing/safe_browsing_blocking_page.cc

Issue 10387010: Select theme resources from ResourceBundle at requested scale factor. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge with master. Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 20 matching lines...) Expand all
31 #include "content/public/browser/browser_thread.h" 31 #include "content/public/browser/browser_thread.h"
32 #include "content/public/browser/interstitial_page.h" 32 #include "content/public/browser/interstitial_page.h"
33 #include "content/public/browser/navigation_controller.h" 33 #include "content/public/browser/navigation_controller.h"
34 #include "content/public/browser/user_metrics.h" 34 #include "content/public/browser/user_metrics.h"
35 #include "content/public/browser/web_contents.h" 35 #include "content/public/browser/web_contents.h"
36 #include "grit/browser_resources.h" 36 #include "grit/browser_resources.h"
37 #include "grit/generated_resources.h" 37 #include "grit/generated_resources.h"
38 #include "grit/locale_settings.h" 38 #include "grit/locale_settings.h"
39 #include "net/base/escape.h" 39 #include "net/base/escape.h"
40 #include "ui/base/l10n/l10n_util.h" 40 #include "ui/base/l10n/l10n_util.h"
41 #include "ui/base/layout.h"
41 #include "ui/base/resource/resource_bundle.h" 42 #include "ui/base/resource/resource_bundle.h"
42 43
43 using content::BrowserThread; 44 using content::BrowserThread;
44 using content::InterstitialPage; 45 using content::InterstitialPage;
45 using content::OpenURLParams; 46 using content::OpenURLParams;
46 using content::Referrer; 47 using content::Referrer;
47 using content::UserMetricsAction; 48 using content::UserMetricsAction;
48 using content::WebContents; 49 using content::WebContents;
49 50
50 // For malware interstitial pages, we link the problematic URL to Google's 51 // For malware interstitial pages, we link the problematic URL to Google's
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 std::string html; 189 std::string html;
189 190
190 if (unsafe_resources_.empty()) { 191 if (unsafe_resources_.empty()) {
191 NOTREACHED(); 192 NOTREACHED();
192 return std::string(); 193 return std::string();
193 } 194 }
194 195
195 if (unsafe_resources_.size() > 1) { 196 if (unsafe_resources_.size() > 1) {
196 PopulateMultipleThreatStringDictionary(&strings); 197 PopulateMultipleThreatStringDictionary(&strings);
197 html = rb.GetRawDataResource( 198 html = rb.GetRawDataResource(
198 IDR_SAFE_BROWSING_MULTIPLE_THREAT_BLOCK).as_string(); 199 IDR_SAFE_BROWSING_MULTIPLE_THREAT_BLOCK,
200 ui::SCALE_FACTOR_NONE).as_string();
199 } else { 201 } else {
200 SafeBrowsingService::UrlCheckResult threat_type = 202 SafeBrowsingService::UrlCheckResult threat_type =
201 unsafe_resources_[0].threat_type; 203 unsafe_resources_[0].threat_type;
202 if (threat_type == SafeBrowsingService::URL_MALWARE) { 204 if (threat_type == SafeBrowsingService::URL_MALWARE) {
203 PopulateMalwareStringDictionary(&strings); 205 PopulateMalwareStringDictionary(&strings);
204 html = rb.GetRawDataResource( 206 html = rb.GetRawDataResource(
205 IDR_SAFE_BROWSING_MALWARE_BLOCK).as_string(); 207 IDR_SAFE_BROWSING_MALWARE_BLOCK,
208 ui::SCALE_FACTOR_NONE).as_string();
206 } else { // Phishing. 209 } else { // Phishing.
207 DCHECK(threat_type == SafeBrowsingService::URL_PHISHING || 210 DCHECK(threat_type == SafeBrowsingService::URL_PHISHING ||
208 threat_type == SafeBrowsingService::CLIENT_SIDE_PHISHING_URL); 211 threat_type == SafeBrowsingService::CLIENT_SIDE_PHISHING_URL);
209 PopulatePhishingStringDictionary(&strings); 212 PopulatePhishingStringDictionary(&strings);
210 html = rb.GetRawDataResource( 213 html = rb.GetRawDataResource(
211 IDR_SAFE_BROWSING_PHISHING_BLOCK).as_string(); 214 IDR_SAFE_BROWSING_PHISHING_BLOCK,
215 ui::SCALE_FACTOR_NONE).as_string();
212 } 216 }
213 } 217 }
214 218
215 return jstemplate_builder::GetTemplatesHtml(html, &strings, "template_root"); 219 return jstemplate_builder::GetTemplatesHtml(html, &strings, "template_root");
216 } 220 }
217 221
218 void SafeBrowsingBlockingPage::PopulateStringDictionary( 222 void SafeBrowsingBlockingPage::PopulateStringDictionary(
219 DictionaryValue* strings, 223 DictionaryValue* strings,
220 const string16& title, 224 const string16& title,
221 const string16& headline, 225 const string16& headline,
(...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after
751 // Client-side phishing detection interstitials never block the main frame 755 // Client-side phishing detection interstitials never block the main frame
752 // load, since they happen after the page is finished loading. 756 // load, since they happen after the page is finished loading.
753 if (unsafe_resources[0].threat_type == 757 if (unsafe_resources[0].threat_type ==
754 SafeBrowsingService::CLIENT_SIDE_PHISHING_URL) { 758 SafeBrowsingService::CLIENT_SIDE_PHISHING_URL) {
755 return false; 759 return false;
756 } 760 }
757 761
758 // Otherwise, check the threat type. 762 // Otherwise, check the threat type.
759 return unsafe_resources.size() == 1 && !unsafe_resources[0].is_subresource; 763 return unsafe_resources.size() == 1 && !unsafe_resources[0].is_subresource;
760 } 764 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698