summaryrefslogtreecommitdiffstats
path: root/chrome/browser/importer
diff options
context:
space:
mode:
authoravi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-14 21:15:35 +0000
committeravi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-14 21:15:35 +0000
commita61c5c9bb6524d77c30b6a18f542c0e4616ee7bc (patch)
treec1afa473cffdaea857f181ba0788e60212649f30 /chrome/browser/importer
parent0eb90137036cf765397a69f04f5c6695679fd8c0 (diff)
downloadchromium_src-a61c5c9bb6524d77c30b6a18f542c0e4616ee7bc.zip
chromium_src-a61c5c9bb6524d77c30b6a18f542c0e4616ee7bc.tar.gz
chromium_src-a61c5c9bb6524d77c30b6a18f542c0e4616ee7bc.tar.bz2
Remove wstring from TemplateURL and friends.
BUG=23581 TEST=no visible changes; all tests pass Review URL: http://codereview.chromium.org/6322001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@71485 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/importer')
-rw-r--r--chrome/browser/importer/firefox2_importer.cc8
-rw-r--r--chrome/browser/importer/firefox_importer_utils.cc4
-rw-r--r--chrome/browser/importer/importer_messages.h16
-rw-r--r--chrome/browser/importer/importer_unittest.cc14
-rw-r--r--chrome/browser/importer/profile_writer.cc6
5 files changed, 25 insertions, 23 deletions
diff --git a/chrome/browser/importer/firefox2_importer.cc b/chrome/browser/importer/firefox2_importer.cc
index 7783a7c..59f9ff2 100644
--- a/chrome/browser/importer/firefox2_importer.cc
+++ b/chrome/browser/importer/firefox2_importer.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -140,9 +140,9 @@ TemplateURL* Firefox2Importer::CreateTemplateURL(const std::wstring& title,
TemplateURL* t_url = new TemplateURL();
// We set short name by using the title if it exists.
// Otherwise, we use the shortcut.
- t_url->set_short_name(!title.empty() ? title : keyword);
- t_url->set_keyword(keyword);
- t_url->SetURL(TemplateURLRef::DisplayURLToURLRef(UTF8ToWide(url.spec())),
+ t_url->set_short_name(WideToUTF16Hack(!title.empty() ? title : keyword));
+ t_url->set_keyword(WideToUTF16Hack(keyword));
+ t_url->SetURL(TemplateURLRef::DisplayURLToURLRef(UTF8ToUTF16(url.spec())),
0, 0);
return t_url;
}
diff --git a/chrome/browser/importer/firefox_importer_utils.cc b/chrome/browser/importer/firefox_importer_utils.cc
index be606ff..3ff88f2 100644
--- a/chrome/browser/importer/firefox_importer_utils.cc
+++ b/chrome/browser/importer/firefox_importer_utils.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -312,7 +312,7 @@ int GetFirefoxDefaultSearchEngineIndex(
int default_se_index = -1;
for (std::vector<TemplateURL*>::const_iterator iter = search_engines.begin();
iter != search_engines.end(); ++iter) {
- if (default_se_name == WideToUTF8((*iter)->short_name())) {
+ if (default_se_name == UTF16ToUTF8((*iter)->short_name())) {
default_se_index = static_cast<int>(iter - search_engines.begin());
break;
}
diff --git a/chrome/browser/importer/importer_messages.h b/chrome/browser/importer/importer_messages.h
index e05aac8..ac63526 100644
--- a/chrome/browser/importer/importer_messages.h
+++ b/chrome/browser/importer/importer_messages.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -222,7 +222,7 @@ struct ParamTraits<TemplateURL::ImageRef> {
WriteParam(m, p.url);
}
static bool Read(const Message* m, void** iter, param_type* p) {
- std::wstring type;
+ std::string type;
int width;
int height;
GURL url;
@@ -275,17 +275,17 @@ struct ParamTraits<TemplateURL> {
WriteParam(m, p.prepopulate_id());
}
static bool Read(const Message* m, void** iter, param_type* p) {
- std::wstring short_name;
- std::wstring description;
+ string16 short_name;
+ string16 description;
bool includes_suggestions_url;
TemplateURLRef suggestions_url;
TemplateURLRef url;
GURL originating_url;
- std::wstring keyword;
+ string16 keyword;
bool autogenerate_keyword;
bool show_in_default_list;
bool safe_for_autoreplace;
- std::vector<std::wstring> languages;
+ std::vector<string16> languages;
std::vector<std::string> input_encodings;
base::Time date_created;
int usage_count;
@@ -314,7 +314,7 @@ struct ParamTraits<TemplateURL> {
*p = TemplateURL();
for (size_t i = 0; i < image_refs_size; ++i) {
- std::wstring type;
+ std::string type;
int width;
int height;
GURL url;
@@ -344,7 +344,7 @@ struct ParamTraits<TemplateURL> {
p->set_show_in_default_list(show_in_default_list);
p->set_safe_for_autoreplace(safe_for_autoreplace);
- std::vector<std::wstring>::const_iterator lang_iter;
+ std::vector<string16>::const_iterator lang_iter;
for (lang_iter = languages.begin();
lang_iter != languages.end();
++lang_iter) {
diff --git a/chrome/browser/importer/importer_unittest.cc b/chrome/browser/importer/importer_unittest.cc
index 595a3d7..2117619 100644
--- a/chrome/browser/importer/importer_unittest.cc
+++ b/chrome/browser/importer/importer_unittest.cc
@@ -637,9 +637,10 @@ class FirefoxObserver : public ProfileWriter,
// The order might not be deterministic, look in the expected list for
// that template URL.
bool found = false;
- std::wstring keyword = template_urls[i]->keyword();
+ string16 keyword = template_urls[i]->keyword();
for (size_t j = 0; j < arraysize(kFirefox2Keywords); ++j) {
- if (template_urls[i]->keyword() == kFirefox2Keywords[j].keyword) {
+ if (template_urls[i]->keyword() ==
+ WideToUTF16Hack(kFirefox2Keywords[j].keyword)) {
EXPECT_EQ(kFirefox2Keywords[j].url, template_urls[i]->url()->url());
found = true;
break;
@@ -652,7 +653,7 @@ class FirefoxObserver : public ProfileWriter,
if (default_keyword_index != -1) {
EXPECT_LT(default_keyword_index, static_cast<int>(template_urls.size()));
TemplateURL* default_turl = template_urls[default_keyword_index];
- default_keyword_ = default_turl->keyword();
+ default_keyword_ = UTF16ToWideHack(default_turl->keyword());
default_keyword_url_ = default_turl->url()->url();
}
@@ -844,9 +845,10 @@ class Firefox3Observer : public ProfileWriter,
// The order might not be deterministic, look in the expected list for
// that template URL.
bool found = false;
- std::wstring keyword = template_urls[i]->keyword();
+ string16 keyword = template_urls[i]->keyword();
for (size_t j = 0; j < arraysize(kFirefox3Keywords); ++j) {
- if (template_urls[i]->keyword() == kFirefox3Keywords[j].keyword) {
+ if (template_urls[i]->keyword() ==
+ WideToUTF16Hack(kFirefox3Keywords[j].keyword)) {
EXPECT_EQ(kFirefox3Keywords[j].url, template_urls[i]->url()->url());
found = true;
break;
@@ -859,7 +861,7 @@ class Firefox3Observer : public ProfileWriter,
if (default_keyword_index != -1) {
EXPECT_LT(default_keyword_index, static_cast<int>(template_urls.size()));
TemplateURL* default_turl = template_urls[default_keyword_index];
- default_keyword_ = default_turl->keyword();
+ default_keyword_ = UTF16ToWideHack(default_turl->keyword());
default_keyword_url_ = default_turl->url()->url();
}
diff --git a/chrome/browser/importer/profile_writer.cc b/chrome/browser/importer/profile_writer.cc
index 00e8dcf..e6eefdf 100644
--- a/chrome/browser/importer/profile_writer.cc
+++ b/chrome/browser/importer/profile_writer.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -181,8 +181,8 @@ static std::string BuildHostPathKey(const TemplateURL* t_url,
if (t_url->url()->SupportsReplacement()) {
return HostPathKeyForURL(GURL(
t_url->url()->ReplaceSearchTerms(
- *t_url, L"random string",
- TemplateURLRef::NO_SUGGESTIONS_AVAILABLE, std::wstring())));
+ *t_url, ASCIIToUTF16("random string"),
+ TemplateURLRef::NO_SUGGESTIONS_AVAILABLE, string16())));
}
}
return std::string();