summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
authorthestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-09 20:00:13 +0000
committerthestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-09 20:00:13 +0000
commitef5ff1b40f1024d834620f5cede62dfd4aea6e0c (patch)
tree3935dae6b7f1ab45c01bc8f66d6bfee7338d9a9a /chrome/browser
parent0bbb1b1f9842366babce756ab2f1713832be63de (diff)
downloadchromium_src-ef5ff1b40f1024d834620f5cede62dfd4aea6e0c.zip
chromium_src-ef5ff1b40f1024d834620f5cede62dfd4aea6e0c.tar.gz
chromium_src-ef5ff1b40f1024d834620f5cede62dfd4aea6e0c.tar.bz2
Fix to use FilePath version of PathService::Get.
BUG=None TEST=None Original Review URL: http://codereview.chromium.org/174189 Patch from Thiago Farina <thiago.farina@gmail.com>. Review URL: http://codereview.chromium.org/193047 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@25778 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/blocked_popup_container_interactive_uitest.cc16
-rw-r--r--chrome/browser/dom_ui/chrome_url_data_manager.cc2
-rw-r--r--chrome/browser/importer/safari_importer_unittest.mm7
-rw-r--r--chrome/browser/process_singleton_win.cc5
-rw-r--r--chrome/browser/rlz/rlz.cc11
-rw-r--r--chrome/browser/safe_browsing/safe_browsing_database_unittest.cc16
-rw-r--r--chrome/browser/search_engines/template_url_parser_unittest.cc26
7 files changed, 40 insertions, 43 deletions
diff --git a/chrome/browser/blocked_popup_container_interactive_uitest.cc b/chrome/browser/blocked_popup_container_interactive_uitest.cc
index 57cb771..c43be7d 100644
--- a/chrome/browser/blocked_popup_container_interactive_uitest.cc
+++ b/chrome/browser/blocked_popup_container_interactive_uitest.cc
@@ -37,10 +37,10 @@ class BlockedPopupContainerInteractiveTest : public UITest {
ASSERT_TRUE(tab_.get());
}
- void NavigateMainTabTo(const std::wstring& file_name) {
+ void NavigateMainTabTo(const std::string& file_name) {
FilePath filename(test_data_directory_);
filename = filename.AppendASCII("constrained_files");
- filename = filename.Append(FilePath::FromWStringHack(file_name));
+ filename = filename.AppendASCII(file_name);
ASSERT_TRUE(tab_->NavigateToURL(net::FilePathToFileURL(filename)));
}
@@ -62,7 +62,7 @@ class BlockedPopupContainerInteractiveTest : public UITest {
};
TEST_F(BlockedPopupContainerInteractiveTest, TestOpenAndResizeTo) {
- NavigateMainTabTo(L"constrained_window_onload_resizeto.html");
+ NavigateMainTabTo("constrained_window_onload_resizeto.html");
SimulateClickInCenterOf(window_);
ASSERT_TRUE(automation()->WaitForWindowCountToBecome(2, 1000));
@@ -140,7 +140,7 @@ bool ParseCountOutOfTitle(const std::wstring& title, int* output) {
// Tests that in the window.open() equivalent of a fork bomb, we stop building
// windows.
TEST_F(BlockedPopupContainerInteractiveTest, DontSpawnEndlessPopups) {
- NavigateMainTabTo(L"infinite_popups.html");
+ NavigateMainTabTo("infinite_popups.html");
SimulateClickInCenterOf(window_);
ASSERT_TRUE(automation()->WaitForWindowCountToBecome(2, 1000));
@@ -183,7 +183,7 @@ TEST_F(BlockedPopupContainerInteractiveTest, DontSpawnEndlessPopups) {
// Make sure that we refuse to close windows when a constrained popup is
// displayed.
TEST_F(BlockedPopupContainerInteractiveTest, WindowOpenWindowClosePopup) {
- NavigateMainTabTo(L"openclose_main.html");
+ NavigateMainTabTo("openclose_main.html");
SimulateClickInCenterOf(window_);
ASSERT_TRUE(automation()->WaitForWindowCountToBecome(2, 5000));
@@ -202,7 +202,7 @@ TEST_F(BlockedPopupContainerInteractiveTest, WindowOpenWindowClosePopup) {
}
TEST_F(BlockedPopupContainerInteractiveTest, BlockAlertFromBlockedPopup) {
- NavigateMainTabTo(L"block_alert.html");
+ NavigateMainTabTo("block_alert.html");
// Wait for there to be an app modal dialog (and fail if it's shown).
ASSERT_FALSE(automation()->WaitForAppModalDialog(4000));
@@ -219,7 +219,7 @@ TEST_F(BlockedPopupContainerInteractiveTest, BlockAlertFromBlockedPopup) {
}
TEST_F(BlockedPopupContainerInteractiveTest, ShowAlertFromNormalPopup) {
- NavigateMainTabTo(L"show_alert.html");
+ NavigateMainTabTo("show_alert.html");
SimulateClickInCenterOf(window_);
ASSERT_TRUE(automation()->WaitForWindowCountToBecome(2, 5000));
@@ -246,7 +246,7 @@ TEST_F(BlockedPopupContainerInteractiveTest, ShowAlertFromNormalPopup) {
// Make sure that window focus works while creating a popup window so that we
// don't
TEST_F(BlockedPopupContainerInteractiveTest, DontBreakOnBlur) {
- NavigateMainTabTo(L"window_blur_test.html");
+ NavigateMainTabTo("window_blur_test.html");
SimulateClickInCenterOf(window_);
// Wait for the popup window to open.
diff --git a/chrome/browser/dom_ui/chrome_url_data_manager.cc b/chrome/browser/dom_ui/chrome_url_data_manager.cc
index 4e3bd43..c3ef325 100644
--- a/chrome/browser/dom_ui/chrome_url_data_manager.cc
+++ b/chrome/browser/dom_ui/chrome_url_data_manager.cc
@@ -116,7 +116,7 @@ void RegisterURLRequestChromeJob() {
}
void UnregisterURLRequestChromeJob() {
- std::wstring inspector_dir;
+ FilePath inspector_dir;
if (PathService::Get(chrome::DIR_INSPECTOR, &inspector_dir)) {
chrome_url_data_manager.RemoveFileSource("inspector");
chrome_url_data_manager.RemoveFileSource(chrome::kChromeUIDevToolsHost);
diff --git a/chrome/browser/importer/safari_importer_unittest.mm b/chrome/browser/importer/safari_importer_unittest.mm
index 78b4f65..94d2517 100644
--- a/chrome/browser/importer/safari_importer_unittest.mm
+++ b/chrome/browser/importer/safari_importer_unittest.mm
@@ -17,12 +17,11 @@
// structure as ~/Library in the Chrome test data directory.
// This function returns the path to that directory.
FilePath GetTestSafariLibraryPath() {
- std::wstring test_dir_wstring;
- PathService::Get(chrome::DIR_TEST_DATA, &test_dir_wstring);
- FilePath test_dir = FilePath::FromWStringHack(test_dir_wstring);
+ FilePath test_dir;
+ PathService::Get(chrome::DIR_TEST_DATA, &test_dir);
// Our simulated ~/Library directory
- test_dir = test_dir.Append("safari_import");
+ test_dir = test_dir.AppendASCII("safari_import");
return test_dir;
}
diff --git a/chrome/browser/process_singleton_win.cc b/chrome/browser/process_singleton_win.cc
index 3c48bb8..bf048aa 100644
--- a/chrome/browser/process_singleton_win.cc
+++ b/chrome/browser/process_singleton_win.cc
@@ -145,12 +145,13 @@ void ProcessSingleton::Create() {
ATOM clazz = RegisterClassEx(&wc);
DCHECK(clazz);
- std::wstring user_data_dir;
+ FilePath user_data_dir;
PathService::Get(chrome::DIR_USER_DATA, &user_data_dir);
// Set the window's title to the path of our user data directory so other
// Chrome instances can decide if they should forward to us or not.
- window_ = CreateWindow(chrome::kMessageWindowClass, user_data_dir.c_str(),
+ window_ = CreateWindow(chrome::kMessageWindowClass,
+ user_data_dir.value().c_str(),
0, 0, 0, 0, 0, HWND_MESSAGE, 0, hinst, 0);
DCHECK(window_);
diff --git a/chrome/browser/rlz/rlz.cc b/chrome/browser/rlz/rlz.cc
index a280be2..620dd2c 100644
--- a/chrome/browser/rlz/rlz.cc
+++ b/chrome/browser/rlz/rlz.cc
@@ -80,11 +80,11 @@ FuncT WireExport(HMODULE module, const char* export_name) {
}
HMODULE LoadRLZLibraryInternal(int directory_key) {
- std::wstring rlz_path;
+ FilePath rlz_path;
if (!PathService::Get(directory_key, &rlz_path))
return NULL;
- file_util::AppendToPath(&rlz_path, L"rlz.dll");
- return ::LoadLibraryW(rlz_path.c_str());
+ rlz_path = rlz_path.AppendASCII("rlz.dll");
+ return ::LoadLibraryW(rlz_path.value().c_str());
}
bool LoadRLZLibrary(int directory_key) {
@@ -261,12 +261,11 @@ class DelayedInitTask : public Task {
bool IsGoogleDefaultSearch() {
if (!g_browser_process)
return false;
- std::wstring user_data_dir;
+ FilePath user_data_dir;
if (!PathService::Get(chrome::DIR_USER_DATA, &user_data_dir))
return false;
ProfileManager* profile_manager = g_browser_process->profile_manager();
- Profile* profile = profile_manager->
- GetDefaultProfile(FilePath::FromWStringHack(user_data_dir));
+ Profile* profile = profile_manager->GetDefaultProfile(user_data_dir);
if (!profile)
return false;
const TemplateURL* url_template =
diff --git a/chrome/browser/safe_browsing/safe_browsing_database_unittest.cc b/chrome/browser/safe_browsing/safe_browsing_database_unittest.cc
index 5c4871a..4542b5c 100644
--- a/chrome/browser/safe_browsing/safe_browsing_database_unittest.cc
+++ b/chrome/browser/safe_browsing/safe_browsing_database_unittest.cc
@@ -1038,7 +1038,7 @@ void PrintStat(const char* name) {
LOG(INFO) << StringPrintf("%s %d", name, value);
}
-std::wstring GetFullSBDataPath(const std::wstring& path) {
+FilePath GetFullSBDataPath(const std::wstring& path) {
FilePath full_path;
CHECK(PathService::Get(base::DIR_SOURCE_ROOT, &full_path));
full_path = full_path.AppendASCII("chrome");
@@ -1047,7 +1047,7 @@ std::wstring GetFullSBDataPath(const std::wstring& path) {
full_path = full_path.AppendASCII("safe_browsing");
full_path = full_path.Append(FilePath::FromWStringHack(path));
CHECK(file_util::PathExists(full_path));
- return full_path.ToWStringHack();
+ return full_path;
}
struct ChunksInfo {
@@ -1070,9 +1070,8 @@ void PeformUpdate(const std::wstring& initial_db,
file_util::Delete(path, false);
if (!initial_db.empty()) {
- std::wstring full_initial_db = GetFullSBDataPath(initial_db);
- ASSERT_TRUE(file_util::CopyFile(
- FilePath::FromWStringHack(full_initial_db), path));
+ FilePath full_initial_db = GetFullSBDataPath(initial_db);
+ ASSERT_TRUE(file_util::CopyFile(full_initial_db, path));
}
SafeBrowsingDatabase* database = SafeBrowsingDatabase::Create();
@@ -1129,9 +1128,8 @@ void UpdateDatabase(const std::wstring& initial_db,
SafeBrowsingProtocolParser parser;
if (!updates_path.empty()) {
- std::wstring data_dir = GetFullSBDataPath(updates_path);
- file_util::FileEnumerator file_enum(
- FilePath::FromWStringHack(data_dir), false,
+ FilePath data_dir = GetFullSBDataPath(updates_path);
+ file_util::FileEnumerator file_enum(data_dir, false,
file_util::FileEnumerator::FILES);
while (true) {
std::wstring file = file_enum.Next().ToWStringHack();
@@ -1166,7 +1164,7 @@ void UpdateDatabase(const std::wstring& initial_db,
std::vector<SBChunkDelete>* deletes = new std::vector<SBChunkDelete>;
if (!response_path.empty()) {
std::string update;
- std::wstring full_response_path = GetFullSBDataPath(response_path);
+ FilePath full_response_path = GetFullSBDataPath(response_path);
if (file_util::ReadFileToString(full_response_path, &update)) {
int next_update;
bool result, rekey, reset;
diff --git a/chrome/browser/search_engines/template_url_parser_unittest.cc b/chrome/browser/search_engines/template_url_parser_unittest.cc
index 77c794c..18dcad2 100644
--- a/chrome/browser/search_engines/template_url_parser_unittest.cc
+++ b/chrome/browser/search_engines/template_url_parser_unittest.cc
@@ -33,13 +33,13 @@ class TemplateURLParserTest : public testing::Test {
// the data dir). The TemplateURL is placed in template_url_.
// The result of Parse is stored in the field parse_result_ (this doesn't
// use a return value due to internally using ASSERT_).
- void ParseFile(const std::wstring& file_name,
+ void ParseFile(const std::string& file_name,
TemplateURLParser::ParameterFilter* filter) {
FilePath full_path;
parse_result_ = false;
ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &full_path));
full_path = full_path.AppendASCII("osdd");
- full_path = full_path.Append(FilePath::FromWStringHack(file_name));
+ full_path = full_path.AppendASCII(file_name);
ASSERT_TRUE(file_util::PathExists(full_path));
std::string contents;
@@ -61,28 +61,28 @@ class TemplateURLParserTest : public testing::Test {
TEST_F(TemplateURLParserTest, FailOnBogusURL) {
if (IsDisabled())
return;
- ParseFile(L"bogus.xml", NULL);
+ ParseFile("bogus.xml", NULL);
EXPECT_FALSE(parse_result_);
}
TEST_F(TemplateURLParserTest, PassOnHTTPS) {
if (IsDisabled())
return;
- ParseFile(L"https.xml", NULL);
+ ParseFile("https.xml", NULL);
EXPECT_TRUE(parse_result_);
}
TEST_F(TemplateURLParserTest, FailOnPost) {
if (IsDisabled())
return;
- ParseFile(L"post.xml", NULL);
+ ParseFile("post.xml", NULL);
EXPECT_FALSE(parse_result_);
}
TEST_F(TemplateURLParserTest, TestDictionary) {
if (IsDisabled())
return;
- ParseFile(L"dictionary.xml", NULL);
+ ParseFile("dictionary.xml", NULL);
ASSERT_TRUE(parse_result_);
EXPECT_EQ(L"Dictionary.com", template_url_.short_name());
EXPECT_TRUE(template_url_.GetFavIconURL() ==
@@ -96,7 +96,7 @@ TEST_F(TemplateURLParserTest, TestDictionary) {
TEST_F(TemplateURLParserTest, TestMSDN) {
if (IsDisabled())
return;
- ParseFile(L"msdn.xml", NULL);
+ ParseFile("msdn.xml", NULL);
ASSERT_TRUE(parse_result_);
EXPECT_EQ(L"Search \" MSDN", template_url_.short_name());
EXPECT_TRUE(template_url_.GetFavIconURL() ==
@@ -110,7 +110,7 @@ TEST_F(TemplateURLParserTest, TestMSDN) {
TEST_F(TemplateURLParserTest, TestWikipedia) {
if (IsDisabled())
return;
- ParseFile(L"wikipedia.xml", NULL);
+ ParseFile("wikipedia.xml", NULL);
ASSERT_TRUE(parse_result_);
EXPECT_EQ(L"Wikipedia (English)", template_url_.short_name());
EXPECT_TRUE(template_url_.GetFavIconURL() ==
@@ -131,7 +131,7 @@ TEST_F(TemplateURLParserTest, TestWikipedia) {
TEST_F(TemplateURLParserTest, NoCrashOnEmptyAttributes) {
if (IsDisabled())
return;
- ParseFile(L"url_with_no_attributes.xml", NULL);
+ ParseFile("url_with_no_attributes.xml", NULL);
}
// Filters any param which as an occurrence of name_str_ in its name or an
@@ -161,7 +161,7 @@ TEST_F(TemplateURLParserTest, TestFirefoxEbay) {
// This file uses the Parameter extension
// (see http://www.opensearch.org/Specifications/OpenSearch/Extensions/Parameter/1.0)
ParamFilterImpl filter("ebay", "ebay");
- ParseFile(L"firefox_ebay.xml", &filter);
+ ParseFile("firefox_ebay.xml", &filter);
ASSERT_TRUE(parse_result_);
EXPECT_EQ(L"eBay", template_url_.short_name());
EXPECT_TRUE(template_url_.url() != NULL);
@@ -182,7 +182,7 @@ TEST_F(TemplateURLParserTest, TestFirefoxWebster) {
return;
// This XML file uses a namespace.
ParamFilterImpl filter("", "Mozilla");
- ParseFile(L"firefox_webster.xml", &filter);
+ ParseFile("firefox_webster.xml", &filter);
ASSERT_TRUE(parse_result_);
EXPECT_EQ(L"Webster", template_url_.short_name());
EXPECT_TRUE(template_url_.url() != NULL);
@@ -200,7 +200,7 @@ TEST_F(TemplateURLParserTest, TestFirefoxYahoo) {
return;
// This XML file uses a namespace.
ParamFilterImpl filter("", "Mozilla");
- ParseFile(L"firefox_yahoo.xml", &filter);
+ ParseFile("firefox_yahoo.xml", &filter);
ASSERT_TRUE(parse_result_);
EXPECT_EQ(L"Yahoo", template_url_.short_name());
EXPECT_TRUE(template_url_.url() != NULL);
@@ -223,7 +223,7 @@ TEST_F(TemplateURLParserTest, TestPostSuggestion) {
return;
// This XML file uses a namespace.
ParamFilterImpl filter("", "Mozilla");
- ParseFile(L"post_suggestion.xml", &filter);
+ ParseFile("post_suggestion.xml", &filter);
ASSERT_TRUE(parse_result_);
EXPECT_EQ(L"Yahoo", template_url_.short_name());
EXPECT_TRUE(template_url_.url() != NULL);