summaryrefslogtreecommitdiffstats
path: root/chrome/browser/safe_browsing
diff options
context:
space:
mode:
authordsh@google.com <dsh@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-03 21:49:53 +0000
committerdsh@google.com <dsh@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-03 21:49:53 +0000
commit3a79b3cc8393d54d72c8c7e14615fe64d86fd039 (patch)
tree2730ef27672c8f9c9e1b6ef3f443434ac98bfd4f /chrome/browser/safe_browsing
parent1c9e90e17741f9c34f4cbe7f3e68a8300ed24e08 (diff)
downloadchromium_src-3a79b3cc8393d54d72c8c7e14615fe64d86fd039.zip
chromium_src-3a79b3cc8393d54d72c8c7e14615fe64d86fd039.tar.gz
chromium_src-3a79b3cc8393d54d72c8c7e14615fe64d86fd039.tar.bz2
Port DictionaryValue to use string16 instead of wstring.
Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=10818 Review URL: http://codereview.chromium.org/31014 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@10833 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/safe_browsing')
-rw-r--r--chrome/browser/safe_browsing/safe_browsing_blocking_page.cc114
1 files changed, 67 insertions, 47 deletions
diff --git a/chrome/browser/safe_browsing/safe_browsing_blocking_page.cc b/chrome/browser/safe_browsing/safe_browsing_blocking_page.cc
index 2eafe9a1..c07c750 100644
--- a/chrome/browser/safe_browsing/safe_browsing_blocking_page.cc
+++ b/chrome/browser/safe_browsing/safe_browsing_blocking_page.cc
@@ -103,11 +103,14 @@ void SafeBrowsingBlockingPage::PopulateStringDictionary(
const std::wstring& description1,
const std::wstring& description2,
const std::wstring& description3) {
- strings->SetString(L"title", title);
- strings->SetString(L"headLine", headline);
- strings->SetString(L"description1", description1);
- strings->SetString(L"description2", description2);
- strings->SetString(L"description3", description3);
+ strings->SetString(ASCIIToUTF16("title"), WideToUTF16Hack(title));
+ strings->SetString(ASCIIToUTF16("headLine"), WideToUTF16Hack(headline));
+ strings->SetString(ASCIIToUTF16("description1"),
+ WideToUTF16Hack(description1));
+ strings->SetString(ASCIIToUTF16("description2"),
+ WideToUTF16Hack(description2));
+ strings->SetString(ASCIIToUTF16("description3"),
+ WideToUTF16Hack(description3));
}
void SafeBrowsingBlockingPage::PopulateMultipleThreatStringDictionary(
@@ -115,14 +118,17 @@ void SafeBrowsingBlockingPage::PopulateMultipleThreatStringDictionary(
bool malware = false;
bool phishing = false;
- std::wstring phishing_label =
- l10n_util::GetString(IDS_SAFE_BROWSING_PHISHING_LABEL);
- std::wstring phishing_link =
- l10n_util::GetString(IDS_SAFE_BROWSING_PHISHING_REPORT_ERROR);
- std::wstring malware_label =
- l10n_util::GetString(IDS_SAFE_BROWSING_MALWARE_LABEL);
- std::wstring malware_link =
- l10n_util::GetString(IDS_SAFE_BROWSING_MALWARE_DIAGNOSTIC_PAGE);
+ string16 phishing_label =
+ WideToUTF16Hack(l10n_util::GetString(IDS_SAFE_BROWSING_PHISHING_LABEL));
+ string16 phishing_link =
+ WideToUTF16Hack(
+ l10n_util::GetString(IDS_SAFE_BROWSING_PHISHING_REPORT_ERROR));
+ string16 malware_label =
+ WideToUTF16Hack(
+ l10n_util::GetString(IDS_SAFE_BROWSING_MALWARE_LABEL));
+ string16 malware_link =
+ WideToUTF16Hack(
+ l10n_util::GetString(IDS_SAFE_BROWSING_MALWARE_DIAGNOSTIC_PAGE));
ListValue* error_strings = new ListValue;
for (UnsafeResourceList::const_iterator iter = unsafe_resources_.begin();
@@ -131,20 +137,26 @@ void SafeBrowsingBlockingPage::PopulateMultipleThreatStringDictionary(
DictionaryValue* current_error_strings = new DictionaryValue;
if (resource.threat_type == SafeBrowsingService::URL_MALWARE) {
malware = true;
- current_error_strings->SetString(L"type", L"malware");
- current_error_strings->SetString(L"typeLabel", malware_label);
- current_error_strings->SetString(L"errorLink", malware_link);
+ current_error_strings->SetString(ASCIIToUTF16("type"),
+ ASCIIToUTF16("malware"));
+ current_error_strings->SetString(ASCIIToUTF16("typeLabel"),
+ malware_label);
+ current_error_strings->SetString(ASCIIToUTF16("errorLink"), malware_link);
} else {
DCHECK(resource.threat_type == SafeBrowsingService::URL_PHISHING);
phishing = true;
- current_error_strings->SetString(L"type", L"phishing");
- current_error_strings->SetString(L"typeLabel", phishing_label);
- current_error_strings->SetString(L"errorLink", phishing_link);
+ current_error_strings->SetString(ASCIIToUTF16("type"),
+ ASCIIToUTF16("phishing"));
+ current_error_strings->SetString(ASCIIToUTF16("typeLabel"),
+ phishing_label);
+ current_error_strings->SetString(ASCIIToUTF16("errorLink"),
+ phishing_link);
}
- current_error_strings->SetString(L"url", UTF8ToWide(resource.url.spec()));
+ current_error_strings->SetString(ASCIIToUTF16("url"),
+ UTF8ToUTF16(resource.url.spec()));
error_strings->Append(current_error_strings);
}
- strings->Set(L"errors", error_strings);
+ strings->Set(ASCIIToUTF16("errors"), error_strings);
DCHECK(phishing || malware);
if (malware && phishing) {
@@ -178,15 +190,18 @@ void SafeBrowsingBlockingPage::PopulateMultipleThreatStringDictionary(
L"", L"");
}
- strings->SetString(L"confirm_text",
- l10n_util::GetString(IDS_SAFE_BROWSING_MALWARE_DESCRIPTION_AGREE));
- strings->SetString(L"continue_button",
- l10n_util::GetString(IDS_SAFE_BROWSING_MALWARE_PROCEED_BUTTON));
- strings->SetString(L"back_button",
- l10n_util::GetString(IDS_SAFE_BROWSING_MALWARE_BACK_BUTTON));
- strings->SetString(L"textdirection",
+ strings->SetString(ASCIIToUTF16("confirm_text"),
+ WideToUTF16Hack(l10n_util::GetString(
+ IDS_SAFE_BROWSING_MALWARE_DESCRIPTION_AGREE)));
+ strings->SetString(ASCIIToUTF16("continue_button"),
+ WideToUTF16Hack(l10n_util::GetString(
+ IDS_SAFE_BROWSING_MALWARE_PROCEED_BUTTON)));
+ strings->SetString(ASCIIToUTF16("back_button"),
+ WideToUTF16Hack(l10n_util::GetString(
+ IDS_SAFE_BROWSING_MALWARE_BACK_BUTTON)));
+ strings->SetString(ASCIIToUTF16("textdirection"),
(l10n_util::GetTextDirection() == l10n_util::RIGHT_TO_LEFT) ?
- L"rtl" : L"ltr");
+ ASCIIToUTF16("rtl") : ASCIIToUTF16("ltr"));
}
void SafeBrowsingBlockingPage::PopulateMalwareStringDictionary(
@@ -194,7 +209,7 @@ void SafeBrowsingBlockingPage::PopulateMalwareStringDictionary(
std::wstring link = StringPrintf(kSbDiagnosticHtml,
l10n_util::GetString(IDS_SAFE_BROWSING_MALWARE_DIAGNOSTIC_PAGE).c_str());
- strings->SetString(L"badURL", UTF8ToWide(url().host()));
+ strings->SetString(ASCIIToUTF16("badURL"), UTF8ToUTF16(url().host()));
// Check to see if we're blocking the main page, or a sub-resource on the
// main page.
std::wstring description1, description2;
@@ -220,15 +235,18 @@ void SafeBrowsingBlockingPage::PopulateMalwareStringDictionary(
description1, description2,
l10n_util::GetString(IDS_SAFE_BROWSING_MALWARE_DESCRIPTION3));
- strings->SetString(L"confirm_text",
- l10n_util::GetString(IDS_SAFE_BROWSING_MALWARE_DESCRIPTION_AGREE));
- strings->SetString(L"continue_button",
- l10n_util::GetString(IDS_SAFE_BROWSING_MALWARE_PROCEED_BUTTON));
- strings->SetString(L"back_button",
- l10n_util::GetString(IDS_SAFE_BROWSING_MALWARE_BACK_BUTTON));
- strings->SetString(L"textdirection",
+ strings->SetString(ASCIIToUTF16("confirm_text"),
+ WideToUTF16Hack(l10n_util::GetString(
+ IDS_SAFE_BROWSING_MALWARE_DESCRIPTION_AGREE)));
+ strings->SetString(ASCIIToUTF16("continue_button"),
+ WideToUTF16Hack(l10n_util::GetString(
+ IDS_SAFE_BROWSING_MALWARE_PROCEED_BUTTON)));
+ strings->SetString(ASCIIToUTF16("back_button"),
+ WideToUTF16Hack(l10n_util::GetString(
+ IDS_SAFE_BROWSING_MALWARE_BACK_BUTTON)));
+ strings->SetString(ASCIIToUTF16("textdirection"),
(l10n_util::GetTextDirection() == l10n_util::RIGHT_TO_LEFT) ?
- L"rtl" : L"ltr");
+ ASCIIToUTF16("rtl") : ASCIIToUTF16("ltr"));
}
void SafeBrowsingBlockingPage::PopulatePhishingStringDictionary(
@@ -243,15 +261,18 @@ void SafeBrowsingBlockingPage::PopulatePhishingStringDictionary(
UTF8ToWide(url().host())),
L"");
- strings->SetString(L"continue_button",
- l10n_util::GetString(IDS_SAFE_BROWSING_PHISHING_PROCEED_BUTTON));
- strings->SetString(L"back_button",
- l10n_util::GetString(IDS_SAFE_BROWSING_PHISHING_BACK_BUTTON));
- strings->SetString(L"report_error",
- l10n_util::GetString(IDS_SAFE_BROWSING_PHISHING_REPORT_ERROR));
- strings->SetString(L"textdirection",
+ strings->SetString(ASCIIToUTF16("continue_button"),
+ WideToUTF16Hack(l10n_util::GetString(
+ IDS_SAFE_BROWSING_PHISHING_PROCEED_BUTTON)));
+ strings->SetString(ASCIIToUTF16("back_button"),
+ WideToUTF16Hack(l10n_util::GetString(
+ IDS_SAFE_BROWSING_PHISHING_BACK_BUTTON)));
+ strings->SetString(ASCIIToUTF16("report_error"),
+ WideToUTF16Hack(l10n_util::GetString(
+ IDS_SAFE_BROWSING_PHISHING_REPORT_ERROR)));
+ strings->SetString(ASCIIToUTF16("textdirection"),
(l10n_util::GetTextDirection() == l10n_util::RIGHT_TO_LEFT) ?
- L"rtl" : L"ltr");
+ ASCIIToUTF16("rtl") : ASCIIToUTF16("ltr"));
}
void SafeBrowsingBlockingPage::CommandReceived(const std::string& cmd) {
@@ -435,4 +456,3 @@ bool SafeBrowsingBlockingPage::IsMainPage(
return unsafe_resources.size() == 1 &&
unsafe_resources[0].resource_type == ResourceType::MAIN_FRAME;
}
-