summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authordsh@google.com <dsh@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-28 01:01:50 +0000
committerdsh@google.com <dsh@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-28 01:01:50 +0000
commit41fb1d7d262e44d8561a5c4d6d7e353f638b56e8 (patch)
tree0b6159a725069a98f9fb6e6e451949a6ce37ccfa /chrome
parent3131a289c0edff9d58da46cae16beae6bd6c0650 (diff)
downloadchromium_src-41fb1d7d262e44d8561a5c4d6d7e353f638b56e8.zip
chromium_src-41fb1d7d262e44d8561a5c4d6d7e353f638b56e8.tar.gz
chromium_src-41fb1d7d262e44d8561a5c4d6d7e353f638b56e8.tar.bz2
Get rid of wstring variants of StringToFoo.
Review URL: http://codereview.chromium.org/28281 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@10664 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/bookmarks/bookmark_codec.cc8
-rw-r--r--chrome/browser/bookmarks/bookmark_html_writer.cc4
-rw-r--r--chrome/browser/browser_init.cc6
-rw-r--r--chrome/browser/dom_ui/dom_ui.cc3
-rw-r--r--chrome/browser/dom_ui/history_ui.cc2
-rw-r--r--chrome/browser/dom_ui/new_tab_ui.cc2
-rw-r--r--chrome/browser/history/text_database.cc5
-rw-r--r--chrome/browser/metrics/metrics_service.cc12
-rw-r--r--chrome/browser/page_state.cc5
-rw-r--r--chrome/browser/search_engines/template_url_model.cc2
-rw-r--r--chrome/browser/search_engines/template_url_parser.cc12
-rw-r--r--chrome/common/logging_chrome.cc3
-rw-r--r--chrome/common/pref_service.cc7
-rw-r--r--chrome/test/ui/ui_test.cc8
-rw-r--r--chrome/test/ui/ui_test_suite.h3
15 files changed, 39 insertions, 43 deletions
diff --git a/chrome/browser/bookmarks/bookmark_codec.cc b/chrome/browser/bookmarks/bookmark_codec.cc
index fc4b592..dd39fc8 100644
--- a/chrome/browser/bookmarks/bookmark_codec.cc
+++ b/chrome/browser/bookmarks/bookmark_codec.cc
@@ -175,8 +175,8 @@ bool BookmarkCodec::DecodeNode(BookmarkModel* model,
if (!node)
node = new BookmarkNode(model, GURL());
node->type_ = history::StarredEntry::USER_GROUP;
- node->date_group_modified_ =
- Time::FromInternalValue(StringToInt64(last_modified_date));
+ node->date_group_modified_ = Time::FromInternalValue(
+ StringToInt64(WideToUTF16Hack(last_modified_date)));
if (parent)
parent->Add(parent->GetChildCount(), node);
@@ -186,7 +186,7 @@ bool BookmarkCodec::DecodeNode(BookmarkModel* model,
}
node->SetTitle(title);
- node->date_added_ =
- Time::FromInternalValue(StringToInt64(date_added_string));
+ node->date_added_ = Time::FromInternalValue(
+ StringToInt64(WideToUTF16Hack(date_added_string)));
return true;
}
diff --git a/chrome/browser/bookmarks/bookmark_html_writer.cc b/chrome/browser/bookmarks/bookmark_html_writer.cc
index bb39ebe..6b6c556 100644
--- a/chrome/browser/bookmarks/bookmark_html_writer.cc
+++ b/chrome/browser/bookmarks/bookmark_html_writer.cc
@@ -193,8 +193,8 @@ class Writer : public Task {
// Converts a time string written to the JSON codec into a time_t string
// (used by bookmarks.html) and writes it.
bool WriteTime(const std::wstring& time_string) {
- base::Time time =
- base::Time::FromInternalValue(StringToInt64(time_string));
+ base::Time time = base::Time::FromInternalValue(
+ StringToInt64(WideToUTF16Hack(time_string)));
return Write(Int64ToString(time.ToTimeT()));
}
diff --git a/chrome/browser/browser_init.cc b/chrome/browser/browser_init.cc
index b393d18..8b5eb37 100644
--- a/chrome/browser/browser_init.cc
+++ b/chrome/browser/browser_init.cc
@@ -217,7 +217,7 @@ bool BrowserInit::LaunchWithProfile::Launch(Profile* profile,
if (!RenderProcessHost::run_renderer_in_process()) {
std::wstring port_str =
command_line_.GetSwitchValue(switches::kRemoteShellPort);
- int64 port = StringToInt64(port_str);
+ int64 port = StringToInt64(WideToUTF16Hack(port_str));
if (port > 0 && port < 65535) {
g_browser_process->InitDebuggerWrapper(static_cast<int>(port));
} else {
@@ -425,7 +425,7 @@ bool BrowserInit::ProcessCommandLine(
command_line.GetSwitchValue(switches::kOmniBoxPopupCount);
if (!popup_count_string.empty()) {
int count = 0;
- if (StringToInt(popup_count_string, &count)) {
+ if (StringToInt(WideToUTF16Hack(popup_count_string), &count)) {
const int popup_count = std::max(0, count);
AutocompleteResult::set_max_matches(popup_count);
AutocompleteProvider::set_max_matches(popup_count / 2);
@@ -439,7 +439,7 @@ bool BrowserInit::ProcessCommandLine(
command_line.GetSwitchValue(switches::kTabCountToLoadOnSessionRestore);
if (!tab_count_string.empty()) {
int count = 0;
- if (StringToInt(tab_count_string, &count)) {
+ if (StringToInt(WideToUTF16Hack(tab_count_string), &count)) {
const int tab_count = std::max(0, count);
SessionRestore::num_tabs_to_load_ = static_cast<size_t>(tab_count);
}
diff --git a/chrome/browser/dom_ui/dom_ui.cc b/chrome/browser/dom_ui/dom_ui.cc
index 22e3382..b0efcad 100644
--- a/chrome/browser/dom_ui/dom_ui.cc
+++ b/chrome/browser/dom_ui/dom_ui.cc
@@ -148,7 +148,7 @@ bool DOMMessageHandler::ExtractIntegerValue(const Value* value, int* out_int) {
static_cast<const StringValue*>(list_member);
std::wstring wstring_value;
string_value->GetAsString(&wstring_value);
- *out_int = StringToInt(wstring_value);
+ *out_int = StringToInt(WideToUTF16Hack(wstring_value));
return true;
}
}
@@ -173,4 +173,3 @@ std::wstring DOMMessageHandler::ExtractStringValue(const Value* value) {
}
return std::wstring();
}
-
diff --git a/chrome/browser/dom_ui/history_ui.cc b/chrome/browser/dom_ui/history_ui.cc
index fcabc19..0f735d4 100644
--- a/chrome/browser/dom_ui/history_ui.cc
+++ b/chrome/browser/dom_ui/history_ui.cc
@@ -278,7 +278,7 @@ void BrowsingHistoryHandler::ExtractSearchHistoryArguments(const Value* value,
static_cast<const StringValue*>(list_member);
std::wstring wstring_value;
string_value->GetAsString(&wstring_value);
- *month = StringToInt(wstring_value);
+ *month = StringToInt(WideToUTF16Hack(wstring_value));
}
}
}
diff --git a/chrome/browser/dom_ui/new_tab_ui.cc b/chrome/browser/dom_ui/new_tab_ui.cc
index 3b83c99..189f703 100644
--- a/chrome/browser/dom_ui/new_tab_ui.cc
+++ b/chrome/browser/dom_ui/new_tab_ui.cc
@@ -596,7 +596,7 @@ void RecentlyClosedTabsHandler::HandleReopenTab(const Value* content) {
static_cast<const StringValue*>(list_member);
std::wstring wstring_value;
if (string_value->GetAsString(&wstring_value)) {
- int session_to_restore = StringToInt(wstring_value);
+ int session_to_restore = StringToInt(WideToUTF16Hack(wstring_value));
tab_restore_service_->RestoreEntryById(browser, session_to_restore,
true);
// The current tab has been nuked at this point; don't touch any member
diff --git a/chrome/browser/history/text_database.cc b/chrome/browser/history/text_database.cc
index 00d05ce..37b15ba 100644
--- a/chrome/browser/history/text_database.cc
+++ b/chrome/browser/history/text_database.cc
@@ -127,8 +127,8 @@ TextDatabase::DBIdent TextDatabase::FileNameToID(const std::wstring& file_path){
return 0;
}
- int year = StringToInt(suffix.substr(0, 4));
- int month = StringToInt(suffix.substr(5, 2));
+ int year = StringToInt(WideToUTF16Hack(suffix.substr(0, 4)));
+ int month = StringToInt(WideToUTF16Hack(suffix.substr(5, 2)));
return year * 100 + month;
}
@@ -392,4 +392,3 @@ void TextDatabase::GetTextMatches(const std::string& query,
}
} // namespace history
-
diff --git a/chrome/browser/metrics/metrics_service.cc b/chrome/browser/metrics/metrics_service.cc
index c50a4c5..5b41058 100644
--- a/chrome/browser/metrics/metrics_service.cc
+++ b/chrome/browser/metrics/metrics_service.cc
@@ -616,12 +616,12 @@ void MetricsService::InitializeMetricsState() {
// This is marked false when we get a WM_ENDSESSION.
pref->SetBoolean(prefs::kStabilitySessionEndCompleted, true);
- int64 last_start_time =
- StringToInt64(pref->GetString(prefs::kStabilityLaunchTimeSec));
- int64 last_end_time =
- StringToInt64(pref->GetString(prefs::kStabilityLastTimestampSec));
- int64 uptime =
- StringToInt64(pref->GetString(prefs::kStabilityUptimeSec));
+ int64 last_start_time = StringToInt64(
+ WideToUTF16Hack(pref->GetString(prefs::kStabilityLaunchTimeSec)));
+ int64 last_end_time = StringToInt64(
+ WideToUTF16Hack(pref->GetString(prefs::kStabilityLastTimestampSec)));
+ int64 uptime = StringToInt64(
+ WideToUTF16Hack(pref->GetString(prefs::kStabilityUptimeSec)));
if (last_start_time && last_end_time) {
// TODO(JAR): Exclude sleep time. ... which must be gathered in UI loop.
diff --git a/chrome/browser/page_state.cc b/chrome/browser/page_state.cc
index 1d52ffb..827416c 100644
--- a/chrome/browser/page_state.cc
+++ b/chrome/browser/page_state.cc
@@ -82,7 +82,7 @@ void PageState::SetInt64Property(const std::wstring& key, int64 value) {
bool PageState::GetInt64Property(const std::wstring& key, int64* value) const {
std::wstring v;
if (GetProperty(key, &v)) {
- return StringToInt64(v, value);
+ return StringToInt64(WideToUTF16Hack(v), value);
}
return false;
}
@@ -94,7 +94,7 @@ void PageState::SetIntProperty(const std::wstring& key, int value) {
bool PageState::GetIntProperty(const std::wstring& key, int* value) const {
std::wstring v;
if (GetProperty(key, &v)) {
- return StringToInt(v, value);
+ return StringToInt(WideToUTF16Hack(v), value);
}
return false;
}
@@ -105,4 +105,3 @@ PageState* PageState::Copy() const {
copy->state_.reset(static_cast<DictionaryValue*>(state_->DeepCopy()));
return copy;
}
-
diff --git a/chrome/browser/search_engines/template_url_model.cc b/chrome/browser/search_engines/template_url_model.cc
index 316ad80..cac5bea 100644
--- a/chrome/browser/search_engines/template_url_model.cc
+++ b/chrome/browser/search_engines/template_url_model.cc
@@ -828,7 +828,7 @@ bool TemplateURLModel::LoadDefaultSearchProviderFromPrefs(
(*default_provider)->SetURL(search_url, 0, 0);
(*default_provider)->SetSuggestionsURL(suggest_url, 0, 0);
if (!id_string.empty())
- (*default_provider)->set_id(StringToInt64(id_string));
+ (*default_provider)->set_id(StringToInt64(WideToUTF16Hack(id_string)));
return true;
}
diff --git a/chrome/browser/search_engines/template_url_parser.cc b/chrome/browser/search_engines/template_url_parser.cc
index 0bec982..8c44933 100644
--- a/chrome/browser/search_engines/template_url_parser.cc
+++ b/chrome/browser/search_engines/template_url_parser.cc
@@ -311,9 +311,11 @@ void ParseURL(const xmlChar** atts, ParsingContext* context) {
} else if (name == kURLTemplateAttribute) {
template_url = XMLCharToWide(value);
} else if (name == kURLIndexOffsetAttribute) {
- index_offset = std::max(1, StringToInt(XMLCharToWide(value)));
+ index_offset =
+ std::max(1, StringToInt(WideToUTF16Hack(XMLCharToWide(value))));
} else if (name == kURLPageOffsetAttribute) {
- page_offset = std::max(1, StringToInt(XMLCharToWide(value)));
+ page_offset =
+ std::max(1, StringToInt(WideToUTF16Hack(XMLCharToWide(value))));
} else if (name == kParamMethodAttribute) {
is_post = LowerCaseEqualsASCII(XMLCharToString(value), "post");
}
@@ -346,9 +348,9 @@ void ParseImage(const xmlChar** atts, ParsingContext* context) {
if (name == kImageTypeAttribute) {
type = XMLCharToWide(value);
} else if (name == kImageWidthAttribute) {
- width = StringToInt(XMLCharToWide(value));
+ width = StringToInt(WideToUTF16Hack(XMLCharToWide(value)));
} else if (name == kImageHeightAttribute) {
- height = StringToInt(XMLCharToWide(value));
+ height = StringToInt(WideToUTF16Hack(XMLCharToWide(value)));
}
attributes += 2;
}
@@ -585,5 +587,3 @@ bool TemplateURLParser::Parse(const unsigned char* data, size_t length,
}
return false;
}
-
-
diff --git a/chrome/common/logging_chrome.cc b/chrome/common/logging_chrome.cc
index 6b34cbe..66a49cf 100644
--- a/chrome/common/logging_chrome.cc
+++ b/chrome/common/logging_chrome.cc
@@ -125,7 +125,7 @@ void InitChromeLogging(const CommandLine& command_line,
// default to LOG_WARNING.
std::wstring log_level = command_line.GetSwitchValue(switches::kLoggingLevel);
int level = 0;
- if (StringToInt(log_level, &level)) {
+ if (StringToInt(WideToUTF16Hack(log_level), &level)) {
if ((level >= 0) && (level < LOG_NUM_SEVERITIES))
logging::SetMinLogLevel(level);
} else {
@@ -200,4 +200,3 @@ size_t GetFatalAssertions(AssertionList* assertions) {
}
} // namespace logging
-
diff --git a/chrome/common/pref_service.cc b/chrome/common/pref_service.cc
index ebc9452..b728a87 100644
--- a/chrome/common/pref_service.cc
+++ b/chrome/common/pref_service.cc
@@ -72,12 +72,14 @@ Value* CreateLocaleDefaultValue(Value::ValueType type, int message_id) {
}
case Value::TYPE_INTEGER: {
- return Value::CreateIntegerValue(StringToInt(resource_string));
+ return Value::CreateIntegerValue(
+ StringToInt(WideToUTF16Hack(resource_string)));
break;
}
case Value::TYPE_REAL: {
- return Value::CreateRealValue(StringToDouble(resource_string));
+ return Value::CreateRealValue(
+ StringToDouble(WideToUTF16Hack(resource_string)));
break;
}
@@ -683,4 +685,3 @@ bool PrefService::Preference::IsDefaultValue() const {
DCHECK(default_value_.get());
return default_value_->Equals(GetValue());
}
-
diff --git a/chrome/test/ui/ui_test.cc b/chrome/test/ui/ui_test.cc
index d7bb7ca..2124ba7 100644
--- a/chrome/test/ui/ui_test.cc
+++ b/chrome/test/ui/ui_test.cc
@@ -186,27 +186,27 @@ void UITest::InitializeTimeouts() {
const CommandLine& command_line = *CommandLine::ForCurrentProcess();
if (command_line.HasSwitch(kUiTestTimeout)) {
std::wstring timeout_str = command_line.GetSwitchValue(kUiTestTimeout);
- int timeout = StringToInt(timeout_str);
+ int timeout = StringToInt(WideToUTF16Hack(timeout_str));
command_execution_timeout_ms_ = std::max(kMaxTestExecutionTime, timeout);
}
if (command_line.HasSwitch(kUiTestActionTimeout)) {
std::wstring act_str = command_line.GetSwitchValue(kUiTestActionTimeout);
- int act_timeout = StringToInt(act_str);
+ int act_timeout = StringToInt(WideToUTF16Hack(act_str));
action_timeout_ms_ = std::max(kWaitForActionMsec, act_timeout);
}
if (command_line.HasSwitch(kUiTestActionMaxTimeout)) {
std::wstring action_max_str =
command_line.GetSwitchValue(kUiTestActionMaxTimeout);
- int max_timeout = StringToInt(action_max_str);
+ int max_timeout = StringToInt(WideToUTF16Hack(action_max_str));
action_max_timeout_ms_ = std::max(kWaitForActionMaxMsec, max_timeout);
}
if (CommandLine::ForCurrentProcess()->HasSwitch(kUiTestSleepTimeout)) {
std::wstring sleep_timeout_str =
CommandLine::ForCurrentProcess()->GetSwitchValue(kUiTestSleepTimeout);
- int sleep_timeout = StringToInt(sleep_timeout_str);
+ int sleep_timeout = StringToInt(WideToUTF16Hack(sleep_timeout_str));
sleep_timeout_ms_ = std::max(kWaitForActionMsec, sleep_timeout);
}
}
diff --git a/chrome/test/ui/ui_test_suite.h b/chrome/test/ui/ui_test_suite.h
index dfe5eeb..d450a71 100644
--- a/chrome/test/ui/ui_test_suite.h
+++ b/chrome/test/ui/ui_test_suite.h
@@ -42,7 +42,7 @@ class UITestSuite : public ChromeTestSuite {
std::wstring test_timeout =
parsed_command_line.GetSwitchValue(UITestSuite::kTestTimeout);
if (!test_timeout.empty()) {
- UITest::set_test_timeout_ms(StringToInt(test_timeout));
+ UITest::set_test_timeout_ms(StringToInt(WideToUTF16Hack(test_timeout)));
}
std::wstring js_flags =
parsed_command_line.GetSwitchValue(switches::kJavaScriptFlags);
@@ -69,4 +69,3 @@ class UITestSuite : public ChromeTestSuite {
};
#endif // CHROME_TEST_UI_UI_TEST_SUITE_H_
-