From 20ce516dc41e836279baba3a214f1b4e4dbcc22d Mon Sep 17 00:00:00 2001 From: "estade@chromium.org" Date: Fri, 18 Jun 2010 02:20:04 +0000 Subject: Pref service strings should be std::string. Part 1: Convert RegisterStringPref. BUG=none TEST=compile Review URL: http://codereview.chromium.org/2809022 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@50202 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/web_resource/web_resource_service.cc | 19 ++++++++++--------- chrome/browser/web_resource/web_resource_service.h | 4 ++-- 2 files changed, 12 insertions(+), 11 deletions(-) (limited to 'chrome/browser/web_resource') diff --git a/chrome/browser/web_resource/web_resource_service.cc b/chrome/browser/web_resource/web_resource_service.cc index a18804a..ac5dae6 100644 --- a/chrome/browser/web_resource/web_resource_service.cc +++ b/chrome/browser/web_resource/web_resource_service.cc @@ -50,7 +50,7 @@ class WebResourceService::WebResourceFetcher web_resource_service_->in_fetch_ = true; url_fetcher_.reset(new URLFetcher(GURL( - WideToUTF8(web_resource_service_->web_resource_server_)), + web_resource_service_->web_resource_server_), URLFetcher::GET, this)); // Do not let url fetcher affect existing state in profile (by setting // cookies, for example. @@ -179,13 +179,13 @@ class WebResourceService::UnpackerClient }; // TODO(mirandac): replace these servers tomorrow! -const wchar_t* WebResourceService::kDefaultResourceServer = +const char* WebResourceService::kDefaultResourceServer = #if defined(OS_MACOSX) - L"https://clients2.google.com/tools/service/npredir?r=chrometips_mac&hl="; + "https://clients2.google.com/tools/service/npredir?r=chrometips_mac&hl="; #elif defined(OS_LINUX) - L"https://clients2.google.com/tools/service/npredir?r=chrometips_linux&hl="; + "https://clients2.google.com/tools/service/npredir?r=chrometips_linux&hl="; #else - L"https://clients2.google.com/tools/service/npredir?r=chrometips_win&hl="; + "https://clients2.google.com/tools/service/npredir?r=chrometips_win&hl="; #endif const char* WebResourceService::kResourceDirectoryName = @@ -203,11 +203,12 @@ WebResourceService::~WebResourceService() { } void WebResourceService::Init() { resource_dispatcher_host_ = g_browser_process->resource_dispatcher_host(); web_resource_fetcher_ = new WebResourceFetcher(this); - prefs_->RegisterStringPref(prefs::kNTPTipsCacheUpdate, L"0"); - std::wstring locale = ASCIIToWide(g_browser_process->GetApplicationLocale()); + prefs_->RegisterStringPref(prefs::kNTPTipsCacheUpdate, "0"); + std::string locale = g_browser_process->GetApplicationLocale(); if (prefs_->HasPrefPath(prefs::kNTPTipsServer)) { - web_resource_server_ = prefs_->GetString(prefs::kNTPTipsServer); + web_resource_server_ = + WideToASCII(prefs_->GetString(prefs::kNTPTipsServer)); // If we are in the correct locale, initialization is done. if (EndsWith(web_resource_server_, locale, false)) return; @@ -293,5 +294,5 @@ void WebResourceService::UpdateResourceCache(const std::string& json_data) { // Update resource server and cache update time in preferences. prefs_->SetString(prefs::kNTPTipsCacheUpdate, DoubleToWString(base::Time::Now().ToDoubleT())); - prefs_->SetString(prefs::kNTPTipsServer, web_resource_server_); + prefs_->SetString(prefs::kNTPTipsServer, ASCIIToWide(web_resource_server_)); } diff --git a/chrome/browser/web_resource/web_resource_service.h b/chrome/browser/web_resource/web_resource_service.h index b7c4980..6e26cd3 100644 --- a/chrome/browser/web_resource/web_resource_service.h +++ b/chrome/browser/web_resource/web_resource_service.h @@ -31,7 +31,7 @@ class WebResourceService static const wchar_t* kTipCachePrefName; // Default server from which to gather resources. - static const wchar_t* kDefaultResourceServer; + static const char* kDefaultResourceServer; private: class WebResourceFetcher; @@ -56,7 +56,7 @@ class WebResourceService FilePath web_resource_dir_; // Server from which we are currently pulling web resource data. - std::wstring web_resource_server_; + std::string web_resource_server_; WebResourceFetcher* web_resource_fetcher_; -- cgit v1.1