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

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

Issue 1073005: Move RTL related functions from app/l10n_util to base/i18n/rtl... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 9 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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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
11 #include "app/l10n_util.h" 11 #include "app/l10n_util.h"
12 #include "app/resource_bundle.h" 12 #include "app/resource_bundle.h"
13 #include "base/histogram.h" 13 #include "base/histogram.h"
14 #include "base/i18n/rtl.h"
14 #include "base/utf_string_conversions.h" 15 #include "base/utf_string_conversions.h"
15 #include "base/values.h" 16 #include "base/values.h"
16 #include "chrome/browser/chrome_thread.h" 17 #include "chrome/browser/chrome_thread.h"
17 #include "chrome/browser/dom_operation_notification_details.h" 18 #include "chrome/browser/dom_operation_notification_details.h"
18 #include "chrome/browser/dom_ui/new_tab_ui.h" 19 #include "chrome/browser/dom_ui/new_tab_ui.h"
19 #include "chrome/browser/google_util.h" 20 #include "chrome/browser/google_util.h"
20 #include "chrome/browser/safe_browsing/safe_browsing_service.h" 21 #include "chrome/browser/safe_browsing/safe_browsing_service.h"
21 #include "chrome/browser/tab_contents/navigation_controller.h" 22 #include "chrome/browser/tab_contents/navigation_controller.h"
22 #include "chrome/browser/tab_contents/navigation_entry.h" 23 #include "chrome/browser/tab_contents/navigation_entry.h"
23 #include "chrome/browser/tab_contents/tab_util.h" 24 #include "chrome/browser/tab_contents/tab_util.h"
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 UTF8ToWide(tab()->GetURL().host())), 232 UTF8ToWide(tab()->GetURL().host())),
232 L"", L""); 233 L"", L"");
233 } 234 }
234 235
235 strings->SetString(L"confirm_text", 236 strings->SetString(L"confirm_text",
236 l10n_util::GetString(IDS_SAFE_BROWSING_MALWARE_DESCRIPTION_AGREE)); 237 l10n_util::GetString(IDS_SAFE_BROWSING_MALWARE_DESCRIPTION_AGREE));
237 strings->SetString(L"continue_button", 238 strings->SetString(L"continue_button",
238 l10n_util::GetString(IDS_SAFE_BROWSING_MALWARE_PROCEED_BUTTON)); 239 l10n_util::GetString(IDS_SAFE_BROWSING_MALWARE_PROCEED_BUTTON));
239 strings->SetString(L"back_button", 240 strings->SetString(L"back_button",
240 l10n_util::GetString(IDS_SAFE_BROWSING_MALWARE_BACK_BUTTON)); 241 l10n_util::GetString(IDS_SAFE_BROWSING_MALWARE_BACK_BUTTON));
241 strings->SetString(L"textdirection", 242 strings->SetString(L"textdirection", base::i18n::IsRTL() ? L"rtl" : L"ltr");
242 (l10n_util::GetTextDirection() == l10n_util::RIGHT_TO_LEFT) ?
243 L"rtl" : L"ltr");
244 } 243 }
245 244
246 void SafeBrowsingBlockingPage::PopulateMalwareStringDictionary( 245 void SafeBrowsingBlockingPage::PopulateMalwareStringDictionary(
247 DictionaryValue* strings) { 246 DictionaryValue* strings) {
248 std::wstring link = StringPrintf(kSbDiagnosticHtml, 247 std::wstring link = StringPrintf(kSbDiagnosticHtml,
249 l10n_util::GetString(IDS_SAFE_BROWSING_MALWARE_DIAGNOSTIC_PAGE).c_str()); 248 l10n_util::GetString(IDS_SAFE_BROWSING_MALWARE_DIAGNOSTIC_PAGE).c_str());
250 249
251 strings->SetString(L"badURL", UTF8ToWide(url().host())); 250 strings->SetString(L"badURL", UTF8ToWide(url().host()));
252 // Check to see if we're blocking the main page, or a sub-resource on the 251 // Check to see if we're blocking the main page, or a sub-resource on the
253 // main page. 252 // main page.
(...skipping 19 matching lines...) Expand all
273 l10n_util::GetString(IDS_SAFE_BROWSING_MALWARE_HEADLINE), 272 l10n_util::GetString(IDS_SAFE_BROWSING_MALWARE_HEADLINE),
274 description1, description2, 273 description1, description2,
275 l10n_util::GetString(IDS_SAFE_BROWSING_MALWARE_DESCRIPTION3)); 274 l10n_util::GetString(IDS_SAFE_BROWSING_MALWARE_DESCRIPTION3));
276 275
277 strings->SetString(L"confirm_text", 276 strings->SetString(L"confirm_text",
278 l10n_util::GetString(IDS_SAFE_BROWSING_MALWARE_DESCRIPTION_AGREE)); 277 l10n_util::GetString(IDS_SAFE_BROWSING_MALWARE_DESCRIPTION_AGREE));
279 strings->SetString(L"continue_button", 278 strings->SetString(L"continue_button",
280 l10n_util::GetString(IDS_SAFE_BROWSING_MALWARE_PROCEED_BUTTON)); 279 l10n_util::GetString(IDS_SAFE_BROWSING_MALWARE_PROCEED_BUTTON));
281 strings->SetString(L"back_button", 280 strings->SetString(L"back_button",
282 l10n_util::GetString(IDS_SAFE_BROWSING_MALWARE_BACK_BUTTON)); 281 l10n_util::GetString(IDS_SAFE_BROWSING_MALWARE_BACK_BUTTON));
283 strings->SetString(L"textdirection", 282 strings->SetString(L"textdirection", base::i18n::IsRTL() ? L"rtl" : L"ltr");
284 (l10n_util::GetTextDirection() == l10n_util::RIGHT_TO_LEFT) ?
285 L"rtl" : L"ltr");
286 } 283 }
287 284
288 void SafeBrowsingBlockingPage::PopulatePhishingStringDictionary( 285 void SafeBrowsingBlockingPage::PopulatePhishingStringDictionary(
289 DictionaryValue* strings) { 286 DictionaryValue* strings) {
290 PopulateStringDictionary( 287 PopulateStringDictionary(
291 strings, 288 strings,
292 l10n_util::GetString(IDS_SAFE_BROWSING_PHISHING_TITLE), 289 l10n_util::GetString(IDS_SAFE_BROWSING_PHISHING_TITLE),
293 l10n_util::GetString(IDS_SAFE_BROWSING_PHISHING_HEADLINE), 290 l10n_util::GetString(IDS_SAFE_BROWSING_PHISHING_HEADLINE),
294 l10n_util::GetStringF(IDS_SAFE_BROWSING_PHISHING_DESCRIPTION1, 291 l10n_util::GetStringF(IDS_SAFE_BROWSING_PHISHING_DESCRIPTION1,
295 UTF8ToWide(url().host())), 292 UTF8ToWide(url().host())),
296 l10n_util::GetStringF(IDS_SAFE_BROWSING_PHISHING_DESCRIPTION2, 293 l10n_util::GetStringF(IDS_SAFE_BROWSING_PHISHING_DESCRIPTION2,
297 UTF8ToWide(url().host())), 294 UTF8ToWide(url().host())),
298 L""); 295 L"");
299 296
300 strings->SetString(L"continue_button", 297 strings->SetString(L"continue_button",
301 l10n_util::GetString(IDS_SAFE_BROWSING_PHISHING_PROCEED_BUTTON)); 298 l10n_util::GetString(IDS_SAFE_BROWSING_PHISHING_PROCEED_BUTTON));
302 strings->SetString(L"back_button", 299 strings->SetString(L"back_button",
303 l10n_util::GetString(IDS_SAFE_BROWSING_PHISHING_BACK_BUTTON)); 300 l10n_util::GetString(IDS_SAFE_BROWSING_PHISHING_BACK_BUTTON));
304 strings->SetString(L"report_error", 301 strings->SetString(L"report_error",
305 l10n_util::GetString(IDS_SAFE_BROWSING_PHISHING_REPORT_ERROR)); 302 l10n_util::GetString(IDS_SAFE_BROWSING_PHISHING_REPORT_ERROR));
306 strings->SetString(L"textdirection", 303 strings->SetString(L"textdirection", base::i18n::IsRTL() ? L"rtl" : L"ltr");
307 (l10n_util::GetTextDirection() == l10n_util::RIGHT_TO_LEFT) ?
308 L"rtl" : L"ltr");
309 } 304 }
310 305
311 void SafeBrowsingBlockingPage::CommandReceived(const std::string& cmd) { 306 void SafeBrowsingBlockingPage::CommandReceived(const std::string& cmd) {
312 std::string command(cmd); // Make a local copy so we can modify it. 307 std::string command(cmd); // Make a local copy so we can modify it.
313 // The Jasonified response has quotes, remove them. 308 // The Jasonified response has quotes, remove them.
314 if (command.length() > 1 && command[0] == '"') { 309 if (command.length() > 1 && command[0] == '"') {
315 command = command.substr(1, command.length() - 2); 310 command = command.substr(1, command.length() - 2);
316 } 311 }
317 312
318 if (command == kLearnMoreCommand) { 313 if (command == kLearnMoreCommand) {
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
507 UnsafeResourceMap* unsafe_resource_map = GetUnsafeResourcesMap(); 502 UnsafeResourceMap* unsafe_resource_map = GetUnsafeResourcesMap();
508 (*unsafe_resource_map)[tab_contents].push_back(unsafe_resource); 503 (*unsafe_resource_map)[tab_contents].push_back(unsafe_resource);
509 } 504 }
510 505
511 // static 506 // static
512 bool SafeBrowsingBlockingPage::IsMainPage( 507 bool SafeBrowsingBlockingPage::IsMainPage(
513 const UnsafeResourceList& unsafe_resources) { 508 const UnsafeResourceList& unsafe_resources) {
514 return unsafe_resources.size() == 1 && 509 return unsafe_resources.size() == 1 &&
515 unsafe_resources[0].resource_type == ResourceType::MAIN_FRAME; 510 unsafe_resources[0].resource_type == ResourceType::MAIN_FRAME;
516 } 511 }
OLDNEW
« no previous file with comments | « chrome/browser/renderer_host/render_widget_host_view_win.cc ('k') | chrome/browser/search_engines/template_url.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698