diff options
-rw-r--r-- | base/base_paths_win.cc | 6 | ||||
-rw-r--r-- | base/i18n/icu_util.cc | 7 | ||||
-rw-r--r-- | base/path_service.cc | 2 | ||||
-rw-r--r-- | base/path_service.h | 2 | ||||
-rw-r--r-- | chrome/browser/importer/firefox_importer_unittest.cc | 30 | ||||
-rw-r--r-- | chrome/browser/importer/firefox_importer_unittest_utils.h | 4 | ||||
-rw-r--r-- | chrome/browser/importer/firefox_importer_unittest_utils_mac.cc | 2 | ||||
-rw-r--r-- | chrome/browser/nacl_process_host.cc | 8 | ||||
-rw-r--r-- | chrome/browser/renderer_host/gtk_key_bindings_handler_unittest.cc | 6 | ||||
-rw-r--r-- | chrome/browser/user_data_manager.cc | 15 | ||||
-rw-r--r-- | chrome/browser/zygote_host_linux.cc | 2 | ||||
-rw-r--r-- | chrome/test/ui/ui_test.cc | 7 | ||||
-rw-r--r-- | webkit/glue/plugins/plugin_list_win.cc | 8 |
13 files changed, 56 insertions, 43 deletions
diff --git a/base/base_paths_win.cc b/base/base_paths_win.cc index 89c2ff3..bc8566c 100644 --- a/base/base_paths_win.cc +++ b/base/base_paths_win.cc @@ -102,10 +102,8 @@ bool PathProviderWin(int key, FilePath* result) { case base::DIR_SOURCE_ROOT: // On Windows, unit tests execute two levels deep from the source root. // For example: chrome/{Debug|Release}/ui_tests.exe - PathService::Get(base::DIR_EXE, &wstring_path); - file_util::UpOneDirectory(&wstring_path); - file_util::UpOneDirectory(&wstring_path); - cur = FilePath(wstring_path); + PathService::Get(base::DIR_EXE, &cur); + cur = cur.DirName().DirName(); break; default: return false; diff --git a/base/i18n/icu_util.cc b/base/i18n/icu_util.cc index 6239a01..bccc1ab 100644 --- a/base/i18n/icu_util.cc +++ b/base/i18n/icu_util.cc @@ -56,12 +56,11 @@ bool Initialize() { #if (ICU_UTIL_DATA_IMPL == ICU_UTIL_DATA_SHARED) // We expect to find the ICU data module alongside the current module. - std::wstring data_path; + FilePath data_path; PathService::Get(base::DIR_MODULE, &data_path); - file_util::AppendToPath(&data_path, - ASCIIToWide(ICU_UTIL_DATA_SHARED_MODULE_NAME)); + data_path = data_path.AppendASCII(ICU_UTIL_DATA_SHARED_MODULE_NAME); - HMODULE module = LoadLibrary(data_path.c_str()); + HMODULE module = LoadLibrary(data_path.value().c_str()); if (!module) { LOG(ERROR) << "Failed to load " << ICU_UTIL_DATA_SHARED_MODULE_NAME; return false; diff --git a/base/path_service.cc b/base/path_service.cc index da172b3..4a4c100 100644 --- a/base/path_service.cc +++ b/base/path_service.cc @@ -188,6 +188,7 @@ bool PathService::Get(int key, FilePath* result) { return true; } +#if defined(OS_WIN) // static bool PathService::Get(int key, std::wstring* result) { // Deprecated compatibility function. @@ -197,6 +198,7 @@ bool PathService::Get(int key, std::wstring* result) { *result = path.ToWStringHack(); return true; } +#endif bool PathService::IsOverridden(int key) { PathData* path_data = GetPathData(); diff --git a/base/path_service.h b/base/path_service.h index 39aaa2a..b0e51e4 100644 --- a/base/path_service.h +++ b/base/path_service.h @@ -26,9 +26,11 @@ class PathService { // Returns true if the directory or file was successfully retrieved. On // failure, 'path' will not be changed. static bool Get(int key, FilePath* path); +#if defined(OS_WIN) // This version, producing a wstring, is deprecated and only kept around // until we can fix all callers. static bool Get(int key, std::wstring* path); +#endif // Overrides the path to a special directory or file. This cannot be used to // change the value of DIR_CURRENT, but that should be obvious. Also, if the diff --git a/chrome/browser/importer/firefox_importer_unittest.cc b/chrome/browser/importer/firefox_importer_unittest.cc index e7e9470..fa5086c 100644 --- a/chrome/browser/importer/firefox_importer_unittest.cc +++ b/chrome/browser/importer/firefox_importer_unittest.cc @@ -19,21 +19,22 @@ using base::Time; // to run in a separate process, so we use a proxy object so we can share the // same test between platforms. TEST(FirefoxImporterTest, Firefox2NSS3Decryptor) { - std::wstring nss_path; + FilePath nss_path; ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &nss_path)); #ifdef OS_MACOSX - file_util::AppendToPath(&nss_path, L"firefox2_nss_mac"); + nss_path = nss_path.AppendASCII("firefox2_nss_mac"); #else - file_util::AppendToPath(&nss_path, L"firefox2_nss"); + nss_path = nss_path.AppendASCII("firefox2_nss"); #endif // !OS_MACOSX - std::wstring db_path; + FilePath db_path; ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &db_path)); - file_util::AppendToPath(&db_path, L"firefox2_profile"); + db_path = db_path.AppendASCII("firefox2_profile"); FFUnitTestDecryptorProxy decryptor_proxy; - ASSERT_TRUE(decryptor_proxy.Setup(nss_path)); + ASSERT_TRUE(decryptor_proxy.Setup(nss_path.ToWStringHack())); - EXPECT_TRUE(decryptor_proxy.DecryptorInit(nss_path, db_path)); + EXPECT_TRUE(decryptor_proxy.DecryptorInit(nss_path.ToWStringHack(), + db_path.ToWStringHack())); EXPECT_EQ(L"hello", decryptor_proxy.Decrypt("MDIEEPgAAAAAAAAAAAAAAAAAAAE" "wFAYIKoZIhvcNAwcECBJM63MpT9rtBAjMCm7qo/EhlA==")); // Test UTF-16 encoding. @@ -42,21 +43,22 @@ TEST(FirefoxImporterTest, Firefox2NSS3Decryptor) { } TEST(FirefoxImporterTest, Firefox3NSS3Decryptor) { - std::wstring nss_path; + FilePath nss_path; ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &nss_path)); #ifdef OS_MACOSX - file_util::AppendToPath(&nss_path, L"firefox3_nss_mac"); + nss_path = nss_path.AppendASCII("firefox3_nss_mac"); #else - file_util::AppendToPath(&nss_path, L"firefox3_nss"); + nss_path = nss_path.AppendASCII("firefox3_nss"); #endif // !OS_MACOSX - std::wstring db_path; + FilePath db_path; ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &db_path)); - file_util::AppendToPath(&db_path, L"firefox3_profile"); + db_path = db_path.AppendASCII("firefox3_profile"); FFUnitTestDecryptorProxy decryptor_proxy; - ASSERT_TRUE(decryptor_proxy.Setup(nss_path)); + ASSERT_TRUE(decryptor_proxy.Setup(nss_path.ToWStringHack())); - EXPECT_TRUE(decryptor_proxy.DecryptorInit(nss_path, db_path)); + EXPECT_TRUE(decryptor_proxy.DecryptorInit(nss_path.ToWStringHack(), + db_path.ToWStringHack())); EXPECT_EQ(L"hello", decryptor_proxy.Decrypt("MDIEEPgAAAAAAAAAAAAAAAAAAAE" "wFAYIKoZIhvcNAwcECKajtRg4qFSHBAhv9luFkXgDJA==")); // Test UTF-16 encoding. diff --git a/chrome/browser/importer/firefox_importer_unittest_utils.h b/chrome/browser/importer/firefox_importer_unittest_utils.h index cb53cce..c989bd6 100644 --- a/chrome/browser/importer/firefox_importer_unittest_utils.h +++ b/chrome/browser/importer/firefox_importer_unittest_utils.h @@ -34,7 +34,7 @@ class FFUnitTestDecryptorProxy { // Initialize a decryptor, returns true if the object was // constructed successfully. - bool Setup(std::wstring& nss_path); + bool Setup(const std::wstring& nss_path); // This match the parallel functions in NSSDecryptor. bool DecryptorInit(const std::wstring& dll_path, const std::wstring& db_path); @@ -67,7 +67,7 @@ FFUnitTestDecryptorProxy::FFUnitTestDecryptorProxy() { FFUnitTestDecryptorProxy::~FFUnitTestDecryptorProxy() { } -bool FFUnitTestDecryptorProxy::Setup(std::wstring& /* nss_path */) { +bool FFUnitTestDecryptorProxy::Setup(const std::wstring& /* nss_path */) { return true; } diff --git a/chrome/browser/importer/firefox_importer_unittest_utils_mac.cc b/chrome/browser/importer/firefox_importer_unittest_utils_mac.cc index bfea202..a6757f9 100644 --- a/chrome/browser/importer/firefox_importer_unittest_utils_mac.cc +++ b/chrome/browser/importer/firefox_importer_unittest_utils_mac.cc @@ -123,7 +123,7 @@ FFUnitTestDecryptorProxy::FFUnitTestDecryptorProxy() : child_process_(0) { } -bool FFUnitTestDecryptorProxy::Setup(std::wstring& nss_path) { +bool FFUnitTestDecryptorProxy::Setup(const std::wstring& nss_path) { // Create a new message loop and spawn the child process. message_loop_.reset(new MessageLoopForIO()); diff --git a/chrome/browser/nacl_process_host.cc b/chrome/browser/nacl_process_host.cc index 133f17f..9d7f445 100644 --- a/chrome/browser/nacl_process_host.cc +++ b/chrome/browser/nacl_process_host.cc @@ -116,8 +116,8 @@ bool NaClProcessHost::LaunchSelLdr(ResourceMessageFilter* renderer_msg_filter, // Build command line for nacl. const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess(); - std::wstring exe_path = - browser_command_line.GetSwitchValue(switches::kBrowserSubprocessPath); + FilePath exe_path = + browser_command_line.GetSwitchValuePath(switches::kBrowserSubprocessPath); if (exe_path.empty() && !PathService::Get(base::FILE_EXE, &exe_path)) return false; @@ -125,8 +125,8 @@ bool NaClProcessHost::LaunchSelLdr(ResourceMessageFilter* renderer_msg_filter, if (logging::DialogsAreSuppressed()) cmd_line.AppendSwitch(switches::kNoErrorDialogs); - // propagate the following switches to the plugin command line (along with - // any associated values) if present in the browser command line + // Propagate the following switches to the plugin command line (along with + // any associated values) if present in the browser command line. // TODO(gregoryd): check which flags of those below can be supported. static const char* const switch_names[] = { switches::kNoSandbox, diff --git a/chrome/browser/renderer_host/gtk_key_bindings_handler_unittest.cc b/chrome/browser/renderer_host/gtk_key_bindings_handler_unittest.cc index a6c6753..0f26e1a 100644 --- a/chrome/browser/renderer_host/gtk_key_bindings_handler_unittest.cc +++ b/chrome/browser/renderer_host/gtk_key_bindings_handler_unittest.cc @@ -27,10 +27,10 @@ class GtkKeyBindingsHandlerTest : public testing::Test { GtkKeyBindingsHandlerTest() : window_(gtk_window_new(GTK_WINDOW_TOPLEVEL)), handler_(NULL) { - std::wstring gtkrc; + FilePath gtkrc; PathService::Get(chrome::DIR_TEST_DATA, >krc); - file_util::AppendToPath(>krc, L"gtk_key_bindings_test_gtkrc"); - gtk_rc_parse(WideToUTF8(gtkrc).c_str()); + gtkrc = gtkrc.AppendASCII("gtk_key_bindings_test_gtkrc"); + gtk_rc_parse(gtkrc.value().c_str()); GtkWidget* fixed = gtk_fixed_new(); handler_ = new GtkKeyBindingsHandler(fixed); diff --git a/chrome/browser/user_data_manager.cc b/chrome/browser/user_data_manager.cc index c89abe6..37aa55c 100644 --- a/chrome/browser/user_data_manager.cc +++ b/chrome/browser/user_data_manager.cc @@ -29,6 +29,15 @@ namespace { +// TODO: don't use wstrings in all this code. :( +// But I'm not fixing it right now since this code is reported to be going +// away. +void DeprecatedPathServiceGet(int key, std::wstring* str) { + FilePath path; + PathService::Get(key, &path); + *str = path.ToWStringHack(); +} + // Helper to start chrome for a given profile index. The helper takes care of // enumerating profiles on the file thread and then it launches Chrome for the // appropriate profile on the original thread. @@ -95,7 +104,7 @@ UserDataManager* UserDataManager::instance_ = NULL; UserDataManager* UserDataManager::Create() { DCHECK(!instance_); std::wstring user_data; - PathService::Get(chrome::DIR_USER_DATA, &user_data); + DeprecatedPathServiceGet(chrome::DIR_USER_DATA, &user_data); instance_ = new UserDataManager(user_data); return instance_; } @@ -180,13 +189,13 @@ void UserDataManager::LaunchChromeForProfile( const std::wstring& profile_name) const { std::wstring user_data_dir = GetUserDataFolderForProfile(profile_name); std::wstring command; - PathService::Get(base::FILE_EXE, &command); + DeprecatedPathServiceGet(base::FILE_EXE, &command); CommandLine command_line(command); command_line.AppendSwitch(switches::kEnableUserDataDirProfiles); command_line.AppendSwitchWithValue(switches::kUserDataDir, user_data_dir); std::wstring local_state_path; - PathService::Get(chrome::FILE_LOCAL_STATE, &local_state_path); + DeprecatedPathServiceGet(chrome::FILE_LOCAL_STATE, &local_state_path); command_line.AppendSwitchWithValue(switches::kParentProfile, local_state_path); base::LaunchApp(command_line, false, false, NULL); diff --git a/chrome/browser/zygote_host_linux.cc b/chrome/browser/zygote_host_linux.cc index bd3d099..34159264 100644 --- a/chrome/browser/zygote_host_linux.cc +++ b/chrome/browser/zygote_host_linux.cc @@ -46,7 +46,7 @@ static void SaveSUIDUnsafeEnvironmentVariables() { } ZygoteHost::ZygoteHost() { - std::wstring chrome_path; + FilePath chrome_path; CHECK(PathService::Get(base::FILE_EXE, &chrome_path)); CommandLine cmd_line(chrome_path); diff --git a/chrome/test/ui/ui_test.cc b/chrome/test/ui/ui_test.cc index cc53886..4f18195 100644 --- a/chrome/test/ui/ui_test.cc +++ b/chrome/test/ui/ui_test.cc @@ -644,10 +644,9 @@ DictionaryValue* UITest::GetLocalState() { } DictionaryValue* UITest::GetDefaultProfilePreferences() { - std::wstring path_wstring; - PathService::Get(chrome::DIR_USER_DATA, &path_wstring); - file_util::AppendToPath(&path_wstring, chrome::kNotSignedInProfile); - FilePath path(FilePath::FromWStringHack(path_wstring)); + FilePath path; + PathService::Get(chrome::DIR_USER_DATA, &path); + path = path.AppendASCII(WideToASCII(chrome::kNotSignedInProfile)); return LoadDictionaryValueFromPath(path.Append(chrome::kPreferencesFilename)); } diff --git a/webkit/glue/plugins/plugin_list_win.cc b/webkit/glue/plugins/plugin_list_win.cc index 9576238..bdf4b07 100644 --- a/webkit/glue/plugins/plugin_list_win.cc +++ b/webkit/glue/plugins/plugin_list_win.cc @@ -121,10 +121,12 @@ void GetFirefoxDirectory(std::set<FilePath>* plugin_dirs) { GetPluginsInRegistryDirectory( HKEY_LOCAL_MACHINE, kRegistryMozillaPlugins, plugin_dirs); - std::wstring firefox_app_data_plugin_path; + FilePath firefox_app_data_plugin_path; if (PathService::Get(base::DIR_APP_DATA, &firefox_app_data_plugin_path)) { - firefox_app_data_plugin_path += L"\\Mozilla\\plugins"; - plugin_dirs->insert(FilePath(firefox_app_data_plugin_path)); + firefox_app_data_plugin_path = + firefox_app_data_plugin_path.AppendASCII("Mozilla") + .AppendASCII("plugins"); + plugin_dirs->insert(firefox_app_data_plugin_path); } } |