diff options
author | dsh@google.com <dsh@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-28 01:01:50 +0000 |
---|---|---|
committer | dsh@google.com <dsh@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-28 01:01:50 +0000 |
commit | 41fb1d7d262e44d8561a5c4d6d7e353f638b56e8 (patch) | |
tree | 0b6159a725069a98f9fb6e6e451949a6ce37ccfa /chrome/browser | |
parent | 3131a289c0edff9d58da46cae16beae6bd6c0650 (diff) | |
download | chromium_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/browser')
-rw-r--r-- | chrome/browser/bookmarks/bookmark_codec.cc | 8 | ||||
-rw-r--r-- | chrome/browser/bookmarks/bookmark_html_writer.cc | 4 | ||||
-rw-r--r-- | chrome/browser/browser_init.cc | 6 | ||||
-rw-r--r-- | chrome/browser/dom_ui/dom_ui.cc | 3 | ||||
-rw-r--r-- | chrome/browser/dom_ui/history_ui.cc | 2 | ||||
-rw-r--r-- | chrome/browser/dom_ui/new_tab_ui.cc | 2 | ||||
-rw-r--r-- | chrome/browser/history/text_database.cc | 5 | ||||
-rw-r--r-- | chrome/browser/metrics/metrics_service.cc | 12 | ||||
-rw-r--r-- | chrome/browser/page_state.cc | 5 | ||||
-rw-r--r-- | chrome/browser/search_engines/template_url_model.cc | 2 | ||||
-rw-r--r-- | chrome/browser/search_engines/template_url_parser.cc | 12 |
11 files changed, 29 insertions, 32 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; } - - |