diff options
965 files changed, 6831 insertions, 6390 deletions
diff --git a/chrome/browser/android/crash_dump_manager.cc b/chrome/browser/android/crash_dump_manager.cc index f079c51..fa85fd3 100644 --- a/chrome/browser/android/crash_dump_manager.cc +++ b/chrome/browser/android/crash_dump_manager.cc @@ -59,7 +59,7 @@ CrashDumpManager::~CrashDumpManager() { int CrashDumpManager::CreateMinidumpFile(int child_process_id) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::PROCESS_LAUNCHER)); - FilePath minidump_path; + base::FilePath minidump_path; if (!file_util::CreateTemporaryFile(&minidump_path)) return base::kInvalidPlatformFileValue; @@ -83,7 +83,7 @@ int CrashDumpManager::CreateMinidumpFile(int child_process_id) { return minidump_file; } -void CrashDumpManager::ProcessMinidump(const FilePath& minidump_path, +void CrashDumpManager::ProcessMinidump(const base::FilePath& minidump_path, base::ProcessHandle pid) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); int64 file_size = 0; @@ -101,7 +101,7 @@ void CrashDumpManager::ProcessMinidump(const FilePath& minidump_path, // We are dealing with a valid minidump. Copy it to the crash report // directory from where Java code will upload it later on. - FilePath crash_dump_dir; + base::FilePath crash_dump_dir; r = PathService::Get(chrome::DIR_CRASH_DUMPS, &crash_dump_dir); if (!r) { NOTREACHED() << "Failed to retrieve the crash dump directory."; @@ -112,7 +112,7 @@ void CrashDumpManager::ProcessMinidump(const FilePath& minidump_path, const std::string filename = base::StringPrintf("chromium-renderer-minidump-%016" PRIx64 ".dmp%d", rand, pid); - FilePath dest_path = crash_dump_dir.Append(filename); + base::FilePath dest_path = crash_dump_dir.Append(filename); r = file_util::Move(minidump_path, dest_path); if (!r) { LOG(ERROR) << "Failed to move crash dump from " << minidump_path.value() @@ -153,7 +153,7 @@ void CrashDumpManager::Observe(int type, NOTREACHED(); return; } - FilePath minidump_path; + base::FilePath minidump_path; { base::AutoLock auto_lock(child_process_id_to_minidump_path_lock_); ChildProcessIDToMinidumpPath::iterator iter = diff --git a/chrome/browser/android/crash_dump_manager.h b/chrome/browser/android/crash_dump_manager.h index 9587614..6cfe497 100644 --- a/chrome/browser/android/crash_dump_manager.h +++ b/chrome/browser/android/crash_dump_manager.h @@ -45,9 +45,9 @@ class CrashDumpManager : public content::NotificationObserver { // Should be created on the UI thread. CrashDumpManager(); - typedef std::map<int, FilePath> ChildProcessIDToMinidumpPath; + typedef std::map<int, base::FilePath> ChildProcessIDToMinidumpPath; - static void ProcessMinidump(const FilePath& minidump_path, + static void ProcessMinidump(const base::FilePath& minidump_path, base::ProcessHandle pid); // NotificationObserver implementation: diff --git a/chrome/browser/android/dev_tools_server.cc b/chrome/browser/android/dev_tools_server.cc index fc83de3..2dce4ea 100644 --- a/chrome/browser/android/dev_tools_server.cc +++ b/chrome/browser/android/dev_tools_server.cc @@ -56,8 +56,8 @@ class DevToolsServerDelegate : public content::DevToolsHttpHandlerDelegate { return use_bundled_frontend_resources_; } - virtual FilePath GetDebugFrontendDir() { - return FilePath(); + virtual base::FilePath GetDebugFrontendDir() { + return base::FilePath(); } virtual std::string GetPageThumbnailData(const GURL& url) { diff --git a/chrome/browser/app_controller_mac.mm b/chrome/browser/app_controller_mac.mm index 6e23eae..175fcaf 100644 --- a/chrome/browser/app_controller_mac.mm +++ b/chrome/browser/app_controller_mac.mm @@ -157,7 +157,7 @@ void RecordLastRunAppBundlePath() { // real, user-visible app bundle directory. (The alternatives give either the // framework's path or the initial app's path, which may be an app mode shim // or a unit test.) - FilePath appBundlePath = + base::FilePath appBundlePath = chrome::GetVersionedDirectory().DirName().DirName().DirName(); CFPreferencesSetAppValue( base::mac::NSToCFCast(app_mode::kLastRunAppBundlePathPrefsKey), @@ -1022,7 +1022,7 @@ void RecordLastRunAppBundlePath() { int return_code; StartupBrowserCreator browser_creator; browser_creator.LaunchBrowser( - command_line, [self lastProfile], FilePath(), + command_line, [self lastProfile], base::FilePath(), chrome::startup::IS_NOT_PROCESS_STARTUP, chrome::startup::IS_NOT_FIRST_RUN, &return_code); } @@ -1126,7 +1126,7 @@ void RecordLastRunAppBundlePath() { CommandLine dummy(CommandLine::NO_PROGRAM); chrome::startup::IsFirstRun first_run = first_run::IsChromeFirstRun() ? chrome::startup::IS_FIRST_RUN : chrome::startup::IS_NOT_FIRST_RUN; - StartupBrowserCreatorImpl launch(FilePath(), dummy, first_run); + StartupBrowserCreatorImpl launch(base::FilePath(), dummy, first_run); launch.OpenURLsInBrowser(browser, false, urls); } @@ -1151,7 +1151,7 @@ void RecordLastRunAppBundlePath() { stringValue]; ProfileManager* profileManager = g_browser_process->profile_manager(); - FilePath path = FilePath(base::SysNSStringToUTF8(profileDir)); + base::FilePath path = base::FilePath(base::SysNSStringToUTF8(profileDir)); path = profileManager->user_data_dir().Append(path); Profile* profile = profileManager->GetProfile(path); if (!profile) { @@ -1192,7 +1192,7 @@ void RecordLastRunAppBundlePath() { string16 printTicket16 = base::SysNSStringToUTF16(printTicket); print_dialog_cloud::CreatePrintDialogForFile( ProfileManager::GetDefaultProfile(), NULL, - FilePath([inputPath UTF8String]), title16, + base::FilePath([inputPath UTF8String]), title16, printTicket16, [mime UTF8String], /*delete_on_close=*/false); } } @@ -1201,7 +1201,8 @@ void RecordLastRunAppBundlePath() { openFiles:(NSArray*)filenames { std::vector<GURL> gurlVector; for (NSString* file in filenames) { - GURL gurl = net::FilePathToFileURL(FilePath(base::SysNSStringToUTF8(file))); + GURL gurl = + net::FilePathToFileURL(base::FilePath(base::SysNSStringToUTF8(file))); gurlVector.push_back(gurl); } if (!gurlVector.empty()) diff --git a/chrome/browser/autofill/autofill_browsertest.cc b/chrome/browser/autofill/autofill_browsertest.cc index 908fa6b..c5c8824 100644 --- a/chrome/browser/autofill/autofill_browsertest.cc +++ b/chrome/browser/autofill/autofill_browsertest.cc @@ -255,8 +255,9 @@ class AutofillTest : public InProcessBrowserTest { CHECK(test_server()->Start()); std::string data; - FilePath data_file = ui_test_utils::GetTestFilePath( - FilePath().AppendASCII("autofill"), FilePath().AppendASCII(filename)); + base::FilePath data_file = + ui_test_utils::GetTestFilePath(base::FilePath().AppendASCII("autofill"), + base::FilePath().AppendASCII(filename)); CHECK(file_util::ReadFileToString(data_file, &data)); std::vector<std::string> lines; base::SplitString(data, '\n', &lines); diff --git a/chrome/browser/autofill/autofill_merge_unittest.cc b/chrome/browser/autofill/autofill_merge_unittest.cc index e4818c4..f6ac625 100644 --- a/chrome/browser/autofill/autofill_merge_unittest.cc +++ b/chrome/browser/autofill/autofill_merge_unittest.cc @@ -20,8 +20,8 @@ namespace { -const FilePath::CharType kTestName[] = FILE_PATH_LITERAL("merge"); -const FilePath::CharType kFileNamePattern[] = FILE_PATH_LITERAL("*.in"); +const base::FilePath::CharType kTestName[] = FILE_PATH_LITERAL("merge"); +const base::FilePath::CharType kFileNamePattern[] = FILE_PATH_LITERAL("*.in"); const char kFieldSeparator[] = ": "; const char kProfileSeparator[] = "---"; diff --git a/chrome/browser/autofill/data_driven_test.cc b/chrome/browser/autofill/data_driven_test.cc index cb47c1e..81111af 100644 --- a/chrome/browser/autofill/data_driven_test.cc +++ b/chrome/browser/autofill/data_driven_test.cc @@ -14,7 +14,7 @@ namespace { // Reads |file| into |content|, and converts Windows line-endings to Unix ones. // Returns true on success. -bool ReadFile(const FilePath& file, std::string* content) { +bool ReadFile(const base::FilePath& file, std::string* content) { if (!file_util::ReadFileToString(file, content)) return false; @@ -23,7 +23,7 @@ bool ReadFile(const FilePath& file, std::string* content) { } // Write |content| to |file|. Returns true on success. -bool WriteFile(const FilePath& file, const std::string& content) { +bool WriteFile(const base::FilePath& file, const std::string& content) { int write_size = file_util::WriteFile(file, content.c_str(), content.length()); return write_size == static_cast<int>(content.length()); @@ -32,15 +32,15 @@ bool WriteFile(const FilePath& file, const std::string& content) { } // namespace void DataDrivenTest::RunDataDrivenTest( - const FilePath& input_directory, - const FilePath& output_directory, - const FilePath::StringType& file_name_pattern) { + const base::FilePath& input_directory, + const base::FilePath& output_directory, + const base::FilePath::StringType& file_name_pattern) { file_util::FileEnumerator input_files(input_directory, false, file_util::FileEnumerator::FILES, file_name_pattern); - for (FilePath input_file = input_files.Next(); + for (base::FilePath input_file = input_files.Next(); !input_file.empty(); input_file = input_files.Next()) { SCOPED_TRACE(input_file.BaseName().value()); @@ -51,7 +51,7 @@ void DataDrivenTest::RunDataDrivenTest( std::string output; GenerateResults(input, &output); - FilePath output_file = output_directory.Append( + base::FilePath output_file = output_directory.Append( input_file.BaseName().StripTrailingSeparators().ReplaceExtension( FILE_PATH_LITERAL(".out"))); @@ -63,9 +63,9 @@ void DataDrivenTest::RunDataDrivenTest( } } -FilePath DataDrivenTest::GetInputDirectory( - const FilePath::StringType& test_name) { - FilePath test_data_dir_; +base::FilePath DataDrivenTest::GetInputDirectory( + const base::FilePath::StringType& test_name) { + base::FilePath test_data_dir_; PathService::Get(chrome::DIR_TEST_DATA, &test_data_dir_); test_data_dir_ = test_data_dir_.AppendASCII("autofill") .Append(test_name) @@ -73,9 +73,9 @@ FilePath DataDrivenTest::GetInputDirectory( return test_data_dir_; } -FilePath DataDrivenTest::GetOutputDirectory( - const FilePath::StringType& test_name) { - FilePath test_data_dir_; +base::FilePath DataDrivenTest::GetOutputDirectory( + const base::FilePath::StringType& test_name) { + base::FilePath test_data_dir_; PathService::Get(chrome::DIR_TEST_DATA, &test_data_dir_); test_data_dir_ = test_data_dir_.AppendASCII("autofill") .Append(test_name) diff --git a/chrome/browser/autofill/data_driven_test.h b/chrome/browser/autofill/data_driven_test.h index 9b87545..23f0483 100644 --- a/chrome/browser/autofill/data_driven_test.h +++ b/chrome/browser/autofill/data_driven_test.h @@ -22,9 +22,9 @@ class DataDrivenTest { // |GenerateResults()|. If the corresponding output file already exists in // the |output_directory|, verifies that the results match the file contents; // otherwise, writes a gold result file to the |output_directory|. - void RunDataDrivenTest(const FilePath& input_directory, - const FilePath& output_directory, - const FilePath::StringType& file_name_pattern); + void RunDataDrivenTest(const base::FilePath& input_directory, + const base::FilePath& output_directory, + const base::FilePath::StringType& file_name_pattern); // Given the |input| data, generates the |output| results. The output results // must be stable across runs. @@ -33,10 +33,11 @@ class DataDrivenTest { virtual void GenerateResults(const std::string& input, std::string* output) = 0; - // Return |FilePath|s to the test input and output subdirectories + // Return |base::FilePath|s to the test input and output subdirectories // ../autofill/|test_name|/input and ../autofill/|test_name|/output. - FilePath GetInputDirectory(const FilePath::StringType& test_name); - FilePath GetOutputDirectory(const FilePath::StringType& test_name); + base::FilePath GetInputDirectory(const base::FilePath::StringType& test_name); + base::FilePath GetOutputDirectory( + const base::FilePath::StringType& test_name); protected: DataDrivenTest(); diff --git a/chrome/browser/autofill/form_structure_browsertest.cc b/chrome/browser/autofill/form_structure_browsertest.cc index d89e3f0..1d042dc 100644 --- a/chrome/browser/autofill/form_structure_browsertest.cc +++ b/chrome/browser/autofill/form_structure_browsertest.cc @@ -20,7 +20,7 @@ namespace { -const FilePath::CharType kTestName[] = FILE_PATH_LITERAL("heuristics"); +const base::FilePath::CharType kTestName[] = FILE_PATH_LITERAL("heuristics"); // Convert the |html| snippet to a data URI. GURL HTMLToDataURI(const std::string& html) { @@ -104,14 +104,16 @@ std::string FormStructureBrowserTest::FormStructuresToString( #define MAYBE_DataDrivenHeuristics(n) DataDrivenHeuristics##n #endif IN_PROC_BROWSER_TEST_F(FormStructureBrowserTest, DataDrivenHeuristics00) { - const FilePath::CharType kFileNamePattern[] = FILE_PATH_LITERAL("00_*.html"); + const base::FilePath::CharType kFileNamePattern[] = + FILE_PATH_LITERAL("00_*.html"); RunDataDrivenTest(GetInputDirectory(kTestName), GetOutputDirectory(kTestName), kFileNamePattern); } IN_PROC_BROWSER_TEST_F(FormStructureBrowserTest, DataDrivenHeuristics01) { - const FilePath::CharType kFileNamePattern[] = FILE_PATH_LITERAL("01_*.html"); + const base::FilePath::CharType kFileNamePattern[] = + FILE_PATH_LITERAL("01_*.html"); RunDataDrivenTest(GetInputDirectory(kTestName), GetOutputDirectory(kTestName), kFileNamePattern); @@ -119,7 +121,8 @@ IN_PROC_BROWSER_TEST_F(FormStructureBrowserTest, DataDrivenHeuristics01) { IN_PROC_BROWSER_TEST_F(FormStructureBrowserTest, MAYBE_DataDrivenHeuristics(02)) { - const FilePath::CharType kFileNamePattern[] = FILE_PATH_LITERAL("02_*.html"); + const base::FilePath::CharType kFileNamePattern[] = + FILE_PATH_LITERAL("02_*.html"); RunDataDrivenTest(GetInputDirectory(kTestName), GetOutputDirectory(kTestName), kFileNamePattern); @@ -127,7 +130,8 @@ IN_PROC_BROWSER_TEST_F(FormStructureBrowserTest, IN_PROC_BROWSER_TEST_F(FormStructureBrowserTest, MAYBE_DataDrivenHeuristics(03)) { - const FilePath::CharType kFileNamePattern[] = FILE_PATH_LITERAL("03_*.html"); + const base::FilePath::CharType kFileNamePattern[] = + FILE_PATH_LITERAL("03_*.html"); RunDataDrivenTest(GetInputDirectory(kTestName), GetOutputDirectory(kTestName), kFileNamePattern); @@ -135,7 +139,8 @@ IN_PROC_BROWSER_TEST_F(FormStructureBrowserTest, IN_PROC_BROWSER_TEST_F(FormStructureBrowserTest, MAYBE_DataDrivenHeuristics(04)) { - const FilePath::CharType kFileNamePattern[] = FILE_PATH_LITERAL("04_*.html"); + const base::FilePath::CharType kFileNamePattern[] = + FILE_PATH_LITERAL("04_*.html"); RunDataDrivenTest(GetInputDirectory(kTestName), GetOutputDirectory(kTestName), kFileNamePattern); @@ -143,7 +148,8 @@ IN_PROC_BROWSER_TEST_F(FormStructureBrowserTest, IN_PROC_BROWSER_TEST_F(FormStructureBrowserTest, MAYBE_DataDrivenHeuristics(05)) { - const FilePath::CharType kFileNamePattern[] = FILE_PATH_LITERAL("05_*.html"); + const base::FilePath::CharType kFileNamePattern[] = + FILE_PATH_LITERAL("05_*.html"); RunDataDrivenTest(GetInputDirectory(kTestName), GetOutputDirectory(kTestName), kFileNamePattern); @@ -151,7 +157,8 @@ IN_PROC_BROWSER_TEST_F(FormStructureBrowserTest, IN_PROC_BROWSER_TEST_F(FormStructureBrowserTest, MAYBE_DataDrivenHeuristics(06)) { - const FilePath::CharType kFileNamePattern[] = FILE_PATH_LITERAL("06_*.html"); + const base::FilePath::CharType kFileNamePattern[] = + FILE_PATH_LITERAL("06_*.html"); RunDataDrivenTest(GetInputDirectory(kTestName), GetOutputDirectory(kTestName), kFileNamePattern); @@ -159,7 +166,8 @@ IN_PROC_BROWSER_TEST_F(FormStructureBrowserTest, IN_PROC_BROWSER_TEST_F(FormStructureBrowserTest, MAYBE_DataDrivenHeuristics(07)) { - const FilePath::CharType kFileNamePattern[] = FILE_PATH_LITERAL("07_*.html"); + const base::FilePath::CharType kFileNamePattern[] = + FILE_PATH_LITERAL("07_*.html"); RunDataDrivenTest(GetInputDirectory(kTestName), GetOutputDirectory(kTestName), kFileNamePattern); @@ -167,7 +175,8 @@ IN_PROC_BROWSER_TEST_F(FormStructureBrowserTest, IN_PROC_BROWSER_TEST_F(FormStructureBrowserTest, MAYBE_DataDrivenHeuristics(08)) { - const FilePath::CharType kFileNamePattern[] = FILE_PATH_LITERAL("08_*.html"); + const base::FilePath::CharType kFileNamePattern[] = + FILE_PATH_LITERAL("08_*.html"); RunDataDrivenTest(GetInputDirectory(kTestName), GetOutputDirectory(kTestName), kFileNamePattern); @@ -175,7 +184,8 @@ IN_PROC_BROWSER_TEST_F(FormStructureBrowserTest, IN_PROC_BROWSER_TEST_F(FormStructureBrowserTest, MAYBE_DataDrivenHeuristics(09)) { - const FilePath::CharType kFileNamePattern[] = FILE_PATH_LITERAL("09_*.html"); + const base::FilePath::CharType kFileNamePattern[] = + FILE_PATH_LITERAL("09_*.html"); RunDataDrivenTest(GetInputDirectory(kTestName), GetOutputDirectory(kTestName), kFileNamePattern); @@ -183,7 +193,8 @@ IN_PROC_BROWSER_TEST_F(FormStructureBrowserTest, IN_PROC_BROWSER_TEST_F(FormStructureBrowserTest, MAYBE_DataDrivenHeuristics(10)) { - const FilePath::CharType kFileNamePattern[] = FILE_PATH_LITERAL("10_*.html"); + const base::FilePath::CharType kFileNamePattern[] = + FILE_PATH_LITERAL("10_*.html"); RunDataDrivenTest(GetInputDirectory(kTestName), GetOutputDirectory(kTestName), kFileNamePattern); @@ -191,7 +202,8 @@ IN_PROC_BROWSER_TEST_F(FormStructureBrowserTest, IN_PROC_BROWSER_TEST_F(FormStructureBrowserTest, MAYBE_DataDrivenHeuristics(11)) { - const FilePath::CharType kFileNamePattern[] = FILE_PATH_LITERAL("11_*.html"); + const base::FilePath::CharType kFileNamePattern[] = + FILE_PATH_LITERAL("11_*.html"); RunDataDrivenTest(GetInputDirectory(kTestName), GetOutputDirectory(kTestName), kFileNamePattern); @@ -199,7 +211,8 @@ IN_PROC_BROWSER_TEST_F(FormStructureBrowserTest, IN_PROC_BROWSER_TEST_F(FormStructureBrowserTest, MAYBE_DataDrivenHeuristics(12)) { - const FilePath::CharType kFileNamePattern[] = FILE_PATH_LITERAL("12_*.html"); + const base::FilePath::CharType kFileNamePattern[] = + FILE_PATH_LITERAL("12_*.html"); RunDataDrivenTest(GetInputDirectory(kTestName), GetOutputDirectory(kTestName), kFileNamePattern); @@ -207,7 +220,8 @@ IN_PROC_BROWSER_TEST_F(FormStructureBrowserTest, IN_PROC_BROWSER_TEST_F(FormStructureBrowserTest, MAYBE_DataDrivenHeuristics(13)) { - const FilePath::CharType kFileNamePattern[] = FILE_PATH_LITERAL("13_*.html"); + const base::FilePath::CharType kFileNamePattern[] = + FILE_PATH_LITERAL("13_*.html"); RunDataDrivenTest(GetInputDirectory(kTestName), GetOutputDirectory(kTestName), kFileNamePattern); @@ -215,7 +229,8 @@ IN_PROC_BROWSER_TEST_F(FormStructureBrowserTest, IN_PROC_BROWSER_TEST_F(FormStructureBrowserTest, MAYBE_DataDrivenHeuristics(14)) { - const FilePath::CharType kFileNamePattern[] = FILE_PATH_LITERAL("14_*.html"); + const base::FilePath::CharType kFileNamePattern[] = + FILE_PATH_LITERAL("14_*.html"); RunDataDrivenTest(GetInputDirectory(kTestName), GetOutputDirectory(kTestName), kFileNamePattern); @@ -223,7 +238,8 @@ IN_PROC_BROWSER_TEST_F(FormStructureBrowserTest, IN_PROC_BROWSER_TEST_F(FormStructureBrowserTest, MAYBE_DataDrivenHeuristics(15)) { - const FilePath::CharType kFileNamePattern[] = FILE_PATH_LITERAL("15_*.html"); + const base::FilePath::CharType kFileNamePattern[] = + FILE_PATH_LITERAL("15_*.html"); RunDataDrivenTest(GetInputDirectory(kTestName), GetOutputDirectory(kTestName), kFileNamePattern); @@ -231,7 +247,8 @@ IN_PROC_BROWSER_TEST_F(FormStructureBrowserTest, IN_PROC_BROWSER_TEST_F(FormStructureBrowserTest, MAYBE_DataDrivenHeuristics(16)) { - const FilePath::CharType kFileNamePattern[] = FILE_PATH_LITERAL("16_*.html"); + const base::FilePath::CharType kFileNamePattern[] = + FILE_PATH_LITERAL("16_*.html"); RunDataDrivenTest(GetInputDirectory(kTestName), GetOutputDirectory(kTestName), kFileNamePattern); @@ -239,7 +256,8 @@ IN_PROC_BROWSER_TEST_F(FormStructureBrowserTest, IN_PROC_BROWSER_TEST_F(FormStructureBrowserTest, MAYBE_DataDrivenHeuristics(17)) { - const FilePath::CharType kFileNamePattern[] = FILE_PATH_LITERAL("17_*.html"); + const base::FilePath::CharType kFileNamePattern[] = + FILE_PATH_LITERAL("17_*.html"); RunDataDrivenTest(GetInputDirectory(kTestName), GetOutputDirectory(kTestName), kFileNamePattern); @@ -247,7 +265,8 @@ IN_PROC_BROWSER_TEST_F(FormStructureBrowserTest, IN_PROC_BROWSER_TEST_F(FormStructureBrowserTest, MAYBE_DataDrivenHeuristics(20)) { - const FilePath::CharType kFileNamePattern[] = FILE_PATH_LITERAL("20_*.html"); + const base::FilePath::CharType kFileNamePattern[] = + FILE_PATH_LITERAL("20_*.html"); RunDataDrivenTest(GetInputDirectory(kTestName), GetOutputDirectory(kTestName), kFileNamePattern); diff --git a/chrome/browser/automation/automation_provider_observers.cc b/chrome/browser/automation/automation_provider_observers.cc index 9dcccb8..4e7dffd 100644 --- a/chrome/browser/automation/automation_provider_observers.cc +++ b/chrome/browser/automation/automation_provider_observers.cc @@ -1745,7 +1745,7 @@ void SavePackageNotificationObserver::ManagerGoingDown( PageSnapshotTaker::PageSnapshotTaker(AutomationProvider* automation, IPC::Message* reply_message, WebContents* web_contents, - const FilePath& path) + const base::FilePath& path) : automation_(automation->AsWeakPtr()), reply_message_(reply_message), web_contents_(web_contents), diff --git a/chrome/browser/automation/automation_provider_observers.h b/chrome/browser/automation/automation_provider_observers.h index e29aea29..93f88ed 100644 --- a/chrome/browser/automation/automation_provider_observers.h +++ b/chrome/browser/automation/automation_provider_observers.h @@ -1274,7 +1274,7 @@ class PageSnapshotTaker : public TabEventObserver, PageSnapshotTaker(AutomationProvider* automation, IPC::Message* reply_message, content::WebContents* web_contents, - const FilePath& path); + const base::FilePath& path); virtual ~PageSnapshotTaker(); // Start the process of taking a snapshot of the entire page. @@ -1298,7 +1298,7 @@ class PageSnapshotTaker : public TabEventObserver, base::WeakPtr<AutomationProvider> automation_; scoped_ptr<IPC::Message> reply_message_; content::WebContents* web_contents_; - FilePath image_path_; + base::FilePath image_path_; content::NotificationRegistrar registrar_; DISALLOW_COPY_AND_ASSIGN(PageSnapshotTaker); diff --git a/chrome/browser/automation/automation_tab_helper_browsertest.cc b/chrome/browser/automation/automation_tab_helper_browsertest.cc index e236cad..2125b9e 100644 --- a/chrome/browser/automation/automation_tab_helper_browsertest.cc +++ b/chrome/browser/automation/automation_tab_helper_browsertest.cc @@ -107,7 +107,7 @@ class AutomationTabHelperBrowserTest : public InProcessBrowserTest { } protected: - FilePath test_data_dir_; + base::FilePath test_data_dir_; }; IN_PROC_BROWSER_TEST_F(AutomationTabHelperBrowserTest, FormSubmission) { diff --git a/chrome/browser/automation/testing_automation_provider.cc b/chrome/browser/automation/testing_automation_provider.cc index d5b82c6..3982d57 100644 --- a/chrome/browser/automation/testing_automation_provider.cc +++ b/chrome/browser/automation/testing_automation_provider.cc @@ -202,7 +202,7 @@ void SendSuccessReply(base::WeakPtr<AutomationProvider> automation, // Helper to process the result of CanEnablePlugin. void DidEnablePlugin(base::WeakPtr<AutomationProvider> automation, IPC::Message* reply_message, - const FilePath::StringType& path, + const base::FilePath::StringType& path, const std::string& error_msg, bool did_enable) { if (did_enable) { @@ -1155,13 +1155,13 @@ void TestingAutomationProvider::CloseBrowserWindow( void TestingAutomationProvider::OpenProfileWindow( base::DictionaryValue* args, IPC::Message* reply_message) { ProfileManager* profile_manager = g_browser_process->profile_manager(); - FilePath::StringType path; + base::FilePath::StringType path; if (!args->GetString("path", &path)) { AutomationJSONReply(this, reply_message).SendError( "Invalid or missing arg: 'path'"); return; } - Profile* profile = profile_manager->GetProfileByPath(FilePath(path)); + Profile* profile = profile_manager->GetProfileByPath(base::FilePath(path)); if (!profile) { AutomationJSONReply(this, reply_message).SendError( StringPrintf("Invalid profile path: %s", path.c_str())); @@ -2241,7 +2241,7 @@ void TestingAutomationProvider::GetBrowserInfo( chrome::kHelperProcessExecutablePath); properties->SetString("command_line_string", CommandLine::ForCurrentProcess()->GetCommandLineString()); - FilePath dumps_path; + base::FilePath dumps_path; PathService::Get(chrome::DIR_CRASH_DUMPS, &dumps_path); properties->SetString("DIR_CRASH_DUMPS", dumps_path.value()); #if defined(USE_AURA) @@ -2633,7 +2633,7 @@ void TestingAutomationProvider::PerformActionOnDownload( } else if (action == "toggle_open_files_like_this") { DownloadPrefs* prefs = DownloadPrefs::FromBrowserContext(selected_item->GetBrowserContext()); - FilePath path = selected_item->GetUserVerifiedFilePath(); + base::FilePath path = selected_item->GetUserVerifiedFilePath(); if (!selected_item->ShouldOpenFileBasedOnExtension()) prefs->EnableAutoOpenBasedOnExtension(path); else @@ -3187,13 +3187,13 @@ void TestingAutomationProvider::GetPluginsInfoCallback( void TestingAutomationProvider::EnablePlugin(Browser* browser, DictionaryValue* args, IPC::Message* reply_message) { - FilePath::StringType path; + base::FilePath::StringType path; if (!args->GetString("path", &path)) { AutomationJSONReply(this, reply_message).SendError("path not specified."); return; } PluginPrefs* plugin_prefs = PluginPrefs::GetForProfile(browser->profile()); - plugin_prefs->EnablePlugin(true, FilePath(path), + plugin_prefs->EnablePlugin(true, base::FilePath(path), base::Bind(&DidEnablePlugin, AsWeakPtr(), reply_message, path, "Could not enable plugin for path %s.")); } @@ -3204,13 +3204,13 @@ void TestingAutomationProvider::EnablePlugin(Browser* browser, void TestingAutomationProvider::DisablePlugin(Browser* browser, DictionaryValue* args, IPC::Message* reply_message) { - FilePath::StringType path; + base::FilePath::StringType path; if (!args->GetString("path", &path)) { AutomationJSONReply(this, reply_message).SendError("path not specified."); return; } PluginPrefs* plugin_prefs = PluginPrefs::GetForProfile(browser->profile()); - plugin_prefs->EnablePlugin(false, FilePath(path), + plugin_prefs->EnablePlugin(false, base::FilePath(path), base::Bind(&DidEnablePlugin, AsWeakPtr(), reply_message, path, "Could not disable plugin for path %s.")); } @@ -3226,8 +3226,8 @@ void TestingAutomationProvider::SaveTabContents( DictionaryValue* args, IPC::Message* reply_message) { int tab_index = 0; - FilePath::StringType filename; - FilePath::StringType parent_directory; + base::FilePath::StringType filename; + base::FilePath::StringType parent_directory; WebContents* web_contents = NULL; if (!args->GetInteger("tab_index", &tab_index) || @@ -3244,10 +3244,10 @@ void TestingAutomationProvider::SaveTabContents( } // We're doing a SAVE_AS_ONLY_HTML so the the directory path isn't // used. Nevertheless, SavePackage requires it be valid. Sigh. - parent_directory = FilePath(filename).DirName().value(); + parent_directory = base::FilePath(filename).DirName().value(); if (!web_contents->SavePage( - FilePath(filename), - FilePath(parent_directory), + base::FilePath(filename), + base::FilePath(parent_directory), content::SAVE_PAGE_TYPE_AS_ONLY_HTML)) { AutomationJSONReply(this, reply_message).SendError( "Could not initiate SavePage"); @@ -3578,7 +3578,7 @@ void TestingAutomationProvider::IsFindInPageVisible( void TestingAutomationProvider::InstallExtension( DictionaryValue* args, IPC::Message* reply_message) { - FilePath::StringType path_string; + base::FilePath::StringType path_string; bool with_ui; bool from_webstore = false; Browser* browser; @@ -3612,7 +3612,7 @@ void TestingAutomationProvider::InstallExtension( this, reply_message); - FilePath extension_path(path_string); + base::FilePath extension_path(path_string); // If the given path has a 'crx' extension, assume it is a packed extension // and install it. Otherwise load it as an unpacked extension. if (extension_path.MatchesExtension(FILE_PATH_LITERAL(".crx"))) { @@ -5482,7 +5482,7 @@ void TestingAutomationProvider::CaptureEntirePageJSON( return; } - FilePath::StringType path_str; + base::FilePath::StringType path_str; if (!args->GetString("path", &path_str)) { AutomationJSONReply(this, reply_message) .SendError("'path' missing or invalid"); @@ -5491,7 +5491,7 @@ void TestingAutomationProvider::CaptureEntirePageJSON( RenderViewHost* render_view = web_contents->GetRenderViewHost(); if (render_view) { - FilePath path(path_str); + base::FilePath path(path_str); // This will delete itself when finished. PageSnapshotTaker* snapshot_taker = new PageSnapshotTaker( this, reply_message, web_contents, path); diff --git a/chrome/browser/background/background_application_list_model_unittest.cc b/chrome/browser/background/background_application_list_model_unittest.cc index 9f8645d..6718908 100644 --- a/chrome/browser/background/background_application_list_model_unittest.cc +++ b/chrome/browser/background/background_application_list_model_unittest.cc @@ -36,8 +36,8 @@ using extensions::APIPermission; using extensions::Extension; // For ExtensionService interface when it requires a path that is not used. -FilePath bogus_file_path() { - return FilePath(FILE_PATH_LITERAL("//foobar_nonexistent")); +base::FilePath bogus_file_path() { + return base::FilePath(FILE_PATH_LITERAL("//foobar_nonexistent")); } class BackgroundApplicationListModelTest : public ExtensionServiceTestBase { diff --git a/chrome/browser/background/background_mode_manager.cc b/chrome/browser/background/background_mode_manager.cc index cfd7b18..513d79f 100644 --- a/chrome/browser/background/background_mode_manager.cc +++ b/chrome/browser/background/background_mode_manager.cc @@ -398,7 +398,7 @@ void BackgroundModeManager::OnApplicationListChanged(Profile* profile) { /////////////////////////////////////////////////////////////////////////////// // BackgroundModeManager, ProfileInfoCacheObserver overrides -void BackgroundModeManager::OnProfileAdded(const FilePath& profile_path) { +void BackgroundModeManager::OnProfileAdded(const base::FilePath& profile_path) { ProfileInfoCache& cache = g_browser_process->profile_manager()->GetProfileInfoCache(); string16 profile_name = cache.GetNameOfProfileAtIndex( @@ -419,7 +419,7 @@ void BackgroundModeManager::OnProfileAdded(const FilePath& profile_path) { } void BackgroundModeManager::OnProfileWillBeRemoved( - const FilePath& profile_path) { + const base::FilePath& profile_path) { ProfileInfoCache& cache = g_browser_process->profile_manager()->GetProfileInfoCache(); string16 profile_name = cache.GetNameOfProfileAtIndex( @@ -435,12 +435,12 @@ void BackgroundModeManager::OnProfileWillBeRemoved( } void BackgroundModeManager::OnProfileWasRemoved( - const FilePath& profile_path, + const base::FilePath& profile_path, const string16& profile_name) { } void BackgroundModeManager::OnProfileNameChanged( - const FilePath& profile_path, + const base::FilePath& profile_path, const string16& old_profile_name) { ProfileInfoCache& cache = g_browser_process->profile_manager()->GetProfileInfoCache(); @@ -458,7 +458,7 @@ void BackgroundModeManager::OnProfileNameChanged( } void BackgroundModeManager::OnProfileAvatarChanged( - const FilePath& profile_path) { + const base::FilePath& profile_path) { } /////////////////////////////////////////////////////////////////////////////// diff --git a/chrome/browser/background/background_mode_manager.h b/chrome/browser/background/background_mode_manager.h index 312748b..b1f79f8 100644 --- a/chrome/browser/background/background_mode_manager.h +++ b/chrome/browser/background/background_mode_manager.h @@ -167,13 +167,15 @@ class BackgroundModeManager virtual void OnApplicationListChanged(Profile* profile) OVERRIDE; // Overrides from ProfileInfoCacheObserver - virtual void OnProfileAdded(const FilePath& profile_path) OVERRIDE; - virtual void OnProfileWillBeRemoved(const FilePath& profile_path) OVERRIDE; - virtual void OnProfileWasRemoved(const FilePath& profile_path, + virtual void OnProfileAdded(const base::FilePath& profile_path) OVERRIDE; + virtual void OnProfileWillBeRemoved( + const base::FilePath& profile_path) OVERRIDE; + virtual void OnProfileWasRemoved(const base::FilePath& profile_path, const string16& profile_name) OVERRIDE; - virtual void OnProfileNameChanged(const FilePath& profile_path, + virtual void OnProfileNameChanged(const base::FilePath& profile_path, const string16& old_profile_name) OVERRIDE; - virtual void OnProfileAvatarChanged(const FilePath& profile_path) OVERRIDE; + virtual void OnProfileAvatarChanged( + const base::FilePath& profile_path) OVERRIDE; // Overrides from SimpleMenuModel::Delegate implementation. virtual bool IsCommandIdChecked(int command_id) const OVERRIDE; diff --git a/chrome/browser/bookmarks/bookmark_codec_unittest.cc b/chrome/browser/bookmarks/bookmark_codec_unittest.cc index aba1347..7ae6cab 100644 --- a/chrome/browser/bookmarks/bookmark_codec_unittest.cc +++ b/chrome/browser/bookmarks/bookmark_codec_unittest.cc @@ -297,9 +297,9 @@ TEST_F(BookmarkCodecTest, PersistIDsTest) { } TEST_F(BookmarkCodecTest, CanDecodeModelWithoutMobileBookmarks) { - FilePath test_data_directory; + base::FilePath test_data_directory; ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &test_data_directory)); - FilePath test_file = test_data_directory.AppendASCII( + base::FilePath test_file = test_data_directory.AppendASCII( "bookmarks/model_without_sync.json"); ASSERT_TRUE(file_util::PathExists(test_file)); diff --git a/chrome/browser/bookmarks/bookmark_html_writer.cc b/chrome/browser/bookmarks/bookmark_html_writer.cc index 58a8071..93beb36 100644 --- a/chrome/browser/bookmarks/bookmark_html_writer.cc +++ b/chrome/browser/bookmarks/bookmark_html_writer.cc @@ -89,7 +89,7 @@ const size_t kIndentSize = 4; class Writer : public base::RefCountedThreadSafe<Writer> { public: Writer(base::Value* bookmarks, - const FilePath& path, + const base::FilePath& path, BookmarkFaviconFetcher::URLFaviconMap* favicons_map, BookmarksExportObserver* observer) : bookmarks_(bookmarks), @@ -363,7 +363,7 @@ class Writer : public base::RefCountedThreadSafe<Writer> { scoped_ptr<Value> bookmarks_; // Path we're writing to. - FilePath path_; + base::FilePath path_; // Map that stores favicon per URL. scoped_ptr<BookmarkFaviconFetcher::URLFaviconMap> favicons_map_; @@ -385,7 +385,7 @@ class Writer : public base::RefCountedThreadSafe<Writer> { BookmarkFaviconFetcher::BookmarkFaviconFetcher( Profile* profile, - const FilePath& path, + const base::FilePath& path, BookmarksExportObserver* observer) : profile_(profile), path_(path), @@ -495,7 +495,7 @@ void BookmarkFaviconFetcher::OnFaviconDataAvailable( namespace bookmark_html_writer { void WriteBookmarks(Profile* profile, - const FilePath& path, + const base::FilePath& path, BookmarksExportObserver* observer) { // BookmarkModel isn't thread safe (nor would we want to lock it down // for the duration of the write), as such we make a copy of the diff --git a/chrome/browser/bookmarks/bookmark_html_writer.h b/chrome/browser/bookmarks/bookmark_html_writer.h index ddc669e..47d004e 100644 --- a/chrome/browser/bookmarks/bookmark_html_writer.h +++ b/chrome/browser/bookmarks/bookmark_html_writer.h @@ -43,7 +43,7 @@ class BookmarkFaviconFetcher: public content::NotificationObserver { URLFaviconMap; BookmarkFaviconFetcher(Profile* profile, - const FilePath& path, + const base::FilePath& path, BookmarksExportObserver* observer); virtual ~BookmarkFaviconFetcher(); @@ -86,7 +86,7 @@ class BookmarkFaviconFetcher: public content::NotificationObserver { scoped_ptr<URLFaviconMap> favicons_map_; // Path where html output is stored. - FilePath path_; + base::FilePath path_; BookmarksExportObserver* observer_; @@ -103,7 +103,7 @@ namespace bookmark_html_writer { // Before writing to the file favicons are fetched on the main thread. // TODO(sky): need a callback on failure. void WriteBookmarks(Profile* profile, - const FilePath& path, + const base::FilePath& path, BookmarksExportObserver* observer); } // namespace bookmark_html_writer diff --git a/chrome/browser/bookmarks/bookmark_html_writer_unittest.cc b/chrome/browser/bookmarks/bookmark_html_writer_unittest.cc index 282141b..4d26f56 100644 --- a/chrome/browser/bookmarks/bookmark_html_writer_unittest.cc +++ b/chrome/browser/bookmarks/bookmark_html_writer_unittest.cc @@ -119,7 +119,7 @@ class BookmarkHTMLWriterTest : public testing::Test { } base::ScopedTempDir temp_dir_; - FilePath path_; + base::FilePath path_; }; // Class that will notify message loop when file is written. diff --git a/chrome/browser/bookmarks/bookmark_node_data.cc b/chrome/browser/bookmarks/bookmark_node_data.cc index d1e39df..58672e1 100644 --- a/chrome/browser/bookmarks/bookmark_node_data.cc +++ b/chrome/browser/bookmarks/bookmark_node_data.cc @@ -208,7 +208,7 @@ void BookmarkNodeData::WriteToClipboard(Profile* profile) const { } bool BookmarkNodeData::ReadFromClipboard() { - FilePath file_path; + base::FilePath file_path; if (!bookmark_pasteboard_helper_mac::ReadFromPasteboard( bookmark_pasteboard_helper_mac::kCopyPastePasteboard, elements, @@ -221,7 +221,7 @@ bool BookmarkNodeData::ReadFromClipboard() { } bool BookmarkNodeData::ReadFromDragClipboard() { - FilePath file_path; + base::FilePath file_path; if (!bookmark_pasteboard_helper_mac::ReadFromPasteboard( bookmark_pasteboard_helper_mac::kDragPasteboard, elements, @@ -284,7 +284,7 @@ bool BookmarkNodeData::Read(const ui::OSExchangeData& data) { #endif void BookmarkNodeData::WriteToPickle(Profile* profile, Pickle* pickle) const { - FilePath path = profile ? profile->GetPath() : FilePath(); + base::FilePath path = profile ? profile->GetPath() : base::FilePath(); path.WriteToPickle(pickle); pickle->WriteUInt64(elements.size()); diff --git a/chrome/browser/bookmarks/bookmark_node_data.h b/chrome/browser/bookmarks/bookmark_node_data.h index ac2a77d..8bf61a62 100644 --- a/chrome/browser/bookmarks/bookmark_node_data.h +++ b/chrome/browser/bookmarks/bookmark_node_data.h @@ -161,7 +161,7 @@ struct BookmarkNodeData { private: // Path of the profile we originated from. - FilePath profile_path_; + base::FilePath profile_path_; }; #endif // CHROME_BROWSER_BOOKMARKS_BOOKMARK_NODE_DATA_H_ diff --git a/chrome/browser/bookmarks/bookmark_pasteboard_helper_mac.mm b/chrome/browser/bookmarks/bookmark_pasteboard_helper_mac.mm index 591b60a..c32ee8e 100644 --- a/chrome/browser/bookmarks/bookmark_pasteboard_helper_mac.mm +++ b/chrome/browser/bookmarks/bookmark_pasteboard_helper_mac.mm @@ -242,7 +242,7 @@ namespace bookmark_pasteboard_helper_mac { void WriteToPasteboard(PasteboardType type, const std::vector<BookmarkNodeData::Element>& elements, - const FilePath& profile_path) { + const base::FilePath& profile_path) { if (elements.empty()) return; @@ -264,12 +264,12 @@ void WriteToPasteboard(PasteboardType type, bool ReadFromPasteboard(PasteboardType type, std::vector<BookmarkNodeData::Element>& elements, - FilePath* profile_path) { + base::FilePath* profile_path) { NSPasteboard* pb = PasteboardFromType(type); elements.clear(); NSString* profile = [pb stringForType:kChromiumProfilePathPboardType]; - *profile_path = FilePath(base::SysNSStringToUTF8(profile)); + *profile_path = base::FilePath(base::SysNSStringToUTF8(profile)); return ReadBookmarkDictionaryListPboardType(pb, elements) || ReadWebURLsWithTitlesPboardType(pb, elements) || ReadNSURLPboardType(pb, elements); diff --git a/chrome/browser/bookmarks/bookmark_storage.cc b/chrome/browser/bookmarks/bookmark_storage.cc index c4dee86..d42a51a 100644 --- a/chrome/browser/bookmarks/bookmark_storage.cc +++ b/chrome/browser/bookmarks/bookmark_storage.cc @@ -26,13 +26,13 @@ using content::BrowserThread; namespace { // Extension used for backup files (copy of main file created during startup). -const FilePath::CharType kBackupExtension[] = FILE_PATH_LITERAL("bak"); +const base::FilePath::CharType kBackupExtension[] = FILE_PATH_LITERAL("bak"); // How often we save. const int kSaveDelayMS = 2500; -void BackupCallback(const FilePath& path) { - FilePath backup_path = path.ReplaceExtension(kBackupExtension); +void BackupCallback(const base::FilePath& path) { + base::FilePath backup_path = path.ReplaceExtension(kBackupExtension); file_util::CopyFile(path, backup_path); } @@ -48,7 +48,7 @@ void AddBookmarksToIndex(BookmarkLoadDetails* details, } } -void LoadCallback(const FilePath& path, +void LoadCallback(const base::FilePath& path, BookmarkStorage* storage, BookmarkLoadDetails* details) { startup_metric_utils::ScopedSlowStartupUMA diff --git a/chrome/browser/browser_encoding_browsertest.cc b/chrome/browser/browser_encoding_browsertest.cc index 1f27d2c..3a46fe0 100644 --- a/chrome/browser/browser_encoding_browsertest.cc +++ b/chrome/browser/browser_encoding_browsertest.cc @@ -101,7 +101,8 @@ class SavePackageFinishedObserver : public content::DownloadManager::Observer { using content::BrowserThread; -static const FilePath::CharType* kTestDir = FILE_PATH_LITERAL("encoding_tests"); +static const base::FilePath::CharType* kTestDir = + FILE_PATH_LITERAL("encoding_tests"); class BrowserEncodingTest : public InProcessBrowserTest, @@ -111,10 +112,11 @@ class BrowserEncodingTest // Saves the current page and verifies that the output matches the expected // result. - void SaveAndCompare(const char* filename_to_write, const FilePath& expected) { + void SaveAndCompare(const char* filename_to_write, + const base::FilePath& expected) { // Dump the page, the content of dump page should be identical to the // expected result file. - FilePath full_file_name = save_dir_.AppendASCII(filename_to_write); + base::FilePath full_file_name = save_dir_.AppendASCII(filename_to_write); // We save the page as way of complete HTML file, which requires a directory // name to save sub resources in it. Although this test file does not have // sub resources, but the directory name is still required. @@ -128,8 +130,8 @@ class BrowserEncodingTest content::SAVE_PAGE_TYPE_AS_COMPLETE_HTML); loop_runner->Run(); - FilePath expected_file_name = ui_test_utils::GetTestFilePath( - FilePath(kTestDir), expected); + base::FilePath expected_file_name = ui_test_utils::GetTestFilePath( + base::FilePath(kTestDir), expected); EXPECT_TRUE(file_util::ContentsEqual(full_file_name, expected_file_name)); } @@ -145,8 +147,8 @@ class BrowserEncodingTest } base::ScopedTempDir temp_dir_; - FilePath save_dir_; - FilePath temp_sub_resource_dir_; + base::FilePath save_dir_; + base::FilePath temp_sub_resource_dir_; }; // TODO(jnd): 1. Some encodings are missing here. It'll be added later. See @@ -157,8 +159,9 @@ class BrowserEncodingTest IN_PROC_BROWSER_TEST_P(BrowserEncodingTest, TestEncodingAliasMapping) { const char* const kAliasTestDir = "alias_mapping"; - FilePath test_dir_path = FilePath(kTestDir).AppendASCII(kAliasTestDir); - FilePath test_file_path(test_dir_path); + base::FilePath test_dir_path = base::FilePath(kTestDir).AppendASCII( + kAliasTestDir); + base::FilePath test_file_path(test_dir_path); test_file_path = test_file_path.AppendASCII( GetParam().file_name); @@ -180,7 +183,8 @@ IN_PROC_BROWSER_TEST_F(BrowserEncodingTest, TestOverrideEncoding) { "expected_gb18030_saved_from_iso88591_meta.html"; const char* const kOverrideTestDir = "user_override"; - FilePath test_dir_path = FilePath(kTestDir).AppendASCII(kOverrideTestDir); + base::FilePath test_dir_path = + base::FilePath(kTestDir).AppendASCII(kOverrideTestDir); test_dir_path = test_dir_path.AppendASCII(kTestFileName); GURL url = content::URLRequestMockHTTPJob::GetMockUrl(test_dir_path); ui_test_utils::NavigateToURL(browser(), url); @@ -198,8 +202,9 @@ IN_PROC_BROWSER_TEST_F(BrowserEncodingTest, TestOverrideEncoding) { navigation_observer.Wait(); EXPECT_EQ("gb18030", web_contents->GetEncoding()); - FilePath expected_filename = - FilePath().AppendASCII(kOverrideTestDir).AppendASCII(kExpectedFileName); + base::FilePath expected_filename = + base::FilePath().AppendASCII(kOverrideTestDir).AppendASCII( + kExpectedFileName); SaveAndCompare(kTestFileName, expected_filename); } @@ -282,7 +287,8 @@ IN_PROC_BROWSER_TEST_F(BrowserEncodingTest, MAYBE_TestEncodingAutoDetect) { // Directory of the files of expected results. const char* const kExpectedResultDir = "expected_results"; - FilePath test_dir_path = FilePath(kTestDir).AppendASCII(kAutoDetectDir); + base::FilePath test_dir_path = + base::FilePath(kTestDir).AppendASCII(kAutoDetectDir); // Set the default charset to one of encodings not supported by the current // auto-detector (Please refer to the above comments) to make sure we @@ -297,7 +303,7 @@ IN_PROC_BROWSER_TEST_F(BrowserEncodingTest, MAYBE_TestEncodingAutoDetect) { browser()->profile()->GetPrefs()->SetBoolean( prefs::kWebKitUsesUniversalDetector, false); - FilePath test_file_path(test_dir_path); + base::FilePath test_file_path(test_dir_path); test_file_path = test_file_path.AppendASCII(kTestDatas[i].test_file_name); GURL url = content::URLRequestMockHTTPJob::GetMockUrl(test_file_path); ui_test_utils::NavigateToURL(browser(), url); @@ -321,8 +327,9 @@ IN_PROC_BROWSER_TEST_F(BrowserEncodingTest, MAYBE_TestEncodingAutoDetect) { // Dump the page, the content of dump page should be equal with our expect // result file. - FilePath expected_result_file_name = - FilePath().AppendASCII(kAutoDetectDir).AppendASCII(kExpectedResultDir). + base::FilePath expected_result_file_name = + base::FilePath().AppendASCII(kAutoDetectDir). + AppendASCII(kExpectedResultDir). AppendASCII(kTestDatas[i].expected_result); SaveAndCompare(kTestDatas[i].test_file_name, expected_result_file_name); } diff --git a/chrome/browser/browser_process_impl.cc b/chrome/browser/browser_process_impl.cc index ab1f680..1a53b63 100644 --- a/chrome/browser/browser_process_impl.cc +++ b/chrome/browser/browser_process_impl.cc @@ -788,7 +788,7 @@ void BrowserProcessImpl::CreateProfileManager() { DCHECK(!created_profile_manager_ && profile_manager_.get() == NULL); created_profile_manager_ = true; - FilePath user_data_dir; + base::FilePath user_data_dir; PathService::Get(chrome::DIR_USER_DATA, &user_data_dir); profile_manager_.reset(new ProfileManager(user_data_dir)); } @@ -797,7 +797,7 @@ void BrowserProcessImpl::CreateLocalState() { DCHECK(!created_local_state_ && local_state_.get() == NULL); created_local_state_ = true; - FilePath local_state_path; + base::FilePath local_state_path; CHECK(PathService::Get(chrome::FILE_LOCAL_STATE, &local_state_path)); scoped_refptr<PrefRegistrySimple> pref_registry = new PrefRegistrySimple; local_state_.reset( @@ -854,7 +854,7 @@ void BrowserProcessImpl::PreMainMessageLoopRun() { #if defined(OS_POSIX) // Also find plugins in a user-specific plugins dir, // e.g. ~/.config/chromium/Plugins. - FilePath user_data_dir; + base::FilePath user_data_dir; if (PathService::Get(chrome::DIR_USER_DATA, &user_data_dir)) plugin_service->AddExtraPluginDir(user_data_dir.Append("Plugins")); #endif diff --git a/chrome/browser/browser_shutdown.cc b/chrome/browser/browser_shutdown.cc index 6a94b1e..7402cac 100644 --- a/chrome/browser/browser_shutdown.cc +++ b/chrome/browser/browser_shutdown.cc @@ -114,8 +114,8 @@ void OnShutdownStarting(ShutdownType type) { } } -FilePath GetShutdownMsPath() { - FilePath shutdown_ms_file; +base::FilePath GetShutdownMsPath() { + base::FilePath shutdown_ms_file; PathService::Get(chrome::DIR_USER_DATA, &shutdown_ms_file); return shutdown_ms_file.AppendASCII(kShutdownMsFile); } @@ -248,7 +248,7 @@ void ShutdownPostThreadsStop(bool restart_last_session) { std::string shutdown_ms = base::Int64ToString(shutdown_delta.InMilliseconds()); int len = static_cast<int>(shutdown_ms.length()) + 1; - FilePath shutdown_ms_file = GetShutdownMsPath(); + base::FilePath shutdown_ms_file = GetShutdownMsPath(); file_util::WriteFile(shutdown_ms_file, shutdown_ms.c_str(), len); } @@ -262,7 +262,7 @@ void ReadLastShutdownFile(ShutdownType type, int num_procs_slow) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); - FilePath shutdown_ms_file = GetShutdownMsPath(); + base::FilePath shutdown_ms_file = GetShutdownMsPath(); std::string shutdown_ms_str; int64 shutdown_ms = 0; if (file_util::ReadFileToString(shutdown_ms_file, &shutdown_ms_str)) diff --git a/chrome/browser/browser_util_win.cc b/chrome/browser/browser_util_win.cc index f4c11c7..2c32df0 100644 --- a/chrome/browser/browser_util_win.cc +++ b/chrome/browser/browser_util_win.cc @@ -17,7 +17,7 @@ namespace browser_util { bool IsBrowserAlreadyRunning() { static HANDLE handle = NULL; - FilePath exe_path; + base::FilePath exe_path; PathService::Get(base::FILE_EXE, &exe_path); std::wstring exe = exe_path.value(); std::replace(exe.begin(), exe.end(), '\\', '!'); diff --git a/chrome/browser/browsing_data/browsing_data_database_helper.cc b/chrome/browser/browsing_data/browsing_data_database_helper.cc index 3ea08c4..9248122 100644 --- a/chrome/browser/browsing_data/browsing_data_database_helper.cc +++ b/chrome/browser/browsing_data/browsing_data_database_helper.cc @@ -92,7 +92,8 @@ void BrowsingDataDatabaseHelper::FetchDatabaseInfoOnFileThread() { ori->GetAllDatabaseNames(&databases); for (std::vector<string16>::const_iterator db = databases.begin(); db != databases.end(); ++db) { - FilePath file_path = tracker_->GetFullDBFilePath(ori->GetOrigin(), *db); + base::FilePath file_path = + tracker_->GetFullDBFilePath(ori->GetOrigin(), *db); base::PlatformFileInfo file_info; if (file_util::GetFileInfo(file_path, &file_info)) { database_info_.push_back(DatabaseInfo( diff --git a/chrome/browser/browsing_data/browsing_data_database_helper_browsertest.cc b/chrome/browser/browsing_data/browsing_data_database_helper_browsertest.cc index c7b1dd3..8c29d07 100644 --- a/chrome/browser/browsing_data/browsing_data_database_helper_browsertest.cc +++ b/chrome/browser/browsing_data/browsing_data_database_helper_browsertest.cc @@ -39,14 +39,15 @@ class BrowsingDataDatabaseHelperTest : public InProcessBrowserTest { string16 identifier1(UTF8ToUTF16(kTestIdentifier1)); db_tracker->DatabaseOpened(identifier1, db_name, description, 1, &size); db_tracker->DatabaseClosed(identifier1, db_name); - FilePath db_path1 = db_tracker->GetFullDBFilePath(identifier1, db_name); + base::FilePath db_path1 = + db_tracker->GetFullDBFilePath(identifier1, db_name); file_util::CreateDirectory(db_path1.DirName()); ASSERT_EQ(0, file_util::WriteFile(db_path1, NULL, 0)); string16 identifierExtension(UTF8ToUTF16(kTestIdentifierExtension)); db_tracker->DatabaseOpened(identifierExtension, db_name, description, 1, &size); db_tracker->DatabaseClosed(identifierExtension, db_name); - FilePath db_path2 = + base::FilePath db_path2 = db_tracker->GetFullDBFilePath(identifierExtension, db_name); file_util::CreateDirectory(db_path2.DirName()); ASSERT_EQ(0, file_util::WriteFile(db_path2, NULL, 0)); diff --git a/chrome/browser/browsing_data/browsing_data_file_system_helper_unittest.cc b/chrome/browser/browsing_data/browsing_data_file_system_helper_unittest.cc index 7a0539a..3708ccb 100644 --- a/chrome/browser/browsing_data/browsing_data_file_system_helper_unittest.cc +++ b/chrome/browser/browsing_data/browsing_data_file_system_helper_unittest.cc @@ -173,8 +173,9 @@ class BrowsingDataFileSystemHelperTest : public testing::Test { // specified origin. void CreateDirectoryForOriginAndType(const GURL& origin, fileapi::FileSystemType type) { - FilePath target = sandbox_->GetFileSystemRootPathOnFileThread( - fileapi::FileSystemURL::CreateForTest(origin, type, FilePath()), true); + base::FilePath target = sandbox_->GetFileSystemRootPathOnFileThread( + fileapi::FileSystemURL::CreateForTest(origin, type, base::FilePath()), + true); EXPECT_TRUE(file_util::DirectoryExists(target)); } diff --git a/chrome/browser/browsing_data/browsing_data_local_storage_helper_browsertest.cc b/chrome/browser/browsing_data/browsing_data_local_storage_helper_browsertest.cc index bd5141f..3dd8319 100644 --- a/chrome/browser/browsing_data/browsing_data_local_storage_helper_browsertest.cc +++ b/chrome/browser/browsing_data/browsing_data_local_storage_helper_browsertest.cc @@ -32,19 +32,19 @@ typedef BrowsingDataHelperCallback<BrowsingDataLocalStorageHelper::LocalStorageInfo> TestCompletionCallback; -const FilePath::CharType kTestFile0[] = +const base::FilePath::CharType kTestFile0[] = FILE_PATH_LITERAL("http_www.chromium.org_0.localstorage"); const char kOriginOfTestFile0[] = "http://www.chromium.org/"; -const FilePath::CharType kTestFile1[] = +const base::FilePath::CharType kTestFile1[] = FILE_PATH_LITERAL("http_www.google.com_0.localstorage"); -const FilePath::CharType kTestFileInvalid[] = +const base::FilePath::CharType kTestFileInvalid[] = FILE_PATH_LITERAL("http_www.google.com_localstorage_0.foo"); // This is only here to test that extension state is not listed by the helper. -const FilePath::CharType kTestFileExtension[] = FILE_PATH_LITERAL( +const base::FilePath::CharType kTestFileExtension[] = FILE_PATH_LITERAL( "chrome-extension_behllobkkfkfnphdnhnkndlbkcpglgmj_0.localstorage"); class BrowsingDataLocalStorageHelperTest : public InProcessBrowserTest { @@ -52,18 +52,18 @@ class BrowsingDataLocalStorageHelperTest : public InProcessBrowserTest { void CreateLocalStorageFilesForTest() { // Note: This helper depends on details of how the dom_storage library // stores data in the host file system. - FilePath storage_path = GetLocalStoragePathForTestingProfile(); + base::FilePath storage_path = GetLocalStoragePathForTestingProfile(); file_util::CreateDirectory(storage_path); - const FilePath::CharType* kFilesToCreate[] = { + const base::FilePath::CharType* kFilesToCreate[] = { kTestFile0, kTestFile1, kTestFileInvalid, kTestFileExtension }; for (size_t i = 0; i < arraysize(kFilesToCreate); ++i) { - FilePath file_path = storage_path.Append(kFilesToCreate[i]); + base::FilePath file_path = storage_path.Append(kFilesToCreate[i]); file_util::WriteFile(file_path, NULL, 0); } } - FilePath GetLocalStoragePathForTestingProfile() { + base::FilePath GetLocalStoragePathForTestingProfile() { return browser()->profile()->GetPath().AppendASCII("Local Storage"); } }; @@ -134,10 +134,10 @@ IN_PROC_BROWSER_TEST_F(BrowsingDataLocalStorageHelperTest, DeleteSingleFile) { false, file_util::FileEnumerator::FILES); int num_files = 0; - for (FilePath file_path = file_enumerator.Next(); + for (base::FilePath file_path = file_enumerator.Next(); !file_path.empty(); file_path = file_enumerator.Next()) { - ASSERT_FALSE(FilePath(kTestFile0) == file_path.BaseName()); + ASSERT_FALSE(base::FilePath(kTestFile0) == file_path.BaseName()); ++num_files; } ASSERT_EQ(3, num_files); diff --git a/chrome/browser/browsing_data/browsing_data_remover_browsertest.cc b/chrome/browser/browsing_data/browsing_data_remover_browsertest.cc index 8ecdc64..10e52d9 100644 --- a/chrome/browser/browsing_data/browsing_data_remover_browsertest.cc +++ b/chrome/browser/browsing_data/browsing_data_remover_browsertest.cc @@ -27,7 +27,7 @@ using content::BrowserThread; namespace { -void SetUrlRequestMock(const FilePath& path) { +void SetUrlRequestMock(const base::FilePath& path) { content::URLRequestMockHTTPJob::AddUrlHandler(path); } } @@ -37,7 +37,7 @@ class BrowsingDataRemoverBrowserTest : public InProcessBrowserTest { BrowsingDataRemoverBrowserTest() {} virtual void SetUpOnMainThread() OVERRIDE { - FilePath path; + base::FilePath path; PathService::Get(content::DIR_TEST_DATA, &path); BrowserThread::PostTask( BrowserThread::IO, FROM_HERE, base::Bind(&SetUrlRequestMock, path)); @@ -78,8 +78,8 @@ IN_PROC_BROWSER_TEST_F(BrowsingDataRemoverBrowserTest, Download) { content::DownloadTestObserver::ON_DANGEROUS_DOWNLOAD_ACCEPT)); GURL download_url = ui_test_utils::GetTestUrl( - FilePath().AppendASCII("downloads"), - FilePath().AppendASCII("a_zip_file.zip")); + base::FilePath().AppendASCII("downloads"), + base::FilePath().AppendASCII("a_zip_file.zip")); ui_test_utils::NavigateToURL(browser(), download_url); observer->WaitForFinished(); @@ -97,7 +97,7 @@ IN_PROC_BROWSER_TEST_F(BrowsingDataRemoverBrowserTest, Download) { // Verify can modify database after deleting it. IN_PROC_BROWSER_TEST_F(BrowsingDataRemoverBrowserTest, Database) { GURL url(content::URLRequestMockHTTPJob::GetMockUrl( - FilePath().AppendASCII("simple_database.html"))); + base::FilePath().AppendASCII("simple_database.html"))); ui_test_utils::NavigateToURL(browser(), url); RunScriptAndCheckResult("createTable()", "done"); diff --git a/chrome/browser/browsing_data/browsing_data_remover_unittest.cc b/chrome/browser/browsing_data/browsing_data_remover_unittest.cc index 6f7df32..42070b8 100644 --- a/chrome/browser/browsing_data/browsing_data_remover_unittest.cc +++ b/chrome/browser/browsing_data/browsing_data_remover_unittest.cc @@ -66,16 +66,16 @@ const GURL kOrigin3(kTestOrigin3); const GURL kOriginExt(kTestOriginExt); const GURL kOriginDevTools(kTestOriginDevTools); -const FilePath::CharType kDomStorageOrigin1[] = +const base::FilePath::CharType kDomStorageOrigin1[] = FILE_PATH_LITERAL("http_host1_1.localstorage"); -const FilePath::CharType kDomStorageOrigin2[] = +const base::FilePath::CharType kDomStorageOrigin2[] = FILE_PATH_LITERAL("http_host2_1.localstorage"); -const FilePath::CharType kDomStorageOrigin3[] = +const base::FilePath::CharType kDomStorageOrigin3[] = FILE_PATH_LITERAL("http_host3_1.localstorage"); -const FilePath::CharType kDomStorageExt[] = FILE_PATH_LITERAL( +const base::FilePath::CharType kDomStorageExt[] = FILE_PATH_LITERAL( "chrome-extension_abcdefghijklmnopqrstuvwxyz_0.localstorage"); const quota::StorageType kTemporary = quota::kStorageTypeTemporary; @@ -451,7 +451,8 @@ class RemoveLocalStorageTester { void AddDOMStorageTestData() { // Note: This test depends on details of how the dom_storage library // stores data in the host file system. - FilePath storage_path = profile_->GetPath().AppendASCII("Local Storage"); + base::FilePath storage_path = + profile_->GetPath().AppendASCII("Local Storage"); file_util::CreateDirectory(storage_path); // Write some files. diff --git a/chrome/browser/captive_portal/captive_portal_browsertest.cc b/chrome/browser/captive_portal/captive_portal_browsertest.cc index 648f27d..47685bc 100644 --- a/chrome/browser/captive_portal/captive_portal_browsertest.cc +++ b/chrome/browser/captive_portal/captive_portal_browsertest.cc @@ -416,7 +416,7 @@ net::URLRequestJob* URLRequestMockCaptivePortalJobFactory::Factory( EXPECT_TRUE(BrowserThread::CurrentlyOn(BrowserThread::IO)); // The PathService is threadsafe. - FilePath root_http; + base::FilePath root_http; PathService::Get(chrome::DIR_TEST_DATA, &root_http); if (request->url() == GURL(kMockHttpsUrl) || @@ -1559,9 +1559,9 @@ IN_PROC_BROWSER_TEST_F(CaptivePortalBrowserTest, HttpsNonTimeoutError) { // Make sure no captive portal test triggers on HTTPS timeouts of iframes. IN_PROC_BROWSER_TEST_F(CaptivePortalBrowserTest, HttpsIframeTimeout) { // Use an HTTPS server for the top level page. - net::TestServer https_server(net::TestServer::TYPE_HTTPS, - net::TestServer::kLocalhost, - FilePath(FILE_PATH_LITERAL("chrome/test/data"))); + net::TestServer https_server( + net::TestServer::TYPE_HTTPS, net::TestServer::kLocalhost, + base::FilePath(FILE_PATH_LITERAL("chrome/test/data"))); ASSERT_TRUE(https_server.Start()); GURL url = https_server.GetURL(kTestServerIframeTimeoutPath); @@ -1614,9 +1614,9 @@ IN_PROC_BROWSER_TEST_F(CaptivePortalBrowserTest, RedirectSSLCertError) { net::TestServer::SSLOptions ssl_options; ssl_options.server_certificate = net::TestServer::SSLOptions::CERT_MISMATCHED_NAME; - net::TestServer https_server(net::TestServer::TYPE_HTTPS, - ssl_options, - FilePath(FILE_PATH_LITERAL("chrome/test/data"))); + net::TestServer https_server( + net::TestServer::TYPE_HTTPS, ssl_options, + base::FilePath(FILE_PATH_LITERAL("chrome/test/data"))); ASSERT_TRUE(https_server.Start()); GURL ssl_login_url = https_server.GetURL(kTestServerLoginPath); @@ -1702,9 +1702,9 @@ IN_PROC_BROWSER_TEST_F(CaptivePortalBrowserTest, SSLCertErrorLogin) { net::TestServer::SSLOptions https_options; https_options.server_certificate = net::TestServer::SSLOptions::CERT_MISMATCHED_NAME; - net::TestServer https_server(net::TestServer::TYPE_HTTPS, - https_options, - FilePath(FILE_PATH_LITERAL("chrome/test/data"))); + net::TestServer https_server( + net::TestServer::TYPE_HTTPS, https_options, + base::FilePath(FILE_PATH_LITERAL("chrome/test/data"))); ASSERT_TRUE(https_server.Start()); // The path does not matter. @@ -1802,7 +1802,7 @@ IN_PROC_BROWSER_TEST_F(CaptivePortalBrowserTest, TwoBrokenTabs) { ui_test_utils::NavigateToURLWithDisposition( browser(), URLRequestMockHTTPJob::GetMockUrl( - FilePath(FILE_PATH_LITERAL("title2.html"))), + base::FilePath(FILE_PATH_LITERAL("title2.html"))), NEW_FOREGROUND_TAB, ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); @@ -1866,9 +1866,9 @@ IN_PROC_BROWSER_TEST_F(CaptivePortalBrowserTest, NavigateBrokenTab) { // Navigate the error tab to a non-error page. TabStripModel* tab_strip_model = browser()->tab_strip_model(); tab_strip_model->ActivateTabAt(0, true); - ui_test_utils::NavigateToURL(browser(), - URLRequestMockHTTPJob::GetMockUrl( - FilePath(FILE_PATH_LITERAL("title2.html")))); + ui_test_utils::NavigateToURL( + browser(), URLRequestMockHTTPJob::GetMockUrl( + base::FilePath(FILE_PATH_LITERAL("title2.html")))); EXPECT_EQ(CaptivePortalTabReloader::STATE_NONE, GetStateOfTabReloaderAt(browser(), 0)); @@ -1915,7 +1915,7 @@ IN_PROC_BROWSER_TEST_F(CaptivePortalBrowserTest, RunNavigateLoadingTabToTimeoutTest( browser(), URLRequestMockHTTPJob::GetMockUrl( - FilePath(FILE_PATH_LITERAL("title.html"))), + base::FilePath(FILE_PATH_LITERAL("title.html"))), GURL(kMockHttpsUrl), GURL(kMockHttpsUrl2)); } @@ -1926,7 +1926,7 @@ IN_PROC_BROWSER_TEST_F(CaptivePortalBrowserTest, GoBack) { ui_test_utils::NavigateToURL( browser(), URLRequestMockHTTPJob::GetMockUrl( - FilePath(FILE_PATH_LITERAL("title2.html")))); + base::FilePath(FILE_PATH_LITERAL("title2.html")))); // Go to the error page. SlowLoadBehindCaptivePortal(browser(), true); @@ -1957,9 +1957,9 @@ IN_PROC_BROWSER_TEST_F(CaptivePortalBrowserTest, GoBackToTimeout) { SlowLoadNoCaptivePortal(browser(), RESULT_INTERNET_CONNECTED); // Navigate to a working page. - ui_test_utils::NavigateToURL(browser(), - URLRequestMockHTTPJob::GetMockUrl( - FilePath(FILE_PATH_LITERAL("title2.html")))); + ui_test_utils::NavigateToURL( + browser(), URLRequestMockHTTPJob::GetMockUrl( + base::FilePath(FILE_PATH_LITERAL("title2.html")))); ASSERT_EQ(CaptivePortalTabReloader::STATE_NONE, GetStateOfTabReloaderAt(browser(), 0)); @@ -2158,9 +2158,9 @@ IN_PROC_BROWSER_TEST_F(CaptivePortalBrowserTest, HttpToHttpsRedirectLogin) { // An HTTPS page redirects to an HTTP page. IN_PROC_BROWSER_TEST_F(CaptivePortalBrowserTest, HttpsToHttpRedirect) { // Use an HTTPS server for the top level page. - net::TestServer https_server(net::TestServer::TYPE_HTTPS, - net::TestServer::kLocalhost, - FilePath(FILE_PATH_LITERAL("chrome/test/data"))); + net::TestServer https_server( + net::TestServer::TYPE_HTTPS, net::TestServer::kLocalhost, + base::FilePath(FILE_PATH_LITERAL("chrome/test/data"))); ASSERT_TRUE(https_server.Start()); GURL http_timeout_url = diff --git a/chrome/browser/chrome_browser_main.cc b/chrome/browser/chrome_browser_main.cc index c8ba8c9..53c4a5d 100644 --- a/chrome/browser/chrome_browser_main.cc +++ b/chrome/browser/chrome_browser_main.cc @@ -259,7 +259,7 @@ PrefService* InitializeLocalState( base::SequencedTaskRunner* local_state_task_runner, const CommandLine& parsed_command_line, bool is_first_run) { - FilePath local_state_path; + base::FilePath local_state_path; PathService::Get(chrome::FILE_LOCAL_STATE, &local_state_path); bool local_state_file_exists = file_util::PathExists(local_state_path); @@ -297,7 +297,7 @@ PrefService* InitializeLocalState( // to chrome_prefs::CreateLocalState. if (!local_state_file_exists && parsed_command_line.HasSwitch(switches::kParentProfile)) { - FilePath parent_profile = + base::FilePath parent_profile = parsed_command_line.GetSwitchValuePath(switches::kParentProfile); scoped_refptr<PrefRegistrySimple> registry = new PrefRegistrySimple(); scoped_ptr<PrefService> parent_local_state( @@ -332,8 +332,8 @@ PrefService* InitializeLocalState( // Returns the path that contains the profile that should be loaded // on process startup. -FilePath GetStartupProfilePath(const FilePath& user_data_dir, - const CommandLine& command_line) { +base::FilePath GetStartupProfilePath(const base::FilePath& user_data_dir, + const CommandLine& command_line) { if (command_line.HasSwitch(switches::kProfileDirectory)) { return user_data_dir.Append( command_line.GetSwitchValuePath(switches::kProfileDirectory)); @@ -354,7 +354,7 @@ FilePath GetStartupProfilePath(const FilePath& user_data_dir, // fallback profile. Returns the newly created profile, or NULL if startup // should not continue. Profile* CreateProfile(const content::MainFunctionParams& parameters, - const FilePath& user_data_dir, + const base::FilePath& user_data_dir, const CommandLine& parsed_command_line) { if (ProfileManager::IsMultipleProfilesEnabled() && parsed_command_line.HasSwitch(switches::kProfileDirectory)) { @@ -374,7 +374,7 @@ Profile* CreateProfile(const content::MainFunctionParams& parameters, profile = g_browser_process->profile_manager()->GetDefaultProfile( user_data_dir); #else - FilePath profile_path = + base::FilePath profile_path = GetStartupProfilePath(user_data_dir, parsed_command_line); profile = g_browser_process->profile_manager()->GetProfile( profile_path); @@ -391,7 +391,8 @@ Profile* CreateProfile(const content::MainFunctionParams& parameters, // prompt the user to pick a different user-data-dir and restart chrome // with the new dir. // http://code.google.com/p/chromium/issues/detail?id=11510 - FilePath new_user_data_dir = chrome::ShowUserDataDirDialog(user_data_dir); + base::FilePath new_user_data_dir = + chrome::ShowUserDataDirDialog(user_data_dir); if (!new_user_data_dir.empty()) { // Because of the way CommandLine parses, it's sufficient to append a new @@ -490,8 +491,9 @@ void RegisterComponentsForUpdate(const CommandLine& command_line) { cus->Start(); } -bool ProcessSingletonNotificationCallback(const CommandLine& command_line, - const FilePath& current_directory) { +bool ProcessSingletonNotificationCallback( + const CommandLine& command_line, + const base::FilePath& current_directory) { // Drop the request if the browser process is already in shutdown path. if (!g_browser_process || g_browser_process->IsShuttingDown()) return false; @@ -519,9 +521,9 @@ bool ProcessSingletonNotificationCallback(const CommandLine& command_line, return true; } - FilePath user_data_dir = + base::FilePath user_data_dir = g_browser_process->profile_manager()->user_data_dir(); - FilePath startup_profile_dir = + base::FilePath startup_profile_dir = GetStartupProfilePath(user_data_dir, command_line); StartupBrowserCreator::ProcessCommandLineAlreadyRunning( @@ -829,7 +831,7 @@ int ChromeBrowserMainParts::PreCreateThreadsImpl() { !ProfileManager::IsImportProcess(parsed_command_line()); #endif - FilePath local_state_path; + base::FilePath local_state_path; CHECK(PathService::Get(chrome::FILE_LOCAL_STATE, &local_state_path)); scoped_refptr<base::SequencedTaskRunner> local_state_task_runner = JsonPrefStore::GetTaskRunnerForFile(local_state_path, @@ -910,7 +912,7 @@ int ChromeBrowserMainParts::PreCreateThreadsImpl() { CHECK(!loaded_locale.empty()) << "Locale could not be found for " << locale; browser_process_->SetApplicationLocale(loaded_locale); - FilePath resources_pack_path; + base::FilePath resources_pack_path; PathService::Get(chrome::FILE_RESOURCES_PACK, &resources_pack_path); ResourceBundle::GetSharedInstance().AddDataPackFromPath( resources_pack_path, ui::SCALE_FACTOR_NONE); @@ -1062,7 +1064,7 @@ void ChromeBrowserMainParts::RunPageCycler() { profile_, chrome::HOST_DESKTOP_TYPE_NATIVE); DCHECK(browser); PageCycler* page_cycler = NULL; - FilePath input_file = + base::FilePath input_file = command_line->GetSwitchValuePath(switches::kVisitURLs); page_cycler = new PageCycler(browser, input_file); page_cycler->set_errors_file( @@ -1420,7 +1422,7 @@ int ChromeBrowserMainParts::PreMainMessageLoopRunImpl() { #if defined(OS_WIN) && !defined(GOOGLE_CHROME_BUILD) if (parsed_command_line().HasSwitch(switches::kDebugPrint)) { - FilePath path = + base::FilePath path = parsed_command_line().GetSwitchValuePath(switches::kDebugPrint); printing::PrintedDocument::set_debug_dump_path(path); } @@ -1517,7 +1519,7 @@ int ChromeBrowserMainParts::PreMainMessageLoopRunImpl() { if (!parsed_command_line().HasSwitch(switches::kDisableComponentUpdate)) RegisterComponentsForUpdate(parsed_command_line()); - if (browser_creator_->Start(parsed_command_line(), FilePath(), + if (browser_creator_->Start(parsed_command_line(), base::FilePath(), profile_, last_opened_profiles, &result_code)) { #if defined(OS_WIN) || (defined(OS_LINUX) && !defined(OS_CHROMEOS)) // Initialize autoupdate timer. Timer callback costs basically nothing diff --git a/chrome/browser/chrome_browser_main.h b/chrome/browser/chrome_browser_main.h index 0686e10..9a9d96e 100644 --- a/chrome/browser/chrome_browser_main.h +++ b/chrome/browser/chrome_browser_main.h @@ -183,7 +183,7 @@ class ChromeBrowserMainParts : public content::BrowserMainParts { // PreMainMessageLoopRunThreadsCreated. bool do_first_run_tasks_; PrefService* local_state_; - FilePath user_data_dir_; + base::FilePath user_data_dir_; // Members needed across shutdown methods. bool restart_last_session_; diff --git a/chrome/browser/chrome_browser_main_android.cc b/chrome/browser/chrome_browser_main_android.cc index 8220fac..1c8459d 100644 --- a/chrome/browser/chrome_browser_main_android.cc +++ b/chrome/browser/chrome_browser_main_android.cc @@ -69,7 +69,7 @@ int ChromeBrowserMainPartsAndroid::PreCreateThreads() { const int result = ChromeBrowserMainParts::PreCreateThreads(); // Add devtools_resources.pak which is used in Chromium TestShell. - FilePath paks_path; + base::FilePath paks_path; PathService::Get(ui::DIR_RESOURCE_PAKS_ANDROID, &paks_path); ResourceBundle::GetSharedInstance().AddOptionalDataPackFromPath( paks_path.Append(FILE_PATH_LITERAL("devtools_resources.pak")), diff --git a/chrome/browser/chrome_browser_main_linux.cc b/chrome/browser/chrome_browser_main_linux.cc index 2b89780..ea0d665 100644 --- a/chrome/browser/chrome_browser_main_linux.cc +++ b/chrome/browser/chrome_browser_main_linux.cc @@ -132,7 +132,7 @@ void ChromeBrowserMainPartsLinux::PreProfileInit() { #endif #if !defined(OS_CHROMEOS) - const FilePath kDefaultMtabPath("/etc/mtab"); + const base::FilePath kDefaultMtabPath("/etc/mtab"); removable_device_notifications_linux_ = new chrome::RemovableDeviceNotificationsLinux(kDefaultMtabPath); removable_device_notifications_linux_->Init(); diff --git a/chrome/browser/chrome_browser_main_mac.mm b/chrome/browser/chrome_browser_main_mac.mm index ebfb656..cdbbfcf 100644 --- a/chrome/browser/chrome_browser_main_mac.mm +++ b/chrome/browser/chrome_browser_main_mac.mm @@ -235,7 +235,7 @@ void ChromeBrowserMainPartsMac::PreMainMessageLoopStart() { ResourceBundle::InitSharedInstanceWithLocale(std::string(), NULL); CHECK(!loaded_locale.empty()) << "Default locale could not be found"; - FilePath resources_pack_path; + base::FilePath resources_pack_path; PathService::Get(chrome::FILE_RESOURCES_PACK, &resources_pack_path); ResourceBundle::GetSharedInstance().AddDataPackFromPath( resources_pack_path, ui::SCALE_FACTOR_NONE); diff --git a/chrome/browser/chrome_browser_main_win.cc b/chrome/browser/chrome_browser_main_win.cc index f8a48a5..311b6d5 100644 --- a/chrome/browser/chrome_browser_main_win.cc +++ b/chrome/browser/chrome_browser_main_win.cc @@ -135,7 +135,7 @@ int DoUninstallTasks(bool chrome_still_running) { VLOG(1) << "Executing uninstall actions"; if (!first_run::RemoveSentinel()) VLOG(1) << "Failed to delete sentinel file."; - FilePath chrome_exe; + base::FilePath chrome_exe; if (PathService::Get(base::FILE_EXE, &chrome_exe)) { ShellUtil::ShortcutLocation user_shortcut_locations[] = { ShellUtil::SHORTCUT_LOCATION_DESKTOP, @@ -268,7 +268,7 @@ void ChromeBrowserMainPartsWin::PrepareRestartOnCrashEnviroment( void ChromeBrowserMainPartsWin::RegisterApplicationRestart( const CommandLine& parsed_command_line) { DCHECK(base::win::GetVersion() >= base::win::VERSION_VISTA); - base::ScopedNativeLibrary library(FilePath(L"kernel32.dll")); + base::ScopedNativeLibrary library(base::FilePath(L"kernel32.dll")); // Get the function pointer for RegisterApplicationRestart. RegisterApplicationRestartProc register_application_restart = static_cast<RegisterApplicationRestartProc>( @@ -335,11 +335,11 @@ bool ChromeBrowserMainPartsWin::CheckMachineLevelInstall() { Version version; InstallUtil::GetChromeVersion(dist, true, &version); if (version.IsValid()) { - FilePath exe_path; + base::FilePath exe_path; PathService::Get(base::DIR_EXE, &exe_path); std::wstring exe = exe_path.value(); - FilePath user_exe_path(installer::GetChromeInstallPath(false, dist)); - if (FilePath::CompareEqualIgnoreCase(exe, user_exe_path.value())) { + base::FilePath user_exe_path(installer::GetChromeInstallPath(false, dist)); + if (base::FilePath::CompareEqualIgnoreCase(exe, user_exe_path.value())) { bool is_metro = base::win::IsMetroProcess(); if (!is_metro) { // The dialog cannot be shown in Win8 Metro as doing so hangs Chrome on @@ -360,7 +360,7 @@ bool ChromeBrowserMainPartsWin::CheckMachineLevelInstall() { uninstall_cmd.AppendSwitch( installer::switches::kDoNotRemoveSharedItems); - const FilePath setup_exe(uninstall_cmd.GetProgram()); + const base::FilePath setup_exe(uninstall_cmd.GetProgram()); const string16 params(uninstall_cmd.GetArgumentsString()); SHELLEXECUTEINFO sei = { sizeof(sei) }; diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc index ed55104..c444962 100644 --- a/chrome/browser/chrome_content_browser_client.cc +++ b/chrome/browser/chrome_content_browser_client.cc @@ -1072,7 +1072,7 @@ void ChromeContentBrowserClient::AppendExtraCommandLineSwitches( command_line->GetSwitchValueASCII(switches::kProcessType); const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess(); if (process_type == switches::kRendererProcess) { - FilePath user_data_dir = + base::FilePath user_data_dir = browser_command_line.GetSwitchValuePath(switches::kUserDataDir); if (!user_data_dir.empty()) command_line->AppendSwitchPath(switches::kUserDataDir, user_data_dir); @@ -1893,7 +1893,7 @@ void ChromeContentBrowserClient::ClearCookies(RenderViewHost* rvh) { // BrowsingDataRemover takes care of deleting itself when done. } -FilePath ChromeContentBrowserClient::GetDefaultDownloadDirectory() { +base::FilePath ChromeContentBrowserClient::GetDefaultDownloadDirectory() { return download_util::GetDefaultDownloadDirectory(); } @@ -1978,8 +1978,8 @@ bool ChromeContentBrowserClient::AllowPepperSocketAPI( return false; } -FilePath ChromeContentBrowserClient::GetHyphenDictionaryDirectory() { - FilePath directory; +base::FilePath ChromeContentBrowserClient::GetHyphenDictionaryDirectory() { + base::FilePath directory; PathService::Get(chrome::DIR_APP_DICTIONARIES, &directory); return directory.Append(FILE_PATH_LITERAL("Hyphen")); } @@ -1995,19 +1995,19 @@ void ChromeContentBrowserClient::GetAdditionalMappedFilesForChildProcess( int child_process_id, std::vector<FileDescriptorInfo>* mappings) { #if defined(OS_ANDROID) - FilePath data_path; + base::FilePath data_path; PathService::Get(ui::DIR_RESOURCE_PAKS_ANDROID, &data_path); DCHECK(!data_path.empty()); int flags = base::PLATFORM_FILE_OPEN | base::PLATFORM_FILE_READ; - FilePath chrome_pak = data_path.AppendASCII("chrome.pak"); + base::FilePath chrome_pak = data_path.AppendASCII("chrome.pak"); base::PlatformFile f = base::CreatePlatformFile(chrome_pak, flags, NULL, NULL); DCHECK(f != base::kInvalidPlatformFileValue); mappings->push_back(FileDescriptorInfo(kAndroidChromePakDescriptor, FileDescriptor(f, true))); - FilePath chrome_resources_pak = + base::FilePath chrome_resources_pak = data_path.AppendASCII("chrome_100_percent.pak"); f = base::CreatePlatformFile(chrome_resources_pak, flags, NULL, NULL); DCHECK(f != base::kInvalidPlatformFileValue); @@ -2015,14 +2015,14 @@ void ChromeContentBrowserClient::GetAdditionalMappedFilesForChildProcess( FileDescriptor(f, true))); const std::string locale = GetApplicationLocale(); - FilePath locale_pak = ResourceBundle::GetSharedInstance(). + base::FilePath locale_pak = ResourceBundle::GetSharedInstance(). GetLocaleFilePath(locale, false); f = base::CreatePlatformFile(locale_pak, flags, NULL, NULL); DCHECK(f != base::kInvalidPlatformFileValue); mappings->push_back(FileDescriptorInfo(kAndroidLocalePakDescriptor, FileDescriptor(f, true))); - FilePath resources_pack_path; + base::FilePath resources_pack_path; PathService::Get(chrome::FILE_RESOURCES_PACK, &resources_pack_path); f = base::CreatePlatformFile(resources_pack_path, flags, NULL, NULL); DCHECK(f != base::kInvalidPlatformFileValue); diff --git a/chrome/browser/chrome_content_browser_client.h b/chrome/browser/chrome_content_browser_client.h index b92f510..029b83d 100644 --- a/chrome/browser/chrome_content_browser_client.h +++ b/chrome/browser/chrome_content_browser_client.h @@ -223,7 +223,7 @@ class ChromeContentBrowserClient : public content::ContentBrowserClient { content::BrowserURLHandler* handler) OVERRIDE; virtual void ClearCache(content::RenderViewHost* rvh) OVERRIDE; virtual void ClearCookies(content::RenderViewHost* rvh) OVERRIDE; - virtual FilePath GetDefaultDownloadDirectory() OVERRIDE; + virtual base::FilePath GetDefaultDownloadDirectory() OVERRIDE; virtual std::string GetDefaultDownloadName() OVERRIDE; virtual void DidCreatePpapiPlugin( content::BrowserPpapiHost* browser_host) OVERRIDE; @@ -233,7 +233,7 @@ class ChromeContentBrowserClient : public content::ContentBrowserClient { content::BrowserContext* browser_context, const GURL& url, const content::SocketPermissionRequest& params) OVERRIDE; - virtual FilePath GetHyphenDictionaryDirectory() OVERRIDE; + virtual base::FilePath GetHyphenDictionaryDirectory() OVERRIDE; virtual ui::SelectFilePolicy* CreateSelectFilePolicy( content::WebContents* web_contents) OVERRIDE; diff --git a/chrome/browser/chrome_main_browsertest.cc b/chrome/browser/chrome_main_browsertest.cc index 7869654..bd61b98 100644 --- a/chrome/browser/chrome_main_browsertest.cc +++ b/chrome/browser/chrome_main_browsertest.cc @@ -46,8 +46,8 @@ IN_PROC_BROWSER_TEST_F(ChromeMainTest, SecondLaunch) { } IN_PROC_BROWSER_TEST_F(ChromeMainTest, ReuseBrowserInstanceWhenOpeningFile) { - FilePath test_file_path = ui_test_utils::GetTestFilePath( - FilePath(), FilePath().AppendASCII("empty.html")); + base::FilePath test_file_path = ui_test_utils::GetTestFilePath( + base::FilePath(), base::FilePath().AppendASCII("empty.html")); CommandLine new_command_line(GetCommandLineForRelaunch()); new_command_line.AppendArgPath(test_file_path); content::WindowedNotificationObserver observer( @@ -75,8 +75,8 @@ IN_PROC_BROWSER_TEST_F(ChromeMainTest, MAYBE_SecondLaunchWithIncognitoUrl) { ASSERT_EQ(1u, chrome::GetTabbedBrowserCount(browser()->profile())); // Run with --incognito switch and an URL specified. - FilePath test_file_path = ui_test_utils::GetTestFilePath( - FilePath(), FilePath().AppendASCII("empty.html")); + base::FilePath test_file_path = ui_test_utils::GetTestFilePath( + base::FilePath(), base::FilePath().AppendASCII("empty.html")); CommandLine new_command_line(GetCommandLineForRelaunch()); new_command_line.AppendSwitch(switches::kIncognito); new_command_line.AppendArgPath(test_file_path); @@ -115,8 +115,8 @@ IN_PROC_BROWSER_TEST_F(ChromeMainTest, SecondLaunchFromIncognitoWithNormalUrl) { ASSERT_EQ(0u, chrome::GetTabbedBrowserCount(profile)); // Run with just an URL specified, no --incognito switch. - FilePath test_file_path = ui_test_utils::GetTestFilePath( - FilePath(), FilePath().AppendASCII("empty.html")); + base::FilePath test_file_path = ui_test_utils::GetTestFilePath( + base::FilePath(), base::FilePath().AppendASCII("empty.html")); CommandLine new_command_line(GetCommandLineForRelaunch()); new_command_line.AppendArgPath(test_file_path); content::WindowedNotificationObserver tab_observer( diff --git a/chrome/browser/chrome_plugin_browsertest.cc b/chrome/browser/chrome_plugin_browsertest.cc index 6257b5e..2929783 100644 --- a/chrome/browser/chrome_plugin_browsertest.cc +++ b/chrome/browser/chrome_plugin_browsertest.cc @@ -74,7 +74,7 @@ class ChromePluginTest : public InProcessBrowserTest { ChromePluginTest() {} static GURL GetURL(const char* filename) { - FilePath path; + base::FilePath path; PathService::Get(content::DIR_TEST_DATA, &path); path = path.AppendASCII("plugin").AppendASCII(filename); CHECK(file_util::PathExists(path)); @@ -103,7 +103,7 @@ class ChromePluginTest : public InProcessBrowserTest { runner->Run(); } - static void GetFlashPath(std::vector<FilePath>* paths) { + static void GetFlashPath(std::vector<base::FilePath>* paths) { paths->clear(); std::vector<webkit::WebPluginInfo> plugins = GetPlugins(); for (std::vector<webkit::WebPluginInfo>::const_iterator it = @@ -124,7 +124,7 @@ class ChromePluginTest : public InProcessBrowserTest { } static void EnableFlash(bool enable, Profile* profile) { - std::vector<FilePath> paths; + std::vector<base::FilePath> paths; GetFlashPath(&paths); ASSERT_FALSE(paths.empty()); @@ -133,7 +133,7 @@ class ChromePluginTest : public InProcessBrowserTest { new content::MessageLoopRunner; scoped_refptr<CallbackBarrier> callback_barrier( new CallbackBarrier(runner->QuitClosure())); - for (std::vector<FilePath>::iterator iter = paths.begin(); + for (std::vector<base::FilePath>::iterator iter = paths.begin(); iter != paths.end(); ++iter) { plugin_prefs->EnablePlugin(enable, *iter, callback_barrier->CreateCallback()); @@ -193,7 +193,7 @@ class ChromePluginTest : public InProcessBrowserTest { IN_PROC_BROWSER_TEST_F(ChromePluginTest, DISABLED_Flash) { // Official builds always have bundled Flash. #if !defined(OFFICIAL_BUILD) - std::vector<FilePath> flash_paths; + std::vector<base::FilePath> flash_paths; GetFlashPath(&flash_paths); if (flash_paths.empty()) { LOG(INFO) << "Test not running because couldn't find Flash."; diff --git a/chrome/browser/chrome_to_mobile_service.cc b/chrome/browser/chrome_to_mobile_service.cc index 59ecee0..ea6a67a 100644 --- a/chrome/browser/chrome_to_mobile_service.cc +++ b/chrome/browser/chrome_to_mobile_service.cc @@ -164,13 +164,14 @@ GURL GetSubmitURL(const GURL& cloud_print_url) { } // A callback to continue snapshot generation after creating the temp file. -typedef base::Callback<void(const FilePath& path)> CreateSnapshotFileCallback; +typedef base::Callback<void(const base::FilePath& path)> + CreateSnapshotFileCallback; // Create a temp file and post the callback on the UI thread with the results. // Call this as a BlockingPoolTask to avoid the FILE thread. void CreateSnapshotFile(CreateSnapshotFileCallback callback) { DCHECK(!content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); - FilePath file; + base::FilePath file; if (!file_util::CreateTemporaryFile(&file)) file.clear(); if (!content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE, @@ -200,7 +201,7 @@ void ReadSnapshotFile(scoped_ptr<ChromeToMobileService::JobData> data, // Delete the snapshot file; DCHECK, but really ignore the result of the delete. // Call this as a BlockingPoolSequencedTask [after posting SubmitSnapshotFile]. -void DeleteSnapshotFile(const FilePath& snapshot) { +void DeleteSnapshotFile(const base::FilePath& snapshot) { DCHECK(!content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); bool success = file_util::Delete(snapshot, false); DCHECK(success); @@ -309,7 +310,7 @@ void ChromeToMobileService::GenerateSnapshot(Browser* browser, } void ChromeToMobileService::SendToMobile(const base::DictionaryValue* mobile, - const FilePath& snapshot, + const base::FilePath& snapshot, Browser* browser, base::WeakPtr<Observer> observer) { DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); @@ -354,7 +355,7 @@ void ChromeToMobileService::SendToMobile(const base::DictionaryValue* mobile, } } -void ChromeToMobileService::DeleteSnapshot(const FilePath& snapshot) { +void ChromeToMobileService::DeleteSnapshot(const base::FilePath& snapshot) { DCHECK(snapshot.empty() || snapshots_.find(snapshot) != snapshots_.end()); if (snapshots_.find(snapshot) != snapshots_.end()) { if (!snapshot.empty()) { @@ -493,7 +494,7 @@ void ChromeToMobileService::SetAccessTokenForTest( void ChromeToMobileService::SnapshotFileCreated( base::WeakPtr<Observer> observer, SessionID::id_type browser_id, - const FilePath& path) { + const base::FilePath& path) { DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); // Track the set of temporary files to be deleted later. snapshots_.insert(path); @@ -506,12 +507,12 @@ void ChromeToMobileService::SnapshotFileCreated( base::Bind(&ChromeToMobileService::SnapshotGenerated, weak_ptr_factory_.GetWeakPtr(), observer)); } else { - SnapshotGenerated(observer, FilePath(), 0); + SnapshotGenerated(observer, base::FilePath(), 0); } } void ChromeToMobileService::SnapshotGenerated(base::WeakPtr<Observer> observer, - const FilePath& path, + const base::FilePath& path, int64 bytes) { LogMetric(bytes > 0 ? SNAPSHOT_GENERATED : SNAPSHOT_ERROR); if (observer.get()) diff --git a/chrome/browser/chrome_to_mobile_service.h b/chrome/browser/chrome_to_mobile_service.h index 9701de8..9ab92cb 100644 --- a/chrome/browser/chrome_to_mobile_service.h +++ b/chrome/browser/chrome_to_mobile_service.h @@ -52,7 +52,7 @@ class ChromeToMobileService : public ProfileKeyedService, virtual ~Observer(); // Called on generation of the page's MHTML snapshot. - virtual void SnapshotGenerated(const FilePath& path, int64 bytes) = 0; + virtual void SnapshotGenerated(const base::FilePath& path, int64 bytes) = 0; // Called after URLFetcher responses from sending the URL (and snapshot). virtual void OnSendComplete(bool success) = 0; @@ -80,7 +80,7 @@ class ChromeToMobileService : public ProfileKeyedService, string16 mobile_id; GURL url; string16 title; - FilePath snapshot; + base::FilePath snapshot; std::string snapshot_id; std::string snapshot_content; JobType type; @@ -120,13 +120,13 @@ class ChromeToMobileService : public ProfileKeyedService, // Send the browser's selected WebContents to the specified mobile device. // Virtual for unit test mocking. virtual void SendToMobile(const base::DictionaryValue* mobile, - const FilePath& snapshot, + const base::FilePath& snapshot, Browser* browser, base::WeakPtr<Observer> observer); // Delete the snapshot file (should be called on observer destruction). // Virtual for unit test mocking. - virtual void DeleteSnapshot(const FilePath& snapshot); + virtual void DeleteSnapshot(const base::FilePath& snapshot); // Opens the "Learn More" help article link in the supplied |browser|. void LearnMore(Browser* browser) const; @@ -163,11 +163,11 @@ class ChromeToMobileService : public ProfileKeyedService, // Handle the attempted creation of a temporary file for snapshot generation. void SnapshotFileCreated(base::WeakPtr<Observer> observer, SessionID::id_type browser_id, - const FilePath& path); + const base::FilePath& path); // Handle the attempted MHTML snapshot generation; alerts the observer. void SnapshotGenerated(base::WeakPtr<Observer> observer, - const FilePath& path, + const base::FilePath& path, int64 bytes); // Handle the attempted reading of the snapshot file for job submission. @@ -210,7 +210,7 @@ class ChromeToMobileService : public ProfileKeyedService, std::string access_token_; // The set of snapshots currently available. - std::set<FilePath> snapshots_; + std::set<base::FilePath> snapshots_; // The list of active URLFetcher requests owned by the service. ScopedVector<net::URLFetcher> url_fetchers_; diff --git a/chrome/browser/chromeos/accessibility/accessibility_util.cc b/chrome/browser/chromeos/accessibility/accessibility_util.cc index 778b1cb..c74c655 100644 --- a/chrome/browser/chromeos/accessibility/accessibility_util.cc +++ b/chrome/browser/chromeos/accessibility/accessibility_util.cc @@ -168,7 +168,7 @@ void EnableSpokenFeedback(bool enabled, ProfileManager::GetDefaultProfile(); ExtensionService* extension_service = extensions::ExtensionSystem::Get(profile)->extension_service(); - FilePath path = FilePath(extension_misc::kChromeVoxExtensionPath); + base::FilePath path = base::FilePath(extension_misc::kChromeVoxExtensionPath); if (enabled) { // Load ChromeVox std::string extension_id = extension_service->component_loader()->Add(IDR_CHROMEVOX_MANIFEST, diff --git a/chrome/browser/chromeos/boot_times_loader.cc b/chrome/browser/chromeos/boot_times_loader.cc index 027d722..8e522d4 100644 --- a/chrome/browser/chromeos/boot_times_loader.cc +++ b/chrome/browser/chromeos/boot_times_loader.cc @@ -89,23 +89,24 @@ namespace chromeos { #define FPL(value) FILE_PATH_LITERAL(value) // Dir uptime & disk logs are located in. -static const FilePath::CharType kLogPath[] = FPL("/tmp"); +static const base::FilePath::CharType kLogPath[] = FPL("/tmp"); // Dir log{in,out} logs are located in. -static const FilePath::CharType kLoginLogPath[] = FPL("/home/chronos/user"); +static const base::FilePath::CharType kLoginLogPath[] = + FPL("/home/chronos/user"); // Prefix for the time measurement files. -static const FilePath::CharType kUptimePrefix[] = FPL("uptime-"); +static const base::FilePath::CharType kUptimePrefix[] = FPL("uptime-"); // Prefix for the disk usage files. -static const FilePath::CharType kDiskPrefix[] = FPL("disk-"); +static const base::FilePath::CharType kDiskPrefix[] = FPL("disk-"); // Name of the time that Chrome's main() is called. -static const FilePath::CharType kChromeMain[] = FPL("chrome-main"); +static const base::FilePath::CharType kChromeMain[] = FPL("chrome-main"); // Delay in milliseconds between file read attempts. static const int64 kReadAttemptDelayMs = 250; // Delay in milliseconds before writing the login times to disk. static const int64 kLoginTimeWriteDelayMs = 3000; // Names of login stats files. -static const FilePath::CharType kLoginSuccess[] = FPL("login-success"); -static const FilePath::CharType kChromeFirstRender[] = +static const base::FilePath::CharType kLoginSuccess[] = FPL("login-success"); +static const base::FilePath::CharType kChromeFirstRender[] = FPL("chrome-first-render"); // Names of login UMA values. @@ -115,7 +116,7 @@ static const char kUmaLogout[] = "ShutdownTime.Logout"; static const char kUmaLogoutPrefix[] = "ShutdownTime."; // Name of file collecting login times. -static const FilePath::CharType kLoginTimes[] = FPL("login-times"); +static const base::FilePath::CharType kLoginTimes[] = FPL("login-times"); // Name of file collecting logout times. static const char kLogoutTimes[] = "logout-times"; @@ -169,9 +170,9 @@ CancelableTaskTracker::TaskId BootTimesLoader::GetBootTimes( // Extracts the uptime value from files located in /tmp, returning the // value as a double in value. -static bool GetTime(const FilePath::StringType& log, double* value) { - FilePath log_dir(kLogPath); - FilePath log_file = log_dir.Append(log); +static bool GetTime(const base::FilePath::StringType& log, double* value) { + base::FilePath log_dir(kLogPath); + base::FilePath log_file = log_dir.Append(log); std::string contents; *value = 0.0; if (file_util::ReadFileToString(log_file, &contents)) { @@ -196,9 +197,9 @@ static void SendBootTimesToUMA(const BootTimesLoader::BootTimes& boot_times) { // Checks if the times for the most recent boot event have been // reported already to avoid sending boot time histogram samples // every time the user logs out. - static const FilePath::CharType kBootTimesSent[] = + static const base::FilePath::CharType kBootTimesSent[] = FPL("/tmp/boot-times-sent"); - FilePath sent(kBootTimesSent); + base::FilePath sent(kBootTimesSent); if (file_util::PathExists(sent)) return; @@ -238,17 +239,19 @@ void BootTimesLoader::Backend::GetBootTimesAndRunCallback( if (is_canceled_cb.Run()) return; - const FilePath::CharType kFirmwareBootTime[] = FPL("firmware-boot-time"); - const FilePath::CharType kPreStartup[] = FPL("pre-startup"); - const FilePath::CharType kChromeExec[] = FPL("chrome-exec"); - const FilePath::CharType kChromeMain[] = FPL("chrome-main"); - const FilePath::CharType kXStarted[] = FPL("x-started"); - const FilePath::CharType kLoginPromptReady[] = FPL("login-prompt-ready"); - const FilePath::StringType uptime_prefix = kUptimePrefix; + const base::FilePath::CharType kFirmwareBootTime[] = + FPL("firmware-boot-time"); + const base::FilePath::CharType kPreStartup[] = FPL("pre-startup"); + const base::FilePath::CharType kChromeExec[] = FPL("chrome-exec"); + const base::FilePath::CharType kChromeMain[] = FPL("chrome-main"); + const base::FilePath::CharType kXStarted[] = FPL("x-started"); + const base::FilePath::CharType kLoginPromptReady[] = + FPL("login-prompt-ready"); + const base::FilePath::StringType uptime_prefix = kUptimePrefix; // Wait until firmware-boot-time file exists by reposting. - FilePath log_dir(kLogPath); - FilePath log_file = log_dir.Append(kFirmwareBootTime); + base::FilePath log_dir(kLogPath); + base::FilePath log_file = log_dir.Append(kFirmwareBootTime); if (!file_util::PathExists(log_file)) { BrowserThread::PostDelayedTask( BrowserThread::FILE, @@ -284,7 +287,7 @@ void BootTimesLoader::Backend::GetBootTimesAndRunCallback( // Appends the given buffer into the file. Returns the number of bytes // written, or -1 on error. // TODO(satorux): Move this to file_util. -static int AppendFile(const FilePath& file_path, +static int AppendFile(const base::FilePath& file_path, const char* data, int size) { FILE* file = file_util::OpenFile(file_path, "a"); @@ -296,13 +299,14 @@ static int AppendFile(const FilePath& file_path, return num_bytes_written; } -static void RecordStatsDelayed(const FilePath::StringType& name, +static void RecordStatsDelayed(const base::FilePath::StringType& name, const std::string& uptime, const std::string& disk) { - const FilePath log_path(kLogPath); - const FilePath uptime_output = - log_path.Append(FilePath(kUptimePrefix + name)); - const FilePath disk_output = log_path.Append(FilePath(kDiskPrefix + name)); + const base::FilePath log_path(kLogPath); + const base::FilePath uptime_output = + log_path.Append(base::FilePath(kUptimePrefix + name)); + const base::FilePath disk_output = + log_path.Append(base::FilePath(kDiskPrefix + name)); // Append numbers to the files. AppendFile(uptime_output, uptime.data(), uptime.size()); @@ -318,7 +322,7 @@ void BootTimesLoader::WriteTimes( const int kMinTimeMillis = 1; const int kMaxTimeMillis = 30000; const int kNumBuckets = 100; - const FilePath log_path(kLoginLogPath); + const base::FilePath log_path(kLoginLogPath); // Need to sort by time since the entries may have been pushed onto the // vector (on the UI thread) in a different order from which they were @@ -412,8 +416,8 @@ void BootTimesLoader::RecordStats(const std::string& name, const Stats& stats) { } BootTimesLoader::Stats BootTimesLoader::GetCurrentStats() { - const FilePath kProcUptime(FPL("/proc/uptime")); - const FilePath kDiskStat(FPL("/sys/block/sda/stat")); + const base::FilePath kProcUptime(FPL("/proc/uptime")); + const base::FilePath kDiskStat(FPL("/sys/block/sda/stat")); Stats stats; base::ThreadRestrictions::ScopedAllowIO allow_io; file_util::ReadFileToString(kProcUptime, &stats.uptime); diff --git a/chrome/browser/chromeos/camera_detector.cc b/chrome/browser/chromeos/camera_detector.cc index 54615ee..dd85767 100644 --- a/chrome/browser/chromeos/camera_detector.cc +++ b/chrome/browser/chromeos/camera_detector.cc @@ -68,9 +68,9 @@ bool CameraDetector::CheckPresence() { // device may trigger costly device initialization. using file_util::FileEnumerator; FileEnumerator file_enum( - FilePath(kV4LSubsystemDir), false /* not recursive */, + base::FilePath(kV4LSubsystemDir), false /* not recursive */, FileEnumerator::FILES | FileEnumerator::SHOW_SYM_LINKS); - for (FilePath path = file_enum.Next(); !path.empty(); + for (base::FilePath path = file_enum.Next(); !path.empty(); path = file_enum.Next()) { std::string v4l_capabilities; if (chrome::GetUdevDevicePropertyValueByPath( diff --git a/chrome/browser/chromeos/chrome_browser_main_chromeos.cc b/chrome/browser/chromeos/chrome_browser_main_chromeos.cc index 2636cf9..7df0c70 100644 --- a/chrome/browser/chromeos/chrome_browser_main_chromeos.cc +++ b/chrome/browser/chromeos/chrome_browser_main_chromeos.cc @@ -770,7 +770,7 @@ void ChromeBrowserMainPartsChromeos::SetupLowMemoryHeadroomFieldTrial() { void ChromeBrowserMainPartsChromeos::SetupZramFieldTrial() { // The dice for this experiment have been thrown at boot. The selected group // number is stored in a file. - const FilePath kZramGroupPath("/home/chronos/.swap_exp_enrolled"); + const base::FilePath kZramGroupPath("/home/chronos/.swap_exp_enrolled"); std::string zram_file_content; // If the file does not exist, the experiment has not started. if (!file_util::ReadFileToString(kZramGroupPath, &zram_file_content)) diff --git a/chrome/browser/chromeos/contacts/contact_database.cc b/chrome/browser/chromeos/contacts/contact_database.cc index 0de9835..d727a30 100644 --- a/chrome/browser/chromeos/contacts/contact_database.cc +++ b/chrome/browser/chromeos/contacts/contact_database.cc @@ -70,7 +70,7 @@ void ContactDatabase::DestroyOnUIThread() { base::Unretained(this))); } -void ContactDatabase::Init(const FilePath& database_dir, +void ContactDatabase::Init(const base::FilePath& database_dir, InitCallback callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); bool* success = new bool(false); @@ -168,7 +168,7 @@ void ContactDatabase::RunLoadCallback( callback.Run(*success, contacts.Pass(), metadata.Pass()); } -void ContactDatabase::InitFromTaskRunner(const FilePath& database_dir, +void ContactDatabase::InitFromTaskRunner(const base::FilePath& database_dir, bool* success) { DCHECK(IsRunByTaskRunner()); DCHECK(success); diff --git a/chrome/browser/chromeos/contacts/contact_database.h b/chrome/browser/chromeos/contacts/contact_database.h index e74e7ef..053f8da 100644 --- a/chrome/browser/chromeos/contacts/contact_database.h +++ b/chrome/browser/chromeos/contacts/contact_database.h @@ -48,7 +48,8 @@ class ContactDatabaseInterface { // Asynchronously initializes the object. |callback| will be invoked on the // UI thread when complete. - virtual void Init(const FilePath& database_dir, InitCallback callback) = 0; + virtual void Init(const base::FilePath& database_dir, + InitCallback callback) = 0; // Asynchronously saves |contacts_to_save| and |metadata| to the database and // removes contacts with IDs contained in |contact_ids_to_delete|. If @@ -76,7 +77,7 @@ class ContactDatabase : public ContactDatabaseInterface { // ContactDatabaseInterface implementation. virtual void DestroyOnUIThread() OVERRIDE; - virtual void Init(const FilePath& database_dir, + virtual void Init(const base::FilePath& database_dir, InitCallback callback) OVERRIDE; virtual void SaveContacts(scoped_ptr<ContactPointers> contacts_to_save, scoped_ptr<ContactIds> contact_ids_to_delete, @@ -107,7 +108,7 @@ class ContactDatabase : public ContactDatabaseInterface { scoped_ptr<UpdateMetadata> metadata); // Initializes the database in |database_dir| and updates |success|. - void InitFromTaskRunner(const FilePath& database_dir, bool* success); + void InitFromTaskRunner(const base::FilePath& database_dir, bool* success); // Saves data to disk and updates |success|. void SaveContactsFromTaskRunner(scoped_ptr<ContactPointers> contacts_to_save, diff --git a/chrome/browser/chromeos/contacts/contact_database_unittest.cc b/chrome/browser/chromeos/contacts/contact_database_unittest.cc index 08e09cd..96e2768 100644 --- a/chrome/browser/chromeos/contacts/contact_database_unittest.cc +++ b/chrome/browser/chromeos/contacts/contact_database_unittest.cc @@ -27,7 +27,7 @@ namespace test { // Name of the directory created within a temporary directory to store the // contacts database. -const FilePath::CharType kDatabaseDirectoryName[] = +const base::FilePath::CharType kDatabaseDirectoryName[] = FILE_PATH_LITERAL("contacts"); class ContactDatabaseTest : public testing::Test { @@ -52,7 +52,7 @@ class ContactDatabaseTest : public testing::Test { } protected: - FilePath database_path() const { + base::FilePath database_path() const { return temp_dir_.path().Append(kDatabaseDirectoryName); } @@ -316,7 +316,7 @@ TEST_F(ContactDatabaseTest, DeleteWhenCorrupt) { // Overwrite all of the files in the database with a space character. file_util::FileEnumerator enumerator( database_path(), false, file_util::FileEnumerator::FILES); - for (FilePath path = enumerator.Next(); !path.empty(); + for (base::FilePath path = enumerator.Next(); !path.empty(); path = enumerator.Next()) { file_util::WriteFile(path, " ", 1); } diff --git a/chrome/browser/chromeos/contacts/fake_contact_database.cc b/chrome/browser/chromeos/contacts/fake_contact_database.cc index 0ce9aab..00b30b8 100644 --- a/chrome/browser/chromeos/contacts/fake_contact_database.cc +++ b/chrome/browser/chromeos/contacts/fake_contact_database.cc @@ -19,7 +19,7 @@ FakeContactDatabase::FakeContactDatabase() DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); } -void FakeContactDatabase::Init(const FilePath& database_dir, +void FakeContactDatabase::Init(const base::FilePath& database_dir, InitCallback callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); callback.Run(init_success_); diff --git a/chrome/browser/chromeos/contacts/fake_contact_database.h b/chrome/browser/chromeos/contacts/fake_contact_database.h index bcadc4e..9263ef6 100644 --- a/chrome/browser/chromeos/contacts/fake_contact_database.h +++ b/chrome/browser/chromeos/contacts/fake_contact_database.h @@ -34,7 +34,7 @@ class FakeContactDatabase : public ContactDatabaseInterface { // ContactDatabaseInterface implementation. virtual void DestroyOnUIThread() OVERRIDE; - virtual void Init(const FilePath& database_dir, + virtual void Init(const base::FilePath& database_dir, InitCallback callback) OVERRIDE; virtual void SaveContacts(scoped_ptr<ContactPointers> contacts_to_save, scoped_ptr<ContactIds> contact_ids_to_delete, diff --git a/chrome/browser/chromeos/contacts/google_contact_store.cc b/chrome/browser/chromeos/contacts/google_contact_store.cc index 43b6a71..ee46ac1 100644 --- a/chrome/browser/chromeos/contacts/google_contact_store.cc +++ b/chrome/browser/chromeos/contacts/google_contact_store.cc @@ -27,7 +27,7 @@ namespace { // Name of the directory within the profile directory where the contact database // is stored. -const FilePath::CharType kDatabaseDirectoryName[] = +const base::FilePath::CharType kDatabaseDirectoryName[] = FILE_PATH_LITERAL("Google Contacts"); // We wait this long after the last update has completed successfully before @@ -125,7 +125,7 @@ void GoogleContactStore::Init() { gdata_service_->Initialize(); } - FilePath db_path = profile_->GetPath().Append(kDatabaseDirectoryName); + base::FilePath db_path = profile_->GetPath().Append(kDatabaseDirectoryName); VLOG(1) << "Initializing contact database \"" << db_path.value() << "\" for " << profile_->GetProfileName(); db_->Init(db_path, diff --git a/chrome/browser/chromeos/cros/burn_library.cc b/chrome/browser/chromeos/cros/burn_library.cc index 24213c61..30da2af 100644 --- a/chrome/browser/chromeos/cros/burn_library.cc +++ b/chrome/browser/chromeos/cros/burn_library.cc @@ -20,7 +20,7 @@ namespace { // Unzips |source_zip_file| and sets the filename of the unzipped image to // |source_image_file|. -void UnzipImage(const FilePath& source_zip_file, +void UnzipImage(const base::FilePath& source_zip_file, const std::string& image_name, scoped_refptr<base::RefCountedString> source_image_file) { if (zip::Unzip(source_zip_file, source_zip_file.DirName())) { @@ -37,10 +37,10 @@ class BurnLibraryImpl : public BurnLibrary { // BurnLibrary implementation. virtual void AddObserver(Observer* observer) OVERRIDE; virtual void RemoveObserver(Observer* observer) OVERRIDE; - virtual void DoBurn(const FilePath& source_path, + virtual void DoBurn(const base::FilePath& source_path, const std::string& image_name, - const FilePath& target_file_path, - const FilePath& target_device_path) OVERRIDE; + const base::FilePath& target_file_path, + const base::FilePath& target_device_path) OVERRIDE; virtual void CancelBurnImage() OVERRIDE; void OnImageUnzipped(scoped_refptr<base::RefCountedString> source_image_file); @@ -112,10 +112,10 @@ void BurnLibraryImpl::CancelBurnImage() { cancelled_ = true; } -void BurnLibraryImpl::DoBurn(const FilePath& source_path, +void BurnLibraryImpl::DoBurn(const base::FilePath& source_path, const std::string& image_name, - const FilePath& target_file_path, - const FilePath& target_device_path) { + const base::FilePath& target_file_path, + const base::FilePath& target_device_path) { if (unzipping_) { // We have unzip in progress, maybe it was "cancelled" before and did not // finish yet. In that case, let's pretend cancel did not happen. @@ -230,10 +230,10 @@ class BurnLibraryStubImpl : public BurnLibrary { virtual void Init() OVERRIDE {} virtual void AddObserver(Observer* observer) OVERRIDE {} virtual void RemoveObserver(Observer* observer) OVERRIDE {} - virtual void DoBurn(const FilePath& source_path, + virtual void DoBurn(const base::FilePath& source_path, const std::string& image_name, - const FilePath& target_file_path, - const FilePath& target_device_path) OVERRIDE { + const base::FilePath& target_file_path, + const base::FilePath& target_device_path) OVERRIDE { } virtual void CancelBurnImage() OVERRIDE {} diff --git a/chrome/browser/chromeos/cros/burn_library.h b/chrome/browser/chromeos/cros/burn_library.h index b617aa4..202178e 100644 --- a/chrome/browser/chromeos/cros/burn_library.h +++ b/chrome/browser/chromeos/cros/burn_library.h @@ -51,10 +51,10 @@ class BurnLibrary { virtual void RemoveObserver(Observer* observer) = 0; // Example values: // DoBurn(image.bin.zip, image.bin, /dev/sdb, /sys/devices/pci..../block.sdb). - virtual void DoBurn(const FilePath& source_path, + virtual void DoBurn(const base::FilePath& source_path, const std::string& image_name, - const FilePath& target_file_path, - const FilePath& target_device_path) = 0; + const base::FilePath& target_file_path, + const base::FilePath& target_device_path) = 0; virtual void CancelBurnImage() = 0; // Factory function, creates a new instance and returns ownership. diff --git a/chrome/browser/chromeos/customization_document.cc b/chrome/browser/chromeos/customization_document.cc index 052ef2a..bad0dc9 100644 --- a/chrome/browser/chromeos/customization_document.cc +++ b/chrome/browser/chromeos/customization_document.cc @@ -80,7 +80,7 @@ CustomizationDocument::CustomizationDocument( CustomizationDocument::~CustomizationDocument() {} bool CustomizationDocument::LoadManifestFromFile( - const FilePath& manifest_path) { + const base::FilePath& manifest_path) { std::string manifest; if (!file_util::ReadFileToString(manifest_path, &manifest)) return false; @@ -146,7 +146,7 @@ StartupCustomizationDocument::StartupCustomizationDocument() // Loading manifest causes us to do blocking IO on UI thread. // Temporarily allow it until we fix http://crosbug.com/11103 base::ThreadRestrictions::ScopedAllowIO allow_io; - LoadManifestFromFile(FilePath(kStartupCustomizationManifestPath)); + LoadManifestFromFile(base::FilePath(kStartupCustomizationManifestPath)); } Init(chromeos::system::StatisticsProvider::GetInstance()); } @@ -270,13 +270,14 @@ void ServicesCustomizationDocument::StartFetching() { BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, base::Bind(&ServicesCustomizationDocument::ReadFileInBackground, base::Unretained(this), // this class is a singleton. - FilePath(url_.path()))); + base::FilePath(url_.path()))); } else { StartFileFetch(); } } -void ServicesCustomizationDocument::ReadFileInBackground(const FilePath& file) { +void ServicesCustomizationDocument::ReadFileInBackground( + const base::FilePath& file) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); std::string manifest; diff --git a/chrome/browser/chromeos/drive/drive_cache.cc b/chrome/browser/chromeos/drive/drive_cache.cc index 8c33b79..3ea0a62 100644 --- a/chrome/browser/chromeos/drive/drive_cache.cc +++ b/chrome/browser/chromeos/drive/drive_cache.cc @@ -27,21 +27,23 @@ using content::BrowserThread; namespace drive { namespace { -const FilePath::CharType kDriveCacheVersionDir[] = FILE_PATH_LITERAL("v1"); -const FilePath::CharType kDriveCacheMetaDir[] = FILE_PATH_LITERAL("meta"); -const FilePath::CharType kDriveCachePinnedDir[] = FILE_PATH_LITERAL("pinned"); -const FilePath::CharType kDriveCacheOutgoingDir[] = +const base::FilePath::CharType kDriveCacheVersionDir[] = + FILE_PATH_LITERAL("v1"); +const base::FilePath::CharType kDriveCacheMetaDir[] = FILE_PATH_LITERAL("meta"); +const base::FilePath::CharType kDriveCachePinnedDir[] = + FILE_PATH_LITERAL("pinned"); +const base::FilePath::CharType kDriveCacheOutgoingDir[] = FILE_PATH_LITERAL("outgoing"); -const FilePath::CharType kDriveCachePersistentDir[] = +const base::FilePath::CharType kDriveCachePersistentDir[] = FILE_PATH_LITERAL("persistent"); -const FilePath::CharType kDriveCacheTmpDir[] = FILE_PATH_LITERAL("tmp"); -const FilePath::CharType kDriveCacheTmpDownloadsDir[] = +const base::FilePath::CharType kDriveCacheTmpDir[] = FILE_PATH_LITERAL("tmp"); +const base::FilePath::CharType kDriveCacheTmpDownloadsDir[] = FILE_PATH_LITERAL("tmp/downloads"); -const FilePath::CharType kDriveCacheTmpDocumentsDir[] = +const base::FilePath::CharType kDriveCacheTmpDocumentsDir[] = FILE_PATH_LITERAL("tmp/documents"); // Create cache directory paths and set permissions. -bool InitCachePaths(const std::vector<FilePath>& cache_paths) { +bool InitCachePaths(const std::vector<base::FilePath>& cache_paths) { if (cache_paths.size() < DriveCache::NUM_CACHE_TYPES) { NOTREACHED(); LOG(ERROR) << "Size of cache_paths is invalid."; @@ -65,12 +67,12 @@ bool InitCachePaths(const std::vector<FilePath>& cache_paths) { // Remove all files under the given directory, non-recursively. // Do not remove recursively as we don't want to touch <gcache>/tmp/downloads, // which is used for user initiated downloads like "Save As" -void RemoveAllFiles(const FilePath& directory) { +void RemoveAllFiles(const base::FilePath& directory) { using file_util::FileEnumerator; FileEnumerator enumerator(directory, false /* recursive */, FileEnumerator::FILES); - for (FilePath file_path = enumerator.Next(); !file_path.empty(); + for (base::FilePath file_path = enumerator.Next(); !file_path.empty(); file_path = enumerator.Next()) { DVLOG(1) << "Removing " << file_path.value(); if (!file_util::Delete(file_path, false /* recursive */)) @@ -79,7 +81,7 @@ void RemoveAllFiles(const FilePath& directory) { } // Deletes the symlink. -void DeleteSymlink(const FilePath& symlink_path) { +void DeleteSymlink(const base::FilePath& symlink_path) { // We try to save one file operation by not checking if link exists before // deleting it, so unlink may return error if link doesn't exist, but it // doesn't really matter to us. @@ -87,8 +89,8 @@ void DeleteSymlink(const FilePath& symlink_path) { } // Creates a symlink. -bool CreateSymlink(const FilePath& cache_file_path, - const FilePath& symlink_path) { +bool CreateSymlink(const base::FilePath& cache_file_path, + const base::FilePath& symlink_path) { // Remove symlink because creating a link will not overwrite an existing one. DeleteSymlink(symlink_path); @@ -102,7 +104,8 @@ bool CreateSymlink(const FilePath& cache_file_path, } // Moves the file. -bool MoveFile(const FilePath& source_path, const FilePath& dest_path) { +bool MoveFile(const base::FilePath& source_path, + const base::FilePath& dest_path) { if (!file_util::Move(source_path, dest_path)) { LOG(ERROR) << "Failed to move " << source_path.value() << " to " << dest_path.value(); @@ -113,7 +116,8 @@ bool MoveFile(const FilePath& source_path, const FilePath& dest_path) { } // Copies the file. -bool CopyFile(const FilePath& source_path, const FilePath& dest_path) { +bool CopyFile(const base::FilePath& source_path, + const base::FilePath& dest_path) { if (!file_util::CopyFile(source_path, dest_path)) { LOG(ERROR) << "Failed to copy " << source_path.value() << " to " << dest_path.value(); @@ -127,8 +131,8 @@ bool CopyFile(const FilePath& source_path, const FilePath& dest_path) { // |path_to_keep| on blocking pool. // If |path_to_keep| is empty, all files in |path_to_delete_pattern| are // deleted. -void DeleteFilesSelectively(const FilePath& path_to_delete_pattern, - const FilePath& path_to_keep) { +void DeleteFilesSelectively(const base::FilePath& path_to_delete_pattern, + const base::FilePath& path_to_keep) { // Enumerate all files in directory of |path_to_delete_pattern| that match // base name of |path_to_delete_pattern|. // If a file is not |path_to_keep|, delete it. @@ -138,7 +142,7 @@ void DeleteFilesSelectively(const FilePath& path_to_delete_pattern, file_util::FileEnumerator::FILES | file_util::FileEnumerator::SHOW_SYM_LINKS, path_to_delete_pattern.BaseName().value()); - for (FilePath current = enumerator.Next(); !current.empty(); + for (base::FilePath current = enumerator.Next(); !current.empty(); current = enumerator.Next()) { // If |path_to_keep| is not empty and same as current, don't delete it. if (!path_to_keep.empty() && current == path_to_keep) @@ -156,7 +160,7 @@ void DeleteFilesSelectively(const FilePath& path_to_delete_pattern, // Used to implement GetFile, MarkAsMounted. void RunGetFileFromCacheCallback( const GetFileFromCacheCallback& callback, - scoped_ptr<std::pair<DriveFileError, FilePath> > result) { + scoped_ptr<std::pair<DriveFileError, base::FilePath> > result) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!callback.is_null()); DCHECK(result.get()); @@ -176,7 +180,7 @@ void RunGetCacheEntryCallback(const GetCacheEntryCallback& callback, } // namespace -DriveCache::DriveCache(const FilePath& cache_root_path, +DriveCache::DriveCache(const base::FilePath& cache_root_path, base::SequencedTaskRunner* blocking_task_runner, FreeDiskSpaceGetterInterface* free_disk_space_getter) : cache_root_path_(cache_root_path), @@ -194,17 +198,18 @@ DriveCache::~DriveCache() { AssertOnSequencedWorkerPool(); } -FilePath DriveCache::GetCacheDirectoryPath( +base::FilePath DriveCache::GetCacheDirectoryPath( CacheSubDirectoryType sub_dir_type) const { DCHECK_LE(0, sub_dir_type); DCHECK_GT(NUM_CACHE_TYPES, sub_dir_type); return cache_paths_[sub_dir_type]; } -FilePath DriveCache::GetCacheFilePath(const std::string& resource_id, - const std::string& md5, - CacheSubDirectoryType sub_dir_type, - CachedFileOrigin file_origin) const { +base::FilePath DriveCache::GetCacheFilePath( + const std::string& resource_id, + const std::string& md5, + CacheSubDirectoryType sub_dir_type, + CachedFileOrigin file_origin) const { DCHECK(sub_dir_type != CACHE_TYPE_META); // Runs on any thread. @@ -213,17 +218,17 @@ FilePath DriveCache::GetCacheFilePath(const std::string& resource_id, std::string base_name = util::EscapeCacheFileName(resource_id); if (file_origin == CACHED_FILE_LOCALLY_MODIFIED) { DCHECK(sub_dir_type == CACHE_TYPE_PERSISTENT); - base_name += FilePath::kExtensionSeparator; + base_name += base::FilePath::kExtensionSeparator; base_name += util::kLocallyModifiedFileExtension; } else if (!md5.empty()) { - base_name += FilePath::kExtensionSeparator; + base_name += base::FilePath::kExtensionSeparator; base_name += util::EscapeCacheFileName(md5); } // For mounted archives the filename is formatted as resource_id.md5.mounted, // i.e. resource_id.md5 is the base name and ".mounted" is the extension if (file_origin == CACHED_FILE_MOUNTED) { DCHECK(sub_dir_type == CACHE_TYPE_PERSISTENT); - base_name += FilePath::kExtensionSeparator; + base_name += base::FilePath::kExtensionSeparator; base_name += util::kMountedArchiveFileExtension; } return GetCacheDirectoryPath(sub_dir_type).Append(base_name); @@ -234,7 +239,7 @@ void DriveCache::AssertOnSequencedWorkerPool() { blocking_task_runner_->RunsTasksOnCurrentThread()); } -bool DriveCache::IsUnderDriveCacheDirectory(const FilePath& path) const { +bool DriveCache::IsUnderDriveCacheDirectory(const base::FilePath& path) const { return cache_root_path_ == path || cache_root_path_.IsParent(path); } @@ -309,7 +314,7 @@ void DriveCache::GetFile(const std::string& resource_id, void DriveCache::Store(const std::string& resource_id, const std::string& md5, - const FilePath& source_path, + const base::FilePath& source_path, FileOperationType file_operation_type, const FileOperationCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); @@ -368,7 +373,7 @@ void DriveCache::MarkAsMounted(const std::string& resource_id, base::Bind(RunGetFileFromCacheCallback, callback)); } -void DriveCache::MarkAsUnmounted(const FilePath& file_path, +void DriveCache::MarkAsUnmounted(const base::FilePath& file_path, const FileOperationCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!callback.is_null()); @@ -574,7 +579,7 @@ scoped_ptr<DriveCache::GetFileResult> DriveCache::GetFileOnBlockingPool( DriveFileError DriveCache::StoreOnBlockingPool( const std::string& resource_id, const std::string& md5, - const FilePath& source_path, + const base::FilePath& source_path, FileOperationType file_operation_type) { AssertOnSequencedWorkerPool(); @@ -590,7 +595,7 @@ DriveFileError DriveCache::StoreOnBlockingPool( return DRIVE_FILE_ERROR_NO_SPACE; } - FilePath symlink_path; + base::FilePath symlink_path; CacheSubDirectoryType sub_dir_type = CACHE_TYPE_TMP; // If file was previously pinned, store it in persistent dir. @@ -610,7 +615,7 @@ DriveFileError DriveCache::StoreOnBlockingPool( sub_dir_type = CACHE_TYPE_PERSISTENT; } - FilePath dest_path = GetCacheFilePath(resource_id, md5, sub_dir_type, + base::FilePath dest_path = GetCacheFilePath(resource_id, md5, sub_dir_type, CACHED_FILE_FROM_SERVER); bool success = false; switch (file_operation_type) { @@ -626,7 +631,7 @@ DriveFileError DriveCache::StoreOnBlockingPool( // Create symlink in pinned directory if the file is pinned. if (success && cache_entry.is_pinned()) { - FilePath symlink_path = GetCacheFilePath(resource_id, std::string(), + base::FilePath symlink_path = GetCacheFilePath(resource_id, std::string(), CACHE_TYPE_PINNED, CACHED_FILE_FROM_SERVER); success = CreateSymlink(dest_path, symlink_path); @@ -634,7 +639,7 @@ DriveFileError DriveCache::StoreOnBlockingPool( // Determine search pattern for stale filenames corresponding to resource_id, // either "<resource_id>*" or "<resource_id>.*". - FilePath stale_filenames_pattern; + base::FilePath stale_filenames_pattern; if (md5.empty()) { // No md5 means no extension, append '*' after base name, i.e. // "<resource_id>*". @@ -642,7 +647,8 @@ DriveFileError DriveCache::StoreOnBlockingPool( // if base name of |dest_path| (i.e. escaped resource_id) contains the // extension separator '.', ReplaceExtension will remove it and everything // after it. The result will be nothing like the escaped resource_id. - stale_filenames_pattern = FilePath(dest_path.value() + util::kWildCard); + stale_filenames_pattern = + base::FilePath(dest_path.value() + util::kWildCard); } else { // Replace md5 extension with '*' i.e. "<resource_id>.*". // Note that ReplaceExtension automatically prefixes the extension with the @@ -668,7 +674,7 @@ DriveFileError DriveCache::PinOnBlockingPool(const std::string& resource_id, const std::string& md5) { AssertOnSequencedWorkerPool(); - FilePath dest_path; + base::FilePath dest_path; CacheSubDirectoryType sub_dir_type = CACHE_TYPE_PERSISTENT; DriveCacheEntry cache_entry; @@ -676,7 +682,7 @@ DriveFileError DriveCache::PinOnBlockingPool(const std::string& resource_id, // Entry does not exist in cache. Set |dest_path| to /dev/null, so that // symlinks to /dev/null will be picked up by DriveSyncClient to download // pinned files that don't exist in cache. - dest_path = FilePath::FromUTF8Unsafe(util::kSymLinkToDevNull); + dest_path = base::FilePath::FromUTF8Unsafe(util::kSymLinkToDevNull); // Set sub_dir_type to TMP. The file will be first downloaded in 'tmp', // then moved to 'persistent'. @@ -701,7 +707,7 @@ DriveFileError DriveCache::PinOnBlockingPool(const std::string& resource_id, } // File exists, move it to persistent dir. // Gets the current path of the file in cache. - FilePath source_path = GetCacheFilePath(resource_id, + base::FilePath source_path = GetCacheFilePath(resource_id, md5, GetSubDirectoryType(cache_entry), CACHED_FILE_FROM_SERVER); @@ -715,7 +721,7 @@ DriveFileError DriveCache::PinOnBlockingPool(const std::string& resource_id, } // Create symlink in pinned dir. - FilePath symlink_path = GetCacheFilePath(resource_id, + base::FilePath symlink_path = GetCacheFilePath(resource_id, std::string(), CACHE_TYPE_PINNED, CACHED_FILE_FROM_SERVER); @@ -755,12 +761,12 @@ DriveFileError DriveCache::UnpinOnBlockingPool(const std::string& resource_id, // don't need to move the file. if (cache_entry.is_present()) { // Gets the current path of the file in cache. - FilePath source_path = GetCacheFilePath(resource_id, + base::FilePath source_path = GetCacheFilePath(resource_id, md5, GetSubDirectoryType(cache_entry), CACHED_FILE_FROM_SERVER); // File exists, move it to tmp dir. - FilePath dest_path = GetCacheFilePath(resource_id, + base::FilePath dest_path = GetCacheFilePath(resource_id, md5, CACHE_TYPE_TMP, CACHED_FILE_FROM_SERVER); @@ -771,7 +777,7 @@ DriveFileError DriveCache::UnpinOnBlockingPool(const std::string& resource_id, // If file was pinned, remove the symlink in pinned dir. if (cache_entry.is_pinned()) { - FilePath symlink_path = GetCacheFilePath(resource_id, + base::FilePath symlink_path = GetCacheFilePath(resource_id, std::string(), CACHE_TYPE_PINNED, CACHED_FILE_FROM_SERVER); @@ -813,12 +819,12 @@ scoped_ptr<DriveCache::GetFileResult> DriveCache::MarkAsMountedOnBlockingPool( // Get the subdir type and path for the unmounted state. CacheSubDirectoryType unmounted_subdir = cache_entry.is_pinned() ? CACHE_TYPE_PERSISTENT : CACHE_TYPE_TMP; - FilePath unmounted_path = GetCacheFilePath( + base::FilePath unmounted_path = GetCacheFilePath( resource_id, md5, unmounted_subdir, CACHED_FILE_FROM_SERVER); // Get the subdir type and path for the mounted state. CacheSubDirectoryType mounted_subdir = CACHE_TYPE_PERSISTENT; - FilePath mounted_path = GetCacheFilePath( + base::FilePath mounted_path = GetCacheFilePath( resource_id, md5, mounted_subdir, CACHED_FILE_MOUNTED); // Move cache file. @@ -837,7 +843,7 @@ scoped_ptr<DriveCache::GetFileResult> DriveCache::MarkAsMountedOnBlockingPool( } DriveFileError DriveCache::MarkAsUnmountedOnBlockingPool( - const FilePath& file_path) { + const base::FilePath& file_path) { AssertOnSequencedWorkerPool(); // Parse file path to obtain resource_id, md5 and extra_extension. @@ -859,12 +865,12 @@ DriveFileError DriveCache::MarkAsUnmountedOnBlockingPool( // Get the subdir type and path for the unmounted state. CacheSubDirectoryType unmounted_subdir = cache_entry.is_pinned() ? CACHE_TYPE_PERSISTENT : CACHE_TYPE_TMP; - FilePath unmounted_path = GetCacheFilePath( + base::FilePath unmounted_path = GetCacheFilePath( resource_id, md5, unmounted_subdir, CACHED_FILE_FROM_SERVER); // Get the subdir type and path for the mounted state. CacheSubDirectoryType mounted_subdir = CACHE_TYPE_PERSISTENT; - FilePath mounted_path = GetCacheFilePath( + base::FilePath mounted_path = GetCacheFilePath( resource_id, md5, mounted_subdir, CACHED_FILE_MOUNTED); // Move cache file. @@ -911,7 +917,7 @@ DriveFileError DriveCache::MarkDirtyOnBlockingPool( DCHECK(cache_entry.is_persistent()); // Determine symlink path in outgoing dir, so as to remove it. - FilePath symlink_path = GetCacheFilePath(resource_id, + base::FilePath symlink_path = GetCacheFilePath(resource_id, std::string(), CACHE_TYPE_OUTGOING, CACHED_FILE_FROM_SERVER); @@ -923,13 +929,13 @@ DriveFileError DriveCache::MarkDirtyOnBlockingPool( // Move file to persistent dir with new .local extension. // Get the current path of the file in cache. - FilePath source_path = GetCacheFilePath(resource_id, + base::FilePath source_path = GetCacheFilePath(resource_id, md5, GetSubDirectoryType(cache_entry), CACHED_FILE_FROM_SERVER); // Determine destination path. const CacheSubDirectoryType sub_dir_type = CACHE_TYPE_PERSISTENT; - FilePath cache_file_path = GetCacheFilePath(resource_id, + base::FilePath cache_file_path = GetCacheFilePath(resource_id, md5, sub_dir_type, CACHED_FILE_LOCALLY_MODIFIED); @@ -938,7 +944,7 @@ DriveFileError DriveCache::MarkDirtyOnBlockingPool( // If file is pinned, update symlink in pinned dir. if (success && cache_entry.is_pinned()) { - FilePath symlink_path = GetCacheFilePath(resource_id, + base::FilePath symlink_path = GetCacheFilePath(resource_id, std::string(), CACHE_TYPE_PINNED, CACHED_FILE_FROM_SERVER); @@ -989,13 +995,13 @@ DriveFileError DriveCache::CommitDirtyOnBlockingPool( DCHECK(cache_entry.is_persistent()); // Create symlink in outgoing dir. - FilePath symlink_path = GetCacheFilePath(resource_id, + base::FilePath symlink_path = GetCacheFilePath(resource_id, std::string(), CACHE_TYPE_OUTGOING, CACHED_FILE_FROM_SERVER); // Get target path of symlink i.e. current path of the file in cache. - FilePath target_path = GetCacheFilePath(resource_id, + base::FilePath target_path = GetCacheFilePath(resource_id, md5, GetSubDirectoryType(cache_entry), CACHED_FILE_LOCALLY_MODIFIED); @@ -1036,7 +1042,7 @@ DriveFileError DriveCache::ClearDirtyOnBlockingPool( DCHECK(cache_entry.is_persistent()); // Get the current path of the file in cache. - FilePath source_path = GetCacheFilePath(resource_id, + base::FilePath source_path = GetCacheFilePath(resource_id, md5, GetSubDirectoryType(cache_entry), CACHED_FILE_LOCALLY_MODIFIED); @@ -1046,7 +1052,7 @@ DriveFileError DriveCache::ClearDirtyOnBlockingPool( // otherwise, move it to tmp dir with .md5 extension. const CacheSubDirectoryType sub_dir_type = cache_entry.is_pinned() ? CACHE_TYPE_PERSISTENT : CACHE_TYPE_TMP; - FilePath dest_path = GetCacheFilePath(resource_id, + base::FilePath dest_path = GetCacheFilePath(resource_id, md5, sub_dir_type, CACHED_FILE_FROM_SERVER); @@ -1055,7 +1061,7 @@ DriveFileError DriveCache::ClearDirtyOnBlockingPool( if (success) { // Delete symlink in outgoing dir. - FilePath symlink_path = GetCacheFilePath(resource_id, + base::FilePath symlink_path = GetCacheFilePath(resource_id, std::string(), CACHE_TYPE_OUTGOING, CACHED_FILE_FROM_SERVER); @@ -1064,7 +1070,7 @@ DriveFileError DriveCache::ClearDirtyOnBlockingPool( // If file is pinned, update symlink in pinned dir. if (success && cache_entry.is_pinned()) { - FilePath symlink_path = GetCacheFilePath(resource_id, + base::FilePath symlink_path = GetCacheFilePath(resource_id, std::string(), CACHE_TYPE_PINNED, CACHED_FILE_FROM_SERVER); @@ -1106,7 +1112,7 @@ DriveFileError DriveCache::RemoveOnBlockingPool( // Determine paths to delete all cache versions of |resource_id| in // persistent, tmp and pinned directories. - std::vector<FilePath> paths_to_delete; + std::vector<base::FilePath> paths_to_delete; // For files in persistent and tmp dirs, delete files that match // "<resource_id>.*". @@ -1129,7 +1135,7 @@ DriveFileError DriveCache::RemoveOnBlockingPool( // Don't delete locally modified (i.e. dirty and possibly outgoing) files. // Since we're not deleting outgoing symlinks, we don't need to append // outgoing path to |paths_to_delete|. - FilePath path_to_keep = GetCacheFilePath(resource_id, + base::FilePath path_to_keep = GetCacheFilePath(resource_id, std::string(), CACHE_TYPE_PERSISTENT, CACHED_FILE_LOCALLY_MODIFIED); @@ -1212,7 +1218,8 @@ void DriveCache::OnCommitDirty(const std::string& resource_id, OnCacheCommitted(resource_id)); } -bool DriveCache::HasEnoughSpaceFor(int64 num_bytes, const FilePath& path) { +bool DriveCache::HasEnoughSpaceFor(int64 num_bytes, + const base::FilePath& path) { int64 free_space = 0; if (free_disk_space_getter_) free_space = free_disk_space_getter_->AmountOfFreeDiskSpace(); @@ -1225,18 +1232,18 @@ bool DriveCache::HasEnoughSpaceFor(int64 num_bytes, const FilePath& path) { } // static -FilePath DriveCache::GetCacheRootPath(Profile* profile) { - FilePath cache_base_path; +base::FilePath DriveCache::GetCacheRootPath(Profile* profile) { + base::FilePath cache_base_path; chrome::GetUserCacheDirectory(profile->GetPath(), &cache_base_path); - FilePath cache_root_path = + base::FilePath cache_root_path = cache_base_path.Append(chrome::kDriveCacheDirname); return cache_root_path.Append(kDriveCacheVersionDir); } // static -std::vector<FilePath> DriveCache::GetCachePaths( - const FilePath& cache_root_path) { - std::vector<FilePath> cache_paths; +std::vector<base::FilePath> DriveCache::GetCachePaths( + const base::FilePath& cache_root_path) { + std::vector<base::FilePath> cache_paths; // The order should match DriveCache::CacheSubDirectoryType enum. cache_paths.push_back(cache_root_path.Append(kDriveCacheMetaDir)); cache_paths.push_back(cache_root_path.Append(kDriveCachePinnedDir)); @@ -1250,7 +1257,7 @@ std::vector<FilePath> DriveCache::GetCachePaths( // static bool DriveCache::CreateCacheDirectories( - const std::vector<FilePath>& paths_to_create) { + const std::vector<base::FilePath>& paths_to_create) { bool success = true; for (size_t i = 0; i < paths_to_create.size(); ++i) { diff --git a/chrome/browser/chromeos/drive/drive_cache.h b/chrome/browser/chromeos/drive/drive_cache.h index b3a4302..d3c867c 100644 --- a/chrome/browser/chromeos/drive/drive_cache.h +++ b/chrome/browser/chromeos/drive/drive_cache.h @@ -32,7 +32,7 @@ class DriveCacheObserver; // Callback for GetFileFromCache. typedef base::Callback<void(DriveFileError error, - const FilePath& cache_file_path)> + const base::FilePath& cache_file_path)> GetFileFromCacheCallback; // Callback for GetCacheEntry. @@ -101,7 +101,7 @@ class DriveCache { // // |free_disk_space_getter| is used to inject a custom free disk space // getter for testing. NULL must be passed for production code. - DriveCache(const FilePath& cache_root_path, + DriveCache(const base::FilePath& cache_root_path, base::SequencedTaskRunner* blocking_task_runner, FreeDiskSpaceGetterInterface* free_disk_space_getter); @@ -109,12 +109,13 @@ class DriveCache { // directory type. Example: <user_profile_dir>/GCache/v1/tmp // // Can be called on any thread. - FilePath GetCacheDirectoryPath(CacheSubDirectoryType sub_dir_type) const; + base::FilePath GetCacheDirectoryPath( + CacheSubDirectoryType sub_dir_type) const; // Returns absolute path of the file if it were cached or to be cached. // // Can be called on any thread. - FilePath GetCacheFilePath(const std::string& resource_id, + base::FilePath GetCacheFilePath(const std::string& resource_id, const std::string& md5, CacheSubDirectoryType sub_dir_type, CachedFileOrigin file_origin) const; @@ -123,7 +124,7 @@ class DriveCache { // <user_profile_dir>/GCache/v1 // // Can be called on any thread. - bool IsUnderDriveCacheDirectory(const FilePath& path) const; + bool IsUnderDriveCacheDirectory(const base::FilePath& path) const; // Adds observer. void AddObserver(DriveCacheObserver* observer); @@ -168,7 +169,7 @@ class DriveCache { // |callback| must not be null. void Store(const std::string& resource_id, const std::string& md5, - const FilePath& source_path, + const base::FilePath& source_path, FileOperationType file_operation_type, const FileOperationCallback& callback); @@ -199,7 +200,7 @@ class DriveCache { // Set the state of the cache entry corresponding to file_path as unmounted. // |callback| must not be null. - void MarkAsUnmounted(const FilePath& file_path, + void MarkAsUnmounted(const base::FilePath& file_path, const FileOperationCallback& callback); // Modifies cache state, which involves the following: @@ -259,25 +260,26 @@ class DriveCache { // Gets the cache root path (i.e. <user_profile_dir>/GCache/v1) from the // profile. // TODO(satorux): Write a unit test for this. - static FilePath GetCacheRootPath(Profile* profile); + static base::FilePath GetCacheRootPath(Profile* profile); // Returns file paths for all the cache sub directories under // |cache_root_path|. - static std::vector<FilePath> GetCachePaths(const FilePath& cache_root_path); + static std::vector<base::FilePath> GetCachePaths( + const base::FilePath& cache_root_path); // Creates cache directory and its sub-directories if they don't exist. // TODO(glotov): take care of this when the setup and cleanup part is // landed, noting that these directories need to be created for development // in linux box and unittest. (http://crosbug.com/27577) static bool CreateCacheDirectories( - const std::vector<FilePath>& paths_to_create); + const std::vector<base::FilePath>& paths_to_create); // Returns the type of the sub directory where the cache file is stored. static CacheSubDirectoryType GetSubDirectoryType( const DriveCacheEntry& cache_entry); private: - typedef std::pair<DriveFileError, FilePath> GetFileResult; + typedef std::pair<DriveFileError, base::FilePath> GetFileResult; virtual ~DriveCache(); @@ -315,7 +317,7 @@ class DriveCache { // Used to implement Store. DriveFileError StoreOnBlockingPool(const std::string& resource_id, const std::string& md5, - const FilePath& source_path, + const base::FilePath& source_path, FileOperationType file_operation_type); // Used to implement Pin. @@ -332,7 +334,7 @@ class DriveCache { const std::string& md5); // Used to implement MarkAsUnmounted. - DriveFileError MarkAsUnmountedOnBlockingPool(const FilePath& file_path); + DriveFileError MarkAsUnmountedOnBlockingPool(const base::FilePath& file_path); // Used to implement MarkDirty. DriveFileError MarkDirtyOnBlockingPool(const std::string& resource_id, @@ -371,13 +373,13 @@ class DriveCache { // Returns true if we have sufficient space to store the given number of // bytes, while keeping kMinFreeSpace bytes on the disk. - bool HasEnoughSpaceFor(int64 num_bytes, const FilePath& path); + bool HasEnoughSpaceFor(int64 num_bytes, const base::FilePath& path); // The root directory of the cache (i.e. <user_profile_dir>/GCache/v1). - const FilePath cache_root_path_; + const base::FilePath cache_root_path_; // Paths for all subdirectories of GCache, one for each // DriveCache::CacheSubDirectoryType enum. - const std::vector<FilePath> cache_paths_; + const std::vector<base::FilePath> cache_paths_; scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_; // The cache state data. This member must be access only on the blocking pool. diff --git a/chrome/browser/chromeos/drive/drive_cache_metadata.cc b/chrome/browser/chromeos/drive/drive_cache_metadata.cc index 27fc7dc..2e0d1fb 100644 --- a/chrome/browser/chromeos/drive/drive_cache_metadata.cc +++ b/chrome/browser/chromeos/drive/drive_cache_metadata.cc @@ -27,18 +27,18 @@ enum DBOpenStatus { }; // A map table of resource ID to file path. -typedef std::map<std::string, FilePath> ResourceIdToFilePathMap; +typedef std::map<std::string, base::FilePath> ResourceIdToFilePathMap; // Returns true if |file_path| is a valid symbolic link as |sub_dir_type|. // Otherwise, returns false with the reason. -bool IsValidSymbolicLink(const FilePath& file_path, +bool IsValidSymbolicLink(const base::FilePath& file_path, DriveCache::CacheSubDirectoryType sub_dir_type, - const std::vector<FilePath>& cache_paths, + const std::vector<base::FilePath>& cache_paths, std::string* reason) { DCHECK(sub_dir_type == DriveCache::CACHE_TYPE_PINNED || sub_dir_type == DriveCache::CACHE_TYPE_OUTGOING); - FilePath destination; + base::FilePath destination; if (!file_util::ReadSymbolicLink(file_path, &destination)) { *reason = "failed to read the symlink (maybe not a symlink)"; return false; @@ -51,7 +51,7 @@ bool IsValidSymbolicLink(const FilePath& file_path, // pinned-but-not-fetched files are symlinks to kSymLinkToDevNull. if (sub_dir_type == DriveCache::CACHE_TYPE_PINNED && - destination == FilePath::FromUTF8Unsafe(util::kSymLinkToDevNull)) { + destination == base::FilePath::FromUTF8Unsafe(util::kSymLinkToDevNull)) { return true; } @@ -80,7 +80,7 @@ void RemoveInvalidFilesFromPersistentDirectory( persistent_file_map.begin(); iter != persistent_file_map.end(); ++iter) { const std::string& resource_id = iter->first; - const FilePath& file_path = iter->second; + const base::FilePath& file_path = iter->second; DriveCacheMetadata::CacheMap::iterator cache_map_iter = cache_map->find(resource_id); @@ -111,7 +111,7 @@ void RemoveInvalidFilesFromPersistentDirectory( // The resource IDs and file paths of discovered files are collected as a // ResourceIdToFilePathMap, if these are processed properly. void ScanCacheDirectory( - const std::vector<FilePath>& cache_paths, + const std::vector<base::FilePath>& cache_paths, DriveCache::CacheSubDirectoryType sub_dir_type, DriveCacheMetadata::CacheMap* cache_map, ResourceIdToFilePathMap* processed_file_map) { @@ -123,7 +123,7 @@ void ScanCacheDirectory( file_util::FileEnumerator::FILES | file_util::FileEnumerator::SHOW_SYM_LINKS, util::kWildCard); - for (FilePath current = enumerator.Next(); !current.empty(); + for (base::FilePath current = enumerator.Next(); !current.empty(); current = enumerator.Next()) { // Extract resource_id and md5 from filename. std::string resource_id; @@ -224,7 +224,7 @@ void ScanCacheDirectory( } } -void ScanCachePaths(const std::vector<FilePath>& cache_paths, +void ScanCachePaths(const std::vector<base::FilePath>& cache_paths, DriveCacheMetadata::CacheMap* cache_map) { DVLOG(1) << "Scanning directories"; @@ -304,7 +304,8 @@ class FakeDriveCacheMetadata : public DriveCacheMetadata { virtual ~FakeDriveCacheMetadata(); // DriveCacheMetadata overrides: - virtual bool Initialize(const std::vector<FilePath>& cache_paths) OVERRIDE; + virtual bool Initialize( + const std::vector<base::FilePath>& cache_paths) OVERRIDE; virtual void AddOrUpdateCacheEntry( const std::string& resource_id, const DriveCacheEntry& cache_entry) OVERRIDE; @@ -331,7 +332,7 @@ FakeDriveCacheMetadata::~FakeDriveCacheMetadata() { } bool FakeDriveCacheMetadata::Initialize( - const std::vector<FilePath>& cache_paths) { + const std::vector<base::FilePath>& cache_paths) { AssertOnSequencedWorkerPool(); ScanCachePaths(cache_paths, &cache_map_); @@ -418,7 +419,8 @@ class DriveCacheMetadataDB : public DriveCacheMetadata { virtual ~DriveCacheMetadataDB(); // DriveCacheMetadata overrides: - virtual bool Initialize(const std::vector<FilePath>& cache_paths) OVERRIDE; + virtual bool Initialize( + const std::vector<base::FilePath>& cache_paths) OVERRIDE; virtual void AddOrUpdateCacheEntry( const std::string& resource_id, const DriveCacheEntry& cache_entry) OVERRIDE; @@ -448,10 +450,10 @@ DriveCacheMetadataDB::~DriveCacheMetadataDB() { } bool DriveCacheMetadataDB::Initialize( - const std::vector<FilePath>& cache_paths) { + const std::vector<base::FilePath>& cache_paths) { AssertOnSequencedWorkerPool(); - const FilePath db_path = + const base::FilePath db_path = cache_paths[DriveCache::CACHE_TYPE_META].Append( kDriveCacheMetadataDBPath); DVLOG(1) << "db path=" << db_path.value(); @@ -588,7 +590,7 @@ void DriveCacheMetadataDB::Iterate(const CacheIterateCallback& callback) { } // namespace // static -const FilePath::CharType* DriveCacheMetadata::kDriveCacheMetadataDBPath = +const base::FilePath::CharType* DriveCacheMetadata::kDriveCacheMetadataDBPath = FILE_PATH_LITERAL("cache_metadata.db"); diff --git a/chrome/browser/chromeos/drive/drive_cache_metadata.h b/chrome/browser/chromeos/drive/drive_cache_metadata.h index d5c52c7..ec6471b 100644 --- a/chrome/browser/chromeos/drive/drive_cache_metadata.h +++ b/chrome/browser/chromeos/drive/drive_cache_metadata.h @@ -39,7 +39,7 @@ class DriveCacheMetadata { typedef std::map<std::string, DriveCacheEntry> CacheMap; // Database path. - static const FilePath::CharType* kDriveCacheMetadataDBPath; + static const base::FilePath::CharType* kDriveCacheMetadataDBPath; virtual ~DriveCacheMetadata(); @@ -53,7 +53,7 @@ class DriveCacheMetadata { base::SequencedTaskRunner* blocking_task_runner); // Initialize the cache metadata store. Returns true on success. - virtual bool Initialize(const std::vector<FilePath>& cache_paths) = 0; + virtual bool Initialize(const std::vector<base::FilePath>& cache_paths) = 0; // Adds a new cache entry corresponding to |resource_id| if it doesn't // exist, otherwise update the existing entry. virtual void AddOrUpdateCacheEntry(const std::string& resource_id, diff --git a/chrome/browser/chromeos/drive/drive_cache_metadata_unittest.cc b/chrome/browser/chromeos/drive/drive_cache_metadata_unittest.cc index fe597f5..357d39b 100644 --- a/chrome/browser/chromeos/drive/drive_cache_metadata_unittest.cc +++ b/chrome/browser/chromeos/drive/drive_cache_metadata_unittest.cc @@ -55,7 +55,7 @@ class DriveCacheMetadataTest : public testing::Test { CreateFile(persistent_directory_.AppendASCII("id_bad.md5bad")); // "id_symlink" is invalid, as symlink is not allowed here. This should // be removed. - CreateSymbolicLink(FilePath::FromUTF8Unsafe(util::kSymLinkToDevNull), + CreateSymbolicLink(base::FilePath::FromUTF8Unsafe(util::kSymLinkToDevNull), persistent_directory_.AppendASCII("id_symlink")); // Create some files in tmp directory. @@ -65,7 +65,7 @@ class DriveCacheMetadataTest : public testing::Test { CreateFile(tmp_directory_.AppendASCII("id_quux.local")); // "id_symlink_tmp" is invalid, as symlink is not allowed here. This // should be removed. - CreateSymbolicLink(FilePath::FromUTF8Unsafe(util::kSymLinkToDevNull), + CreateSymbolicLink(base::FilePath::FromUTF8Unsafe(util::kSymLinkToDevNull), tmp_directory_.AppendASCII("id_symlink_tmp")); // Create symbolic links in pinned directory. @@ -75,7 +75,7 @@ class DriveCacheMetadataTest : public testing::Test { pinned_directory_.AppendASCII("id_foo")); // "id_corge" is pinned, but not present locally. It's properly pointing // to /dev/null. - CreateSymbolicLink(FilePath::FromUTF8Unsafe(util::kSymLinkToDevNull), + CreateSymbolicLink(base::FilePath::FromUTF8Unsafe(util::kSymLinkToDevNull), pinned_directory_.AppendASCII("id_corge")); // "id_dangling" is pointing to a non-existent file. The symlink should // be removed. @@ -99,14 +99,15 @@ class DriveCacheMetadataTest : public testing::Test { } // Create a file at |file_path|. - void CreateFile(const FilePath& file_path) { + void CreateFile(const base::FilePath& file_path) { const std::string kFoo = "foo"; ASSERT_TRUE(file_util::WriteFile(file_path, kFoo.data(), kFoo.size())) << ": " << file_path.value(); } // Create an symlink to |target| at |symlink|. - void CreateSymbolicLink(const FilePath& target, const FilePath& symlink) { + void CreateSymbolicLink(const base::FilePath& target, + const base::FilePath& symlink) { ASSERT_TRUE(file_util::CreateSymbolicLink(target, symlink)) << ": " << target.value() << ": " << symlink.value(); } @@ -131,11 +132,11 @@ class DriveCacheMetadataTest : public testing::Test { base::ScopedTempDir temp_dir_; scoped_ptr<DriveCacheMetadata> metadata_; - std::vector<FilePath> cache_paths_; - FilePath persistent_directory_; - FilePath tmp_directory_; - FilePath pinned_directory_; - FilePath outgoing_directory_; + std::vector<base::FilePath> cache_paths_; + base::FilePath persistent_directory_; + base::FilePath tmp_directory_; + base::FilePath pinned_directory_; + base::FilePath outgoing_directory_; }; // Test all the methods of DriveCacheMetadata except for @@ -392,8 +393,9 @@ TEST_F(DriveCacheMetadataTest, RemoveTemporaryFiles) { TEST_F(DriveCacheMetadataTest, CorruptDB) { SetUpCacheWithVariousFiles(); - const FilePath db_path = cache_paths_[DriveCache::CACHE_TYPE_META].Append( - DriveCacheMetadata::kDriveCacheMetadataDBPath); + const base::FilePath db_path = + cache_paths_[DriveCache::CACHE_TYPE_META].Append( + DriveCacheMetadata::kDriveCacheMetadataDBPath); // Write a bogus file. std::string text("Hello world"); @@ -413,9 +415,9 @@ TEST_F(DriveCacheMetadataTest, CorruptDB) { TEST(DriveCacheMetadataExtraTest, CannotOpenDB) { // Create nonexistent cache paths, so the initialization fails due to the // failure of opening the DB. - std::vector<FilePath> cache_paths = + std::vector<base::FilePath> cache_paths = DriveCache::GetCachePaths( - FilePath::FromUTF8Unsafe("/somewhere/nonexistent")); + base::FilePath::FromUTF8Unsafe("/somewhere/nonexistent")); scoped_ptr<DriveCacheMetadata> metadata = DriveCacheMetadata::CreateDriveCacheMetadata(NULL); diff --git a/chrome/browser/chromeos/drive/drive_cache_unittest.cc b/chrome/browser/chromeos/drive/drive_cache_unittest.cc index d5831c5..cc9c90e 100644 --- a/chrome/browser/chromeos/drive/drive_cache_unittest.cc +++ b/chrome/browser/chromeos/drive/drive_cache_unittest.cc @@ -62,14 +62,14 @@ struct TestCacheResource { const int64 kLotsOfSpace = kMinFreeSpace * 10; struct PathToVerify { - PathToVerify(const FilePath& in_path_to_scan, - const FilePath& in_expected_existing_path) : + PathToVerify(const base::FilePath& in_path_to_scan, + const base::FilePath& in_expected_existing_path) : path_to_scan(in_path_to_scan), expected_existing_path(in_expected_existing_path) { } - FilePath path_to_scan; - FilePath expected_existing_path; + base::FilePath path_to_scan; + base::FilePath expected_existing_path; }; // Copies results from Iterate(). @@ -141,7 +141,7 @@ class DriveCacheTest : public testing::Test { const struct TestCacheResource& resource = test_cache_resources[i]; // Copy file from data dir to cache. if (!std::string(resource.source_file).empty()) { - FilePath source_path = + base::FilePath source_path = google_apis::test_util::GetTestFilePath(resource.source_file); DriveFileError error = DRIVE_FILE_OK; @@ -198,7 +198,7 @@ class DriveCacheTest : public testing::Test { DriveFileError expected_error, const std::string& expected_file_extension) { DriveFileError error = DRIVE_FILE_OK; - FilePath cache_file_path; + base::FilePath cache_file_path; cache_->GetFile( resource_id, md5, base::Bind(&test_util::CopyResultsFromGetFileFromCacheCallback, @@ -208,9 +208,9 @@ class DriveCacheTest : public testing::Test { EXPECT_EQ(expected_error, error); if (error == DRIVE_FILE_OK) { // Verify filename of |cache_file_path|. - FilePath base_name = cache_file_path.BaseName(); + base::FilePath base_name = cache_file_path.BaseName(); EXPECT_EQ(util::EscapeCacheFileName(resource_id) + - FilePath::kExtensionSeparator + + base::FilePath::kExtensionSeparator + util::EscapeCacheFileName( expected_file_extension.empty() ? md5 : expected_file_extension), @@ -223,7 +223,7 @@ class DriveCacheTest : public testing::Test { void TestStoreToCache( const std::string& resource_id, const std::string& md5, - const FilePath& source_path, + const base::FilePath& source_path, DriveFileError expected_error, int expected_cache_state, DriveCache::CacheSubDirectoryType expected_sub_dir_type) { @@ -271,19 +271,19 @@ class DriveCacheTest : public testing::Test { paths_to_verify.push_back( // Index 0: CACHE_TYPE_TMP. PathToVerify(cache_->GetCacheFilePath(resource_id, "*", DriveCache::CACHE_TYPE_TMP, - DriveCache::CACHED_FILE_FROM_SERVER), FilePath())); + DriveCache::CACHED_FILE_FROM_SERVER), base::FilePath())); paths_to_verify.push_back( // Index 1: CACHE_TYPE_PERSISTENT. PathToVerify(cache_->GetCacheFilePath(resource_id, "*", DriveCache::CACHE_TYPE_PERSISTENT, - DriveCache::CACHED_FILE_FROM_SERVER), FilePath())); + DriveCache::CACHED_FILE_FROM_SERVER), base::FilePath())); paths_to_verify.push_back( // Index 2: CACHE_TYPE_TMP, but STATE_PINNED. PathToVerify(cache_->GetCacheFilePath(resource_id, "", DriveCache::CACHE_TYPE_PINNED, - DriveCache::CACHED_FILE_FROM_SERVER), FilePath())); + DriveCache::CACHED_FILE_FROM_SERVER), base::FilePath())); paths_to_verify.push_back( // Index 3: CACHE_TYPE_OUTGOING. PathToVerify(cache_->GetCacheFilePath(resource_id, "", DriveCache::CACHE_TYPE_OUTGOING, - DriveCache::CACHED_FILE_FROM_SERVER), FilePath())); + DriveCache::CACHED_FILE_FROM_SERVER), base::FilePath())); if (!cache_entry_found) { for (size_t i = 0; i < paths_to_verify.size(); ++i) { file_util::FileEnumerator enumerator( @@ -332,7 +332,7 @@ class DriveCacheTest : public testing::Test { file_util::FileEnumerator::SHOW_SYM_LINKS, verify.path_to_scan.BaseName().value()); size_t num_files_found = 0; - for (FilePath current = enumerator.Next(); !current.empty(); + for (base::FilePath current = enumerator.Next(); !current.empty(); current = enumerator.Next()) { ++num_files_found; EXPECT_EQ(verify.expected_existing_path, current); @@ -401,7 +401,7 @@ class DriveCacheTest : public testing::Test { // Verify filename. if (error == DRIVE_FILE_OK) { - FilePath cache_file_path; + base::FilePath cache_file_path; cache_->GetFile( resource_id, md5, base::Bind(&test_util::CopyResultsFromGetFileFromCacheCallback, @@ -409,9 +409,9 @@ class DriveCacheTest : public testing::Test { google_apis::test_util::RunBlockingPoolTask(); EXPECT_EQ(DRIVE_FILE_OK, error); - FilePath base_name = cache_file_path.BaseName(); + base::FilePath base_name = cache_file_path.BaseName(); EXPECT_EQ(util::EscapeCacheFileName(resource_id) + - FilePath::kExtensionSeparator + + base::FilePath::kExtensionSeparator + "local", base_name.value()); } @@ -467,7 +467,7 @@ class DriveCacheTest : public testing::Test { expect_outgoing_symlink_ = false; DriveFileError error = DRIVE_FILE_OK; - FilePath cache_file_path; + base::FilePath cache_file_path; cache_->MarkAsMounted( resource_id, md5, @@ -486,7 +486,7 @@ class DriveCacheTest : public testing::Test { void TestMarkAsUnmounted( const std::string& resource_id, const std::string& md5, - const FilePath& file_path, + const base::FilePath& file_path, DriveFileError expected_error, int expected_cache_state, DriveCache::CacheSubDirectoryType expected_sub_dir_type) { @@ -501,7 +501,7 @@ class DriveCacheTest : public testing::Test { base::Bind(&test_util::CopyErrorCodeFromFileOperationCallback, &error)); google_apis::test_util::RunBlockingPoolTask(); - FilePath cache_file_path; + base::FilePath cache_file_path; cache_->GetFile( resource_id, md5, base::Bind(&test_util::CopyResultsFromGetFileFromCacheCallback, @@ -539,7 +539,7 @@ class DriveCacheTest : public testing::Test { } // Verify actual cache file. - FilePath dest_path = cache_->GetCacheFilePath( + base::FilePath dest_path = cache_->GetCacheFilePath( resource_id, md5, test_util::ToCacheEntry(expected_cache_state_).is_pinned() || @@ -556,7 +556,7 @@ class DriveCacheTest : public testing::Test { EXPECT_FALSE(exists); // Verify symlink in pinned dir. - FilePath symlink_path = cache_->GetCacheFilePath( + base::FilePath symlink_path = cache_->GetCacheFilePath( resource_id, std::string(), DriveCache::CACHE_TYPE_PINNED, @@ -565,7 +565,7 @@ class DriveCacheTest : public testing::Test { exists = file_util::IsLink(symlink_path); if (test_util::ToCacheEntry(expected_cache_state_).is_pinned()) { EXPECT_TRUE(exists); - FilePath target_path; + base::FilePath target_path; EXPECT_TRUE(file_util::ReadSymbolicLink(symlink_path, &target_path)); if (test_util::ToCacheEntry(expected_cache_state_).is_present()) EXPECT_EQ(dest_path, target_path); @@ -586,7 +586,7 @@ class DriveCacheTest : public testing::Test { if (expect_outgoing_symlink_ && test_util::ToCacheEntry(expected_cache_state_).is_dirty()) { EXPECT_TRUE(exists); - FilePath target_path; + base::FilePath target_path; EXPECT_TRUE(file_util::ReadSymbolicLink(symlink_path, &target_path)); EXPECT_TRUE(target_path.value() != kSymLinkToDevNull); if (test_util::ToCacheEntry(expected_cache_state_).is_present()) @@ -596,7 +596,7 @@ class DriveCacheTest : public testing::Test { } } - FilePath GetCacheFilePath(const std::string& resource_id, + base::FilePath GetCacheFilePath(const std::string& resource_id, const std::string& md5, DriveCache::CacheSubDirectoryType sub_dir_type, DriveCache::CachedFileOrigin file_origin) { @@ -627,19 +627,19 @@ class DriveCacheTest : public testing::Test { void TestGetCacheFilePath(const std::string& resource_id, const std::string& md5, const std::string& expected_filename) { - FilePath actual_path = cache_->GetCacheFilePath( + base::FilePath actual_path = cache_->GetCacheFilePath( resource_id, md5, DriveCache::CACHE_TYPE_TMP, DriveCache::CACHED_FILE_FROM_SERVER); - FilePath expected_path = + base::FilePath expected_path = cache_->GetCacheDirectoryPath(DriveCache::CACHE_TYPE_TMP); expected_path = expected_path.Append(expected_filename); EXPECT_EQ(expected_path, actual_path); - FilePath base_name = actual_path.BaseName(); + base::FilePath base_name = actual_path.BaseName(); - // FilePath::Extension returns ".", so strip it. + // base::FilePath::Extension returns ".", so strip it. std::string unescaped_md5 = util::UnescapeCacheFileName( base_name.Extension().substr(1)); EXPECT_EQ(md5, unescaped_md5); @@ -652,7 +652,7 @@ class DriveCacheTest : public testing::Test { // that they have the <md5>. This should return 1 or 0. size_t CountCacheFiles(const std::string& resource_id, const std::string& md5) { - FilePath path = GetCacheFilePath( + base::FilePath path = GetCacheFilePath( resource_id, "*", (test_util::ToCacheEntry(expected_cache_state_).is_pinned() ? DriveCache::CACHE_TYPE_PERSISTENT : @@ -662,11 +662,11 @@ class DriveCacheTest : public testing::Test { file_util::FileEnumerator::FILES, path.BaseName().value()); size_t num_files_found = 0; - for (FilePath current = enumerator.Next(); !current.empty(); + for (base::FilePath current = enumerator.Next(); !current.empty(); current = enumerator.Next()) { ++num_files_found; EXPECT_EQ(util::EscapeCacheFileName(resource_id) + - FilePath::kExtensionSeparator + + base::FilePath::kExtensionSeparator + util::EscapeCacheFileName(md5), current.BaseName().value()); } @@ -697,7 +697,7 @@ TEST_F(DriveCacheTest, GetCacheFilePath) { std::string resource_id("pdf:1a2b"); std::string md5("abcdef0123456789"); TestGetCacheFilePath(resource_id, md5, - resource_id + FilePath::kExtensionSeparator + md5); + resource_id + base::FilePath::kExtensionSeparator + md5); // Use non-alphanumeric characters for resource id, including '.' which is an // extension separator, to test that the characters are escaped and unescaped @@ -705,9 +705,9 @@ TEST_F(DriveCacheTest, GetCacheFilePath) { resource_id = "pdf:`~!@#$%^&*()-_=+[{|]}\\;',<.>/?"; std::string escaped_resource_id = util::EscapeCacheFileName(resource_id); std::string escaped_md5 = util::EscapeCacheFileName(md5); - TestGetCacheFilePath(resource_id, md5, - escaped_resource_id + FilePath::kExtensionSeparator + - escaped_md5); + TestGetCacheFilePath( + resource_id, md5, escaped_resource_id + + base::FilePath::kExtensionSeparator + escaped_md5); } TEST_F(DriveCacheTest, StoreToCacheSimple) { @@ -724,7 +724,7 @@ TEST_F(DriveCacheTest, StoreToCacheSimple) { DriveCache::CACHE_TYPE_TMP); // Store a non-existent file to the same |resource_id| and |md5|. - TestStoreToCache(resource_id, md5, FilePath("./non_existent.json"), + TestStoreToCache(resource_id, md5, base::FilePath("./non_existent.json"), DRIVE_FILE_ERROR_FAILED, test_util::TEST_CACHE_STATE_PRESENT, DriveCache::CACHE_TYPE_TMP); @@ -884,7 +884,7 @@ TEST_F(DriveCacheTest, StoreToCachePinned) { DriveCache::CACHE_TYPE_PERSISTENT); // Store a non-existent file to a previously pinned and stored file. - TestStoreToCache(resource_id, md5, FilePath("./non_existent.json"), + TestStoreToCache(resource_id, md5, base::FilePath("./non_existent.json"), DRIVE_FILE_ERROR_FAILED, test_util::TEST_CACHE_STATE_PRESENT | test_util::TEST_CACHE_STATE_PINNED | @@ -1066,7 +1066,7 @@ TEST_F(DriveCacheTest, PinAndUnpinDirtyCache) { DriveCache::CACHE_TYPE_PERSISTENT); // Verifies dirty file exists. - FilePath dirty_path = GetCacheFilePath( + base::FilePath dirty_path = GetCacheFilePath( resource_id, md5, DriveCache::CACHE_TYPE_PERSISTENT, @@ -1259,7 +1259,7 @@ TEST_F(DriveCacheTest, RemoveFromDirtyCache) { TEST_F(DriveCacheTest, MountUnmount) { fake_free_disk_space_getter_->set_fake_free_disk_space(kLotsOfSpace); - FilePath file_path; + base::FilePath file_path; std::string resource_id("pdf:1a2b"); std::string md5("abcdef0123456789"); @@ -1379,7 +1379,7 @@ TEST(DriveCacheExtraTest, InitializationFailure) { // Set the cache root to a non existent path, so the initialization fails. DriveCache* cache = new DriveCache( - FilePath::FromUTF8Unsafe("/somewhere/nonexistent/blah/blah"), + base::FilePath::FromUTF8Unsafe("/somewhere/nonexistent/blah/blah"), pool->GetSequencedTaskRunner(pool->GetSequenceToken()), NULL /* free_disk_space_getter */); diff --git a/chrome/browser/chromeos/drive/drive_download_handler.cc b/chrome/browser/chromeos/drive/drive_download_handler.cc index 046b00c..a10c2b9 100644 --- a/chrome/browser/chromeos/drive/drive_download_handler.cc +++ b/chrome/browser/chromeos/drive/drive_download_handler.cc @@ -27,16 +27,16 @@ const char kDrivePathKey[] = "DrivePath"; // User Data stored in DownloadItem for drive path. class DriveUserData : public base::SupportsUserData::Data { public: - explicit DriveUserData(const FilePath& path) : file_path_(path), + explicit DriveUserData(const base::FilePath& path) : file_path_(path), is_complete_(false) {} virtual ~DriveUserData() {} - const FilePath& file_path() const { return file_path_; } + const base::FilePath& file_path() const { return file_path_; } bool is_complete() const { return is_complete_; } void set_complete() { is_complete_ = true; } private: - const FilePath file_path_; + const base::FilePath file_path_; bool is_complete_; }; @@ -53,11 +53,12 @@ DriveUserData* GetDriveUserData(DownloadItem* download) { // Creates a temporary file |drive_tmp_download_path| in // |drive_tmp_download_dir|. Must be called on a thread that allows file // operations. -FilePath GetDriveTempDownloadPath(const FilePath& drive_tmp_download_dir) { +base::FilePath GetDriveTempDownloadPath( + const base::FilePath& drive_tmp_download_dir) { bool created = file_util::CreateDirectory(drive_tmp_download_dir); DCHECK(created) << "Can not create temp download directory at " << drive_tmp_download_dir.value(); - FilePath drive_tmp_download_path; + base::FilePath drive_tmp_download_path; created = file_util::CreateTemporaryFileInDir(drive_tmp_download_dir, &drive_tmp_download_path); DCHECK(created) << "Temporary download file creation failed"; @@ -65,9 +66,9 @@ FilePath GetDriveTempDownloadPath(const FilePath& drive_tmp_download_dir) { } // Moves downloaded file to Drive. -void MoveDownloadedFile(const FilePath& downloaded_file, +void MoveDownloadedFile(const base::FilePath& downloaded_file, DriveFileError error, - const FilePath& dest_path) { + const base::FilePath& dest_path) { if (error != DRIVE_FILE_OK) return; file_util::Move(downloaded_file, dest_path); @@ -83,7 +84,7 @@ void ContinueCheckingForFileExistence( // Returns true if |download| is a Drive download created from data persisted // on the download history DB. -bool IsPersistedDriveDownload(const FilePath& drive_tmp_download_path, +bool IsPersistedDriveDownload(const base::FilePath& drive_tmp_download_path, DownloadItem* download) { // Persisted downloads are not in IN_PROGRESS state when created, while newly // created downloads are. @@ -113,7 +114,7 @@ DriveDownloadHandler* DriveDownloadHandler::GetForProfile(Profile* profile) { void DriveDownloadHandler::Initialize( DownloadManager* download_manager, - const FilePath& drive_tmp_download_path) { + const base::FilePath& drive_tmp_download_path) { DCHECK(!drive_tmp_download_path.empty()); drive_tmp_download_path_ = drive_tmp_download_path; @@ -131,7 +132,7 @@ void DriveDownloadHandler::Initialize( } void DriveDownloadHandler::SubstituteDriveDownloadPath( - const FilePath& drive_path, + const base::FilePath& drive_path, content::DownloadItem* download, const SubstituteDriveDownloadPathCallback& callback) { DVLOG(1) << "SubstituteDriveDownloadPath " << drive_path.value(); @@ -144,7 +145,7 @@ void DriveDownloadHandler::SubstituteDriveDownloadPath( // DriveFileSystem::GetEntryInfoByPath // OnEntryFound calls DriveFileSystem::CreateDirectory (if necessary) // OnCreateDirectory calls SubstituteDriveDownloadPathInternal - const FilePath drive_dir_path = + const base::FilePath drive_dir_path = util::ExtractDrivePath(drive_path.DirName()); // Ensure the directory exists. This also forces DriveFileSystem to // initialize DriveRootDirectory. @@ -159,7 +160,7 @@ void DriveDownloadHandler::SubstituteDriveDownloadPath( } } -void DriveDownloadHandler::SetDownloadParams(const FilePath& drive_path, +void DriveDownloadHandler::SetDownloadParams(const base::FilePath& drive_path, DownloadItem* download) { if (!download || (download->GetState() != DownloadItem::IN_PROGRESS)) return; @@ -172,16 +173,17 @@ void DriveDownloadHandler::SetDownloadParams(const FilePath& drive_path, // /drive, and the user has now changed the download target to a local // folder. download->SetUserData(&kDrivePathKey, NULL); - download->SetDisplayName(FilePath()); + download->SetDisplayName(base::FilePath()); } } -FilePath DriveDownloadHandler::GetTargetPath(const DownloadItem* download) { +base::FilePath DriveDownloadHandler::GetTargetPath( + const DownloadItem* download) { const DriveUserData* data = GetDriveUserData(download); // If data is NULL, we've somehow lost the drive path selected by the file // picker. DCHECK(data); - return data ? data->file_path() : FilePath(); + return data ? data->file_path() : base::FilePath(); } bool DriveDownloadHandler::IsDriveDownload(const DownloadItem* download) { @@ -253,7 +255,7 @@ void DriveDownloadHandler::OnDownloadUpdated( } void DriveDownloadHandler::OnEntryFound( - const FilePath& drive_dir_path, + const base::FilePath& drive_dir_path, const SubstituteDriveDownloadPathCallback& callback, DriveFileError error, scoped_ptr<DriveEntryProto> entry_proto) { @@ -271,7 +273,7 @@ void DriveDownloadHandler::OnEntryFound( } else { LOG(WARNING) << "Failed to get entry info for path: " << drive_dir_path.value() << ", error = " << error; - callback.Run(FilePath()); + callback.Run(base::FilePath()); } } @@ -287,7 +289,7 @@ void DriveDownloadHandler::OnCreateDirectory( callback); } else { LOG(WARNING) << "Failed to create directory, error = " << error; - callback.Run(FilePath()); + callback.Run(base::FilePath()); } } diff --git a/chrome/browser/chromeos/drive/drive_download_handler.h b/chrome/browser/chromeos/drive/drive_download_handler.h index 3420ebb..c80d8e0 100644 --- a/chrome/browser/chromeos/drive/drive_download_handler.h +++ b/chrome/browser/chromeos/drive/drive_download_handler.h @@ -37,26 +37,26 @@ class DriveDownloadHandler : public AllDownloadItemNotifier::Observer { // Become an observer of DownloadManager. void Initialize(content::DownloadManager* download_manager, - const FilePath& drive_tmp_download_path); + const base::FilePath& drive_tmp_download_path); // Callback used to return results from SubstituteDriveDownloadPath. // TODO(hashimoto): Report error with a DriveFileError. crbug.com/171345 - typedef base::Callback<void(const FilePath&)> + typedef base::Callback<void(const base::FilePath&)> SubstituteDriveDownloadPathCallback; void SubstituteDriveDownloadPath( - const FilePath& drive_path, + const base::FilePath& drive_path, content::DownloadItem* download, const SubstituteDriveDownloadPathCallback& callback); // Sets drive path, for example, '/special/drive/MyFolder/MyFile', // to external data in |download|. Also sets display name and // makes |download| a temporary. - void SetDownloadParams(const FilePath& drive_path, + void SetDownloadParams(const base::FilePath& drive_path, content::DownloadItem* download); // Gets the target drive path from external data in |download|. - FilePath GetTargetPath(const content::DownloadItem* download); + base::FilePath GetTargetPath(const content::DownloadItem* download); // Checks if there is a Drive upload associated with |download| bool IsDriveDownload(const content::DownloadItem* download); @@ -78,7 +78,7 @@ class DriveDownloadHandler : public AllDownloadItemNotifier::Observer { // Callback for DriveFileSystem::GetEntryInfoByPath(). // Used to implement SubstituteDriveDownloadPath(). - void OnEntryFound(const FilePath& drive_dir_path, + void OnEntryFound(const base::FilePath& drive_dir_path, const SubstituteDriveDownloadPathCallback& callback, DriveFileError error, scoped_ptr<DriveEntryProto> entry_proto); @@ -98,7 +98,7 @@ class DriveDownloadHandler : public AllDownloadItemNotifier::Observer { scoped_ptr<AllDownloadItemNotifier> notifier_; // Temporary download location directory. - FilePath drive_tmp_download_path_; + base::FilePath drive_tmp_download_path_; // Note: This should remain the last member so it'll be destroyed and // invalidate its weak pointers before any other members are destroyed. diff --git a/chrome/browser/chromeos/drive/drive_feed_loader.cc b/chrome/browser/chromeos/drive/drive_feed_loader.cc index b13b04c..301b746 100644 --- a/chrome/browser/chromeos/drive/drive_feed_loader.cc +++ b/chrome/browser/chromeos/drive/drive_feed_loader.cc @@ -31,9 +31,9 @@ namespace drive { namespace { -const FilePath::CharType kFilesystemProtoFile[] = +const base::FilePath::CharType kFilesystemProtoFile[] = FILE_PATH_LITERAL("file_system.pb"); -const FilePath::CharType kResourceMetadataDBFile[] = +const base::FilePath::CharType kResourceMetadataDBFile[] = FILE_PATH_LITERAL("resource_metadata.db"); // Update the fetch progress UI per every this number of feeds. @@ -61,7 +61,7 @@ SerializationTimetable kSerializeTimetable[] = { // Loads the file at |path| into the string |serialized_proto| on a blocking // thread. -DriveFileError LoadProtoOnBlockingPool(const FilePath& path, +DriveFileError LoadProtoOnBlockingPool(const base::FilePath& path, base::Time* last_modified, std::string* serialized_proto) { base::PlatformFileInfo info; @@ -93,7 +93,7 @@ bool ShouldSerializeFileSystemNow(size_t serialized_size, } // Saves the string |serialized_proto| to a file at |path| on a blocking thread. -void SaveProtoOnBlockingPool(const FilePath& path, +void SaveProtoOnBlockingPool(const base::FilePath& path, scoped_ptr<std::string> serialized_proto) { const int file_size = static_cast<int>(serialized_proto->length()); if (file_util::WriteFile(path, serialized_proto->data(), file_size) != @@ -555,7 +555,8 @@ void DriveFeedLoader::LoadFromCache(const FileOperationCallback& callback) { refreshing_ = true; LoadRootFeedParams* params = new LoadRootFeedParams(callback); - FilePath path = cache_->GetCacheDirectoryPath(DriveCache::CACHE_TYPE_META); + base::FilePath path = + cache_->GetCacheDirectoryPath(DriveCache::CACHE_TYPE_META); if (UseLevelDB()) { path = path.Append(kResourceMetadataDBFile); resource_metadata_->InitFromDB(path, blocking_task_runner_, @@ -622,7 +623,7 @@ void DriveFeedLoader::SaveFileSystem() { if (UseLevelDB()) { resource_metadata_->SaveToDB(); } else { - const FilePath path = + const base::FilePath path = cache_->GetCacheDirectoryPath(DriveCache::CACHE_TYPE_META).Append( kFilesystemProtoFile); scoped_ptr<std::string> serialized_proto(new std::string()); @@ -667,7 +668,7 @@ void DriveFeedLoader::NotifyDirectoryChanged( DCHECK(!update_finished_callback.is_null()); if (should_notify_changed_directories) { - for (std::set<FilePath>::iterator dir_iter = + for (std::set<base::FilePath>::iterator dir_iter = feed_processor_->changed_dirs().begin(); dir_iter != feed_processor_->changed_dirs().end(); ++dir_iter) { diff --git a/chrome/browser/chromeos/drive/drive_feed_processor.cc b/chrome/browser/chromeos/drive/drive_feed_processor.cc index 22746ea..dde43bc 100644 --- a/chrome/browser/chromeos/drive/drive_feed_processor.cc +++ b/chrome/browser/chromeos/drive/drive_feed_processor.cc @@ -93,7 +93,7 @@ void DriveFeedProcessor::ApplyEntryProtoMap(bool is_delta_feed) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); if (!is_delta_feed) { // Full update. - changed_dirs_.insert(FilePath(kDriveRootDirectory)); + changed_dirs_.insert(base::FilePath(kDriveRootDirectory)); resource_metadata_->RemoveAll( base::Bind(&DriveFeedProcessor::ApplyNextEntryProtoAsync, weak_ptr_factory_.GetWeakPtr())); @@ -162,7 +162,7 @@ void DriveFeedProcessor::ApplyEntryProto(const DriveEntryProto& entry_proto) { void DriveFeedProcessor::ContinueApplyEntryProto( const DriveEntryProto& entry_proto, DriveFileError error, - const FilePath& file_path, + const base::FilePath& file_path, scoped_ptr<DriveEntryProto> old_entry_proto) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); @@ -193,9 +193,10 @@ void DriveFeedProcessor::AddEntryToParent(const DriveEntryProto& entry_proto) { entry_proto.file_info().is_directory())); } -void DriveFeedProcessor::NotifyForAddEntryToParent(bool is_directory, - DriveFileError error, - const FilePath& file_path) { +void DriveFeedProcessor::NotifyForAddEntryToParent( + bool is_directory, + DriveFileError error, + const base::FilePath& file_path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DVLOG(1) << "NotifyForAddEntryToParent " << file_path.value(); @@ -213,13 +214,13 @@ void DriveFeedProcessor::NotifyForAddEntryToParent(bool is_directory, void DriveFeedProcessor::RemoveEntryFromParent( const DriveEntryProto& entry_proto, - const FilePath& file_path) { + const base::FilePath& file_path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!file_path.empty()); if (!entry_proto.file_info().is_directory()) { // No children if entry is a file. - OnGetChildrenForRemove(entry_proto, file_path, std::set<FilePath>()); + OnGetChildrenForRemove(entry_proto, file_path, std::set<base::FilePath>()); } else { // If entry is a directory, notify its children. resource_metadata_->GetChildDirectories( @@ -233,8 +234,8 @@ void DriveFeedProcessor::RemoveEntryFromParent( void DriveFeedProcessor::OnGetChildrenForRemove( const DriveEntryProto& entry_proto, - const FilePath& file_path, - const std::set<FilePath>& child_directories) { + const base::FilePath& file_path, + const std::set<base::FilePath>& child_directories) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!file_path.empty()); @@ -249,10 +250,10 @@ void DriveFeedProcessor::OnGetChildrenForRemove( void DriveFeedProcessor::NotifyForRemoveEntryFromParent( bool is_directory, - const FilePath& file_path, - const std::set<FilePath>& child_directories, + const base::FilePath& file_path, + const std::set<base::FilePath>& child_directories, DriveFileError error, - const FilePath& parent_path) { + const base::FilePath& parent_path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DVLOG(1) << "NotifyForRemoveEntryFromParent " << file_path.value(); @@ -274,7 +275,7 @@ void DriveFeedProcessor::NotifyForRemoveEntryFromParent( } void DriveFeedProcessor::RefreshEntry(const DriveEntryProto& entry_proto, - const FilePath& file_path) { + const base::FilePath& file_path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); resource_metadata_->RefreshEntry( @@ -285,9 +286,9 @@ void DriveFeedProcessor::RefreshEntry(const DriveEntryProto& entry_proto, } void DriveFeedProcessor::NotifyForRefreshEntry( - const FilePath& old_file_path, + const base::FilePath& old_file_path, DriveFileError error, - const FilePath& file_path, + const base::FilePath& file_path, scoped_ptr<DriveEntryProto> entry_proto) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); @@ -361,7 +362,7 @@ void DriveFeedProcessor::UpdateRootUploadUrl() { DCHECK(root_upload_url_.is_valid()); resource_metadata_->GetEntryInfoByPath( - FilePath(kDriveRootDirectory), + base::FilePath(kDriveRootDirectory), base::Bind(&DriveFeedProcessor::OnGetRootEntryProto, weak_ptr_factory_.GetWeakPtr())); } @@ -387,7 +388,7 @@ void DriveFeedProcessor::OnGetRootEntryProto( void DriveFeedProcessor::OnUpdateRootUploadUrl( DriveFileError error, - const FilePath& /* root_path */, + const base::FilePath& /* root_path */, scoped_ptr<DriveEntryProto> /* root_proto */) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); LOG_IF(WARNING, error != DRIVE_FILE_OK) << "Failed to refresh root directory"; diff --git a/chrome/browser/chromeos/drive/drive_feed_processor.h b/chrome/browser/chromeos/drive/drive_feed_processor.h index 6057017..54a9353 100644 --- a/chrome/browser/chromeos/drive/drive_feed_processor.h +++ b/chrome/browser/chromeos/drive/drive_feed_processor.h @@ -69,7 +69,7 @@ class DriveFeedProcessor { const DriveEntryProtoMap& entry_proto_map() const { return entry_proto_map_; } // The set of changed directories as a result of feed processing. - const std::set<FilePath>& changed_dirs() const { return changed_dirs_; } + const std::set<base::FilePath>& changed_dirs() const { return changed_dirs_; } private: // Applies the pre-processed feed from entry_proto_map_ onto the filesystem. @@ -88,7 +88,7 @@ class DriveFeedProcessor { void ContinueApplyEntryProto( const DriveEntryProto& entry_proto, DriveFileError error, - const FilePath& file_path, + const base::FilePath& file_path, scoped_ptr<DriveEntryProto> old_entry_proto); // Apply the DriveEntryProto pointed to by |it| to resource_metadata_. @@ -101,39 +101,39 @@ class DriveFeedProcessor { // Callback for DriveResourceMetadata::AddEntryToParent. void NotifyForAddEntryToParent(bool is_directory, DriveFileError error, - const FilePath& file_path); + const base::FilePath& file_path); // Removes entry pointed to by |resource_id| from its parent. Updates // changed_dirs_ as a side effect. void RemoveEntryFromParent( const DriveEntryProto& entry_proto, - const FilePath& file_path); + const base::FilePath& file_path); // Continues RemoveEntryFromParent after // DriveResourceMetadata::GetChildDirectories. void OnGetChildrenForRemove( const DriveEntryProto& entry_proto, - const FilePath& file_path, - const std::set<FilePath>& child_directories); + const base::FilePath& file_path, + const std::set<base::FilePath>& child_directories); // Callback for DriveResourceMetadata::RemoveEntryFromParent. void NotifyForRemoveEntryFromParent( bool is_directory, - const FilePath& file_path, - const std::set<FilePath>& child_directories, + const base::FilePath& file_path, + const std::set<base::FilePath>& child_directories, DriveFileError error, - const FilePath& parent_path); + const base::FilePath& parent_path); // Refreshes DriveResourceMetadata entry that has the same resource_id as // |entry_proto| with |entry_proto|. Updates changed_dirs_ as a side effect. void RefreshEntry(const DriveEntryProto& entry_proto, - const FilePath& file_path); + const base::FilePath& file_path); // Callback for DriveResourceMetadata::RefreshEntry. void NotifyForRefreshEntry( - const FilePath& old_file_path, + const base::FilePath& old_file_path, DriveFileError error, - const FilePath& file_path, + const base::FilePath& file_path, scoped_ptr<DriveEntryProto> entry_proto); // Updates the upload url of the root directory with root_upload_url_. @@ -147,7 +147,7 @@ class DriveFeedProcessor { // Callback for DriveResourceMetadata::RefreshEntry after the root upload // url is set. void OnUpdateRootUploadUrl(DriveFileError error, - const FilePath& root_path, + const base::FilePath& root_path, scoped_ptr<DriveEntryProto> root_proto); // Runs after all entries have been processed. @@ -159,7 +159,7 @@ class DriveFeedProcessor { DriveResourceMetadata* resource_metadata_; // Not owned. DriveEntryProtoMap entry_proto_map_; - std::set<FilePath> changed_dirs_; + std::set<base::FilePath> changed_dirs_; GURL root_upload_url_; int64 largest_changestamp_; base::Closure on_complete_callback_; diff --git a/chrome/browser/chromeos/drive/drive_file_system.cc b/chrome/browser/chromeos/drive/drive_file_system.cc index 59694b9..c5d1d9f 100644 --- a/chrome/browser/chromeos/drive/drive_file_system.cc +++ b/chrome/browser/chromeos/drive/drive_file_system.cc @@ -54,7 +54,7 @@ const int kSlowPollingIntervalInSec = 300; // Runs GetFileCallback with pointers dereferenced. // Used for PostTaskAndReply(). void RunGetFileCallbackHelper(const GetFileCallback& callback, - FilePath* file_path, + base::FilePath* file_path, const std::string& mime_type, DriveFileType file_type, DriveFileError error) { @@ -117,10 +117,10 @@ void EmptyFileOperationCallback(DriveFileError error) {} // Creates a temporary JSON file representing a document with |edit_url| // and |resource_id| under |document_dir| on blocking pool. DriveFileError CreateDocumentJsonFileOnBlockingPool( - const FilePath& document_dir, + const base::FilePath& document_dir, const GURL& edit_url, const std::string& resource_id, - FilePath* temp_file_path) { + base::FilePath* temp_file_path) { DCHECK(temp_file_path); DriveFileError error = DRIVE_FILE_ERROR_FAILED; @@ -145,7 +145,7 @@ DriveFileError CreateDocumentJsonFileOnBlockingPool( // create GetEntryInfoCallback. void RunGetEntryInfoWithFilePathCallback( const GetEntryInfoWithFilePathCallback& callback, - const FilePath& path, + const base::FilePath& path, DriveFileError error, scoped_ptr<DriveEntryProto> entry_proto) { DCHECK(!callback.is_null()); @@ -189,8 +189,8 @@ DriveFileSystem::GetFileCompleteForOpenParams::GetFileCompleteForOpenParams( // DriveFileSystem::GetFileFromCacheParams struct implementation. struct DriveFileSystem::GetFileFromCacheParams { GetFileFromCacheParams( - const FilePath& virtual_file_path, - const FilePath& local_tmp_path, + const base::FilePath& virtual_file_path, + const base::FilePath& local_tmp_path, const std::string& resource_id, const std::string& md5, const std::string& mime_type, @@ -205,9 +205,9 @@ struct DriveFileSystem::GetFileFromCacheParams { get_content_callback(get_content_callback) { } - FilePath virtual_file_path; - FilePath local_tmp_path; - FilePath cache_file_path; + base::FilePath virtual_file_path; + base::FilePath local_tmp_path; + base::FilePath cache_file_path; std::string resource_id; std::string md5; std::string mime_type; @@ -217,7 +217,7 @@ struct DriveFileSystem::GetFileFromCacheParams { // DriveFileSystem::AddUploadedFileParams implementation. struct DriveFileSystem::AddUploadedFileParams { - AddUploadedFileParams(const FilePath& file_content_path, + AddUploadedFileParams(const base::FilePath& file_content_path, const FileOperationCallback& callback, const std::string& resource_id, const std::string& md5) @@ -227,7 +227,7 @@ struct DriveFileSystem::AddUploadedFileParams { md5(md5) { } - FilePath file_content_path; + base::FilePath file_content_path; FileOperationCallback callback; std::string resource_id; std::string md5; @@ -401,13 +401,13 @@ void DriveFileSystem::GetEntryInfoByResourceId( void DriveFileSystem::GetEntryInfoByResourceIdAfterGetEntry( const GetEntryInfoWithFilePathCallback& callback, DriveFileError error, - const FilePath& file_path, + const base::FilePath& file_path, scoped_ptr<DriveEntryProto> entry_proto) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!callback.is_null()); if (error != DRIVE_FILE_OK) { - callback.Run(error, FilePath(), scoped_ptr<DriveEntryProto>()); + callback.Run(error, base::FilePath(), scoped_ptr<DriveEntryProto>()); return; } DCHECK(entry_proto.get()); @@ -449,8 +449,8 @@ void DriveFileSystem::LoadFeedIfNeeded(const FileOperationCallback& callback) { } void DriveFileSystem::TransferFileFromRemoteToLocal( - const FilePath& remote_src_file_path, - const FilePath& local_dest_file_path, + const base::FilePath& remote_src_file_path, + const base::FilePath& local_dest_file_path, const FileOperationCallback& callback) { drive_operations_.TransferFileFromRemoteToLocal(remote_src_file_path, @@ -459,8 +459,8 @@ void DriveFileSystem::TransferFileFromRemoteToLocal( } void DriveFileSystem::TransferFileFromLocalToRemote( - const FilePath& local_src_file_path, - const FilePath& remote_dest_file_path, + const base::FilePath& local_src_file_path, + const base::FilePath& remote_dest_file_path, const FileOperationCallback& callback) { drive_operations_.TransferFileFromLocalToRemote(local_src_file_path, @@ -468,23 +468,23 @@ void DriveFileSystem::TransferFileFromLocalToRemote( callback); } -void DriveFileSystem::Copy(const FilePath& src_file_path, - const FilePath& dest_file_path, +void DriveFileSystem::Copy(const base::FilePath& src_file_path, + const base::FilePath& dest_file_path, const FileOperationCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!callback.is_null()); drive_operations_.Copy(src_file_path, dest_file_path, callback); } -void DriveFileSystem::Move(const FilePath& src_file_path, - const FilePath& dest_file_path, +void DriveFileSystem::Move(const base::FilePath& src_file_path, + const base::FilePath& dest_file_path, const FileOperationCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!callback.is_null()); drive_operations_.Move(src_file_path, dest_file_path, callback); } -void DriveFileSystem::Remove(const FilePath& file_path, +void DriveFileSystem::Remove(const base::FilePath& file_path, bool is_recursive, const FileOperationCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); @@ -493,7 +493,7 @@ void DriveFileSystem::Remove(const FilePath& file_path, } void DriveFileSystem::CreateDirectory( - const FilePath& directory_path, + const base::FilePath& directory_path, bool is_exclusive, bool is_recursive, const FileOperationCallback& callback) { @@ -504,7 +504,7 @@ void DriveFileSystem::CreateDirectory( directory_path, is_exclusive, is_recursive, callback); } -void DriveFileSystem::CreateFile(const FilePath& file_path, +void DriveFileSystem::CreateFile(const base::FilePath& file_path, bool is_exclusive, const FileOperationCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); @@ -521,7 +521,7 @@ void DriveFileSystem::CreateFile(const FilePath& file_path, } void DriveFileSystem::OnGetEntryInfoForCreateFile( - const FilePath& file_path, + const base::FilePath& file_path, bool is_exclusive, const FileOperationCallback& callback, DriveFileError result, @@ -556,12 +556,12 @@ void DriveFileSystem::OnGetEntryInfoForCreateFile( // No entry found at |file_path|. Let's create a brand new file. // For now, it is implemented by uploading an empty file (/dev/null). // TODO(kinaba): http://crbug.com/135143. Implement in a nicer way. - drive_operations_.TransferRegularFile(FilePath(kEmptyFilePath), + drive_operations_.TransferRegularFile(base::FilePath(kEmptyFilePath), file_path, callback); } -void DriveFileSystem::GetFileByPath(const FilePath& file_path, +void DriveFileSystem::GetFileByPath(const base::FilePath& file_path, const GetFileCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!callback.is_null()); @@ -575,7 +575,7 @@ void DriveFileSystem::GetFileByPath(const FilePath& file_path, } void DriveFileSystem::OnGetEntryInfoCompleteForGetFileByPath( - const FilePath& file_path, + const base::FilePath& file_path, const GetFileCallback& callback, DriveFileError error, scoped_ptr<DriveEntryProto> entry_proto) { @@ -583,7 +583,7 @@ void DriveFileSystem::OnGetEntryInfoCompleteForGetFileByPath( DCHECK(!callback.is_null()); if (error != DRIVE_FILE_OK) { - callback.Run(error, FilePath(), std::string(), REGULAR_FILE); + callback.Run(error, base::FilePath(), std::string(), REGULAR_FILE); return; } DCHECK(entry_proto.get()); @@ -595,7 +595,7 @@ void DriveFileSystem::OnGetEntryInfoCompleteForGetFileByPath( } void DriveFileSystem::GetResolvedFileByPath( - const FilePath& file_path, + const base::FilePath& file_path, const GetFileCallback& get_file_callback, const google_apis::GetContentCallback& get_content_callback, scoped_ptr<DriveEntryProto> entry_proto) { @@ -605,7 +605,7 @@ void DriveFileSystem::GetResolvedFileByPath( if (!entry_proto->has_file_specific_info()) { get_file_callback.Run(DRIVE_FILE_ERROR_NOT_FOUND, - FilePath(), + base::FilePath(), std::string(), REGULAR_FILE); return; @@ -616,7 +616,7 @@ void DriveFileSystem::GetResolvedFileByPath( // formats. The JSON file contains the edit URL and resource ID of the // document. if (entry_proto->file_specific_info().is_hosted_document()) { - FilePath* temp_file_path = new FilePath; + base::FilePath* temp_file_path = new base::FilePath; const std::string mime_type = kMimeTypeJson; const DriveFileType file_type = HOSTED_DOCUMENT; base::PostTaskAndReplyWithResult( @@ -637,7 +637,7 @@ void DriveFileSystem::GetResolvedFileByPath( } // Returns absolute path of the file if it were cached or to be cached. - FilePath local_tmp_path = cache_->GetCacheFilePath( + base::FilePath local_tmp_path = cache_->GetCacheFilePath( entry_proto->resource_id(), entry_proto->file_specific_info().file_md5(), DriveCache::CACHE_TYPE_TMP, @@ -676,14 +676,14 @@ void DriveFileSystem::GetFileByResourceIdAfterGetEntry( const GetFileCallback& get_file_callback, const google_apis::GetContentCallback& get_content_callback, DriveFileError error, - const FilePath& file_path, + const base::FilePath& file_path, scoped_ptr<DriveEntryProto> entry_proto) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!get_file_callback.is_null()); if (error != DRIVE_FILE_OK) { get_file_callback.Run(DRIVE_FILE_ERROR_NOT_FOUND, - FilePath(), + base::FilePath(), std::string(), REGULAR_FILE); return; @@ -698,7 +698,7 @@ void DriveFileSystem::GetFileByResourceIdAfterGetEntry( void DriveFileSystem::OnGetFileFromCache( const GetFileFromCacheParams& in_params, DriveFileError error, - const FilePath& cache_file_path) { + const base::FilePath& cache_file_path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!in_params.get_file_callback.is_null()); @@ -779,7 +779,7 @@ void DriveFileSystem::CheckForSpaceBeforeDownload( int64 file_size, const GURL& download_url, DriveFileError error, - const FilePath& /* drive_file_path */, + const base::FilePath& /* drive_file_path */, scoped_ptr<DriveEntryProto> /* entry_proto */) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!params.get_file_callback.is_null()); @@ -804,7 +804,7 @@ void DriveFileSystem::CheckForSpaceBeforeDownload( void DriveFileSystem::StartDownloadFileIfEnoughSpace( const GetFileFromCacheParams& params, const GURL& download_url, - const FilePath& cache_file_path, + const base::FilePath& cache_file_path, bool has_enough_space) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!params.get_file_callback.is_null()); @@ -829,7 +829,7 @@ void DriveFileSystem::StartDownloadFileIfEnoughSpace( params.get_content_callback); } -void DriveFileSystem::GetEntryInfoByPath(const FilePath& file_path, +void DriveFileSystem::GetEntryInfoByPath(const base::FilePath& file_path, const GetEntryInfoCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!callback.is_null()); @@ -842,7 +842,7 @@ void DriveFileSystem::GetEntryInfoByPath(const FilePath& file_path, } void DriveFileSystem::GetEntryInfoByPathAfterLoad( - const FilePath& file_path, + const base::FilePath& file_path, const GetEntryInfoCallback& callback, DriveFileError error) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); @@ -877,7 +877,7 @@ void DriveFileSystem::GetEntryInfoByPathAfterGetEntry( } void DriveFileSystem::ReadDirectoryByPath( - const FilePath& directory_path, + const base::FilePath& directory_path, const ReadDirectoryWithSettingCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!callback.is_null()); @@ -889,7 +889,7 @@ void DriveFileSystem::ReadDirectoryByPath( } void DriveFileSystem::ReadDirectoryByPathAfterLoad( - const FilePath& directory_path, + const base::FilePath& directory_path, const ReadDirectoryWithSettingCallback& callback, DriveFileError error) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); @@ -927,7 +927,8 @@ void DriveFileSystem::ReadDirectoryByPathAfterRead( callback.Run(DRIVE_FILE_OK, hide_hosted_docs_, entries.Pass()); } -void DriveFileSystem::RequestDirectoryRefresh(const FilePath& directory_path) { +void DriveFileSystem::RequestDirectoryRefresh( + const base::FilePath& directory_path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); // Make sure the destination directory exists. @@ -939,7 +940,7 @@ void DriveFileSystem::RequestDirectoryRefresh(const FilePath& directory_path) { } void DriveFileSystem::RequestDirectoryRefreshAfterGetEntryInfo( - const FilePath& directory_path, + const base::FilePath& directory_path, DriveFileError error, scoped_ptr<DriveEntryProto> entry_proto) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); @@ -960,7 +961,7 @@ void DriveFileSystem::RequestDirectoryRefreshAfterGetEntryInfo( void DriveFileSystem::OnRequestDirectoryRefresh( const std::string& directory_resource_id, - const FilePath& directory_path, + const base::FilePath& directory_path, const ScopedVector<google_apis::ResourceList>& feed_list, DriveFileError error) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); @@ -1080,7 +1081,7 @@ void DriveFileSystem::OnSearch( } else { entry_info_callback.Run( DRIVE_FILE_OK, - FilePath::FromUTF8Unsafe(entry_proto.base_name()), + base::FilePath::FromUTF8Unsafe(entry_proto.base_name()), scoped_ptr<DriveEntryProto>(new DriveEntryProto(entry_proto))); } } @@ -1091,7 +1092,7 @@ void DriveFileSystem::AddToSearchResults( bool should_run_callback, const base::Closure& callback, DriveFileError error, - const FilePath& drive_file_path, + const base::FilePath& drive_file_path, scoped_ptr<DriveEntryProto> entry_proto) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(entry_proto.get()); @@ -1132,11 +1133,11 @@ void DriveFileSystem::Search(const std::string& search_query, } void DriveFileSystem::OnDirectoryChangedByOperation( - const FilePath& directory_path) { + const base::FilePath& directory_path) { OnDirectoryChanged(directory_path); } -void DriveFileSystem::OnDirectoryChanged(const FilePath& directory_path) { +void DriveFileSystem::OnDirectoryChanged(const base::FilePath& directory_path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); FOR_EACH_OBSERVER(DriveFileSystemObserver, observers_, @@ -1167,7 +1168,7 @@ void DriveFileSystem::LoadRootFeedFromCacheForTesting( void DriveFileSystem::OnFileDownloaded( const GetFileFromCacheParams& params, google_apis::GDataErrorCode status, - const FilePath& downloaded_file_path) { + const base::FilePath& downloaded_file_path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!params.get_file_callback.is_null()); @@ -1214,7 +1215,7 @@ void DriveFileSystem::UnpinIfPinned( void DriveFileSystem::OnFileDownloadedAndSpaceChecked( const GetFileFromCacheParams& params, google_apis::GDataErrorCode status, - const FilePath& downloaded_file_path, + const base::FilePath& downloaded_file_path, bool has_enough_space) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!params.get_file_callback.is_null()); @@ -1253,7 +1254,7 @@ void DriveFileSystem::OnFileDownloadedAndSpaceChecked( void DriveFileSystem::OnDirectoryChangeFileMoveCallback( DriveFileError error, - const FilePath& directory_path) { + const base::FilePath& directory_path) { if (error == DRIVE_FILE_OK) OnDirectoryChanged(directory_path); } @@ -1312,9 +1313,9 @@ void DriveFileSystem::NotifyInitialLoadFinishedAndRun( } void DriveFileSystem::AddUploadedFile( - const FilePath& directory_path, + const base::FilePath& directory_path, scoped_ptr<google_apis::ResourceEntry> entry, - const FilePath& file_content_path, + const base::FilePath& file_content_path, const FileOperationCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(entry.get()); @@ -1337,7 +1338,7 @@ void DriveFileSystem::AddUploadedFile( void DriveFileSystem::AddUploadedFileToCache( const AddUploadedFileParams& params, DriveFileError error, - const FilePath& file_path) { + const base::FilePath& file_path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!params.resource_id.empty()); DCHECK(!params.md5.empty()); @@ -1393,7 +1394,7 @@ void DriveFileSystem::SetHideHostedDocuments(bool hide) { // Kick off directory refresh when this setting changes. FOR_EACH_OBSERVER(DriveFileSystemObserver, observers_, - OnDirectoryChanged(FilePath(kDriveRootDirectory))); + OnDirectoryChanged(base::FilePath(kDriveRootDirectory))); } //============= DriveFileSystem: internal helper functions ===================== @@ -1409,7 +1410,7 @@ void DriveFileSystem::InitializePreferenceObserver() { base::Unretained(this))); } -void DriveFileSystem::OpenFile(const FilePath& file_path, +void DriveFileSystem::OpenFile(const base::FilePath& file_path, const OpenFileCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!callback.is_null()); @@ -1422,7 +1423,7 @@ void DriveFileSystem::OpenFile(const FilePath& file_path, if (open_files_.find(file_path) != open_files_.end()) { base::MessageLoopProxy::current()->PostTask( FROM_HERE, - base::Bind(callback, DRIVE_FILE_ERROR_IN_USE, FilePath())); + base::Bind(callback, DRIVE_FILE_ERROR_IN_USE, base::FilePath())); return; } open_files_.insert(file_path); @@ -1439,7 +1440,7 @@ void DriveFileSystem::OpenFile(const FilePath& file_path, } void DriveFileSystem::OnGetEntryInfoCompleteForOpenFile( - const FilePath& file_path, + const base::FilePath& file_path, const OpenFileCallback& callback, DriveFileError error, scoped_ptr<DriveEntryProto> entry_proto) { @@ -1459,7 +1460,7 @@ void DriveFileSystem::OnGetEntryInfoCompleteForOpenFile( } if (error != DRIVE_FILE_OK) { - callback.Run(error, FilePath()); + callback.Run(error, base::FilePath()); return; } @@ -1481,14 +1482,14 @@ void DriveFileSystem::OnGetEntryInfoCompleteForOpenFile( void DriveFileSystem::OnGetFileCompleteForOpenFile( const GetFileCompleteForOpenParams& params, DriveFileError error, - const FilePath& file_path, + const base::FilePath& file_path, const std::string& mime_type, DriveFileType file_type) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!params.callback.is_null()); if (error != DRIVE_FILE_OK) { - params.callback.Run(error, FilePath()); + params.callback.Run(error, base::FilePath()); return; } @@ -1510,17 +1511,18 @@ void DriveFileSystem::OnMarkDirtyInCacheCompleteForOpenFile( DCHECK(!params.callback.is_null()); if (error != DRIVE_FILE_OK) { - params.callback.Run(error, FilePath()); + params.callback.Run(error, base::FilePath()); return; } cache_->GetFile(params.resource_id, params.md5, params.callback); } -void DriveFileSystem::OnOpenFileFinished(const FilePath& file_path, - const OpenFileCallback& callback, - DriveFileError result, - const FilePath& cache_file_path) { +void DriveFileSystem::OnOpenFileFinished( + const base::FilePath& file_path, + const OpenFileCallback& callback, + DriveFileError result, + const base::FilePath& cache_file_path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!callback.is_null()); @@ -1533,7 +1535,7 @@ void DriveFileSystem::OnOpenFileFinished(const FilePath& file_path, callback.Run(result, cache_file_path); } -void DriveFileSystem::CloseFile(const FilePath& file_path, +void DriveFileSystem::CloseFile(const base::FilePath& file_path, const FileOperationCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!callback.is_null()); @@ -1559,7 +1561,7 @@ void DriveFileSystem::CloseFile(const FilePath& file_path, } void DriveFileSystem::CloseFileAfterGetEntryInfo( - const FilePath& file_path, + const base::FilePath& file_path, const FileOperationCallback& callback, DriveFileError error, scoped_ptr<DriveEntryProto> entry_proto) { @@ -1585,7 +1587,7 @@ void DriveFileSystem::CloseFileAfterGetEntryInfo( callback); } -void DriveFileSystem::CloseFileFinalize(const FilePath& file_path, +void DriveFileSystem::CloseFileFinalize(const base::FilePath& file_path, const FileOperationCallback& callback, DriveFileError result) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); @@ -1659,7 +1661,7 @@ void DriveFileSystem::CheckLocalModificationAndRunAfterGetCacheFile( scoped_ptr<DriveEntryProto> entry_proto, const GetEntryInfoCallback& callback, DriveFileError error, - const FilePath& local_cache_path) { + const base::FilePath& local_cache_path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!callback.is_null()); diff --git a/chrome/browser/chromeos/drive/drive_file_system.h b/chrome/browser/chromeos/drive/drive_file_system.h index bf44cca..5f2db1a 100644 --- a/chrome/browser/chromeos/drive/drive_file_system.h +++ b/chrome/browser/chromeos/drive/drive_file_system.h @@ -82,34 +82,34 @@ class DriveFileSystem : public DriveFileSystemInterface, const GURL& next_feed, const SearchCallback& callback) OVERRIDE; virtual void TransferFileFromRemoteToLocal( - const FilePath& remote_src_file_path, - const FilePath& local_dest_file_path, + const base::FilePath& remote_src_file_path, + const base::FilePath& local_dest_file_path, const FileOperationCallback& callback) OVERRIDE; virtual void TransferFileFromLocalToRemote( - const FilePath& local_src_file_path, - const FilePath& remote_dest_file_path, + const base::FilePath& local_src_file_path, + const base::FilePath& remote_dest_file_path, const FileOperationCallback& callback) OVERRIDE; - virtual void OpenFile(const FilePath& file_path, + virtual void OpenFile(const base::FilePath& file_path, const OpenFileCallback& callback) OVERRIDE; - virtual void CloseFile(const FilePath& file_path, + virtual void CloseFile(const base::FilePath& file_path, const FileOperationCallback& callback) OVERRIDE; - virtual void Copy(const FilePath& src_file_path, - const FilePath& dest_file_path, + virtual void Copy(const base::FilePath& src_file_path, + const base::FilePath& dest_file_path, const FileOperationCallback& callback) OVERRIDE; - virtual void Move(const FilePath& src_file_path, - const FilePath& dest_file_path, + virtual void Move(const base::FilePath& src_file_path, + const base::FilePath& dest_file_path, const FileOperationCallback& callback) OVERRIDE; - virtual void Remove(const FilePath& file_path, + virtual void Remove(const base::FilePath& file_path, bool is_recursive, const FileOperationCallback& callback) OVERRIDE; - virtual void CreateDirectory(const FilePath& directory_path, + virtual void CreateDirectory(const base::FilePath& directory_path, bool is_exclusive, bool is_recursive, const FileOperationCallback& callback) OVERRIDE; - virtual void CreateFile(const FilePath& file_path, + virtual void CreateFile(const base::FilePath& file_path, bool is_exclusive, const FileOperationCallback& callback) OVERRIDE; - virtual void GetFileByPath(const FilePath& file_path, + virtual void GetFileByPath(const base::FilePath& file_path, const GetFileCallback& callback) OVERRIDE; virtual void GetFileByResourceId( const std::string& resource_id, @@ -119,18 +119,18 @@ class DriveFileSystem : public DriveFileSystemInterface, const std::string& resource_id, const FileOperationCallback& callback) OVERRIDE; virtual void GetEntryInfoByPath( - const FilePath& file_path, + const base::FilePath& file_path, const GetEntryInfoCallback& callback) OVERRIDE; virtual void ReadDirectoryByPath( - const FilePath& directory_path, + const base::FilePath& directory_path, const ReadDirectoryWithSettingCallback& callback) OVERRIDE; virtual void RequestDirectoryRefresh( - const FilePath& directory_path) OVERRIDE; + const base::FilePath& directory_path) OVERRIDE; virtual void GetAvailableSpace( const GetAvailableSpaceCallback& callback) OVERRIDE; - virtual void AddUploadedFile(const FilePath& directory_path, + virtual void AddUploadedFile(const base::FilePath& directory_path, scoped_ptr<google_apis::ResourceEntry> doc_entry, - const FilePath& file_content_path, + const base::FilePath& file_content_path, const FileOperationCallback& callback) OVERRIDE; virtual void GetMetadata( const GetFilesystemMetadataCallback& callback) OVERRIDE; @@ -138,11 +138,11 @@ class DriveFileSystem : public DriveFileSystemInterface, // file_system::OperationObserver overrides. virtual void OnDirectoryChangedByOperation( - const FilePath& directory_path) OVERRIDE; + const base::FilePath& directory_path) OVERRIDE; // DriveFeedLoader::Observer overrides. // Used to propagate events from DriveFeedLoader. - virtual void OnDirectoryChanged(const FilePath& directory_path) OVERRIDE; + virtual void OnDirectoryChanged(const base::FilePath& directory_path) OVERRIDE; virtual void OnResourceListFetched(int num_accumulated_entries) OVERRIDE; virtual void OnFeedFromServerLoaded() OVERRIDE; @@ -192,7 +192,7 @@ class DriveFileSystem : public DriveFileSystemInterface, bool should_run_callback, const base::Closure& callback, DriveFileError error, - const FilePath& drive_file_path, + const base::FilePath& drive_file_path, scoped_ptr<DriveEntryProto> entry_proto); // Invoked during the process of CreateFile. @@ -202,15 +202,15 @@ class DriveFileSystem : public DriveFileSystemInterface, // entry, a new empty file is uploaded, and when it finishes // DidUploadForCreateBrandNewFile does the final clean up. // |callback| must not be null. - void OnGetEntryInfoForCreateFile(const FilePath& file_path, + void OnGetEntryInfoForCreateFile(const base::FilePath& file_path, bool is_exclusive, const FileOperationCallback& callback, DriveFileError result, scoped_ptr<DriveEntryProto> entry_proto); - void DoUploadForCreateBrandNewFile(const FilePath& remote_path, - FilePath* local_path, + void DoUploadForCreateBrandNewFile(const base::FilePath& remote_path, + base::FilePath* local_path, const FileOperationCallback& callback); - void DidUploadForCreateBrandNewFile(const FilePath& local_path, + void DidUploadForCreateBrandNewFile(const base::FilePath& local_path, const FileOperationCallback& callback, DriveFileError result); @@ -218,7 +218,7 @@ class DriveFileSystem : public DriveFileSystemInterface, // GetFileByPath. It then continues to invoke GetResolvedFileByPath. // |callback| must not be null. void OnGetEntryInfoCompleteForGetFileByPath( - const FilePath& file_path, + const base::FilePath& file_path, const GetFileCallback& callback, DriveFileError error, scoped_ptr<DriveEntryProto> file_info); @@ -227,7 +227,7 @@ class DriveFileSystem : public DriveFileSystemInterface, // It then continues to invoke GetResolvedFileByPath and proceeds to // OnGetFileCompleteForOpenFile. void OnGetEntryInfoCompleteForOpenFile( - const FilePath& file_path, + const base::FilePath& file_path, const OpenFileCallback& callback, DriveFileError error, scoped_ptr<DriveEntryProto> file_info); @@ -235,10 +235,10 @@ class DriveFileSystem : public DriveFileSystemInterface, // Invoked at the last step of OpenFile. It removes |file_path| from the // current set of opened files if |result| is an error, and then invokes the // |callback| function. - void OnOpenFileFinished(const FilePath& file_path, + void OnOpenFileFinished(const base::FilePath& file_path, const OpenFileCallback& callback, DriveFileError result, - const FilePath& cache_file_path); + const base::FilePath& cache_file_path); // Invoked during the process of CloseFile. What is done here is as follows: // 1) Gets resource_id and md5 of the entry at |file_path|. @@ -246,11 +246,11 @@ class DriveFileSystem : public DriveFileSystemInterface, // 3) Removes the |file_path| from the remembered set of opened files. // 4) Invokes the user-supplied |callback|. // |callback| must not be null. - void CloseFileAfterGetEntryInfo(const FilePath& file_path, + void CloseFileAfterGetEntryInfo(const base::FilePath& file_path, const FileOperationCallback& callback, DriveFileError error, scoped_ptr<DriveEntryProto> entry_proto); - void CloseFileFinalize(const FilePath& file_path, + void CloseFileFinalize(const base::FilePath& file_path, const FileOperationCallback& callback, DriveFileError result); @@ -260,7 +260,7 @@ class DriveFileSystem : public DriveFileSystemInterface, // |file_info.md5|. void OnGetFileCompleteForOpenFile(const GetFileCompleteForOpenParams& params, DriveFileError error, - const FilePath& file_path, + const base::FilePath& file_path, const std::string& mime_type, DriveFileType file_type); @@ -278,7 +278,7 @@ class DriveFileSystem : public DriveFileSystemInterface, // Callback for handling file downloading requests. void OnFileDownloaded(const GetFileFromCacheParams& params, google_apis::GDataErrorCode status, - const FilePath& downloaded_file_path); + const base::FilePath& downloaded_file_path); // Unpins file if cache entry is pinned. void UnpinIfPinned(const std::string& resource_id, @@ -290,17 +290,17 @@ class DriveFileSystem : public DriveFileSystemInterface, // an error in case we don't have enough disk space. void OnFileDownloadedAndSpaceChecked(const GetFileFromCacheParams& params, google_apis::GDataErrorCode status, - const FilePath& downloaded_file_path, + const base::FilePath& downloaded_file_path, bool has_enough_space); // FileMoveCallback for directory changes. Notifies of directory changes. void OnDirectoryChangeFileMoveCallback(DriveFileError error, - const FilePath& directory_path); + const base::FilePath& directory_path); // Adds the uploaded file to the cache. void AddUploadedFileToCache(const AddUploadedFileParams& params, DriveFileError error, - const FilePath& file_path); + const base::FilePath& file_path); // Callback for handling results of ReloadFeedFromServerIfNeeded() initiated // from CheckForUpdates(). @@ -323,7 +323,7 @@ class DriveFileSystem : public DriveFileSystemInterface, // GetFileByPath() request. void OnGetFileFromCache(const GetFileFromCacheParams& params, DriveFileError error, - const FilePath& cache_file_path); + const base::FilePath& cache_file_path); // Callback for |drive_service_->GetResourceEntry|. // It is called before file download. If GetResourceEntry was successful, @@ -340,14 +340,14 @@ class DriveFileSystem : public DriveFileSystemInterface, int64 file_size, const GURL& download_url, DriveFileError error, - const FilePath& drive_file_path, + const base::FilePath& drive_file_path, scoped_ptr<DriveEntryProto> entry_proto); // Starts downloading a file if we have enough disk space indicated by // |has_enough_space|. void StartDownloadFileIfEnoughSpace(const GetFileFromCacheParams& params, const GURL& download_url, - const FilePath& cache_file_path, + const base::FilePath& cache_file_path, bool has_enough_space); // Changes state of hosted documents visibility, triggers directory refresh. @@ -360,7 +360,7 @@ class DriveFileSystem : public DriveFileSystemInterface, // 1) Called when the feed is loaded. // 2) Called when an entry is found. // |callback| must not be null. - void GetEntryInfoByPathAfterLoad(const FilePath& file_path, + void GetEntryInfoByPathAfterLoad(const base::FilePath& file_path, const GetEntryInfoCallback& callback, DriveFileError error); void GetEntryInfoByPathAfterGetEntry(const GetEntryInfoCallback& callback, @@ -372,7 +372,7 @@ class DriveFileSystem : public DriveFileSystemInterface, // 2) Called when an entry is found. // |callback| must not be null. void ReadDirectoryByPathAfterLoad( - const FilePath& directory_path, + const base::FilePath& directory_path, const ReadDirectoryWithSettingCallback& callback, DriveFileError error); void ReadDirectoryByPathAfterRead( @@ -391,14 +391,14 @@ class DriveFileSystem : public DriveFileSystemInterface, // |get_file_callback| must not be null. // |get_content_callback| may be null. void GetResolvedFileByPath( - const FilePath& file_path, + const base::FilePath& file_path, const GetFileCallback& get_file_callback, const google_apis::GetContentCallback& get_content_callback, scoped_ptr<DriveEntryProto> entry_proto); void OnRequestDirectoryRefresh( const std::string& directory_resource_id, - const FilePath& directory_path, + const base::FilePath& directory_path, const ScopedVector<google_apis::ResourceList>& feed_list, DriveFileError error); @@ -408,7 +408,7 @@ class DriveFileSystem : public DriveFileSystemInterface, void GetEntryInfoByResourceIdAfterGetEntry( const GetEntryInfoWithFilePathCallback& callback, DriveFileError error, - const FilePath& file_path, + const base::FilePath& file_path, scoped_ptr<DriveEntryProto> entry_proto); // Part of GetFileByResourceId(). Called after @@ -419,13 +419,13 @@ class DriveFileSystem : public DriveFileSystemInterface, const GetFileCallback& get_file_callback, const google_apis::GetContentCallback& get_content_callback, DriveFileError error, - const FilePath& file_path, + const base::FilePath& file_path, scoped_ptr<DriveEntryProto> entry_proto); // Part of RequestDirectoryRefresh(). Called after // GetEntryInfoByPath() is complete. void RequestDirectoryRefreshAfterGetEntryInfo( - const FilePath& file_path, + const base::FilePath& file_path, DriveFileError error, scoped_ptr<DriveEntryProto> entry_proto); @@ -444,7 +444,7 @@ class DriveFileSystem : public DriveFileSystemInterface, scoped_ptr<DriveEntryProto> entry_proto, const GetEntryInfoCallback& callback, DriveFileError error, - const FilePath& local_cache_path); + const base::FilePath& local_cache_path); void CheckLocalModificationAndRunAfterGetFileInfo( scoped_ptr<DriveEntryProto> entry_proto, const GetEntryInfoCallback& callback, @@ -481,7 +481,7 @@ class DriveFileSystem : public DriveFileSystemInterface, bool hide_hosted_docs_; // The set of paths opened by OpenFile but not yet closed by CloseFile. - std::set<FilePath> open_files_; + std::set<base::FilePath> open_files_; scoped_ptr<PrefChangeRegistrar> pref_registrar_; diff --git a/chrome/browser/chromeos/drive/drive_file_system_interface.h b/chrome/browser/chromeos/drive/drive_file_system_interface.h index df44133..87b3a56 100644 --- a/chrome/browser/chromeos/drive/drive_file_system_interface.h +++ b/chrome/browser/chromeos/drive/drive_file_system_interface.h @@ -29,19 +29,19 @@ typedef std::vector<DriveEntryProto> DriveEntryProtoVector; // This is data needed to create a file system entry that will be used by file // browser. struct SearchResultInfo { - SearchResultInfo(const FilePath& path, + SearchResultInfo(const base::FilePath& path, const DriveEntryProto& entry_proto) : path(path), entry_proto(entry_proto) { } - FilePath path; + base::FilePath path; DriveEntryProto entry_proto; }; // Used to get files from the file system. typedef base::Callback<void(DriveFileError error, - const FilePath& file_path, + const base::FilePath& file_path, const std::string& mime_type, DriveFileType file_type)> GetFileCallback; @@ -65,7 +65,7 @@ typedef base::Callback<void( // Used to open files from the file system. |file_path| is the path on the local // file system for the opened file. typedef base::Callback<void(DriveFileError error, - const FilePath& file_path)> OpenFileCallback; + const base::FilePath& file_path)> OpenFileCallback; // Used to get available space for the account from Drive. typedef base::Callback<void(DriveFileError error, @@ -123,8 +123,8 @@ class DriveFileSystemInterface { // // |callback| must not be null. virtual void TransferFileFromRemoteToLocal( - const FilePath& remote_src_file_path, - const FilePath& local_dest_file_path, + const base::FilePath& remote_src_file_path, + const base::FilePath& local_dest_file_path, const FileOperationCallback& callback) = 0; // Initiates transfer of |local_src_file_path| to |remote_dest_file_path|. @@ -134,8 +134,8 @@ class DriveFileSystemInterface { // // |callback| must not be null. virtual void TransferFileFromLocalToRemote( - const FilePath& local_src_file_path, - const FilePath& remote_dest_file_path, + const base::FilePath& local_src_file_path, + const base::FilePath& remote_dest_file_path, const FileOperationCallback& callback) = 0; // Retrieves a file at the virtual path |file_path| on the Drive file system @@ -147,14 +147,14 @@ class DriveFileSystemInterface { // Otherwise, Drive file system does not pick up the file for uploading. // // |callback| must not be null. - virtual void OpenFile(const FilePath& file_path, + virtual void OpenFile(const base::FilePath& file_path, const OpenFileCallback& callback) = 0; // Closes a file at the virtual path |file_path| on the Drive file system, // which is opened via OpenFile(). It commits the dirty flag on the cache. // // |callback| must not be null. - virtual void CloseFile(const FilePath& file_path, + virtual void CloseFile(const base::FilePath& file_path, const FileOperationCallback& callback) = 0; // Copies |src_file_path| to |dest_file_path| on the file system. @@ -175,8 +175,8 @@ class DriveFileSystemInterface { // of the file system. // // |callback| must not be null. - virtual void Copy(const FilePath& src_file_path, - const FilePath& dest_file_path, + virtual void Copy(const base::FilePath& src_file_path, + const base::FilePath& dest_file_path, const FileOperationCallback& callback) = 0; // Moves |src_file_path| to |dest_file_path| on the file system. @@ -195,8 +195,8 @@ class DriveFileSystemInterface { // of the file system. // // |callback| must not be null. - virtual void Move(const FilePath& src_file_path, - const FilePath& dest_file_path, + virtual void Move(const base::FilePath& src_file_path, + const base::FilePath& dest_file_path, const FileOperationCallback& callback) = 0; // Removes |file_path| from the file system. If |is_recursive| is set and @@ -208,7 +208,7 @@ class DriveFileSystemInterface { // TODO(satorux): is_recursive is not supported yet. crbug.com/138282 // // |callback| must not be null. - virtual void Remove(const FilePath& file_path, + virtual void Remove(const base::FilePath& file_path, bool is_recursive, const FileOperationCallback& callback) = 0; @@ -218,7 +218,7 @@ class DriveFileSystemInterface { // directories as needed just like mkdir -p does. // // |callback| must not be null. - virtual void CreateDirectory(const FilePath& directory_path, + virtual void CreateDirectory(const base::FilePath& directory_path, bool is_exclusive, bool is_recursive, const FileOperationCallback& callback) = 0; @@ -229,7 +229,7 @@ class DriveFileSystemInterface { // path, or the parent directory of the path is not present yet. // // |callback| must not be null. - virtual void CreateFile(const FilePath& file_path, + virtual void CreateFile(const base::FilePath& file_path, bool is_exclusive, const FileOperationCallback& callback) = 0; @@ -239,7 +239,7 @@ class DriveFileSystemInterface { // will be downloaded through GData API or Drive V2 API. // // |callback| must not be null. - virtual void GetFileByPath(const FilePath& file_path, + virtual void GetFileByPath(const base::FilePath& file_path, const GetFileCallback& callback) = 0; // Gets a file by the given |resource_id| from the Drive server. Used for @@ -268,7 +268,7 @@ class DriveFileSystemInterface { // retrieve and refresh file system content from server and disk cache. // // |callback| must not be null. - virtual void GetEntryInfoByPath(const FilePath& file_path, + virtual void GetEntryInfoByPath(const base::FilePath& file_path, const GetEntryInfoCallback& callback) = 0; // Finds and reads a directory by |file_path|. This call will also retrieve @@ -276,7 +276,7 @@ class DriveFileSystemInterface { // // |callback| must not be null. virtual void ReadDirectoryByPath( - const FilePath& file_path, + const base::FilePath& file_path, const ReadDirectoryWithSettingCallback& callback) = 0; // Requests a refresh of the directory pointed by |file_path| (i.e. fetches @@ -291,7 +291,7 @@ class DriveFileSystemInterface { // and the change is notified via Observer::OnDirectoryChanged(). Note that // this function ignores changes in directories in the target // directory. Changes in directories are handled via the delta feeds. - virtual void RequestDirectoryRefresh(const FilePath& file_path) = 0; + virtual void RequestDirectoryRefresh(const base::FilePath& file_path) = 0; // Does server side content search for |search_query|. // If |shared_with_me| is true, it searches for the files shared to the user, @@ -315,9 +315,9 @@ class DriveFileSystemInterface { // |file_content_path| into the cache. // // |callback| must not be null. - virtual void AddUploadedFile(const FilePath& directory_path, + virtual void AddUploadedFile(const base::FilePath& directory_path, scoped_ptr<google_apis::ResourceEntry> doc_entry, - const FilePath& file_content_path, + const base::FilePath& file_content_path, const FileOperationCallback& callback) = 0; // Returns miscellaneous metadata of the file system like the largest diff --git a/chrome/browser/chromeos/drive/drive_file_system_proxy.cc b/chrome/browser/chromeos/drive/drive_file_system_proxy.cc index b67cddb..6a61650 100644 --- a/chrome/browser/chromeos/drive/drive_file_system_proxy.cc +++ b/chrome/browser/chromeos/drive/drive_file_system_proxy.cc @@ -53,7 +53,7 @@ void OnGetFileByPathForOpen( int file_flags, base::ProcessHandle peer_handle, DriveFileError file_error, - const FilePath& local_path, + const base::FilePath& local_path, const std::string& unused_mime_type, DriveFileType file_type) { base::PlatformFileError error = @@ -85,7 +85,7 @@ void CallSnapshotFileCallback( const FileSystemOperation::SnapshotFileCallback& callback, const base::PlatformFileInfo& file_info, DriveFileError file_error, - const FilePath& local_path, + const base::FilePath& local_path, const std::string& unused_mime_type, DriveFileType file_type) { scoped_refptr<ShareableFileReference> file_ref; @@ -114,13 +114,13 @@ void CallSnapshotFileCallback( } // Emits debug log when DriveFileSystem::CloseFile() is complete. -void EmitDebugLogForCloseFile(const FilePath& local_path, +void EmitDebugLogForCloseFile(const base::FilePath& local_path, DriveFileError file_error) { DVLOG(1) << "Closed: " << local_path.AsUTF8Unsafe() << ": " << file_error; } base::PlatformFileError DoTruncateOnBlockingPool( - const FilePath& local_cache_path, + const base::FilePath& local_cache_path, int64 length) { base::PlatformFileError result = base::PLATFORM_FILE_ERROR_FAILED; @@ -179,13 +179,13 @@ void DriveFileSystemProxy::DetachFromFileSystem() { void DriveFileSystemProxy::GetFileInfo(const FileSystemURL& file_url, const FileSystemOperation::GetMetadataCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); - FilePath file_path; + base::FilePath file_path; if (!ValidateUrl(file_url, &file_path)) { MessageLoopProxy::current()->PostTask(FROM_HERE, base::Bind(callback, base::PLATFORM_FILE_ERROR_NOT_FOUND, base::PlatformFileInfo(), - FilePath())); + base::FilePath())); return; } @@ -205,7 +205,7 @@ void DriveFileSystemProxy::Copy(const FileSystemURL& src_file_url, const FileSystemOperation::StatusCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); - FilePath src_file_path, dest_file_path; + base::FilePath src_file_path, dest_file_path; if (!ValidateUrl(src_file_url, &src_file_path) || !ValidateUrl(dest_file_url, &dest_file_path)) { MessageLoopProxy::current()->PostTask(FROM_HERE, @@ -229,7 +229,7 @@ void DriveFileSystemProxy::Move(const FileSystemURL& src_file_url, const FileSystemOperation::StatusCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); - FilePath src_file_path, dest_file_path; + base::FilePath src_file_path, dest_file_path; if (!ValidateUrl(src_file_url, &src_file_path) || !ValidateUrl(dest_file_url, &dest_file_path)) { MessageLoopProxy::current()->PostTask(FROM_HERE, @@ -252,7 +252,7 @@ void DriveFileSystemProxy::ReadDirectory(const FileSystemURL& file_url, const FileSystemOperation::ReadDirectoryCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); - FilePath file_path; + base::FilePath file_path; if (!ValidateUrl(file_url, &file_path)) { base::MessageLoopProxy::current()->PostTask( FROM_HERE, @@ -277,7 +277,7 @@ void DriveFileSystemProxy::Remove(const FileSystemURL& file_url, bool recursive, const FileSystemOperation::StatusCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); - FilePath file_path; + base::FilePath file_path; if (!ValidateUrl(file_url, &file_path)) { MessageLoopProxy::current()->PostTask(FROM_HERE, base::Bind(callback, base::PLATFORM_FILE_ERROR_NOT_FOUND)); @@ -302,7 +302,7 @@ void DriveFileSystemProxy::CreateDirectory( const FileSystemOperation::StatusCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); - FilePath file_path; + base::FilePath file_path; if (!ValidateUrl(file_url, &file_path)) { MessageLoopProxy::current()->PostTask(FROM_HERE, base::Bind(callback, base::PLATFORM_FILE_ERROR_NOT_FOUND)); @@ -327,7 +327,7 @@ void DriveFileSystemProxy::CreateFile( const FileSystemOperation::StatusCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); - FilePath file_path; + base::FilePath file_path; if (!ValidateUrl(file_url, &file_path)) { MessageLoopProxy::current()->PostTask(FROM_HERE, base::Bind(callback, base::PLATFORM_FILE_ERROR_NOT_FOUND)); @@ -356,7 +356,7 @@ void DriveFileSystemProxy::Truncate( return; } - FilePath file_path; + base::FilePath file_path; if (!ValidateUrl(file_url, &file_path)) { MessageLoopProxy::current()->PostTask(FROM_HERE, base::Bind(callback, base::PLATFORM_FILE_ERROR_NOT_FOUND)); @@ -383,7 +383,7 @@ void DriveFileSystemProxy::OnOpenFileForWriting( base::ProcessHandle peer_handle, const FileSystemOperation::OpenFileCallback& callback, DriveFileError file_error, - const FilePath& local_cache_path) { + const base::FilePath& local_cache_path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); base::PlatformFileError error = @@ -412,7 +412,7 @@ void DriveFileSystemProxy::OnOpenFileForWriting( } void DriveFileSystemProxy::OnCreateFileForOpen( - const FilePath& file_path, + const base::FilePath& file_path, int file_flags, base::ProcessHandle peer_handle, const FileSystemOperation::OpenFileCallback& callback, @@ -448,11 +448,11 @@ void DriveFileSystemProxy::OnCreateFileForOpen( } void DriveFileSystemProxy::OnFileOpenedForTruncate( - const FilePath& virtual_path, + const base::FilePath& virtual_path, int64 length, const fileapi::FileSystemOperation::StatusCallback& callback, DriveFileError open_result, - const FilePath& local_cache_path) { + const base::FilePath& local_cache_path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); if (open_result != DRIVE_FILE_OK) { @@ -475,7 +475,7 @@ void DriveFileSystemProxy::OnFileOpenedForTruncate( } void DriveFileSystemProxy::DidTruncate( - const FilePath& virtual_path, + const base::FilePath& virtual_path, const FileSystemOperation::StatusCallback& callback, base::PlatformFileError truncate_result) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); @@ -499,7 +499,7 @@ void DriveFileSystemProxy::OpenFile( const FileSystemOperation::OpenFileCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); - FilePath file_path; + base::FilePath file_path; if (!ValidateUrl(file_url, &file_path)) { MessageLoopProxy::current()->PostTask(FROM_HERE, base::Bind(callback, @@ -577,7 +577,7 @@ void DriveFileSystemProxy::OpenFile( } void DriveFileSystemProxy::NotifyCloseFile(const FileSystemURL& url) { - FilePath file_path; + base::FilePath file_path; if (!ValidateUrl(url, &file_path)) return; @@ -608,13 +608,13 @@ void DriveFileSystemProxy::CreateSnapshotFile( const FileSystemOperation::SnapshotFileCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); - FilePath file_path; + base::FilePath file_path; if (!ValidateUrl(file_url, &file_path)) { MessageLoopProxy::current()->PostTask(FROM_HERE, base::Bind(callback, base::PLATFORM_FILE_ERROR_NOT_FOUND, base::PlatformFileInfo(), - FilePath(), + base::FilePath(), scoped_refptr<ShareableFileReference>(NULL))); return; } @@ -631,7 +631,7 @@ void DriveFileSystemProxy::CreateSnapshotFile( } void DriveFileSystemProxy::OnGetEntryInfoByPath( - const FilePath& entry_path, + const base::FilePath& entry_path, const FileSystemOperation::SnapshotFileCallback& callback, DriveFileError error, scoped_ptr<DriveEntryProto> entry_proto) { @@ -640,7 +640,7 @@ void DriveFileSystemProxy::OnGetEntryInfoByPath( if (error != DRIVE_FILE_OK || !entry_proto.get()) { callback.Run(base::PLATFORM_FILE_ERROR_NOT_FOUND, base::PlatformFileInfo(), - FilePath(), + base::FilePath(), scoped_refptr<ShareableFileReference>(NULL)); return; } @@ -663,12 +663,12 @@ void DriveFileSystemProxy::CreateWritableSnapshotFile( const fileapi::WritableSnapshotFile& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); - FilePath file_path; + base::FilePath file_path; if (!ValidateUrl(file_url, &file_path)) { MessageLoopProxy::current()->PostTask(FROM_HERE, base::Bind(callback, base::PLATFORM_FILE_ERROR_NOT_FOUND, - FilePath(), + base::FilePath(), scoped_refptr<ShareableFileReference>(NULL))); return; } @@ -692,7 +692,7 @@ DriveFileSystemProxy::~DriveFileSystemProxy() { // static. bool DriveFileSystemProxy::ValidateUrl( - const FileSystemURL& url, FilePath* file_path) { + const FileSystemURL& url, base::FilePath* file_path) { // what platform you're on. if (!url.is_valid() || url.type() != fileapi::kFileSystemTypeDrive) { return false; @@ -728,7 +728,7 @@ void DriveFileSystemProxy::OnStatusCallback( } void DriveFileSystemProxy::OnGetMetadata( - const FilePath& file_path, + const base::FilePath& file_path, const FileSystemOperation::GetMetadataCallback& callback, DriveFileError error, scoped_ptr<DriveEntryProto> entry_proto) { @@ -737,7 +737,7 @@ void DriveFileSystemProxy::OnGetMetadata( if (error != DRIVE_FILE_OK) { callback.Run(DriveFileErrorToPlatformError(error), base::PlatformFileInfo(), - FilePath()); + base::FilePath()); return; } DCHECK(entry_proto.get()); @@ -780,10 +780,10 @@ void DriveFileSystemProxy::OnReadDirectory( } void DriveFileSystemProxy::OnCreateWritableSnapshotFile( - const FilePath& virtual_path, + const base::FilePath& virtual_path, const fileapi::WritableSnapshotFile& callback, DriveFileError result, - const FilePath& local_path) { + const base::FilePath& local_path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); scoped_refptr<ShareableFileReference> file_ref; @@ -803,8 +803,8 @@ void DriveFileSystemProxy::OnCreateWritableSnapshotFile( } void DriveFileSystemProxy::CloseWritableSnapshotFile( - const FilePath& virtual_path, - const FilePath& local_path) { + const base::FilePath& virtual_path, + const base::FilePath& local_path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); CallDriveFileSystemMethodOnUIThread( diff --git a/chrome/browser/chromeos/drive/drive_file_system_proxy.h b/chrome/browser/chromeos/drive/drive_file_system_proxy.h index 50142bd..7fcbd01 100644 --- a/chrome/browser/chromeos/drive/drive_file_system_proxy.h +++ b/chrome/browser/chromeos/drive/drive_file_system_proxy.h @@ -96,7 +96,7 @@ class DriveFileSystemProxy : public fileapi::RemoteFileSystemProxyInterface { // the call will return true and fill in |file_path| with a file path of // a corresponding element within this file system. static bool ValidateUrl(const fileapi::FileSystemURL& url, - FilePath* file_path); + base::FilePath* file_path); // Helper method to call methods of DriveFilesSystem. This method aborts // method calls in case DetachFromFileSystem() has been called. @@ -115,7 +115,7 @@ class DriveFileSystemProxy : public fileapi::RemoteFileSystemProxyInterface { // Helper callback for relaying reply for metadata retrieval request to the // calling thread. void OnGetMetadata( - const FilePath& file_path, + const base::FilePath& file_path, const fileapi::FileSystemOperation::GetMetadataCallback& callback, DriveFileError error, @@ -124,7 +124,7 @@ class DriveFileSystemProxy : public fileapi::RemoteFileSystemProxyInterface { // Helper callback for relaying reply for GetEntryInfoByPath() to the // calling thread. void OnGetEntryInfoByPath( - const FilePath& entry_path, + const base::FilePath& entry_path, const fileapi::FileSystemOperation::SnapshotFileCallback& callback, DriveFileError error, @@ -142,31 +142,31 @@ class DriveFileSystemProxy : public fileapi::RemoteFileSystemProxyInterface { // Helper callback for relaying reply for CreateWritableSnapshotFile() to // the calling thread. void OnCreateWritableSnapshotFile( - const FilePath& virtual_path, + const base::FilePath& virtual_path, const fileapi::WritableSnapshotFile& callback, DriveFileError result, - const FilePath& local_path); + const base::FilePath& local_path); // Helper callback for closing the local cache file and committing the dirty // flag. This is triggered when the callback for CreateWritableSnapshotFile // released the refcounted reference to the file. void CloseWritableSnapshotFile( - const FilePath& virtual_path, - const FilePath& local_path); + const base::FilePath& virtual_path, + const base::FilePath& local_path); // Invoked during Truncate() operation. This is called when a local modifiable // cache is ready for truncation. void OnFileOpenedForTruncate( - const FilePath& virtual_path, + const base::FilePath& virtual_path, int64 length, const fileapi::FileSystemOperation::StatusCallback& callback, DriveFileError open_result, - const FilePath& local_cache_path); + const base::FilePath& local_cache_path); // Invoked during Truncate() operation. This is called when the truncation of // a local cache file is finished on FILE thread. void DidTruncate( - const FilePath& virtual_path, + const base::FilePath& virtual_path, const fileapi::FileSystemOperation::StatusCallback& callback, base::PlatformFileError truncate_result); @@ -178,11 +178,11 @@ class DriveFileSystemProxy : public fileapi::RemoteFileSystemProxyInterface { base::ProcessHandle peer_handle, const fileapi::FileSystemOperation::OpenFileCallback& callback, DriveFileError file_error, - const FilePath& local_cache_path); + const base::FilePath& local_cache_path); // Invoked during OpenFile() operation when file create flags are set. void OnCreateFileForOpen( - const FilePath& file_path, + const base::FilePath& file_path, int file_flags, base::ProcessHandle peer_handle, const fileapi::FileSystemOperation::OpenFileCallback& callback, diff --git a/chrome/browser/chromeos/drive/drive_file_system_unittest.cc b/chrome/browser/chromeos/drive/drive_file_system_unittest.cc index 9de17d9..9302e05 100644 --- a/chrome/browser/chromeos/drive/drive_file_system_unittest.cc +++ b/chrome/browser/chromeos/drive/drive_file_system_unittest.cc @@ -70,7 +70,7 @@ void DriveSearchCallback( ASSERT_EQ(expected_results_size, results->size()); for (size_t i = 0; i < results->size(); i++) { - EXPECT_EQ(FilePath(expected_results[i].path), + EXPECT_EQ(base::FilePath(expected_results[i].path), results->at(i).path); EXPECT_EQ(expected_results[i].is_directory, results->at(i).entry_proto.file_info().is_directory()); @@ -104,8 +104,8 @@ class FakeDriveUploader : public google_apis::DriveUploaderInterface { // contents of "gdata/uploaded_file.json" to the caller. virtual void UploadNewFile( const GURL& upload_location, - const FilePath& drive_file_path, - const FilePath& local_file_path, + const base::FilePath& drive_file_path, + const base::FilePath& local_file_path, const std::string& title, const std::string& content_type, const google_apis::UploadCompletionCallback& callback) OVERRIDE { @@ -130,8 +130,8 @@ class FakeDriveUploader : public google_apis::DriveUploaderInterface { // "gdata/root_feed.json" to the caller. virtual void UploadExistingFile( const GURL& upload_location, - const FilePath& drive_file_path, - const FilePath& local_file_path, + const base::FilePath& drive_file_path, + const base::FilePath& local_file_path, const std::string& content_type, const std::string& etag, const google_apis::UploadCompletionCallback& callback) OVERRIDE { @@ -277,7 +277,7 @@ class DriveFileSystemTest : public testing::Test { return true; } - void AddDirectoryFromFile(const FilePath& directory_path, + void AddDirectoryFromFile(const base::FilePath& directory_path, const std::string& filename) { scoped_ptr<Value> atom = google_apis::test_util::LoadJSONFile(filename); ASSERT_TRUE(atom.get()); @@ -293,7 +293,7 @@ class DriveFileSystemTest : public testing::Test { // Tweak entry title to match the last segment of the directory path // (new directory name). - std::vector<FilePath::StringType> dir_parts; + std::vector<base::FilePath::StringType> dir_parts; directory_path.GetComponents(&dir_parts); entry_dict->SetString("title.$t", dir_parts[dir_parts.size() - 1]); @@ -307,7 +307,7 @@ class DriveFileSystemTest : public testing::Test { EXPECT_EQ(DRIVE_FILE_OK, error); } - bool RemoveEntry(const FilePath& file_path) { + bool RemoveEntry(const base::FilePath& file_path) { DriveFileError error = DRIVE_FILE_ERROR_FAILED; file_system_->Remove( file_path, false, @@ -317,7 +317,7 @@ class DriveFileSystemTest : public testing::Test { return error == DRIVE_FILE_OK; } - FilePath GetCachePathForFile(const std::string& resource_id, + base::FilePath GetCachePathForFile(const std::string& resource_id, const std::string& md5) { return cache_->GetCacheFilePath(resource_id, md5, @@ -327,7 +327,7 @@ class DriveFileSystemTest : public testing::Test { // Gets entry info by path synchronously. scoped_ptr<DriveEntryProto> GetEntryInfoByPathSync( - const FilePath& file_path) { + const base::FilePath& file_path) { DriveFileError error = DRIVE_FILE_ERROR_FAILED; scoped_ptr<DriveEntryProto> entry_proto; file_system_->GetEntryInfoByPath( @@ -341,7 +341,7 @@ class DriveFileSystemTest : public testing::Test { // Gets directory info by path synchronously. scoped_ptr<DriveEntryProtoVector> ReadDirectoryByPathSync( - const FilePath& file_path) { + const base::FilePath& file_path) { DriveFileError error = DRIVE_FILE_ERROR_FAILED; scoped_ptr<DriveEntryProtoVector> entries; file_system_->ReadDirectoryByPath( @@ -354,13 +354,13 @@ class DriveFileSystemTest : public testing::Test { } // Returns true if an entry exists at |file_path|. - bool EntryExists(const FilePath& file_path) { + bool EntryExists(const base::FilePath& file_path) { return GetEntryInfoByPathSync(file_path).get(); } // Gets the resource ID of |file_path|. Returns an empty string if not found. - std::string GetResourceIdByPath(const FilePath& file_path) { + std::string GetResourceIdByPath(const base::FilePath& file_path) { scoped_ptr<DriveEntryProto> entry_proto = GetEntryInfoByPathSync(file_path); if (entry_proto.get()) @@ -392,7 +392,7 @@ class DriveFileSystemTest : public testing::Test { // Returns true if the cache file exists for the given resource ID and MD5. bool CacheFileExists(const std::string& resource_id, const std::string& md5) { - const FilePath file_path = cache_->GetCacheFilePath( + const base::FilePath file_path = cache_->GetCacheFilePath( resource_id, md5, DriveCache::CACHE_TYPE_TMP, @@ -403,7 +403,7 @@ class DriveFileSystemTest : public testing::Test { void TestStoreToCache( const std::string& resource_id, const std::string& md5, - const FilePath& source_path, + const base::FilePath& source_path, DriveFileError expected_error, int expected_cache_state, DriveCache::CacheSubDirectoryType expected_sub_dir_type) { @@ -480,7 +480,7 @@ class DriveFileSystemTest : public testing::Test { void VerifyCacheStateAfterOpenFile(DriveFileError error, const std::string& resource_id, const std::string& md5, - const FilePath& cache_file_path) { + const base::FilePath& cache_file_path) { expected_error_ = DRIVE_FILE_OK; expected_cache_state_ = (test_util::TEST_CACHE_STATE_PRESENT | test_util::TEST_CACHE_STATE_DIRTY | @@ -527,7 +527,7 @@ class DriveFileSystemTest : public testing::Test { } // Verify actual cache file. - FilePath dest_path = cache_->GetCacheFilePath( + base::FilePath dest_path = cache_->GetCacheFilePath( resource_id, md5, test_util::ToCacheEntry(expected_cache_state_).is_pinned() || @@ -544,7 +544,7 @@ class DriveFileSystemTest : public testing::Test { EXPECT_FALSE(exists); // Verify symlink in pinned dir. - FilePath symlink_path = cache_->GetCacheFilePath( + base::FilePath symlink_path = cache_->GetCacheFilePath( resource_id, std::string(), DriveCache::CACHE_TYPE_PINNED, @@ -553,7 +553,7 @@ class DriveFileSystemTest : public testing::Test { exists = file_util::IsLink(symlink_path); if (test_util::ToCacheEntry(expected_cache_state_).is_pinned()) { EXPECT_TRUE(exists); - FilePath target_path; + base::FilePath target_path; EXPECT_TRUE(file_util::ReadSymbolicLink(symlink_path, &target_path)); if (test_util::ToCacheEntry(expected_cache_state_).is_present()) EXPECT_EQ(dest_path, target_path); @@ -574,7 +574,7 @@ class DriveFileSystemTest : public testing::Test { if (expect_outgoing_symlink_ && test_util::ToCacheEntry(expected_cache_state_).is_dirty()) { EXPECT_TRUE(exists); - FilePath target_path; + base::FilePath target_path; EXPECT_TRUE(file_util::ReadSymbolicLink(symlink_path, &target_path)); EXPECT_TRUE(target_path.value() != kSymLinkToDevNull); if (test_util::ToCacheEntry(expected_cache_state_).is_present()) @@ -672,7 +672,7 @@ class DriveFileSystemTest : public testing::Test { ASSERT_TRUE(root.SerializeToString(&serialized_proto)); ASSERT_TRUE(!serialized_proto.empty()); - FilePath cache_dir_path = profile_->GetPath().Append( + base::FilePath cache_dir_path = profile_->GetPath().Append( FILE_PATH_LITERAL("GCache/v1/meta/")); ASSERT_TRUE(file_util::CreateDirectory(cache_dir_path)); const int file_size = static_cast<int>(serialized_proto.length()); @@ -683,7 +683,7 @@ class DriveFileSystemTest : public testing::Test { // Verifies that |file_path| is a valid JSON file for the hosted document // associated with |entry| (i.e. |url| and |resource_id| match). void VerifyHostedDocumentJSONFile(const DriveEntryProto& entry_proto, - const FilePath& file_path) { + const base::FilePath& file_path) { std::string error; JSONFileValueSerializer serializer(file_path); scoped_ptr<Value> value(serializer.Deserialize(NULL, &error)); @@ -728,7 +728,7 @@ class DriveFileSystemTest : public testing::Test { void AsyncInitializationCallback( int* counter, int expected_counter, - const FilePath& expected_file_path, + const base::FilePath& expected_file_path, MessageLoop* message_loop, DriveFileError error, scoped_ptr<DriveEntryProto> entry_proto) { @@ -748,13 +748,13 @@ TEST_F(DriveFileSystemTest, DuplicatedAsyncInitialization) { &AsyncInitializationCallback, &counter, 2, - FilePath(FILE_PATH_LITERAL("drive")), + base::FilePath(FILE_PATH_LITERAL("drive")), &message_loop_); file_system_->GetEntryInfoByPath( - FilePath(FILE_PATH_LITERAL("drive")), callback); + base::FilePath(FILE_PATH_LITERAL("drive")), callback); file_system_->GetEntryInfoByPath( - FilePath(FILE_PATH_LITERAL("drive")), callback); + base::FilePath(FILE_PATH_LITERAL("drive")), callback); message_loop_.Run(); // Wait to get our result EXPECT_EQ(2, counter); @@ -768,9 +768,9 @@ TEST_F(DriveFileSystemTest, DuplicatedAsyncInitialization) { TEST_F(DriveFileSystemTest, SearchRootDirectory) { ASSERT_TRUE(LoadRootFeedDocument("gdata/root_feed.json")); - const FilePath kFilePath = FilePath(FILE_PATH_LITERAL("drive")); + const base::FilePath kFilePath = base::FilePath(FILE_PATH_LITERAL("drive")); scoped_ptr<DriveEntryProto> entry = GetEntryInfoByPathSync( - FilePath(FILE_PATH_LITERAL(kFilePath))); + base::FilePath(FILE_PATH_LITERAL(kFilePath))); ASSERT_TRUE(entry.get()); EXPECT_EQ(fake_drive_service_->GetRootResourceId(), entry->resource_id()); } @@ -778,7 +778,7 @@ TEST_F(DriveFileSystemTest, SearchRootDirectory) { TEST_F(DriveFileSystemTest, SearchExistingFile) { ASSERT_TRUE(LoadRootFeedDocument("gdata/root_feed.json")); - const FilePath kFilePath = FilePath( + const base::FilePath kFilePath = base::FilePath( FILE_PATH_LITERAL("drive/File 1.txt")); scoped_ptr<DriveEntryProto> entry = GetEntryInfoByPathSync(kFilePath); ASSERT_TRUE(entry.get()); @@ -788,7 +788,7 @@ TEST_F(DriveFileSystemTest, SearchExistingFile) { TEST_F(DriveFileSystemTest, SearchExistingDocument) { ASSERT_TRUE(LoadRootFeedDocument("gdata/root_feed.json")); - const FilePath kFilePath = FilePath( + const base::FilePath kFilePath = base::FilePath( FILE_PATH_LITERAL("drive/Document 1.gdoc")); scoped_ptr<DriveEntryProto> entry = GetEntryInfoByPathSync(kFilePath); ASSERT_TRUE(entry.get()); @@ -798,7 +798,7 @@ TEST_F(DriveFileSystemTest, SearchExistingDocument) { TEST_F(DriveFileSystemTest, SearchNonExistingFile) { ASSERT_TRUE(LoadRootFeedDocument("gdata/root_feed.json")); - const FilePath kFilePath = FilePath( + const base::FilePath kFilePath = base::FilePath( FILE_PATH_LITERAL("drive/nonexisting.file")); scoped_ptr<DriveEntryProto> entry = GetEntryInfoByPathSync(kFilePath); ASSERT_FALSE(entry.get()); @@ -807,18 +807,18 @@ TEST_F(DriveFileSystemTest, SearchNonExistingFile) { TEST_F(DriveFileSystemTest, SearchEncodedFileNames) { ASSERT_TRUE(LoadRootFeedDocument("gdata/root_feed.json")); - const FilePath kFilePath1 = FilePath( + const base::FilePath kFilePath1 = base::FilePath( FILE_PATH_LITERAL("drive/Slash / in file 1.txt")); scoped_ptr<DriveEntryProto> entry = GetEntryInfoByPathSync(kFilePath1); ASSERT_FALSE(entry.get()); - const FilePath kFilePath2 = FilePath::FromUTF8Unsafe( + const base::FilePath kFilePath2 = base::FilePath::FromUTF8Unsafe( "drive/Slash \xE2\x88\x95 in file 1.txt"); entry = GetEntryInfoByPathSync(kFilePath2); ASSERT_TRUE(entry.get()); EXPECT_EQ("file:slash_file_resource_id", entry->resource_id()); - const FilePath kFilePath3 = FilePath::FromUTF8Unsafe( + const base::FilePath kFilePath3 = base::FilePath::FromUTF8Unsafe( "drive/Slash \xE2\x88\x95 in directory/Slash SubDir File.txt"); entry = GetEntryInfoByPathSync(kFilePath3); ASSERT_TRUE(entry.get()); @@ -828,18 +828,18 @@ TEST_F(DriveFileSystemTest, SearchEncodedFileNames) { TEST_F(DriveFileSystemTest, SearchEncodedFileNamesLoadingRoot) { ASSERT_TRUE(LoadRootFeedDocument("gdata/root_feed.json")); - const FilePath kFilePath1 = FilePath( + const base::FilePath kFilePath1 = base::FilePath( FILE_PATH_LITERAL("drive/Slash / in file 1.txt")); scoped_ptr<DriveEntryProto> entry = GetEntryInfoByPathSync(kFilePath1); ASSERT_FALSE(entry.get()); - const FilePath kFilePath2 = FilePath::FromUTF8Unsafe( + const base::FilePath kFilePath2 = base::FilePath::FromUTF8Unsafe( "drive/Slash \xE2\x88\x95 in file 1.txt"); entry = GetEntryInfoByPathSync(kFilePath2); ASSERT_TRUE(entry.get()); EXPECT_EQ("file:slash_file_resource_id", entry->resource_id()); - const FilePath kFilePath3 = FilePath::FromUTF8Unsafe( + const base::FilePath kFilePath3 = base::FilePath::FromUTF8Unsafe( "drive/Slash \xE2\x88\x95 in directory/Slash SubDir File.txt"); entry = GetEntryInfoByPathSync(kFilePath3); ASSERT_TRUE(entry.get()); @@ -849,13 +849,13 @@ TEST_F(DriveFileSystemTest, SearchEncodedFileNamesLoadingRoot) { TEST_F(DriveFileSystemTest, SearchDuplicateNames) { ASSERT_TRUE(LoadRootFeedDocument("gdata/root_feed.json")); - const FilePath kFilePath1 = FilePath( + const base::FilePath kFilePath1 = base::FilePath( FILE_PATH_LITERAL("drive/Duplicate Name.txt")); scoped_ptr<DriveEntryProto> entry = GetEntryInfoByPathSync(kFilePath1); ASSERT_TRUE(entry.get()); const std::string resource_id1 = entry->resource_id(); - const FilePath kFilePath2 = FilePath( + const base::FilePath kFilePath2 = base::FilePath( FILE_PATH_LITERAL("drive/Duplicate Name (2).txt")); entry = GetEntryInfoByPathSync(kFilePath2); ASSERT_TRUE(entry.get()); @@ -874,7 +874,7 @@ TEST_F(DriveFileSystemTest, SearchDuplicateNames) { TEST_F(DriveFileSystemTest, SearchExistingDirectory) { ASSERT_TRUE(LoadRootFeedDocument("gdata/root_feed.json")); - const FilePath kFilePath = FilePath( + const base::FilePath kFilePath = base::FilePath( FILE_PATH_LITERAL("drive/Directory 1")); scoped_ptr<DriveEntryProto> entry = GetEntryInfoByPathSync(kFilePath); ASSERT_TRUE(entry.get()); @@ -884,7 +884,7 @@ TEST_F(DriveFileSystemTest, SearchExistingDirectory) { TEST_F(DriveFileSystemTest, SearchInSubdir) { ASSERT_TRUE(LoadRootFeedDocument("gdata/root_feed.json")); - const FilePath kFilePath = FilePath( + const base::FilePath kFilePath = base::FilePath( FILE_PATH_LITERAL("drive/Directory 1/SubDirectory File 1.txt")); scoped_ptr<DriveEntryProto> entry = GetEntryInfoByPathSync(kFilePath); ASSERT_TRUE(entry.get()); @@ -895,7 +895,7 @@ TEST_F(DriveFileSystemTest, SearchInSubdir) { TEST_F(DriveFileSystemTest, SearchInSubSubdir) { ASSERT_TRUE(LoadRootFeedDocument("gdata/root_feed.json")); - const FilePath kFilePath = FilePath( + const base::FilePath kFilePath = base::FilePath( FILE_PATH_LITERAL("drive/Directory 1/Sub Directory Folder/" "Sub Sub Directory Folder")); scoped_ptr<DriveEntryProto> entry = GetEntryInfoByPathSync(kFilePath); @@ -906,10 +906,12 @@ TEST_F(DriveFileSystemTest, SearchInSubSubdir) { TEST_F(DriveFileSystemTest, FilePathTests) { ASSERT_TRUE(LoadRootFeedDocument("gdata/root_feed.json")); - EXPECT_TRUE(EntryExists(FilePath(FILE_PATH_LITERAL("drive/File 1.txt")))); - EXPECT_TRUE(EntryExists(FilePath(FILE_PATH_LITERAL("drive/Directory 1")))); + EXPECT_TRUE( + EntryExists(base::FilePath(FILE_PATH_LITERAL("drive/File 1.txt")))); + EXPECT_TRUE( + EntryExists(base::FilePath(FILE_PATH_LITERAL("drive/Directory 1")))); EXPECT_TRUE(EntryExists( - FilePath( + base::FilePath( FILE_PATH_LITERAL("drive/Directory 1/SubDirectory File 1.txt")))); } @@ -917,38 +919,40 @@ TEST_F(DriveFileSystemTest, ChangeFeed_AddAndDeleteFileInRoot) { ASSERT_TRUE(LoadRootFeedDocument("gdata/root_feed.json")); EXPECT_CALL(*mock_directory_observer_, OnDirectoryChanged( - Eq(FilePath(FILE_PATH_LITERAL("drive"))))).Times(2); + Eq(base::FilePath(FILE_PATH_LITERAL("drive"))))).Times(2); ASSERT_TRUE(LoadChangeFeed("gdata/delta_file_added_in_root.json")); EXPECT_TRUE( - EntryExists(FilePath(FILE_PATH_LITERAL("drive/Added file.gdoc")))); + EntryExists(base::FilePath(FILE_PATH_LITERAL("drive/Added file.gdoc")))); ASSERT_TRUE(LoadChangeFeed("gdata/delta_file_deleted_in_root.json")); EXPECT_FALSE( - EntryExists(FilePath(FILE_PATH_LITERAL("drive/Added file.gdoc")))); + EntryExists(base::FilePath(FILE_PATH_LITERAL("drive/Added file.gdoc")))); } TEST_F(DriveFileSystemTest, ChangeFeed_AddAndDeleteFileFromExistingDirectory) { ASSERT_TRUE(LoadRootFeedDocument("gdata/root_feed.json")); - EXPECT_TRUE(EntryExists(FilePath(FILE_PATH_LITERAL("drive/Directory 1")))); + EXPECT_TRUE( + EntryExists(base::FilePath(FILE_PATH_LITERAL("drive/Directory 1")))); // Add file to an existing directory. EXPECT_CALL(*mock_directory_observer_, OnDirectoryChanged( - Eq(FilePath(FILE_PATH_LITERAL("drive"))))).Times(1); + Eq(base::FilePath(FILE_PATH_LITERAL("drive"))))).Times(1); EXPECT_CALL(*mock_directory_observer_, OnDirectoryChanged( - Eq(FilePath(FILE_PATH_LITERAL("drive/Directory 1"))))).Times(1); + Eq(base::FilePath(FILE_PATH_LITERAL("drive/Directory 1"))))).Times(1); ASSERT_TRUE(LoadChangeFeed("gdata/delta_file_added_in_directory.json")); - EXPECT_TRUE(EntryExists(FilePath( + EXPECT_TRUE(EntryExists(base::FilePath( FILE_PATH_LITERAL("drive/Directory 1/Added file.gdoc")))); // Remove that file from the directory. EXPECT_CALL(*mock_directory_observer_, OnDirectoryChanged( - Eq(FilePath(FILE_PATH_LITERAL("drive/Directory 1"))))).Times(1); + Eq(base::FilePath(FILE_PATH_LITERAL("drive/Directory 1"))))).Times(1); ASSERT_TRUE(LoadChangeFeed("gdata/delta_file_deleted_in_directory.json")); - EXPECT_TRUE(EntryExists(FilePath(FILE_PATH_LITERAL("drive/Directory 1")))); - EXPECT_FALSE(EntryExists(FilePath( + EXPECT_TRUE( + EntryExists(base::FilePath(FILE_PATH_LITERAL("drive/Directory 1")))); + EXPECT_FALSE(EntryExists(base::FilePath( FILE_PATH_LITERAL("drive/Directory 1/Added file.gdoc")))); } @@ -956,14 +960,15 @@ TEST_F(DriveFileSystemTest, ChangeFeed_AddFileToNewDirectory) { ASSERT_TRUE(LoadRootFeedDocument("gdata/root_feed.json")); // Add file to a new directory. EXPECT_CALL(*mock_directory_observer_, OnDirectoryChanged( - Eq(FilePath(FILE_PATH_LITERAL("drive"))))).Times(1); + Eq(base::FilePath(FILE_PATH_LITERAL("drive"))))).Times(1); EXPECT_CALL(*mock_directory_observer_, OnDirectoryChanged( - Eq(FilePath(FILE_PATH_LITERAL("drive/New Directory"))))).Times(1); + Eq(base::FilePath(FILE_PATH_LITERAL("drive/New Directory"))))).Times(1); ASSERT_TRUE(LoadChangeFeed("gdata/delta_file_added_in_new_directory.json")); - EXPECT_TRUE(EntryExists(FilePath(FILE_PATH_LITERAL("drive/New Directory")))); - EXPECT_TRUE(EntryExists(FilePath( + EXPECT_TRUE( + EntryExists(base::FilePath(FILE_PATH_LITERAL("drive/New Directory")))); + EXPECT_TRUE(EntryExists(base::FilePath( FILE_PATH_LITERAL("drive/New Directory/File in new dir.gdoc")))); } @@ -981,41 +986,41 @@ TEST_F(DriveFileSystemTest, ChangeFeed_AddFileToNewButDeletedDirectory) { TEST_F(DriveFileSystemTest, ChangeFeed_DirectoryMovedFromRootToDirectory) { ASSERT_TRUE(LoadRootFeedDocument("gdata/root_feed.json")); - EXPECT_TRUE(EntryExists(FilePath(FILE_PATH_LITERAL( + EXPECT_TRUE(EntryExists(base::FilePath(FILE_PATH_LITERAL( "drive/Directory 2")))); - EXPECT_TRUE(EntryExists(FilePath(FILE_PATH_LITERAL( + EXPECT_TRUE(EntryExists(base::FilePath(FILE_PATH_LITERAL( "drive/Directory 1")))); - EXPECT_TRUE(EntryExists(FilePath(FILE_PATH_LITERAL( + EXPECT_TRUE(EntryExists(base::FilePath(FILE_PATH_LITERAL( "drive/Directory 1/SubDirectory File 1.txt")))); - EXPECT_TRUE(EntryExists(FilePath(FILE_PATH_LITERAL( + EXPECT_TRUE(EntryExists(base::FilePath(FILE_PATH_LITERAL( "drive/Directory 1/Sub Directory Folder")))); - EXPECT_TRUE(EntryExists(FilePath(FILE_PATH_LITERAL( + EXPECT_TRUE(EntryExists(base::FilePath(FILE_PATH_LITERAL( "drive/Directory 1/Sub Directory Folder/Sub Sub Directory Folder")))); // This will move "Directory 1" from "drive/" to "drive/Directory 2/". EXPECT_CALL(*mock_directory_observer_, OnDirectoryChanged( - Eq(FilePath(FILE_PATH_LITERAL("drive"))))).Times(1); + Eq(base::FilePath(FILE_PATH_LITERAL("drive"))))).Times(1); EXPECT_CALL(*mock_directory_observer_, OnDirectoryChanged( - Eq(FilePath(FILE_PATH_LITERAL("drive/Directory 1"))))).Times(1); + Eq(base::FilePath(FILE_PATH_LITERAL("drive/Directory 1"))))).Times(1); EXPECT_CALL(*mock_directory_observer_, OnDirectoryChanged( - Eq(FilePath(FILE_PATH_LITERAL("drive/Directory 2"))))).Times(1); + Eq(base::FilePath(FILE_PATH_LITERAL("drive/Directory 2"))))).Times(1); EXPECT_CALL(*mock_directory_observer_, OnDirectoryChanged( - Eq(FilePath(FILE_PATH_LITERAL("drive/Directory 2/Directory 1"))))) + Eq(base::FilePath(FILE_PATH_LITERAL("drive/Directory 2/Directory 1"))))) .Times(1); ASSERT_TRUE(LoadChangeFeed( "gdata/delta_dir_moved_from_root_to_directory.json")); - EXPECT_TRUE(EntryExists(FilePath(FILE_PATH_LITERAL( + EXPECT_TRUE(EntryExists(base::FilePath(FILE_PATH_LITERAL( "drive/Directory 2")))); - EXPECT_FALSE(EntryExists(FilePath(FILE_PATH_LITERAL( + EXPECT_FALSE(EntryExists(base::FilePath(FILE_PATH_LITERAL( "drive/Directory 1")))); - EXPECT_TRUE(EntryExists(FilePath(FILE_PATH_LITERAL( + EXPECT_TRUE(EntryExists(base::FilePath(FILE_PATH_LITERAL( "drive/Directory 2/Directory 1")))); - EXPECT_TRUE(EntryExists(FilePath(FILE_PATH_LITERAL( + EXPECT_TRUE(EntryExists(base::FilePath(FILE_PATH_LITERAL( "drive/Directory 2/Directory 1/SubDirectory File 1.txt")))); - EXPECT_TRUE(EntryExists(FilePath(FILE_PATH_LITERAL( + EXPECT_TRUE(EntryExists(base::FilePath(FILE_PATH_LITERAL( "drive/Directory 2/Directory 1/Sub Directory Folder")))); - EXPECT_TRUE(EntryExists(FilePath(FILE_PATH_LITERAL( + EXPECT_TRUE(EntryExists(base::FilePath(FILE_PATH_LITERAL( "drive/Directory 2/Directory 1/Sub Directory Folder/" "Sub Sub Directory Folder")))); } @@ -1023,53 +1028,53 @@ TEST_F(DriveFileSystemTest, ChangeFeed_DirectoryMovedFromRootToDirectory) { TEST_F(DriveFileSystemTest, ChangeFeed_FileMovedFromDirectoryToRoot) { ASSERT_TRUE(LoadRootFeedDocument("gdata/root_feed.json")); - EXPECT_TRUE(EntryExists(FilePath(FILE_PATH_LITERAL( + EXPECT_TRUE(EntryExists(base::FilePath(FILE_PATH_LITERAL( "drive/Directory 1")))); - EXPECT_TRUE(EntryExists(FilePath(FILE_PATH_LITERAL( + EXPECT_TRUE(EntryExists(base::FilePath(FILE_PATH_LITERAL( "drive/Directory 1/Sub Directory Folder")))); - EXPECT_TRUE(EntryExists(FilePath(FILE_PATH_LITERAL( + EXPECT_TRUE(EntryExists(base::FilePath(FILE_PATH_LITERAL( "drive/Directory 1/Sub Directory Folder/Sub Sub Directory Folder")))); - EXPECT_TRUE(EntryExists(FilePath(FILE_PATH_LITERAL( + EXPECT_TRUE(EntryExists(base::FilePath(FILE_PATH_LITERAL( "drive/Directory 1/SubDirectory File 1.txt")))); EXPECT_CALL(*mock_directory_observer_, OnDirectoryChanged( - Eq(FilePath(FILE_PATH_LITERAL("drive"))))).Times(1); + Eq(base::FilePath(FILE_PATH_LITERAL("drive"))))).Times(1); EXPECT_CALL(*mock_directory_observer_, OnDirectoryChanged( - Eq(FilePath(FILE_PATH_LITERAL("drive/Directory 1"))))).Times(1); + Eq(base::FilePath(FILE_PATH_LITERAL("drive/Directory 1"))))).Times(1); ASSERT_TRUE(LoadChangeFeed( "gdata/delta_file_moved_from_directory_to_root.json")); - EXPECT_TRUE(EntryExists(FilePath(FILE_PATH_LITERAL( + EXPECT_TRUE(EntryExists(base::FilePath(FILE_PATH_LITERAL( "drive/Directory 1")))); - EXPECT_TRUE(EntryExists(FilePath(FILE_PATH_LITERAL( + EXPECT_TRUE(EntryExists(base::FilePath(FILE_PATH_LITERAL( "drive/Directory 1/Sub Directory Folder")))); - EXPECT_TRUE(EntryExists(FilePath(FILE_PATH_LITERAL( + EXPECT_TRUE(EntryExists(base::FilePath(FILE_PATH_LITERAL( "drive/Directory 1/Sub Directory Folder/Sub Sub Directory Folder")))); - EXPECT_FALSE(EntryExists(FilePath(FILE_PATH_LITERAL( + EXPECT_FALSE(EntryExists(base::FilePath(FILE_PATH_LITERAL( "drive/Directory 1/SubDirectory File 1.txt")))); - EXPECT_TRUE(EntryExists(FilePath(FILE_PATH_LITERAL( + EXPECT_TRUE(EntryExists(base::FilePath(FILE_PATH_LITERAL( "drive/SubDirectory File 1.txt")))); } TEST_F(DriveFileSystemTest, ChangeFeed_FileRenamedInDirectory) { ASSERT_TRUE(LoadRootFeedDocument("gdata/root_feed.json")); - EXPECT_TRUE(EntryExists(FilePath(FILE_PATH_LITERAL( + EXPECT_TRUE(EntryExists(base::FilePath(FILE_PATH_LITERAL( "drive/Directory 1")))); - EXPECT_TRUE(EntryExists(FilePath(FILE_PATH_LITERAL( + EXPECT_TRUE(EntryExists(base::FilePath(FILE_PATH_LITERAL( "drive/Directory 1/SubDirectory File 1.txt")))); EXPECT_CALL(*mock_directory_observer_, OnDirectoryChanged( - Eq(FilePath(FILE_PATH_LITERAL("drive"))))).Times(1); + Eq(base::FilePath(FILE_PATH_LITERAL("drive"))))).Times(1); EXPECT_CALL(*mock_directory_observer_, OnDirectoryChanged( - Eq(FilePath(FILE_PATH_LITERAL("drive/Directory 1"))))).Times(1); + Eq(base::FilePath(FILE_PATH_LITERAL("drive/Directory 1"))))).Times(1); ASSERT_TRUE(LoadChangeFeed("gdata/delta_file_renamed_in_directory.json")); - EXPECT_TRUE(EntryExists(FilePath(FILE_PATH_LITERAL( + EXPECT_TRUE(EntryExists(base::FilePath(FILE_PATH_LITERAL( "drive/Directory 1")))); - EXPECT_FALSE(EntryExists(FilePath(FILE_PATH_LITERAL( + EXPECT_FALSE(EntryExists(base::FilePath(FILE_PATH_LITERAL( "drive/Directory 1/SubDirectory File 1.txt")))); - EXPECT_TRUE(EntryExists(FilePath(FILE_PATH_LITERAL( + EXPECT_TRUE(EntryExists(base::FilePath(FILE_PATH_LITERAL( "drive/Directory 1/New SubDirectory File 1.txt")))); } @@ -1077,19 +1082,21 @@ TEST_F(DriveFileSystemTest, CachedFeedLoading) { SaveTestFileSystem(USE_OLD_TIMESTAMP); ASSERT_TRUE(TestLoadMetadataFromCache()); - EXPECT_TRUE(EntryExists(FilePath(FILE_PATH_LITERAL("drive/File1")))); - EXPECT_TRUE(EntryExists(FilePath(FILE_PATH_LITERAL("drive/Dir1")))); - EXPECT_TRUE(EntryExists(FilePath(FILE_PATH_LITERAL("drive/Dir1/File2")))); - EXPECT_TRUE(EntryExists(FilePath(FILE_PATH_LITERAL("drive/Dir1/SubDir2")))); + EXPECT_TRUE(EntryExists(base::FilePath(FILE_PATH_LITERAL("drive/File1")))); + EXPECT_TRUE(EntryExists(base::FilePath(FILE_PATH_LITERAL("drive/Dir1")))); + EXPECT_TRUE( + EntryExists(base::FilePath(FILE_PATH_LITERAL("drive/Dir1/File2")))); + EXPECT_TRUE( + EntryExists(base::FilePath(FILE_PATH_LITERAL("drive/Dir1/SubDir2")))); EXPECT_TRUE(EntryExists( - FilePath(FILE_PATH_LITERAL("drive/Dir1/SubDir2/File3")))); + base::FilePath(FILE_PATH_LITERAL("drive/Dir1/SubDir2/File3")))); } TEST_F(DriveFileSystemTest, CachedFeedLoadingThenServerFeedLoading) { SaveTestFileSystem(USE_SERVER_TIMESTAMP); // Kicks loading of cached file system and query for server update. - EXPECT_TRUE(EntryExists(FilePath(FILE_PATH_LITERAL("drive/File1")))); + EXPECT_TRUE(EntryExists(base::FilePath(FILE_PATH_LITERAL("drive/File1")))); // SaveTestFileSystem and "account_metadata.json" have the same changestamp, // so no request for new feeds (i.e., call to GetResourceList) should happen. @@ -1113,7 +1120,7 @@ TEST_F(DriveFileSystemTest, OfflineCachedFeedLoading) { fake_drive_service_->set_offline(true); // Kicks loading of cached file system and query for server update. - EXPECT_TRUE(EntryExists(FilePath(FILE_PATH_LITERAL("drive/File1")))); + EXPECT_TRUE(EntryExists(base::FilePath(FILE_PATH_LITERAL("drive/File1")))); // Loading of account metadata should not happen as it's offline. EXPECT_EQ(0, fake_drive_service_->account_metadata_load_count()); @@ -1139,17 +1146,17 @@ TEST_F(DriveFileSystemTest, TransferFileFromLocalToRemote_RegularFile) { // We'll add a file to the Drive root directory. EXPECT_CALL(*mock_directory_observer_, OnDirectoryChanged( - Eq(FilePath(FILE_PATH_LITERAL("drive"))))).Times(1); + Eq(base::FilePath(FILE_PATH_LITERAL("drive"))))).Times(1); // Prepare a local file. base::ScopedTempDir temp_dir; ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); - const FilePath local_src_file_path = temp_dir.path().Append("local.txt"); + const base::FilePath local_src_file_path = temp_dir.path().Append("local.txt"); const std::string kContent = "hello"; file_util::WriteFile(local_src_file_path, kContent.data(), kContent.size()); // Confirm that the remote file does not exist. - const FilePath remote_dest_file_path(FILE_PATH_LITERAL("drive/remote.txt")); + const base::FilePath remote_dest_file_path(FILE_PATH_LITERAL("drive/remote.txt")); EXPECT_FALSE(EntryExists(remote_dest_file_path)); scoped_ptr<base::Value> value = @@ -1178,7 +1185,8 @@ TEST_F(DriveFileSystemTest, TransferFileFromLocalToRemote_HostedDocument) { // matches "Document 1" in root_feed.json. base::ScopedTempDir temp_dir; ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); - const FilePath local_src_file_path = temp_dir.path().Append("local.gdoc"); + const base::FilePath local_src_file_path = + temp_dir.path().Append("local.gdoc"); const std::string kEditUrl = "https://3_document_self_link/document:5_document_resource_id"; const std::string kResourceId = "document:5_document_resource_id"; @@ -1188,15 +1196,15 @@ TEST_F(DriveFileSystemTest, TransferFileFromLocalToRemote_HostedDocument) { file_util::WriteFile(local_src_file_path, kContent.data(), kContent.size()); // Confirm that the remote file does not exist. - const FilePath remote_dest_file_path( + const base::FilePath remote_dest_file_path( FILE_PATH_LITERAL("drive/Directory 1/Document 1.gdoc")); EXPECT_FALSE(EntryExists(remote_dest_file_path)); // We'll add a file to the Drive root and then move to "Directory 1". EXPECT_CALL(*mock_directory_observer_, OnDirectoryChanged( - Eq(FilePath(FILE_PATH_LITERAL("drive"))))).Times(1); + Eq(base::FilePath(FILE_PATH_LITERAL("drive"))))).Times(1); EXPECT_CALL(*mock_directory_observer_, OnDirectoryChanged( - Eq(FilePath(FILE_PATH_LITERAL("drive/Directory 1"))))).Times(1); + Eq(base::FilePath(FILE_PATH_LITERAL("drive/Directory 1"))))).Times(1); // We'll copy a hosted document using CopyHostedDocument. // ".gdoc" suffix should be stripped when copying. @@ -1226,16 +1234,17 @@ TEST_F(DriveFileSystemTest, TransferFileFromRemoteToLocal_RegularFile) { // The transfered file is cached and the change of "offline avaialble" // attribute is notified. EXPECT_CALL(*mock_directory_observer_, OnDirectoryChanged( - Eq(FilePath(FILE_PATH_LITERAL("drive"))))).Times(1); + Eq(base::FilePath(FILE_PATH_LITERAL("drive"))))).Times(1); base::ScopedTempDir temp_dir; ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); - FilePath local_dest_file_path = temp_dir.path().Append("local_copy.txt"); + base::FilePath local_dest_file_path = + temp_dir.path().Append("local_copy.txt"); - FilePath remote_src_file_path(FILE_PATH_LITERAL("drive/File 1.txt")); + base::FilePath remote_src_file_path(FILE_PATH_LITERAL("drive/File 1.txt")); scoped_ptr<DriveEntryProto> file = GetEntryInfoByPathSync( remote_src_file_path); - FilePath cache_file = GetCachePathForFile( + base::FilePath cache_file = GetCachePathForFile( file->resource_id(), file->file_specific_info().file_md5()); const int64 file_size = file->file_info().size(); @@ -1270,8 +1279,10 @@ TEST_F(DriveFileSystemTest, TransferFileFromRemoteToLocal_HostedDocument) { base::ScopedTempDir temp_dir; ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); - FilePath local_dest_file_path = temp_dir.path().Append("local_copy.txt"); - FilePath remote_src_file_path(FILE_PATH_LITERAL("drive/Document 1.gdoc")); + base::FilePath local_dest_file_path = + temp_dir.path().Append("local_copy.txt"); + base::FilePath remote_src_file_path( + FILE_PATH_LITERAL("drive/Document 1.gdoc")); DriveFileError error = DRIVE_FILE_ERROR_FAILED; file_system_->TransferFileFromRemoteToLocal( remote_src_file_path, @@ -1288,8 +1299,8 @@ TEST_F(DriveFileSystemTest, TransferFileFromRemoteToLocal_HostedDocument) { } TEST_F(DriveFileSystemTest, CopyNotExistingFile) { - FilePath src_file_path(FILE_PATH_LITERAL("drive/Dummy file.txt")); - FilePath dest_file_path(FILE_PATH_LITERAL("drive/Test.log")); + base::FilePath src_file_path(FILE_PATH_LITERAL("drive/Dummy file.txt")); + base::FilePath dest_file_path(FILE_PATH_LITERAL("drive/Test.log")); ASSERT_TRUE(LoadRootFeedDocument("gdata/root_feed.json")); @@ -1308,9 +1319,9 @@ TEST_F(DriveFileSystemTest, CopyNotExistingFile) { } TEST_F(DriveFileSystemTest, CopyFileToNonExistingDirectory) { - FilePath src_file_path(FILE_PATH_LITERAL("drive/File 1.txt")); - FilePath dest_parent_path(FILE_PATH_LITERAL("drive/Dummy")); - FilePath dest_file_path(FILE_PATH_LITERAL("drive/Dummy/Test.log")); + base::FilePath src_file_path(FILE_PATH_LITERAL("drive/File 1.txt")); + base::FilePath dest_parent_path(FILE_PATH_LITERAL("drive/Dummy")); + base::FilePath dest_file_path(FILE_PATH_LITERAL("drive/Dummy/Test.log")); ASSERT_TRUE(LoadRootFeedDocument("gdata/root_feed.json")); @@ -1341,9 +1352,10 @@ TEST_F(DriveFileSystemTest, CopyFileToNonExistingDirectory) { // Test the case where the parent of |dest_file_path| is an existing file, // not a directory. TEST_F(DriveFileSystemTest, CopyFileToInvalidPath) { - FilePath src_file_path(FILE_PATH_LITERAL("drive/Document 1.gdoc")); - FilePath dest_parent_path(FILE_PATH_LITERAL("drive/Duplicate Name.txt")); - FilePath dest_file_path(FILE_PATH_LITERAL( + base::FilePath src_file_path(FILE_PATH_LITERAL("drive/Document 1.gdoc")); + base::FilePath dest_parent_path( + FILE_PATH_LITERAL("drive/Duplicate Name.txt")); + base::FilePath dest_file_path(FILE_PATH_LITERAL( "drive/Duplicate Name.txt/Document 1.gdoc")); ASSERT_TRUE(LoadRootFeedDocument("gdata/root_feed.json")); @@ -1377,10 +1389,10 @@ TEST_F(DriveFileSystemTest, CopyFileToInvalidPath) { } TEST_F(DriveFileSystemTest, RenameFile) { - const FilePath src_file_path( + const base::FilePath src_file_path( FILE_PATH_LITERAL("drive/Directory 1/SubDirectory File 1.txt")); - const FilePath src_parent_path(FILE_PATH_LITERAL("drive/Directory 1")); - const FilePath dest_file_path( + const base::FilePath src_parent_path(FILE_PATH_LITERAL("drive/Directory 1")); + const base::FilePath dest_file_path( FILE_PATH_LITERAL("drive/Directory 1/Test.log")); ASSERT_TRUE(LoadRootFeedDocument("gdata/root_feed.json")); @@ -1393,7 +1405,7 @@ TEST_F(DriveFileSystemTest, RenameFile) { src_entry_proto->resource_id(); EXPECT_CALL(*mock_directory_observer_, OnDirectoryChanged( - Eq(FilePath(FILE_PATH_LITERAL("drive/Directory 1"))))).Times(1); + Eq(base::FilePath(FILE_PATH_LITERAL("drive/Directory 1"))))).Times(1); DriveFileError error = DRIVE_FILE_ERROR_FAILED; file_system_->Move( @@ -1409,9 +1421,10 @@ TEST_F(DriveFileSystemTest, RenameFile) { } TEST_F(DriveFileSystemTest, MoveFileFromRootToSubDirectory) { - FilePath src_file_path(FILE_PATH_LITERAL("drive/File 1.txt")); - FilePath dest_parent_path(FILE_PATH_LITERAL("drive/Directory 1")); - FilePath dest_file_path(FILE_PATH_LITERAL("drive/Directory 1/Test.log")); + base::FilePath src_file_path(FILE_PATH_LITERAL("drive/File 1.txt")); + base::FilePath dest_parent_path(FILE_PATH_LITERAL("drive/Directory 1")); + base::FilePath dest_file_path( + FILE_PATH_LITERAL("drive/Directory 1/Test.log")); ASSERT_TRUE(LoadRootFeedDocument("gdata/root_feed.json")); @@ -1432,9 +1445,9 @@ TEST_F(DriveFileSystemTest, MoveFileFromRootToSubDirectory) { // Expect notification for both source and destination directories. EXPECT_CALL(*mock_directory_observer_, OnDirectoryChanged( - Eq(FilePath(FILE_PATH_LITERAL("drive"))))).Times(2); + Eq(base::FilePath(FILE_PATH_LITERAL("drive"))))).Times(2); EXPECT_CALL(*mock_directory_observer_, OnDirectoryChanged( - Eq(FilePath(FILE_PATH_LITERAL("drive/Directory 1"))))).Times(1); + Eq(base::FilePath(FILE_PATH_LITERAL("drive/Directory 1"))))).Times(1); DriveFileError error = DRIVE_FILE_ERROR_FAILED; file_system_->Move( @@ -1450,10 +1463,10 @@ TEST_F(DriveFileSystemTest, MoveFileFromRootToSubDirectory) { } TEST_F(DriveFileSystemTest, MoveFileFromSubDirectoryToRoot) { - FilePath src_parent_path(FILE_PATH_LITERAL("drive/Directory 1")); - FilePath src_file_path( + base::FilePath src_parent_path(FILE_PATH_LITERAL("drive/Directory 1")); + base::FilePath src_file_path( FILE_PATH_LITERAL("drive/Directory 1/SubDirectory File 1.txt")); - FilePath dest_file_path(FILE_PATH_LITERAL("drive/Test.log")); + base::FilePath dest_file_path(FILE_PATH_LITERAL("drive/Test.log")); ASSERT_TRUE(LoadRootFeedDocument("gdata/root_feed.json")); @@ -1474,9 +1487,9 @@ TEST_F(DriveFileSystemTest, MoveFileFromSubDirectoryToRoot) { // Expect notification for both source and destination directories. EXPECT_CALL(*mock_directory_observer_, OnDirectoryChanged( - Eq(FilePath(FILE_PATH_LITERAL("drive"))))).Times(2); + Eq(base::FilePath(FILE_PATH_LITERAL("drive"))))).Times(2); EXPECT_CALL(*mock_directory_observer_, OnDirectoryChanged( - Eq(FilePath(FILE_PATH_LITERAL("drive/Directory 1"))))).Times(1); + Eq(base::FilePath(FILE_PATH_LITERAL("drive/Directory 1"))))).Times(1); DriveFileError error = DRIVE_FILE_ERROR_FAILED; file_system_->Move( @@ -1492,17 +1505,18 @@ TEST_F(DriveFileSystemTest, MoveFileFromSubDirectoryToRoot) { } TEST_F(DriveFileSystemTest, MoveFileBetweenSubDirectories) { - FilePath src_parent_path(FILE_PATH_LITERAL("drive/Directory 1")); - FilePath src_file_path( + base::FilePath src_parent_path(FILE_PATH_LITERAL("drive/Directory 1")); + base::FilePath src_file_path( FILE_PATH_LITERAL("drive/Directory 1/SubDirectory File 1.txt")); - FilePath dest_parent_path(FILE_PATH_LITERAL("drive/New Folder 1")); - FilePath dest_file_path(FILE_PATH_LITERAL("drive/New Folder 1/Test.log")); - FilePath interim_file_path(FILE_PATH_LITERAL("drive/Test.log")); + base::FilePath dest_parent_path(FILE_PATH_LITERAL("drive/New Folder 1")); + base::FilePath dest_file_path( + FILE_PATH_LITERAL("drive/New Folder 1/Test.log")); + base::FilePath interim_file_path(FILE_PATH_LITERAL("drive/Test.log")); ASSERT_TRUE(LoadRootFeedDocument("gdata/root_feed.json")); EXPECT_CALL(*mock_directory_observer_, OnDirectoryChanged( - Eq(FilePath(FILE_PATH_LITERAL("drive"))))).Times(1); + Eq(base::FilePath(FILE_PATH_LITERAL("drive"))))).Times(1); AddDirectoryFromFile(dest_parent_path, "gdata/directory_entry_atom.json"); @@ -1533,11 +1547,11 @@ TEST_F(DriveFileSystemTest, MoveFileBetweenSubDirectories) { // Expect notification for both source and destination directories plus // interim file path. EXPECT_CALL(*mock_directory_observer_, OnDirectoryChanged( - Eq(FilePath(FILE_PATH_LITERAL("drive/Directory 1"))))).Times(1); + Eq(base::FilePath(FILE_PATH_LITERAL("drive/Directory 1"))))).Times(1); EXPECT_CALL(*mock_directory_observer_, OnDirectoryChanged( - Eq(FilePath(FILE_PATH_LITERAL("drive"))))).Times(1); + Eq(base::FilePath(FILE_PATH_LITERAL("drive"))))).Times(1); EXPECT_CALL(*mock_directory_observer_, OnDirectoryChanged( - Eq(FilePath(FILE_PATH_LITERAL("drive/New Folder 1"))))).Times(1); + Eq(base::FilePath(FILE_PATH_LITERAL("drive/New Folder 1"))))).Times(1); DriveFileError error = DRIVE_FILE_ERROR_FAILED; file_system_->Move( @@ -1556,8 +1570,8 @@ TEST_F(DriveFileSystemTest, MoveFileBetweenSubDirectories) { } TEST_F(DriveFileSystemTest, MoveNotExistingFile) { - FilePath src_file_path(FILE_PATH_LITERAL("drive/Dummy file.txt")); - FilePath dest_file_path(FILE_PATH_LITERAL("drive/Test.log")); + base::FilePath src_file_path(FILE_PATH_LITERAL("drive/Dummy file.txt")); + base::FilePath dest_file_path(FILE_PATH_LITERAL("drive/Test.log")); ASSERT_TRUE(LoadRootFeedDocument("gdata/root_feed.json")); @@ -1576,9 +1590,9 @@ TEST_F(DriveFileSystemTest, MoveNotExistingFile) { } TEST_F(DriveFileSystemTest, MoveFileToNonExistingDirectory) { - FilePath src_file_path(FILE_PATH_LITERAL("drive/File 1.txt")); - FilePath dest_parent_path(FILE_PATH_LITERAL("drive/Dummy")); - FilePath dest_file_path(FILE_PATH_LITERAL("drive/Dummy/Test.log")); + base::FilePath src_file_path(FILE_PATH_LITERAL("drive/File 1.txt")); + base::FilePath dest_parent_path(FILE_PATH_LITERAL("drive/Dummy")); + base::FilePath dest_file_path(FILE_PATH_LITERAL("drive/Dummy/Test.log")); ASSERT_TRUE(LoadRootFeedDocument("gdata/root_feed.json")); @@ -1607,9 +1621,10 @@ TEST_F(DriveFileSystemTest, MoveFileToNonExistingDirectory) { // Test the case where the parent of |dest_file_path| is a existing file, // not a directory. TEST_F(DriveFileSystemTest, MoveFileToInvalidPath) { - FilePath src_file_path(FILE_PATH_LITERAL("drive/File 1.txt")); - FilePath dest_parent_path(FILE_PATH_LITERAL("drive/Duplicate Name.txt")); - FilePath dest_file_path(FILE_PATH_LITERAL( + base::FilePath src_file_path(FILE_PATH_LITERAL("drive/File 1.txt")); + base::FilePath dest_parent_path( + FILE_PATH_LITERAL("drive/Duplicate Name.txt")); + base::FilePath dest_file_path(FILE_PATH_LITERAL( "drive/Duplicate Name.txt/Test.log")); ASSERT_TRUE(LoadRootFeedDocument("gdata/root_feed.json")); @@ -1643,10 +1658,10 @@ TEST_F(DriveFileSystemTest, MoveFileToInvalidPath) { TEST_F(DriveFileSystemTest, RemoveEntries) { ASSERT_TRUE(LoadRootFeedDocument("gdata/root_feed.json")); - FilePath nonexisting_file(FILE_PATH_LITERAL("drive/Dummy file.txt")); - FilePath file_in_root(FILE_PATH_LITERAL("drive/File 1.txt")); - FilePath dir_in_root(FILE_PATH_LITERAL("drive/Directory 1")); - FilePath file_in_subdir( + base::FilePath nonexisting_file(FILE_PATH_LITERAL("drive/Dummy file.txt")); + base::FilePath file_in_root(FILE_PATH_LITERAL("drive/File 1.txt")); + base::FilePath dir_in_root(FILE_PATH_LITERAL("drive/Directory 1")); + base::FilePath file_in_subdir( FILE_PATH_LITERAL("drive/Directory 1/SubDirectory File 1.txt")); ASSERT_TRUE(EntryExists(file_in_root)); @@ -1667,7 +1682,7 @@ TEST_F(DriveFileSystemTest, RemoveEntries) { // Once for file in root and once for file... EXPECT_CALL(*mock_directory_observer_, OnDirectoryChanged( - Eq(FilePath(FILE_PATH_LITERAL("drive"))))).Times(2); + Eq(base::FilePath(FILE_PATH_LITERAL("drive"))))).Times(2); // Remove first file in root. EXPECT_TRUE(RemoveEntry(file_in_root)); @@ -1688,7 +1703,7 @@ TEST_F(DriveFileSystemTest, RemoveEntries) { EXPECT_FALSE(RemoveEntry(nonexisting_file)); // Try removing root file element. - EXPECT_FALSE(RemoveEntry(FilePath(FILE_PATH_LITERAL("drive")))); + EXPECT_FALSE(RemoveEntry(base::FilePath(FILE_PATH_LITERAL("drive")))); // Need this to ensure OnDirectoryChanged() is run. google_apis::test_util::RunBlockingPoolTask(); @@ -1698,19 +1713,19 @@ TEST_F(DriveFileSystemTest, CreateDirectory) { ASSERT_TRUE(LoadRootFeedDocument("gdata/root_feed.json")); EXPECT_CALL(*mock_directory_observer_, OnDirectoryChanged( - Eq(FilePath(FILE_PATH_LITERAL("drive"))))).Times(1); + Eq(base::FilePath(FILE_PATH_LITERAL("drive"))))).Times(1); // Create directory in root. - FilePath dir_path(FILE_PATH_LITERAL("drive/New Folder 1")); + base::FilePath dir_path(FILE_PATH_LITERAL("drive/New Folder 1")); EXPECT_FALSE(EntryExists(dir_path)); AddDirectoryFromFile(dir_path, "gdata/directory_entry_atom.json"); EXPECT_TRUE(EntryExists(dir_path)); EXPECT_CALL(*mock_directory_observer_, OnDirectoryChanged( - Eq(FilePath(FILE_PATH_LITERAL("drive/New Folder 1"))))).Times(1); + Eq(base::FilePath(FILE_PATH_LITERAL("drive/New Folder 1"))))).Times(1); // Create directory in a sub directory. - FilePath subdir_path(FILE_PATH_LITERAL("drive/New Folder 1/New Folder 2")); + base::FilePath subdir_path(FILE_PATH_LITERAL("drive/New Folder 1/New Folder 2")); EXPECT_FALSE(EntryExists(subdir_path)); AddDirectoryFromFile(subdir_path, "gdata/directory_entry_atom2.json"); EXPECT_TRUE(EntryExists(subdir_path)); @@ -1720,11 +1735,11 @@ TEST_F(DriveFileSystemTest, CreateDirectory) { TEST_F(DriveFileSystemTest, CreateDirectoryWithService) { ASSERT_TRUE(LoadRootFeedDocument("gdata/root_feed.json")); EXPECT_CALL(*mock_directory_observer_, OnDirectoryChanged( - Eq(FilePath(FILE_PATH_LITERAL("drive"))))).Times(1); + Eq(base::FilePath(FILE_PATH_LITERAL("drive"))))).Times(1); DriveFileError error = DRIVE_FILE_ERROR_FAILED; file_system_->CreateDirectory( - FilePath(FILE_PATH_LITERAL("drive/Sample Directory Title")), + base::FilePath(FILE_PATH_LITERAL("drive/Sample Directory Title")), false, // is_exclusive true, // is_recursive base::Bind(&test_util::CopyErrorCodeFromFileOperationCallback, &error)); @@ -1739,11 +1754,11 @@ TEST_F(DriveFileSystemTest, GetFileByPath_FromGData_EnoughSpace) { // The transfered file is cached and the change of "offline avaialble" // attribute is notified. EXPECT_CALL(*mock_directory_observer_, OnDirectoryChanged( - Eq(FilePath(FILE_PATH_LITERAL("drive"))))).Times(1); + Eq(base::FilePath(FILE_PATH_LITERAL("drive"))))).Times(1); - FilePath file_in_root(FILE_PATH_LITERAL("drive/File 1.txt")); + base::FilePath file_in_root(FILE_PATH_LITERAL("drive/File 1.txt")); scoped_ptr<DriveEntryProto> entry_proto(GetEntryInfoByPathSync(file_in_root)); - FilePath downloaded_file = GetCachePathForFile( + base::FilePath downloaded_file = GetCachePathForFile( entry_proto->resource_id(), entry_proto->file_specific_info().file_md5()); const int64 file_size = entry_proto->file_info().size(); @@ -1753,7 +1768,7 @@ TEST_F(DriveFileSystemTest, GetFileByPath_FromGData_EnoughSpace) { file_size + kMinFreeSpace); DriveFileError error = DRIVE_FILE_ERROR_FAILED; - FilePath file_path; + base::FilePath file_path; DriveFileType file_type; file_system_->GetFileByPath( file_in_root, @@ -1769,9 +1784,9 @@ TEST_F(DriveFileSystemTest, GetFileByPath_FromGData_EnoughSpace) { TEST_F(DriveFileSystemTest, GetFileByPath_FromGData_NoSpaceAtAll) { ASSERT_TRUE(LoadRootFeedDocument("gdata/root_feed.json")); - FilePath file_in_root(FILE_PATH_LITERAL("drive/File 1.txt")); + base::FilePath file_in_root(FILE_PATH_LITERAL("drive/File 1.txt")); scoped_ptr<DriveEntryProto> entry_proto(GetEntryInfoByPathSync(file_in_root)); - FilePath downloaded_file = GetCachePathForFile( + base::FilePath downloaded_file = GetCachePathForFile( entry_proto->resource_id(), entry_proto->file_specific_info().file_md5()); @@ -1779,7 +1794,7 @@ TEST_F(DriveFileSystemTest, GetFileByPath_FromGData_NoSpaceAtAll) { fake_free_disk_space_getter_->set_fake_free_disk_space(0); DriveFileError error = DRIVE_FILE_OK; - FilePath file_path; + base::FilePath file_path; DriveFileType file_type; file_system_->GetFileByPath( file_in_root, @@ -1796,11 +1811,11 @@ TEST_F(DriveFileSystemTest, GetFileByPath_FromGData_NoEnoughSpaceButCanFreeUp) { // The transfered file is cached and the change of "offline avaialble" // attribute is notified. EXPECT_CALL(*mock_directory_observer_, OnDirectoryChanged( - Eq(FilePath(FILE_PATH_LITERAL("drive"))))).Times(1); + Eq(base::FilePath(FILE_PATH_LITERAL("drive"))))).Times(1); - FilePath file_in_root(FILE_PATH_LITERAL("drive/File 1.txt")); + base::FilePath file_in_root(FILE_PATH_LITERAL("drive/File 1.txt")); scoped_ptr<DriveEntryProto> entry_proto(GetEntryInfoByPathSync(file_in_root)); - FilePath downloaded_file = GetCachePathForFile( + base::FilePath downloaded_file = GetCachePathForFile( entry_proto->resource_id(), entry_proto->file_specific_info().file_md5()); const int64 file_size = entry_proto->file_info().size(); @@ -1820,7 +1835,7 @@ TEST_F(DriveFileSystemTest, GetFileByPath_FromGData_NoEnoughSpaceButCanFreeUp) { const std::string content(file_size, 'x'); base::ScopedTempDir temp_dir; ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); - const FilePath tmp_file = + const base::FilePath tmp_file = temp_dir.path().AppendASCII("something.txt"); ASSERT_EQ(file_size, file_util::WriteFile(tmp_file, content.data(), content.size())); @@ -1835,7 +1850,7 @@ TEST_F(DriveFileSystemTest, GetFileByPath_FromGData_NoEnoughSpaceButCanFreeUp) { ASSERT_TRUE(CacheFileExists("<resource_id>", "<md5>")); DriveFileError error = DRIVE_FILE_ERROR_FAILED; - FilePath file_path; + base::FilePath file_path; DriveFileType file_type; file_system_->GetFileByPath( file_in_root, @@ -1856,9 +1871,9 @@ TEST_F(DriveFileSystemTest, GetFileByPath_FromGData_NoEnoughSpaceButCanFreeUp) { TEST_F(DriveFileSystemTest, GetFileByPath_FromGData_EnoughSpaceButBecomeFull) { ASSERT_TRUE(LoadRootFeedDocument("gdata/root_feed.json")); - FilePath file_in_root(FILE_PATH_LITERAL("drive/File 1.txt")); + base::FilePath file_in_root(FILE_PATH_LITERAL("drive/File 1.txt")); scoped_ptr<DriveEntryProto> entry_proto(GetEntryInfoByPathSync(file_in_root)); - FilePath downloaded_file = GetCachePathForFile( + base::FilePath downloaded_file = GetCachePathForFile( entry_proto->resource_id(), entry_proto->file_specific_info().file_md5()); const int64 file_size = entry_proto->file_info().size(); @@ -1873,7 +1888,7 @@ TEST_F(DriveFileSystemTest, GetFileByPath_FromGData_EnoughSpaceButBecomeFull) { fake_free_disk_space_getter_->set_fake_free_disk_space(kMinFreeSpace - 1); DriveFileError error = DRIVE_FILE_OK; - FilePath file_path; + base::FilePath file_path; DriveFileType file_type; file_system_->GetFileByPath( file_in_root, @@ -1889,9 +1904,9 @@ TEST_F(DriveFileSystemTest, GetFileByPath_FromCache) { ASSERT_TRUE(LoadRootFeedDocument("gdata/root_feed.json")); - FilePath file_in_root(FILE_PATH_LITERAL("drive/File 1.txt")); + base::FilePath file_in_root(FILE_PATH_LITERAL("drive/File 1.txt")); scoped_ptr<DriveEntryProto> entry_proto(GetEntryInfoByPathSync(file_in_root)); - FilePath downloaded_file = GetCachePathForFile( + base::FilePath downloaded_file = GetCachePathForFile( entry_proto->resource_id(), entry_proto->file_specific_info().file_md5()); @@ -1905,7 +1920,7 @@ TEST_F(DriveFileSystemTest, GetFileByPath_FromCache) { DriveCache::CACHE_TYPE_TMP); DriveFileError error = DRIVE_FILE_OK; - FilePath file_path; + base::FilePath file_path; DriveFileType file_type; file_system_->GetFileByPath( file_in_root, @@ -1920,13 +1935,13 @@ TEST_F(DriveFileSystemTest, GetFileByPath_FromCache) { TEST_F(DriveFileSystemTest, GetFileByPath_HostedDocument) { ASSERT_TRUE(LoadRootFeedDocument("gdata/root_feed.json")); - FilePath file_in_root(FILE_PATH_LITERAL("drive/Document 1.gdoc")); + base::FilePath file_in_root(FILE_PATH_LITERAL("drive/Document 1.gdoc")); scoped_ptr<DriveEntryProto> src_entry_proto = GetEntryInfoByPathSync(file_in_root); ASSERT_TRUE(src_entry_proto.get()); DriveFileError error = DRIVE_FILE_ERROR_FAILED; - FilePath file_path; + base::FilePath file_path; DriveFileType file_type; file_system_->GetFileByPath( file_in_root, @@ -1947,18 +1962,18 @@ TEST_F(DriveFileSystemTest, GetFileByResourceId) { // The transfered file is cached and the change of "offline avaialble" // attribute is notified. EXPECT_CALL(*mock_directory_observer_, OnDirectoryChanged( - Eq(FilePath(FILE_PATH_LITERAL("drive"))))).Times(1); + Eq(base::FilePath(FILE_PATH_LITERAL("drive"))))).Times(1); ASSERT_TRUE(LoadRootFeedDocument("gdata/root_feed.json")); - FilePath file_in_root(FILE_PATH_LITERAL("drive/File 1.txt")); + base::FilePath file_in_root(FILE_PATH_LITERAL("drive/File 1.txt")); scoped_ptr<DriveEntryProto> entry_proto(GetEntryInfoByPathSync(file_in_root)); - FilePath downloaded_file = GetCachePathForFile( + base::FilePath downloaded_file = GetCachePathForFile( entry_proto->resource_id(), entry_proto->file_specific_info().file_md5()); DriveFileError error = DRIVE_FILE_OK; - FilePath file_path; + base::FilePath file_path; DriveFileType file_type; file_system_->GetFileByResourceId( entry_proto->resource_id(), @@ -1976,9 +1991,9 @@ TEST_F(DriveFileSystemTest, GetFileByResourceId_FromCache) { ASSERT_TRUE(LoadRootFeedDocument("gdata/root_feed.json")); - FilePath file_in_root(FILE_PATH_LITERAL("drive/File 1.txt")); + base::FilePath file_in_root(FILE_PATH_LITERAL("drive/File 1.txt")); scoped_ptr<DriveEntryProto> entry_proto(GetEntryInfoByPathSync(file_in_root)); - FilePath downloaded_file = GetCachePathForFile( + base::FilePath downloaded_file = GetCachePathForFile( entry_proto->resource_id(), entry_proto->file_specific_info().file_md5()); @@ -1996,7 +2011,7 @@ TEST_F(DriveFileSystemTest, GetFileByResourceId_FromCache) { fake_drive_service_->set_offline(true); DriveFileError error = DRIVE_FILE_ERROR_FAILED; - FilePath file_path; + base::FilePath file_path; DriveFileType file_type; file_system_->GetFileByResourceId( entry_proto->resource_id(), @@ -2015,7 +2030,7 @@ TEST_F(DriveFileSystemTest, UpdateFileByResourceId_PersistentFile) { ASSERT_TRUE(LoadRootFeedDocument("gdata/root_feed.json")); // This is a file defined in root_feed.json. - const FilePath kFilePath(FILE_PATH_LITERAL("drive/File 1.txt")); + const base::FilePath kFilePath(FILE_PATH_LITERAL("drive/File 1.txt")); const std::string kResourceId("file:2_file_resource_id"); const std::string kMd5("3b4382ebefec6e743578c76bbd0575ce"); @@ -2029,7 +2044,7 @@ TEST_F(DriveFileSystemTest, UpdateFileByResourceId_PersistentFile) { // First store a file to cache. A cache file will be created at: // GCache/v1/persistent/<kResourceId>.<kMd5> - const FilePath original_cache_file_path = + const base::FilePath original_cache_file_path = DriveCache::GetCacheRootPath(profile_.get()) .AppendASCII("persistent") .AppendASCII(kResourceId + "." + kMd5); @@ -2055,7 +2070,7 @@ TEST_F(DriveFileSystemTest, UpdateFileByResourceId_PersistentFile) { test_util::TEST_CACHE_STATE_DIRTY | test_util::TEST_CACHE_STATE_PERSISTENT, DriveCache::CACHE_TYPE_PERSISTENT); - const FilePath dirty_cache_file_path = + const base::FilePath dirty_cache_file_path = DriveCache::GetCacheRootPath(profile_.get()) .AppendASCII("persistent") .AppendASCII(kResourceId + ".local"); @@ -2080,7 +2095,7 @@ TEST_F(DriveFileSystemTest, UpdateFileByResourceId_PersistentFile) { test_util::TEST_CACHE_STATE_DIRTY | test_util::TEST_CACHE_STATE_PERSISTENT, DriveCache::CACHE_TYPE_PERSISTENT); - const FilePath outgoing_symlink_path = + const base::FilePath outgoing_symlink_path = DriveCache::GetCacheRootPath(profile_.get()) .AppendASCII("outgoing") .AppendASCII(kResourceId); @@ -2089,12 +2104,12 @@ TEST_F(DriveFileSystemTest, UpdateFileByResourceId_PersistentFile) { // We'll notify the directory change to the observer upon completion. EXPECT_CALL(*mock_directory_observer_, - OnDirectoryChanged(Eq(FilePath(kDriveRootDirectory)))).Times(1); + OnDirectoryChanged(Eq(base::FilePath(kDriveRootDirectory)))).Times(1); // Check the number of files in the root directory. We'll compare the // number after updating a file. scoped_ptr<DriveEntryProtoVector> root_directory_entries( - ReadDirectoryByPathSync(FilePath::FromUTF8Unsafe("drive"))); + ReadDirectoryByPathSync(base::FilePath::FromUTF8Unsafe("drive"))); ASSERT_TRUE(root_directory_entries.get()); const int num_files_in_root = CountFiles(*root_directory_entries); @@ -2120,7 +2135,7 @@ TEST_F(DriveFileSystemTest, UpdateFileByResourceId_NonexistentFile) { ASSERT_TRUE(LoadRootFeedDocument("gdata/root_feed.json")); // This is nonexistent in root_feed.json. - const FilePath kFilePath(FILE_PATH_LITERAL("drive/Nonexistent.txt")); + const base::FilePath kFilePath(FILE_PATH_LITERAL("drive/Nonexistent.txt")); const std::string kResourceId("file:nonexistent_resource_id"); const std::string kMd5("nonexistent_md5"); @@ -2224,9 +2239,10 @@ TEST_F(DriveFileSystemTest, RequestDirectoryRefresh) { // We'll notify the directory change to the observer. EXPECT_CALL(*mock_directory_observer_, - OnDirectoryChanged(Eq(FilePath(kDriveRootDirectory)))).Times(1); + OnDirectoryChanged(Eq( + base::FilePath(kDriveRootDirectory)))).Times(1); - file_system_->RequestDirectoryRefresh(FilePath(kDriveRootDirectory)); + file_system_->RequestDirectoryRefresh(base::FilePath(kDriveRootDirectory)); google_apis::test_util::RunBlockingPoolTask(); } @@ -2236,11 +2252,11 @@ TEST_F(DriveFileSystemTest, OpenAndCloseFile) { // The transfered file is cached and the change of "offline avaialble" // attribute is notified. EXPECT_CALL(*mock_directory_observer_, OnDirectoryChanged( - Eq(FilePath(FILE_PATH_LITERAL("drive"))))).Times(1); + Eq(base::FilePath(FILE_PATH_LITERAL("drive"))))).Times(1); - const FilePath kFileInRoot(FILE_PATH_LITERAL("drive/File 1.txt")); + const base::FilePath kFileInRoot(FILE_PATH_LITERAL("drive/File 1.txt")); scoped_ptr<DriveEntryProto> entry_proto(GetEntryInfoByPathSync(kFileInRoot)); - FilePath downloaded_file = GetCachePathForFile( + base::FilePath downloaded_file = GetCachePathForFile( entry_proto->resource_id(), entry_proto->file_specific_info().file_md5()); const int64 file_size = entry_proto->file_info().size(); @@ -2258,13 +2274,13 @@ TEST_F(DriveFileSystemTest, OpenAndCloseFile) { // Open kFileInRoot ("drive/File 1.txt"). DriveFileError error = DRIVE_FILE_ERROR_FAILED; - FilePath file_path; + base::FilePath file_path; file_system_->OpenFile( kFileInRoot, base::Bind(&test_util::CopyResultsFromOpenFileCallbackAndQuit, &error, &file_path)); message_loop_.Run(); - const FilePath opened_file_path = file_path; + const base::FilePath opened_file_path = file_path; // Verify that the file was properly opened. EXPECT_EQ(DRIVE_FILE_OK, error); @@ -2326,7 +2342,7 @@ TEST_F(DriveFileSystemTest, WebAppsRegistryIsLoaded) { // No apps should be found as the webapps registry is empty. ScopedVector<DriveWebAppInfo> apps; drive_webapps_registry_->GetWebAppsForFile( - FilePath::FromUTF8Unsafe("foo.ext_1"), + base::FilePath::FromUTF8Unsafe("foo.ext_1"), "" /* mime_type */, &apps); EXPECT_TRUE(apps.empty()); @@ -2334,11 +2350,11 @@ TEST_F(DriveFileSystemTest, WebAppsRegistryIsLoaded) { // Kicks loading of cached file system and query for server update. This // will cause GetAccountMetadata() to be called, to check the server-side // changestamp, and the webapps registry will be loaded at the same time. - EXPECT_TRUE(EntryExists(FilePath(FILE_PATH_LITERAL("drive/File1")))); + EXPECT_TRUE(EntryExists(base::FilePath(FILE_PATH_LITERAL("drive/File1")))); // An app for foo.ext_1 should now be found, as the registry was loaded. drive_webapps_registry_->GetWebAppsForFile( - FilePath(FILE_PATH_LITERAL("foo.ext_1")), + base::FilePath(FILE_PATH_LITERAL("foo.ext_1")), "" /* mime_type */, &apps); EXPECT_EQ(1U, apps.size()); diff --git a/chrome/browser/chromeos/drive/drive_file_system_util.cc b/chrome/browser/chromeos/drive/drive_file_system_util.cc index 94f492b..80f798a 100644 --- a/chrome/browser/chromeos/drive/drive_file_system_util.cc +++ b/chrome/browser/chromeos/drive/drive_file_system_util.cc @@ -45,7 +45,7 @@ const char kDriveSpecialRootPath[] = "/special"; const char kDriveMountPointPath[] = "/special/drive"; -const FilePath::CharType* kDriveMountPointPathComponents[] = { +const base::FilePath::CharType* kDriveMountPointPathComponents[] = { "/", "special", "drive" }; @@ -75,7 +75,8 @@ FileWriteHelper* GetFileWriteHelper(Profile* profile) { return system_service ? system_service->file_write_helper() : NULL; } -GURL GetHostedDocumentURLBlockingThread(const FilePath& drive_cache_path) { +GURL GetHostedDocumentURLBlockingThread( + const base::FilePath& drive_cache_path) { std::string json; if (!file_util::ReadFileToString(drive_cache_path, &json)) { NOTREACHED() << "Unable to read file " << drive_cache_path.value(); @@ -112,7 +113,7 @@ void OpenEditURLUIThread(Profile* profile, const GURL& edit_url) { void OnGetEntryInfoByResourceId(Profile* profile, const std::string& resource_id, DriveFileError error, - const FilePath& /* drive_file_path */, + const base::FilePath& /* drive_file_path */, scoped_ptr<DriveEntryProto> entry_proto) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); @@ -128,9 +129,9 @@ void OnGetEntryInfoByResourceId(Profile* profile, } // namespace -const FilePath& GetDriveMountPointPath() { - CR_DEFINE_STATIC_LOCAL(FilePath, drive_mount_path, - (FilePath::FromUTF8Unsafe(kDriveMountPointPath))); +const base::FilePath& GetDriveMountPointPath() { + CR_DEFINE_STATIC_LOCAL(base::FilePath, drive_mount_path, + (base::FilePath::FromUTF8Unsafe(kDriveMountPointPath))); return drive_mount_path; } @@ -140,9 +141,9 @@ const std::string& GetDriveMountPointPathAsString() { return drive_mount_path_string; } -const FilePath& GetSpecialRemoteRootPath() { - CR_DEFINE_STATIC_LOCAL(FilePath, drive_mount_path, - (FilePath::FromUTF8Unsafe(kDriveSpecialRootPath))); +const base::FilePath& GetSpecialRemoteRootPath() { + CR_DEFINE_STATIC_LOCAL(base::FilePath, drive_mount_path, + (base::FilePath::FromUTF8Unsafe(kDriveSpecialRootPath))); return drive_mount_path; } @@ -156,7 +157,7 @@ GURL GetFileResourceUrl(const std::string& resource_id, } void ModifyDriveFileResourceUrl(Profile* profile, - const FilePath& drive_cache_path, + const base::FilePath& drive_cache_path, GURL* url) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); @@ -193,20 +194,20 @@ void ModifyDriveFileResourceUrl(Profile* profile, } } -bool IsUnderDriveMountPoint(const FilePath& path) { +bool IsUnderDriveMountPoint(const base::FilePath& path) { return GetDriveMountPointPath() == path || GetDriveMountPointPath().IsParent(path); } -FilePath ExtractDrivePath(const FilePath& path) { +base::FilePath ExtractDrivePath(const base::FilePath& path) { if (!IsUnderDriveMountPoint(path)) - return FilePath(); + return base::FilePath(); - std::vector<FilePath::StringType> components; + std::vector<base::FilePath::StringType> components; path.GetComponents(&components); // -1 to include 'drive'. - FilePath extracted; + base::FilePath extracted; for (size_t i = arraysize(kDriveMountPointPathComponents) - 1; i < components.size(); ++i) { extracted = extracted.Append(components[i]); @@ -255,7 +256,7 @@ std::string ExtractResourceIdFromUrl(const GURL& url) { net::UnescapeRule::URL_SPECIAL_CHARS); } -void ParseCacheFilePath(const FilePath& path, +void ParseCacheFilePath(const base::FilePath& path, std::string* resource_id, std::string* md5, std::string* extra_extension) { @@ -264,13 +265,13 @@ void ParseCacheFilePath(const FilePath& path, DCHECK(extra_extension); // Extract up to two extensions from the right. - FilePath base_name = path.BaseName(); + base::FilePath base_name = path.BaseName(); const int kNumExtensionsToExtract = 2; - std::vector<FilePath::StringType> extensions; + std::vector<base::FilePath::StringType> extensions; for (int i = 0; i < kNumExtensionsToExtract; ++i) { - FilePath::StringType extension = base_name.Extension(); + base::FilePath::StringType extension = base_name.Extension(); if (!extension.empty()) { - // FilePath::Extension returns ".", so strip it. + // base::FilePath::Extension returns ".", so strip it. extension = UnescapeCacheFileName(extension.substr(1)); base_name = base_name.RemoveExtension(); extensions.push_back(extension); @@ -291,7 +292,7 @@ void ParseCacheFilePath(const FilePath& path, } void PrepareWritableFileAndRun(Profile* profile, - const FilePath& path, + const base::FilePath& path, const OpenFileCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!callback.is_null()); @@ -299,7 +300,7 @@ void PrepareWritableFileAndRun(Profile* profile, FileWriteHelper* file_write_helper = GetFileWriteHelper(profile); if (!file_write_helper) return; - FilePath remote_path(ExtractDrivePath(path)); + base::FilePath remote_path(ExtractDrivePath(path)); file_write_helper->PrepareWritableFileAndRun(remote_path, callback); } else { content::BrowserThread::GetBlockingPool()->PostTask( @@ -308,7 +309,7 @@ void PrepareWritableFileAndRun(Profile* profile, } void EnsureDirectoryExists(Profile* profile, - const FilePath& directory, + const base::FilePath& directory, const FileOperationCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI) || BrowserThread::CurrentlyOn(BrowserThread::IO)); diff --git a/chrome/browser/chromeos/drive/drive_file_system_util_unittest.cc b/chrome/browser/chromeos/drive/drive_file_system_util_unittest.cc index 73baf0e..4c90b24 100644 --- a/chrome/browser/chromeos/drive/drive_file_system_util_unittest.cc +++ b/chrome/browser/chromeos/drive/drive_file_system_util_unittest.cc @@ -12,42 +12,42 @@ namespace util { TEST(DriveFileSystemUtilTest, IsUnderDriveMountPoint) { EXPECT_FALSE(IsUnderDriveMountPoint( - FilePath::FromUTF8Unsafe("/wherever/foo.txt"))); + base::FilePath::FromUTF8Unsafe("/wherever/foo.txt"))); EXPECT_FALSE(IsUnderDriveMountPoint( - FilePath::FromUTF8Unsafe("/special/foo.txt"))); + base::FilePath::FromUTF8Unsafe("/special/foo.txt"))); EXPECT_FALSE(IsUnderDriveMountPoint( - FilePath::FromUTF8Unsafe("/special/drivex/foo.txt"))); + base::FilePath::FromUTF8Unsafe("/special/drivex/foo.txt"))); EXPECT_FALSE(IsUnderDriveMountPoint( - FilePath::FromUTF8Unsafe("special/drivex/foo.txt"))); + base::FilePath::FromUTF8Unsafe("special/drivex/foo.txt"))); EXPECT_TRUE(IsUnderDriveMountPoint( - FilePath::FromUTF8Unsafe("/special/drive"))); + base::FilePath::FromUTF8Unsafe("/special/drive"))); EXPECT_TRUE(IsUnderDriveMountPoint( - FilePath::FromUTF8Unsafe("/special/drive/foo.txt"))); + base::FilePath::FromUTF8Unsafe("/special/drive/foo.txt"))); EXPECT_TRUE(IsUnderDriveMountPoint( - FilePath::FromUTF8Unsafe("/special/drive/subdir/foo.txt"))); + base::FilePath::FromUTF8Unsafe("/special/drive/subdir/foo.txt"))); } TEST(DriveFileSystemUtilTest, ExtractDrivePath) { - EXPECT_EQ(FilePath(), + EXPECT_EQ(base::FilePath(), ExtractDrivePath( - FilePath::FromUTF8Unsafe("/wherever/foo.txt"))); - EXPECT_EQ(FilePath(), + base::FilePath::FromUTF8Unsafe("/wherever/foo.txt"))); + EXPECT_EQ(base::FilePath(), ExtractDrivePath( - FilePath::FromUTF8Unsafe("/special/foo.txt"))); - EXPECT_EQ(FilePath(), + base::FilePath::FromUTF8Unsafe("/special/foo.txt"))); + EXPECT_EQ(base::FilePath(), ExtractDrivePath( - FilePath::FromUTF8Unsafe("/special/drivex/foo.txt"))); + base::FilePath::FromUTF8Unsafe("/special/drivex/foo.txt"))); - EXPECT_EQ(FilePath::FromUTF8Unsafe("drive"), + EXPECT_EQ(base::FilePath::FromUTF8Unsafe("drive"), ExtractDrivePath( - FilePath::FromUTF8Unsafe("/special/drive"))); - EXPECT_EQ(FilePath::FromUTF8Unsafe("drive/foo.txt"), + base::FilePath::FromUTF8Unsafe("/special/drive"))); + EXPECT_EQ(base::FilePath::FromUTF8Unsafe("drive/foo.txt"), ExtractDrivePath( - FilePath::FromUTF8Unsafe("/special/drive/foo.txt"))); - EXPECT_EQ(FilePath::FromUTF8Unsafe("drive/subdir/foo.txt"), - ExtractDrivePath( - FilePath::FromUTF8Unsafe("/special/drive/subdir/foo.txt"))); + base::FilePath::FromUTF8Unsafe("/special/drive/foo.txt"))); + EXPECT_EQ(base::FilePath::FromUTF8Unsafe("drive/subdir/foo.txt"), + ExtractDrivePath(base::FilePath::FromUTF8Unsafe( + "/special/drive/subdir/foo.txt"))); } TEST(DriveFileSystemUtilTest, EscapeUnescapeCacheFileName) { @@ -80,7 +80,7 @@ TEST(DriveFileSystemUtilTest, ExtractResourceIdFromUrl) { TEST(DriveFileSystemUtilTest, ParseCacheFilePath) { std::string resource_id, md5, extra_extension; ParseCacheFilePath( - FilePath::FromUTF8Unsafe( + base::FilePath::FromUTF8Unsafe( "/home/user/GCache/v1/persistent/pdf:a1b2.0123456789abcdef.mounted"), &resource_id, &md5, @@ -90,7 +90,7 @@ TEST(DriveFileSystemUtilTest, ParseCacheFilePath) { EXPECT_EQ(extra_extension, "mounted"); ParseCacheFilePath( - FilePath::FromUTF8Unsafe( + base::FilePath::FromUTF8Unsafe( "/home/user/GCache/v1/tmp/pdf:a1b2.0123456789abcdef"), &resource_id, &md5, @@ -100,7 +100,7 @@ TEST(DriveFileSystemUtilTest, ParseCacheFilePath) { EXPECT_EQ(extra_extension, ""); ParseCacheFilePath( - FilePath::FromUTF8Unsafe( + base::FilePath::FromUTF8Unsafe( "/home/user/GCache/v1/pinned/pdf:a1b2"), &resource_id, &md5, diff --git a/chrome/browser/chromeos/drive/drive_files.cc b/chrome/browser/chromeos/drive/drive_files.cc index 4dcc037..c8230ab 100644 --- a/chrome/browser/chromeos/drive/drive_files.cc +++ b/chrome/browser/chromeos/drive/drive_files.cc @@ -46,8 +46,8 @@ const DriveDirectory* DriveEntry::AsDriveDirectoryConst() const { return const_cast<DriveEntry*>(this)->AsDriveDirectory(); } -FilePath DriveEntry::GetFilePath() const { - FilePath path; +base::FilePath DriveEntry::GetFilePath() const { + base::FilePath path; if (parent()) path = parent()->GetFilePath(); path = path.Append(base_name()); @@ -120,17 +120,17 @@ void DriveDirectory::AddEntry(DriveEntry* entry) { // Do file name de-duplication - find files with the same name and // append a name modifier to the name. int max_modifier = 1; - FilePath full_file_name(entry->base_name()); + base::FilePath full_file_name(entry->base_name()); const std::string extension = full_file_name.Extension(); const std::string file_name = full_file_name.RemoveExtension().value(); while (!FindChild(full_file_name.value()).empty()) { if (!extension.empty()) { - full_file_name = FilePath(base::StringPrintf("%s (%d)%s", + full_file_name = base::FilePath(base::StringPrintf("%s (%d)%s", file_name.c_str(), ++max_modifier, extension.c_str())); } else { - full_file_name = FilePath(base::StringPrintf("%s (%d)", + full_file_name = base::FilePath(base::StringPrintf("%s (%d)", file_name.c_str(), ++max_modifier)); } @@ -183,7 +183,7 @@ void DriveDirectory::RemoveEntry(DriveEntry* entry) { } std::string DriveDirectory::FindChild( - const FilePath::StringType& file_name) const { + const base::FilePath::StringType& file_name) const { ChildMap::const_iterator iter = child_files_.find(file_name); if (iter != child_files_.end()) return iter->second; @@ -242,7 +242,8 @@ void DriveDirectory::RemoveChildDirectories() { child_directories_.clear(); } -void DriveDirectory::GetChildDirectoryPaths(std::set<FilePath>* child_dirs) { +void DriveDirectory::GetChildDirectoryPaths( + std::set<base::FilePath>* child_dirs) { for (ChildMap::const_iterator iter = child_directories_.begin(); iter != child_directories_.end(); ++iter) { DriveDirectory* dir = resource_metadata_->GetEntryByResourceId( diff --git a/chrome/browser/chromeos/drive/drive_files.h b/chrome/browser/chromeos/drive/drive_files.h index 241df6d..9c3b750 100644 --- a/chrome/browser/chromeos/drive/drive_files.h +++ b/chrome/browser/chromeos/drive/drive_files.h @@ -62,12 +62,14 @@ class DriveEntry { // This is not the full path, use GetFilePath for that. // Note that base_name_ gets reset by SetBaseNameFromTitle() in a number of // situations due to de-duplication (see AddEntry). - const FilePath::StringType& base_name() const { return base_name_; } + const base::FilePath::StringType& base_name() const { return base_name_; } // TODO(achuith): Make this private when GDataDB no longer uses path as a key. - void set_base_name(const FilePath::StringType& name) { base_name_ = name; } + void set_base_name(const base::FilePath::StringType& name) { + base_name_ = name; + } - const FilePath::StringType& title() const { return title_; } - void set_title(const FilePath::StringType& title) { title_ = title; } + const base::FilePath::StringType& title() const { return title_; } + void set_title(const base::FilePath::StringType& title) { title_ = title; } // The unique resource ID associated with this file system entry. const std::string& resource_id() const { return resource_id_; } @@ -96,7 +98,7 @@ class DriveEntry { // Returns virtual file path representing this file system entry. This path // corresponds to file path expected by public methods of DriveFileSystem // class. - FilePath GetFilePath() const; + base::FilePath GetFilePath() const; // Sets |base_name_| based on the value of |title_| without name // de-duplication (see AddEntry() for details on de-duplication). @@ -118,7 +120,7 @@ class DriveEntry { // |base_name_| but may be different from |base_name_|. For example, // |base_name_| has an added .g<something> extension for hosted documents or // may have an extra suffix for name de-duplication on the drive file system. - FilePath::StringType title_; + base::FilePath::StringType title_; std::string resource_id_; std::string parent_resource_id_; // Files with the same title will be uniquely identified with this field @@ -133,7 +135,7 @@ class DriveEntry { // Name of this file in the drive virtual file system. This can change // due to de-duplication (See AddEntry). - FilePath::StringType base_name_; + base::FilePath::StringType base_name_; DriveDirectory* parent_; // Weak pointer to DriveResourceMetadata. @@ -231,7 +233,7 @@ class DriveDirectory : public DriveEntry { // Find a child's resource_id by its name. Returns the empty string if not // found. TODO(satorux): Remove this. crbug.com/139649 - std::string FindChild(const FilePath::StringType& file_name) const; + std::string FindChild(const base::FilePath::StringType& file_name) const; // Removes the entry from its children without destroying the // entry instance. @@ -243,10 +245,10 @@ class DriveDirectory : public DriveEntry { void RemoveChildDirectories(); // Recursively extracts the paths set of all sub-directories. - void GetChildDirectoryPaths(std::set<FilePath>* child_dirs); + void GetChildDirectoryPaths(std::set<base::FilePath>* child_dirs); // Map between base_name and resource_id of files and directories. - typedef std::map<FilePath::StringType, std::string> ChildMap; + typedef std::map<base::FilePath::StringType, std::string> ChildMap; // Collection of children. ChildMap child_files_; ChildMap child_directories_; diff --git a/chrome/browser/chromeos/drive/drive_prefetcher.cc b/chrome/browser/chromeos/drive/drive_prefetcher.cc index a977c80..917b2d5 100644 --- a/chrome/browser/chromeos/drive/drive_prefetcher.cc +++ b/chrome/browser/chromeos/drive/drive_prefetcher.cc @@ -87,7 +87,7 @@ void DrivePrefetcher::OnInitialLoadFinished(DriveFileError error) { DoFullScan(); } -void DrivePrefetcher::OnDirectoryChanged(const FilePath& directory_path) { +void DrivePrefetcher::OnDirectoryChanged(const base::FilePath& directory_path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); // TODO(kinaba): crbug.com/156270. @@ -110,7 +110,7 @@ void DrivePrefetcher::OnSyncClientIdle() { void DrivePrefetcher::DoFullScan() { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - FilePath root(util::ExtractDrivePath(util::GetDriveMountPointPath())); + base::FilePath root(util::ExtractDrivePath(util::GetDriveMountPointPath())); VisitDirectory(root); } @@ -138,7 +138,7 @@ void DrivePrefetcher::DoPrefetch() { void DrivePrefetcher::OnPrefetchFinished(const std::string& resource_id, DriveFileError error, - const FilePath& file_path, + const base::FilePath& file_path, const std::string& mime_type, DriveFileType file_type) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); @@ -177,7 +177,7 @@ void DrivePrefetcher::VisitFile(const DriveEntryProto& entry) { latest_files_.erase(latest_files_.begin()); } -void DrivePrefetcher::VisitDirectory(const FilePath& directory_path) { +void DrivePrefetcher::VisitDirectory(const base::FilePath& directory_path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); ++number_of_inflight_traversals_; @@ -189,7 +189,7 @@ void DrivePrefetcher::VisitDirectory(const FilePath& directory_path) { } void DrivePrefetcher::OnReadDirectory( - const FilePath& directory_path, + const base::FilePath& directory_path, DriveFileError error, bool hide_hosted_documents, scoped_ptr<DriveEntryProtoVector> entries) { diff --git a/chrome/browser/chromeos/drive/drive_prefetcher_unittest.cc b/chrome/browser/chromeos/drive/drive_prefetcher_unittest.cc index 7430f69..80e8f14 100644 --- a/chrome/browser/chromeos/drive/drive_prefetcher_unittest.cc +++ b/chrome/browser/chromeos/drive/drive_prefetcher_unittest.cc @@ -35,7 +35,7 @@ enum TestEntryType { // TestEntry represents a dummy entry for mocking a filesystem. struct TestEntry { - const FilePath::CharType* path; + const base::FilePath::CharType* path; TestEntryType entry_type; int64 last_accessed; int64 last_modified; @@ -43,15 +43,15 @@ struct TestEntry { int64 file_size; // Checks whether this TestEntry is the direct content of the |directory|. - bool IsDirectChildOf(const FilePath& directory) const { - return FilePath(path).DirName() == directory; + bool IsDirectChildOf(const base::FilePath& directory) const { + return base::FilePath(path).DirName() == directory; } // Converts this TestEntry to DriveEntryProto, which is the real data // structure used in DriveFileSystem. DriveEntryProto ToDriveEntryProto() const { DriveEntryProto entry; - entry.set_base_name(FilePath(path).BaseName().value()); + entry.set_base_name(base::FilePath(path).BaseName().value()); entry.mutable_file_info()->set_is_directory(entry_type == TYPE_DIRECTORY); if (entry_type != TYPE_DIRECTORY) { entry.mutable_file_specific_info()->set_is_hosted_document( @@ -69,14 +69,14 @@ struct TestEntry { // resource_id (arg0) to |fetched_list|, and calls back a successful completion. ACTION_P(MockGetFile, fetched_list) { fetched_list->push_back(arg0); - arg1.Run(DRIVE_FILE_OK, FilePath(), std::string(), REGULAR_FILE); + arg1.Run(DRIVE_FILE_OK, base::FilePath(), std::string(), REGULAR_FILE); } // Mocks DriveFileSystem::ReadDirectory. It holds the flat list of all entries // in the mock filesystem in |test_entries|, and when it is called to read a // |directory|, it selects only the direct children of the directory. ACTION_P(MockReadDirectory, test_entries) { - const FilePath& directory = arg0; + const base::FilePath& directory = arg0; const ReadDirectoryWithSettingCallback& callback = arg1; scoped_ptr<DriveEntryProtoVector> entries(new DriveEntryProtoVector); diff --git a/chrome/browser/chromeos/drive/drive_protocol_handler.cc b/chrome/browser/chromeos/drive/drive_protocol_handler.cc index 4f224a4..74f204d 100644 --- a/chrome/browser/chromeos/drive/drive_protocol_handler.cc +++ b/chrome/browser/chromeos/drive/drive_protocol_handler.cc @@ -113,7 +113,7 @@ DriveFileSystemInterface* GetFileSystemOnUIThread(void* profile_id) { // Helper function to cancel Drive download operation on UI thread. void CancelDriveDownloadOnUIThread( - void* profile_id, const FilePath& drive_file_path) { + void* profile_id, const base::FilePath& drive_file_path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DriveSystemService* system_service = GetSystemService(profile_id); @@ -131,7 +131,7 @@ void GetEntryInfoByResourceIdOnUIThread( DriveFileSystemInterface* file_system = GetFileSystemOnUIThread(profile_id); if (!file_system) { callback.Run(DRIVE_FILE_ERROR_FAILED, - FilePath(), + base::FilePath(), scoped_ptr<DriveEntryProto>()); return; } @@ -149,7 +149,7 @@ void GetFileByResourceIdOnUIThread( DriveFileSystemInterface* file_system = GetFileSystemOnUIThread(profile_id); if (!file_system) { get_file_callback.Run(DRIVE_FILE_ERROR_FAILED, - FilePath(), + base::FilePath(), std::string(), REGULAR_FILE); return; @@ -197,7 +197,7 @@ class DriveURLRequestJob : public net::URLRequestJob { // Helper callback for handling async responses from // DriveFileSystem::GetFileByResourceId(). void OnGetFileByResourceId(DriveFileError error, - const FilePath& local_file_path, + const base::FilePath& local_file_path, const std::string& mime_type, DriveFileType file_type); @@ -207,7 +207,7 @@ class DriveURLRequestJob : public net::URLRequestJob { // Helper callback for GetEntryInfoByResourceId invoked by Start(). void OnGetEntryInfoByResourceId(const std::string& resource_id, DriveFileError error, - const FilePath& drive_file_path, + const base::FilePath& drive_file_path, scoped_ptr<DriveEntryProto> entry_proto); // Helper methods for ReadRawData to open file and read from its corresponding @@ -242,8 +242,8 @@ class DriveURLRequestJob : public net::URLRequestJob { bool error_; // True if we've encountered an error. bool headers_set_; // True if headers have been set. - FilePath local_file_path_; - FilePath drive_file_path_; + base::FilePath local_file_path_; + base::FilePath drive_file_path_; std::string mime_type_; int64 initial_file_size_; int64 remaining_bytes_; @@ -519,7 +519,7 @@ DriveURLRequestJob::~DriveURLRequestJob() { void DriveURLRequestJob::OnGetEntryInfoByResourceId( const std::string& resource_id, DriveFileError error, - const FilePath& drive_file_path, + const base::FilePath& drive_file_path, scoped_ptr<DriveEntryProto> entry_proto) { if (entry_proto.get() && !entry_proto->has_file_specific_info()) error = DRIVE_FILE_ERROR_NOT_FOUND; @@ -671,7 +671,7 @@ bool DriveURLRequestJob::ReadFromDownloadData() { void DriveURLRequestJob::OnGetFileByResourceId( DriveFileError error, - const FilePath& local_file_path, + const base::FilePath& local_file_path, const std::string& mime_type, DriveFileType file_type) { DVLOG(1) << "Got OnGetFileByResourceId"; diff --git a/chrome/browser/chromeos/drive/drive_resource_metadata.cc b/chrome/browser/chromeos/drive/drive_resource_metadata.cc index a952cf8..7d4d53c 100644 --- a/chrome/browser/chromeos/drive/drive_resource_metadata.cc +++ b/chrome/browser/chromeos/drive/drive_resource_metadata.cc @@ -34,7 +34,7 @@ void PostFileMoveCallbackError(const FileMoveCallback& callback, DriveFileError error) { base::MessageLoopProxy::current()->PostTask( FROM_HERE, - base::Bind(callback, error, FilePath())); + base::Bind(callback, error, base::FilePath())); } // Posts |error| to |callback| asynchronously. |callback| must not be null. @@ -44,7 +44,7 @@ void PostGetEntryInfoWithFilePathCallbackError( scoped_ptr<DriveEntryProto> proto; base::MessageLoopProxy::current()->PostTask( FROM_HERE, - base::Bind(callback, error, FilePath(), base::Passed(&proto))); + base::Bind(callback, error, base::FilePath(), base::Passed(&proto))); } } // namespace @@ -65,13 +65,13 @@ EntryInfoPairResult::~EntryInfoPairResult() { // Params for ResourceMetadataDB::Create. struct CreateDBParams { - CreateDBParams(const FilePath& db_path, + CreateDBParams(const base::FilePath& db_path, base::SequencedTaskRunner* blocking_task_runner) : db_path(db_path), blocking_task_runner(blocking_task_runner) { } - FilePath db_path; + base::FilePath db_path; scoped_refptr<base::SequencedTaskRunner> blocking_task_runner; scoped_ptr<ResourceMetadataDB> db; DriveResourceMetadata::SerializedMap serialized_resources; @@ -80,7 +80,7 @@ struct CreateDBParams { // Wrapper for level db. All methods must be called on blocking thread. class ResourceMetadataDB { public: - ResourceMetadataDB(const FilePath& db_path, + ResourceMetadataDB(const base::FilePath& db_path, base::SequencedTaskRunner* blocking_task_runner); // Initializes the database. @@ -98,10 +98,10 @@ class ResourceMetadataDB { scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_; scoped_ptr<leveldb::DB> level_db_; - FilePath db_path_; + base::FilePath db_path_; }; -ResourceMetadataDB::ResourceMetadataDB(const FilePath& db_path, +ResourceMetadataDB::ResourceMetadataDB(const base::FilePath& db_path, base::SequencedTaskRunner* blocking_task_runner) : blocking_task_runner_(blocking_task_runner), db_path_(db_path) { @@ -246,7 +246,7 @@ void DriveResourceMetadata::SetLargestChangestamp( } void DriveResourceMetadata::AddEntryToDirectory( - const FilePath& directory_path, + const base::FilePath& directory_path, scoped_ptr<google_apis::ResourceEntry> entry, const FileMoveCallback& callback) { DCHECK(!directory_path.empty()); @@ -276,8 +276,8 @@ void DriveResourceMetadata::AddEntryToDirectory( } void DriveResourceMetadata::MoveEntryToDirectory( - const FilePath& file_path, - const FilePath& directory_path, + const base::FilePath& file_path, + const base::FilePath& directory_path, const FileMoveCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!directory_path.empty()); @@ -291,7 +291,7 @@ void DriveResourceMetadata::MoveEntryToDirectory( } DriveEntry* destination = FindEntryByPathSync(directory_path); - FilePath moved_file_path; + base::FilePath moved_file_path; DriveFileError error = DRIVE_FILE_ERROR_FAILED; if (!destination) { error = DRIVE_FILE_ERROR_NOT_FOUND; @@ -311,8 +311,8 @@ void DriveResourceMetadata::MoveEntryToDirectory( } void DriveResourceMetadata::RenameEntry( - const FilePath& file_path, - const FilePath::StringType& new_name, + const base::FilePath& file_path, + const base::FilePath::StringType& new_name, const FileMoveCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!file_path.empty()); @@ -389,11 +389,11 @@ void DriveResourceMetadata::RemoveEntryFromResourceMap( } DriveEntry* DriveResourceMetadata::FindEntryByPathSync( - const FilePath& file_path) { + const base::FilePath& file_path) { if (file_path == root_->GetFilePath()) return root_.get(); - std::vector<FilePath::StringType> components; + std::vector<base::FilePath::StringType> components; file_path.GetComponents(&components); DriveDirectory* current_dir = root_.get(); @@ -428,7 +428,7 @@ void DriveResourceMetadata::GetEntryInfoByResourceId( scoped_ptr<DriveEntryProto> entry_proto; DriveFileError error = DRIVE_FILE_ERROR_FAILED; - FilePath drive_file_path; + base::FilePath drive_file_path; DriveEntry* entry = GetEntryByResourceId(resource_id); if (entry) { @@ -446,7 +446,7 @@ void DriveResourceMetadata::GetEntryInfoByResourceId( } void DriveResourceMetadata::GetEntryInfoByPath( - const FilePath& path, + const base::FilePath& path, const GetEntryInfoCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!callback.is_null()); @@ -469,7 +469,7 @@ void DriveResourceMetadata::GetEntryInfoByPath( } void DriveResourceMetadata::ReadDirectoryByPath( - const FilePath& path, + const base::FilePath& path, const ReadDirectoryCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!callback.is_null()); @@ -493,8 +493,8 @@ void DriveResourceMetadata::ReadDirectoryByPath( } void DriveResourceMetadata::GetEntryInfoPairByPaths( - const FilePath& first_path, - const FilePath& second_path, + const base::FilePath& first_path, + const base::FilePath& second_path, const GetEntryInfoPairCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!callback.is_null()); @@ -534,7 +534,7 @@ void DriveResourceMetadata::RefreshEntry( FROM_HERE, base::Bind(callback, DRIVE_FILE_ERROR_NOT_FOUND, - FilePath(), + base::FilePath(), base::Passed(&result_entry_proto))); return; } @@ -651,7 +651,7 @@ void DriveResourceMetadata::GetChildDirectories( DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!changed_dirs_callback.is_null()); - std::set<FilePath> changed_directories; + std::set<base::FilePath> changed_directories; DriveEntry* entry = GetEntryByResourceId(resource_id); if (entry && entry->AsDriveDirectory()) entry->AsDriveDirectory()->GetChildDirectoryPaths(&changed_directories); @@ -667,7 +667,7 @@ void DriveResourceMetadata::RemoveAll(const base::Closure& callback) { } void DriveResourceMetadata::InitFromDB( - const FilePath& db_path, + const base::FilePath& db_path, base::SequencedTaskRunner* blocking_task_runner, const FileOperationCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); @@ -896,8 +896,8 @@ scoped_ptr<DriveEntry> DriveResourceMetadata::CreateDriveEntryFromProtoString( } void DriveResourceMetadata::GetEntryInfoPairByPathsAfterGetFirst( - const FilePath& first_path, - const FilePath& second_path, + const base::FilePath& first_path, + const base::FilePath& second_path, const GetEntryInfoPairCallback& callback, DriveFileError error, scoped_ptr<DriveEntryProto> entry_proto) { @@ -926,7 +926,7 @@ void DriveResourceMetadata::GetEntryInfoPairByPathsAfterGetFirst( } void DriveResourceMetadata::GetEntryInfoPairByPathsAfterGetSecond( - const FilePath& second_path, + const base::FilePath& second_path, const GetEntryInfoPairCallback& callback, scoped_ptr<EntryInfoPairResult> result, DriveFileError error, diff --git a/chrome/browser/chromeos/drive/drive_resource_metadata.h b/chrome/browser/chromeos/drive/drive_resource_metadata.h index 356ab72..9cd61fa 100644 --- a/chrome/browser/chromeos/drive/drive_resource_metadata.h +++ b/chrome/browser/chromeos/drive/drive_resource_metadata.h @@ -47,7 +47,8 @@ enum DriveFileType { // The root directory name used for the Google Drive file system tree. The // name is used in URLs for the file manager, hence user-visible. -const FilePath::CharType kDriveRootDirectory[] = FILE_PATH_LITERAL("drive"); +const base::FilePath::CharType kDriveRootDirectory[] = + FILE_PATH_LITERAL("drive"); // This should be incremented when incompatibility change is made in // drive.proto. @@ -56,7 +57,7 @@ const int32 kProtoVersion = 2; // Callback similar to FileOperationCallback but with a given |file_path|. // Used for operations that change a file path like moving files. typedef base::Callback<void(DriveFileError error, - const FilePath& file_path)> + const base::FilePath& file_path)> FileMoveCallback; // Used to get entry info from the file system. @@ -76,12 +77,12 @@ typedef base::Callback<void(DriveFileError error, // the Drive file path (i.e. only contains the base name without parent // directory names). typedef base::Callback<void(DriveFileError error, - const FilePath& drive_file_path, + const base::FilePath& drive_file_path, scoped_ptr<DriveEntryProto> entry_proto)> GetEntryInfoWithFilePathCallback; // Used to get a set of changed directories for feed processing. -typedef base::Callback<void(const std::set<FilePath>&)> +typedef base::Callback<void(const std::set<base::FilePath>&)> GetChildDirectoriesCallback; typedef base::Callback<void(int64)> GetChangestampCallback; @@ -91,7 +92,7 @@ struct EntryInfoResult { EntryInfoResult(); ~EntryInfoResult(); - FilePath path; + base::FilePath path; DriveFileError error; scoped_ptr<DriveEntryProto> proto; }; @@ -124,7 +125,7 @@ class DriveResourceMetadataInterface { // Adds |entry| to directory with path |directory_path| and invoke the // callback asynchronously. |callback| must not be null. - virtual void AddEntryToDirectory(const FilePath& directory_path, + virtual void AddEntryToDirectory(const base::FilePath& directory_path, scoped_ptr<google_apis::ResourceEntry> entry, const FileMoveCallback& callback) = 0; @@ -136,14 +137,14 @@ class DriveResourceMetadataInterface { // Moves entry specified by |file_path| to the directory specified by // |directory_path| and calls the callback asynchronously. Removes the entry // from the previous parent. |callback| must not be null. - virtual void MoveEntryToDirectory(const FilePath& file_path, - const FilePath& directory_path, + virtual void MoveEntryToDirectory(const base::FilePath& file_path, + const base::FilePath& directory_path, const FileMoveCallback& callback) = 0; // Renames entry specified by |file_path| with the new name |new_name| and // calls |callback| asynchronously. |callback| must not be null. - virtual void RenameEntry(const FilePath& file_path, - const FilePath::StringType& new_name, + virtual void RenameEntry(const base::FilePath& file_path, + const base::FilePath::StringType& new_name, const FileMoveCallback& callback) = 0; // Removes entry with |resource_id| from its parent. Calls |callback| with the @@ -159,12 +160,12 @@ class DriveResourceMetadataInterface { // Finds an entry (a file or a directory) by |file_path|. // |callback| must not be null. - virtual void GetEntryInfoByPath(const FilePath& file_path, + virtual void GetEntryInfoByPath(const base::FilePath& file_path, const GetEntryInfoCallback& callback) = 0; // Finds and reads a directory by |file_path|. // |callback| must not be null. - virtual void ReadDirectoryByPath(const FilePath& file_path, + virtual void ReadDirectoryByPath(const base::FilePath& file_path, const ReadDirectoryCallback& callback) = 0; // Similar to GetEntryInfoByPath() but this function finds a pair of @@ -172,8 +173,8 @@ class DriveResourceMetadataInterface { // |first_path| is not found, this function does not try to get the // entry of |second_path|. |callback| must not be null. virtual void GetEntryInfoPairByPaths( - const FilePath& first_path, - const FilePath& second_path, + const base::FilePath& first_path, + const base::FilePath& second_path, const GetEntryInfoPairCallback& callback) = 0; // Refreshes a drive entry with the same resource id as |entry_proto|. @@ -232,16 +233,16 @@ class DriveResourceMetadata : public DriveResourceMetadataInterface { int64 value, const FileOperationCallback& callback) OVERRIDE; virtual void AddEntryToDirectory( - const FilePath& directory_path, + const base::FilePath& directory_path, scoped_ptr<google_apis::ResourceEntry> entry, const FileMoveCallback& callback) OVERRIDE; virtual void AddEntryToParent(const DriveEntryProto& entry_proto, const FileMoveCallback& callback) OVERRIDE; - virtual void MoveEntryToDirectory(const FilePath& file_path, - const FilePath& directory_path, + virtual void MoveEntryToDirectory(const base::FilePath& file_path, + const base::FilePath& directory_path, const FileMoveCallback& callback) OVERRIDE; - virtual void RenameEntry(const FilePath& file_path, - const FilePath::StringType& new_name, + virtual void RenameEntry(const base::FilePath& file_path, + const base::FilePath::StringType& new_name, const FileMoveCallback& callback) OVERRIDE; virtual void RemoveEntryFromParent(const std::string& resource_id, const FileMoveCallback& callback) OVERRIDE; @@ -249,14 +250,14 @@ class DriveResourceMetadata : public DriveResourceMetadataInterface { const std::string& resource_id, const GetEntryInfoWithFilePathCallback& callback) OVERRIDE; virtual void GetEntryInfoByPath( - const FilePath& file_path, + const base::FilePath& file_path, const GetEntryInfoCallback& callback) OVERRIDE; virtual void ReadDirectoryByPath( - const FilePath& file_path, + const base::FilePath& file_path, const ReadDirectoryCallback& callback) OVERRIDE; virtual void GetEntryInfoPairByPaths( - const FilePath& first_path, - const FilePath& second_path, + const base::FilePath& first_path, + const base::FilePath& second_path, const GetEntryInfoPairCallback& callback) OVERRIDE; virtual void RefreshEntry( const DriveEntryProto& entry_proto, @@ -275,7 +276,7 @@ class DriveResourceMetadata : public DriveResourceMetadataInterface { // Restores from and saves to database, calling |callback| asynchronously. // |callback| must not be null. - void InitFromDB(const FilePath& db_path, + void InitFromDB(const base::FilePath& db_path, base::SequencedTaskRunner* blocking_task_runner, const FileOperationCallback& callback); void SaveToDB(); @@ -321,8 +322,8 @@ class DriveResourceMetadata : public DriveResourceMetadataInterface { // asynchronously fetched. This fetches the second DriveEntry only if the // first was found. void GetEntryInfoPairByPathsAfterGetFirst( - const FilePath& first_path, - const FilePath& second_path, + const base::FilePath& first_path, + const base::FilePath& second_path, const GetEntryInfoPairCallback& callback, DriveFileError error, scoped_ptr<DriveEntryProto> entry_proto); @@ -330,14 +331,14 @@ class DriveResourceMetadata : public DriveResourceMetadataInterface { // Continues with GetIntroInfoPairByPaths after the second DriveEntry has been // asynchronously fetched. void GetEntryInfoPairByPathsAfterGetSecond( - const FilePath& second_path, + const base::FilePath& second_path, const GetEntryInfoPairCallback& callback, scoped_ptr<EntryInfoPairResult> result, DriveFileError error, scoped_ptr<DriveEntryProto> entry_proto); // Searches for |file_path| synchronously. - DriveEntry* FindEntryByPathSync(const FilePath& file_path); + DriveEntry* FindEntryByPathSync(const base::FilePath& file_path); // Helper function to add |entry_proto| as a child to |directory|. // |callback| must not be null. diff --git a/chrome/browser/chromeos/drive/drive_resource_metadata_unittest.cc b/chrome/browser/chromeos/drive/drive_resource_metadata_unittest.cc index 76080a0..43c06af 100644 --- a/chrome/browser/chromeos/drive/drive_resource_metadata_unittest.cc +++ b/chrome/browser/chromeos/drive/drive_resource_metadata_unittest.cc @@ -38,8 +38,8 @@ void CopyResultsFromInitFromDBCallback(DriveFileError* expected_error, // Copies result from GetChildDirectoriesCallback. void CopyResultFromGetChildDirectoriesCallback( - std::set<FilePath>* out_child_directories, - const std::set<FilePath>& in_child_directories) { + std::set<base::FilePath>* out_child_directories, + const std::set<base::FilePath>& in_child_directories) { *out_child_directories = in_child_directories; } @@ -158,7 +158,7 @@ bool DriveResourceMetadataTest::AddDriveEntryProto( is_directory, parent_resource_id); DriveFileError error = DRIVE_FILE_ERROR_FAILED; - FilePath drive_file_path; + base::FilePath drive_file_path; resource_metadata->AddEntryToParent( entry_proto, @@ -228,7 +228,7 @@ TEST_F(DriveResourceMetadataTest, GetEntryByResourceId_RootDirectory) { DriveResourceMetadata resource_metadata(kTestRootResourceId); DriveFileError error = DRIVE_FILE_ERROR_FAILED; - FilePath drive_file_path; + base::FilePath drive_file_path; scoped_ptr<DriveEntryProto> entry_proto; // Look up the root directory by its resource ID. @@ -238,7 +238,7 @@ TEST_F(DriveResourceMetadataTest, GetEntryByResourceId_RootDirectory) { &error, &drive_file_path, &entry_proto)); google_apis::test_util::RunBlockingPoolTask(); EXPECT_EQ(DRIVE_FILE_OK, error); - EXPECT_EQ(FilePath::FromUTF8Unsafe("drive"), drive_file_path); + EXPECT_EQ(base::FilePath::FromUTF8Unsafe("drive"), drive_file_path); ASSERT_TRUE(entry_proto.get()); EXPECT_EQ("drive", entry_proto->base_name()); } @@ -246,7 +246,7 @@ TEST_F(DriveResourceMetadataTest, GetEntryByResourceId_RootDirectory) { TEST_F(DriveResourceMetadataTest, GetEntryInfoByResourceId) { // Confirm that an existing file is found. DriveFileError error = DRIVE_FILE_ERROR_FAILED; - FilePath drive_file_path; + base::FilePath drive_file_path; scoped_ptr<DriveEntryProto> entry_proto; resource_metadata_->GetEntryInfoByResourceId( "resource_id:file4", @@ -254,7 +254,8 @@ TEST_F(DriveResourceMetadataTest, GetEntryInfoByResourceId) { &error, &drive_file_path, &entry_proto)); google_apis::test_util::RunBlockingPoolTask(); EXPECT_EQ(DRIVE_FILE_OK, error); - EXPECT_EQ(FilePath::FromUTF8Unsafe("drive/dir1/file4"), drive_file_path); + EXPECT_EQ(base::FilePath::FromUTF8Unsafe("drive/dir1/file4"), + drive_file_path); ASSERT_TRUE(entry_proto.get()); EXPECT_EQ("file4", entry_proto->base_name()); @@ -275,7 +276,7 @@ TEST_F(DriveResourceMetadataTest, GetEntryInfoByPath) { DriveFileError error = DRIVE_FILE_ERROR_FAILED; scoped_ptr<DriveEntryProto> entry_proto; resource_metadata_->GetEntryInfoByPath( - FilePath::FromUTF8Unsafe("drive/dir1/file4"), + base::FilePath::FromUTF8Unsafe("drive/dir1/file4"), base::Bind(&test_util::CopyResultsFromGetEntryInfoCallback, &error, &entry_proto)); google_apis::test_util::RunBlockingPoolTask(); @@ -287,7 +288,7 @@ TEST_F(DriveResourceMetadataTest, GetEntryInfoByPath) { error = DRIVE_FILE_ERROR_FAILED; entry_proto.reset(); resource_metadata_->GetEntryInfoByPath( - FilePath::FromUTF8Unsafe("drive/dir1/non_existing"), + base::FilePath::FromUTF8Unsafe("drive/dir1/non_existing"), base::Bind(&test_util::CopyResultsFromGetEntryInfoCallback, &error, &entry_proto)); google_apis::test_util::RunBlockingPoolTask(); @@ -300,7 +301,7 @@ TEST_F(DriveResourceMetadataTest, ReadDirectoryByPath) { DriveFileError error = DRIVE_FILE_ERROR_FAILED; scoped_ptr<DriveEntryProtoVector> entries; resource_metadata_->ReadDirectoryByPath( - FilePath::FromUTF8Unsafe("drive/dir1"), + base::FilePath::FromUTF8Unsafe("drive/dir1"), base::Bind(&test_util::CopyResultsFromReadDirectoryCallback, &error, &entries)); google_apis::test_util::RunBlockingPoolTask(); @@ -322,7 +323,7 @@ TEST_F(DriveResourceMetadataTest, ReadDirectoryByPath) { error = DRIVE_FILE_ERROR_FAILED; entries.reset(); resource_metadata_->ReadDirectoryByPath( - FilePath::FromUTF8Unsafe("drive/non_existing"), + base::FilePath::FromUTF8Unsafe("drive/non_existing"), base::Bind(&test_util::CopyResultsFromReadDirectoryCallback, &error, &entries)); google_apis::test_util::RunBlockingPoolTask(); @@ -333,7 +334,7 @@ TEST_F(DriveResourceMetadataTest, ReadDirectoryByPath) { error = DRIVE_FILE_ERROR_FAILED; entries.reset(); resource_metadata_->ReadDirectoryByPath( - FilePath::FromUTF8Unsafe("drive/dir1/file4"), + base::FilePath::FromUTF8Unsafe("drive/dir1/file4"), base::Bind(&test_util::CopyResultsFromReadDirectoryCallback, &error, &entries)); google_apis::test_util::RunBlockingPoolTask(); @@ -345,20 +346,20 @@ TEST_F(DriveResourceMetadataTest, GetEntryInfoPairByPaths) { // Confirm that existing two files are found. scoped_ptr<EntryInfoPairResult> pair_result; resource_metadata_->GetEntryInfoPairByPaths( - FilePath::FromUTF8Unsafe("drive/dir1/file4"), - FilePath::FromUTF8Unsafe("drive/dir1/file5"), + base::FilePath::FromUTF8Unsafe("drive/dir1/file4"), + base::FilePath::FromUTF8Unsafe("drive/dir1/file5"), base::Bind(&test_util::CopyResultsFromGetEntryInfoPairCallback, &pair_result)); google_apis::test_util::RunBlockingPoolTask(); // The first entry should be found. EXPECT_EQ(DRIVE_FILE_OK, pair_result->first.error); - EXPECT_EQ(FilePath::FromUTF8Unsafe("drive/dir1/file4"), + EXPECT_EQ(base::FilePath::FromUTF8Unsafe("drive/dir1/file4"), pair_result->first.path); ASSERT_TRUE(pair_result->first.proto.get()); EXPECT_EQ("file4", pair_result->first.proto->base_name()); // The second entry should be found. EXPECT_EQ(DRIVE_FILE_OK, pair_result->second.error); - EXPECT_EQ(FilePath::FromUTF8Unsafe("drive/dir1/file5"), + EXPECT_EQ(base::FilePath::FromUTF8Unsafe("drive/dir1/file5"), pair_result->second.path); ASSERT_TRUE(pair_result->second.proto.get()); EXPECT_EQ("file5", pair_result->second.proto->base_name()); @@ -366,38 +367,38 @@ TEST_F(DriveResourceMetadataTest, GetEntryInfoPairByPaths) { // Confirm that the first non existent file is not found. pair_result.reset(); resource_metadata_->GetEntryInfoPairByPaths( - FilePath::FromUTF8Unsafe("drive/dir1/non_existent"), - FilePath::FromUTF8Unsafe("drive/dir1/file5"), + base::FilePath::FromUTF8Unsafe("drive/dir1/non_existent"), + base::FilePath::FromUTF8Unsafe("drive/dir1/file5"), base::Bind(&test_util::CopyResultsFromGetEntryInfoPairCallback, &pair_result)); google_apis::test_util::RunBlockingPoolTask(); // The first entry should not be found. EXPECT_EQ(DRIVE_FILE_ERROR_NOT_FOUND, pair_result->first.error); - EXPECT_EQ(FilePath::FromUTF8Unsafe("drive/dir1/non_existent"), + EXPECT_EQ(base::FilePath::FromUTF8Unsafe("drive/dir1/non_existent"), pair_result->first.path); ASSERT_FALSE(pair_result->first.proto.get()); // The second entry should not be found, because the first one failed. EXPECT_EQ(DRIVE_FILE_ERROR_FAILED, pair_result->second.error); - EXPECT_EQ(FilePath(), pair_result->second.path); + EXPECT_EQ(base::FilePath(), pair_result->second.path); ASSERT_FALSE(pair_result->second.proto.get()); // Confirm that the second non existent file is not found. pair_result.reset(); resource_metadata_->GetEntryInfoPairByPaths( - FilePath::FromUTF8Unsafe("drive/dir1/file4"), - FilePath::FromUTF8Unsafe("drive/dir1/non_existent"), + base::FilePath::FromUTF8Unsafe("drive/dir1/file4"), + base::FilePath::FromUTF8Unsafe("drive/dir1/non_existent"), base::Bind(&test_util::CopyResultsFromGetEntryInfoPairCallback, &pair_result)); google_apis::test_util::RunBlockingPoolTask(); // The first entry should be found. EXPECT_EQ(DRIVE_FILE_OK, pair_result->first.error); - EXPECT_EQ(FilePath::FromUTF8Unsafe("drive/dir1/file4"), + EXPECT_EQ(base::FilePath::FromUTF8Unsafe("drive/dir1/file4"), pair_result->first.path); ASSERT_TRUE(pair_result->first.proto.get()); EXPECT_EQ("file4", pair_result->first.proto->base_name()); // The second entry should not be found. EXPECT_EQ(DRIVE_FILE_ERROR_NOT_FOUND, pair_result->second.error); - EXPECT_EQ(FilePath::FromUTF8Unsafe("drive/dir1/non_existent"), + EXPECT_EQ(base::FilePath::FromUTF8Unsafe("drive/dir1/non_existent"), pair_result->second.path); ASSERT_FALSE(pair_result->second.proto.get()); } @@ -412,7 +413,7 @@ TEST_F(DriveResourceMetadataTest, DBTest) { DriveResourceMetadata resource_metadata(kTestRootResourceId); Init(&resource_metadata); - FilePath db_path(DriveCache::GetCacheRootPath(&profile). + base::FilePath db_path(DriveCache::GetCacheRootPath(&profile). AppendASCII("meta").AppendASCII("resource_metadata.db")); // InitFromDB should fail with DRIVE_FILE_ERROR_NOT_FOUND since the db // doesn't exist. @@ -452,7 +453,7 @@ TEST_F(DriveResourceMetadataTest, DBTest) { DriveFileError error = DRIVE_FILE_ERROR_FAILED; scoped_ptr<DriveEntryProtoVector> entries; test_resource_metadata.ReadDirectoryByPath( - FilePath::FromUTF8Unsafe("drive/dir2"), + base::FilePath::FromUTF8Unsafe("drive/dir2"), base::Bind(&test_util::CopyResultsFromReadDirectoryCallback, &error, &entries)); google_apis::test_util::RunBlockingPoolTask(); @@ -464,7 +465,7 @@ TEST_F(DriveResourceMetadataTest, DBTest) { TEST_F(DriveResourceMetadataTest, RemoveEntryFromParent) { // Make sure file9 is found. DriveFileError error = DRIVE_FILE_ERROR_FAILED; - FilePath drive_file_path; + base::FilePath drive_file_path; const std::string file9_resource_id = "resource_id:file9"; scoped_ptr<DriveEntryProto> entry_proto; resource_metadata_->GetEntryInfoByResourceId( @@ -473,7 +474,8 @@ TEST_F(DriveResourceMetadataTest, RemoveEntryFromParent) { &error, &drive_file_path, &entry_proto)); google_apis::test_util::RunBlockingPoolTask(); EXPECT_EQ(DRIVE_FILE_OK, error); - EXPECT_EQ(FilePath::FromUTF8Unsafe("drive/dir1/dir3/file9"), drive_file_path); + EXPECT_EQ(base::FilePath::FromUTF8Unsafe("drive/dir1/dir3/file9"), + drive_file_path); ASSERT_TRUE(entry_proto.get()); EXPECT_EQ("file9", entry_proto->base_name()); @@ -484,7 +486,7 @@ TEST_F(DriveResourceMetadataTest, RemoveEntryFromParent) { &error, &drive_file_path)); google_apis::test_util::RunBlockingPoolTask(); EXPECT_EQ(DRIVE_FILE_OK, error); - EXPECT_EQ(FilePath::FromUTF8Unsafe("drive/dir1/dir3"), drive_file_path); + EXPECT_EQ(base::FilePath::FromUTF8Unsafe("drive/dir1/dir3"), drive_file_path); // file9 should no longer exist. resource_metadata_->GetEntryInfoByResourceId( @@ -503,7 +505,7 @@ TEST_F(DriveResourceMetadataTest, RemoveEntryFromParent) { &error, &drive_file_path, &entry_proto)); google_apis::test_util::RunBlockingPoolTask(); EXPECT_EQ(DRIVE_FILE_OK, error); - EXPECT_EQ(FilePath::FromUTF8Unsafe("drive/dir1/dir3"), drive_file_path); + EXPECT_EQ(base::FilePath::FromUTF8Unsafe("drive/dir1/dir3"), drive_file_path); ASSERT_TRUE(entry_proto.get()); EXPECT_EQ("dir3", entry_proto->base_name()); @@ -514,7 +516,7 @@ TEST_F(DriveResourceMetadataTest, RemoveEntryFromParent) { &error, &drive_file_path)); google_apis::test_util::RunBlockingPoolTask(); EXPECT_EQ(DRIVE_FILE_OK, error); - EXPECT_EQ(FilePath::FromUTF8Unsafe("drive/dir1"), drive_file_path); + EXPECT_EQ(base::FilePath::FromUTF8Unsafe("drive/dir1"), drive_file_path); // dir3 should no longer exist. resource_metadata_->GetEntryInfoByResourceId( @@ -544,18 +546,19 @@ TEST_F(DriveResourceMetadataTest, RemoveEntryFromParent) { TEST_F(DriveResourceMetadataTest, MoveEntryToDirectory) { DriveFileError error = DRIVE_FILE_ERROR_FAILED; - FilePath drive_file_path; + base::FilePath drive_file_path; scoped_ptr<DriveEntryProto> entry_proto; // Move file8 to drive/dir1. resource_metadata_->MoveEntryToDirectory( - FilePath::FromUTF8Unsafe("drive/dir2/file8"), - FilePath::FromUTF8Unsafe("drive/dir1"), + base::FilePath::FromUTF8Unsafe("drive/dir2/file8"), + base::FilePath::FromUTF8Unsafe("drive/dir1"), base::Bind(&test_util::CopyResultsFromFileMoveCallback, &error, &drive_file_path)); google_apis::test_util::RunBlockingPoolTask(); EXPECT_EQ(DRIVE_FILE_OK, error); - EXPECT_EQ(FilePath::FromUTF8Unsafe("drive/dir1/file8"), drive_file_path); + EXPECT_EQ(base::FilePath::FromUTF8Unsafe("drive/dir1/file8"), + drive_file_path); // Look up the entry by its resource id and make sure it really moved. resource_metadata_->GetEntryInfoByResourceId( @@ -564,57 +567,59 @@ TEST_F(DriveResourceMetadataTest, MoveEntryToDirectory) { &error, &drive_file_path, &entry_proto)); google_apis::test_util::RunBlockingPoolTask(); EXPECT_EQ(DRIVE_FILE_OK, error); - EXPECT_EQ(FilePath::FromUTF8Unsafe("drive/dir1/file8"), drive_file_path); + EXPECT_EQ(base::FilePath::FromUTF8Unsafe("drive/dir1/file8"), + drive_file_path); // Move non-existent file to drive/dir1. This should fail. resource_metadata_->MoveEntryToDirectory( - FilePath::FromUTF8Unsafe("drive/dir2/file8"), - FilePath::FromUTF8Unsafe("drive/dir1"), + base::FilePath::FromUTF8Unsafe("drive/dir2/file8"), + base::FilePath::FromUTF8Unsafe("drive/dir1"), base::Bind(&test_util::CopyResultsFromFileMoveCallback, &error, &drive_file_path)); google_apis::test_util::RunBlockingPoolTask(); EXPECT_EQ(DRIVE_FILE_ERROR_NOT_FOUND, error); - EXPECT_EQ(FilePath(), drive_file_path); + EXPECT_EQ(base::FilePath(), drive_file_path); // Move existing file to non-existent directory. This should fail. resource_metadata_->MoveEntryToDirectory( - FilePath::FromUTF8Unsafe("drive/dir1/file8"), - FilePath::FromUTF8Unsafe("drive/dir4"), + base::FilePath::FromUTF8Unsafe("drive/dir1/file8"), + base::FilePath::FromUTF8Unsafe("drive/dir4"), base::Bind(&test_util::CopyResultsFromFileMoveCallback, &error, &drive_file_path)); google_apis::test_util::RunBlockingPoolTask(); EXPECT_EQ(DRIVE_FILE_ERROR_NOT_FOUND, error); - EXPECT_EQ(FilePath(), drive_file_path); + EXPECT_EQ(base::FilePath(), drive_file_path); // Move existing file to existing file (non-directory). This should fail. resource_metadata_->MoveEntryToDirectory( - FilePath::FromUTF8Unsafe("drive/dir1/file8"), - FilePath::FromUTF8Unsafe("drive/dir1/file4"), + base::FilePath::FromUTF8Unsafe("drive/dir1/file8"), + base::FilePath::FromUTF8Unsafe("drive/dir1/file4"), base::Bind(&test_util::CopyResultsFromFileMoveCallback, &error, &drive_file_path)); google_apis::test_util::RunBlockingPoolTask(); EXPECT_EQ(DRIVE_FILE_ERROR_NOT_A_DIRECTORY, error); - EXPECT_EQ(FilePath(), drive_file_path); + EXPECT_EQ(base::FilePath(), drive_file_path); // Move the file to root. resource_metadata_->MoveEntryToDirectory( - FilePath::FromUTF8Unsafe("drive/dir1/file8"), - FilePath::FromUTF8Unsafe("drive"), + base::FilePath::FromUTF8Unsafe("drive/dir1/file8"), + base::FilePath::FromUTF8Unsafe("drive"), base::Bind(&test_util::CopyResultsFromFileMoveCallback, &error, &drive_file_path)); google_apis::test_util::RunBlockingPoolTask(); EXPECT_EQ(DRIVE_FILE_OK, error); - EXPECT_EQ(FilePath::FromUTF8Unsafe("drive/file8"), drive_file_path); + EXPECT_EQ(base::FilePath::FromUTF8Unsafe("drive/file8"), drive_file_path); // Move the file from root. resource_metadata_->MoveEntryToDirectory( - FilePath::FromUTF8Unsafe("drive/file8"), - FilePath::FromUTF8Unsafe("drive/dir2"), + base::FilePath::FromUTF8Unsafe("drive/file8"), + base::FilePath::FromUTF8Unsafe("drive/dir2"), base::Bind(&test_util::CopyResultsFromFileMoveCallback, &error, &drive_file_path)); google_apis::test_util::RunBlockingPoolTask(); EXPECT_EQ(DRIVE_FILE_OK, error); - EXPECT_EQ(FilePath::FromUTF8Unsafe("drive/dir2/file8"), drive_file_path); + EXPECT_EQ(base::FilePath::FromUTF8Unsafe("drive/dir2/file8"), + drive_file_path); // Make sure file is still ok. resource_metadata_->GetEntryInfoByResourceId( @@ -623,23 +628,25 @@ TEST_F(DriveResourceMetadataTest, MoveEntryToDirectory) { &error, &drive_file_path, &entry_proto)); google_apis::test_util::RunBlockingPoolTask(); EXPECT_EQ(DRIVE_FILE_OK, error); - EXPECT_EQ(FilePath::FromUTF8Unsafe("drive/dir2/file8"), drive_file_path); + EXPECT_EQ(base::FilePath::FromUTF8Unsafe("drive/dir2/file8"), + drive_file_path); } TEST_F(DriveResourceMetadataTest, RenameEntry) { DriveFileError error = DRIVE_FILE_ERROR_FAILED; - FilePath drive_file_path; + base::FilePath drive_file_path; scoped_ptr<DriveEntryProto> entry_proto; // Rename file8 to file11. resource_metadata_->RenameEntry( - FilePath::FromUTF8Unsafe("drive/dir2/file8"), + base::FilePath::FromUTF8Unsafe("drive/dir2/file8"), "file11", base::Bind(&test_util::CopyResultsFromFileMoveCallback, &error, &drive_file_path)); google_apis::test_util::RunBlockingPoolTask(); EXPECT_EQ(DRIVE_FILE_OK, error); - EXPECT_EQ(FilePath::FromUTF8Unsafe("drive/dir2/file11"), drive_file_path); + EXPECT_EQ(base::FilePath::FromUTF8Unsafe("drive/dir2/file11"), + drive_file_path); // Lookup the file by resource id to make sure the file actually got renamed. resource_metadata_->GetEntryInfoByResourceId( @@ -648,47 +655,49 @@ TEST_F(DriveResourceMetadataTest, RenameEntry) { &error, &drive_file_path, &entry_proto)); google_apis::test_util::RunBlockingPoolTask(); EXPECT_EQ(DRIVE_FILE_OK, error); - EXPECT_EQ(FilePath::FromUTF8Unsafe("drive/dir2/file11"), drive_file_path); + EXPECT_EQ(base::FilePath::FromUTF8Unsafe("drive/dir2/file11"), + drive_file_path); // Rename to file7 to force a duplicate name. resource_metadata_->RenameEntry( - FilePath::FromUTF8Unsafe("drive/dir2/file11"), + base::FilePath::FromUTF8Unsafe("drive/dir2/file11"), "file7", base::Bind(&test_util::CopyResultsFromFileMoveCallback, &error, &drive_file_path)); google_apis::test_util::RunBlockingPoolTask(); EXPECT_EQ(DRIVE_FILE_OK, error); - EXPECT_EQ(FilePath::FromUTF8Unsafe("drive/dir2/file7 (2)"), drive_file_path); + EXPECT_EQ(base::FilePath::FromUTF8Unsafe("drive/dir2/file7 (2)"), + drive_file_path); // Rename to same name. This should fail. resource_metadata_->RenameEntry( - FilePath::FromUTF8Unsafe("drive/dir2/file7 (2)"), + base::FilePath::FromUTF8Unsafe("drive/dir2/file7 (2)"), "file7 (2)", base::Bind(&test_util::CopyResultsFromFileMoveCallback, &error, &drive_file_path)); google_apis::test_util::RunBlockingPoolTask(); EXPECT_EQ(DRIVE_FILE_ERROR_EXISTS, error); - EXPECT_EQ(FilePath(), drive_file_path); + EXPECT_EQ(base::FilePath(), drive_file_path); // Rename non-existent. resource_metadata_->RenameEntry( - FilePath::FromUTF8Unsafe("drive/dir2/file11"), + base::FilePath::FromUTF8Unsafe("drive/dir2/file11"), "file11", base::Bind(&test_util::CopyResultsFromFileMoveCallback, &error, &drive_file_path)); google_apis::test_util::RunBlockingPoolTask(); EXPECT_EQ(DRIVE_FILE_ERROR_NOT_FOUND, error); - EXPECT_EQ(FilePath(), drive_file_path); + EXPECT_EQ(base::FilePath(), drive_file_path); } TEST_F(DriveResourceMetadataTest, RefreshEntry) { DriveFileError error = DRIVE_FILE_ERROR_FAILED; - FilePath drive_file_path; + base::FilePath drive_file_path; scoped_ptr<DriveEntryProto> entry_proto; // Get file9. resource_metadata_->GetEntryInfoByPath( - FilePath::FromUTF8Unsafe("drive/dir1/dir3/file9"), + base::FilePath::FromUTF8Unsafe("drive/dir1/dir3/file9"), base::Bind(&test_util::CopyResultsFromGetEntryInfoCallback, &error, &entry_proto)); google_apis::test_util::RunBlockingPoolTask(); @@ -710,7 +719,7 @@ TEST_F(DriveResourceMetadataTest, RefreshEntry) { &error, &drive_file_path, &entry_proto)); google_apis::test_util::RunBlockingPoolTask(); EXPECT_EQ(DRIVE_FILE_OK, error); - EXPECT_EQ(FilePath::FromUTF8Unsafe("drive/dir1/dir3/file100"), + EXPECT_EQ(base::FilePath::FromUTF8Unsafe("drive/dir1/dir3/file100"), drive_file_path); ASSERT_TRUE(entry_proto.get()); EXPECT_EQ("file100", entry_proto->base_name()); @@ -720,7 +729,7 @@ TEST_F(DriveResourceMetadataTest, RefreshEntry) { // Make sure we get the same thing from GetEntryInfoByPath. entry_proto.reset(); resource_metadata_->GetEntryInfoByPath( - FilePath::FromUTF8Unsafe("drive/dir1/dir3/file100"), + base::FilePath::FromUTF8Unsafe("drive/dir1/dir3/file100"), base::Bind(&test_util::CopyResultsFromGetEntryInfoCallback, &error, &entry_proto)); google_apis::test_util::RunBlockingPoolTask(); @@ -733,7 +742,7 @@ TEST_F(DriveResourceMetadataTest, RefreshEntry) { // Get dir2. entry_proto.reset(); resource_metadata_->GetEntryInfoByPath( - FilePath::FromUTF8Unsafe("drive/dir2"), + base::FilePath::FromUTF8Unsafe("drive/dir2"), base::Bind(&test_util::CopyResultsFromGetEntryInfoCallback, &error, &entry_proto)); google_apis::test_util::RunBlockingPoolTask(); @@ -753,7 +762,7 @@ TEST_F(DriveResourceMetadataTest, RefreshEntry) { &error, &drive_file_path, &entry_proto)); google_apis::test_util::RunBlockingPoolTask(); EXPECT_EQ(DRIVE_FILE_OK, error); - EXPECT_EQ(FilePath::FromUTF8Unsafe("drive/dir1/dir3/dir100"), + EXPECT_EQ(base::FilePath::FromUTF8Unsafe("drive/dir1/dir3/dir100"), drive_file_path); ASSERT_TRUE(entry_proto.get()); EXPECT_EQ("dir100", entry_proto->base_name()); @@ -763,7 +772,7 @@ TEST_F(DriveResourceMetadataTest, RefreshEntry) { // Make sure the children have moved over. Test file6. entry_proto.reset(); resource_metadata_->GetEntryInfoByPath( - FilePath::FromUTF8Unsafe("drive/dir1/dir3/dir100/file6"), + base::FilePath::FromUTF8Unsafe("drive/dir1/dir3/dir100/file6"), base::Bind(&test_util::CopyResultsFromGetEntryInfoCallback, &error, &entry_proto)); google_apis::test_util::RunBlockingPoolTask(); @@ -773,7 +782,7 @@ TEST_F(DriveResourceMetadataTest, RefreshEntry) { // Make sure dir2 no longer exists. resource_metadata_->GetEntryInfoByPath( - FilePath::FromUTF8Unsafe("drive/dir2"), + base::FilePath::FromUTF8Unsafe("drive/dir2"), base::Bind(&test_util::CopyResultsFromGetEntryInfoCallback, &error, &entry_proto)); google_apis::test_util::RunBlockingPoolTask(); @@ -784,12 +793,12 @@ TEST_F(DriveResourceMetadataTest, RefreshEntry) { // Test the special logic for RefreshEntry of root. TEST_F(DriveResourceMetadataTest, RefreshEntry_Root) { DriveFileError error = DRIVE_FILE_ERROR_FAILED; - FilePath drive_file_path; + base::FilePath drive_file_path; scoped_ptr<DriveEntryProto> entry_proto; // Get root. resource_metadata_->GetEntryInfoByPath( - FilePath::FromUTF8Unsafe("drive"), + base::FilePath::FromUTF8Unsafe("drive"), base::Bind(&test_util::CopyResultsFromGetEntryInfoCallback, &error, &entry_proto)); google_apis::test_util::RunBlockingPoolTask(); @@ -810,7 +819,7 @@ TEST_F(DriveResourceMetadataTest, RefreshEntry_Root) { &error, &drive_file_path, &entry_proto)); google_apis::test_util::RunBlockingPoolTask(); EXPECT_EQ(DRIVE_FILE_OK, error); - EXPECT_EQ(FilePath::FromUTF8Unsafe("drive"), drive_file_path); + EXPECT_EQ(base::FilePath::FromUTF8Unsafe("drive"), drive_file_path); ASSERT_TRUE(entry_proto.get()); EXPECT_EQ("drive", entry_proto->base_name()); EXPECT_TRUE(entry_proto->file_info().is_directory()); @@ -820,7 +829,7 @@ TEST_F(DriveResourceMetadataTest, RefreshEntry_Root) { // Make sure the children have moved over. Test file9. entry_proto.reset(); resource_metadata_->GetEntryInfoByPath( - FilePath::FromUTF8Unsafe("drive/dir1/dir3/file9"), + base::FilePath::FromUTF8Unsafe("drive/dir1/dir3/file9"), base::Bind(&test_util::CopyResultsFromGetEntryInfoCallback, &error, &entry_proto)); google_apis::test_util::RunBlockingPoolTask(); @@ -835,7 +844,7 @@ TEST_F(DriveResourceMetadataTest, AddEntryToParent) { sequence_id++, false, "resource_id:dir3"); DriveFileError error = DRIVE_FILE_ERROR_FAILED; - FilePath drive_file_path; + base::FilePath drive_file_path; // Add to dir3. resource_metadata_->AddEntryToParent( @@ -844,7 +853,7 @@ TEST_F(DriveResourceMetadataTest, AddEntryToParent) { &error, &drive_file_path)); google_apis::test_util::RunBlockingPoolTask(); EXPECT_EQ(DRIVE_FILE_OK, error); - EXPECT_EQ(FilePath::FromUTF8Unsafe("drive/dir1/dir3/file100"), + EXPECT_EQ(base::FilePath::FromUTF8Unsafe("drive/dir1/dir3/file100"), drive_file_path); // Adds to root when parent resource id is not specified. @@ -857,7 +866,7 @@ TEST_F(DriveResourceMetadataTest, AddEntryToParent) { &error, &drive_file_path)); google_apis::test_util::RunBlockingPoolTask(); EXPECT_EQ(DRIVE_FILE_OK, error); - EXPECT_EQ(FilePath::FromUTF8Unsafe("drive/file101"), drive_file_path); + EXPECT_EQ(base::FilePath::FromUTF8Unsafe("drive/file101"), drive_file_path); // Add a directory. DriveEntryProto dir_entry_proto = CreateDriveEntryProto( @@ -869,7 +878,8 @@ TEST_F(DriveResourceMetadataTest, AddEntryToParent) { &error, &drive_file_path)); google_apis::test_util::RunBlockingPoolTask(); EXPECT_EQ(DRIVE_FILE_OK, error); - EXPECT_EQ(FilePath::FromUTF8Unsafe("drive/dir1/dir102"), drive_file_path); + EXPECT_EQ(base::FilePath::FromUTF8Unsafe("drive/dir1/dir102"), + drive_file_path); // Add to an invalid parent. DriveEntryProto file_entry_proto3 = CreateDriveEntryProto( @@ -884,7 +894,7 @@ TEST_F(DriveResourceMetadataTest, AddEntryToParent) { } TEST_F(DriveResourceMetadataTest, GetChildDirectories) { - std::set<FilePath> child_directories; + std::set<base::FilePath> child_directories; // file9: not a directory, so no children. resource_metadata_->GetChildDirectories("resource_id:file9", @@ -907,7 +917,7 @@ TEST_F(DriveResourceMetadataTest, GetChildDirectories) { google_apis::test_util::RunBlockingPoolTask(); EXPECT_EQ(1u, child_directories.size()); EXPECT_EQ(1u, child_directories.count( - FilePath::FromUTF8Unsafe("drive/dir1/dir3"))); + base::FilePath::FromUTF8Unsafe("drive/dir1/dir3"))); // Add a few more directories to make sure deeper nesting works. // dir2/dir100 @@ -941,11 +951,11 @@ TEST_F(DriveResourceMetadataTest, GetChildDirectories) { &child_directories)); google_apis::test_util::RunBlockingPoolTask(); EXPECT_EQ(8u, child_directories.size()); - EXPECT_EQ(1u, child_directories.count(FilePath::FromUTF8Unsafe( + EXPECT_EQ(1u, child_directories.count(base::FilePath::FromUTF8Unsafe( "drive/dir2/dir101"))); - EXPECT_EQ(1u, child_directories.count(FilePath::FromUTF8Unsafe( + EXPECT_EQ(1u, child_directories.count(base::FilePath::FromUTF8Unsafe( "drive/dir2/dir101/dir104"))); - EXPECT_EQ(1u, child_directories.count(FilePath::FromUTF8Unsafe( + EXPECT_EQ(1u, child_directories.count(base::FilePath::FromUTF8Unsafe( "drive/dir2/dir101/dir102/dir105/dir106/dir107"))); } @@ -955,7 +965,7 @@ TEST_F(DriveResourceMetadataTest, RemoveAll) { // root has children. resource_metadata_->ReadDirectoryByPath( - FilePath::FromUTF8Unsafe("drive"), + base::FilePath::FromUTF8Unsafe("drive"), base::Bind(&test_util::CopyResultsFromReadDirectoryCallback, &error, &entries)); google_apis::test_util::RunBlockingPoolTask(); @@ -967,12 +977,12 @@ TEST_F(DriveResourceMetadataTest, RemoveAll) { resource_metadata_->RemoveAll(base::Bind(&base::DoNothing)); google_apis::test_util::RunBlockingPoolTask(); - FilePath drive_file_path; + base::FilePath drive_file_path; scoped_ptr<DriveEntryProto> entry_proto; // root should continue to exist. resource_metadata_->GetEntryInfoByPath( - FilePath::FromUTF8Unsafe("drive"), + base::FilePath::FromUTF8Unsafe("drive"), base::Bind(&test_util::CopyResultsFromGetEntryInfoCallback, &error, &entry_proto)); google_apis::test_util::RunBlockingPoolTask(); @@ -984,7 +994,7 @@ TEST_F(DriveResourceMetadataTest, RemoveAll) { // root should have no children. resource_metadata_->ReadDirectoryByPath( - FilePath::FromUTF8Unsafe("drive"), + base::FilePath::FromUTF8Unsafe("drive"), base::Bind(&test_util::CopyResultsFromReadDirectoryCallback, &error, &entries)); google_apis::test_util::RunBlockingPoolTask(); diff --git a/chrome/browser/chromeos/drive/drive_scheduler.cc b/chrome/browser/chromeos/drive/drive_scheduler.cc index ea62f51..905d441 100644 --- a/chrome/browser/chromeos/drive/drive_scheduler.cc +++ b/chrome/browser/chromeos/drive/drive_scheduler.cc @@ -242,8 +242,8 @@ void DriveScheduler::AddNewDirectory( } void DriveScheduler::DownloadFile( - const FilePath& virtual_path, - const FilePath& local_cache_path, + const base::FilePath& virtual_path, + const base::FilePath& local_cache_path, const GURL& download_url, const google_apis::DownloadActionCallback& download_action_callback, const google_apis::GetContentCallback& get_content_callback) { @@ -263,8 +263,8 @@ void DriveScheduler::DownloadFile( void DriveScheduler::UploadExistingFile( const GURL& upload_location, - const FilePath& drive_file_path, - const FilePath& local_file_path, + const base::FilePath& drive_file_path, + const base::FilePath& local_file_path, const std::string& content_type, const std::string& etag, const google_apis::UploadCompletionCallback& upload_completion_callback) { @@ -636,7 +636,7 @@ void DriveScheduler::OnEntryActionJobDone(int job_id, void DriveScheduler::OnDownloadActionJobDone(int job_id, google_apis::GDataErrorCode error, - const FilePath& temp_file) { + const base::FilePath& temp_file) { DriveFileError drive_error(util::GDataToDriveFileError(error)); scoped_ptr<QueueEntry> job_info = OnJobDone(job_id, drive_error); @@ -652,8 +652,8 @@ void DriveScheduler::OnDownloadActionJobDone(int job_id, void DriveScheduler::OnUploadCompletionJobDone( int job_id, google_apis::DriveUploadError error, - const FilePath& drive_path, - const FilePath& file_path, + const base::FilePath& drive_path, + const base::FilePath& file_path, scoped_ptr<google_apis::ResourceEntry> resource_entry) { DriveFileError drive_error(DriveUploadErrorToDriveFileError(error)); diff --git a/chrome/browser/chromeos/drive/drive_scheduler.h b/chrome/browser/chromeos/drive/drive_scheduler.h index 23eddd2..7713e39 100644 --- a/chrome/browser/chromeos/drive/drive_scheduler.h +++ b/chrome/browser/chromeos/drive/drive_scheduler.h @@ -73,7 +73,7 @@ class DriveScheduler int total_bytes; // Drive path of the file that this job acts on. - FilePath file_path; + base::FilePath file_path; // Current state of the operation. JobState state; @@ -145,8 +145,8 @@ class DriveScheduler // Adds a DownloadFile operation to the queue. void DownloadFile( - const FilePath& virtual_path, - const FilePath& local_cache_path, + const base::FilePath& virtual_path, + const base::FilePath& local_cache_path, const GURL& download_url, const google_apis::DownloadActionCallback& download_action_callback, const google_apis::GetContentCallback& get_content_callback); @@ -154,8 +154,8 @@ class DriveScheduler // Adds an UploadExistingFile operation to the queue. void UploadExistingFile( const GURL& upload_location, - const FilePath& drive_file_path, - const FilePath& local_file_path, + const base::FilePath& drive_file_path, + const base::FilePath& local_file_path, const std::string& content_type, const std::string& etag, const google_apis::UploadCompletionCallback& upload_completion_callback); @@ -186,8 +186,8 @@ class DriveScheduler // Online and cache path of the operation's target. // Used by: // TYPE_DOWNLOAD_FILE - FilePath virtual_path; - FilePath local_cache_path; + base::FilePath virtual_path; + base::FilePath local_cache_path; // Parameters for GetResourceList(). // Used by: @@ -256,8 +256,8 @@ class DriveScheduler // Used by: // TYPE_UPLOAD_EXISTING_FILE GURL upload_location; - FilePath drive_file_path; - FilePath local_file_path; + base::FilePath drive_file_path; + base::FilePath local_file_path; std::string content_type; std::string etag; google_apis::UploadCompletionCallback upload_completion_callback; @@ -319,14 +319,14 @@ class DriveScheduler // Callback for job finishing with a DownloadActionCallback. void OnDownloadActionJobDone(int job_id, google_apis::GDataErrorCode error, - const FilePath& temp_file); + const base::FilePath& temp_file); // Callback for job finishing with a UploadCompletionCallback. void OnUploadCompletionJobDone( int job_id, google_apis::DriveUploadError error, - const FilePath& drive_path, - const FilePath& file_path, + const base::FilePath& drive_path, + const base::FilePath& file_path, scoped_ptr<google_apis::ResourceEntry> resource_entry); // net::NetworkChangeNotifier::ConnectionTypeObserver override. diff --git a/chrome/browser/chromeos/drive/drive_scheduler_unittest.cc b/chrome/browser/chromeos/drive/drive_scheduler_unittest.cc index 327d811..9b38173 100644 --- a/chrome/browser/chromeos/drive/drive_scheduler_unittest.cc +++ b/chrome/browser/chromeos/drive/drive_scheduler_unittest.cc @@ -44,8 +44,8 @@ class FakeDriveUploader : public google_apis::DriveUploaderInterface { // DriveUploaderInterface overrides. virtual void UploadNewFile( const GURL& upload_location, - const FilePath& drive_file_path, - const FilePath& local_file_path, + const base::FilePath& drive_file_path, + const base::FilePath& local_file_path, const std::string& title, const std::string& content_type, const google_apis::UploadCompletionCallback& callback) OVERRIDE { @@ -53,8 +53,8 @@ class FakeDriveUploader : public google_apis::DriveUploaderInterface { virtual void UploadExistingFile( const GURL& upload_location, - const FilePath& drive_file_path, - const FilePath& local_file_path, + const base::FilePath& drive_file_path, + const base::FilePath& local_file_path, const std::string& content_type, const std::string& etag, const google_apis::UploadCompletionCallback& callback) OVERRIDE { diff --git a/chrome/browser/chromeos/drive/drive_sync_client.cc b/chrome/browser/chromeos/drive/drive_sync_client.cc index 341ccb0..739ab7f 100644 --- a/chrome/browser/chromeos/drive/drive_sync_client.cc +++ b/chrome/browser/chromeos/drive/drive_sync_client.cc @@ -264,7 +264,7 @@ void DriveSyncClient::OnGetEntryInfoByResourceId( const std::string& resource_id, const DriveCacheEntry& cache_entry, DriveFileError error, - const FilePath& /* drive_file_path */, + const base::FilePath& /* drive_file_path */, scoped_ptr<DriveEntryProto> entry_proto) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); @@ -321,7 +321,7 @@ void DriveSyncClient::OnPinned(const std::string& resource_id, void DriveSyncClient::OnFetchFileComplete(const std::string& resource_id, DriveFileError error, - const FilePath& local_path, + const base::FilePath& local_path, const std::string& ununsed_mime_type, DriveFileType file_type) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); diff --git a/chrome/browser/chromeos/drive/drive_sync_client.h b/chrome/browser/chromeos/drive/drive_sync_client.h index e30b5ce..77dc8d3 100644 --- a/chrome/browser/chromeos/drive/drive_sync_client.h +++ b/chrome/browser/chromeos/drive/drive_sync_client.h @@ -127,7 +127,7 @@ class DriveSyncClient void OnGetEntryInfoByResourceId(const std::string& resource_id, const DriveCacheEntry& cache_entry, DriveFileError error, - const FilePath& file_path, + const base::FilePath& file_path, scoped_ptr<DriveEntryProto> entry_proto); // Called when a cache entry is obtained. @@ -146,7 +146,7 @@ class DriveSyncClient // Calls DoSyncLoop() to go back to the sync loop. void OnFetchFileComplete(const std::string& resource_id, DriveFileError error, - const FilePath& local_path, + const base::FilePath& local_path, const std::string& ununsed_mime_type, DriveFileType file_type); diff --git a/chrome/browser/chromeos/drive/drive_sync_client_unittest.cc b/chrome/browser/chromeos/drive/drive_sync_client_unittest.cc index 2b7aa26..a5a30af 100644 --- a/chrome/browser/chromeos/drive/drive_sync_client_unittest.cc +++ b/chrome/browser/chromeos/drive/drive_sync_client_unittest.cc @@ -53,7 +53,7 @@ ACTION_P(MockUpdateFileByResourceId, error) { ACTION_P2(MockUpdateFileByResourceId, error, md5) { scoped_ptr<DriveEntryProto> entry_proto(new DriveEntryProto); entry_proto->mutable_file_specific_info()->set_file_md5(md5); - arg1.Run(error, FilePath(), entry_proto.Pass()); + arg1.Run(error, base::FilePath(), entry_proto.Pass()); } class MockNetworkChangeNotifier : public net::NetworkChangeNotifier { @@ -140,7 +140,7 @@ class DriveSyncClientTest : public testing::Test { // Sets up cache for tests. void SetUpCache() { // Prepare a temp file. - FilePath temp_file; + base::FilePath temp_file; EXPECT_TRUE(file_util::CreateTemporaryFileInDir(temp_dir_.path(), &temp_file)); const std::string content = "hello"; @@ -170,7 +170,7 @@ class DriveSyncClientTest : public testing::Test { // Prepare a pinned-and-fetched file. const std::string resource_id_fetched = "resource_id_fetched"; const std::string md5_fetched = "md5"; - FilePath cache_file_path; + base::FilePath cache_file_path; cache_->Store(resource_id_fetched, md5_fetched, temp_file, DriveCache::FILE_OPERATION_COPY, base::Bind(&test_util::CopyErrorCodeFromFileOperationCallback, @@ -220,7 +220,7 @@ class DriveSyncClientTest : public testing::Test { &DriveSyncClientTest::VerifyStartNotified), MockGetFileByResourceId( DRIVE_FILE_OK, - FilePath::FromUTF8Unsafe("local_path_does_not_matter"), + base::FilePath::FromUTF8Unsafe("local_path_does_not_matter"), std::string("mime_type_does_not_matter"), REGULAR_FILE))); } diff --git a/chrome/browser/chromeos/drive/drive_system_service.cc b/chrome/browser/chromeos/drive/drive_system_service.cc index 65c449f..d7c85b2 100644 --- a/chrome/browser/chromeos/drive/drive_system_service.cc +++ b/chrome/browser/chromeos/drive/drive_system_service.cc @@ -106,7 +106,7 @@ void DriveSystemService::DriveCacheDeleter::operator()( DriveSystemService::DriveSystemService( Profile* profile, google_apis::DriveServiceInterface* test_drive_service, - const FilePath& test_cache_root, + const base::FilePath& test_cache_root, DriveFileSystemInterface* test_file_system) : profile_(profile), drive_disabled_(false), @@ -259,7 +259,7 @@ void DriveSystemService::AddDriveMountPoint() { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!file_system_proxy_.get()); - const FilePath drive_mount_point = util::GetDriveMountPointPath(); + const base::FilePath drive_mount_point = util::GetDriveMountPointPath(); fileapi::ExternalMountPoints* mount_points = BrowserContext::GetMountPoints(profile_); DCHECK(mount_points); @@ -414,7 +414,7 @@ ProfileKeyedService* DriveSystemServiceFactory::BuildServiceInstanceFor( Profile* profile) const { DriveSystemService* service = NULL; if (factory_for_test_.is_null()) - service = new DriveSystemService(profile, NULL, FilePath(), NULL); + service = new DriveSystemService(profile, NULL, base::FilePath(), NULL); else service = factory_for_test_.Run(profile); diff --git a/chrome/browser/chromeos/drive/drive_system_service_unittest.cc b/chrome/browser/chromeos/drive/drive_system_service_unittest.cc index 52b64e7..fbb9433 100644 --- a/chrome/browser/chromeos/drive/drive_system_service_unittest.cc +++ b/chrome/browser/chromeos/drive/drive_system_service_unittest.cc @@ -27,7 +27,7 @@ class DriveSystemServiceTest : public testing::Test { file_system_ = new MockDriveFileSystem; system_service_ = new DriveSystemService(profile_.get(), new google_apis::DummyDriveService, - FilePath(), + base::FilePath(), file_system_); } diff --git a/chrome/browser/chromeos/drive/drive_task_executor.cc b/chrome/browser/chromeos/drive/drive_task_executor.cc index 8ce2e94..4eeed0a 100644 --- a/chrome/browser/chromeos/drive/drive_task_executor.cc +++ b/chrome/browser/chromeos/drive/drive_task_executor.cc @@ -46,7 +46,7 @@ DriveTaskExecutor::~DriveTaskExecutor() { bool DriveTaskExecutor::ExecuteAndNotify( const std::vector<FileSystemURL>& file_urls, const file_handler_util::FileTaskFinishedCallback& done) { - std::vector<FilePath> raw_paths; + std::vector<base::FilePath> raw_paths; for (std::vector<FileSystemURL>::const_iterator url = file_urls.begin(); url != file_urls.end(); ++url) { if (!url->is_valid() || url->type() != fileapi::kFileSystemTypeDrive) @@ -64,7 +64,7 @@ bool DriveTaskExecutor::ExecuteAndNotify( // Reset the index, so we know when we're done. current_index_ = raw_paths.size(); - for (std::vector<FilePath>::const_iterator iter = raw_paths.begin(); + for (std::vector<base::FilePath>::const_iterator iter = raw_paths.begin(); iter != raw_paths.end(); ++iter) { file_system->GetEntryInfoByPath( *iter, diff --git a/chrome/browser/chromeos/drive/drive_test_util.cc b/chrome/browser/chromeos/drive/drive_test_util.cc index 986d561..24b0cac 100644 --- a/chrome/browser/chromeos/drive/drive_test_util.cc +++ b/chrome/browser/chromeos/drive/drive_test_util.cc @@ -44,9 +44,9 @@ void CopyErrorCodeFromFileOperationCallback(DriveFileError* output, void CopyResultsFromFileMoveCallback( DriveFileError* out_error, - FilePath* out_file_path, + base::FilePath* out_file_path, DriveFileError error, - const FilePath& moved_file_path) { + const base::FilePath& moved_file_path) { DCHECK(out_error); DCHECK(out_file_path); @@ -93,10 +93,10 @@ void CopyResultsFromReadDirectoryByPathCallback( void CopyResultsFromGetEntryInfoWithFilePathCallback( DriveFileError* out_error, - FilePath* out_drive_file_path, + base::FilePath* out_drive_file_path, scoped_ptr<DriveEntryProto>* out_entry_proto, DriveFileError error, - const FilePath& drive_file_path, + const base::FilePath& drive_file_path, scoped_ptr<DriveEntryProto> entry_proto) { DCHECK(out_error); DCHECK(out_drive_file_path); @@ -121,10 +121,11 @@ void CopyResultFromInitializeCacheCallback(bool* out_success, *out_success = success; } -void CopyResultsFromGetFileFromCacheCallback(DriveFileError* out_error, - FilePath* out_cache_file_path, - DriveFileError error, - const FilePath& cache_file_path) { +void CopyResultsFromGetFileFromCacheCallback( + DriveFileError* out_error, + base::FilePath* out_cache_file_path, + DriveFileError error, + const base::FilePath& cache_file_path) { DCHECK(out_error); DCHECK(out_cache_file_path); *out_error = error; @@ -142,10 +143,10 @@ void CopyResultsFromGetCacheEntryCallback(bool* out_success, } void CopyResultsFromGetFileCallback(DriveFileError* out_error, - FilePath* out_file_path, + base::FilePath* out_file_path, DriveFileType* out_file_type, DriveFileError error, - const FilePath& file_path, + const base::FilePath& file_path, const std::string& /*mime_type*/, DriveFileType file_type) { DCHECK(out_error); @@ -183,9 +184,9 @@ void CopyResultsFromSearchMetadataCallback( } void CopyResultsFromOpenFileCallbackAndQuit(DriveFileError* out_error, - FilePath* out_file_path, + base::FilePath* out_file_path, DriveFileError error, - const FilePath& file_path) { + const base::FilePath& file_path) { *out_error = error; *out_file_path = file_path; MessageLoop::current()->Quit(); diff --git a/chrome/browser/chromeos/drive/drive_webapps_registry.cc b/chrome/browser/chromeos/drive/drive_webapps_registry.cc index 9813d53..0da55eb 100644 --- a/chrome/browser/chromeos/drive/drive_webapps_registry.cc +++ b/chrome/browser/chromeos/drive/drive_webapps_registry.cc @@ -31,8 +31,8 @@ std::string GetWebStoreIdFromUrl(const GURL& url) { return std::string(); } - FilePath path(url.path()); - std::vector<FilePath::StringType> components; + base::FilePath path(url.path()); + std::vector<base::FilePath::StringType> components; path.GetComponents(&components); DCHECK_LE(2U, components.size()); // Coming from kStoreProductUrl @@ -101,14 +101,14 @@ DriveWebAppsRegistry::~DriveWebAppsRegistry() { } void DriveWebAppsRegistry::GetWebAppsForFile( - const FilePath& file, + const base::FilePath& file, const std::string& mime_type, ScopedVector<DriveWebAppInfo>* apps) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); SelectorWebAppList result_map; if (!file.empty()) { - FilePath::StringType extension = file.Extension(); + base::FilePath::StringType extension = file.Extension(); if (extension.size() < 2) return; diff --git a/chrome/browser/chromeos/drive/drive_webapps_registry_unittest.cc b/chrome/browser/chromeos/drive/drive_webapps_registry_unittest.cc index fff37b3..90f8604 100644 --- a/chrome/browser/chromeos/drive/drive_webapps_registry_unittest.cc +++ b/chrome/browser/chromeos/drive/drive_webapps_registry_unittest.cc @@ -92,14 +92,14 @@ TEST_F(DriveWebAppsRegistryTest, LoadAndFindWebApps) { // Find by extension 'ext_1'. ScopedVector<DriveWebAppInfo> ext_1_results; - FilePath ext1_file(FILE_PATH_LITERAL("gdata/SampleFile.ext_1")); + base::FilePath ext1_file(FILE_PATH_LITERAL("gdata/SampleFile.ext_1")); web_apps->GetWebAppsForFile(ext1_file, std::string(), &ext_1_results); ASSERT_EQ(1U, ext_1_results.size()); EXPECT_TRUE(VerifyApp1(ext_1_results, true)); // Find by extension 'ext_3'. ScopedVector<DriveWebAppInfo> ext_3_results; - FilePath ext3_file(FILE_PATH_LITERAL("gdata/AnotherFile.ext_3")); + base::FilePath ext3_file(FILE_PATH_LITERAL("gdata/AnotherFile.ext_3")); web_apps->GetWebAppsForFile(ext3_file, std::string(), &ext_3_results); ASSERT_EQ(2U, ext_3_results.size()); EXPECT_TRUE(VerifyApp1(ext_3_results, false)); @@ -107,14 +107,14 @@ TEST_F(DriveWebAppsRegistryTest, LoadAndFindWebApps) { // Find by mimetype 'ext_3'. ScopedVector<DriveWebAppInfo> mime_results; - web_apps->GetWebAppsForFile(FilePath(), "application/test_type_2", + web_apps->GetWebAppsForFile(base::FilePath(), "application/test_type_2", &mime_results); ASSERT_EQ(1U, mime_results.size()); EXPECT_TRUE(VerifyApp2(mime_results, true)); // Find by extension and mimetype. ScopedVector<DriveWebAppInfo> mime_ext_results; - FilePath mime_file(FILE_PATH_LITERAL("gdata/MimeFile.ext_2")); + base::FilePath mime_file(FILE_PATH_LITERAL("gdata/MimeFile.ext_2")); web_apps->GetWebAppsForFile(mime_file, "application/test_type_2", &mime_ext_results); ASSERT_EQ(2U, mime_ext_results.size()); @@ -137,7 +137,7 @@ TEST_F(DriveWebAppsRegistryTest, LoadAndFindDriveWebApps) { // Find by primary extension 'exe'. ScopedVector<DriveWebAppInfo> ext_results; - FilePath ext_file(FILE_PATH_LITERAL("drive/file.exe")); + base::FilePath ext_file(FILE_PATH_LITERAL("drive/file.exe")); web_apps->GetWebAppsForFile(ext_file, std::string(), &ext_results); ASSERT_EQ(1U, ext_results.size()); VerifyApp(ext_results, "abcdefghabcdefghabcdefghabcdefgh", "123456788192", @@ -145,7 +145,7 @@ TEST_F(DriveWebAppsRegistryTest, LoadAndFindDriveWebApps) { // Find by primary MIME type. ScopedVector<DriveWebAppInfo> primary_app; - web_apps->GetWebAppsForFile(FilePath(), + web_apps->GetWebAppsForFile(base::FilePath(), "application/vnd.google-apps.drive-sdk.123456788192", &primary_app); ASSERT_EQ(1U, primary_app.size()); VerifyApp(primary_app, "abcdefghabcdefghabcdefghabcdefgh", "123456788192", @@ -153,7 +153,7 @@ TEST_F(DriveWebAppsRegistryTest, LoadAndFindDriveWebApps) { // Find by secondary MIME type. ScopedVector<DriveWebAppInfo> secondary_app; - web_apps->GetWebAppsForFile(FilePath(), "text/html", &secondary_app); + web_apps->GetWebAppsForFile(base::FilePath(), "text/html", &secondary_app); ASSERT_EQ(1U, secondary_app.size()); VerifyApp(secondary_app, "abcdefghabcdefghabcdefghabcdefgh", "123456788192", "Drive app 1", "", false); diff --git a/chrome/browser/chromeos/drive/file_change.cc b/chrome/browser/chromeos/drive/file_change.cc index a4e6ee9..cc3c9aa 100644 --- a/chrome/browser/chromeos/drive/file_change.cc +++ b/chrome/browser/chromeos/drive/file_change.cc @@ -6,14 +6,15 @@ namespace drive { -FileChange::FileChange(const FilePath& path, Type type) +FileChange::FileChange(const base::FilePath& path, Type type) : path_(path), type_(type) { } FileChange::~FileChange() {} // static -FileChangeSet FileChange::CreateSingleSet(const FilePath& path, Type type) { +FileChangeSet FileChange::CreateSingleSet(const base::FilePath& path, + Type type) { FileChangeSet result; result.insert(FileChange(path, type)); return result; diff --git a/chrome/browser/chromeos/drive/file_change.h b/chrome/browser/chromeos/drive/file_change.h index f24cdc9..b9880e9 100644 --- a/chrome/browser/chromeos/drive/file_change.h +++ b/chrome/browser/chromeos/drive/file_change.h @@ -29,11 +29,11 @@ class FileChange { // Created an object representing a change of file or directory pointed by // |change_path|. The change is of |change_type| type. - FileChange(const FilePath& path, Type type); + FileChange(const base::FilePath& path, Type type); ~FileChange(); // Factory method to create a FileChangeSet object with only one element. - static FileChangeSet CreateSingleSet(const FilePath& path, Type type); + static FileChangeSet CreateSingleSet(const base::FilePath& path, Type type); bool operator==(const FileChange &file_change) const { return path_ == file_change.path() && type_ == file_change.type(); @@ -44,12 +44,12 @@ class FileChange { (path_ == file_change.path() && type_ < file_change.type()); } - const FilePath& path() const { return path_; } + const base::FilePath& path() const { return path_; } Type type() const { return type_; } private: - const FilePath path_; + const base::FilePath path_; const Type type_; }; diff --git a/chrome/browser/chromeos/drive/file_change_unittest.cc b/chrome/browser/chromeos/drive/file_change_unittest.cc index 1912a5c..619f37f 100644 --- a/chrome/browser/chromeos/drive/file_change_unittest.cc +++ b/chrome/browser/chromeos/drive/file_change_unittest.cc @@ -8,7 +8,7 @@ namespace drive { TEST(FileChangeTest, Getters) { - FilePath change_path(FILE_PATH_LITERAL("test")); + base::FilePath change_path(FILE_PATH_LITERAL("test")); FileChange::Type change_type = FileChange::ADDED; FileChange file_change(change_path, change_type); @@ -18,7 +18,7 @@ TEST(FileChangeTest, Getters) { } TEST(FileChangeTest, FactoryMethod) { - FilePath change_path(FILE_PATH_LITERAL("a/b/c/d")); + base::FilePath change_path(FILE_PATH_LITERAL("a/b/c/d")); FileChange::Type change_type = FileChange::CHANGED; FileChangeSet changed_files = @@ -34,38 +34,38 @@ TEST(FileChangeTest, FactoryMethod) { TEST(FileChangeTest, Equals) { // Change is equal if and only if both path and type are equal. // Paths differ, types are equal. - FileChange file_change1(FilePath(FILE_PATH_LITERAL("a")), + FileChange file_change1(base::FilePath(FILE_PATH_LITERAL("a")), FileChange::ADDED); - FileChange file_change2(FilePath(FILE_PATH_LITERAL("b")), + FileChange file_change2(base::FilePath(FILE_PATH_LITERAL("b")), FileChange::ADDED); EXPECT_EQ(file_change1, file_change1); EXPECT_FALSE(file_change1 == file_change2); // Paths are equal, types differ. - FileChange file_change3(FilePath(FILE_PATH_LITERAL("a")), + FileChange file_change3(base::FilePath(FILE_PATH_LITERAL("a")), FileChange::DELETED); - FileChange file_change4(FilePath(FILE_PATH_LITERAL("a")), + FileChange file_change4(base::FilePath(FILE_PATH_LITERAL("a")), FileChange::CHANGED); EXPECT_FALSE(file_change3 == file_change4); // Paths and types are equal. - FileChange file_change5(FilePath(FILE_PATH_LITERAL("c")), + FileChange file_change5(base::FilePath(FILE_PATH_LITERAL("c")), FileChange::ADDED); - FileChange file_change6(FilePath(FILE_PATH_LITERAL("c")), + FileChange file_change6(base::FilePath(FILE_PATH_LITERAL("c")), FileChange::ADDED); EXPECT_EQ(file_change5, file_change6); } TEST(FileChangeTest, Compare) { - FileChange file_change1(FilePath(FILE_PATH_LITERAL("a")), + FileChange file_change1(base::FilePath(FILE_PATH_LITERAL("a")), FileChange::DELETED); - FileChange file_change2(FilePath(FILE_PATH_LITERAL("a")), + FileChange file_change2(base::FilePath(FILE_PATH_LITERAL("a")), FileChange::ADDED); - FileChange file_change3(FilePath(FILE_PATH_LITERAL("a")), + FileChange file_change3(base::FilePath(FILE_PATH_LITERAL("a")), FileChange::CHANGED); - FileChange file_change4(FilePath(FILE_PATH_LITERAL("b")), + FileChange file_change4(base::FilePath(FILE_PATH_LITERAL("b")), FileChange::ADDED); - FileChange file_change5(FilePath(FILE_PATH_LITERAL("c")), + FileChange file_change5(base::FilePath(FILE_PATH_LITERAL("c")), FileChange::DELETED); // Comparison operator should not return true for equal values. diff --git a/chrome/browser/chromeos/drive/file_system/copy_operation.cc b/chrome/browser/chromeos/drive/file_system/copy_operation.cc index 75d422e..798f64c 100644 --- a/chrome/browser/chromeos/drive/file_system/copy_operation.cc +++ b/chrome/browser/chromeos/drive/file_system/copy_operation.cc @@ -34,8 +34,9 @@ const char kMimeTypeOctetStream[] = "application/octet-stream"; // Copies a file from |src_file_path| to |dest_file_path| on the local // file system using file_util::CopyFile. // Returns DRIVE_FILE_OK on success or DRIVE_FILE_ERROR_FAILED otherwise. -DriveFileError CopyLocalFileOnBlockingPool(const FilePath& src_file_path, - const FilePath& dest_file_path) { +DriveFileError CopyLocalFileOnBlockingPool( + const base::FilePath& src_file_path, + const base::FilePath& dest_file_path) { return file_util::CopyFile(src_file_path, dest_file_path) ? DRIVE_FILE_OK : DRIVE_FILE_ERROR_FAILED; } @@ -44,7 +45,7 @@ DriveFileError CopyLocalFileOnBlockingPool(const FilePath& src_file_path, // hosted document on blocking pool, and if so, gets the resource ID of the // document. std::string GetDocumentResourceIdOnBlockingPool( - const FilePath& local_file_path) { + const base::FilePath& local_file_path) { std::string result; if (ResourceEntry::HasHostedDocumentExtension(local_file_path)) { std::string error; @@ -61,15 +62,15 @@ std::string GetDocumentResourceIdOnBlockingPool( // CopyOperation::StartFileUploadParams implementation. struct CopyOperation::StartFileUploadParams { - StartFileUploadParams(const FilePath& in_local_file_path, - const FilePath& in_remote_file_path, + StartFileUploadParams(const base::FilePath& in_local_file_path, + const base::FilePath& in_remote_file_path, const FileOperationCallback& in_callback) : local_file_path(in_local_file_path), remote_file_path(in_remote_file_path), callback(in_callback) {} - const FilePath local_file_path; - const FilePath remote_file_path; + const base::FilePath local_file_path; + const base::FilePath remote_file_path; const FileOperationCallback callback; }; @@ -97,8 +98,8 @@ CopyOperation::~CopyOperation() { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); } -void CopyOperation::Copy(const FilePath& src_file_path, - const FilePath& dest_file_path, +void CopyOperation::Copy(const base::FilePath& src_file_path, + const base::FilePath& dest_file_path, const FileOperationCallback& callback) { BrowserThread::CurrentlyOn(BrowserThread::UI); DCHECK(!callback.is_null()); @@ -113,8 +114,8 @@ void CopyOperation::Copy(const FilePath& src_file_path, } void CopyOperation::TransferFileFromRemoteToLocal( - const FilePath& remote_src_file_path, - const FilePath& local_dest_file_path, + const base::FilePath& remote_src_file_path, + const base::FilePath& local_dest_file_path, const FileOperationCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!callback.is_null()); @@ -128,10 +129,10 @@ void CopyOperation::TransferFileFromRemoteToLocal( } void CopyOperation::OnGetFileCompleteForTransferFile( - const FilePath& local_dest_file_path, + const base::FilePath& local_dest_file_path, const FileOperationCallback& callback, DriveFileError error, - const FilePath& local_file_path, + const base::FilePath& local_file_path, const std::string& unused_mime_type, DriveFileType file_type) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); @@ -155,8 +156,8 @@ void CopyOperation::OnGetFileCompleteForTransferFile( } void CopyOperation::TransferFileFromLocalToRemote( - const FilePath& local_src_file_path, - const FilePath& remote_dest_file_path, + const base::FilePath& local_src_file_path, + const base::FilePath& remote_dest_file_path, const FileOperationCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!callback.is_null()); @@ -173,8 +174,8 @@ void CopyOperation::TransferFileFromLocalToRemote( } void CopyOperation::TransferRegularFile( - const FilePath& local_file_path, - const FilePath& remote_dest_file_path, + const base::FilePath& local_file_path, + const base::FilePath& remote_dest_file_path, const FileOperationCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!callback.is_null()); @@ -195,16 +196,16 @@ void CopyOperation::TransferRegularFile( } void CopyOperation::CopyHostedDocumentToDirectory( - const FilePath& dir_path, + const base::FilePath& dir_path, const std::string& resource_id, - const FilePath::StringType& new_name, + const base::FilePath::StringType& new_name, const FileOperationCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!callback.is_null()); drive_scheduler_->CopyHostedDocument( resource_id, - FilePath(new_name).AsUTF8Unsafe(), + base::FilePath(new_name).AsUTF8Unsafe(), base::Bind(&CopyOperation::OnCopyHostedDocumentCompleted, weak_ptr_factory_.GetWeakPtr(), dir_path, @@ -212,7 +213,7 @@ void CopyOperation::CopyHostedDocumentToDirectory( } void CopyOperation::OnCopyHostedDocumentCompleted( - const FilePath& dir_path, + const base::FilePath& dir_path, const FileOperationCallback& callback, GDataErrorCode status, scoped_ptr<google_apis::ResourceEntry> resource_entry) { @@ -230,7 +231,7 @@ void CopyOperation::OnCopyHostedDocumentCompleted( // first add it to |root_| to mirror the state and then move it to the // destination directory by MoveEntryFromRootDirectory(). metadata_->AddEntryToDirectory( - FilePath(kDriveRootDirectory), + base::FilePath(kDriveRootDirectory), resource_entry.Pass(), base::Bind(&CopyOperation::MoveEntryFromRootDirectory, weak_ptr_factory_.GetWeakPtr(), @@ -239,17 +240,17 @@ void CopyOperation::OnCopyHostedDocumentCompleted( } void CopyOperation::MoveEntryFromRootDirectory( - const FilePath& directory_path, + const base::FilePath& directory_path, const FileOperationCallback& callback, DriveFileError error, - const FilePath& file_path) { + const base::FilePath& file_path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!callback.is_null()); DCHECK_EQ(kDriveRootDirectory, file_path.DirName().value()); // Return if there is an error or |dir_path| is the root directory. if (error != DRIVE_FILE_OK || - directory_path == FilePath(kDriveRootDirectory)) { + directory_path == base::FilePath(kDriveRootDirectory)) { callback.Run(error); return; } @@ -260,7 +261,7 @@ void CopyOperation::MoveEntryFromRootDirectory( } void CopyOperation::CopyAfterGetEntryInfoPair( - const FilePath& dest_file_path, + const base::FilePath& dest_file_path, const FileOperationCallback& callback, scoped_ptr<EntryInfoPairResult> result) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); @@ -301,7 +302,7 @@ void CopyOperation::CopyAfterGetEntryInfoPair( // TODO(kochi): Reimplement this once the server API supports // copying of regular files directly on the server side. crbug.com/138273 - const FilePath& src_file_path = result->first.path; + const base::FilePath& src_file_path = result->first.path; drive_file_system_->GetFileByPath( src_file_path, base::Bind(&CopyOperation::OnGetFileCompleteForCopy, @@ -311,10 +312,10 @@ void CopyOperation::CopyAfterGetEntryInfoPair( } void CopyOperation::OnGetFileCompleteForCopy( - const FilePath& remote_dest_file_path, + const base::FilePath& remote_dest_file_path, const FileOperationCallback& callback, DriveFileError error, - const FilePath& local_file_path, + const base::FilePath& local_file_path, const std::string& unused_mime_type, DriveFileType file_type) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); @@ -375,8 +376,8 @@ void CopyOperation::StartFileUploadAfterGetEntryInfo( void CopyOperation::OnTransferCompleted( const FileOperationCallback& callback, google_apis::DriveUploadError error, - const FilePath& drive_path, - const FilePath& file_path, + const base::FilePath& drive_path, + const base::FilePath& file_path, scoped_ptr<ResourceEntry> resource_entry) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!callback.is_null()); @@ -392,8 +393,8 @@ void CopyOperation::OnTransferCompleted( } void CopyOperation::TransferFileFromLocalToRemoteAfterGetEntryInfo( - const FilePath& local_src_file_path, - const FilePath& remote_dest_file_path, + const base::FilePath& local_src_file_path, + const base::FilePath& remote_dest_file_path, const FileOperationCallback& callback, DriveFileError error, scoped_ptr<DriveEntryProto> entry_proto) { @@ -424,8 +425,8 @@ void CopyOperation::TransferFileFromLocalToRemoteAfterGetEntryInfo( } void CopyOperation::TransferFileForResourceId( - const FilePath& local_file_path, - const FilePath& remote_dest_file_path, + const base::FilePath& local_file_path, + const base::FilePath& remote_dest_file_path, const FileOperationCallback& callback, const std::string& resource_id) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); diff --git a/chrome/browser/chromeos/drive/file_system/drive_operations.cc b/chrome/browser/chromeos/drive/file_system/drive_operations.cc index 7cf8952..5db8ae0 100644 --- a/chrome/browser/chromeos/drive/file_system/drive_operations.cc +++ b/chrome/browser/chromeos/drive/file_system/drive_operations.cc @@ -71,8 +71,8 @@ void DriveOperations::InitForTesting(CopyOperation* copy_operation, update_operation_.reset(update_operation); } -void DriveOperations::Copy(const FilePath& src_file_path, - const FilePath& dest_file_path, +void DriveOperations::Copy(const base::FilePath& src_file_path, + const base::FilePath& dest_file_path, const FileOperationCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!callback.is_null()); @@ -81,8 +81,8 @@ void DriveOperations::Copy(const FilePath& src_file_path, } void DriveOperations::TransferFileFromRemoteToLocal( - const FilePath& remote_src_file_path, - const FilePath& local_dest_file_path, + const base::FilePath& remote_src_file_path, + const base::FilePath& local_dest_file_path, const FileOperationCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!callback.is_null()); @@ -93,8 +93,8 @@ void DriveOperations::TransferFileFromRemoteToLocal( } void DriveOperations::TransferFileFromLocalToRemote( - const FilePath& local_src_file_path, - const FilePath& remote_dest_file_path, + const base::FilePath& local_src_file_path, + const base::FilePath& remote_dest_file_path, const FileOperationCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!callback.is_null()); @@ -105,8 +105,8 @@ void DriveOperations::TransferFileFromLocalToRemote( } void DriveOperations::TransferRegularFile( - const FilePath& local_src_file_path, - const FilePath& remote_dest_file_path, + const base::FilePath& local_src_file_path, + const base::FilePath& remote_dest_file_path, const FileOperationCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!callback.is_null()); @@ -117,7 +117,7 @@ void DriveOperations::TransferRegularFile( } void DriveOperations::CreateDirectory( - const FilePath& directory_path, + const base::FilePath& directory_path, bool is_exclusive, bool is_recursive, const FileOperationCallback& callback) { @@ -128,8 +128,8 @@ void DriveOperations::CreateDirectory( directory_path, is_exclusive, is_recursive, callback); } -void DriveOperations::Move(const FilePath& src_file_path, - const FilePath& dest_file_path, +void DriveOperations::Move(const base::FilePath& src_file_path, + const base::FilePath& dest_file_path, const FileOperationCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!callback.is_null()); @@ -137,7 +137,7 @@ void DriveOperations::Move(const FilePath& src_file_path, move_operation_->Move(src_file_path, dest_file_path, callback); } -void DriveOperations::Remove(const FilePath& file_path, +void DriveOperations::Remove(const base::FilePath& file_path, bool is_recursive, const FileOperationCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); diff --git a/chrome/browser/chromeos/drive/file_system/move_operation.cc b/chrome/browser/chromeos/drive/file_system/move_operation.cc index 138eef6..f0248ef 100644 --- a/chrome/browser/chromeos/drive/file_system/move_operation.cc +++ b/chrome/browser/chromeos/drive/file_system/move_operation.cc @@ -31,8 +31,8 @@ MoveOperation::~MoveOperation() { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); } -void MoveOperation::Move(const FilePath& src_file_path, - const FilePath& dest_file_path, +void MoveOperation::Move(const base::FilePath& src_file_path, + const base::FilePath& dest_file_path, const FileOperationCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!callback.is_null()); @@ -47,7 +47,7 @@ void MoveOperation::Move(const FilePath& src_file_path, } void MoveOperation::MoveAfterGetEntryInfoPair( - const FilePath& dest_file_path, + const base::FilePath& dest_file_path, const FileOperationCallback& callback, scoped_ptr<EntryInfoPairResult> result) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); @@ -69,8 +69,8 @@ void MoveOperation::MoveAfterGetEntryInfoPair( } // If the file/directory is moved to the same directory, just rename it. - const FilePath& src_file_path = result->first.path; - const FilePath& dest_parent_path = result->second.path; + const base::FilePath& src_file_path = result->first.path; + const base::FilePath& dest_parent_path = result->second.path; DCHECK_EQ(dest_parent_path.value(), dest_file_path.DirName().value()); if (src_file_path.DirName() == dest_parent_path) { FileMoveCallback final_file_path_update_callback = @@ -113,15 +113,15 @@ void MoveOperation::MoveAfterGetEntryInfoPair( void MoveOperation::OnFilePathUpdated(const FileOperationCallback& callback, DriveFileError error, - const FilePath& /* file_path */) { + const base::FilePath& /* file_path */) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!callback.is_null()); callback.Run(error); } -void MoveOperation::Rename(const FilePath& file_path, - const FilePath::StringType& new_name, +void MoveOperation::Rename(const base::FilePath& file_path, + const base::FilePath::StringType& new_name, const FileMoveCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!callback.is_null()); @@ -144,8 +144,8 @@ void MoveOperation::Rename(const FilePath& file_path, } void MoveOperation::RenameAfterGetEntryInfo( - const FilePath& file_path, - const FilePath::StringType& new_name, + const base::FilePath& file_path, + const base::FilePath::StringType& new_name, const FileMoveCallback& callback, DriveFileError error, scoped_ptr<DriveEntryProto> entry_proto) { @@ -161,10 +161,10 @@ void MoveOperation::RenameAfterGetEntryInfo( // Drop the .g<something> extension from |new_name| if the file being // renamed is a hosted document and |new_name| has the same .g<something> // extension as the file. - FilePath::StringType file_name = new_name; + base::FilePath::StringType file_name = new_name; if (entry_proto->has_file_specific_info() && entry_proto->file_specific_info().is_hosted_document()) { - FilePath new_file(file_name); + base::FilePath new_file(file_name); if (new_file.Extension() == entry_proto->file_specific_info().document_extension()) { file_name = new_file.RemoveExtension().value(); @@ -173,7 +173,7 @@ void MoveOperation::RenameAfterGetEntryInfo( drive_scheduler_->RenameResource( entry_proto->resource_id(), - FilePath(file_name).AsUTF8Unsafe(), + base::FilePath(file_name).AsUTF8Unsafe(), base::Bind(&MoveOperation::RenameEntryLocally, weak_ptr_factory_.GetWeakPtr(), file_path, @@ -182,8 +182,8 @@ void MoveOperation::RenameAfterGetEntryInfo( } void MoveOperation::RenameEntryLocally( - const FilePath& file_path, - const FilePath::StringType& new_name, + const base::FilePath& file_path, + const base::FilePath::StringType& new_name, const FileMoveCallback& callback, google_apis::GDataErrorCode status) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); @@ -191,7 +191,7 @@ void MoveOperation::RenameEntryLocally( const DriveFileError error = util::GDataToDriveFileError(status); if (error != DRIVE_FILE_OK) { - callback.Run(error, FilePath()); + callback.Run(error, base::FilePath()); return; } @@ -206,7 +206,7 @@ void MoveOperation::RenameEntryLocally( void MoveOperation::RemoveEntryFromDirectory( const FileMoveCallback& callback, DriveFileError error, - const FilePath& file_path) { + const base::FilePath& file_path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!callback.is_null()); @@ -226,7 +226,7 @@ void MoveOperation::RemoveEntryFromDirectoryAfterEntryInfoPair( DCHECK(!callback.is_null()); DCHECK(result.get()); - const FilePath& file_path = result->first.path; + const base::FilePath& file_path = result->first.path; if (result->first.error != DRIVE_FILE_OK) { callback.Run(result->first.error, file_path); return; @@ -250,7 +250,7 @@ void MoveOperation::RemoveEntryFromDirectoryAfterEntryInfoPair( base::Bind(&MoveOperation::MoveEntryToDirectory, weak_ptr_factory_.GetWeakPtr(), file_path, - FilePath(kDriveRootDirectory), + base::FilePath(kDriveRootDirectory), base::Bind(&MoveOperation::NotifyAndRunFileMoveCallback, weak_ptr_factory_.GetWeakPtr(), callback))); @@ -258,10 +258,10 @@ void MoveOperation::RemoveEntryFromDirectoryAfterEntryInfoPair( // TODO(zork): Share with CopyOperation. // See: crbug.com/150050 -void MoveOperation::AddEntryToDirectory(const FilePath& directory_path, +void MoveOperation::AddEntryToDirectory(const base::FilePath& directory_path, const FileOperationCallback& callback, DriveFileError error, - const FilePath& file_path) { + const base::FilePath& file_path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!callback.is_null()); @@ -299,8 +299,8 @@ void MoveOperation::AddEntryToDirectoryAfterGetEntryInfoPair( return; } - const FilePath& file_path = result->first.path; - const FilePath& dir_path = result->second.path; + const base::FilePath& file_path = result->first.path; + const base::FilePath& dir_path = result->second.path; drive_scheduler_->AddResourceToDirectory( dir_proto->resource_id(), src_proto->resource_id(), @@ -316,8 +316,8 @@ void MoveOperation::AddEntryToDirectoryAfterGetEntryInfoPair( // TODO(zork): Share with CopyOperation. // See: crbug.com/150050 void MoveOperation::MoveEntryToDirectory( - const FilePath& file_path, - const FilePath& directory_path, + const base::FilePath& file_path, + const base::FilePath& directory_path, const FileMoveCallback& callback, google_apis::GDataErrorCode status) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); @@ -325,7 +325,7 @@ void MoveOperation::MoveEntryToDirectory( const DriveFileError error = util::GDataToDriveFileError(status); if (error != DRIVE_FILE_OK) { - callback.Run(error, FilePath()); + callback.Run(error, base::FilePath()); return; } @@ -337,7 +337,7 @@ void MoveOperation::MoveEntryToDirectory( void MoveOperation::NotifyAndRunFileOperationCallback( const FileOperationCallback& callback, DriveFileError error, - const FilePath& moved_file_path) { + const base::FilePath& moved_file_path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!callback.is_null()); @@ -350,7 +350,7 @@ void MoveOperation::NotifyAndRunFileOperationCallback( void MoveOperation::NotifyAndRunFileMoveCallback( const FileMoveCallback& callback, DriveFileError error, - const FilePath& moved_file_path) { + const base::FilePath& moved_file_path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!callback.is_null()); diff --git a/chrome/browser/chromeos/drive/file_system/remove_operation.cc b/chrome/browser/chromeos/drive/file_system/remove_operation.cc index 99d651b..9879b7b 100644 --- a/chrome/browser/chromeos/drive/file_system/remove_operation.cc +++ b/chrome/browser/chromeos/drive/file_system/remove_operation.cc @@ -40,7 +40,7 @@ RemoveOperation::~RemoveOperation() { } void RemoveOperation::Remove( - const FilePath& file_path, + const base::FilePath& file_path, bool is_recursive, const FileOperationCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); @@ -101,7 +101,7 @@ void RemoveOperation::RemoveResourceLocally( void RemoveOperation::NotifyDirectoryChanged( const FileOperationCallback& callback, DriveFileError error, - const FilePath& directory_path) { + const base::FilePath& directory_path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!callback.is_null()); diff --git a/chrome/browser/chromeos/drive/file_system/update_operation.cc b/chrome/browser/chromeos/drive/file_system/update_operation.cc index e1c9c44..b88cd2a 100644 --- a/chrome/browser/chromeos/drive/file_system/update_operation.cc +++ b/chrome/browser/chromeos/drive/file_system/update_operation.cc @@ -55,7 +55,7 @@ void UpdateOperation::UpdateFileByResourceId( void UpdateOperation::UpdateFileByEntryInfo( const FileOperationCallback& callback, DriveFileError error, - const FilePath& drive_file_path, + const base::FilePath& drive_file_path, scoped_ptr<DriveEntryProto> entry_proto) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!callback.is_null()); @@ -84,10 +84,10 @@ void UpdateOperation::UpdateFileByEntryInfo( void UpdateOperation::OnGetFileCompleteForUpdateFile( const FileOperationCallback& callback, - const FilePath& drive_file_path, + const base::FilePath& drive_file_path, scoped_ptr<DriveEntryProto> entry_proto, DriveFileError error, - const FilePath& cache_file_path) { + const base::FilePath& cache_file_path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!callback.is_null()); @@ -110,8 +110,8 @@ void UpdateOperation::OnGetFileCompleteForUpdateFile( void UpdateOperation::OnUpdatedFileUploaded( const FileOperationCallback& callback, google_apis::DriveUploadError error, - const FilePath& drive_path, - const FilePath& file_path, + const base::FilePath& drive_path, + const base::FilePath& file_path, scoped_ptr<google_apis::ResourceEntry> resource_entry) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!callback.is_null()); @@ -131,7 +131,7 @@ void UpdateOperation::OnUpdatedFileUploaded( void UpdateOperation::OnUpdatedFileRefreshed( const FileOperationCallback& callback, DriveFileError error, - const FilePath& drive_file_path, + const base::FilePath& drive_file_path, scoped_ptr<DriveEntryProto> entry_proto) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!callback.is_null()); diff --git a/chrome/browser/chromeos/drive/file_write_helper.cc b/chrome/browser/chromeos/drive/file_write_helper.cc index 8b890b6..39126e6 100644 --- a/chrome/browser/chromeos/drive/file_write_helper.cc +++ b/chrome/browser/chromeos/drive/file_write_helper.cc @@ -14,7 +14,7 @@ namespace drive { namespace { // Emits debug log when DriveFileSystem::CloseFile() is complete. -void EmitDebugLogForCloseFile(const FilePath& file_path, +void EmitDebugLogForCloseFile(const base::FilePath& file_path, DriveFileError file_error) { if (file_error != DRIVE_FILE_OK) { LOG(WARNING) << "CloseFile failed: " << file_path.AsUTF8Unsafe() << ": " @@ -37,7 +37,7 @@ FileWriteHelper::~FileWriteHelper() { } void FileWriteHelper::PrepareWritableFileAndRun( - const FilePath& file_path, + const base::FilePath& file_path, const OpenFileCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!callback.is_null()); @@ -52,7 +52,7 @@ void FileWriteHelper::PrepareWritableFileAndRun( } void FileWriteHelper::PrepareWritableFileAndRunAfterCreateFile( - const FilePath& file_path, + const base::FilePath& file_path, const OpenFileCallback& callback, DriveFileError error) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); @@ -61,7 +61,7 @@ void FileWriteHelper::PrepareWritableFileAndRunAfterCreateFile( if (error != DRIVE_FILE_OK) { content::BrowserThread::GetBlockingPool()->PostTask( FROM_HERE, - base::Bind(callback, error, FilePath())); + base::Bind(callback, error, base::FilePath())); return; } file_system_->OpenFile( @@ -73,17 +73,17 @@ void FileWriteHelper::PrepareWritableFileAndRunAfterCreateFile( } void FileWriteHelper::PrepareWritableFileAndRunAfterOpenFile( - const FilePath& file_path, + const base::FilePath& file_path, const OpenFileCallback& callback, DriveFileError error, - const FilePath& local_cache_path) { + const base::FilePath& local_cache_path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!callback.is_null()); if (error != DRIVE_FILE_OK) { content::BrowserThread::GetBlockingPool()->PostTask( FROM_HERE, - base::Bind(callback, error, FilePath())); + base::Bind(callback, error, base::FilePath())); return; } @@ -96,7 +96,7 @@ void FileWriteHelper::PrepareWritableFileAndRunAfterOpenFile( } void FileWriteHelper::PrepareWritableFileAndRunAfterCallback( - const FilePath& file_path) { + const base::FilePath& file_path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); file_system_->CloseFile(file_path, base::Bind(&EmitDebugLogForCloseFile, file_path)); diff --git a/chrome/browser/chromeos/drive/file_write_helper_unittest.cc b/chrome/browser/chromeos/drive/file_write_helper_unittest.cc index f217180..594c8c0 100644 --- a/chrome/browser/chromeos/drive/file_write_helper_unittest.cc +++ b/chrome/browser/chromeos/drive/file_write_helper_unittest.cc @@ -37,9 +37,9 @@ ACTION_P(MockCloseFile, error) { } void RecordOpenFileCallbackArguments(DriveFileError* error, - FilePath* path, + base::FilePath* path, DriveFileError error_arg, - const FilePath& path_arg) { + const base::FilePath& path_arg) { base::ThreadRestrictions::AssertIOAllowed(); *error = error_arg; *path = path_arg; @@ -61,8 +61,8 @@ class FileWriteHelperTest : public testing::Test { }; TEST_F(FileWriteHelperTest, PrepareFileForWritingSuccess) { - const FilePath kDrivePath("/drive/file.txt"); - const FilePath kLocalPath("/tmp/dummy.txt"); + const base::FilePath kDrivePath("/drive/file.txt"); + const base::FilePath kLocalPath("/tmp/dummy.txt"); EXPECT_CALL(*mock_file_system_, CreateFile(kDrivePath, false, _)) .WillOnce(MockCreateFile(DRIVE_FILE_OK)); @@ -73,7 +73,7 @@ TEST_F(FileWriteHelperTest, PrepareFileForWritingSuccess) { FileWriteHelper file_write_helper(mock_file_system_.get()); DriveFileError error = DRIVE_FILE_ERROR_FAILED; - FilePath path; + base::FilePath path; file_write_helper.PrepareWritableFileAndRun( kDrivePath, base::Bind(&RecordOpenFileCallbackArguments, &error, &path)); google_apis::test_util::RunBlockingPoolTask(); @@ -83,7 +83,7 @@ TEST_F(FileWriteHelperTest, PrepareFileForWritingSuccess) { } TEST_F(FileWriteHelperTest, PrepareFileForWritingCreateFail) { - const FilePath kDrivePath("/drive/file.txt"); + const base::FilePath kDrivePath("/drive/file.txt"); EXPECT_CALL(*mock_file_system_, CreateFile(kDrivePath, false, _)) .WillOnce(MockCreateFile(DRIVE_FILE_ERROR_ACCESS_DENIED)); @@ -92,33 +92,33 @@ TEST_F(FileWriteHelperTest, PrepareFileForWritingCreateFail) { FileWriteHelper file_write_helper(mock_file_system_.get()); DriveFileError error = DRIVE_FILE_ERROR_FAILED; - FilePath path; + base::FilePath path; file_write_helper.PrepareWritableFileAndRun( kDrivePath, base::Bind(&RecordOpenFileCallbackArguments, &error, &path)); google_apis::test_util::RunBlockingPoolTask(); EXPECT_EQ(DRIVE_FILE_ERROR_ACCESS_DENIED, error); - EXPECT_EQ(FilePath(), path); + EXPECT_EQ(base::FilePath(), path); } TEST_F(FileWriteHelperTest, PrepareFileForWritingOpenFail) { - const FilePath kDrivePath("/drive/file.txt"); + const base::FilePath kDrivePath("/drive/file.txt"); EXPECT_CALL(*mock_file_system_, CreateFile(kDrivePath, false, _)) .WillOnce(MockCreateFile(DRIVE_FILE_OK)); EXPECT_CALL(*mock_file_system_, OpenFile(kDrivePath, _)) - .WillOnce(MockOpenFile(DRIVE_FILE_ERROR_IN_USE, FilePath())); + .WillOnce(MockOpenFile(DRIVE_FILE_ERROR_IN_USE, base::FilePath())); EXPECT_CALL(*mock_file_system_, CloseFile(_, _)).Times(0); FileWriteHelper file_write_helper(mock_file_system_.get()); DriveFileError error = DRIVE_FILE_ERROR_FAILED; - FilePath path; + base::FilePath path; file_write_helper.PrepareWritableFileAndRun( kDrivePath, base::Bind(&RecordOpenFileCallbackArguments, &error, &path)); google_apis::test_util::RunBlockingPoolTask(); EXPECT_EQ(DRIVE_FILE_ERROR_IN_USE, error); - EXPECT_EQ(FilePath(), path); + EXPECT_EQ(base::FilePath(), path); } } // namespace drive diff --git a/chrome/browser/chromeos/drive/mock_directory_change_observer.h b/chrome/browser/chromeos/drive/mock_directory_change_observer.h index ba71384..65068c5 100644 --- a/chrome/browser/chromeos/drive/mock_directory_change_observer.h +++ b/chrome/browser/chromeos/drive/mock_directory_change_observer.h @@ -18,7 +18,7 @@ class MockDirectoryChangeObserver : public DriveFileSystemObserver { virtual ~MockDirectoryChangeObserver(); // DriveFileSystemInterface::Observer overrides. - MOCK_METHOD1(OnDirectoryChanged, void(const FilePath& directory_path)); + MOCK_METHOD1(OnDirectoryChanged, void(const base::FilePath& directory_path)); }; } // namespace drive diff --git a/chrome/browser/chromeos/drive/mock_drive_file_system.h b/chrome/browser/chromeos/drive/mock_drive_file_system.h index a0947bf..f1edb91 100644 --- a/chrome/browser/chromeos/drive/mock_drive_file_system.h +++ b/chrome/browser/chromeos/drive/mock_drive_file_system.h @@ -40,37 +40,37 @@ class MockDriveFileSystem : public DriveFileSystemInterface { const GURL& next_feed, const SearchCallback& callback)); MOCK_METHOD3(TransferFileFromRemoteToLocal, - void(const FilePath& local_src_file_path, - const FilePath& remote_dest_file_path, + void(const base::FilePath& local_src_file_path, + const base::FilePath& remote_dest_file_path, const FileOperationCallback& callback)); MOCK_METHOD3(TransferFileFromLocalToRemote, - void(const FilePath& local_src_file_path, - const FilePath& remote_dest_file_path, + void(const base::FilePath& local_src_file_path, + const base::FilePath& remote_dest_file_path, const FileOperationCallback& callback)); - MOCK_METHOD2(OpenFile, void(const FilePath& file_path, + MOCK_METHOD2(OpenFile, void(const base::FilePath& file_path, const OpenFileCallback& callback)); - MOCK_METHOD2(CloseFile, void(const FilePath& file_path, + MOCK_METHOD2(CloseFile, void(const base::FilePath& file_path, const FileOperationCallback& callback)); - MOCK_METHOD3(Copy, void(const FilePath& src_file_path, - const FilePath& dest_file_path, + MOCK_METHOD3(Copy, void(const base::FilePath& src_file_path, + const base::FilePath& dest_file_path, const FileOperationCallback& callback)); - MOCK_METHOD3(Move, void(const FilePath& src_file_path, - const FilePath& dest_file_path, + MOCK_METHOD3(Move, void(const base::FilePath& src_file_path, + const base::FilePath& dest_file_path, const FileOperationCallback& callback)); - MOCK_METHOD3(Remove, void(const FilePath& file_path, + MOCK_METHOD3(Remove, void(const base::FilePath& file_path, bool is_recursive, const FileOperationCallback& callback)); MOCK_METHOD4(CreateDirectory, - void(const FilePath& directory_path, + void(const base::FilePath& directory_path, bool is_exclusive, bool is_recursive, const FileOperationCallback& callback)); MOCK_METHOD3(CreateFile, - void(const FilePath& file_path, + void(const base::FilePath& file_path, bool is_exclusive, const FileOperationCallback& callback)); MOCK_METHOD2(GetFileByPath, - void(const FilePath& file_path, + void(const base::FilePath& file_path, const GetFileCallback& callback)); MOCK_METHOD3( GetFileByResourceId, @@ -80,19 +80,19 @@ class MockDriveFileSystem : public DriveFileSystemInterface { MOCK_METHOD2(UpdateFileByResourceId, void(const std::string& resource_id, const FileOperationCallback& callback)); - MOCK_METHOD2(GetEntryInfoByPath, void(const FilePath& file_path, + MOCK_METHOD2(GetEntryInfoByPath, void(const base::FilePath& file_path, const GetEntryInfoCallback& callback)); MOCK_METHOD2(ReadDirectoryByPath, - void(const FilePath& file_path, + void(const base::FilePath& file_path, const ReadDirectoryWithSettingCallback& callback)); MOCK_METHOD1(RequestDirectoryRefresh, - void(const FilePath& file_path)); + void(const base::FilePath& file_path)); MOCK_METHOD1(GetAvailableSpace, void(const GetAvailableSpaceCallback& callback)); // This function is not mockable by gmock because scoped_ptr is not supported. - virtual void AddUploadedFile(const FilePath& file, + virtual void AddUploadedFile(const base::FilePath& file, scoped_ptr<google_apis::ResourceEntry> entry, - const FilePath& file_content_path, + const base::FilePath& file_content_path, const FileOperationCallback& callback) OVERRIDE { } MOCK_METHOD1(GetMetadata, diff --git a/chrome/browser/chromeos/drive/search_metadata.cc b/chrome/browser/chromeos/drive/search_metadata.cc index ae4cd20..bc13d24 100644 --- a/chrome/browser/chromeos/drive/search_metadata.cc +++ b/chrome/browser/chromeos/drive/search_metadata.cc @@ -53,7 +53,7 @@ class SearchMetadataHelper { // Starts searching the local resource metadata by reading the root // directory. void Start() { - const FilePath root(kDriveRootDirectory); + const base::FilePath root(kDriveRootDirectory); ++num_pending_reads_; file_system_->ReadDirectoryByPath( root, @@ -66,7 +66,7 @@ class SearchMetadataHelper { private: // Called when a directory is read. Continues searching the local resource // metadata by recursively reading sub directories. - void DidReadDirectoryByPath(const FilePath& parent_path, + void DidReadDirectoryByPath(const base::FilePath& parent_path, DriveFileError error, bool hide_hosted_documents, scoped_ptr<DriveEntryProtoVector> entries) { @@ -82,8 +82,8 @@ class SearchMetadataHelper { --num_pending_reads_; for (size_t i = 0; i < entries->size(); ++i) { const DriveEntryProto& entry = entries->at(i); - const FilePath current_path = parent_path.Append( - FilePath::FromUTF8Unsafe(entry.base_name())); + const base::FilePath current_path = parent_path.Append( + base::FilePath::FromUTF8Unsafe(entry.base_name())); // Skip the hosted document if "hide hosted documents" setting is // enabled. if (hide_hosted_documents && diff --git a/chrome/browser/chromeos/drive/search_metadata.h b/chrome/browser/chromeos/drive/search_metadata.h index 2012f01..9cb7beb 100644 --- a/chrome/browser/chromeos/drive/search_metadata.h +++ b/chrome/browser/chromeos/drive/search_metadata.h @@ -14,7 +14,7 @@ namespace drive { // Struct to represent a search result for SearchMetadata(). struct MetadataSearchResult { - MetadataSearchResult(const FilePath& in_path, + MetadataSearchResult(const base::FilePath& in_path, const DriveEntryProto& in_entry_proto, const std::string& in_highlighted_base_name) : path(in_path), @@ -23,7 +23,7 @@ struct MetadataSearchResult { } // The two members are used to create FileEntry object. - FilePath path; + base::FilePath path; DriveEntryProto entry_proto; // The base name to be displayed in the UI. The parts matched the search diff --git a/chrome/browser/chromeos/drive/search_metadata_unittest.cc b/chrome/browser/chromeos/drive/search_metadata_unittest.cc index 6c4b2a4..20a86d8 100644 --- a/chrome/browser/chromeos/drive/search_metadata_unittest.cc +++ b/chrome/browser/chromeos/drive/search_metadata_unittest.cc @@ -89,9 +89,8 @@ TEST_F(SearchMetadataTest, SearchMetadata_RegularFile) { google_apis::test_util::RunBlockingPoolTask(); EXPECT_EQ(DRIVE_FILE_OK, error); ASSERT_EQ(1U, result->size()); - EXPECT_EQ( - FilePath::FromUTF8Unsafe("drive/Directory 1/SubDirectory File 1.txt"), - result->at(0).path); + EXPECT_EQ(base::FilePath::FromUTF8Unsafe( + "drive/Directory 1/SubDirectory File 1.txt"), result->at(0).path); } // This test checks if |FindAndHighlight| does case-insensitive search. @@ -111,9 +110,8 @@ TEST_F(SearchMetadataTest, SearchMetadata_CaseInsensitiveSearch) { google_apis::test_util::RunBlockingPoolTask(); EXPECT_EQ(DRIVE_FILE_OK, error); ASSERT_EQ(1U, result->size()); - EXPECT_EQ( - FilePath::FromUTF8Unsafe("drive/Directory 1/SubDirectory File 1.txt"), - result->at(0).path); + EXPECT_EQ(base::FilePath::FromUTF8Unsafe( + "drive/Directory 1/SubDirectory File 1.txt"), result->at(0).path); } TEST_F(SearchMetadataTest, SearchMetadata_RegularFiles) { @@ -139,12 +137,11 @@ TEST_F(SearchMetadataTest, SearchMetadata_RegularFiles) { // All base names should contain "File". EXPECT_EQ( - FilePath::FromUTF8Unsafe( + base::FilePath::FromUTF8Unsafe( "drive/Slash \xE2\x88\x95 in directory/Slash SubDir File.txt"), result->at(0).path); - EXPECT_EQ( - FilePath::FromUTF8Unsafe("drive/Directory 1/SubDirectory File 1.txt"), - result->at(1).path); + EXPECT_EQ(base::FilePath::FromUTF8Unsafe( + "drive/Directory 1/SubDirectory File 1.txt"), result->at(1).path); } TEST_F(SearchMetadataTest, SearchMetadata_AtMostOneFile) { @@ -164,7 +161,7 @@ TEST_F(SearchMetadataTest, SearchMetadata_AtMostOneFile) { EXPECT_EQ(DRIVE_FILE_OK, error); ASSERT_EQ(1U, result->size()); EXPECT_EQ( - FilePath::FromUTF8Unsafe( + base::FilePath::FromUTF8Unsafe( "drive/Slash \xE2\x88\x95 in directory/Slash SubDir File.txt"), result->at(0).path); } @@ -184,7 +181,7 @@ TEST_F(SearchMetadataTest, SearchMetadata_Directory) { EXPECT_EQ(DRIVE_FILE_OK, error); ASSERT_EQ(1U, result->size()); EXPECT_EQ( - FilePath::FromUTF8Unsafe("drive/Directory 1"), + base::FilePath::FromUTF8Unsafe("drive/Directory 1"), result->at(0).path); } @@ -203,7 +200,7 @@ TEST_F(SearchMetadataTest, SearchMetadata_HostedDocument) { EXPECT_EQ(DRIVE_FILE_OK, error); ASSERT_EQ(1U, result->size()); - EXPECT_EQ(FilePath::FromUTF8Unsafe("drive/Document 1.gdoc"), + EXPECT_EQ(base::FilePath::FromUTF8Unsafe("drive/Document 1.gdoc"), result->at(0).path); } diff --git a/chrome/browser/chromeos/drive/stale_cache_files_remover.cc b/chrome/browser/chromeos/drive/stale_cache_files_remover.cc index f444707..a6fb378 100644 --- a/chrome/browser/chromeos/drive/stale_cache_files_remover.cc +++ b/chrome/browser/chromeos/drive/stale_cache_files_remover.cc @@ -69,7 +69,7 @@ void StaleCacheFilesRemover::RemoveCacheIfNecessary( const std::string& resource_id, const std::string& cache_md5, DriveFileError error, - const FilePath& drive_file_path, + const base::FilePath& drive_file_path, scoped_ptr<DriveEntryProto> entry_proto) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); diff --git a/chrome/browser/chromeos/drive/stale_cache_files_remover.h b/chrome/browser/chromeos/drive/stale_cache_files_remover.h index 5c34328..d3f4350 100644 --- a/chrome/browser/chromeos/drive/stale_cache_files_remover.h +++ b/chrome/browser/chromeos/drive/stale_cache_files_remover.h @@ -46,7 +46,7 @@ class StaleCacheFilesRemover : public DriveFileSystemObserver { const std::string& resource_id, const std::string& cache_md5, DriveFileError error, - const FilePath& drive_file_path, + const base::FilePath& drive_file_path, scoped_ptr<DriveEntryProto> entry_proto); DriveCache* cache_; // Not owned. diff --git a/chrome/browser/chromeos/drive/stale_cache_files_remover_unittest.cc b/chrome/browser/chromeos/drive/stale_cache_files_remover_unittest.cc index fabff76..f6e2f57 100644 --- a/chrome/browser/chromeos/drive/stale_cache_files_remover_unittest.cc +++ b/chrome/browser/chromeos/drive/stale_cache_files_remover_unittest.cc @@ -133,7 +133,7 @@ class StaleCacheFilesRemoverTest : public testing::Test { }; TEST_F(StaleCacheFilesRemoverTest, RemoveStaleCacheFiles) { - FilePath dummy_file = + base::FilePath dummy_file = google_apis::test_util::GetTestFilePath("gdata/root_feed.json"); std::string resource_id("pdf:1a2b3c"); std::string md5("abcdef0123456789"); @@ -149,13 +149,13 @@ TEST_F(StaleCacheFilesRemoverTest, RemoveStaleCacheFiles) { EXPECT_EQ(DRIVE_FILE_OK, error); // Verify that the cache file exists. - FilePath path = cache_->GetCacheFilePath(resource_id, + base::FilePath path = cache_->GetCacheFilePath(resource_id, md5, DriveCache::CACHE_TYPE_TMP, DriveCache::CACHED_FILE_FROM_SERVER); EXPECT_TRUE(file_util::PathExists(path)); - FilePath unused; + base::FilePath unused; scoped_ptr<DriveEntryProto> entry_proto; file_system_->GetEntryInfoByResourceId( resource_id, diff --git a/chrome/browser/chromeos/enterprise_extension_observer.cc b/chrome/browser/chromeos/enterprise_extension_observer.cc index 63ac62e..add3b7f 100644 --- a/chrome/browser/chromeos/enterprise_extension_observer.cc +++ b/chrome/browser/chromeos/enterprise_extension_observer.cc @@ -50,7 +50,7 @@ void EnterpriseExtensionObserver::Observe( // static void EnterpriseExtensionObserver::CheckExtensionAndNotifyEntd( - const FilePath& path) { + const base::FilePath& path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); if (file_util::PathExists( path.Append(FILE_PATH_LITERAL("isa-cros-policy")))) { diff --git a/chrome/browser/chromeos/extensions/default_app_order.cc b/chrome/browser/chromeos/extensions/default_app_order.cc index 3d3e06a..d9acdc5 100644 --- a/chrome/browser/chromeos/extensions/default_app_order.cc +++ b/chrome/browser/chromeos/extensions/default_app_order.cc @@ -26,7 +26,7 @@ ExternalLoader* loader_instance = NULL; // Reads external ordinal json file and returned the parsed value. Returns NULL // if the file does not exist or could not be parsed properly. Caller takes // ownership of the returned value. -base::ListValue* ReadExternalOrdinalFile(const FilePath& path) { +base::ListValue* ReadExternalOrdinalFile(const base::FilePath& path) { if (!file_util::PathExists(path)) return NULL; @@ -108,7 +108,7 @@ const std::vector<std::string>& ExternalLoader::GetAppIds() { } void ExternalLoader::Load() { - FilePath ordinals_file; + base::FilePath ordinals_file; CHECK(PathService::Get(chrome::FILE_DEFAULT_APP_ORDER, &ordinals_file)); scoped_ptr<base::ListValue> ordinals_value( diff --git a/chrome/browser/chromeos/extensions/default_app_order_unittest.cc b/chrome/browser/chromeos/extensions/default_app_order_unittest.cc index 56d1a56..73ada42 100644 --- a/chrome/browser/chromeos/extensions/default_app_order_unittest.cc +++ b/chrome/browser/chromeos/extensions/default_app_order_unittest.cc @@ -20,7 +20,7 @@ namespace chromeos { namespace { -const FilePath::CharType kTestFile[] = +const base::FilePath::CharType kTestFile[] = FILE_PATH_LITERAL("test_default_app_order.json"); } @@ -48,14 +48,14 @@ class DefaultAppOrderTest : public testing::Test { return true; } - void SetExternalFile(const FilePath& path) { + void SetExternalFile(const base::FilePath& path) { path_override_.reset(new base::ScopedPathOverride( chrome::FILE_DEFAULT_APP_ORDER, path)); } void CreateExternalOrderFile(const std::string& content) { ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); - FilePath external_file = temp_dir_.path().Append(kTestFile); + base::FilePath external_file = temp_dir_.path().Append(kTestFile); file_util::WriteFile(external_file, content.c_str(), content.size()); SetExternalFile(external_file); } @@ -95,7 +95,7 @@ TEST_F(DefaultAppOrderTest, ExternalOrder) { // Tests none-existent order file gives built-in default. TEST_F(DefaultAppOrderTest, NoExternalFile) { - SetExternalFile(FilePath(FILE_PATH_LITERAL("none_existent_file"))); + SetExternalFile(base::FilePath(FILE_PATH_LITERAL("none_existent_file"))); scoped_ptr<default_app_order::ExternalLoader> loader( new default_app_order::ExternalLoader(false)); diff --git a/chrome/browser/chromeos/extensions/echo_private_api.cc b/chrome/browser/chromeos/extensions/echo_private_api.cc index 51f195d..84986a0 100644 --- a/chrome/browser/chromeos/extensions/echo_private_api.cc +++ b/chrome/browser/chromeos/extensions/echo_private_api.cc @@ -87,7 +87,7 @@ bool GetOobeTimestampFunction::GetOobeTimestampOnFileThread() { const char kOobeTimestampFile[] = "/home/chronos/.oobe_completed"; std::string timestamp = ""; base::PlatformFileInfo fileInfo; - if (file_util::GetFileInfo(FilePath(kOobeTimestampFile), &fileInfo)) { + if (file_util::GetFileInfo(base::FilePath(kOobeTimestampFile), &fileInfo)) { base::Time::Exploded ctime; fileInfo.creation_time.UTCExplode(&ctime); timestamp += base::StringPrintf("%u-%u-%u", diff --git a/chrome/browser/chromeos/extensions/external_filesystem_apitest.cc b/chrome/browser/chromeos/extensions/external_filesystem_apitest.cc index f4b4262..e4e1c53 100644 --- a/chrome/browser/chromeos/extensions/external_filesystem_apitest.cc +++ b/chrome/browser/chromeos/extensions/external_filesystem_apitest.cc @@ -80,7 +80,8 @@ class BackgroundObserver { }; // Creates a cache representation of the test file with predetermined content. -void CreateFileWithContent(const FilePath& path, const std::string& content) { +void CreateFileWithContent(const base::FilePath& path, + const std::string& content) { int content_size = static_cast<int>(content.length()); ASSERT_EQ(content_size, file_util::WriteFile(path, content.c_str(), content_size)); @@ -143,7 +144,7 @@ class FileSystemExtensionApiTest : public ExtensionApiTest { } protected: - FilePath mount_point_dir_; + base::FilePath mount_point_dir_; private: base::ScopedTempDir tmp_dir_; @@ -161,10 +162,10 @@ class RestrictedFileSystemExtensionApiTest : public ExtensionApiTest { // Create the mount point. file_util::CreateDirectory(mount_point_dir_); - FilePath test_dir = mount_point_dir_.Append("test_dir"); + base::FilePath test_dir = mount_point_dir_.Append("test_dir"); file_util::CreateDirectory(test_dir); - FilePath test_file = test_dir.AppendASCII("test_file.foo"); + base::FilePath test_file = test_dir.AppendASCII("test_file.foo"); CreateFileWithContent(test_file, kTestFileContent); test_file = test_dir.AppendASCII("mutable_test_file.foo"); @@ -195,7 +196,7 @@ class RestrictedFileSystemExtensionApiTest : public ExtensionApiTest { protected: base::ScopedTempDir tmp_dir_; - FilePath mount_point_dir_; + base::FilePath mount_point_dir_; }; @@ -210,7 +211,7 @@ class RemoteFileSystemExtensionApiTest : public ExtensionApiTest { // system service. This has to be done early on (before the browser is // created) because the system service instance is initialized very early // by FileBrowserEventRouter. - FilePath tmp_dir_path; + base::FilePath tmp_dir_path; PathService::Get(base::DIR_TEMP, &tmp_dir_path); ASSERT_TRUE(test_cache_root_.CreateUniqueTempDirUnderPath(tmp_dir_path)); @@ -269,7 +270,7 @@ IN_PROC_BROWSER_TEST_F(FileSystemExtensionApiTest, FileBrowserTestLazy) { #if defined(ENABLE_WEB_INTENTS) IN_PROC_BROWSER_TEST_F(FileSystemExtensionApiTest, FileBrowserWebIntentTest) { // Create a test file inside the ScopedTempDir. - FilePath test_file = mount_point_dir_.AppendASCII("text_file.xul"); + base::FilePath test_file = mount_point_dir_.AppendASCII("text_file.xul"); CreateFileWithContent(test_file, kTestFileContent); ASSERT_TRUE(RunFileBrowserHandlerTest("intent.html#/tmp/text_file.xul", diff --git a/chrome/browser/chromeos/extensions/file_browser_event_router.cc b/chrome/browser/chromeos/extensions/file_browser_event_router.cc index 1ea5f47..921be57 100644 --- a/chrome/browser/chromeos/extensions/file_browser_event_router.cc +++ b/chrome/browser/chromeos/extensions/file_browser_event_router.cc @@ -93,7 +93,7 @@ const char* MountErrorToString(chromeos::MountError error) { void RelayFileWatcherCallbackToUIThread( const base::FilePathWatcher::Callback& callback, - const FilePath& local_path, + const base::FilePath& local_path, bool got_error) { BrowserThread::PostTask( BrowserThread::UI, FROM_HERE, @@ -264,13 +264,13 @@ void FileBrowserEventRouter::ObserveFileSystemEvents() { // File watch setup routines. bool FileBrowserEventRouter::AddFileWatch( - const FilePath& local_path, - const FilePath& virtual_path, + const base::FilePath& local_path, + const base::FilePath& virtual_path, const std::string& extension_id) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); base::AutoLock lock(lock_); - FilePath watch_path = local_path; + base::FilePath watch_path = local_path; bool is_remote_watch = false; // Tweak watch path for remote sources - we need to drop leading /special // directory from there in order to be able to pair these events with @@ -302,12 +302,12 @@ bool FileBrowserEventRouter::AddFileWatch( } void FileBrowserEventRouter::RemoveFileWatch( - const FilePath& local_path, + const base::FilePath& local_path, const std::string& extension_id) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); base::AutoLock lock(lock_); - FilePath watch_path = local_path; + base::FilePath watch_path = local_path; // Tweak watch path for remote sources - we need to drop leading /special // directory from there in order to be able to pair these events with // their change notifications. @@ -440,7 +440,7 @@ void FileBrowserEventRouter::OnMountEvent( // when mounting failed or unmounting succeeded. if ((event == DiskMountManager::MOUNTING) != (error_code == chromeos::MOUNT_ERROR_NONE)) { - FilePath source_path(mount_info.source_path); + base::FilePath source_path(mount_info.source_path); DriveSystemService* system_service = DriveSystemServiceFactory::GetForProfile(profile_); drive::DriveCache* cache = @@ -524,7 +524,7 @@ void FileBrowserEventRouter::OnProgressUpdate( } void FileBrowserEventRouter::OnDirectoryChanged( - const FilePath& directory_path) { + const base::FilePath& directory_path) { HandleFileWatchNotification(directory_path, false); } @@ -573,7 +573,7 @@ void FileBrowserEventRouter::OnRefreshTokenInvalid() { } void FileBrowserEventRouter::HandleFileWatchNotification( - const FilePath& local_path, bool got_error) { + const base::FilePath& local_path, bool got_error) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); base::AutoLock lock(lock_); @@ -586,7 +586,7 @@ void FileBrowserEventRouter::HandleFileWatchNotification( } void FileBrowserEventRouter::DispatchDirectoryChangeEvent( - const FilePath& virtual_path, + const base::FilePath& virtual_path, bool got_error, const FileBrowserEventRouter::ExtensionUsageRegistry& extensions) { if (!profile_) { @@ -636,7 +636,7 @@ void FileBrowserEventRouter::DispatchMountEvent( // Add sourcePath to the event. mount_info_value->SetString("sourcePath", mount_info.source_path); - FilePath relative_mount_path; + base::FilePath relative_mount_path; // If there were no error or some special conditions occurred, add mountPath // to the event. @@ -648,7 +648,7 @@ void FileBrowserEventRouter::DispatchMountEvent( if (file_manager_util::ConvertFileToRelativeFileSystemPath( profile_, kFileBrowserDomain, - FilePath(mount_info.mount_path), + base::FilePath(mount_info.mount_path), &relative_mount_path)) { mount_info_value->SetString("mountPath", "/" + relative_mount_path.value()); @@ -675,7 +675,7 @@ void FileBrowserEventRouter::ShowRemovableDeviceInFileManager( // To enable Photo Import call file_manager_util::OpenActionChoiceDialog // instead. - file_manager_util::ViewRemovableDrive(FilePath(mount_path)); + file_manager_util::ViewRemovableDrive(base::FilePath(mount_path)); } void FileBrowserEventRouter::OnDiskAdded( @@ -803,7 +803,7 @@ void FileBrowserEventRouter::OnFormatCompleted( } FileBrowserEventRouter::FileWatcherExtensions::FileWatcherExtensions( - const FilePath& path, const std::string& extension_id, + const base::FilePath& path, const std::string& extension_id, bool is_remote_file_system) : ref_count_(0), is_remote_file_system_(is_remote_file_system) { @@ -859,7 +859,7 @@ FileBrowserEventRouter::FileWatcherExtensions::GetRefCount() const { return ref_count_; } -const FilePath& +const base::FilePath& FileBrowserEventRouter::FileWatcherExtensions::GetVirtualPath() const { return virtual_path_; } @@ -873,7 +873,7 @@ FileBrowserEventRouter::GetRemoteFileSystem() const { } bool FileBrowserEventRouter::FileWatcherExtensions::Watch( - const FilePath& path, + const base::FilePath& path, const base::FilePathWatcher::Callback& callback) { if (is_remote_file_system_) return true; diff --git a/chrome/browser/chromeos/extensions/file_browser_event_router.h b/chrome/browser/chromeos/extensions/file_browser_event_router.h index a5aa407..3c856e4 100644 --- a/chrome/browser/chromeos/extensions/file_browser_event_router.h +++ b/chrome/browser/chromeos/extensions/file_browser_event_router.h @@ -61,10 +61,10 @@ class FileBrowserEventRouter void ObserveFileSystemEvents(); // File watch setup routines. - bool AddFileWatch(const FilePath& file_path, - const FilePath& virtual_path, + bool AddFileWatch(const base::FilePath& file_path, + const base::FilePath& virtual_path, const std::string& extension_id); - void RemoveFileWatch(const FilePath& file_path, + void RemoveFileWatch(const base::FilePath& file_path, const std::string& extension_id); // Mounts Drive on File browser. |callback| will be called after raising a @@ -98,7 +98,8 @@ class FileBrowserEventRouter virtual void OnRefreshTokenInvalid() OVERRIDE; // drive::DriveFileSystemInterface::Observer overrides. - virtual void OnDirectoryChanged(const FilePath& directory_path) OVERRIDE; + virtual void OnDirectoryChanged( + const base::FilePath& directory_path) OVERRIDE; virtual void OnResourceListFetched(int num_accumulated_entries) OVERRIDE; virtual void OnFileSystemMounted() OVERRIDE; virtual void OnFileSystemBeingUnmounted() OVERRIDE; @@ -111,7 +112,7 @@ class FileBrowserEventRouter class FileWatcherExtensions { public: - FileWatcherExtensions(const FilePath& path, + FileWatcherExtensions(const base::FilePath& path, const std::string& extension_id, bool is_remote_file_system); @@ -125,21 +126,21 @@ class FileBrowserEventRouter unsigned int GetRefCount() const; - const FilePath& GetVirtualPath() const; + const base::FilePath& GetVirtualPath() const; - bool Watch(const FilePath& path, + bool Watch(const base::FilePath& path, const base::FilePathWatcher::Callback& callback); private: linked_ptr<base::FilePathWatcher> file_watcher_; - FilePath local_path_; - FilePath virtual_path_; + base::FilePath local_path_; + base::FilePath virtual_path_; ExtensionUsageRegistry extensions_; unsigned int ref_count_; bool is_remote_file_system_; }; - typedef std::map<FilePath, FileWatcherExtensions*> WatcherMap; + typedef std::map<base::FilePath, FileWatcherExtensions*> WatcherMap; explicit FileBrowserEventRouter(Profile* profile); virtual ~FileBrowserEventRouter(); @@ -162,11 +163,11 @@ class FileBrowserEventRouter void OnFileBrowserPrefsChanged(); // Process file watch notifications. - void HandleFileWatchNotification(const FilePath& path, + void HandleFileWatchNotification(const base::FilePath& path, bool got_error); // Sends directory change event. - void DispatchDirectoryChangeEvent(const FilePath& path, bool error, + void DispatchDirectoryChangeEvent(const base::FilePath& path, bool error, const ExtensionUsageRegistry& extensions); void DispatchMountEvent( diff --git a/chrome/browser/chromeos/extensions/file_browser_handler_api.cc b/chrome/browser/chromeos/extensions/file_browser_handler_api.cc index 4e287ed..977d0c5 100644 --- a/chrome/browser/chromeos/extensions/file_browser_handler_api.cc +++ b/chrome/browser/chromeos/extensions/file_browser_handler_api.cc @@ -76,12 +76,12 @@ ui::SelectFileDialog::FileTypeInfo ConvertExtensionsToFileTypeInfo( ui::SelectFileDialog::FileTypeInfo file_type_info; for (size_t i = 0; i < extensions.size(); ++i) { - FilePath::StringType allowed_extension = - FilePath::FromUTF8Unsafe(extensions[i]).value(); + base::FilePath::StringType allowed_extension = + base::FilePath::FromUTF8Unsafe(extensions[i]).value(); // FileTypeInfo takes a nested vector like [["htm", "html"], ["txt"]] to // group equivalent extensions, but we don't use this feature here. - std::vector<FilePath::StringType> inner_vector; + std::vector<base::FilePath::StringType> inner_vector; inner_vector.push_back(allowed_extension); file_type_info.extensions.push_back(inner_vector); } @@ -116,16 +116,16 @@ class FileSelectorImpl : public FileSelector, // deleted by the caller. It will delete itself after it receives response // from SelectFielDialog. virtual void SelectFile( - const FilePath& suggested_name, + const base::FilePath& suggested_name, const std::vector<std::string>& allowed_extensions, Browser* browser, FileBrowserHandlerInternalSelectFileFunction* function) OVERRIDE; // ui::SelectFileDialog::Listener overrides. - virtual void FileSelected(const FilePath& path, + virtual void FileSelected(const base::FilePath& path, int index, void* params) OVERRIDE; - virtual void MultiFilesSelected(const std::vector<FilePath>& files, + virtual void MultiFilesSelected(const std::vector<base::FilePath>& files, void* params) OVERRIDE; virtual void FileSelectionCanceled(void* params) OVERRIDE; @@ -139,7 +139,7 @@ class FileSelectorImpl : public FileSelector, // // Returns boolean indicating whether the dialog has been successfully shown // to the user. - bool StartSelectFile(const FilePath& suggested_name, + bool StartSelectFile(const base::FilePath& suggested_name, const std::vector<std::string>& allowed_extensions, Browser* browser); @@ -149,7 +149,7 @@ class FileSelectorImpl : public FileSelector, // |success| indicates whether user has selectd the file. // |selected_path| is path that was selected. It is empty if the file wasn't // selected. - void SendResponse(bool success, const FilePath& selected_path); + void SendResponse(bool success, const base::FilePath& selected_path); // Dialog that is shown by selector. scoped_refptr<ui::SelectFileDialog> dialog_; @@ -167,11 +167,11 @@ FileSelectorImpl::~FileSelectorImpl() { dialog_->ListenerDestroyed(); // Send response if needed. if (function_) - SendResponse(false, FilePath()); + SendResponse(false, base::FilePath()); } void FileSelectorImpl::SelectFile( - const FilePath& suggested_name, + const base::FilePath& suggested_name, const std::vector<std::string>& allowed_extensions, Browser* browser, FileBrowserHandlerInternalSelectFileFunction* function) { @@ -189,7 +189,7 @@ void FileSelectorImpl::SelectFile( } bool FileSelectorImpl::StartSelectFile( - const FilePath& suggested_name, + const base::FilePath& suggested_name, const std::vector<std::string>& allowed_extensions, Browser* browser) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); @@ -224,13 +224,13 @@ bool FileSelectorImpl::StartSelectFile( } void FileSelectorImpl::FileSelected( - const FilePath& path, int index, void* params) { + const base::FilePath& path, int index, void* params) { SendResponse(true, path); delete this; } void FileSelectorImpl::MultiFilesSelected( - const std::vector<FilePath>& files, + const std::vector<base::FilePath>& files, void* params) { // Only single file should be selected in save-as dialog. NOTREACHED(); @@ -238,12 +238,12 @@ void FileSelectorImpl::MultiFilesSelected( void FileSelectorImpl::FileSelectionCanceled( void* params) { - SendResponse(false, FilePath()); + SendResponse(false, base::FilePath()); delete this; } void FileSelectorImpl::SendResponse(bool success, - const FilePath& selected_path) { + const base::FilePath& selected_path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); // We don't want to send multiple responses. @@ -307,7 +307,7 @@ FileBrowserHandlerInternalSelectFileFunction:: bool FileBrowserHandlerInternalSelectFileFunction::RunImpl() { scoped_ptr<SelectFile::Params> params(SelectFile::Params::Create(*args_)); - FilePath suggested_name(params->selection_params.suggested_name); + base::FilePath suggested_name(params->selection_params.suggested_name); std::vector<std::string> allowed_extensions; if (params->selection_params.allowed_file_extensions.get()) allowed_extensions = *params->selection_params.allowed_file_extensions; @@ -327,7 +327,7 @@ bool FileBrowserHandlerInternalSelectFileFunction::RunImpl() { void FileBrowserHandlerInternalSelectFileFunction::OnFilePathSelected( bool success, - const FilePath& full_path) { + const base::FilePath& full_path) { if (!success) { Respond(false); return; diff --git a/chrome/browser/chromeos/extensions/file_browser_handler_api.h b/chrome/browser/chromeos/extensions/file_browser_handler_api.h index bcc10f2..565cf32 100644 --- a/chrome/browser/chromeos/extensions/file_browser_handler_api.h +++ b/chrome/browser/chromeos/extensions/file_browser_handler_api.h @@ -49,7 +49,7 @@ class FileSelector { // The interface implementation should delete itself after the extension // function is notified of file selection result. virtual void SelectFile( - const FilePath& suggested_name, + const base::FilePath& suggested_name, const std::vector<std::string>& allowed_extensions, Browser* browser, FileBrowserHandlerInternalSelectFileFunction* function) = 0; @@ -92,7 +92,7 @@ class FileBrowserHandlerInternalSelectFileFunction // |success| Whether the path was selected. // |full_path| The selected file path if one was selected. It is ignored if // the selection did not succeed. - void OnFilePathSelected(bool success, const FilePath& full_path); + void OnFilePathSelected(bool success, const base::FilePath& full_path); protected: // The class is ref counted, so destructor should not be public. @@ -141,9 +141,9 @@ class FileBrowserHandlerInternalSelectFileFunction bool user_gesture_check_enabled_; // Full file system path of the selected file. - FilePath full_path_; + base::FilePath full_path_; // Selected file's virtual path in extension function caller's file system. - FilePath virtual_path_; + base::FilePath virtual_path_; // Extension function caller's file system name. std::string file_system_name_; // Extension function caller's file system root URL. @@ -151,7 +151,7 @@ class FileBrowserHandlerInternalSelectFileFunction // List of permissions and paths that have to be granted for the selected // files. - std::vector<std::pair<FilePath, int> > permissions_to_grant_; + std::vector<std::pair<base::FilePath, int> > permissions_to_grant_; DECLARE_EXTENSION_FUNCTION("fileBrowserHandlerInternal.selectFile", FILEBROWSERHANDLERINTERNAL_SELECTFILE) diff --git a/chrome/browser/chromeos/extensions/file_browser_handler_api_test.cc b/chrome/browser/chromeos/extensions/file_browser_handler_api_test.cc index d05e1c9..2ff20d1 100644 --- a/chrome/browser/chromeos/extensions/file_browser_handler_api_test.cc +++ b/chrome/browser/chromeos/extensions/file_browser_handler_api_test.cc @@ -34,10 +34,10 @@ namespace { // Data that defines FileSelector behaviour in each test case. struct TestCase { - TestCase(const FilePath& suggested_name, + TestCase(const base::FilePath& suggested_name, const std::vector<std::string>& allowed_extensions, bool success, - const FilePath& selected_path) + const base::FilePath& selected_path) : suggested_name(suggested_name), allowed_extensions(allowed_extensions), success(success), @@ -46,7 +46,7 @@ struct TestCase { ~TestCase() {} // Path that we expect to be suggested to the file selector. - FilePath suggested_name; + base::FilePath suggested_name; // Extensions that we expect to be allowed to the file selector. std::vector<std::string> allowed_extensions; @@ -54,12 +54,12 @@ struct TestCase { // Whether file selector should fail. bool success; // The path file selector should return back to the function. - FilePath selected_path; + base::FilePath selected_path; }; // Checks that file under path |selected_path| contains |expected_contents|. // Must be called on the file thread. -void ExpectFileContentEquals(const FilePath& selected_path, +void ExpectFileContentEquals(const base::FilePath& selected_path, const std::string& expected_contents) { std::string test_file_contents; ASSERT_TRUE(file_util::ReadFileToString(selected_path, &test_file_contents)); @@ -72,10 +72,10 @@ void ExpectFileContentEquals(const FilePath& selected_path, // results. class MockFileSelector : public file_handler::FileSelector { public: - MockFileSelector(const FilePath& suggested_name, + MockFileSelector(const base::FilePath& suggested_name, const std::vector<std::string>& allowed_extensions, bool success, - const FilePath& selected_path) + const base::FilePath& selected_path) : suggested_name_(suggested_name), allowed_extensions_(allowed_extensions), success_(success), @@ -86,7 +86,7 @@ class MockFileSelector : public file_handler::FileSelector { // file_handler::FileSelector implementation. // |browser| is not used. virtual void SelectFile( - const FilePath& suggested_name, + const base::FilePath& suggested_name, const std::vector<std::string>& allowed_extensions, Browser* browser, FileBrowserHandlerInternalSelectFileFunction* function) OVERRIDE { @@ -111,7 +111,7 @@ class MockFileSelector : public file_handler::FileSelector { private: // File name that is expected to be suggested by the function. - FilePath suggested_name_; + base::FilePath suggested_name_; // Extensions that is expected to be allowed by the function. std::vector<std::string> allowed_extensions_; @@ -119,7 +119,7 @@ class MockFileSelector : public file_handler::FileSelector { // Whether the selection should succeed. bool success_; // File path that should be returned to the function. - FilePath selected_path_; + base::FilePath selected_path_; DISALLOW_COPY_AND_ASSIGN(MockFileSelector); }; @@ -147,13 +147,13 @@ class MockFileSelectorFactory : public file_handler::FileSelectorFactory { private: // File name that is expected to be suggested by the function. - FilePath suggested_name_; + base::FilePath suggested_name_; // Extensions that is expected to be allowed by the function. std::vector<std::string> allowed_extensions_; // Whether the selection should succeed. bool success_; // File path that should be returned to the function. - FilePath selected_path_; + base::FilePath selected_path_; DISALLOW_COPY_AND_ASSIGN(MockFileSelectorFactory); }; @@ -165,7 +165,7 @@ class FileBrowserHandlerExtensionTest : public ExtensionApiTest { // Create mount point directory that will be used in the test. // Mount point will be called "tmp", and it will be located in a tmp // directory with an unique name. - FilePath tmp_dir_path; + base::FilePath tmp_dir_path; PathService::Get(base::DIR_TEMP, &tmp_dir_path); ASSERT_TRUE(scoped_tmp_dir_.CreateUniqueTempDirUnderPath(tmp_dir_path)); tmp_mount_point_ = scoped_tmp_dir_.path().Append("tmp"); @@ -182,7 +182,8 @@ class FileBrowserHandlerExtensionTest : public ExtensionApiTest { tmp_mount_point_); } - FilePath GetFullPathOnTmpMountPoint(const FilePath& relative_path) { + base::FilePath GetFullPathOnTmpMountPoint( + const base::FilePath& relative_path) { return tmp_mount_point_.Append(relative_path); } @@ -224,7 +225,7 @@ class FileBrowserHandlerExtensionTest : public ExtensionApiTest { base::ScopedTempDir scoped_tmp_dir_; // Our test mount point path. - FilePath tmp_mount_point_; + base::FilePath tmp_mount_point_; }; const std::vector<TestCase>* FileBrowserHandlerExtensionTest::test_cases_ = @@ -241,8 +242,8 @@ size_t FileBrowserHandlerExtensionTest::current_test_case_ = 0; // create, read and write the file under the selected file path. IN_PROC_BROWSER_TEST_F(FileBrowserHandlerExtensionTest, EndToEnd) { // Path that will be "selected" by file selector. - const FilePath selected_path = - GetFullPathOnTmpMountPoint(FilePath("test_file.txt")); + const base::FilePath selected_path = + GetFullPathOnTmpMountPoint(base::FilePath("test_file.txt")); std::vector<std::string> allowed_extensions; allowed_extensions.push_back("txt"); @@ -250,15 +251,15 @@ IN_PROC_BROWSER_TEST_F(FileBrowserHandlerExtensionTest, EndToEnd) { std::vector<TestCase> test_cases; test_cases.push_back( - TestCase(FilePath("some_file_name.txt"), + TestCase(base::FilePath("some_file_name.txt"), allowed_extensions, true, selected_path)); test_cases.push_back( - TestCase(FilePath("fail"), + TestCase(base::FilePath("fail"), std::vector<std::string>(), false, - FilePath())); + base::FilePath())); SetTestCases(&test_cases); @@ -322,10 +323,10 @@ IN_PROC_BROWSER_TEST_F(FileBrowserHandlerExtensionTest, NoUserGesture) { // dictionary with |success == false| and no file entry when user cancels file // selection. IN_PROC_BROWSER_TEST_F(FileBrowserHandlerExtensionTest, SelectionFailed) { - TestCase test_case(FilePath("some_file_name.txt"), + TestCase test_case(base::FilePath("some_file_name.txt"), std::vector<std::string>(), false, - FilePath()); + base::FilePath()); scoped_refptr<FileBrowserHandlerInternalSelectFileFunction> select_file_function( @@ -351,10 +352,10 @@ IN_PROC_BROWSER_TEST_F(FileBrowserHandlerExtensionTest, SelectionFailed) { // only a file name (i.e. that extension function caller has no influence on // which directory contents will be initially displayed in selection dialog). IN_PROC_BROWSER_TEST_F(FileBrowserHandlerExtensionTest, SuggestedFullPath) { - TestCase test_case(FilePath("some_file_name.txt"), + TestCase test_case(base::FilePath("some_file_name.txt"), std::vector<std::string>(), false, - FilePath()); + base::FilePath()); scoped_refptr<FileBrowserHandlerInternalSelectFileFunction> select_file_function( diff --git a/chrome/browser/chromeos/extensions/file_browser_private_api.cc b/chrome/browser/chromeos/extensions/file_browser_private_api.cc index 43c255a..a9fee5f 100644 --- a/chrome/browser/chromeos/extensions/file_browser_private_api.cc +++ b/chrome/browser/chromeos/extensions/file_browser_private_api.cc @@ -154,9 +154,10 @@ base::DictionaryValue* CreateValueFromDisk( std::string mount_path; if (!volume->mount_path().empty()) { - FilePath relative_mount_path; - file_manager_util::ConvertFileToRelativeFileSystemPath(profile, - extension_id, FilePath(volume->mount_path()), &relative_mount_path); + base::FilePath relative_mount_path; + file_manager_util::ConvertFileToRelativeFileSystemPath( + profile, extension_id, base::FilePath(volume->mount_path()), + &relative_mount_path); mount_path = relative_mount_path.value(); } @@ -189,13 +190,13 @@ base::DictionaryValue* CreateValueFromMountPoint(Profile* profile, mount_point_info.mount_type)); mount_info->SetString("sourcePath", mount_point_info.source_path); - FilePath relative_mount_path; + base::FilePath relative_mount_path; // Convert mount point path to relative path with the external file system // exposed within File API. if (file_manager_util::ConvertFileToRelativeFileSystemPath( profile, extension_id, - FilePath(mount_point_info.mount_path), + base::FilePath(mount_point_info.mount_path), &relative_mount_path)) { mount_info->SetString("mountPath", relative_mount_path.value()); } @@ -209,7 +210,7 @@ base::DictionaryValue* CreateValueFromMountPoint(Profile* profile, // Gives the extension renderer |host| file |permissions| for the given |path|. void GrantFilePermissionsToHost(content::RenderViewHost* host, - const FilePath& path, + const base::FilePath& path, int permissions) { ChildProcessSecurityPolicy::GetInstance()->GrantPermissionsForFile( host->GetProcess()->GetID(), path, permissions); @@ -226,7 +227,7 @@ void AddDriveMountPoint( if (!provider) return; - const FilePath mount_point = drive::util::GetDriveMountPointPath(); + const base::FilePath mount_point = drive::util::GetDriveMountPointPath(); if (!render_view_host || !render_view_host->GetProcess()) return; @@ -258,7 +259,7 @@ void AddDriveMountPoint( drive::DriveCache::CACHE_TYPE_PERSISTENT), file_handler_util::GetReadOnlyPermissions()); - FilePath mount_point_virtual; + base::FilePath mount_point_virtual; if (provider->GetVirtualPath(mount_point, &mount_point_virtual)) provider->GrantFileAccessToExtension(extension_id, mount_point_virtual); } @@ -347,11 +348,11 @@ void GetSizeStatsOnFileThread(const std::string& mount_path, // isn't of the type CrosMountPointProvider handles, return an empty FilePath. // // Virtual paths will look like "Downloads/foo/bar.txt" or "drive/foo/bar.txt". -FilePath GetVirtualPathFromURL(fileapi::FileSystemContext* context, - const GURL& url) { +base::FilePath GetVirtualPathFromURL(fileapi::FileSystemContext* context, + const GURL& url) { fileapi::FileSystemURL filesystem_url(context->CrackURL(url)); if (!chromeos::CrosMountPointProvider::CanHandleURL(filesystem_url)) - return FilePath(); + return base::FilePath(); return filesystem_url.virtual_path(); } @@ -360,11 +361,11 @@ FilePath GetVirtualPathFromURL(fileapi::FileSystemContext* context, // // Local paths will look like "/home/chronos/user/Downloads/foo/bar.txt" or // "/special/drive/foo/bar.txt". -FilePath GetLocalPathFromURL(fileapi::FileSystemContext* context, - const GURL& url) { +base::FilePath GetLocalPathFromURL(fileapi::FileSystemContext* context, + const GURL& url) { fileapi::FileSystemURL filesystem_url(context->CrackURL(url)); if (!chromeos::CrosMountPointProvider::CanHandleURL(filesystem_url)) - return FilePath(); + return base::FilePath(); return filesystem_url.path(); } @@ -464,11 +465,11 @@ void FillDriveFilePropertiesValue( file_specific_info.content_mime_type()); } -void GetMimeTypesForFileURLs(const std::vector<FilePath>& file_paths, +void GetMimeTypesForFileURLs(const std::vector<base::FilePath>& file_paths, std::set<std::string>* mime_types) { - for (std::vector<FilePath>::const_iterator iter = file_paths.begin(); + for (std::vector<base::FilePath>::const_iterator iter = file_paths.begin(); iter != file_paths.end(); ++iter) { - const FilePath::StringType file_extension = + const base::FilePath::StringType file_extension = StringToLowerASCII(iter->Extension()); // TODO(thorogood): Rearchitect this call so it can run on the File thread; @@ -584,7 +585,7 @@ class RequestLocalFileSystemFunction::LocalFileSystemCallbackDispatcher { // Grant R/W file permissions to the renderer hosting component // extension for all paths exposed by our local file system provider. - std::vector<FilePath> root_dirs = provider->GetRootDirectories(); + std::vector<base::FilePath> root_dirs = provider->GetRootDirectories(); for (size_t i = 0; i < root_dirs.size(); ++i) { ChildProcessSecurityPolicy::GetInstance()->GrantPermissionsForFile( child_id_, root_dirs[i], @@ -757,8 +758,8 @@ bool FileWatchBrowserFunctionBase::RunImpl() { void FileWatchBrowserFunctionBase::RunFileWatchOperationOnFileThread( scoped_refptr<FileBrowserEventRouter> event_router, const FileSystemURL& file_url, const std::string& extension_id) { - FilePath local_path = file_url.path(); - FilePath virtual_path = file_url.virtual_path(); + base::FilePath local_path = file_url.path(); + base::FilePath virtual_path = file_url.virtual_path(); bool result = !local_path.empty() && PerformFileWatchOperation( event_router, local_path, virtual_path, extension_id); @@ -770,14 +771,14 @@ void FileWatchBrowserFunctionBase::RunFileWatchOperationOnFileThread( bool AddFileWatchBrowserFunction::PerformFileWatchOperation( scoped_refptr<FileBrowserEventRouter> event_router, - const FilePath& local_path, const FilePath& virtual_path, + const base::FilePath& local_path, const base::FilePath& virtual_path, const std::string& extension_id) { return event_router->AddFileWatch(local_path, virtual_path, extension_id); } bool RemoveFileWatchBrowserFunction::PerformFileWatchOperation( scoped_refptr<FileBrowserEventRouter> event_router, - const FilePath& local_path, const FilePath& unused, + const base::FilePath& local_path, const base::FilePath& unused, const std::string& extension_id) { event_router->RemoveFileWatch(local_path, extension_id); return true; @@ -944,7 +945,7 @@ bool GetFileTasksFileBrowserFunction::FindDriveAppTasks( } bool GetFileTasksFileBrowserFunction::FindAppTasks( - const std::vector<FilePath>& file_paths, + const std::vector<base::FilePath>& file_paths, ListValue* result_list) { DCHECK(!file_paths.empty()); ExtensionService* service = profile_->GetExtensionService(); @@ -1002,7 +1003,7 @@ bool GetFileTasksFileBrowserFunction::FindAppTasks( // Find Web Intent platform apps that support the View task, and add them to // the |result_list|. These will be marked as kTaskWebIntent. bool GetFileTasksFileBrowserFunction::FindWebIntentTasks( - const std::vector<FilePath>& file_paths, + const std::vector<base::FilePath>& file_paths, ListValue* result_list) { DCHECK(!file_paths.empty()); ExtensionService* service = profile_->GetExtensionService(); @@ -1077,7 +1078,7 @@ bool GetFileTasksFileBrowserFunction::RunImpl() { // file paths. FileInfoList info_list; std::vector<GURL> file_urls; - std::vector<FilePath> file_paths; + std::vector<base::FilePath> file_paths; for (size_t i = 0; i < files_list->GetSize(); ++i) { FileInfo info; std::string file_url_str; @@ -1377,7 +1378,7 @@ void FileBrowserFunction::GetLocalPathsOnFileThread( size_t len = file_urls.size(); selected_files.reserve(len); for (size_t i = 0; i < len; ++i) { - FilePath local_path; + base::FilePath local_path; const GURL& file_url = file_urls[i]; // If "localPath" parameter is set, use it as the real path. @@ -1399,7 +1400,7 @@ void FileBrowserFunction::GetLocalPathsOnFileThread( const std::string unescaped_value = net::UnescapeURLComponent(parameters[i].second, kUnescapeRuleForQueryParameters); - local_path = FilePath::FromUTF8Unsafe(unescaped_value); + local_path = base::FilePath::FromUTF8Unsafe(unescaped_value); break; } } @@ -1476,11 +1477,11 @@ bool ViewFilesFunction::RunImpl() { BrowserContext::GetStoragePartition(profile(), site_instance)-> GetFileSystemContext(); - std::vector<FilePath> files; + std::vector<base::FilePath> files; for (size_t i = 0; i < path_list->GetSize(); ++i) { std::string url_as_string; path_list->GetString(i, &url_as_string); - FilePath path = GetLocalPathFromURL(file_system_context, + base::FilePath path = GetLocalPathFromURL(file_system_context, GURL(url_as_string)); if (path.empty()) return false; @@ -1621,8 +1622,8 @@ void AddMountFunction::GetLocalPathsResponseOnUIThread( return; } - const FilePath& source_path = files[0].file_path; - const FilePath::StringType& display_name = files[0].display_name; + const base::FilePath& source_path = files[0].file_path; + const base::FilePath::StringType& display_name = files[0].display_name; // Check if the source path is under Drive cache directory. if (drive::util::IsUnderDriveMountPoint(source_path)) { @@ -1646,7 +1647,7 @@ void AddMountFunction::GetLocalPathsResponseOnUIThread( void AddMountFunction::MarkCacheAsMounted( const std::string& mount_type, - const FilePath::StringType& display_name, + const base::FilePath::StringType& display_name, drive::DriveFileError error, scoped_ptr<drive::DriveEntryProto> entry_proto) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); @@ -1668,10 +1669,11 @@ void AddMountFunction::MarkCacheAsMounted( this, mount_type, display_name)); } -void AddMountFunction::OnMountedStateSet(const std::string& mount_type, - const FilePath::StringType& file_name, - drive::DriveFileError error, - const FilePath& file_path) { +void AddMountFunction::OnMountedStateSet( + const std::string& mount_type, + const base::FilePath::StringType& file_name, + drive::DriveFileError error, + const base::FilePath& file_path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); if (error != drive::DRIVE_FILE_OK) { @@ -1684,10 +1686,9 @@ void AddMountFunction::OnMountedStateSet(const std::string& mount_type, SetResult(new base::StringValue(file_path.value())); SendResponse(true); // MountPath() takes a std::string. - disk_mount_manager->MountPath(file_path.AsUTF8Unsafe(), - FilePath(file_name).Extension(), file_name, - DiskMountManager::MountTypeFromString( - mount_type)); + disk_mount_manager->MountPath( + file_path.AsUTF8Unsafe(), base::FilePath(file_name).Extension(), + file_name, DiskMountManager::MountTypeFromString(mount_type)); } RemoveMountFunction::RemoveMountFunction() { @@ -1781,7 +1782,7 @@ bool SetLastModifiedFunction::RunImpl() { scoped_refptr<fileapi::FileSystemContext> file_system_context = BrowserContext::GetStoragePartition(profile(), site_instance)-> GetFileSystemContext(); - FilePath local_path = GetLocalPathFromURL(file_system_context, + base::FilePath local_path = GetLocalPathFromURL(file_system_context, GURL(file_url)); BrowserThread::PostTask( @@ -1796,7 +1797,7 @@ bool SetLastModifiedFunction::RunImpl() { } void SetLastModifiedFunction::RunOperationOnFileThread( - const FilePath& local_path, + const base::FilePath& local_path, time_t timestamp) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); @@ -1842,7 +1843,7 @@ bool GetSizeStatsFunction::RunImpl() { BrowserContext::GetStoragePartition(profile(), site_instance)-> GetFileSystemContext(); - FilePath file_path = GetLocalPathFromURL(file_system_context, + base::FilePath file_path = GetLocalPathFromURL(file_system_context, GURL(mount_url)); if (file_path.empty()) return false; @@ -1944,7 +1945,7 @@ bool FormatDeviceFunction::RunImpl() { BrowserContext::GetStoragePartition(profile(), site_instance)-> GetFileSystemContext(); - FilePath file_path = GetLocalPathFromURL(file_system_context, + base::FilePath file_path = GetLocalPathFromURL(file_system_context, GURL(volume_file_url)); if (file_path.empty()) return false; @@ -1977,7 +1978,7 @@ bool GetVolumeMetadataFunction::RunImpl() { BrowserContext::GetStoragePartition(profile(), site_instance)-> GetFileSystemContext(); - FilePath file_path = GetLocalPathFromURL(file_system_context, + base::FilePath file_path = GetLocalPathFromURL(file_system_context, GURL(volume_mount_url)); if (file_path.empty()) { error_ = "Invalid mount path."; @@ -2391,7 +2392,7 @@ GetDriveFilePropertiesFunction::~GetDriveFilePropertiesFunction() { } void GetDriveFilePropertiesFunction::DoOperation( - const FilePath& file_path, + const base::FilePath& file_path, base::DictionaryValue* property_dict, scoped_ptr<drive::DriveEntryProto> entry_proto) { DCHECK(property_dict); @@ -2438,7 +2439,7 @@ void GetDriveFilePropertiesFunction::GetNextFileProperties() { std::string file_str; path_list_->GetString(current_index_, &file_str); GURL file_url = GURL(file_str); - FilePath file_path = GetVirtualPathFromURL(file_system_context, + base::FilePath file_path = GetVirtualPathFromURL(file_system_context, file_url); base::DictionaryValue* property_dict = new base::DictionaryValue; @@ -2474,7 +2475,7 @@ void GetDriveFilePropertiesFunction::CompleteGetFileProperties() { } void GetDriveFilePropertiesFunction::OnGetFileInfo( - const FilePath& file_path, + const base::FilePath& file_path, base::DictionaryValue* property_dict, drive::DriveFileError error, scoped_ptr<drive::DriveEntryProto> entry_proto) { @@ -2490,7 +2491,7 @@ void GetDriveFilePropertiesFunction::OnGetFileInfo( } void GetDriveFilePropertiesFunction::OnOperationComplete( - const FilePath& file_path, + const base::FilePath& file_path, base::DictionaryValue* property_dict, drive::DriveFileError error, scoped_ptr<drive::DriveEntryProto> entry_proto) { @@ -2602,7 +2603,7 @@ bool PinDriveFileFunction::RunImpl() { } void PinDriveFileFunction::DoOperation( - const FilePath& file_path, + const base::FilePath& file_path, base::DictionaryValue* properties, scoped_ptr<drive::DriveEntryProto> entry_proto) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); @@ -2637,7 +2638,7 @@ void PinDriveFileFunction::DoOperation( } void PinDriveFileFunction::OnPinStateSet( - const FilePath& path, + const base::FilePath& path, base::DictionaryValue* properties, scoped_ptr<drive::DriveEntryProto> entry_proto, drive::DriveFileError error) { @@ -2716,7 +2717,8 @@ void GetDriveFilesFunction::GetLocalPathsResponseOnUIThread( for (size_t i = 0; i < files.size(); ++i) { DCHECK(drive::util::IsUnderDriveMountPoint(files[i].file_path)); - FilePath drive_path = drive::util::ExtractDrivePath(files[i].file_path); + base::FilePath drive_path = + drive::util::ExtractDrivePath(files[i].file_path); remaining_drive_paths_.push(drive_path); } @@ -2733,7 +2735,7 @@ void GetDriveFilesFunction::GetFileOrSendResponse() { } // Get the file on the top of the queue. - FilePath drive_path = remaining_drive_paths_.front(); + base::FilePath drive_path = remaining_drive_paths_.front(); drive::DriveSystemService* system_service = drive::DriveSystemServiceFactory::GetForProfile(profile_); @@ -2754,10 +2756,10 @@ void GetDriveFilesFunction::GetFileOrSendResponse() { void GetDriveFilesFunction::OnFileReady( drive::DriveFileError error, - const FilePath& local_path, + const base::FilePath& local_path, const std::string& unused_mime_type, drive::DriveFileType file_type) { - FilePath drive_path = remaining_drive_paths_.front(); + base::FilePath drive_path = remaining_drive_paths_.front(); if (error == drive::DRIVE_FILE_OK) { local_paths_->Append(new base::StringValue(local_path.value())); @@ -2834,7 +2836,7 @@ bool CancelFileTransfersFunction::RunImpl() { std::string url_as_string; url_list->GetString(i, &url_as_string); - FilePath file_path = GetLocalPathFromURL(file_system_context, + base::FilePath file_path = GetLocalPathFromURL(file_system_context, GURL(url_as_string)); if (file_path.empty()) continue; @@ -2882,9 +2884,9 @@ bool TransferFileFunction::RunImpl() { BrowserContext::GetStoragePartition(profile(), site_instance)-> GetFileSystemContext(); - FilePath source_file = GetLocalPathFromURL(file_system_context, + base::FilePath source_file = GetLocalPathFromURL(file_system_context, GURL(source_file_url)); - FilePath destination_file = GetLocalPathFromURL(file_system_context, + base::FilePath destination_file = GetLocalPathFromURL(file_system_context, GURL(destination_file_url)); if (source_file.empty() || destination_file.empty()) return false; @@ -3227,7 +3229,7 @@ bool RequestDirectoryRefreshFunction::RunImpl() { BrowserContext::GetStoragePartition(profile(), site_instance)-> GetFileSystemContext(); - FilePath directory_path = GetVirtualPathFromURL(file_system_context, + base::FilePath directory_path = GetVirtualPathFromURL(file_system_context, GURL(file_url_as_string)); system_service->file_system()->RequestDirectoryRefresh(directory_path); @@ -3255,7 +3257,7 @@ bool ZipSelectionFunction::RunImpl() { BrowserContext::GetStoragePartition(profile(), site_instance)-> GetFileSystemContext(); - FilePath src_dir = GetLocalPathFromURL(file_system_context, + base::FilePath src_dir = GetLocalPathFromURL(file_system_context, GURL(dir_url)); if (src_dir.empty()) return false; @@ -3266,11 +3268,12 @@ bool ZipSelectionFunction::RunImpl() { if (!selection_urls || !selection_urls->GetSize()) return false; - std::vector<FilePath> files; + std::vector<base::FilePath> files; for (size_t i = 0; i < selection_urls->GetSize(); ++i) { std::string file_url; selection_urls->GetString(i, &file_url); - FilePath path = GetLocalPathFromURL(file_system_context, GURL(file_url)); + base::FilePath path = + GetLocalPathFromURL(file_system_context, GURL(file_url)); if (path.empty()) return false; files.push_back(path); @@ -3289,13 +3292,13 @@ bool ZipSelectionFunction::RunImpl() { if (cache && cache->IsUnderDriveCacheDirectory(src_dir)) return false; - FilePath dest_file = src_dir.Append(dest_name); - std::vector<FilePath> src_relative_paths; + base::FilePath dest_file = src_dir.Append(dest_name); + std::vector<base::FilePath> src_relative_paths; for (size_t i = 0; i != files.size(); ++i) { - const FilePath& file_path = files[i]; + const base::FilePath& file_path = files[i]; // Obtain the relative path of |file_path| under |src_dir|. - FilePath relative_path; + base::FilePath relative_path; if (!src_dir.AppendRelativePath(file_path, &relative_path)) return false; src_relative_paths.push_back(relative_path); diff --git a/chrome/browser/chromeos/extensions/file_browser_private_api.h b/chrome/browser/chromeos/extensions/file_browser_private_api.h index b259df5..1e9dae7 100644 --- a/chrome/browser/chromeos/extensions/file_browser_private_api.h +++ b/chrome/browser/chromeos/extensions/file_browser_private_api.h @@ -95,7 +95,7 @@ class FileWatchBrowserFunctionBase : public AsyncExtensionFunction { virtual bool PerformFileWatchOperation( scoped_refptr<FileBrowserEventRouter> event_router, - const FilePath& local_path, const FilePath& virtual_path, + const base::FilePath& local_path, const base::FilePath& virtual_path, const std::string& extension_id) = 0; // AsyncExtensionFunction overrides. @@ -120,7 +120,7 @@ class AddFileWatchBrowserFunction : public FileWatchBrowserFunctionBase { virtual bool PerformFileWatchOperation( scoped_refptr<FileBrowserEventRouter> event_router, - const FilePath& local_path, const FilePath& virtual_path, + const base::FilePath& local_path, const base::FilePath& virtual_path, const std::string& extension_id) OVERRIDE; }; @@ -136,7 +136,7 @@ class RemoveFileWatchBrowserFunction : public FileWatchBrowserFunctionBase { virtual bool PerformFileWatchOperation( scoped_refptr<FileBrowserEventRouter> event_router, - const FilePath& local_path, const FilePath& virtual_path, + const base::FilePath& local_path, const base::FilePath& virtual_path, const std::string& extension_id) OVERRIDE; }; @@ -155,7 +155,7 @@ class GetFileTasksFileBrowserFunction : public AsyncExtensionFunction { private: struct FileInfo { GURL file_url; - FilePath file_path; + base::FilePath file_path; std::string mime_type; }; typedef std::vector<FileInfo> FileInfoList; @@ -202,13 +202,13 @@ class GetFileTasksFileBrowserFunction : public AsyncExtensionFunction { #if defined(ENABLE_WEB_INTENTS) // Find the list of Web Intent tasks that can be used with the given file // types, appending them to the |result_list|. - bool FindWebIntentTasks(const std::vector<FilePath>& file_paths, + bool FindWebIntentTasks(const std::vector<base::FilePath>& file_paths, ListValue* result_list); #endif // Find the list of app file handlers that can be used with the given file // types, appending them to the |result_list|. - bool FindAppTasks(const std::vector<FilePath>& file_paths, + bool FindAppTasks(const std::vector<base::FilePath>& file_paths, ListValue* result_list); }; @@ -369,15 +369,15 @@ class AddMountFunction : public FileBrowserFunction { // Calls DriveCache::MarkCacheAsMounted. void MarkCacheAsMounted(const std::string& mount_type, - const FilePath::StringType& display_name, + const base::FilePath::StringType& display_name, drive::DriveFileError error, scoped_ptr<drive::DriveEntryProto> entry_proto); // A callback method to handle the result of MarkCacheAsMounted. void OnMountedStateSet(const std::string& mount_type, - const FilePath::StringType& file_name, + const base::FilePath::StringType& file_name, drive::DriveFileError error, - const FilePath& file_path); + const base::FilePath& file_path); }; // Unmounts selected device. Expects mount point path as an argument. @@ -440,7 +440,7 @@ class SetLastModifiedFunction : public FileBrowserFunction { protected: virtual ~SetLastModifiedFunction(); - void RunOperationOnFileThread(const FilePath& local_path, + void RunOperationOnFileThread(const base::FilePath& local_path, time_t timestamp); // AsyncExtensionFunction overrides. @@ -545,11 +545,11 @@ class GetDriveFilePropertiesFunction : public FileBrowserFunction { // Virtual function that can be overridden to do operations on each virtual // file path and update its the properties. - virtual void DoOperation(const FilePath& file_path, + virtual void DoOperation(const base::FilePath& file_path, base::DictionaryValue* properties, scoped_ptr<drive::DriveEntryProto> entry_proto); - void OnOperationComplete(const FilePath& file_path, + void OnOperationComplete(const base::FilePath& file_path, base::DictionaryValue* properties, drive::DriveFileError error, scoped_ptr<drive::DriveEntryProto> entry_proto); @@ -561,7 +561,7 @@ class GetDriveFilePropertiesFunction : public FileBrowserFunction { void PrepareResults(); private: - void OnGetFileInfo(const FilePath& file_path, + void OnGetFileInfo(const base::FilePath& file_path, base::DictionaryValue* property_dict, drive::DriveFileError error, scoped_ptr<drive::DriveEntryProto> entry_proto); @@ -597,12 +597,12 @@ class PinDriveFileFunction : public GetDriveFilePropertiesFunction { private: // Actually do the pinning/unpinning of each file. virtual void DoOperation( - const FilePath& file_path, + const base::FilePath& file_path, base::DictionaryValue* properties, scoped_ptr<drive::DriveEntryProto> entry_proto) OVERRIDE; // Callback for SetPinState. Updates properties with error. - void OnPinStateSet(const FilePath& path, + void OnPinStateSet(const base::FilePath& path, base::DictionaryValue* properties, scoped_ptr<drive::DriveEntryProto> entry_proto, drive::DriveFileError error); @@ -661,11 +661,11 @@ class GetDriveFilesFunction : public FileBrowserFunction { // Called by DriveFileSystem::GetFile(). Pops the file from // |remaining_drive_paths_|, and calls GetFileOrSendResponse(). void OnFileReady(drive::DriveFileError error, - const FilePath& local_path, + const base::FilePath& local_path, const std::string& unused_mime_type, drive::DriveFileType file_type); - std::queue<FilePath> remaining_drive_paths_; + std::queue<base::FilePath> remaining_drive_paths_; ListValue* local_paths_; }; diff --git a/chrome/browser/chromeos/extensions/file_browser_resource_throttle_browsertest.cc b/chrome/browser/chromeos/extensions/file_browser_resource_throttle_browsertest.cc index b041420..fc58288 100644 --- a/chrome/browser/chromeos/extensions/file_browser_resource_throttle_browsertest.cc +++ b/chrome/browser/chromeos/extensions/file_browser_resource_throttle_browsertest.cc @@ -362,7 +362,7 @@ IN_PROC_BROWSER_TEST_F(FileBrowserResourceThrottleExtensionApiTest, GURL url = test_server_->GetURL("/text_path.txt"); // The download's target file path. - FilePath target_path = + base::FilePath target_path = downloads_dir_.path().Append(FILE_PATH_LITERAL("download_target.txt")); // Set the downloads parameters. diff --git a/chrome/browser/chromeos/extensions/file_handler_util.cc b/chrome/browser/chromeos/extensions/file_handler_util.cc index b6b56e4..3349718 100644 --- a/chrome/browser/chromeos/extensions/file_handler_util.cc +++ b/chrome/browser/chromeos/extensions/file_handler_util.cc @@ -348,14 +348,14 @@ FileBrowserHandlerSet::iterator FindHandler( // Given the list of selected files, returns array of file action tasks // that are shared between them. void FindDefaultTasks(Profile* profile, - const std::vector<FilePath>& files_list, + const std::vector<base::FilePath>& files_list, const FileBrowserHandlerSet& common_tasks, FileBrowserHandlerSet* default_tasks) { DCHECK(default_tasks); default_tasks->clear(); std::set<std::string> default_ids; - for (std::vector<FilePath>::const_iterator it = files_list.begin(); + for (std::vector<base::FilePath>::const_iterator it = files_list.begin(); it != files_list.end(); ++it) { std::string task_id = file_handler_util::GetDefaultTaskIdFromPrefs( profile, "", it->Extension()); @@ -449,7 +449,7 @@ bool FindCommonTasks(Profile* profile, bool GetTaskForURLAndPath(Profile* profile, const GURL& url, - const FilePath& file_path, + const base::FilePath& file_path, const FileBrowserHandler** handler) { std::vector<GURL> file_urls; file_urls.push_back(url); @@ -462,7 +462,7 @@ bool GetTaskForURLAndPath(Profile* profile, if (common_tasks.empty()) return false; - std::vector<FilePath> file_paths; + std::vector<base::FilePath> file_paths; file_paths.push_back(file_path); FindDefaultTasks(profile, file_paths, common_tasks, &default_tasks); @@ -505,8 +505,8 @@ class ExtensionTaskExecutor : public FileTaskExecutor { FileDefinition(); ~FileDefinition(); - FilePath virtual_path; - FilePath absolute_path; + base::FilePath virtual_path; + base::FilePath absolute_path; bool is_directory; }; @@ -787,8 +787,8 @@ class ExtensionTaskExecutor::ExecuteTasksFileSystemCallbackDispatcher { // Check if this file system entry exists first. base::PlatformFileInfo file_info; - FilePath local_path = url.path(); - FilePath virtual_path = url.virtual_path(); + base::FilePath local_path = url.path(); + base::FilePath virtual_path = url.virtual_path(); bool is_drive_file = url.type() == fileapi::kFileSystemTypeDrive; DCHECK(!is_drive_file || drive::util::IsUnderDriveMountPoint(local_path)); @@ -982,8 +982,8 @@ void ExtensionTaskExecutor::SetupPermissionsAndDispatchEvent( files_urls->Append(file_def); file_def->SetString("fileSystemName", file_system_name); file_def->SetString("fileSystemRoot", file_system_root.spec()); - FilePath root(FILE_PATH_LITERAL("/")); - FilePath full_path = root.Append(iter->virtual_path); + base::FilePath root(FILE_PATH_LITERAL("/")); + base::FilePath full_path = root.Append(iter->virtual_path); file_def->SetString("fileFullPath", full_path.value()); file_def->SetBoolean("fileIsDirectory", iter->is_directory); } diff --git a/chrome/browser/chromeos/extensions/file_handler_util.h b/chrome/browser/chromeos/extensions/file_handler_util.h index f14a715..fb29e2a3 100644 --- a/chrome/browser/chromeos/extensions/file_handler_util.h +++ b/chrome/browser/chromeos/extensions/file_handler_util.h @@ -74,7 +74,7 @@ bool CrackTaskID(const std::string& task_id, // This generates a list of default tasks (tasks set as default by the user in // prefs) from the |common_tasks|. void FindDefaultTasks(Profile* profile, - const std::vector<FilePath>& files_list, + const std::vector<base::FilePath>& files_list, const std::set<const FileBrowserHandler*>& common_tasks, std::set<const FileBrowserHandler*>* default_tasks); @@ -89,7 +89,7 @@ bool FindCommonTasks(Profile* profile, // found, tries to match the url with one of the builtin tasks. bool GetTaskForURLAndPath(Profile* profile, const GURL& url, - const FilePath& path, + const base::FilePath& path, const FileBrowserHandler** handler); // Used for returning success or failure from task executions. diff --git a/chrome/browser/chromeos/extensions/file_manager_util.cc b/chrome/browser/chromeos/extensions/file_manager_util.cc index 44e7d2b..a68e93e 100644 --- a/chrome/browser/chromeos/extensions/file_manager_util.cc +++ b/chrome/browser/chromeos/extensions/file_manager_util.cc @@ -196,7 +196,7 @@ DictionaryValue* ProgessStatusToDictionaryValue( GURL file_url; if (file_manager_util::ConvertFileToFileSystemUrl(profile, drive::util::GetSpecialRemoteRootPath().Append( - FilePath(status.file_path)), + base::FilePath(status.file_path)), extension_id, &file_url)) { result->SetString("fileUrl", file_url.spec()); @@ -223,7 +223,7 @@ void OpenNewTab(const GURL& url, Profile* profile) { } // Shows a warning message box saying that the file could not be opened. -void ShowWarningMessageBox(Profile* profile, const FilePath& path) { +void ShowWarningMessageBox(Profile* profile, const base::FilePath& path) { // TODO: if FindOrCreateTabbedBrowser creates a new browser the returned // browser is leaked. Browser* browser = @@ -241,7 +241,7 @@ void ShowWarningMessageBox(Profile* profile, const FilePath& path) { // Called when a file on Drive was found. Opens the file found at |file_path| // in a new tab with a URL computed based on the |file_type| void OnDriveFileFound(Profile* profile, - const FilePath& file_path, + const base::FilePath& file_path, drive::DriveFileType file_type, drive::DriveFileError error, scoped_ptr<drive::DriveEntryProto> entry_proto) { @@ -267,7 +267,7 @@ void OnDriveFileFound(Profile* profile, } } -void InstallCRX(Browser* browser, const FilePath& path) { +void InstallCRX(Browser* browser, const base::FilePath& path) { ExtensionService* service = extensions::ExtensionSystem::Get(browser->profile())->extension_service(); CHECK(service); @@ -287,7 +287,7 @@ void InstallCRX(Browser* browser, const FilePath& path) { // Called when a crx file on Drive was downloaded. void OnCRXDownloadCallback(Browser* browser, drive::DriveFileError error, - const FilePath& file, + const base::FilePath& file, const std::string& unused_mime_type, drive::DriveFileType file_type) { if (error != drive::DRIVE_FILE_OK || file_type != drive::REGULAR_FILE) @@ -301,7 +301,7 @@ enum TAB_REUSE_MODE { REUSE_NEVER }; -bool FileManageTabExists(const FilePath& path, TAB_REUSE_MODE mode) { +bool FileManageTabExists(const base::FilePath& path, TAB_REUSE_MODE mode) { if (mode == REUSE_NEVER) return false; @@ -379,7 +379,7 @@ void ExecuteHandler(Profile* profile, executor->Execute(urls); } -void OpenFileBrowser(const FilePath& path, +void OpenFileBrowser(const base::FilePath& path, TAB_REUSE_MODE mode, const std::string& action_id) { content::RecordAction(UserMetricsAction("ShowFileBrowserFullTab")); @@ -409,7 +409,7 @@ void OpenFileBrowser(const FilePath& path, url += "?" + net::EscapeUrlEncodedData(query, false); } if (!path.empty()) { - FilePath virtual_path; + base::FilePath virtual_path; if (!ConvertFileToRelativeFileSystemPath(profile, kFileBrowserDomain, path, &virtual_path)) return; @@ -448,7 +448,7 @@ Browser* GetBrowserForUrl(GURL target_url) { return NULL; } -bool ExecuteDefaultHandler(Profile* profile, const FilePath& path) { +bool ExecuteDefaultHandler(Profile* profile, const base::FilePath& path) { GURL url; if (!ConvertFileToFileSystemUrl(profile, path, kFileBrowserDomain, &url)) return false; @@ -498,7 +498,7 @@ bool ExecuteDefaultHandler(Profile* profile, const FilePath& path) { } // Reads an entire file into a string. Fails is the file is 4K or longer. -bool ReadSmallFileToString(const FilePath& path, std::string* contents) { +bool ReadSmallFileToString(const base::FilePath& path, std::string* contents) { FILE* file = file_util::OpenFile(path, "rb"); if (!file) { return false; @@ -516,7 +516,7 @@ bool ReadSmallFileToString(const FilePath& path, std::string* contents) { // Reads JSON from a Google Docs file, extracts a document url and opens it // in a tab. -void ReadUrlFromGDocOnFileThread(const FilePath& file_path) { +void ReadUrlFromGDocOnFileThread(const base::FilePath& file_path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); std::string contents; if (!ReadSmallFileToString(file_path, &contents)) { @@ -542,7 +542,7 @@ void ReadUrlFromGDocOnFileThread(const FilePath& file_path) { // Used to implement ViewItem(). void ContinueViewItem(Profile* profile, - const FilePath& path, + const base::FilePath& path, base::PlatformFileError error) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); @@ -607,11 +607,11 @@ GURL GetVideoPlayerUrl(const GURL& source_url) { } bool ConvertFileToFileSystemUrl(Profile* profile, - const FilePath& full_file_path, + const base::FilePath& full_file_path, const std::string& extension_id, GURL* url) { GURL origin_url = Extension::GetBaseURLFromExtensionId(extension_id); - FilePath virtual_path; + base::FilePath virtual_path; if (!ConvertFileToRelativeFileSystemPath(profile, extension_id, full_file_path, &virtual_path)) { return false; @@ -626,8 +626,8 @@ bool ConvertFileToFileSystemUrl(Profile* profile, bool ConvertFileToRelativeFileSystemPath( Profile* profile, const std::string& extension_id, - const FilePath& full_file_path, - FilePath* virtual_path) { + const base::FilePath& full_file_path, + base::FilePath* virtual_path) { ExtensionService* service = extensions::ExtensionSystem::Get(profile)->extension_service(); // May be NULL during unit_tests. @@ -654,10 +654,10 @@ bool ConvertFileToRelativeFileSystemPath( GURL GetFileBrowserUrlWithParams( ui::SelectFileDialog::Type type, const string16& title, - const FilePath& default_virtual_path, + const base::FilePath& default_virtual_path, const ui::SelectFileDialog::FileTypeInfo* file_types, int file_type_index, - const FilePath::StringType& default_extension) { + const base::FilePath::StringType& default_extension) { DictionaryValue arg_value; arg_value.SetString("type", GetDialogTypeAsString(type)); arg_value.SetString("title", title); @@ -740,11 +740,11 @@ string16 GetTitleFromType(ui::SelectFileDialog::Type dialog_type) { return title; } -void ViewRemovableDrive(const FilePath& path) { +void ViewRemovableDrive(const base::FilePath& path) { OpenFileBrowser(path, REUSE_ANY_FILE_MANAGER, "auto-open"); } -void OpenActionChoiceDialog(const FilePath& path) { +void OpenActionChoiceDialog(const base::FilePath& path) { const int kDialogWidth = 394; // TODO(dgozman): remove 50, which is a title height once popup window // will have no title. @@ -752,7 +752,7 @@ void OpenActionChoiceDialog(const FilePath& path) { Profile* profile = ProfileManager::GetDefaultProfileOrOffTheRecord(); - FilePath virtual_path; + base::FilePath virtual_path; if (!ConvertFileToRelativeFileSystemPath(profile, kFileBrowserDomain, path, &virtual_path)) return; @@ -781,7 +781,7 @@ void OpenActionChoiceDialog(const FilePath& path) { browser->window()->Show(); } -void ViewItem(const FilePath& path) { +void ViewItem(const base::FilePath& path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); Profile* profile = ProfileManager::GetDefaultProfileOrOffTheRecord(); @@ -802,12 +802,12 @@ void ViewItem(const FilePath& path) { base::Bind(&ContinueViewItem, profile, path)); } -void ShowFileInFolder(const FilePath& path) { +void ShowFileInFolder(const base::FilePath& path) { // This action changes the selection so we do not reuse existing tabs. OpenFileBrowser(path, REUSE_NEVER, "select"); } -bool ExecuteBuiltinHandler(Browser* browser, const FilePath& path, +bool ExecuteBuiltinHandler(Browser* browser, const base::FilePath& path, const std::string& internal_task_id) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); @@ -922,7 +922,7 @@ bool ShouldBeOpenedWithPdfPlugin(Profile* profile, const char* file_extension) { if (base::strcasecmp(file_extension, kPdfExtension) != 0) return false; - FilePath pdf_path; + base::FilePath pdf_path; PathService::Get(chrome::FILE_PDF_PLUGIN, &pdf_path); content::PepperPluginInfo* pepper_info = diff --git a/chrome/browser/chromeos/extensions/file_manager_util.h b/chrome/browser/chromeos/extensions/file_manager_util.h index e70c029..00743b8 100644 --- a/chrome/browser/chromeos/extensions/file_manager_util.h +++ b/chrome/browser/chromeos/extensions/file_manager_util.h @@ -35,7 +35,7 @@ GURL GetVideoPlayerUrl(); // Converts |full_file_path| into external filesystem: url. Returns false // if |full_file_path| is not managed by the external filesystem provider. bool ConvertFileToFileSystemUrl(Profile* profile, - const FilePath& full_file_path, + const base::FilePath& full_file_path, const std::string& extension_id, GURL* url); @@ -44,17 +44,17 @@ bool ConvertFileToFileSystemUrl(Profile* profile, // external filesystem provider. bool ConvertFileToRelativeFileSystemPath(Profile* profile, const std::string& extension_id, - const FilePath& full_file_path, - FilePath* relative_path); + const base::FilePath& full_file_path, + base::FilePath* relative_path); // Gets base file browser url for. GURL GetFileBrowserUrlWithParams( ui::SelectFileDialog::Type type, const string16& title, - const FilePath& default_virtual_path, + const base::FilePath& default_virtual_path, const ui::SelectFileDialog::FileTypeInfo* file_types, int file_type_index, - const FilePath::StringType& default_extension); + const base::FilePath::StringType& default_extension); // Get file dialog title string from its type. string16 GetTitleFromType(ui::SelectFileDialog::Type type); @@ -65,23 +65,23 @@ string16 GetTitleFromType(ui::SelectFileDialog::Type type); // the left panel, and that is all we want. // If there is no File Browser open, this call opens a new one pointing to // |path|. In this case the tab will automatically close on |path| unmount. -void ViewRemovableDrive(const FilePath& path); +void ViewRemovableDrive(const base::FilePath& path); // Opens an action choice dialog for an external drive. // One of the actions is opening the File Manager. -void OpenActionChoiceDialog(const FilePath& path); +void OpenActionChoiceDialog(const base::FilePath& path); // Opens item with the default File Browser handler. -void ViewItem(const FilePath& path); +void ViewItem(const base::FilePath& path); // Opens file browser on the folder containing the file, with the file selected. -void ShowFileInFolder(const FilePath& path); +void ShowFileInFolder(const base::FilePath& path); // Executes the built-in File Manager handler or tries to open |file| directly // in the browser. Returns false if neither is possible. bool ExecuteBuiltinHandler( Browser* browser, - const FilePath& path, + const base::FilePath& path, const std::string& internal_task_id); bool ShouldBeOpenedWithPdfPlugin(Profile* profile, const char* file_extension); diff --git a/chrome/browser/chromeos/extensions/install_limiter.cc b/chrome/browser/chromeos/extensions/install_limiter.cc index 8cfc652..b25d820 100644 --- a/chrome/browser/chromeos/extensions/install_limiter.cc +++ b/chrome/browser/chromeos/extensions/install_limiter.cc @@ -20,7 +20,7 @@ using content::BrowserThread; namespace { // Gets the file size of |file| and stores it in |size| on the blocking pool. -void GetFileSizeOnBlockingPool(const FilePath& file, int64* size) { +void GetFileSizeOnBlockingPool(const base::FilePath& file, int64* size) { DCHECK(BrowserThread::GetBlockingPool()->RunsTasksOnCurrentThread()); // Get file size. In case of error, sets 0 as file size to let the installer @@ -38,7 +38,7 @@ namespace extensions { InstallLimiter::DeferredInstall::DeferredInstall( const scoped_refptr<CrxInstaller>& installer, - const FilePath& path) + const base::FilePath& path) : installer(installer), path(path) { } @@ -64,7 +64,7 @@ void InstallLimiter::DisableForTest() { } void InstallLimiter::Add(const scoped_refptr<CrxInstaller>& installer, - const FilePath& path) { + const base::FilePath& path) { // No deferred installs when disabled for test. if (disabled_for_test_) { installer->InstallCrx(path); @@ -81,7 +81,7 @@ void InstallLimiter::Add(const scoped_refptr<CrxInstaller>& installer, void InstallLimiter::AddWithSize( const scoped_refptr<CrxInstaller>& installer, - const FilePath& path, + const base::FilePath& path, int64* size) { const int64 kBigAppSizeThreshold = 1048576; // 1MB @@ -117,7 +117,7 @@ void InstallLimiter::CheckAndRunDeferrredInstalls() { } void InstallLimiter::RunInstall(const scoped_refptr<CrxInstaller>& installer, - const FilePath& path) { + const base::FilePath& path) { registrar_.Add(this, chrome::NOTIFICATION_CRX_INSTALLER_DONE, content::Source<CrxInstaller>(installer.get())); diff --git a/chrome/browser/chromeos/extensions/install_limiter.h b/chrome/browser/chromeos/extensions/install_limiter.h index 194af4c..9b59dd4 100644 --- a/chrome/browser/chromeos/extensions/install_limiter.h +++ b/chrome/browser/chromeos/extensions/install_limiter.h @@ -35,17 +35,18 @@ class InstallLimiter : public ProfileKeyedService, void DisableForTest(); - void Add(const scoped_refptr<CrxInstaller>& installer, const FilePath& path); + void Add(const scoped_refptr<CrxInstaller>& installer, + const base::FilePath& path); private: // DeferredInstall holds info to run a CrxInstaller later. struct DeferredInstall { DeferredInstall(const scoped_refptr<CrxInstaller>& installer, - const FilePath& path); + const base::FilePath& path); ~DeferredInstall(); const scoped_refptr<CrxInstaller> installer; - const FilePath path; + const base::FilePath path; }; typedef std::queue<DeferredInstall> DeferredInstallList; @@ -55,7 +56,7 @@ class InstallLimiter : public ProfileKeyedService, // it stores the install info into |deferred_installs_| to run it later. // Otherwise, it just runs the installer. void AddWithSize(const scoped_refptr<CrxInstaller>& installer, - const FilePath& path, + const base::FilePath& path, int64* size); // Checks and runs deferred big app installs when appropriate. @@ -64,7 +65,7 @@ class InstallLimiter : public ProfileKeyedService, // Starts install using passed-in info and observes |installer|'s done // notification. void RunInstall(const scoped_refptr<CrxInstaller>& installer, - const FilePath& path); + const base::FilePath& path); // content::NotificationObserver overrides: virtual void Observe(int type, diff --git a/chrome/browser/chromeos/extensions/wallpaper_private_api.cc b/chrome/browser/chromeos/extensions/wallpaper_private_api.cc index c6daa7f..d9c09db 100644 --- a/chrome/browser/chromeos/extensions/wallpaper_private_api.cc +++ b/chrome/browser/chromeos/extensions/wallpaper_private_api.cc @@ -64,13 +64,13 @@ ash::WallpaperLayout GetLayoutEnum(const std::string& layout) { // Saves |data| as |file_name| to directory with |key|. Return false if the // directory can not be found/created or failed to write file. bool SaveData(int key, const std::string& file_name, const std::string& data) { - FilePath data_dir; + base::FilePath data_dir; CHECK(PathService::Get(key, &data_dir)); if (!file_util::DirectoryExists(data_dir) && !file_util::CreateDirectory(data_dir)) { return false; } - FilePath file_path = data_dir.Append(file_name); + base::FilePath file_path = data_dir.Append(file_name); return file_util::PathExists(file_path) || (file_util::WriteFile(file_path, data.c_str(), @@ -82,13 +82,13 @@ bool SaveData(int key, const std::string& file_name, const std::string& data) { // can not be found in the directory, return true with empty |data|. It is // expected that we may try to access file which did not saved yet. bool GetData(int key, const std::string& file_name, std::string* data) { - FilePath data_dir; + base::FilePath data_dir; CHECK(PathService::Get(key, &data_dir)); if (!file_util::DirectoryExists(data_dir) && !file_util::CreateDirectory(data_dir)) return false; - FilePath file_path = data_dir.Append(file_name); + base::FilePath file_path = data_dir.Append(file_name); return !file_util::PathExists(file_path) || file_util::ReadFileToString(file_path, data); @@ -335,10 +335,10 @@ void WallpaperSetWallpaperIfExistFunction::ReadFileAndInitiateStartDecode( DCHECK(BrowserThread::GetBlockingPool()->IsRunningSequenceOnCurrentThread( sequence_token_)); std::string data; - FilePath data_dir; + base::FilePath data_dir; CHECK(PathService::Get(chrome::DIR_CHROMEOS_WALLPAPERS, &data_dir)); - FilePath file_path = data_dir.Append(file_name); + base::FilePath file_path = data_dir.Append(file_name); if (file_util::PathExists(file_path) && file_util::ReadFileToString(file_path, &data)) { @@ -435,10 +435,10 @@ void WallpaperSetWallpaperFunction::SaveToFile() { this, base::Passed(&deep_copy))); chromeos::UserImage wallpaper(wallpaper_); - FilePath wallpaper_dir; + base::FilePath wallpaper_dir; CHECK(PathService::Get(chrome::DIR_CHROMEOS_WALLPAPERS, &wallpaper_dir)); - FilePath file_path = wallpaper_dir.Append(file_name).InsertBeforeExtension( - chromeos::kSmallWallpaperSuffix); + base::FilePath file_path = wallpaper_dir.Append( + file_name).InsertBeforeExtension(chromeos::kSmallWallpaperSuffix); if (file_util::PathExists(file_path)) return; // Generates and saves small resolution wallpaper. Uses CENTER_CROPPED to @@ -680,13 +680,13 @@ bool WallpaperGetOfflineWallpaperListFunction::RunImpl() { void WallpaperGetOfflineWallpaperListFunction::GetList() { DCHECK(BrowserThread::GetBlockingPool()->IsRunningSequenceOnCurrentThread( sequence_token_)); - FilePath wallpaper_dir; + base::FilePath wallpaper_dir; std::vector<std::string> file_list; CHECK(PathService::Get(chrome::DIR_CHROMEOS_WALLPAPERS, &wallpaper_dir)); if (file_util::DirectoryExists(wallpaper_dir)) { file_util::FileEnumerator files(wallpaper_dir, false, file_util::FileEnumerator::FILES); - for (FilePath current = files.Next(); !current.empty(); + for (base::FilePath current = files.Next(); !current.empty(); current = files.Next()) { std::string file_name = current.BaseName().RemoveExtension().value(); // Do not add file name of small resolution wallpaper to the list. diff --git a/chrome/browser/chromeos/extensions/zip_file_creator.cc b/chrome/browser/chromeos/extensions/zip_file_creator.cc index bd03e00..7a2ac45 100644 --- a/chrome/browser/chromeos/extensions/zip_file_creator.cc +++ b/chrome/browser/chromeos/extensions/zip_file_creator.cc @@ -28,9 +28,9 @@ namespace extensions { ZipFileCreator::ZipFileCreator( Observer* observer, - const FilePath& src_dir, - const std::vector<FilePath>& src_relative_paths, - const FilePath& dest_file) + const base::FilePath& src_dir, + const std::vector<base::FilePath>& src_relative_paths, + const base::FilePath& dest_file) : thread_identifier_(BrowserThread::ID_COUNT), observer_(observer), src_dir_(src_dir), diff --git a/chrome/browser/chromeos/extensions/zip_file_creator.h b/chrome/browser/chromeos/extensions/zip_file_creator.h index 75146af..d43e8d2 100644 --- a/chrome/browser/chromeos/extensions/zip_file_creator.h +++ b/chrome/browser/chromeos/extensions/zip_file_creator.h @@ -40,9 +40,9 @@ class ZipFileCreator : public content::UtilityProcessHostClient { // Creates a zip file from the specified list of files and directories. ZipFileCreator(Observer* observer, - const FilePath& src_dir, - const std::vector<FilePath>& src_relative_paths, - const FilePath& dest_file); + const base::FilePath& src_dir, + const std::vector<base::FilePath>& src_relative_paths, + const base::FilePath& dest_file); // Start creating the zip file. The client is called with the results. void Start(); @@ -76,14 +76,14 @@ class ZipFileCreator : public content::UtilityProcessHostClient { Observer* observer_; // The source directory for input files. - FilePath src_dir_; + base::FilePath src_dir_; // The list of source files paths to be included in the zip file. // Entries are relative paths under directory |src_dir_|. - std::vector<FilePath> src_relative_paths_; + std::vector<base::FilePath> src_relative_paths_; // The output zip file. - FilePath dest_file_; + base::FilePath dest_file_; // Whether we've received a response from the utility process yet. bool got_response_; diff --git a/chrome/browser/chromeos/external_metrics.h b/chrome/browser/chromeos/external_metrics.h index 4e2982a..42a1378 100644 --- a/chrome/browser/chromeos/external_metrics.h +++ b/chrome/browser/chromeos/external_metrics.h @@ -82,7 +82,7 @@ class ExternalMetrics : public base::RefCountedThreadSafe<ExternalMetrics> { // Used for testing only. RecorderType test_recorder_; - FilePath test_path_; + base::FilePath test_path_; DISALLOW_COPY_AND_ASSIGN(ExternalMetrics); }; diff --git a/chrome/browser/chromeos/external_metrics_unittest.cc b/chrome/browser/chromeos/external_metrics_unittest.cc index d1ff75d..0487953 100644 --- a/chrome/browser/chromeos/external_metrics_unittest.cc +++ b/chrome/browser/chromeos/external_metrics_unittest.cc @@ -73,7 +73,7 @@ TEST(ExternalMetricsTest, ParseExternalMetricsFile) { scoped_refptr<chromeos::ExternalMetrics> external_metrics(new chromeos::ExternalMetrics()); external_metrics->test_recorder_ = &ReceiveMessage; - external_metrics->test_path_ = FilePath(path); + external_metrics->test_path_ = base::FilePath(path); EXPECT_TRUE(unlink(path) == 0 || errno == ENOENT); // Sends a few valid messages. Once in a while, collects them and checks the diff --git a/chrome/browser/chromeos/imageburner/burn_controller.cc b/chrome/browser/chromeos/imageburner/burn_controller.cc index cef84d9..9167196 100644 --- a/chrome/browser/chromeos/imageburner/burn_controller.cc +++ b/chrome/browser/chromeos/imageburner/burn_controller.cc @@ -161,7 +161,7 @@ class BurnControllerImpl ProcessError(IDS_IMAGEBURN_USER_ERROR); } else if (state != StateMachine::INITIAL && !working_) { // User has started burn process, so let's start observing. - StartBurnImage(FilePath(), FilePath()); + StartBurnImage(base::FilePath(), base::FilePath()); } } @@ -209,7 +209,7 @@ class BurnControllerImpl BurnImage(); } else if (state_machine_->state() != StateMachine::INITIAL) { // User has started burn process, so let's start observing. - StartBurnImage(FilePath(), FilePath()); + StartBurnImage(base::FilePath(), base::FilePath()); } } @@ -237,8 +237,8 @@ class BurnControllerImpl // BurnController override. // May be called with empty values if there is a handler that has started // burning, and thus set the target paths. - virtual void StartBurnImage(const FilePath& target_device_path, - const FilePath& target_file_path) OVERRIDE { + virtual void StartBurnImage(const base::FilePath& target_device_path, + const base::FilePath& target_file_path) OVERRIDE { if (!target_device_path.empty() && !target_file_path.empty() && state_machine_->new_burn_posible()) { if (!CheckNetwork()) { @@ -347,7 +347,7 @@ class BurnControllerImpl return CrosLibrary::Get()->GetNetworkLibrary()->Connected(); } - FilePath zip_image_file_path_; + base::FilePath zip_image_file_path_; std::string image_file_name_; BurnManager* burn_manager_; StateMachine* state_machine_; diff --git a/chrome/browser/chromeos/imageburner/burn_manager.cc b/chrome/browser/chromeos/imageburner/burn_manager.cc index c2d035d..e030b7e 100644 --- a/chrome/browser/chromeos/imageburner/burn_manager.cc +++ b/chrome/browser/chromeos/imageburner/burn_manager.cc @@ -34,7 +34,7 @@ const int64 kBytesImageDownloadProgressReportInterval = 10240; BurnManager* g_burn_manager = NULL; // Cretes a directory and calls |callback| with the result on UI thread. -void CreateDirectory(const FilePath& path, +void CreateDirectory(const base::FilePath& path, base::Callback<void(bool success)> callback) { const bool success = file_util::CreateDirectory(path); BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, @@ -267,7 +267,7 @@ void BurnManager::OnImageDirCreated(Delegate* delegate, bool success) { delegate->OnImageDirCreated(success); } -const FilePath& BurnManager::GetImageDir() { +const base::FilePath& BurnManager::GetImageDir() { return image_dir_; } @@ -288,7 +288,8 @@ void BurnManager::FetchConfigFile(Delegate* delegate) { config_fetcher_->Start(); } -void BurnManager::FetchImage(const GURL& image_url, const FilePath& file_path) { +void BurnManager::FetchImage(const GURL& image_url, + const base::FilePath& file_path) { tick_image_download_start_ = base::TimeTicks::Now(); bytes_image_download_progress_last_reported_ = 0; image_fetcher_.reset(net::URLFetcher::Create(image_url, diff --git a/chrome/browser/chromeos/imageburner/burn_manager.h b/chrome/browser/chromeos/imageburner/burn_manager.h index cebed12..383912f 100644 --- a/chrome/browser/chromeos/imageburner/burn_manager.h +++ b/chrome/browser/chromeos/imageburner/burn_manager.h @@ -199,7 +199,7 @@ class BurnManager : net::URLFetcherDelegate { void FetchConfigFile(Delegate* delegate); // Fetch a zipped recovery image. - void FetchImage(const GURL& image_url, const FilePath& file_path); + void FetchImage(const GURL& image_url, const base::FilePath& file_path); // Cancel fetching image. void CancelImageFetch(); @@ -216,15 +216,15 @@ class BurnManager : net::URLFetcherDelegate { // Returns directory image should be dopwnloaded to. // The directory has to be previously created. - const FilePath& GetImageDir(); + const base::FilePath& GetImageDir(); - const FilePath& target_device_path() { return target_device_path_; } - void set_target_device_path(const FilePath& path) { + const base::FilePath& target_device_path() { return target_device_path_; } + void set_target_device_path(const base::FilePath& path) { target_device_path_ = path; } - const FilePath& target_file_path() { return target_file_path_; } - void set_target_file_path(const FilePath& path) { + const base::FilePath& target_file_path() { return target_file_path_; } + void set_target_file_path(const base::FilePath& path) { target_file_path_ = path; } @@ -244,9 +244,9 @@ class BurnManager : net::URLFetcherDelegate { base::WeakPtrFactory<BurnManager> weak_ptr_factory_; - FilePath image_dir_; - FilePath target_device_path_; - FilePath target_file_path_; + base::FilePath image_dir_; + base::FilePath target_device_path_; + base::FilePath target_file_path_; GURL config_file_url_; bool config_file_fetched_; diff --git a/chrome/browser/chromeos/input_method/ibus_controller_impl.cc b/chrome/browser/chromeos/input_method/ibus_controller_impl.cc index 46c5e32..13e4f94 100644 --- a/chrome/browser/chromeos/input_method/ibus_controller_impl.cc +++ b/chrome/browser/chromeos/input_method/ibus_controller_impl.cc @@ -190,7 +190,7 @@ base::FilePathWatcher* g_file_path_watcher = NULL; // Called when the ibus-daemon address file is modified. void OnFilePathChanged(const base::Closure& closure, - const FilePath& file_path, + const base::FilePath& file_path, bool failed) { if (failed) return; // Can't recover, do nothing. @@ -213,7 +213,7 @@ void StartWatch(const std::string& address_file_path, delete g_file_path_watcher; g_file_path_watcher = new base::FilePathWatcher; bool result = g_file_path_watcher->Watch( - FilePath::FromUTF8Unsafe(address_file_path), + base::FilePath::FromUTF8Unsafe(address_file_path), false, // do not watch child directory. base::Bind(&OnFilePathChanged, callback)); DCHECK(result); diff --git a/chrome/browser/chromeos/input_method/textinput_browsertest.cc b/chrome/browser/chromeos/input_method/textinput_browsertest.cc index 7ba6994..b065d03 100644 --- a/chrome/browser/chromeos/input_method/textinput_browsertest.cc +++ b/chrome/browser/chromeos/input_method/textinput_browsertest.cc @@ -64,8 +64,8 @@ class TextInputTest : public InProcessBrowserTest, IN_PROC_BROWSER_TEST_F(TextInputTest, SwitchToPasswordFieldTest) { GetInputMethod()->AddObserver(this); GURL url = ui_test_utils::GetTestUrl( - FilePath("textinput"), - FilePath("ime_enable_disable_test.html")); + base::FilePath("textinput"), + base::FilePath("ime_enable_disable_test.html")); ui_test_utils::NavigateToURL(browser(), url); content::WebContents* tab = diff --git a/chrome/browser/chromeos/kiosk_mode/kiosk_mode_screensaver.cc b/chrome/browser/chromeos/kiosk_mode/kiosk_mode_screensaver.cc index 6f80408..d07bab9 100644 --- a/chrome/browser/chromeos/kiosk_mode/kiosk_mode_screensaver.cc +++ b/chrome/browser/chromeos/kiosk_mode/kiosk_mode_screensaver.cc @@ -37,18 +37,18 @@ namespace { typedef base::Callback<void( scoped_refptr<Extension>, - const FilePath&)> UnpackCallback; + const base::FilePath&)> UnpackCallback; class ScreensaverUnpackerClient : public extensions::SandboxedUnpackerClient { public: - ScreensaverUnpackerClient(const FilePath& crx_path, + ScreensaverUnpackerClient(const base::FilePath& crx_path, const UnpackCallback& unpacker_callback) : crx_path_(crx_path), unpack_callback_(unpacker_callback) {} - virtual void OnUnpackSuccess(const FilePath& temp_dir, - const FilePath& extension_root, + virtual void OnUnpackSuccess(const base::FilePath& temp_dir, + const base::FilePath& extension_root, const base::DictionaryValue* original_manifest, const Extension* extension) OVERRIDE; virtual void OnUnpackFailure(const string16& error) OVERRIDE; @@ -58,20 +58,20 @@ class ScreensaverUnpackerClient private: void LoadScreensaverExtension( - const FilePath& extension_base_path, - const FilePath& screensaver_extension_path); + const base::FilePath& extension_base_path, + const base::FilePath& screensaver_extension_path); void NotifyAppPackOfDamagedFile(); - FilePath crx_path_; + base::FilePath crx_path_; UnpackCallback unpack_callback_; DISALLOW_COPY_AND_ASSIGN(ScreensaverUnpackerClient); }; void ScreensaverUnpackerClient::OnUnpackSuccess( - const FilePath& temp_dir, - const FilePath& extension_root, + const base::FilePath& temp_dir, + const base::FilePath& extension_root, const base::DictionaryValue* original_manifest, const Extension* extension) { content::BrowserThread::PostTask( @@ -89,8 +89,8 @@ void ScreensaverUnpackerClient::OnUnpackFailure(const string16& error) { } void ScreensaverUnpackerClient::LoadScreensaverExtension( - const FilePath& extension_base_path, - const FilePath& screensaver_extension_path) { + const base::FilePath& extension_base_path, + const base::FilePath& screensaver_extension_path) { DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::FILE)); std::string error; @@ -173,15 +173,15 @@ void KioskModeScreensaver::GetScreensaverCrxPath() { } void KioskModeScreensaver::ScreensaverPathCallback( - const FilePath& screensaver_crx) { + const base::FilePath& screensaver_crx) { if (screensaver_crx.empty()) return; Profile* default_profile = ProfileManager::GetDefaultProfile(); if (!default_profile) return; - FilePath extensions_dir = extensions::ExtensionSystem::Get(default_profile)-> - extension_service()->install_directory(); + base::FilePath extensions_dir = extensions::ExtensionSystem::Get( + default_profile)->extension_service()->install_directory(); scoped_refptr<SandboxedUnpacker> screensaver_unpacker( new SandboxedUnpacker( screensaver_crx, @@ -207,7 +207,7 @@ void KioskModeScreensaver::ScreensaverPathCallback( void KioskModeScreensaver::SetupScreensaver( scoped_refptr<Extension> extension, - const FilePath& extension_base_path) { + const base::FilePath& extension_base_path) { DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); extension_base_path_ = extension_base_path; diff --git a/chrome/browser/chromeos/kiosk_mode/kiosk_mode_screensaver.h b/chrome/browser/chromeos/kiosk_mode/kiosk_mode_screensaver.h index 5b4ca4f..949247e 100644 --- a/chrome/browser/chromeos/kiosk_mode/kiosk_mode_screensaver.h +++ b/chrome/browser/chromeos/kiosk_mode/kiosk_mode_screensaver.h @@ -33,16 +33,16 @@ class KioskModeScreensaver : public ash::UserActivityObserver { // Callback to receive the path to the screensaver extension's crx and call // the unpacker to unpack and load the crx. - void ScreensaverPathCallback(const FilePath& screensaver_crx); + void ScreensaverPathCallback(const base::FilePath& screensaver_crx); // Called back on the UI thread to Setup the screensaver with the now unpacked // and loaded extension. void SetupScreensaver(scoped_refptr<extensions::Extension> extension, - const FilePath& extension_base_path); + const base::FilePath& extension_base_path); base::WeakPtrFactory<KioskModeScreensaver> weak_ptr_factory_; - FilePath extension_base_path_; + base::FilePath extension_base_path_; DISALLOW_COPY_AND_ASSIGN(KioskModeScreensaver); }; diff --git a/chrome/browser/chromeos/kiosk_mode/kiosk_mode_settings.cc b/chrome/browser/chromeos/kiosk_mode/kiosk_mode_settings.cc index c9dd847..5169dcc 100644 --- a/chrome/browser/chromeos/kiosk_mode/kiosk_mode_settings.cc +++ b/chrome/browser/chromeos/kiosk_mode/kiosk_mode_settings.cc @@ -103,7 +103,7 @@ bool KioskModeSettings::is_initialized() const { void KioskModeSettings::GetScreensaverPath( policy::AppPackUpdater::ScreenSaverUpdateCallback callback) const { if (!is_initialized_) { - callback.Run(FilePath()); + callback.Run(base::FilePath()); return; } @@ -111,7 +111,7 @@ void KioskModeSettings::GetScreensaverPath( // for testing and dev workflows. if (CommandLine::ForCurrentProcess()->HasSwitch( switches::kKioskModeScreensaverPath)) { - callback.Run(FilePath( + callback.Run(base::FilePath( CommandLine::ForCurrentProcess()-> GetSwitchValueASCII(switches::kKioskModeScreensaverPath))); return; diff --git a/chrome/browser/chromeos/login/login_utils.cc b/chrome/browser/chromeos/login/login_utils.cc index c4094bb..4e6f8dd 100644 --- a/chrome/browser/chromeos/login/login_utils.cc +++ b/chrome/browser/chromeos/login/login_utils.cc @@ -119,7 +119,7 @@ const char kGuestUserName[] = ""; // Flag file that disables RLZ tracking, when present. const char kRLZDisabledFlagName[] = FILE_PATH_LITERAL(".rlz_disabled"); -FilePath GetRlzDisabledFlagPath() { +base::FilePath GetRlzDisabledFlagPath() { return file_util::GetHomeDir().Append(kRLZDisabledFlagName); } #endif @@ -355,7 +355,7 @@ void LoginUtilsImpl::DoBrowserLaunch(Profile* profile, chrome::startup::IS_FIRST_RUN : chrome::startup::IS_NOT_FIRST_RUN; browser_creator.LaunchBrowser(*CommandLine::ForCurrentProcess(), profile, - FilePath(), + base::FilePath(), chrome::startup::IS_PROCESS_STARTUP, first_run, &return_code); diff --git a/chrome/browser/chromeos/login/mock_user_image_manager.h b/chrome/browser/chromeos/login/mock_user_image_manager.h index 8bcd97b..658c53b 100644 --- a/chrome/browser/chromeos/login/mock_user_image_manager.h +++ b/chrome/browser/chromeos/login/mock_user_image_manager.h @@ -22,7 +22,7 @@ class MockUserImageManager : public UserImageManager { MOCK_METHOD2(SaveUserDefaultImageIndex, void(const std::string&, int)); MOCK_METHOD2(SaveUserImage, void(const std::string&, const UserImage&)); MOCK_METHOD2(SaveUserImageFromFile, void(const std::string&, - const FilePath&)); + const base::FilePath&)); MOCK_METHOD1(SaveUserImageFromProfileImage, void(const std::string&)); MOCK_METHOD1(DownloadProfileImage, void(const std::string&)); MOCK_CONST_METHOD0(DownloadedProfileImage, const gfx::ImageSkia& (void)); diff --git a/chrome/browser/chromeos/login/parallel_authenticator_unittest.cc b/chrome/browser/chromeos/login/parallel_authenticator_unittest.cc index b17403c..556f9b7 100644 --- a/chrome/browser/chromeos/login/parallel_authenticator_unittest.cc +++ b/chrome/browser/chromeos/login/parallel_authenticator_unittest.cc @@ -109,8 +109,8 @@ class ParallelAuthenticatorTest : public testing::Test { mock_caller_ = NULL; } - FilePath PopulateTempFile(const char* data, int data_len) { - FilePath out; + base::FilePath PopulateTempFile(const char* data, int data_len) { + base::FilePath out; FILE* tmp_file = file_util::CreateAndOpenTemporaryFile(&out); EXPECT_NE(tmp_file, static_cast<FILE*>(NULL)); EXPECT_EQ(file_util::WriteFile(out, data, data_len), data_len); diff --git a/chrome/browser/chromeos/login/update_screen.cc b/chrome/browser/chromeos/login/update_screen.cc index 2c57c0b..41805bc 100644 --- a/chrome/browser/chromeos/login/update_screen.cc +++ b/chrome/browser/chromeos/login/update_screen.cc @@ -381,7 +381,7 @@ bool UpdateScreen::HasCriticalUpdate() { // Checking for update flag file causes us to do blocking IO on UI thread. // Temporarily allow it until we fix http://crosbug.com/11106 base::ThreadRestrictions::ScopedAllowIO allow_io; - FilePath update_deadline_file_path(kUpdateDeadlineFile); + base::FilePath update_deadline_file_path(kUpdateDeadlineFile); if (!file_util::ReadFileToString(update_deadline_file_path, &deadline) || deadline.empty()) { return false; diff --git a/chrome/browser/chromeos/login/user_image_loader.cc b/chrome/browser/chromeos/login/user_image_loader.cc index bd451d2..7ba6b1a 100644 --- a/chrome/browser/chromeos/login/user_image_loader.cc +++ b/chrome/browser/chromeos/login/user_image_loader.cc @@ -71,7 +71,7 @@ void UserImageLoader::LoadImage( DCHECK(task_runner->RunsTasksOnCurrentThread()); std::string image_data; - file_util::ReadFileToString(FilePath(filepath), &image_data); + file_util::ReadFileToString(base::FilePath(filepath), &image_data); scoped_refptr<ImageDecoder> image_decoder = new ImageDecoder(this, image_data, image_codec_); diff --git a/chrome/browser/chromeos/login/user_image_manager_browsertest.cc b/chrome/browser/chromeos/login/user_image_manager_browsertest.cc index 6ac8ef9..3a3e764 100644 --- a/chrome/browser/chromeos/login/user_image_manager_browsertest.cc +++ b/chrome/browser/chromeos/login/user_image_manager_browsertest.cc @@ -89,7 +89,7 @@ class UserImageManagerTest : public CrosInProcessBrowserTest, // Stores old (pre-migration) user image info. void SetOldUserImageInfo(const std::string& username, int image_index, - const FilePath& image_path) { + const base::FilePath& image_path) { AddUser(username); DictionaryPrefUpdate images_pref(local_state_, "UserImages"); base::DictionaryValue* image_properties = new base::DictionaryValue(); @@ -104,7 +104,7 @@ class UserImageManagerTest : public CrosInProcessBrowserTest, void ExpectUserImageInfo(const base::DictionaryValue* images_pref, const std::string& username, int image_index, - const FilePath& image_path) { + const base::FilePath& image_path) { ASSERT_TRUE(images_pref); const base::DictionaryValue* image_properties = NULL; images_pref->GetDictionaryWithoutPathExpansion(username, &image_properties); @@ -131,7 +131,7 @@ class UserImageManagerTest : public CrosInProcessBrowserTest, // and that new user image info does not exist. void ExpectOldUserImageInfo(const std::string& username, int image_index, - const FilePath& image_path) { + const base::FilePath& image_path) { ExpectUserImageInfo(local_state_->GetDictionary("UserImages"), username, image_index, image_path); ExpectNoUserImageInfo(local_state_->GetDictionary("user_image_info"), @@ -142,7 +142,7 @@ class UserImageManagerTest : public CrosInProcessBrowserTest, // and that old user image info does not exist. void ExpectNewUserImageInfo(const std::string& username, int image_index, - const FilePath& image_path) { + const base::FilePath& image_path) { ExpectUserImageInfo(local_state_->GetDictionary("user_image_info"), username, image_index, image_path); ExpectNoUserImageInfo(local_state_->GetDictionary("UserImages"), @@ -152,7 +152,7 @@ class UserImageManagerTest : public CrosInProcessBrowserTest, // Sets bitmap |resource_id| as image for |username| and saves it to disk. void SaveUserImagePNG(const std::string& username, int resource_id) { - FilePath image_path = GetUserImagePath(username, "png"); + base::FilePath image_path = GetUserImagePath(username, "png"); scoped_refptr<base::RefCountedStaticMemory> image_data( ResourceBundle::GetSharedInstance().LoadDataResourceBytesForScale( resource_id, ui::SCALE_FACTOR_100P)); @@ -165,9 +165,9 @@ class UserImageManagerTest : public CrosInProcessBrowserTest, } // Returns the image path for user |username| with specified |extension|. - FilePath GetUserImagePath(const std::string& username, + base::FilePath GetUserImagePath(const std::string& username, const std::string& extension) { - FilePath user_data_dir; + base::FilePath user_data_dir; PathService::Get(chrome::DIR_USER_DATA, &user_data_dir); return user_data_dir.Append(username).AddExtension(extension); } @@ -183,38 +183,41 @@ class UserImageManagerTest : public CrosInProcessBrowserTest, IN_PROC_BROWSER_TEST_F(UserImageManagerTest, PRE_DefaultUserImagePreserved) { // Setup an old default (stock) user image. ScopedMockUserManagerEnabler mock_user_manager; - SetOldUserImageInfo(kTestUser1, kFirstDefaultImageIndex, FilePath()); + SetOldUserImageInfo(kTestUser1, kFirstDefaultImageIndex, base::FilePath()); } IN_PROC_BROWSER_TEST_F(UserImageManagerTest, DefaultUserImagePreserved) { UserManager::Get()->GetUsers(); // Load users. // Old info preserved. - ExpectOldUserImageInfo(kTestUser1, kFirstDefaultImageIndex, FilePath()); + ExpectOldUserImageInfo(kTestUser1, kFirstDefaultImageIndex, base::FilePath()); LogIn(kTestUser1); // Wait for migration. content::RunMessageLoop(); // Image info is migrated now. - ExpectNewUserImageInfo(kTestUser1, kFirstDefaultImageIndex, FilePath()); + ExpectNewUserImageInfo(kTestUser1, kFirstDefaultImageIndex, base::FilePath()); } IN_PROC_BROWSER_TEST_F(UserImageManagerTest, PRE_OtherUsersUnaffected) { // Setup two users with stock images. ScopedMockUserManagerEnabler mock_user_manager; - SetOldUserImageInfo(kTestUser1, kFirstDefaultImageIndex, FilePath()); - SetOldUserImageInfo(kTestUser2, kFirstDefaultImageIndex + 1, FilePath()); + SetOldUserImageInfo(kTestUser1, kFirstDefaultImageIndex, base::FilePath()); + SetOldUserImageInfo(kTestUser2, kFirstDefaultImageIndex + 1, + base::FilePath()); } IN_PROC_BROWSER_TEST_F(UserImageManagerTest, OtherUsersUnaffected) { UserManager::Get()->GetUsers(); // Load users. // Old info preserved. - ExpectOldUserImageInfo(kTestUser1, kFirstDefaultImageIndex, FilePath()); - ExpectOldUserImageInfo(kTestUser2, kFirstDefaultImageIndex + 1, FilePath()); + ExpectOldUserImageInfo(kTestUser1, kFirstDefaultImageIndex, base::FilePath()); + ExpectOldUserImageInfo(kTestUser2, kFirstDefaultImageIndex + 1, + base::FilePath()); LogIn(kTestUser1); // Wait for migration. content::RunMessageLoop(); // Image info is migrated for the first user and unaffected for the rest. - ExpectNewUserImageInfo(kTestUser1, kFirstDefaultImageIndex, FilePath()); - ExpectOldUserImageInfo(kTestUser2, kFirstDefaultImageIndex + 1, FilePath()); + ExpectNewUserImageInfo(kTestUser1, kFirstDefaultImageIndex, base::FilePath()); + ExpectOldUserImageInfo(kTestUser2, kFirstDefaultImageIndex + 1, + base::FilePath()); } IN_PROC_BROWSER_TEST_F(UserImageManagerTest, PRE_PRE_NonJPEGImageFromFile) { diff --git a/chrome/browser/chromeos/login/user_image_manager_impl.cc b/chrome/browser/chromeos/login/user_image_manager_impl.cc index 37a1ac3..4e5aaf5 100644 --- a/chrome/browser/chromeos/login/user_image_manager_impl.cc +++ b/chrome/browser/chromeos/login/user_image_manager_impl.cc @@ -141,7 +141,7 @@ void AddProfileImageTimeHistogram(ProfileDownloadResult result, void DeleteImageFile(const std::string& image_path) { if (image_path.empty()) return; - FilePath fp(image_path); + base::FilePath fp(image_path); BrowserThread::PostTask( BrowserThread::FILE, FROM_HERE, @@ -320,7 +320,7 @@ void UserImageManagerImpl::SaveUserImage(const std::string& username, } void UserImageManagerImpl::SaveUserImageFromFile(const std::string& username, - const FilePath& path) { + const base::FilePath& path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); // Always use unsafe image loader because we resize the image when saving // anyway. @@ -373,10 +373,10 @@ const gfx::ImageSkia& UserImageManagerImpl::DownloadedProfileImage() const { return downloaded_profile_image_; } -FilePath UserImageManagerImpl::GetImagePathForUser( +base::FilePath UserImageManagerImpl::GetImagePathForUser( const std::string& username) { std::string filename = username + kSafeImagePathExtension; - FilePath user_data_dir; + base::FilePath user_data_dir; PathService::Get(chrome::DIR_USER_DATA, &user_data_dir); return user_data_dir.AppendASCII(filename); } @@ -433,7 +433,7 @@ void UserImageManagerImpl::SaveUserImageInternal(const std::string& username, if (UserManager::Get()->IsUserNonCryptohomeDataEphemeral(username)) return; - FilePath image_path = GetImagePathForUser(username); + base::FilePath image_path = GetImagePathForUser(username); DVLOG(1) << "Saving user image to " << image_path.value(); last_image_set_async_ = true; @@ -448,7 +448,7 @@ void UserImageManagerImpl::SaveUserImageInternal(const std::string& username, void UserImageManagerImpl::SaveImageToFile(const std::string& username, const UserImage& user_image, - const FilePath& image_path, + const base::FilePath& image_path, int image_index, const GURL& image_url) { if (!SaveBitmapToFile(user_image, image_path)) @@ -509,7 +509,7 @@ void UserImageManagerImpl::SaveImageToLocalState(const std::string& username, } bool UserImageManagerImpl::SaveBitmapToFile(const UserImage& user_image, - const FilePath& image_path) { + const base::FilePath& image_path) { UserImage safe_image; const UserImage::RawImage* encoded_image = NULL; if (!user_image.is_safe_format()) { diff --git a/chrome/browser/chromeos/login/wallpaper_manager.cc b/chrome/browser/chromeos/login/wallpaper_manager.cc index 28a1df0..87a9e44 100644 --- a/chrome/browser/chromeos/login/wallpaper_manager.cc +++ b/chrome/browser/chromeos/login/wallpaper_manager.cc @@ -210,23 +210,24 @@ bool WallpaperManager::GetWallpaperFromCache(const std::string& email, return false; } -FilePath WallpaperManager::GetOriginalWallpaperPathForUser( +base::FilePath WallpaperManager::GetOriginalWallpaperPathForUser( const std::string& username) { std::string filename = username + kOriginalCustomWallpaperSuffix; - FilePath user_data_dir; + base::FilePath user_data_dir; PathService::Get(chrome::DIR_USER_DATA, &user_data_dir); return user_data_dir.AppendASCII(filename); } -FilePath WallpaperManager::GetWallpaperPathForUser(const std::string& username, - bool is_small) { +base::FilePath WallpaperManager::GetWallpaperPathForUser( + const std::string& username, + bool is_small) { const char* suffix = is_small ? kSmallWallpaperSuffix : kLargeWallpaperSuffix; std::string filename = base::StringPrintf("%s_wallpaper%s", username.c_str(), suffix); - FilePath user_data_dir; + base::FilePath user_data_dir; PathService::Get(chrome::DIR_USER_DATA, &user_data_dir); return user_data_dir.AppendASCII(filename); } @@ -332,7 +333,7 @@ void WallpaperManager::RemoveUserWallpaperInfo(const std::string& email) { } void WallpaperManager::ResizeAndSaveWallpaper(const UserImage& wallpaper, - const FilePath& path, + const base::FilePath& path, ash::WallpaperLayout layout, int preferred_width, int preferred_height) { @@ -562,8 +563,8 @@ void WallpaperManager::SetUserWallpaper(const std::string& email) { desktop_background_controller()->GetAppropriateResolution(); const char* sub_dir = (resolution == ash::WALLPAPER_RESOLUTION_SMALL) ? kSmallWallpaperSubDir : kLargeWallpaperSubDir; - FilePath wallpaper_path = GetCustomWallpaperPath(sub_dir, email, - info.file); + base::FilePath wallpaper_path = GetCustomWallpaperPath(sub_dir, email, + info.file); if (current_wallpaper_path_ == wallpaper_path) return; current_wallpaper_path_ = wallpaper_path; @@ -632,15 +633,15 @@ void WallpaperManager::CacheUserWallpaper(const std::string& email) { return; WallpaperInfo info; if (GetUserWallpaperInfo(email, &info)) { - FilePath wallpaper_dir; - FilePath wallpaper_path; + base::FilePath wallpaper_dir; + base::FilePath wallpaper_path; if (info.type == User::CUSTOMIZED) { ash::WallpaperResolution resolution = ash::Shell::GetInstance()-> desktop_background_controller()->GetAppropriateResolution(); const char* sub_dir = (resolution == ash::WALLPAPER_RESOLUTION_SMALL) ? kSmallWallpaperSubDir : kLargeWallpaperSubDir; - FilePath wallpaper_path = GetCustomWallpaperPath(sub_dir, email, - info.file); + base::FilePath wallpaper_path = GetCustomWallpaperPath(sub_dir, email, + info.file); task_runner_->PostTask(FROM_HERE, base::Bind(&WallpaperManager::GetCustomWallpaperInternal, base::Unretained(this), email, info, wallpaper_path, @@ -661,10 +662,10 @@ void WallpaperManager::ClearObsoleteWallpaperPrefs() { } void WallpaperManager::DeleteWallpaperInList( - const std::vector<FilePath>& file_list) { - for (std::vector<FilePath>::const_iterator it = file_list.begin(); + const std::vector<base::FilePath>& file_list) { + for (std::vector<base::FilePath>::const_iterator it = file_list.begin(); it != file_list.end(); ++it) { - FilePath path = *it; + base::FilePath path = *it; // Some users may still have legacy wallpapers with png extension. We need // to delete these wallpapers too. if (!file_util::Delete(path, true) && @@ -675,9 +676,9 @@ void WallpaperManager::DeleteWallpaperInList( } void WallpaperManager::DeleteUserWallpapers(const std::string& email) { - std::vector<FilePath> file_to_remove; + std::vector<base::FilePath> file_to_remove; // Remove small user wallpaper. - FilePath wallpaper_path = GetWallpaperPathForUser(email, true); + base::FilePath wallpaper_path = GetWallpaperPathForUser(email, true); file_to_remove.push_back(wallpaper_path); wallpaper_path = GetCustomWallpaperDir(kSmallWallpaperSubDir, email); file_to_remove.push_back(wallpaper_path); @@ -766,8 +767,8 @@ void WallpaperManager::InitializeRegisteredDeviceWallpaper() { void WallpaperManager::LoadWallpaper(const std::string& email, const WallpaperInfo& info, bool update_wallpaper) { - FilePath wallpaper_dir; - FilePath wallpaper_path; + base::FilePath wallpaper_dir; + base::FilePath wallpaper_path; if (info.type == User::ONLINE) { std::string file_name = GURL(info.file).ExtractFileName(); ash::WallpaperResolution resolution = ash::Shell::GetInstance()-> @@ -776,7 +777,7 @@ void WallpaperManager::LoadWallpaper(const std::string& email, // resolution. if (info.layout != ash::WALLPAPER_LAYOUT_STRETCH && resolution == ash::WALLPAPER_RESOLUTION_SMALL) { - file_name = FilePath(file_name).InsertBeforeExtension( + file_name = base::FilePath(file_name).InsertBeforeExtension( kSmallWallpaperSuffix).value(); } CHECK(PathService::Get(chrome::DIR_CHROMEOS_WALLPAPERS, &wallpaper_dir)); @@ -792,7 +793,7 @@ void WallpaperManager::LoadWallpaper(const std::string& email, // overlooked that case and caused these wallpapers not being loaded at all. // On some slow devices, it caused login webui not visible after upgrade to // M26 from M21. See crosbug.com/38429 for details. - FilePath user_data_dir; + base::FilePath user_data_dir; PathService::Get(chrome::DIR_USER_DATA, &user_data_dir); wallpaper_path = user_data_dir.Append(info.file); StartLoad(email, info, update_wallpaper, wallpaper_path); @@ -895,7 +896,7 @@ bool WallpaperManager::GetUserWallpaperInfo(const std::string& email, void WallpaperManager::GetCustomWallpaperInternalOld( const std::string& email, const WallpaperInfo& info, - const FilePath& wallpaper_path, + const base::FilePath& wallpaper_path, bool update_wallpaper) { DCHECK(BrowserThread::GetBlockingPool()-> IsRunningSequenceOnCurrentThread(sequence_token_)); @@ -913,7 +914,7 @@ void WallpaperManager::GetCustomWallpaperInternalOld( } } - FilePath valid_path = wallpaper_path.DirName().Append(file_name); + base::FilePath valid_path = wallpaper_path.DirName().Append(file_name); if (!file_util::PathExists(valid_path)) valid_path = valid_path.AddExtension(".png"); BrowserThread::PostTask( @@ -1006,27 +1007,26 @@ void WallpaperManager::ProcessCustomWallpaper( DCHECK(BrowserThread::GetBlockingPool()-> IsRunningSequenceOnCurrentThread(sequence_token_)); UserImage wallpaper(*image.get(), raw_image); - if (persistent) - SaveCustomWallpaper(email, FilePath(info.file), info.layout, wallpaper); + if (persistent) { + SaveCustomWallpaper(email, base::FilePath(info.file), info.layout, + wallpaper); + } } void WallpaperManager::SaveCustomWallpaper(const std::string& email, - const FilePath& original_path, + const base::FilePath& original_path, ash::WallpaperLayout layout, const UserImage& wallpaper) { DCHECK(BrowserThread::GetBlockingPool()-> IsRunningSequenceOnCurrentThread(sequence_token_)); EnsureCustomWallpaperDirectories(email); std::string file_name = original_path.BaseName().value(); - FilePath small_wallpaper_path = GetCustomWallpaperPath(kSmallWallpaperSubDir, - email, - file_name); - FilePath large_wallpaper_path = GetCustomWallpaperPath(kLargeWallpaperSubDir, - email, - file_name); - FilePath thumbnail_path = GetCustomWallpaperPath(kThumbnailWallpaperSubDir, - email, - file_name); + base::FilePath small_wallpaper_path = + GetCustomWallpaperPath(kSmallWallpaperSubDir, email, file_name); + base::FilePath large_wallpaper_path = + GetCustomWallpaperPath(kLargeWallpaperSubDir, email, file_name); + base::FilePath thumbnail_path = + GetCustomWallpaperPath(kThumbnailWallpaperSubDir, email, file_name); std::vector<unsigned char> image_data = wallpaper.raw_image(); // Saves the original file in case that resized wallpaper is not generated @@ -1052,7 +1052,7 @@ void WallpaperManager::RecordUma(User::WallpaperType type, int index) { User::WALLPAPER_TYPE_COUNT); } -void WallpaperManager::SaveWallpaperInternal(const FilePath& path, +void WallpaperManager::SaveWallpaperInternal(const base::FilePath& path, const char* data, int size) { int written_bytes = file_util::WriteFile(path, data, size); @@ -1062,7 +1062,7 @@ void WallpaperManager::SaveWallpaperInternal(const FilePath& path, void WallpaperManager::StartLoad(const std::string& email, const WallpaperInfo& info, bool update_wallpaper, - const FilePath& wallpaper_path) { + const base::FilePath& wallpaper_path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); // All wallpaper related operation should run on the same thread. So we pass diff --git a/chrome/browser/chromeos/login/wallpaper_manager.h b/chrome/browser/chromeos/login/wallpaper_manager.h index bbd4ad8..aa8ec23 100644 --- a/chrome/browser/chromeos/login/wallpaper_manager.h +++ b/chrome/browser/chromeos/login/wallpaper_manager.h @@ -101,15 +101,15 @@ class WallpaperManager: public system::TimezoneSettings::Observer, gfx::ImageSkia* wallpaper); // Returns filepath to save original custom wallpaper for the given user. - FilePath GetOriginalWallpaperPathForUser(const std::string& username); + base::FilePath GetOriginalWallpaperPathForUser(const std::string& username); // Returns small resolution custom wallpaper filepath for the given user when // |is_small| is ture. Otherwise, returns large resolution custom wallpaper // path. // TODO(bshe): Remove this function when all custom wallpapers moved to the // new direcotry. crbug.com/174925 - FilePath GetWallpaperPathForUser(const std::string& username, - bool is_small); + base::FilePath GetWallpaperPathForUser(const std::string& username, + bool is_small); // Gets wallpaper information of logged in user. bool GetLoggedInUserWallpaperInfo(WallpaperInfo* info); @@ -131,7 +131,7 @@ class WallpaperManager: public system::TimezoneSettings::Observer, // and |preferred_height| while maintaining aspect ratio. And saves the // resized wallpaper to |path|. void ResizeAndSaveWallpaper(const UserImage& wallpaper, - const FilePath& path, + const base::FilePath& path, ash::WallpaperLayout layout, int preferred_width, int preferred_height); @@ -205,7 +205,7 @@ class WallpaperManager: public system::TimezoneSettings::Observer, void ClearObsoleteWallpaperPrefs(); // Deletes a list of wallpaper files in |file_list|. - void DeleteWallpaperInList(const std::vector<FilePath>& file_list); + void DeleteWallpaperInList(const std::vector<base::FilePath>& file_list); // Deletes all |email| related custom or converted wallpapers. void DeleteUserWallpapers(const std::string& email); @@ -258,7 +258,7 @@ class WallpaperManager: public system::TimezoneSettings::Observer, // loaded wallpaper. Must run on wallpaper sequenced worker thread. void GetCustomWallpaperInternal(const std::string& email, const WallpaperInfo& info, - const FilePath& wallpaper_path, + const base::FilePath& wallpaper_path, bool update_wallpaper); // Gets wallpaper information of |email| from Local State or memory. Returns @@ -287,19 +287,20 @@ class WallpaperManager: public system::TimezoneSettings::Observer, // Saves original custom wallpaper to |path| (absolute path) on filesystem // and starts resizing operation of the custom wallpaper if necessary. void SaveCustomWallpaper(const std::string& email, - const FilePath& path, + const base::FilePath& path, ash::WallpaperLayout layout, const UserImage& wallpaper); // Saves wallpaper image raw |data| to |path| (absolute path) in file system. - void SaveWallpaperInternal(const FilePath& path, const char* data, int size); + void SaveWallpaperInternal(const base::FilePath& path, const char* data, + int size); // Starts to load wallpaper at |wallpaper_path|. If |wallpaper_path| is the // same as |current_wallpaper_path_|, do nothing. Must be called on UI thread. void StartLoad(const std::string& email, const WallpaperInfo& info, bool update_wallpaper, - const FilePath& wallpaper_path); + const base::FilePath& wallpaper_path); // Overridden from chromeos::PowerManagerObserver. virtual void SystemResumed(const base::TimeDelta& sleep_duration) OVERRIDE; @@ -320,7 +321,7 @@ class WallpaperManager: public system::TimezoneSettings::Observer, scoped_refptr<base::SequencedTaskRunner> task_runner_; // The file path of current loaded/loading custom/online wallpaper. - FilePath current_wallpaper_path_; + base::FilePath current_wallpaper_path_; // Loads user wallpaper from its file. scoped_refptr<UserImageLoader> wallpaper_loader_; diff --git a/chrome/browser/chromeos/login/wallpaper_manager_browsertest.cc b/chrome/browser/chromeos/login/wallpaper_manager_browsertest.cc index ea4c5e7..5a8017e 100644 --- a/chrome/browser/chromeos/login/wallpaper_manager_browsertest.cc +++ b/chrome/browser/chromeos/login/wallpaper_manager_browsertest.cc @@ -111,7 +111,7 @@ class WallpaperManagerBrowserTest : public CrosInProcessBrowserTest, // Saves bitmap |resource_id| to disk. void SaveUserWallpaperData(const std::string& username, - const FilePath& wallpaper_path, + const base::FilePath& wallpaper_path, int resource_id) { scoped_refptr<base::RefCountedStaticMemory> image_data( ResourceBundle::GetSharedInstance().LoadDataResourceBytesForScale( @@ -188,12 +188,14 @@ IN_PROC_BROWSER_TEST_F(WallpaperManagerBrowserTest, // Wait for default wallpaper loaded. WaitAsyncWallpaperLoad(); std::string id = base::Int64ToString(base::Time::Now().ToInternalValue()); - FilePath small_wallpaper_path = GetCustomWallpaperPath(kSmallWallpaperSubDir, - kTestUser1, - id); - FilePath large_wallpaper_path = GetCustomWallpaperPath(kLargeWallpaperSubDir, - kTestUser1, - id); + base::FilePath small_wallpaper_path = GetCustomWallpaperPath( + kSmallWallpaperSubDir, + kTestUser1, + id); + base::FilePath large_wallpaper_path = GetCustomWallpaperPath( + kLargeWallpaperSubDir, + kTestUser1, + id); // Saves the small/large resolution wallpapers to small/large custom // wallpaper paths. @@ -276,9 +278,10 @@ IN_PROC_BROWSER_TEST_F(WallpaperManagerBrowserTest, // Change wallpaper to a custom wallpaper. std::string id = base::Int64ToString(base::Time::Now().ToInternalValue()); - FilePath small_wallpaper_path = GetCustomWallpaperPath(kSmallWallpaperSubDir, - kTestUser1, - id); + base::FilePath small_wallpaper_path = GetCustomWallpaperPath( + kSmallWallpaperSubDir, + kTestUser1, + id); SaveUserWallpaperData(kTestUser1, small_wallpaper_path, ash::kDefaultSmallWallpaper.idr); diff --git a/chrome/browser/chromeos/login/wizard_controller.cc b/chrome/browser/chromeos/login/wizard_controller.cc index 4066f70..616218e 100644 --- a/chrome/browser/chromeos/login/wizard_controller.cc +++ b/chrome/browser/chromeos/login/wizard_controller.cc @@ -661,24 +661,24 @@ void WizardController::MarkOobeCompleted() { // completed. // On chrome device, returns /home/chronos/.oobe_completed. // On Linux desktop, returns $HOME/.oobe_completed. -static FilePath GetOobeCompleteFlagPath() { +static base::FilePath GetOobeCompleteFlagPath() { // The constant is defined here so it won't be referenced directly. const char kOobeCompleteFlagFilePath[] = "/home/chronos/.oobe_completed"; if (base::chromeos::IsRunningOnChromeOS()) { - return FilePath(kOobeCompleteFlagFilePath); + return base::FilePath(kOobeCompleteFlagFilePath); } else { const char* home = getenv("HOME"); // Unlikely but if HOME is not defined, use the current directory. if (!home) home = ""; - return FilePath(home).AppendASCII(".oobe_completed"); + return base::FilePath(home).AppendASCII(".oobe_completed"); } } static void CreateOobeCompleteFlagFile() { // Create flag file for boot-time init scripts. - FilePath oobe_complete_path = GetOobeCompleteFlagPath(); + base::FilePath oobe_complete_path = GetOobeCompleteFlagPath(); if (!file_util::PathExists(oobe_complete_path)) { FILE* oobe_flag_file = file_util::OpenFile(oobe_complete_path, "w+b"); if (oobe_flag_file == NULL) @@ -704,7 +704,7 @@ bool WizardController::IsDeviceRegistered() { // Pref is not set. For compatibility check flag file. It causes blocking // IO on UI thread. But it's required for update from old versions. base::ThreadRestrictions::ScopedAllowIO allow_io; - FilePath oobe_complete_flag_file_path = GetOobeCompleteFlagPath(); + base::FilePath oobe_complete_flag_file_path = GetOobeCompleteFlagPath(); bool file_exists = file_util::PathExists(oobe_complete_flag_file_path); SaveIntegerPreferenceForced(kDeviceRegistered, file_exists ? 1 : 0); return file_exists; diff --git a/chrome/browser/chromeos/mobile/mobile_activator.cc b/chrome/browser/chromeos/mobile/mobile_activator.cc index 71cb8f3..b55f041 100644 --- a/chrome/browser/chromeos/mobile/mobile_activator.cc +++ b/chrome/browser/chromeos/mobile/mobile_activator.cc @@ -88,7 +88,7 @@ std::string CellularConfigDocument::GetErrorMessage(const std::string& code) { void CellularConfigDocument::LoadCellularConfigFile() { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); // Load partner customization startup manifest if it is available. - FilePath config_path(kCellularConfigPath); + base::FilePath config_path(kCellularConfigPath); if (!file_util::PathExists(config_path)) return; @@ -107,7 +107,7 @@ void CellularConfigDocument::SetErrorMap( error_map_.insert(map.begin(), map.end()); } -bool CellularConfigDocument::LoadFromFile(const FilePath& config_path) { +bool CellularConfigDocument::LoadFromFile(const base::FilePath& config_path) { std::string config; if (!file_util::ReadFileToString(config_path, &config)) return false; diff --git a/chrome/browser/chromeos/mobile/mobile_activator.h b/chrome/browser/chromeos/mobile/mobile_activator.h index c378f29..5848a55 100644 --- a/chrome/browser/chromeos/mobile/mobile_activator.h +++ b/chrome/browser/chromeos/mobile/mobile_activator.h @@ -37,7 +37,7 @@ class CellularConfigDocument virtual ~CellularConfigDocument(); void SetErrorMap(const ErrorMap& map); - bool LoadFromFile(const FilePath& config_path); + bool LoadFromFile(const base::FilePath& config_path); std::string version_; ErrorMap error_map_; diff --git a/chrome/browser/chromeos/mobile_config.cc b/chrome/browser/chromeos/mobile_config.cc index 0fbb479..eec29c7 100644 --- a/chrome/browser/chromeos/mobile_config.cc +++ b/chrome/browser/chromeos/mobile_config.cc @@ -323,8 +323,8 @@ void MobileConfig::LoadConfig() { BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, base::Bind(&MobileConfig::ReadConfigInBackground, base::Unretained(this), // this class is a singleton. - FilePath(kGlobalCarrierConfigPath), - FilePath(kLocalCarrierConfigPath))); + base::FilePath(kGlobalCarrierConfigPath), + base::FilePath(kLocalCarrierConfigPath))); } void MobileConfig::ProcessConfig(const std::string& global_config, @@ -353,8 +353,9 @@ void MobileConfig::ProcessConfig(const std::string& global_config, } } -void MobileConfig::ReadConfigInBackground(const FilePath& global_config_file, - const FilePath& local_config_file) { +void MobileConfig::ReadConfigInBackground( + const base::FilePath& global_config_file, + const base::FilePath& local_config_file) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); std::string global_config; std::string local_config; diff --git a/chrome/browser/chromeos/process_proxy/process_proxy.cc b/chrome/browser/chromeos/process_proxy/process_proxy.cc index b0d627a..ead1377 100644 --- a/chrome/browser/chromeos/process_proxy/process_proxy.cc +++ b/chrome/browser/chromeos/process_proxy/process_proxy.cc @@ -217,7 +217,8 @@ bool ProcessProxy::LaunchProcess(const std::string& command, int slave_fd, options.ctrl_terminal_fd = slave_fd; // Launch the process. - return base::LaunchProcess(CommandLine(FilePath(command)), options, pid); + return base::LaunchProcess(CommandLine(base::FilePath(command)), options, + pid); } void ProcessProxy::CloseAllFdPairs() { diff --git a/chrome/browser/chromeos/screensaver/screensaver_controller_browsertest.cc b/chrome/browser/chromeos/screensaver/screensaver_controller_browsertest.cc index 656ef80..a763b34 100644 --- a/chrome/browser/chromeos/screensaver/screensaver_controller_browsertest.cc +++ b/chrome/browser/chromeos/screensaver/screensaver_controller_browsertest.cc @@ -17,7 +17,7 @@ namespace { scoped_refptr<extensions::Extension> CreateTestScreensaverExtension() { scoped_refptr<extensions::Extension> extension = extensions::ExtensionBuilder() - .SetPath(FilePath()) + .SetPath(base::FilePath()) .SetManifest(extensions::DictionaryBuilder() .Set("name", "Screensaver Extension") .Set("version", "1") diff --git a/chrome/browser/chromeos/settings/device_settings_provider_unittest.cc b/chrome/browser/chromeos/settings/device_settings_provider_unittest.cc index d9d6c69..f316153 100644 --- a/chrome/browser/chromeos/settings/device_settings_provider_unittest.cc +++ b/chrome/browser/chromeos/settings/device_settings_provider_unittest.cc @@ -245,7 +245,7 @@ TEST_F(DeviceSettingsProviderTest, PolicyLoadNotification) { TEST_F(DeviceSettingsProviderTest, StatsReportingMigration) { // Create the legacy consent file. - FilePath consent_file; + base::FilePath consent_file; ASSERT_TRUE(PathService::Get(chrome::DIR_USER_DATA, &consent_file)); consent_file = consent_file.AppendASCII("Consent To Send Stats"); ASSERT_EQ(1, file_util::WriteFile(consent_file, "0", 1)); diff --git a/chrome/browser/chromeos/settings/owner_key_util.cc b/chrome/browser/chromeos/settings/owner_key_util.cc index 8bbdc01..e5aee02 100644 --- a/chrome/browser/chromeos/settings/owner_key_util.cc +++ b/chrome/browser/chromeos/settings/owner_key_util.cc @@ -17,7 +17,7 @@ namespace chromeos { // OwnerKeyUtil OwnerKeyUtil* OwnerKeyUtil::Create() { - return new OwnerKeyUtilImpl(FilePath(OwnerKeyUtilImpl::kOwnerKeyFile)); + return new OwnerKeyUtilImpl(base::FilePath(OwnerKeyUtilImpl::kOwnerKeyFile)); } OwnerKeyUtil::OwnerKeyUtil() {} @@ -30,7 +30,7 @@ OwnerKeyUtil::~OwnerKeyUtil() {} // static const char OwnerKeyUtilImpl::kOwnerKeyFile[] = "/var/lib/whitelist/owner.key"; -OwnerKeyUtilImpl::OwnerKeyUtilImpl(const FilePath& key_file) +OwnerKeyUtilImpl::OwnerKeyUtilImpl(const base::FilePath& key_file) : key_file_(key_file) {} OwnerKeyUtilImpl::~OwnerKeyUtilImpl() {} diff --git a/chrome/browser/chromeos/settings/owner_key_util_unittest.cc b/chrome/browser/chromeos/settings/owner_key_util_unittest.cc index 8f62299..9ac917c 100644 --- a/chrome/browser/chromeos/settings/owner_key_util_unittest.cc +++ b/chrome/browser/chromeos/settings/owner_key_util_unittest.cc @@ -59,7 +59,7 @@ class OwnerKeyUtilTest : public testing::Test { } base::ScopedTempDir tmpdir_; - FilePath key_file_; + base::FilePath key_file_; scoped_refptr<OwnerKeyUtil> util_; private: diff --git a/chrome/browser/chromeos/system/ash_system_tray_delegate.cc b/chrome/browser/chromeos/system/ash_system_tray_delegate.cc index 0c5b636..d69e280 100644 --- a/chrome/browser/chromeos/system/ash_system_tray_delegate.cc +++ b/chrome/browser/chromeos/system/ash_system_tray_delegate.cc @@ -597,7 +597,7 @@ class SystemTrayDelegate : public ash::SystemTrayDelegate, ActivateInputMethodProperty(key); } - virtual void CancelDriveOperation(const FilePath& file_path) OVERRIDE { + virtual void CancelDriveOperation(const base::FilePath& file_path) OVERRIDE { DriveSystemService* system_service = FindDriveSystemService(); if (!system_service) return; diff --git a/chrome/browser/chromeos/system/drm_settings.cc b/chrome/browser/chromeos/system/drm_settings.cc index d290859..7bb6fd7 100644 --- a/chrome/browser/chromeos/system/drm_settings.cc +++ b/chrome/browser/chromeos/system/drm_settings.cc @@ -40,10 +40,10 @@ void ManageDrmIdentifierOnFileThread(bool enable, const std::string& email) { // Drop the file under <data>/<profile>/<drm id file>. // TODO(wad) get the profile directory in a more succinct fashion. - FilePath drm_id_file; + base::FilePath drm_id_file; PathService::Get(chrome::DIR_USER_DATA, &drm_id_file); const CommandLine& cmd_line = *CommandLine::ForCurrentProcess(); - FilePath profile = cmd_line.GetSwitchValuePath(switches::kLoginProfile); + base::FilePath profile = cmd_line.GetSwitchValuePath(switches::kLoginProfile); if (profile.empty()) { LOG(ERROR) << "called with no login-profile!"; return; diff --git a/chrome/browser/chromeos/system/input_device_settings.cc b/chrome/browser/chromeos/system/input_device_settings.cc index 6b2f925..da16565 100644 --- a/chrome/browser/chromeos/system/input_device_settings.cc +++ b/chrome/browser/chromeos/system/input_device_settings.cc @@ -28,7 +28,7 @@ const char kMouseControl[] = "/opt/google/mouse/mousecontrol"; bool ScriptExists(const std::string& script) { DCHECK(content::BrowserThread::GetBlockingPool()->RunsTasksOnCurrentThread()); - return file_util::PathExists(FilePath(script)); + return file_util::PathExists(base::FilePath(script)); } // Executes the input control script asynchronously, if it exists. diff --git a/chrome/browser/chromeos/system/name_value_pairs_parser.cc b/chrome/browser/chromeos/system/name_value_pairs_parser.cc index 2c89e7c..84928c7 100644 --- a/chrome/browser/chromeos/system/name_value_pairs_parser.cc +++ b/chrome/browser/chromeos/system/name_value_pairs_parser.cc @@ -24,7 +24,7 @@ const char kTrimChars[] = "\" "; bool GetToolOutput(int argc, const char* argv[], std::string& output) { DCHECK_GE(argc, 1); - if (!file_util::PathExists(FilePath(argv[0]))) { + if (!file_util::PathExists(base::FilePath(argv[0]))) { LOG(WARNING) << "Tool for statistics not found: " << argv[0]; return false; } @@ -118,9 +118,10 @@ bool NameValuePairsParser::GetSingleValueFromTool(int argc, return true; } -bool NameValuePairsParser::GetNameValuePairsFromFile(const FilePath& file_path, - const std::string& eq, - const std::string& delim) { +bool NameValuePairsParser::GetNameValuePairsFromFile( + const base::FilePath& file_path, + const std::string& eq, + const std::string& delim) { std::string contents; if (file_util::ReadFileToString(file_path, &contents)) { return ParseNameValuePairs(contents, eq, delim); diff --git a/chrome/browser/chromeos/system/power_manager_settings.cc b/chrome/browser/chromeos/system/power_manager_settings.cc index eb35311..d112b8d 100644 --- a/chrome/browser/chromeos/system/power_manager_settings.cc +++ b/chrome/browser/chromeos/system/power_manager_settings.cc @@ -23,7 +23,7 @@ void EnableScreenLockOnFileThread(bool enable) { if (base::chromeos::IsRunningOnChromeOS()) { std::string config = base::StringPrintf("%d", enable); - file_util::WriteFile(FilePath(kLockOnIdleSuspendPath), + file_util::WriteFile(base::FilePath(kLockOnIdleSuspendPath), config.c_str(), config.size()); } diff --git a/chrome/browser/chromeos/system/statistics_provider.cc b/chrome/browser/chromeos/system/statistics_provider.cc index d459b7c..c8b6d74 100644 --- a/chrome/browser/chromeos/system/statistics_provider.cc +++ b/chrome/browser/chromeos/system/statistics_provider.cc @@ -156,7 +156,7 @@ StatisticsProviderImpl::StatisticsProviderImpl() void StatisticsProviderImpl::LoadMachineOSInfoFile() { NameValuePairsParser parser(&machine_info_); - if (parser.GetNameValuePairsFromFile(FilePath(kMachineOSInfoFile), + if (parser.GetNameValuePairsFromFile(base::FilePath(kMachineOSInfoFile), kMachineOSInfoEq, kMachineOSInfoDelim)) { #if defined(GOOGLE_CHROME_BUILD) @@ -200,13 +200,13 @@ void StatisticsProviderImpl::LoadMachineStatistics() { else machine_info_[kHardwareClassKey] = hardware_class; - parser.GetNameValuePairsFromFile(FilePath(kMachineHardwareInfoFile), + parser.GetNameValuePairsFromFile(base::FilePath(kMachineHardwareInfoFile), kMachineHardwareInfoEq, kMachineHardwareInfoDelim); - parser.GetNameValuePairsFromFile(FilePath(kEchoCouponFile), + parser.GetNameValuePairsFromFile(base::FilePath(kEchoCouponFile), kEchoCouponEq, kEchoCouponDelim); - parser.GetNameValuePairsFromFile(FilePath(kVpdFile), kVpdEq, kVpdDelim); + parser.GetNameValuePairsFromFile(base::FilePath(kVpdFile), kVpdEq, kVpdDelim); // Finished loading the statistics. on_statistics_loaded_.Signal(); diff --git a/chrome/browser/chromeos/system/syslogs_provider.cc b/chrome/browser/chromeos/system/syslogs_provider.cc index 6837b7d..ac06731 100644 --- a/chrome/browser/chromeos/system/syslogs_provider.cc +++ b/chrome/browser/chromeos/system/syslogs_provider.cc @@ -118,10 +118,10 @@ std::string ReadValue(std::string* data) { // values are "sysinfo" or "feedback"; in case of an invalid // value, the script will currently default to "sysinfo" -LogDictionaryType* GetSystemLogs(FilePath* zip_file_name, +LogDictionaryType* GetSystemLogs(base::FilePath* zip_file_name, const std::string& context) { // Create the temp file, logs will go here - FilePath temp_filename; + base::FilePath temp_filename; if (!file_util::CreateTemporaryFile(&temp_filename)) return NULL; @@ -203,7 +203,7 @@ class SyslogsProviderImpl : public SyslogsProvider { const ReadCompleteCallback& callback); // Loads compressed logs and writes into |zip_content|. - void LoadCompressedLogs(const FilePath& zip_file, + void LoadCompressedLogs(const base::FilePath& zip_file, std::string* zip_content); SyslogsProviderImpl(); @@ -306,7 +306,7 @@ void SyslogsProviderImpl::ReadSyslogs( return; // Create temp file. - FilePath zip_file; + base::FilePath zip_file; if (compress_logs && !file_util::CreateTemporaryFile(&zip_file)) { LOG(ERROR) << "Cannot create temp file"; compress_logs = false; @@ -349,7 +349,7 @@ void SyslogsProviderImpl::ReadSyslogs( handler->StartFetch(MemoryDetails::UPDATE_USER_METRICS); } -void SyslogsProviderImpl::LoadCompressedLogs(const FilePath& zip_file, +void SyslogsProviderImpl::LoadCompressedLogs(const base::FilePath& zip_file, std::string* zip_content) { DCHECK(zip_content); if (!file_util::ReadFileToString(zip_file, zip_content)) { diff --git a/chrome/browser/chromeos/system/timezone_settings.cc b/chrome/browser/chromeos/system/timezone_settings.cc index 8b59301..7cd8e95 100644 --- a/chrome/browser/chromeos/system/timezone_settings.cc +++ b/chrome/browser/chromeos/system/timezone_settings.cc @@ -162,9 +162,9 @@ void SetTimezoneIDFromString(const std::string& id) { // We want to do this in an atomic way. So we are going to create the symlink // at kTimezoneSymlink2 and then move it to kTimezoneSymlink - FilePath timezone_symlink(kTimezoneSymlink); - FilePath timezone_symlink2(kTimezoneSymlink2); - FilePath timezone_file(kTimezoneFilesDir + id); + base::FilePath timezone_symlink(kTimezoneSymlink); + base::FilePath timezone_symlink2(kTimezoneSymlink2); + base::FilePath timezone_file(kTimezoneFilesDir + id); // Make sure timezone_file exists. if (!file_util::PathExists(timezone_file)) { diff --git a/chrome/browser/chromeos/system_logs/command_line_log_source.cc b/chrome/browser/chromeos/system_logs/command_line_log_source.cc index d127278..55e5548 100644 --- a/chrome/browser/chromeos/system_logs/command_line_log_source.cc +++ b/chrome/browser/chromeos/system_logs/command_line_log_source.cc @@ -24,37 +24,38 @@ void ExecuteCommandLines(chromeos::SystemLogsResponse* response) { // it more easier to modify and understand. std::vector<std::pair<std::string, CommandLine> > commands; - CommandLine command(FilePath("/usr/bin/amixer")); + CommandLine command(base::FilePath("/usr/bin/amixer")); command.AppendArg("-c0"); command.AppendArg("contents"); commands.push_back(std::make_pair("alsa controls", command)); - command = CommandLine((FilePath("/usr/bin/cras_test_client"))); + command = CommandLine((base::FilePath("/usr/bin/cras_test_client"))); command.AppendArg("--dump_server_info"); commands.push_back(std::make_pair("cras", command)); - command = CommandLine((FilePath("/usr/bin/printenv"))); + command = CommandLine((base::FilePath("/usr/bin/printenv"))); commands.push_back(std::make_pair("env", command)); - command = CommandLine(FilePath("/usr/bin/setxkbmap")); + command = CommandLine(base::FilePath("/usr/bin/setxkbmap")); command.AppendArg("-print"); command.AppendArg("-query"); commands.push_back(std::make_pair("setxkbmap", command)); - command = CommandLine(FilePath("/usr/bin/xinput")); + command = CommandLine(base::FilePath("/usr/bin/xinput")); command.AppendArg("list"); command.AppendArg("--long"); commands.push_back(std::make_pair("xinput", command)); - command = CommandLine(FilePath("/usr/bin/xrandr")); + command = CommandLine(base::FilePath("/usr/bin/xrandr")); command.AppendArg("--verbose"); commands.push_back(std::make_pair("xrandr", command)); - command = CommandLine(FilePath("/opt/google/touchpad/tpcontrol")); + command = CommandLine(base::FilePath("/opt/google/touchpad/tpcontrol")); command.AppendArg("status"); commands.push_back(std::make_pair("hack-33025-touchpad", command)); - command = CommandLine(FilePath("/opt/google/touchpad/generate_userfeedback")); + command = + CommandLine(base::FilePath("/opt/google/touchpad/generate_userfeedback")); commands.push_back(std::make_pair("hack-33025-touchpad_activity", command)); for (size_t i = 0; i < commands.size(); ++i) { diff --git a/chrome/browser/chromeos/system_logs/debug_daemon_log_source.cc b/chrome/browser/chromeos/system_logs/debug_daemon_log_source.cc index 22f4ea8..692cdfc 100644 --- a/chrome/browser/chromeos/system_logs/debug_daemon_log_source.cc +++ b/chrome/browser/chromeos/system_logs/debug_daemon_log_source.cc @@ -139,7 +139,7 @@ void DebugDaemonLogSource::ReadUserLogFiles(const KeyValueMap& user_log_files) { ++it) { std::string value; bool read_success = file_util::ReadFileToString( - FilePath(it->second), &value); + base::FilePath(it->second), &value); if (read_success && !value.empty()) (*response_)[it->first] = value; else diff --git a/chrome/browser/chromeos/system_logs/lsb_release_log_source.cc b/chrome/browser/chromeos/system_logs/lsb_release_log_source.cc index 645a56b..56c3496 100644 --- a/chrome/browser/chromeos/system_logs/lsb_release_log_source.cc +++ b/chrome/browser/chromeos/system_logs/lsb_release_log_source.cc @@ -42,7 +42,7 @@ void LsbReleaseLogSource::Fetch(const SysLogsSourceCallback& callback) { void LsbReleaseLogSource::ReadLSBRelease(SystemLogsResponse* response) { DCHECK(response); - const FilePath lsb_release_file("/etc/lsb-release"); + const base::FilePath lsb_release_file("/etc/lsb-release"); std::string lsb_data; bool read_success = file_util::ReadFileToString(lsb_release_file, &lsb_data); // if we were using an internal temp file, the user does not need the diff --git a/chrome/browser/chromeos/version_loader.cc b/chrome/browser/chromeos/version_loader.cc index 5258928..6334b16 100644 --- a/chrome/browser/chromeos/version_loader.cc +++ b/chrome/browser/chromeos/version_loader.cc @@ -134,7 +134,7 @@ void VersionLoader::Backend::GetVersion(VersionFormat format, DCHECK(BrowserThread::GetBlockingPool()->RunsTasksOnCurrentThread()); std::string contents; - const FilePath file_path(kPathVersion); + const base::FilePath file_path(kPathVersion); if (file_util::ReadFileToString(file_path, &contents)) { *version = ParseVersion( contents, @@ -158,7 +158,7 @@ void VersionLoader::Backend::GetFirmware(std::string* firmware) { DCHECK(BrowserThread::GetBlockingPool()->RunsTasksOnCurrentThread()); std::string contents; - const FilePath file_path(kPathFirmware); + const base::FilePath file_path(kPathFirmware); if (file_util::ReadFileToString(file_path, &contents)) { *firmware = ParseFirmware(contents); } diff --git a/chrome/browser/collected_cookies_browsertest.cc b/chrome/browser/collected_cookies_browsertest.cc index cf9f281..b8548e8 100644 --- a/chrome/browser/collected_cookies_browsertest.cc +++ b/chrome/browser/collected_cookies_browsertest.cc @@ -17,7 +17,8 @@ namespace { -const FilePath::CharType kDocRoot[] = FILE_PATH_LITERAL("chrome/test/data"); +const base::FilePath::CharType kDocRoot[] = + FILE_PATH_LITERAL("chrome/test/data"); } // namespace diff --git a/chrome/browser/component_updater/component_unpacker.cc b/chrome/browser/component_updater/component_unpacker.cc index 680a296..c9d4409 100644 --- a/chrome/browser/component_updater/component_unpacker.cc +++ b/chrome/browser/component_updater/component_unpacker.cc @@ -83,8 +83,9 @@ class CRXValidator { // TODO(cpu): add a specific attribute check to a component json that the // extension unpacker will reject, so that a component cannot be installed // as an extension. -base::DictionaryValue* ReadManifest(const FilePath& unpack_path) { - FilePath manifest = unpack_path.Append(FILE_PATH_LITERAL("manifest.json")); +base::DictionaryValue* ReadManifest(const base::FilePath& unpack_path) { + base::FilePath manifest = + unpack_path.Append(FILE_PATH_LITERAL("manifest.json")); if (!file_util::PathExists(manifest)) return NULL; JSONFileValueSerializer serializer(manifest); @@ -100,7 +101,7 @@ base::DictionaryValue* ReadManifest(const FilePath& unpack_path) { } // namespace. ComponentUnpacker::ComponentUnpacker(const std::vector<uint8>& pk_hash, - const FilePath& path, + const base::FilePath& path, ComponentInstaller* installer) : error_(kNone) { if (pk_hash.empty() || path.empty()) { diff --git a/chrome/browser/component_updater/component_unpacker.h b/chrome/browser/component_updater/component_unpacker.h index 86d623a..be26517 100644 --- a/chrome/browser/component_updater/component_unpacker.h +++ b/chrome/browser/component_updater/component_unpacker.h @@ -41,7 +41,7 @@ class ComponentUnpacker { // Unpacks, verifies and calls the installer. |pk_hash| is the expected // public key SHA256 hash. |path| is the current location of the CRX. ComponentUnpacker(const std::vector<uint8>& pk_hash, - const FilePath& path, + const base::FilePath& path, ComponentInstaller* installer); // If something went wrong during unpacking or installer invocation, the @@ -51,7 +51,7 @@ class ComponentUnpacker { Error error() const { return error_; } private: - FilePath unpack_path_; + base::FilePath unpack_path_; Error error_; }; diff --git a/chrome/browser/component_updater/component_updater_service.cc b/chrome/browser/component_updater/component_updater_service.cc index f1ee355..cac5efe 100644 --- a/chrome/browser/component_updater/component_updater_service.cc +++ b/chrome/browser/component_updater/component_updater_service.cc @@ -327,7 +327,7 @@ class CrxUpdateService : public ComponentUpdateService { void ParseManifest(const std::string& xml); - void Install(const CRXContext* context, const FilePath& crx_path); + void Install(const CRXContext* context, const base::FilePath& crx_path); void DoneInstalling(const std::string& component_id, ComponentUnpacker::Error error); @@ -723,7 +723,7 @@ void CrxUpdateService::OnURLFetchComplete(const net::URLFetcher* source, url_fetcher_.reset(); ScheduleNextRun(false); } else { - FilePath temp_crx_path; + base::FilePath temp_crx_path; CHECK(source->GetResponseAsFilePath(true, &temp_crx_path)); size_t count = ChangeItemStatus(CrxUpdateItem::kDownloading, CrxUpdateItem::kUpdating); @@ -752,7 +752,7 @@ void CrxUpdateService::OnURLFetchComplete(const net::URLFetcher* source, // |unpacker|. If there is an error this function is in charge of deleting // the files created. void CrxUpdateService::Install(const CRXContext* context, - const FilePath& crx_path) { + const base::FilePath& crx_path) { // This function owns the |crx_path| and the |context| object. DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); ComponentUnpacker diff --git a/chrome/browser/component_updater/pepper_flash_component_installer.cc b/chrome/browser/component_updater/pepper_flash_component_installer.cc index 76ee1af..d4d7037 100644 --- a/chrome/browser/component_updater/pepper_flash_component_installer.cc +++ b/chrome/browser/component_updater/pepper_flash_component_installer.cc @@ -76,8 +76,8 @@ const char kNullVersion[] = "0.0.0.0"; // The base directory on Windows looks like: // <profile>\AppData\Local\Google\Chrome\User Data\PepperFlash\. -FilePath GetPepperFlashBaseDirectory() { - FilePath result; +base::FilePath GetPepperFlashBaseDirectory() { + base::FilePath result; PathService::Get(chrome::DIR_COMPONENT_UPDATED_PEPPER_FLASH_PLUGIN, &result); return result; } @@ -89,14 +89,14 @@ FilePath GetPepperFlashBaseDirectory() { // <profile>\AppData\Local\Google\Chrome\User Data\PepperFlash\10.3.44.555\. // |latest_version| returns the corresponding version number. |older_dirs| // returns directories of all older versions. -bool GetPepperFlashDirectory(FilePath* latest_dir, +bool GetPepperFlashDirectory(base::FilePath* latest_dir, Version* latest_version, - std::vector<FilePath>* older_dirs) { - FilePath base_dir = GetPepperFlashBaseDirectory(); + std::vector<base::FilePath>* older_dirs) { + base::FilePath base_dir = GetPepperFlashBaseDirectory(); bool found = false; file_util::FileEnumerator file_enumerator(base_dir, false, file_util::FileEnumerator::DIRECTORIES); - for (FilePath path = file_enumerator.Next(); !path.value().empty(); + for (base::FilePath path = file_enumerator.Next(); !path.value().empty(); path = file_enumerator.Next()) { Version version(path.BaseName().MaybeAsASCII()); if (!version.IsValid()) @@ -131,7 +131,7 @@ bool SupportsPepperInterface(const char* interface_name) { return (strcmp(interface_name, PPB_PDF_INTERFACE) == 0); } -bool MakePepperFlashPluginInfo(const FilePath& flash_path, +bool MakePepperFlashPluginInfo(const base::FilePath& flash_path, const Version& flash_version, bool out_of_process, content::PepperPluginInfo* plugin_info) { @@ -172,7 +172,7 @@ bool IsPepperFlash(const webkit::WebPluginInfo& plugin) { (plugin.pepper_permissions & ppapi::PERMISSION_FLASH); } -void RegisterPepperFlashWithChrome(const FilePath& path, +void RegisterPepperFlashWithChrome(const base::FilePath& path, const Version& version) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); content::PepperPluginInfo plugin_info; @@ -244,7 +244,7 @@ class PepperFlashComponentInstaller : public ComponentInstaller { virtual void OnUpdateError(int error) OVERRIDE; virtual bool Install(base::DictionaryValue* manifest, - const FilePath& unpack_path) OVERRIDE; + const base::FilePath& unpack_path) OVERRIDE; private: Version current_version_; @@ -260,7 +260,7 @@ void PepperFlashComponentInstaller::OnUpdateError(int error) { } bool PepperFlashComponentInstaller::Install(base::DictionaryValue* manifest, - const FilePath& unpack_path) { + const base::FilePath& unpack_path) { Version version; if (!CheckPepperFlashManifest(manifest, &version)) return false; @@ -270,7 +270,7 @@ bool PepperFlashComponentInstaller::Install(base::DictionaryValue* manifest, chrome::kPepperFlashPluginFilename))) return false; // Passed the basic tests. Time to install it. - FilePath path = + base::FilePath path = GetPepperFlashBaseDirectory().AppendASCII(version.GetString()); if (file_util::PathExists(path)) return false; @@ -344,7 +344,7 @@ void FinishPepperFlashUpdateRegistration(ComponentUpdateService* cus, void StartPepperFlashUpdateRegistration(ComponentUpdateService* cus) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); - FilePath path = GetPepperFlashBaseDirectory(); + base::FilePath path = GetPepperFlashBaseDirectory(); if (!file_util::PathExists(path)) { if (!file_util::CreateDirectory(path)) { NOTREACHED() << "Could not create Pepper Flash directory."; @@ -353,7 +353,7 @@ void StartPepperFlashUpdateRegistration(ComponentUpdateService* cus) { } Version version(kNullVersion); - std::vector<FilePath> older_dirs; + std::vector<base::FilePath> older_dirs; if (GetPepperFlashDirectory(&path, &version, &older_dirs)) { path = path.Append(chrome::kPepperFlashPluginFilename); if (file_util::PathExists(path)) { @@ -370,7 +370,7 @@ void StartPepperFlashUpdateRegistration(ComponentUpdateService* cus) { base::Bind(&FinishPepperFlashUpdateRegistration, cus, version)); // Remove older versions of Pepper Flash. - for (std::vector<FilePath>::iterator iter = older_dirs.begin(); + for (std::vector<base::FilePath>::iterator iter = older_dirs.begin(); iter != older_dirs.end(); ++iter) { file_util::Delete(*iter, true); } diff --git a/chrome/browser/component_updater/pnacl/pnacl_component_installer.cc b/chrome/browser/component_updater/pnacl/pnacl_component_installer.cc index fbbb315..f9cf2da 100644 --- a/chrome/browser/component_updater/pnacl/pnacl_component_installer.cc +++ b/chrome/browser/component_updater/pnacl/pnacl_component_installer.cc @@ -137,20 +137,21 @@ const char kNullVersion[] = "0.0.0.0"; // <profile>\AppData\Local\Google\Chrome\User Data\Pnacl\0.1.2.3\. // and the base directory will be: // <profile>\AppData\Local\Google\Chrome\User Data\Pnacl\. -FilePath GetPnaclBaseDirectory() { - FilePath result; +base::FilePath GetPnaclBaseDirectory() { + base::FilePath result; CHECK(PathService::Get(chrome::DIR_PNACL_BASE, &result)); return result; } -bool GetLatestPnaclDirectory(FilePath* latest_dir, Version* latest_version, - std::vector<FilePath>* older_dirs) { +bool GetLatestPnaclDirectory(base::FilePath* latest_dir, + Version* latest_version, + std::vector<base::FilePath>* older_dirs) { // Enumerate all versions starting from the base directory. - FilePath base_dir = GetPnaclBaseDirectory(); + base::FilePath base_dir = GetPnaclBaseDirectory(); bool found = false; file_util::FileEnumerator file_enumerator(base_dir, false, file_util::FileEnumerator::DIRECTORIES); - for (FilePath path = file_enumerator.Next(); !path.value().empty(); + for (base::FilePath path = file_enumerator.Next(); !path.value().empty(); path = file_enumerator.Next()) { Version version(path.BaseName().MaybeAsASCII()); if (!version.IsValid()) @@ -173,8 +174,8 @@ bool GetLatestPnaclDirectory(FilePath* latest_dir, Version* latest_version, } // Read the PNaCl specific manifest. -base::DictionaryValue* ReadPnaclManifest(const FilePath& unpack_path) { - FilePath manifest = unpack_path.Append( +base::DictionaryValue* ReadPnaclManifest(const base::FilePath& unpack_path) { + base::FilePath manifest = unpack_path.Append( FILE_PATH_LITERAL("pnacl_public_pnacl_json")); if (!file_util::PathExists(manifest)) return NULL; @@ -235,7 +236,7 @@ class PnaclComponentInstaller : public ComponentInstaller { virtual void OnUpdateError(int error) OVERRIDE; virtual bool Install(base::DictionaryValue* manifest, - const FilePath& unpack_path) OVERRIDE; + const base::FilePath& unpack_path) OVERRIDE; private: Version current_version_; @@ -252,7 +253,7 @@ void PnaclComponentInstaller::OnUpdateError(int error) { namespace { -bool PathContainsPnacl(const FilePath& base_path) { +bool PathContainsPnacl(const base::FilePath& base_path) { // Check that at least one of the compiler files exists, for the current ISA. std::string expected_filename("pnacl_public_"); std::string arch = PnaclArch(); @@ -264,7 +265,7 @@ bool PathContainsPnacl(const FilePath& base_path) { } // namespace bool PnaclComponentInstaller::Install(base::DictionaryValue* manifest, - const FilePath& unpack_path) { + const base::FilePath& unpack_path) { scoped_ptr<base::DictionaryValue> pnacl_manifest( ReadPnaclManifest(unpack_path)); if (pnacl_manifest == NULL) { @@ -290,7 +291,7 @@ bool PnaclComponentInstaller::Install(base::DictionaryValue* manifest, } // Passed the basic tests. Time to install it. - FilePath path = + base::FilePath path = GetPnaclBaseDirectory().AppendASCII(version.GetString()); if (file_util::PathExists(path)) { LOG(WARNING) << "Target path already exists, not installing."; @@ -334,7 +335,7 @@ void FinishPnaclUpdateRegistration(ComponentUpdateService* cus, // a hosted version is actually newer. void StartPnaclUpdateRegistration(ComponentUpdateService* cus) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); - FilePath path = GetPnaclBaseDirectory(); + base::FilePath path = GetPnaclBaseDirectory(); if (!file_util::PathExists(path)) { if (!file_util::CreateDirectory(path)) { NOTREACHED() << "Could not create base Pnacl directory."; @@ -343,7 +344,7 @@ void StartPnaclUpdateRegistration(ComponentUpdateService* cus) { } Version version(kNullVersion); - std::vector<FilePath> older_dirs; + std::vector<base::FilePath> older_dirs; if (GetLatestPnaclDirectory(&path, &version, &older_dirs)) { if (!PathContainsPnacl(path)) { version = Version(kNullVersion); @@ -357,7 +358,7 @@ void StartPnaclUpdateRegistration(ComponentUpdateService* cus) { base::Bind(&FinishPnaclUpdateRegistration, cus, version)); // Remove older versions of PNaCl. - for (std::vector<FilePath>::iterator iter = older_dirs.begin(); + for (std::vector<base::FilePath>::iterator iter = older_dirs.begin(); iter != older_dirs.end(); ++iter) { file_util::Delete(*iter, true); } diff --git a/chrome/browser/component_updater/recovery_component_installer.cc b/chrome/browser/component_updater/recovery_component_installer.cc index 3573549..f665b68 100644 --- a/chrome/browser/component_updater/recovery_component_installer.cc +++ b/chrome/browser/component_updater/recovery_component_installer.cc @@ -33,7 +33,7 @@ const uint8 sha2_hash[] = {0xdf, 0x39, 0x9a, 0x9b, 0x28, 0x3a, 0x9b, 0x0c, 0xf6, 0x29, 0x7c, 0x0a, 0x5f, 0xea, 0x67, 0xb7}; // File name of the recovery binary on different platforms. -const FilePath::CharType kRecoveryFileName[] = +const base::FilePath::CharType kRecoveryFileName[] = #if defined(OS_WIN) FILE_PATH_LITERAL("ChromeRecovery.exe"); #else // OS_LINUX, OS_MACOSX, etc. @@ -54,7 +54,7 @@ class RecoveryComponentInstaller : public ComponentInstaller { virtual void OnUpdateError(int error) OVERRIDE; virtual bool Install(base::DictionaryValue* manifest, - const FilePath& unpack_path) OVERRIDE; + const base::FilePath& unpack_path) OVERRIDE; private: Version current_version_; @@ -102,7 +102,7 @@ void RecoveryComponentInstaller::OnUpdateError(int error) { } bool RecoveryComponentInstaller::Install(base::DictionaryValue* manifest, - const FilePath& unpack_path) { + const base::FilePath& unpack_path) { std::string name; manifest->GetStringASCII("name", &name); if (name != kRecoveryManifestName) @@ -114,7 +114,7 @@ bool RecoveryComponentInstaller::Install(base::DictionaryValue* manifest, return false; if (current_version_.CompareTo(version) >= 0) return false; - FilePath main_file = unpack_path.Append(kRecoveryFileName); + base::FilePath main_file = unpack_path.Append(kRecoveryFileName); if (!file_util::PathExists(main_file)) return false; // Passed the basic tests. The installation continues with the diff --git a/chrome/browser/component_updater/swiftshader_component_installer.cc b/chrome/browser/component_updater/swiftshader_component_installer.cc index d10f173..1a155ec0 100644 --- a/chrome/browser/component_updater/swiftshader_component_installer.cc +++ b/chrome/browser/component_updater/swiftshader_component_installer.cc @@ -32,14 +32,14 @@ const uint8 sha2_hash[] = {0xd7, 0x56, 0x36, 0x6d, 0xde, 0xf6, 0x15, 0x3b, 0x52, 0x47, 0x62, 0xed, 0x12, 0xca, 0xcc, 0x6a}; // File name of the internal SwiftShader plugin on different platforms. -const FilePath::CharType kSwiftShaderEglName[] = +const base::FilePath::CharType kSwiftShaderEglName[] = FILE_PATH_LITERAL("libegl.dll"); -const FilePath::CharType kSwiftShaderGlesName[] = +const base::FilePath::CharType kSwiftShaderGlesName[] = FILE_PATH_LITERAL("libglesv2.dll"); const char kSwiftShaderManifestName[] = "SwiftShader"; -const FilePath::CharType kSwiftShaderBaseDirectory[] = +const base::FilePath::CharType kSwiftShaderBaseDirectory[] = FILE_PATH_LITERAL("SwiftShader"); // If we don't have a SwiftShader component, this is the version we claim. @@ -47,8 +47,8 @@ const char kNullVersion[] = "0.0.0.0"; // The base directory on windows looks like: // <profile>\AppData\Local\Google\Chrome\User Data\SwiftShader\. -FilePath GetSwiftShaderBaseDirectory() { - FilePath result; +base::FilePath GetSwiftShaderBaseDirectory() { + base::FilePath result; PathService::Get(chrome::DIR_USER_DATA, &result); return result.Append(kSwiftShaderBaseDirectory); } @@ -57,14 +57,14 @@ FilePath GetSwiftShaderBaseDirectory() { // so we need to enumerate the directories to find the full path. // On success it returns something like: // <profile>\AppData\Local\Google\Chrome\User Data\SwiftShader\10.3.44.555\. -bool GetLatestSwiftShaderDirectory(FilePath* result, +bool GetLatestSwiftShaderDirectory(base::FilePath* result, Version* latest, - std::vector<FilePath>* older_dirs) { - FilePath base_dir = GetSwiftShaderBaseDirectory(); + std::vector<base::FilePath>* older_dirs) { + base::FilePath base_dir = GetSwiftShaderBaseDirectory(); bool found = false; file_util::FileEnumerator file_enumerator(base_dir, false, file_util::FileEnumerator::DIRECTORIES); - for (FilePath path = file_enumerator.Next(); !path.value().empty(); + for (base::FilePath path = file_enumerator.Next(); !path.value().empty(); path = file_enumerator.Next()) { Version version(path.BaseName().MaybeAsASCII()); if (!version.IsValid()) @@ -85,7 +85,7 @@ bool GetLatestSwiftShaderDirectory(FilePath* result, return found; } -void RegisterSwiftShaderWithChrome(const FilePath& path) { +void RegisterSwiftShaderWithChrome(const base::FilePath& path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); GpuDataManager::GetInstance()->RegisterSwiftShaderPath(path); } @@ -101,7 +101,7 @@ class SwiftShaderComponentInstaller : public ComponentInstaller { virtual void OnUpdateError(int error) OVERRIDE; virtual bool Install(base::DictionaryValue* manifest, - const FilePath& unpack_path) OVERRIDE; + const base::FilePath& unpack_path) OVERRIDE; private: Version current_version_; @@ -117,7 +117,7 @@ void SwiftShaderComponentInstaller::OnUpdateError(int error) { } bool SwiftShaderComponentInstaller::Install(base::DictionaryValue* manifest, - const FilePath& unpack_path) { + const base::FilePath& unpack_path) { std::string name; manifest->GetStringASCII("name", &name); if (name != kSwiftShaderManifestName) @@ -133,7 +133,7 @@ bool SwiftShaderComponentInstaller::Install(base::DictionaryValue* manifest, !file_util::PathExists(unpack_path.Append(kSwiftShaderGlesName))) return false; // Passed the basic tests. Time to install it. - FilePath path = + base::FilePath path = GetSwiftShaderBaseDirectory().AppendASCII(version.GetString()); if (file_util::PathExists(path)) return false; @@ -186,7 +186,7 @@ void UpdateChecker::OnGpuInfoUpdate() { gpu_data_manager->ShouldUseSoftwareRendering()) { gpu_data_manager->RemoveObserver(this); DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); - FilePath path = GetSwiftShaderBaseDirectory(); + base::FilePath path = GetSwiftShaderBaseDirectory(); Version version(kNullVersion); GetLatestSwiftShaderDirectory(&path, &version, NULL); @@ -200,7 +200,7 @@ void UpdateChecker::OnGpuInfoUpdate() { // and if so register it. void RegisterSwiftShaderPath(ComponentUpdateService* cus) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); - FilePath path = GetSwiftShaderBaseDirectory(); + base::FilePath path = GetSwiftShaderBaseDirectory(); if (!file_util::PathExists(path)) { if (!file_util::CreateDirectory(path)) { NOTREACHED() << "Could not create SwiftShader directory."; @@ -209,7 +209,7 @@ void RegisterSwiftShaderPath(ComponentUpdateService* cus) { } Version version(kNullVersion); - std::vector<FilePath> older_dirs; + std::vector<base::FilePath> older_dirs; if (GetLatestSwiftShaderDirectory(&path, &version, &older_dirs)) BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, base::Bind(&RegisterSwiftShaderWithChrome, path)); @@ -221,7 +221,7 @@ void RegisterSwiftShaderPath(ComponentUpdateService* cus) { // of the GpuDataManager. // Remove older versions of SwiftShader. - for (std::vector<FilePath>::iterator iter = older_dirs.begin(); + for (std::vector<base::FilePath>::iterator iter = older_dirs.begin(); iter != older_dirs.end(); ++iter) { file_util::Delete(*iter, true); } diff --git a/chrome/browser/component_updater/test/component_installers_unittest.cc b/chrome/browser/component_updater/test/component_installers_unittest.cc index 807f659..f0a38dc 100644 --- a/chrome/browser/component_updater/test/component_installers_unittest.cc +++ b/chrome/browser/component_updater/test/component_installers_unittest.cc @@ -22,7 +22,7 @@ using content::BrowserThread; namespace { // File name of the Pepper Flash plugin on different platforms. -const FilePath::CharType kDataPath[] = +const base::FilePath::CharType kDataPath[] = #if defined(OS_MACOSX) FILE_PATH_LITERAL("components/flapper/mac"); #elif defined(OS_WIN) @@ -48,7 +48,7 @@ TEST(ComponentInstallerTest, PepperFlashCheck) { ppapi::PpapiGlobals::SetPpapiGlobalsOnThreadForTest(&test_globals); // The test directory is chrome/test/data/components/flapper. - FilePath manifest; + base::FilePath manifest; PathService::Get(chrome::DIR_TEST_DATA, &manifest); manifest = manifest.Append(kDataPath); manifest = manifest.AppendASCII("manifest.json"); diff --git a/chrome/browser/component_updater/test/component_updater_service_unittest.cc b/chrome/browser/component_updater/test/component_updater_service_unittest.cc index 6f6aedd..e65bda8 100644 --- a/chrome/browser/component_updater/test/component_updater_service_unittest.cc +++ b/chrome/browser/component_updater/test/component_updater_service_unittest.cc @@ -106,7 +106,7 @@ class TestInstaller : public ComponentInstaller { } virtual bool Install(base::DictionaryValue* manifest, - const FilePath& unpack_path) OVERRIDE { + const base::FilePath& unpack_path) OVERRIDE { ++install_count_; delete manifest; return file_util::Delete(unpack_path, true); @@ -183,7 +183,7 @@ class ComponentUpdaterTest : public testing::Test { } // Makes the full path to a component updater test file. - const FilePath test_file(const char* file) { + const base::FilePath test_file(const char* file) { return test_data_dir_.AppendASCII(file); } @@ -214,7 +214,7 @@ class ComponentUpdaterTest : public testing::Test { private: scoped_ptr<ComponentUpdateService> component_updater_; - FilePath test_data_dir_; + base::FilePath test_data_dir_; TestNotificationTracker notification_tracker_; TestConfigurator* test_config_; // ComponentInstaller objects to delete after each test. diff --git a/chrome/browser/content_settings/content_settings_browsertest.cc b/chrome/browser/content_settings/content_settings_browsertest.cc index d87dcb5..417f21a 100644 --- a/chrome/browser/content_settings/content_settings_browsertest.cc +++ b/chrome/browser/content_settings/content_settings_browsertest.cc @@ -43,7 +43,7 @@ class ContentSettingsTest : public InProcessBrowserTest { : https_server_( net::TestServer::TYPE_HTTPS, net::TestServer::SSLOptions(net::TestServer::SSLOptions::CERT_OK), - FilePath(FILE_PATH_LITERAL("chrome/test/data"))) { + base::FilePath(FILE_PATH_LITERAL("chrome/test/data"))) { } virtual void SetUpOnMainThread() OVERRIDE { @@ -199,7 +199,7 @@ IN_PROC_BROWSER_TEST_F(ContentSettingsTest, // NOTE: don't use test_server here, since we need the port to be the same // across the restart. GURL url = URLRequestMockHTTPJob::GetMockUrl( - FilePath(FILE_PATH_LITERAL("setcookie.html"))); + base::FilePath(FILE_PATH_LITERAL("setcookie.html"))); CookieSettings* settings = CookieSettings::Factory::GetForProfile(browser()->profile()); settings->SetDefaultCookieSetting(CONTENT_SETTING_BLOCK); @@ -217,7 +217,7 @@ IN_PROC_BROWSER_TEST_F(ContentSettingsTest, IN_PROC_BROWSER_TEST_F(ContentSettingsTest, AllowCookiesForASessionUsingExceptions) { GURL url = URLRequestMockHTTPJob::GetMockUrl( - FilePath(FILE_PATH_LITERAL("setcookie.html"))); + base::FilePath(FILE_PATH_LITERAL("setcookie.html"))); ASSERT_TRUE(GetCookies(browser()->profile(), url).empty()); } @@ -292,7 +292,7 @@ class ClickToPlayPluginTest : public ContentSettingsTest { #if defined(OS_MACOSX) virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { - FilePath plugin_dir; + base::FilePath plugin_dir; PathService::Get(base::DIR_MODULE, &plugin_dir); plugin_dir = plugin_dir.AppendASCII("plugins"); // The plugins directory isn't read by default on the Mac, so it needs to be @@ -307,7 +307,7 @@ IN_PROC_BROWSER_TEST_F(ClickToPlayPluginTest, Basic) { CONTENT_SETTINGS_TYPE_PLUGINS, CONTENT_SETTING_BLOCK); GURL url = ui_test_utils::GetTestUrl( - FilePath(), FilePath().AppendASCII("clicktoplay.html")); + base::FilePath(), base::FilePath().AppendASCII("clicktoplay.html")); ui_test_utils::NavigateToURL(browser(), url); string16 expected_title(ASCIIToUTF16("OK")); @@ -318,7 +318,7 @@ IN_PROC_BROWSER_TEST_F(ClickToPlayPluginTest, Basic) { browser()->tab_strip_model()->GetActiveWebContents()->GetRenderViewHost(); ChromePluginServiceFilter* filter = ChromePluginServiceFilter::GetInstance(); int process_id = host->GetProcess()->GetID(); - FilePath path(FILE_PATH_LITERAL("blah")); + base::FilePath path(FILE_PATH_LITERAL("blah")); EXPECT_FALSE(filter->CanLoadPlugin(process_id, path)); filter->AuthorizeAllPlugins(process_id); EXPECT_TRUE(filter->CanLoadPlugin(process_id, path)); @@ -331,7 +331,7 @@ IN_PROC_BROWSER_TEST_F(ClickToPlayPluginTest, Basic) { // Verify that plugins can be allowed on a domain by adding an exception IN_PROC_BROWSER_TEST_F(ClickToPlayPluginTest, AllowException) { GURL url = ui_test_utils::GetTestUrl( - FilePath(), FilePath().AppendASCII("clicktoplay.html")); + base::FilePath(), base::FilePath().AppendASCII("clicktoplay.html")); browser()->profile()->GetHostContentSettingsMap()->SetDefaultContentSetting( CONTENT_SETTINGS_TYPE_PLUGINS, CONTENT_SETTING_BLOCK); @@ -352,7 +352,7 @@ IN_PROC_BROWSER_TEST_F(ClickToPlayPluginTest, AllowException) { // Verify that plugins can be blocked on a domain by adding an exception. IN_PROC_BROWSER_TEST_F(ClickToPlayPluginTest, BlockException) { GURL url = ui_test_utils::GetTestUrl( - FilePath(), FilePath().AppendASCII("clicktoplay.html")); + base::FilePath(), base::FilePath().AppendASCII("clicktoplay.html")); browser()->profile()->GetHostContentSettingsMap()->SetContentSetting( ContentSettingsPattern::FromURL(url), @@ -373,7 +373,8 @@ IN_PROC_BROWSER_TEST_F(ClickToPlayPluginTest, LoadAllBlockedPlugins) { CONTENT_SETTINGS_TYPE_PLUGINS, CONTENT_SETTING_BLOCK); GURL url = ui_test_utils::GetTestUrl( - FilePath(), FilePath().AppendASCII("load_all_blocked_plugins.html")); + base::FilePath(), + base::FilePath().AppendASCII("load_all_blocked_plugins.html")); ui_test_utils::NavigateToURL(browser(), url); string16 expected_title1(ASCIIToUTF16("1")); @@ -430,7 +431,8 @@ IN_PROC_BROWSER_TEST_F(ClickToPlayPluginTest, DeleteSelfAtLoad) { CONTENT_SETTINGS_TYPE_PLUGINS, CONTENT_SETTING_BLOCK); GURL url = ui_test_utils::GetTestUrl( - FilePath(), FilePath().AppendASCII("plugin_delete_self_at_load.html")); + base::FilePath(), + base::FilePath().AppendASCII("plugin_delete_self_at_load.html")); ui_test_utils::NavigateToURL(browser(), url); string16 expected_title(ASCIIToUTF16("OK")); diff --git a/chrome/browser/crash_handler_host_linux.cc b/chrome/browser/crash_handler_host_linux.cc index 41d6b1d..d1a47b7 100644 --- a/chrome/browser/crash_handler_host_linux.cc +++ b/chrome/browser/crash_handler_host_linux.cc @@ -369,7 +369,7 @@ void CrashHandlerHostLinux::WriteDumpFile(BreakpadInfo* info, int signal_fd) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); - FilePath dumps_path("/tmp"); + base::FilePath dumps_path("/tmp"); PathService::Get(base::DIR_TEMP, &dumps_path); if (!info->upload) PathService::Get(chrome::DIR_CRASH_DUMPS, &dumps_path); diff --git a/chrome/browser/crash_recovery_browsertest.cc b/chrome/browser/crash_recovery_browsertest.cc index 1211e3d..775af6d 100644 --- a/chrome/browser/crash_recovery_browsertest.cc +++ b/chrome/browser/crash_recovery_browsertest.cc @@ -67,11 +67,13 @@ IN_PROC_BROWSER_TEST_F(CrashRecoveryBrowserTest, Reload) { // ID of the RenderProcessHost was stale, so the NavigationEntry in the new tab // was not committed. This prevents regression of that bug. IN_PROC_BROWSER_TEST_F(CrashRecoveryBrowserTest, LoadInNewTab) { - const FilePath::CharType* kTitle2File = FILE_PATH_LITERAL("title2.html"); + const base::FilePath::CharType* kTitle2File = + FILE_PATH_LITERAL("title2.html"); - ui_test_utils::NavigateToURL(browser(), - ui_test_utils::GetTestUrl(FilePath(FilePath::kCurrentDirectory), - FilePath(kTitle2File))); + ui_test_utils::NavigateToURL( + browser(), ui_test_utils::GetTestUrl( + base::FilePath(base::FilePath::kCurrentDirectory), + base::FilePath(kTitle2File))); string16 title_before_crash; string16 title_after_crash; diff --git a/chrome/browser/crash_upload_list.cc b/chrome/browser/crash_upload_list.cc index 01516d0..9e30367 100644 --- a/chrome/browser/crash_upload_list.cc +++ b/chrome/browser/crash_upload_list.cc @@ -63,9 +63,9 @@ void CrashUploadList::LoadCrashListAndInformDelegateOfCompletion() { } void CrashUploadList::LoadCrashList() { - FilePath crash_dir_path; + base::FilePath crash_dir_path; PathService::Get(chrome::DIR_CRASH_DUMPS, &crash_dir_path); - FilePath upload_log_path = crash_dir_path.AppendASCII("uploads.log"); + base::FilePath upload_log_path = crash_dir_path.AppendASCII("uploads.log"); if (file_util::PathExists(upload_log_path)) { std::string contents; file_util::ReadFileToString(upload_log_path, &contents); diff --git a/chrome/browser/devtools/browser_list_tabcontents_provider.cc b/chrome/browser/devtools/browser_list_tabcontents_provider.cc index 4e461ce..e52474a 100644 --- a/chrome/browser/devtools/browser_list_tabcontents_provider.cc +++ b/chrome/browser/devtools/browser_list_tabcontents_provider.cc @@ -54,13 +54,13 @@ bool BrowserListTabContentsProvider::BundlesFrontendResources() { return true; } -FilePath BrowserListTabContentsProvider::GetDebugFrontendDir() { +base::FilePath BrowserListTabContentsProvider::GetDebugFrontendDir() { #if defined(DEBUG_DEVTOOLS) - FilePath inspector_dir; + base::FilePath inspector_dir; PathService::Get(chrome::DIR_INSPECTOR, &inspector_dir); return inspector_dir; #else - return FilePath(); + return base::FilePath(); #endif } diff --git a/chrome/browser/devtools/browser_list_tabcontents_provider.h b/chrome/browser/devtools/browser_list_tabcontents_provider.h index 782c484..646d1a6 100644 --- a/chrome/browser/devtools/browser_list_tabcontents_provider.h +++ b/chrome/browser/devtools/browser_list_tabcontents_provider.h @@ -23,7 +23,7 @@ class BrowserListTabContentsProvider // DevToolsHttpProtocolHandler::Delegate overrides. virtual std::string GetDiscoveryPageHTML() OVERRIDE; virtual bool BundlesFrontendResources() OVERRIDE; - virtual FilePath GetDebugFrontendDir() OVERRIDE; + virtual base::FilePath GetDebugFrontendDir() OVERRIDE; virtual std::string GetPageThumbnailData(const GURL& url) OVERRIDE; virtual content::RenderViewHost* CreateNewTarget() OVERRIDE; virtual TargetType GetTargetType(content::RenderViewHost*) OVERRIDE; diff --git a/chrome/browser/devtools/devtools_file_helper.cc b/chrome/browser/devtools/devtools_file_helper.cc index b157f6d..753d7d6 100644 --- a/chrome/browser/devtools/devtools_file_helper.cc +++ b/chrome/browser/devtools/devtools_file_helper.cc @@ -45,17 +45,17 @@ using content::WebContents; namespace { -base::LazyInstance<FilePath>::Leaky +base::LazyInstance<base::FilePath>::Leaky g_last_save_path = LAZY_INSTANCE_INITIALIZER; } // namespace namespace { -typedef Callback<void(const FilePath&)> SelectedCallback; +typedef Callback<void(const base::FilePath&)> SelectedCallback; typedef Callback<void(void)> CanceledCallback; -const FilePath::CharType kMagicFileName[] = +const base::FilePath::CharType kMagicFileName[] = FILE_PATH_LITERAL(".allow-devtools-edit"); class SelectFileDialog : public ui::SelectFileDialog::Listener, @@ -70,7 +70,7 @@ class SelectFileDialog : public ui::SelectFileDialog::Listener, } void Show(ui::SelectFileDialog::Type type, - const FilePath& default_path) { + const base::FilePath& default_path) { AddRef(); // Balanced in the three listener outcomes. select_file_dialog_->SelectFile(type, string16(), @@ -83,14 +83,14 @@ class SelectFileDialog : public ui::SelectFileDialog::Listener, } // ui::SelectFileDialog::Listener implementation. - virtual void FileSelected(const FilePath& path, + virtual void FileSelected(const base::FilePath& path, int index, void* params) OVERRIDE { selected_callback_.Run(path); Release(); // Balanced in ::Show. } - virtual void MultiFilesSelected(const std::vector<FilePath>& files, + virtual void MultiFilesSelected(const std::vector<base::FilePath>& files, void* params) OVERRIDE { Release(); // Balanced in ::Show. NOTREACHED() << "Should not be able to select multiple files"; @@ -110,14 +110,14 @@ class SelectFileDialog : public ui::SelectFileDialog::Listener, CanceledCallback canceled_callback_; }; -void WriteToFile(const FilePath& path, const std::string& content) { +void WriteToFile(const base::FilePath& path, const std::string& content) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); DCHECK(!path.empty()); file_util::WriteFile(path, content.c_str(), content.length()); } -void AppendToFile(const FilePath& path, const std::string& content) { +void AppendToFile(const base::FilePath& path, const std::string& content) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); DCHECK(!path.empty()); @@ -133,7 +133,7 @@ fileapi::IsolatedContext* isolated_context() { } std::string RegisterFileSystem(WebContents* web_contents, - const FilePath& path, + const base::FilePath& path, std::string* registered_name) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); CHECK(content::HasWebUIScheme(web_contents->GetURL())); @@ -156,15 +156,16 @@ std::string RegisterFileSystem(WebContents* web_contents, return file_system_id; } -typedef Callback<void(const std::vector<FilePath>&)> ValidateFoldersCallback; +typedef Callback<void(const std::vector<base::FilePath>&)> + ValidateFoldersCallback; -void ValidateFoldersOnFileThread(const std::vector<FilePath>& file_paths, +void ValidateFoldersOnFileThread(const std::vector<base::FilePath>& file_paths, const ValidateFoldersCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); - std::vector<FilePath> permitted_paths; - std::vector<FilePath>::const_iterator it; + std::vector<base::FilePath> permitted_paths; + std::vector<base::FilePath>::const_iterator it; for (it = file_paths.begin(); it != file_paths.end(); ++it) { - FilePath security_file_path = it->Append(kMagicFileName); + base::FilePath security_file_path = it->Append(kMagicFileName); if (file_util::PathExists(security_file_path)) permitted_paths.push_back(*it); } @@ -225,7 +226,7 @@ void DevToolsFileHelper::Save(const std::string& url, const DictionaryValue* file_map = profile_->GetPrefs()->GetDictionary(prefs::kDevToolsEditedFiles); - FilePath initial_path; + base::FilePath initial_path; const Value* path_value; if (file_map->Get(base::MD5String(url), &path_value)) @@ -243,7 +244,7 @@ void DevToolsFileHelper::Save(const std::string& url, initial_path = g_last_save_path.Pointer()->DirName().AppendASCII( suggested_file_name); } else { - FilePath download_path = DownloadPrefs::FromDownloadManager( + base::FilePath download_path = DownloadPrefs::FromDownloadManager( BrowserContext::GetDownloadManager(profile_))->DownloadPath(); initial_path = download_path.AppendASCII(suggested_file_name); } @@ -275,7 +276,7 @@ void DevToolsFileHelper::Append(const std::string& url, void DevToolsFileHelper::SaveAsFileSelected(const std::string& url, const std::string& content, const SaveCallback& callback, - const FilePath& path) { + const base::FilePath& path) { *g_last_save_path.Pointer() = path; saved_files_[url] = path; @@ -298,13 +299,14 @@ void DevToolsFileHelper::AddFileSystem(const AddFileSystemCallback& callback) { weak_factory_.GetWeakPtr(), callback), Bind(callback, "", FileSystem())); - select_file_dialog->Show(ui::SelectFileDialog::SELECT_FOLDER, FilePath()); + select_file_dialog->Show(ui::SelectFileDialog::SELECT_FOLDER, + base::FilePath()); } void DevToolsFileHelper::InnerAddFileSystem( const AddFileSystemCallback& callback, - const FilePath& path) { - std::vector<FilePath> file_paths(1, path); + const base::FilePath& path) { + std::vector<base::FilePath> file_paths(1, path); ValidateFoldersCallback validate_folders_callback = Bind( &DevToolsFileHelper::AddValidatedFileSystem, weak_factory_.GetWeakPtr(), @@ -317,17 +319,17 @@ void DevToolsFileHelper::InnerAddFileSystem( void DevToolsFileHelper::AddValidatedFileSystem( const AddFileSystemCallback& callback, - const std::vector<FilePath>& permitted_paths) { + const std::vector<base::FilePath>& permitted_paths) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); if (permitted_paths.empty()) { - std::string magic_file_name = FilePath(kMagicFileName).AsUTF8Unsafe(); + std::string magic_file_name = base::FilePath(kMagicFileName).AsUTF8Unsafe(); std::string error_string = l10n_util::GetStringFUTF8( IDS_DEV_TOOLS_MAGIC_FILE_NOT_EXISTS_MESSAGE, UTF8ToUTF16(magic_file_name)); callback.Run(error_string, FileSystem()); return; } - FilePath path = permitted_paths.at(0); + base::FilePath path = permitted_paths.at(0); std::string registered_name; std::string file_system_id = RegisterFileSystem(web_contents_, path, @@ -350,11 +352,11 @@ void DevToolsFileHelper::RequestFileSystems( const RequestFileSystemsCallback& callback) { const DictionaryValue* file_systems_paths_value = profile_->GetPrefs()->GetDictionary(prefs::kDevToolsFileSystemPaths); - std::vector<FilePath> saved_paths; + std::vector<base::FilePath> saved_paths; DictionaryValue::key_iterator it = file_systems_paths_value->begin_keys(); for (; it != file_systems_paths_value->end_keys(); ++it) { std::string file_system_path = *it; - FilePath path = FilePath::FromUTF8Unsafe(file_system_path); + base::FilePath path = base::FilePath::FromUTF8Unsafe(file_system_path); saved_paths.push_back(path); } @@ -370,10 +372,10 @@ void DevToolsFileHelper::RequestFileSystems( void DevToolsFileHelper::RestoreValidatedFileSystems( const RequestFileSystemsCallback& callback, - const std::vector<FilePath>& permitted_paths) { + const std::vector<base::FilePath>& permitted_paths) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); std::vector<FileSystem> file_systems; - std::vector<FilePath>::const_iterator it; + std::vector<base::FilePath>::const_iterator it; for (it = permitted_paths.begin(); it != permitted_paths.end(); ++it) { std::string registered_name; std::string file_system_id = RegisterFileSystem(web_contents_, @@ -391,7 +393,7 @@ void DevToolsFileHelper::RestoreValidatedFileSystems( void DevToolsFileHelper::RemoveFileSystem(const std::string& file_system_path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - FilePath path = FilePath::FromUTF8Unsafe(file_system_path); + base::FilePath path = base::FilePath::FromUTF8Unsafe(file_system_path); isolated_context()->RevokeFileSystemByPath(path); DictionaryPrefUpdate update(profile_->GetPrefs(), diff --git a/chrome/browser/devtools/devtools_sanity_browsertest.cc b/chrome/browser/devtools/devtools_sanity_browsertest.cc index f6eefc0..b30a358 100644 --- a/chrome/browser/devtools/devtools_sanity_browsertest.cc +++ b/chrome/browser/devtools/devtools_sanity_browsertest.cc @@ -183,12 +183,12 @@ class DevToolsExtensionTest : public DevToolsSanityTest, protected: // Load an extension from test\data\devtools\extensions\<extension_name> void LoadExtension(const char* extension_name) { - FilePath path = test_extensions_dir_.AppendASCII(extension_name); + base::FilePath path = test_extensions_dir_.AppendASCII(extension_name); ASSERT_TRUE(LoadExtensionFromPath(path)) << "Failed to load extension."; } private: - bool LoadExtensionFromPath(const FilePath& path) { + bool LoadExtensionFromPath(const base::FilePath& path) { ExtensionService* service = extensions::ExtensionSystem::Get( browser()->profile())->extension_service(); size_t num_before = service->extensions()->size(); @@ -255,7 +255,7 @@ class DevToolsExtensionTest : public DevToolsSanityTest, } } - FilePath test_extensions_dir_; + base::FilePath test_extensions_dir_; }; class DevToolsExperimentalExtensionTest : public DevToolsExtensionTest { diff --git a/chrome/browser/diagnostics/diagnostics_model.cc b/chrome/browser/diagnostics/diagnostics_model.cc index 382bc81..e2bdc7b 100644 --- a/chrome/browser/diagnostics/diagnostics_model.cc +++ b/chrome/browser/diagnostics/diagnostics_model.cc @@ -165,7 +165,8 @@ class DiagnosticsModelPosix : public DiagnosticsModelImpl { } // namespace DiagnosticsModel* MakeDiagnosticsModel(const CommandLine& cmdline) { - FilePath user_data_dir = cmdline.GetSwitchValuePath(switches::kUserDataDir); + base::FilePath user_data_dir = + cmdline.GetSwitchValuePath(switches::kUserDataDir); if (!user_data_dir.empty()) PathService::Override(chrome::DIR_USER_DATA, user_data_dir); #if defined(OS_WIN) diff --git a/chrome/browser/diagnostics/diagnostics_test.cc b/chrome/browser/diagnostics/diagnostics_test.cc index 390b0e2..2e46766 100644 --- a/chrome/browser/diagnostics/diagnostics_test.cc +++ b/chrome/browser/diagnostics/diagnostics_test.cc @@ -45,9 +45,9 @@ void DiagnosticTest::RecordOutcome(const string16& additional_info, } // static -FilePath DiagnosticTest::GetUserDefaultProfileDir() { - FilePath path; +base::FilePath DiagnosticTest::GetUserDefaultProfileDir() { + base::FilePath path; if (!PathService::Get(chrome::DIR_USER_DATA, &path)) - return FilePath(); + return base::FilePath(); return path.AppendASCII(chrome::kInitialProfile); } diff --git a/chrome/browser/diagnostics/recon_diagnostics.cc b/chrome/browser/diagnostics/recon_diagnostics.cc index 3278eff..a924b6d 100644 --- a/chrome/browser/diagnostics/recon_diagnostics.cc +++ b/chrome/browser/diagnostics/recon_diagnostics.cc @@ -135,7 +135,7 @@ class InstallTypeTest : public DiagnosticTest { virtual bool ExecuteImpl(DiagnosticsModel::Observer* observer) OVERRIDE { #if defined(OS_WIN) - FilePath chrome_exe; + base::FilePath chrome_exe; if (!PathService::Get(base::FILE_EXE, &chrome_exe)) { RecordFailure(ASCIIToUTF16("Path provider failure")); return false; @@ -230,7 +230,7 @@ class PathTest : public DiagnosticTest { RecordStopFailure(ASCIIToUTF16("dependency failure")); return false; } - FilePath dir_or_file; + base::FilePath dir_or_file; if (!PathService::Get(path_info_.path_id, &dir_or_file)) { RecordStopFailure(ASCIIToUTF16("Path provider failure")); return false; @@ -291,7 +291,7 @@ class DiskSpaceTest : public DiagnosticTest { virtual int GetId() OVERRIDE { return 0; } virtual bool ExecuteImpl(DiagnosticsModel::Observer* observer) OVERRIDE { - FilePath data_dir; + base::FilePath data_dir; if (!PathService::Get(chrome::DIR_USER_DATA, &data_dir)) return false; int64 disk_space = base::SysInfo::AmountOfFreeDiskSpace(data_dir); @@ -315,7 +315,9 @@ class DiskSpaceTest : public DiagnosticTest { // Checks that a given json file can be correctly parsed. class JSONTest : public DiagnosticTest { public: - JSONTest(const FilePath& path, const string16& name, int64 max_file_size) + JSONTest(const base::FilePath& path, + const string16& name, + int64 max_file_size) : DiagnosticTest(name), path_(path), max_file_size_(max_file_size) { } @@ -361,7 +363,7 @@ class JSONTest : public DiagnosticTest { } private: - FilePath path_; + base::FilePath path_; int64 max_file_size_; DISALLOW_COPY_AND_ASSIGN(JSONTest); }; @@ -405,19 +407,19 @@ DiagnosticTest* MakeInstallTypeTest() { } DiagnosticTest* MakePreferencesTest() { - FilePath path = DiagnosticTest::GetUserDefaultProfileDir(); + base::FilePath path = DiagnosticTest::GetUserDefaultProfileDir(); path = path.Append(chrome::kPreferencesFilename); return new JSONTest(path, ASCIIToUTF16("Profile JSON"), 100 * kOneKilo); } DiagnosticTest* MakeBookMarksTest() { - FilePath path = DiagnosticTest::GetUserDefaultProfileDir(); + base::FilePath path = DiagnosticTest::GetUserDefaultProfileDir(); path = path.Append(chrome::kBookmarksFileName); return new JSONTest(path, ASCIIToUTF16("BookMarks JSON"), 2 * kOneMeg); } DiagnosticTest* MakeLocalStateTest() { - FilePath path; + base::FilePath path; PathService::Get(chrome::DIR_USER_DATA, &path); path = path.Append(chrome::kLocalStateFilename); return new JSONTest(path, ASCIIToUTF16("Local State JSON"), 50 * kOneKilo); diff --git a/chrome/browser/diagnostics/sqlite_diagnostics.cc b/chrome/browser/diagnostics/sqlite_diagnostics.cc index 406b7b49..07dd702 100644 --- a/chrome/browser/diagnostics/sqlite_diagnostics.cc +++ b/chrome/browser/diagnostics/sqlite_diagnostics.cc @@ -26,7 +26,7 @@ namespace { class SqliteIntegrityTest : public DiagnosticTest { public: SqliteIntegrityTest(bool critical, const string16& title, - const FilePath& profile_relative_db_path) + const base::FilePath& profile_relative_db_path) : DiagnosticTest(title), critical_(critical), db_path_(profile_relative_db_path) { @@ -35,7 +35,7 @@ class SqliteIntegrityTest : public DiagnosticTest { virtual int GetId() OVERRIDE { return 0; } virtual bool ExecuteImpl(DiagnosticsModel::Observer* observer) OVERRIDE { - FilePath path = GetUserDefaultProfileDir(); + base::FilePath path = GetUserDefaultProfileDir(); path = path.Append(db_path_); if (!file_util::PathExists(path)) { RecordOutcome(ASCIIToUTF16("File not found"), @@ -83,7 +83,7 @@ class SqliteIntegrityTest : public DiagnosticTest { private: bool critical_; - FilePath db_path_; + base::FilePath db_path_; DISALLOW_COPY_AND_ASSIGN(SqliteIntegrityTest); }; @@ -91,39 +91,41 @@ class SqliteIntegrityTest : public DiagnosticTest { DiagnosticTest* MakeSqliteWebDbTest() { return new SqliteIntegrityTest(true, ASCIIToUTF16("Web DB"), - FilePath(chrome::kWebDataFilename)); + base::FilePath(chrome::kWebDataFilename)); } DiagnosticTest* MakeSqliteCookiesDbTest() { return new SqliteIntegrityTest(true, ASCIIToUTF16("Cookies DB"), - FilePath(chrome::kCookieFilename)); + base::FilePath(chrome::kCookieFilename)); } DiagnosticTest* MakeSqliteHistoryDbTest() { return new SqliteIntegrityTest(true, ASCIIToUTF16("History DB"), - FilePath(chrome::kHistoryFilename)); + base::FilePath(chrome::kHistoryFilename)); } DiagnosticTest* MakeSqliteArchivedHistoryDbTest() { - return new SqliteIntegrityTest(false, ASCIIToUTF16("Archived History DB"), - FilePath(chrome::kArchivedHistoryFilename)); + return new SqliteIntegrityTest( + false, ASCIIToUTF16("Archived History DB"), + base::FilePath(chrome::kArchivedHistoryFilename)); } DiagnosticTest* MakeSqliteThumbnailsDbTest() { return new SqliteIntegrityTest(false, ASCIIToUTF16("Thumbnails DB"), - FilePath(chrome::kThumbnailsFilename)); + base::FilePath(chrome::kThumbnailsFilename)); } DiagnosticTest* MakeSqliteAppCacheDbTest() { - FilePath appcache_dir(content::kAppCacheDirname); - FilePath appcache_db = appcache_dir.Append(appcache::kAppCacheDatabaseName); + base::FilePath appcache_dir(content::kAppCacheDirname); + base::FilePath appcache_db = + appcache_dir.Append(appcache::kAppCacheDatabaseName); return new SqliteIntegrityTest(false, ASCIIToUTF16("AppCache DB"), appcache_db); } DiagnosticTest* MakeSqliteWebDatabaseTrackerDbTest() { - FilePath databases_dir(webkit_database::kDatabaseDirectoryName); - FilePath tracker_db = + base::FilePath databases_dir(webkit_database::kDatabaseDirectoryName); + base::FilePath tracker_db = databases_dir.Append(webkit_database::kTrackerDatabaseFileName); return new SqliteIntegrityTest(false, ASCIIToUTF16("DatabaseTracker DB"), tracker_db); diff --git a/chrome/browser/download/chrome_download_manager_delegate.cc b/chrome/browser/download/chrome_download_manager_delegate.cc index f6bf4f5..28d613d 100644 --- a/chrome/browser/download/chrome_download_manager_delegate.cc +++ b/chrome/browser/download/chrome_download_manager_delegate.cc @@ -84,7 +84,7 @@ static const char safe_browsing_id[] = "Safe Browsing ID"; // String pointer used to set the local file extension to be used when a // download is going to be dispatched with web intents. -static const FilePath::CharType kWebIntentsFileExtension[] = +static const base::FilePath::CharType kWebIntentsFileExtension[] = FILE_PATH_LITERAL(".webintents"); // The state of a safebrowsing check. @@ -119,7 +119,7 @@ SafeBrowsingState::~SafeBrowsingState() {} // in operation to net::GenerateFileName(), but uses a localized // default name. void GenerateFileNameFromRequest(const DownloadItem& download_item, - FilePath* generated_name, + base::FilePath* generated_name, std::string referrer_charset) { std::string default_file_name( l10n_util::GetStringUTF8(IDS_DEFAULT_DOWNLOAD_FILENAME)); @@ -133,14 +133,14 @@ void GenerateFileNameFromRequest(const DownloadItem& download_item, } // Needed to give PostTask a void closure in OnWebIntentDispatchCompleted. -void DeleteFile(const FilePath& file_path) { +void DeleteFile(const base::FilePath& file_path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); file_util::Delete(file_path, false); } // Called when the web intents dispatch has completed. Deletes the |file_path|. void OnWebIntentDispatchCompleted( - const FilePath& file_path, + const base::FilePath& file_path, webkit_glue::WebIntentReplyType intent_reply) { BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, base::Bind(&DeleteFile, file_path)); @@ -165,8 +165,8 @@ void VisitCountsToVisitedBefore( // platform_util::OpenItem/ShowItemInFolder, including any transformation // required for download abstractions layered on top of the core system, // e.g. download to Drive. -FilePath GetPlatformDownloadPath(Profile* profile, - const DownloadItem* download) { +base::FilePath GetPlatformDownloadPath(Profile* profile, + const DownloadItem* download) { #if defined(OS_CHROMEOS) drive::DriveDownloadHandler* drive_download_handler = drive::DriveDownloadHandler::GetForProfile(profile); @@ -236,7 +236,7 @@ bool ChromeDownloadManagerDelegate::DetermineDownloadTarget( void ChromeDownloadManagerDelegate::ChooseDownloadPath( DownloadItem* item, - const FilePath& suggested_path, + const base::FilePath& suggested_path, const FileSelectedCallback& file_selected_callback) { // Deletes itself. DownloadFilePicker* file_picker = @@ -249,8 +249,8 @@ void ChromeDownloadManagerDelegate::ChooseDownloadPath( file_selected_callback); } -FilePath ChromeDownloadManagerDelegate::GetIntermediatePath( - const FilePath& target_path, +base::FilePath ChromeDownloadManagerDelegate::GetIntermediatePath( + const base::FilePath& target_path, content::DownloadDangerType danger_type) { // If the download is not dangerous, just append .crdownload to the target // path. @@ -259,8 +259,8 @@ FilePath ChromeDownloadManagerDelegate::GetIntermediatePath( // If the download is potentially dangerous we create a filename of the form // 'Unconfirmed <random>.crdownload'. - FilePath::StringType file_name; - FilePath dir = target_path.DirName(); + base::FilePath::StringType file_name; + base::FilePath dir = target_path.DirName(); #if defined(OS_WIN) string16 unconfirmed_prefix = l10n_util::GetStringUTF16(IDS_DOWNLOAD_UNCONFIRMED_PREFIX); @@ -293,14 +293,14 @@ WebContents* ChromeDownloadManagerDelegate:: } bool ChromeDownloadManagerDelegate::ShouldOpenFileBasedOnExtension( - const FilePath& path) { + const base::FilePath& path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - FilePath::StringType extension = path.Extension(); + base::FilePath::StringType extension = path.Extension(); if (extension.empty()) return false; if (extensions::Extension::IsExtension(path)) return false; - DCHECK(extension[0] == FilePath::kExtensionSeparator); + DCHECK(extension[0] == base::FilePath::kExtensionSeparator); extension.erase(0, 1); return download_prefs_->IsAutoOpenEnabledForExtension(extension); } @@ -501,10 +501,11 @@ bool ChromeDownloadManagerDelegate::GenerateFileHash() { #endif } -void ChromeDownloadManagerDelegate::GetSaveDir(BrowserContext* browser_context, - FilePath* website_save_dir, - FilePath* download_save_dir, - bool* skip_dir_check) { +void ChromeDownloadManagerDelegate::GetSaveDir( + BrowserContext* browser_context, + base::FilePath* website_save_dir, + base::FilePath* download_save_dir, + bool* skip_dir_check) { Profile* profile = Profile::FromBrowserContext(browser_context); PrefServiceSyncable* prefs = profile->GetPrefs(); @@ -512,7 +513,7 @@ void ChromeDownloadManagerDelegate::GetSaveDir(BrowserContext* browser_context, // If not, initialize it with default directory. if (!prefs->FindPreference(prefs::kSaveFileDefaultDirectory)) { DCHECK(prefs->FindPreference(prefs::kDownloadDefaultDirectory)); - FilePath default_save_path = prefs->GetFilePath( + base::FilePath default_save_path = prefs->GetFilePath( prefs::kDownloadDefaultDirectory); prefs->RegisterFilePathPref(prefs::kSaveFileDefaultDirectory, default_save_path, @@ -533,8 +534,8 @@ void ChromeDownloadManagerDelegate::GetSaveDir(BrowserContext* browser_context, void ChromeDownloadManagerDelegate::ChooseSavePath( WebContents* web_contents, - const FilePath& suggested_path, - const FilePath::StringType& default_extension, + const base::FilePath& suggested_path, + const base::FilePath::StringType& default_extension, bool can_save_as_complete, const content::SavePackagePathPickedCallback& callback) { // Deletes itself. @@ -592,7 +593,7 @@ DownloadProtectionService* // TODO(phajdan.jr): This is apparently not being exercised in tests. bool ChromeDownloadManagerDelegate::IsDangerousFile( const DownloadItem& download, - const FilePath& suggested_path, + const base::FilePath& suggested_path, bool visited_referrer_before) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); @@ -627,8 +628,8 @@ bool ChromeDownloadManagerDelegate::IsDangerousFile( void ChromeDownloadManagerDelegate::GetReservedPath( DownloadItem& download, - const FilePath& target_path, - const FilePath& default_download_path, + const base::FilePath& target_path, + const base::FilePath& default_download_path, bool should_uniquify_path, const DownloadPathReservationTracker::ReservedPathCallback& callback) { DownloadPathReservationTracker::GetReservedPath( @@ -740,12 +741,12 @@ void ChromeDownloadManagerDelegate::CheckVisitedReferrerBeforeDone( bool should_prompt = (download->GetTargetDisposition() == DownloadItem::TARGET_DISPOSITION_PROMPT); bool is_forced_path = !download->GetForcedFilePath().empty(); - FilePath suggested_path; + base::FilePath suggested_path; // Check whether this download is for an extension install or not. // Allow extensions to be explicitly saved. if (!is_forced_path) { - FilePath generated_name; + base::FilePath generated_name; GenerateFileNameFromRequest( *download, &generated_name, @@ -771,7 +772,7 @@ void ChromeDownloadManagerDelegate::CheckVisitedReferrerBeforeDone( // Determine the proper path for a download, by either one of the following: // 1) using the default download directory. // 2) prompting the user. - FilePath target_directory; + base::FilePath target_directory; if (should_prompt && !last_download_path_.empty()) target_directory = last_download_path_; else @@ -850,7 +851,7 @@ void ChromeDownloadManagerDelegate::SubstituteDriveDownloadPathCallback( bool should_prompt, bool is_forced_path, content::DownloadDangerType danger_type, - const FilePath& suggested_path) { + const base::FilePath& suggested_path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DownloadItem* download = download_manager_->GetDownload(download_id); @@ -859,10 +860,10 @@ void ChromeDownloadManagerDelegate::SubstituteDriveDownloadPathCallback( if (suggested_path.empty()) { // Substitution failed. - callback.Run(FilePath(), + callback.Run(base::FilePath(), DownloadItem::TARGET_DISPOSITION_OVERWRITE, danger_type, - FilePath()); + base::FilePath()); return; } @@ -880,7 +881,7 @@ void ChromeDownloadManagerDelegate::OnPathReservationAvailable( const content::DownloadTargetCallback& callback, bool should_prompt, content::DownloadDangerType danger_type, - const FilePath& reserved_path, + const base::FilePath& reserved_path, bool reserved_path_verified) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DownloadItem* download = @@ -907,9 +908,9 @@ void ChromeDownloadManagerDelegate::OnTargetPathDetermined( const content::DownloadTargetCallback& callback, DownloadItem::TargetDisposition disposition, content::DownloadDangerType danger_type, - const FilePath& target_path) { + const base::FilePath& target_path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - FilePath intermediate_path; + base::FilePath intermediate_path; DownloadItem* download = download_manager_->GetDownload(download_id); if (!download || (download->GetState() != DownloadItem::IN_PROGRESS)) diff --git a/chrome/browser/download/chrome_download_manager_delegate.h b/chrome/browser/download/chrome_download_manager_delegate.h index 93a6e28..ff64439 100644 --- a/chrome/browser/download/chrome_download_manager_delegate.h +++ b/chrome/browser/download/chrome_download_manager_delegate.h @@ -50,7 +50,7 @@ class ChromeDownloadManagerDelegate // Callback type used with ChooseDownloadPath(). The callback should be // invoked with the user-selected path as the argument. If the file selection // was canceled, the argument should be the empty path. - typedef base::Callback<void(const FilePath&)> FileSelectedCallback; + typedef base::Callback<void(const base::FilePath&)> FileSelectedCallback; explicit ChromeDownloadManagerDelegate(Profile* profile); @@ -68,7 +68,8 @@ class ChromeDownloadManagerDelegate const content::DownloadTargetCallback& callback) OVERRIDE; virtual content::WebContents* GetAlternativeWebContentsToNotifyForDownload() OVERRIDE; - virtual bool ShouldOpenFileBasedOnExtension(const FilePath& path) OVERRIDE; + virtual bool ShouldOpenFileBasedOnExtension( + const base::FilePath& path) OVERRIDE; virtual bool ShouldCompleteDownload( content::DownloadItem* item, const base::Closure& complete_callback) OVERRIDE; @@ -77,13 +78,13 @@ class ChromeDownloadManagerDelegate const content::DownloadOpenDelayedCallback& callback) OVERRIDE; virtual bool GenerateFileHash() OVERRIDE; virtual void GetSaveDir(content::BrowserContext* browser_context, - FilePath* website_save_dir, - FilePath* download_save_dir, + base::FilePath* website_save_dir, + base::FilePath* download_save_dir, bool* skip_dir_check) OVERRIDE; virtual void ChooseSavePath( content::WebContents* web_contents, - const FilePath& suggested_path, - const FilePath::StringType& default_extension, + const base::FilePath& suggested_path, + const base::FilePath::StringType& default_extension, bool can_save_as_complete, const content::SavePackagePathPickedCallback& callback) OVERRIDE; virtual void OpenDownload(content::DownloadItem* download) OVERRIDE; @@ -112,7 +113,7 @@ class ChromeDownloadManagerDelegate // user action initiated the download, and whether the user has explicitly // marked the file type as "auto open". Protected virtual for testing. virtual bool IsDangerousFile(const content::DownloadItem& download, - const FilePath& suggested_path, + const base::FilePath& suggested_path, bool visited_referrer_before); // Obtains a path reservation by calling @@ -120,8 +121,8 @@ class ChromeDownloadManagerDelegate // testing. virtual void GetReservedPath( content::DownloadItem& download, - const FilePath& target_path, - const FilePath& default_download_path, + const base::FilePath& target_path, + const base::FilePath& default_download_path, bool should_uniquify_path, const DownloadPathReservationTracker::ReservedPathCallback& callback); @@ -131,7 +132,7 @@ class ChromeDownloadManagerDelegate // selected full path. If the user cancels the dialog, then an empty FilePath // will be passed into |callback|. Protected virtual for testing. virtual void ChooseDownloadPath(content::DownloadItem* item, - const FilePath& suggested_path, + const base::FilePath& suggested_path, const FileSelectedCallback& callback); // So that test classes that inherit from this for override purposes @@ -180,12 +181,12 @@ class ChromeDownloadManagerDelegate bool should_prompt, bool is_forced_path, content::DownloadDangerType danger_type, - const FilePath& unverified_path); + const base::FilePath& unverified_path); #endif // Determine the intermediate path to use for |target_path|. |danger_type| // specifies the danger level of the download. - FilePath GetIntermediatePath(const FilePath& target_path, + base::FilePath GetIntermediatePath(const base::FilePath& target_path, content::DownloadDangerType danger_type); // Called on the UI thread once a reserved path is available. Updates the @@ -196,7 +197,7 @@ class ChromeDownloadManagerDelegate const content::DownloadTargetCallback& callback, bool should_prompt, content::DownloadDangerType danger_type, - const FilePath& reserved_path, + const base::FilePath& reserved_path, bool reserved_path_verified); // Called on the UI thread once the final target path is available. @@ -205,7 +206,7 @@ class ChromeDownloadManagerDelegate const content::DownloadTargetCallback& callback, content::DownloadItem::TargetDisposition disposition, content::DownloadDangerType danger_type, - const FilePath& target_path); + const base::FilePath& target_path); #if defined(ENABLE_WEB_INTENTS) // Check policy of whether we should open this download with a web intents @@ -253,7 +254,7 @@ class ChromeDownloadManagerDelegate // The directory most recently chosen by the user in response to a Save As // dialog for a regular download. - FilePath last_download_path_; + base::FilePath last_download_path_; DISALLOW_COPY_AND_ASSIGN(ChromeDownloadManagerDelegate); }; diff --git a/chrome/browser/download/chrome_download_manager_delegate_unittest.cc b/chrome/browser/download/chrome_download_manager_delegate_unittest.cc index 2bda304..b8e18dc 100644 --- a/chrome/browser/download/chrome_download_manager_delegate_unittest.cc +++ b/chrome/browser/download/chrome_download_manager_delegate_unittest.cc @@ -114,16 +114,16 @@ struct DownloadTestCase { const char* mime_type; // Should be non-empty if |test_type| == FORCED. Value of GetForcedFilePath(). - const FilePath::CharType* forced_file_path; + const base::FilePath::CharType* forced_file_path; // Expected final download path. Specified relative to the test download path. // If the user is presented with a file chooser, this path will also be the // response sent back from the file chooser. - const FilePath::CharType* expected_target_path; + const base::FilePath::CharType* expected_target_path; // The path to expect as the suggested path if the user will be prompted for a // download path. - const FilePath::CharType* expected_prompt_path; + const base::FilePath::CharType* expected_prompt_path; // Expected target disposition. If this is TARGET_DISPOSITION_PROMPT, then the // test run will expect ChromeDownloadManagerDelegate to prompt the user for a @@ -176,7 +176,7 @@ class TestChromeDownloadManagerDelegate : public ChromeDownloadManagerDelegate { } virtual bool IsDangerousFile(const DownloadItem& download, - const FilePath& suggested_path, + const base::FilePath& suggested_path, bool visited_referrer_before) OVERRIDE { // The implementaion of ChromeDownloadManagerDelegate::IsDangerousFile() is // sensitive to a number of external factors (e.g. whether off-store @@ -191,8 +191,8 @@ class TestChromeDownloadManagerDelegate : public ChromeDownloadManagerDelegate { virtual void GetReservedPath( content::DownloadItem& download, - const FilePath& target_path, - const FilePath& default_download_path, + const base::FilePath& target_path, + const base::FilePath& default_download_path, bool should_uniquify_path, const DownloadPathReservationTracker::ReservedPathCallback& callback) OVERRIDE { @@ -205,7 +205,7 @@ class TestChromeDownloadManagerDelegate : public ChromeDownloadManagerDelegate { // During tests, we want to mock the behavior of this method. MOCK_METHOD3(ChooseDownloadPath, void(content::DownloadItem*, - const FilePath&, + const base::FilePath&, const FileSelectedCallback&)); #if defined(FULL_SAFE_BROWSING) @@ -240,11 +240,11 @@ class ChromeDownloadManagerDelegateTest : content::MockDownloadItem* CreateActiveDownloadItem(int32 id); // Sets the AutoOpenBasedOnExtension user preference for |path|. - void EnableAutoOpenBasedOnExtension(const FilePath& path); + void EnableAutoOpenBasedOnExtension(const base::FilePath& path); // Given the relative path |path|, returns the full path under the temporary // downloads directory. - FilePath GetPathInDownloadDir(const FilePath::StringType& path); + base::FilePath GetPathInDownloadDir(const base::FilePath::StringType& path); // Run |test_case| using |item|. void RunTestCaseWithDownloadItem(const DownloadTestCase& test_case, @@ -257,15 +257,15 @@ class ChromeDownloadManagerDelegateTest : size_t test_case_count); // Set the kDownloadDefaultDirectory user preference to |path|. - void SetDefaultDownloadPath(const FilePath& path); + void SetDefaultDownloadPath(const base::FilePath& path); // Set the kDownloadDefaultDirectory managed preference to |path|. - void SetManagedDownloadPath(const FilePath& path); + void SetManagedDownloadPath(const base::FilePath& path); // Set the kPromptForDownload user preference to |prompt|. void SetPromptForDownload(bool prompt); - const FilePath& default_download_path() const; + const base::FilePath& default_download_path() const; TestChromeDownloadManagerDelegate* delegate(); content::MockDownloadManager* download_manager(); DownloadPrefs* download_prefs(); @@ -274,10 +274,10 @@ class ChromeDownloadManagerDelegateTest : // Verifies that |target_path|, |disposition|, |danger_type| and // |intermediate_path| matches the expectations of |test_case|. void DownloadTargetVerifier(const DownloadTestCase* test_case, - const FilePath& target_path, + const base::FilePath& target_path, DownloadItem::TargetDisposition disposition, content::DownloadDangerType danger_type, - const FilePath& intermediate_path); + const base::FilePath& intermediate_path); TestingPrefServiceSyncable* pref_service_; base::ScopedTempDir test_download_dir_; @@ -334,7 +334,7 @@ content::MockDownloadItem* content::MockDownloadItem* item = new ::testing::NiceMock<content::MockDownloadItem>(); ON_CALL(*item, GetFullPath()) - .WillByDefault(ReturnRefOfCopy(FilePath())); + .WillByDefault(ReturnRefOfCopy(base::FilePath())); ON_CALL(*item, GetHash()) .WillByDefault(ReturnRefOfCopy(std::string())); ON_CALL(*item, GetReferrerUrl()) @@ -361,16 +361,16 @@ content::MockDownloadItem* } void ChromeDownloadManagerDelegateTest::EnableAutoOpenBasedOnExtension( - const FilePath& path) { + const base::FilePath& path) { EXPECT_TRUE( delegate_->download_prefs()->EnableAutoOpenBasedOnExtension(path)); } -FilePath ChromeDownloadManagerDelegateTest::GetPathInDownloadDir( - const FilePath::StringType& relative_path) { +base::FilePath ChromeDownloadManagerDelegateTest::GetPathInDownloadDir( + const base::FilePath::StringType& relative_path) { if (relative_path.empty()) - return FilePath(); - FilePath full_path(test_download_dir_.path().Append(relative_path)); + return base::FilePath(); + base::FilePath full_path(test_download_dir_.path().Append(relative_path)); return full_path.NormalizePathSeparators(); } @@ -381,7 +381,8 @@ void ChromeDownloadManagerDelegateTest::RunTestCaseWithDownloadItem( GURL download_url(test_case.url); std::vector<GURL> url_chain; url_chain.push_back(download_url); - FilePath forced_file_path(GetPathInDownloadDir(test_case.forced_file_path)); + base::FilePath forced_file_path( + GetPathInDownloadDir(test_case.forced_file_path)); EXPECT_CALL(*item, GetURL()) .WillRepeatedly(ReturnRef(download_url)); EXPECT_CALL(*item, GetUrlChain()) @@ -428,7 +429,7 @@ void ChromeDownloadManagerDelegateTest::RunTestCaseWithDownloadItem( DownloadItem::TARGET_DISPOSITION_PROMPT : DownloadItem::TARGET_DISPOSITION_OVERWRITE; EXPECT_CALL(*item, GetTargetFilePath()) - .WillRepeatedly(ReturnRefOfCopy(FilePath())); + .WillRepeatedly(ReturnRefOfCopy(base::FilePath())); EXPECT_CALL(*item, GetTargetDisposition()) .WillRepeatedly(Return(initial_disposition)); EXPECT_CALL(*item, GetDangerType()) @@ -436,9 +437,9 @@ void ChromeDownloadManagerDelegateTest::RunTestCaseWithDownloadItem( if (test_case.expected_disposition == DownloadItem::TARGET_DISPOSITION_PROMPT) { - FilePath expected_prompt_path = GetPathInDownloadDir( + base::FilePath expected_prompt_path = GetPathInDownloadDir( test_case.expected_prompt_path); - FilePath expected_target_path = GetPathInDownloadDir( + base::FilePath expected_target_path = GetPathInDownloadDir( test_case.expected_target_path); EXPECT_CALL(*delegate_, ChooseDownloadPath(item, expected_prompt_path, _)) @@ -466,12 +467,12 @@ void ChromeDownloadManagerDelegateTest::RunTestCases( } void ChromeDownloadManagerDelegateTest::SetDefaultDownloadPath( - const FilePath& path) { + const base::FilePath& path) { pref_service_->SetFilePath(prefs::kDownloadDefaultDirectory, path); } void ChromeDownloadManagerDelegateTest::SetManagedDownloadPath( - const FilePath& path) { + const base::FilePath& path) { pref_service_->SetManagedPref(prefs::kDownloadDefaultDirectory, base::CreateFilePathValue(path)); } @@ -482,11 +483,11 @@ void ChromeDownloadManagerDelegateTest::SetPromptForDownload(bool prompt) { void ChromeDownloadManagerDelegateTest::DownloadTargetVerifier( const DownloadTestCase* test_case, - const FilePath& target_path, + const base::FilePath& target_path, DownloadItem::TargetDisposition disposition, content::DownloadDangerType danger_type, - const FilePath& intermediate_path) { - FilePath expected_target_path( + const base::FilePath& intermediate_path) { + base::FilePath expected_target_path( GetPathInDownloadDir(test_case->expected_target_path)); EXPECT_EQ(expected_target_path.value(), target_path.value()); EXPECT_EQ(test_case->expected_disposition, disposition); @@ -510,7 +511,7 @@ void ChromeDownloadManagerDelegateTest::DownloadTargetVerifier( } } -const FilePath& ChromeDownloadManagerDelegateTest::default_download_path() +const base::FilePath& ChromeDownloadManagerDelegateTest::default_download_path() const { return test_download_dir_.path(); } @@ -809,7 +810,8 @@ TEST_F(ChromeDownloadManagerDelegateTest, StartDownload_PromptAlways) { }; SetPromptForDownload(true); - EnableAutoOpenBasedOnExtension(FilePath(FILE_PATH_LITERAL("dummy.dummy"))); + EnableAutoOpenBasedOnExtension( + base::FilePath(FILE_PATH_LITERAL("dummy.dummy"))); RunTestCases(kPromptingTestCases, arraysize(kPromptingTestCases)); } diff --git a/chrome/browser/download/download_browsertest.cc b/chrome/browser/download/download_browsertest.cc index da3836e..4aa80ed 100644 --- a/chrome/browser/download/download_browsertest.cc +++ b/chrome/browser/download/download_browsertest.cc @@ -91,10 +91,11 @@ namespace { // IDs and paths of CRX files used in tests. const char kGoodCrxId[] = "ldnnhddmnhbkjipkidpdiheffobcpfmf"; -const FilePath kGoodCrxPath(FILE_PATH_LITERAL("extensions/good.crx")); +const base::FilePath kGoodCrxPath(FILE_PATH_LITERAL("extensions/good.crx")); const char kLargeThemeCrxId[] = "pjpgmfcmabopnnfonnhmdjglfpjjfkbf"; -const FilePath kLargeThemePath(FILE_PATH_LITERAL("extensions/theme2.crx")); +const base::FilePath kLargeThemePath( + FILE_PATH_LITERAL("extensions/theme2.crx")); // Get History Information. class DownloadsHistoryDataCollector { @@ -356,12 +357,12 @@ class DownloadTest : public InProcessBrowserTest { }; // Location of the file source (the place from which it is downloaded). - FilePath OriginFile(FilePath file) { + base::FilePath OriginFile(base::FilePath file) { return test_dir_.Append(file); } // Location of the file destination (place to which it is downloaded). - FilePath DestinationFile(Browser* browser, FilePath file) { + base::FilePath DestinationFile(Browser* browser, base::FilePath file) { return GetDownloadDirectory(browser).Append(file.BaseName()); } @@ -388,7 +389,7 @@ class DownloadTest : public InProcessBrowserTest { DownloadManagerForBrowser(browser)); } - FilePath GetDownloadDirectory(Browser* browser) { + base::FilePath GetDownloadDirectory(Browser* browser) { return GetDownloadPrefs(browser)->DownloadPath(); } @@ -482,20 +483,21 @@ class DownloadTest : public InProcessBrowserTest { // Returning false indicates a failure of the function, and should be asserted // in the caller. bool CheckDownload(Browser* browser, - const FilePath& downloaded_filename, - const FilePath& origin_filename) { + const base::FilePath& downloaded_filename, + const base::FilePath& origin_filename) { // Find the path to which the data will be downloaded. - FilePath downloaded_file(DestinationFile(browser, downloaded_filename)); + base::FilePath downloaded_file( + DestinationFile(browser, downloaded_filename)); // Find the origin path (from which the data comes). - FilePath origin_file(OriginFile(origin_filename)); + base::FilePath origin_file(OriginFile(origin_filename)); return CheckDownloadFullPaths(browser, downloaded_file, origin_file); } // A version of CheckDownload that allows complete path specification. bool CheckDownloadFullPaths(Browser* browser, - const FilePath& downloaded_file, - const FilePath& origin_file) { + const base::FilePath& downloaded_file, + const base::FilePath& origin_file) { bool origin_file_exists = file_util::PathExists(origin_file); EXPECT_TRUE(origin_file_exists); if (!origin_file_exists) @@ -535,7 +537,7 @@ class DownloadTest : public InProcessBrowserTest { // TODO(ahendrickson) -- |expected_title_in_progress| and // |expected_title_finished| need to be checked. - FilePath filename; + base::FilePath filename; net::FileURLToFilePath(url, &filename); string16 expected_title_in_progress( ASCIIToUTF16(partial_indication) + filename.LossyDisplayName()); @@ -574,9 +576,10 @@ class DownloadTest : public InProcessBrowserTest { // TODO(ahendrickson): check download status text after downloading. - FilePath basefilename(filename.BaseName()); + base::FilePath basefilename(filename.BaseName()); net::FileURLToFilePath(url, &filename); - FilePath download_path = downloads_directory_.path().Append(basefilename); + base::FilePath download_path = + downloads_directory_.path().Append(basefilename); EXPECT_TRUE(browser->window()->IsDownloadShelfVisible()); bool downloaded_path_exists = file_util::PathExists(download_path); @@ -617,7 +620,7 @@ class DownloadTest : public InProcessBrowserTest { // Checks that |path| is has |file_size| bytes, and matches the |value| // string. - bool VerifyFile(const FilePath& path, + bool VerifyFile(const base::FilePath& path, const std::string& value, const int64 file_size) { std::string file_contents; @@ -752,8 +755,8 @@ class DownloadTest : public InProcessBrowserTest { if (item->GetState() == content::DownloadItem::COMPLETE) { // Clean up the file, in case it ended up in the My Documents folder. - FilePath destination_folder = GetDownloadDirectory(browser()); - FilePath my_downloaded_file = item->GetTargetFilePath(); + base::FilePath destination_folder = GetDownloadDirectory(browser()); + base::FilePath my_downloaded_file = item->GetTargetFilePath(); EXPECT_TRUE(file_util::PathExists(my_downloaded_file)); EXPECT_TRUE(file_util::Delete(my_downloaded_file, false)); @@ -764,7 +767,7 @@ class DownloadTest : public InProcessBrowserTest { if (download_info.should_redirect_to_documents) { // If it's not where we asked it to be, it should be in the // My Documents folder. - FilePath my_docs_folder; + base::FilePath my_docs_folder; EXPECT_TRUE(PathService::Get(chrome::DIR_USER_DOCUMENTS, &my_docs_folder)); EXPECT_EQ(0u, @@ -843,7 +846,7 @@ class DownloadTest : public InProcessBrowserTest { DownloadFilesCheckErrorsSetup(); // Make the test folder unwritable. - FilePath destination_folder = GetDownloadDirectory(browser()); + base::FilePath destination_folder = GetDownloadDirectory(browser()); DVLOG(1) << " " << __FUNCTION__ << "()" << " folder = '" << destination_folder.value() << "'"; file_util::PermissionRestorer permission_restorer(destination_folder); @@ -870,7 +873,7 @@ class DownloadTest : public InProcessBrowserTest { } // Location of the test data. - FilePath test_dir_; + base::FilePath test_dir_; // Location of the downloads directory for these tests base::ScopedTempDir downloads_directory_; @@ -886,7 +889,7 @@ class DownloadTest : public InProcessBrowserTest { // Download a file due to the associated MIME type. IN_PROC_BROWSER_TEST_F(DownloadTest, DownloadMimeType) { - FilePath file(FILE_PATH_LITERAL("download-test1.lib")); + base::FilePath file(FILE_PATH_LITERAL("download-test1.lib")); GURL url(URLRequestMockHTTPJob::GetMockUrl(file)); // Download the file and wait. We do not expect the Select File dialog. @@ -902,7 +905,7 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, DownloadMimeType) { // Download a file and confirm that the zone identifier (on windows) // is set to internet. IN_PROC_BROWSER_TEST_F(DownloadTest, CheckInternetZone) { - FilePath file(FILE_PATH_LITERAL("download-test1.lib")); + base::FilePath file(FILE_PATH_LITERAL("download-test1.lib")); GURL url(URLRequestMockHTTPJob::GetMockUrl(file)); // Download the file and wait. We do not expect the Select File dialog. @@ -911,7 +914,7 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, CheckInternetZone) { // Check state. Special file state must be checked before CheckDownload, // as CheckDownload will delete the output file. EXPECT_EQ(1, browser()->tab_strip_model()->count()); - FilePath downloaded_file(DestinationFile(browser(), file)); + base::FilePath downloaded_file(DestinationFile(browser(), file)); if (file_util::VolumeSupportsADS(downloaded_file)) EXPECT_TRUE(file_util::HasInternetZoneIdentifier(downloaded_file)); CheckDownload(browser(), file, file); @@ -925,7 +928,7 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, DownloadMimeTypeSelect) { // Re-enable prompting. browser()->profile()->GetPrefs()->SetBoolean( prefs::kPromptForDownload, true); - FilePath file(FILE_PATH_LITERAL("download-test1.lib")); + base::FilePath file(FILE_PATH_LITERAL("download-test1.lib")); GURL url(URLRequestMockHTTPJob::GetMockUrl(file)); EnableFileChooser(true); @@ -954,9 +957,9 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, DownloadMimeTypeSelect) { // Access a file with a viewable mime-type, verify that a download // did not initiate. IN_PROC_BROWSER_TEST_F(DownloadTest, NoDownload) { - FilePath file(FILE_PATH_LITERAL("download-test2.html")); + base::FilePath file(FILE_PATH_LITERAL("download-test2.html")); GURL url(URLRequestMockHTTPJob::GetMockUrl(file)); - FilePath file_path(DestinationFile(browser(), file)); + base::FilePath file_path(DestinationFile(browser(), file)); // Open a web page and wait. ui_test_utils::NavigateToURL(browser(), url); @@ -1012,7 +1015,7 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, DownloadResourceThrottleCancels) { // Navigate to a page with the same domain as the file to download. We can't // navigate directly to the file we don't want to download because cross-site // navigations reset the TabDownloadState. - FilePath same_site_path(FILE_PATH_LITERAL("download_script.html")); + base::FilePath same_site_path(FILE_PATH_LITERAL("download_script.html")); GURL same_site_url(URLRequestMockHTTPJob::GetMockUrl(same_site_path)); ui_test_utils::NavigateToURL(browser(), same_site_url); @@ -1050,8 +1053,8 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, DownloadResourceThrottleCancels) { base::Unretained(MessageLoopForUI::current()))); // Check that we did not download the file. - FilePath file(FILE_PATH_LITERAL("download-test1.lib")); - FilePath file_path(DestinationFile(browser(), file)); + base::FilePath file(FILE_PATH_LITERAL("download-test1.lib")); + base::FilePath file_path(DestinationFile(browser(), file)); EXPECT_FALSE(file_util::PathExists(file_path)); // Check state. @@ -1070,9 +1073,10 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, DownloadResourceThrottleCancels) { // header. This also ensures we properly handle empty file downloads. // The download shelf should be visible in the current tab. IN_PROC_BROWSER_TEST_F(DownloadTest, ContentDisposition) { - FilePath file(FILE_PATH_LITERAL("download-test3.gif")); + base::FilePath file(FILE_PATH_LITERAL("download-test3.gif")); GURL url(URLRequestMockHTTPJob::GetMockUrl(file)); - FilePath download_file(FILE_PATH_LITERAL("download-test3-attachment.gif")); + base::FilePath download_file( + FILE_PATH_LITERAL("download-test3-attachment.gif")); // Download a file and wait. DownloadAndWait(browser(), url); @@ -1088,9 +1092,10 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, ContentDisposition) { // tab, opening a second tab, closing the shelf, going back to the first tab, // and checking that the shelf is closed. IN_PROC_BROWSER_TEST_F(DownloadTest, PerWindowShelf) { - FilePath file(FILE_PATH_LITERAL("download-test3.gif")); + base::FilePath file(FILE_PATH_LITERAL("download-test3.gif")); GURL url(URLRequestMockHTTPJob::GetMockUrl(file)); - FilePath download_file(FILE_PATH_LITERAL("download-test3-attachment.gif")); + base::FilePath download_file( + FILE_PATH_LITERAL("download-test3-attachment.gif")); // Download a file and wait. DownloadAndWait(browser(), url); @@ -1123,7 +1128,7 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, PerWindowShelf) { // Check whether the downloads shelf is closed when the downloads tab is // invoked. IN_PROC_BROWSER_TEST_F(DownloadTest, CloseShelfOnDownloadsTab) { - FilePath file(FILE_PATH_LITERAL("download-test1.lib")); + base::FilePath file(FILE_PATH_LITERAL("download-test1.lib")); GURL url(URLRequestMockHTTPJob::GetMockUrl(file)); // Download the file and wait. We do not expect the Select File dialog. @@ -1170,7 +1175,7 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, IncognitoDownload) { // Download a file in the Incognito window and wait. CreateAndSetDownloadsDirectory(incognito); - FilePath file(FILE_PATH_LITERAL("download-test1.lib")); + base::FilePath file(FILE_PATH_LITERAL("download-test1.lib")); GURL url(URLRequestMockHTTPJob::GetMockUrl(file)); // Since |incognito| is a separate browser, we have to set it up explicitly. incognito->profile()->GetPrefs()->SetBoolean(prefs::kPromptForDownload, @@ -1213,7 +1218,7 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, IncognitoDownload) { IN_PROC_BROWSER_TEST_F(DownloadTest, DontCloseNewTab1) { // Because it's an HTML link, it should open a web page rather than // downloading. - FilePath file1(FILE_PATH_LITERAL("download-test2.html")); + base::FilePath file1(FILE_PATH_LITERAL("download-test2.html")); GURL url(URLRequestMockHTTPJob::GetMockUrl(file1)); // Open a web page and wait. @@ -1233,7 +1238,7 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, DontCloseNewTab1) { IN_PROC_BROWSER_TEST_F(DownloadTest, CloseNewTab1) { // Download a file in a new background tab and wait. The tab is automatically // closed when the download begins. - FilePath file(FILE_PATH_LITERAL("download-test1.lib")); + base::FilePath file(FILE_PATH_LITERAL("download-test1.lib")); GURL url(URLRequestMockHTTPJob::GetMockUrl(file)); DownloadAndWaitWithDisposition( browser(), @@ -1258,14 +1263,14 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, CloseNewTab1) { IN_PROC_BROWSER_TEST_F(DownloadTest, DontCloseNewTab2) { // Because it's an HTML link, it should open a web page rather than // downloading. - FilePath file1(FILE_PATH_LITERAL("download_page1.html")); + base::FilePath file1(FILE_PATH_LITERAL("download_page1.html")); GURL url(URLRequestMockHTTPJob::GetMockUrl(file1)); // Open a web page and wait. ui_test_utils::NavigateToURL(browser(), url); // Download a file in a new tab and wait (via Javascript). - FilePath file(FILE_PATH_LITERAL("download-test1.lib")); + base::FilePath file(FILE_PATH_LITERAL("download-test1.lib")); DownloadAndWaitWithDisposition(browser(), GURL("javascript:openNew()"), CURRENT_TAB, @@ -1288,7 +1293,7 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, DontCloseNewTab2) { IN_PROC_BROWSER_TEST_F(DownloadTest, DontCloseNewTab3) { // Because it's an HTML link, it should open a web page rather than // downloading. - FilePath file1(FILE_PATH_LITERAL("download_page2.html")); + base::FilePath file1(FILE_PATH_LITERAL("download_page2.html")); GURL url1(URLRequestMockHTTPJob::GetMockUrl(file1)); // Open a web page and wait. @@ -1304,7 +1309,7 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, DontCloseNewTab3) { EXPECT_EQ(2, browser()->tab_strip_model()->count()); // Download a file and wait. - FilePath file(FILE_PATH_LITERAL("download-test1.lib")); + base::FilePath file(FILE_PATH_LITERAL("download-test1.lib")); GURL url(URLRequestMockHTTPJob::GetMockUrl(file)); DownloadAndWaitWithDisposition(browser(), url, @@ -1328,7 +1333,7 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, DontCloseNewTab3) { IN_PROC_BROWSER_TEST_F(DownloadTest, CloseNewTab2) { // Because it's an HTML link, it should open a web page rather than // downloading. - FilePath file1(FILE_PATH_LITERAL("download_page3.html")); + base::FilePath file1(FILE_PATH_LITERAL("download_page3.html")); GURL url(URLRequestMockHTTPJob::GetMockUrl(file1)); // Open a web page and wait. @@ -1336,7 +1341,7 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, CloseNewTab2) { // Download a file and wait. // The file to download is "download-test1.lib". - FilePath file(FILE_PATH_LITERAL("download-test1.lib")); + base::FilePath file(FILE_PATH_LITERAL("download-test1.lib")); DownloadAndWaitWithDisposition(browser(), GURL("javascript:openNew()"), CURRENT_TAB, @@ -1359,7 +1364,7 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, CloseNewTab2) { IN_PROC_BROWSER_TEST_F(DownloadTest, CloseNewTab3) { // Because it's an HTML link, it should open a web page rather than // downloading. - FilePath file1(FILE_PATH_LITERAL("download_page4.html")); + base::FilePath file1(FILE_PATH_LITERAL("download_page4.html")); GURL url(URLRequestMockHTTPJob::GetMockUrl(file1)); // Open a web page and wait. @@ -1368,7 +1373,7 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, CloseNewTab3) { // Download a file in a new tab and wait. The tab will automatically close // when the download begins. // The file to download is "download-test1.lib". - FilePath file(FILE_PATH_LITERAL("download-test1.lib")); + base::FilePath file(FILE_PATH_LITERAL("download-test1.lib")); DownloadAndWaitWithDisposition( browser(), GURL("javascript:document.getElementById('form').submit()"), @@ -1390,7 +1395,7 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, CloseNewTab3) { // // Regression test for http://crbug.com/44454 IN_PROC_BROWSER_TEST_F(DownloadTest, NewWindow) { - FilePath file(FILE_PATH_LITERAL("download-test1.lib")); + base::FilePath file(FILE_PATH_LITERAL("download-test1.lib")); GURL url(URLRequestMockHTTPJob::GetMockUrl(file)); #if !defined(OS_MACOSX) // See below. @@ -1447,7 +1452,7 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, NewWindow) { IN_PROC_BROWSER_TEST_F(DownloadTest, DownloadHistoryCheck) { GURL download_url(URLRequestSlowDownloadJob::kKnownSizeUrl); - FilePath file(net::GenerateFileName(download_url, "", "", "", "", "")); + base::FilePath file(net::GenerateFileName(download_url, "", "", "", "", "")); // We use the server so that we can get a redirect and test url_chain // persistence. @@ -1527,7 +1532,7 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, DownloadHistoryCheck) { // Make sure a dangerous file shows up properly in the history. IN_PROC_BROWSER_TEST_F(DownloadTest, DownloadHistoryDangerCheck) { // .swf file so that it's dangerous on all platforms (including CrOS). - FilePath file(FILE_PATH_LITERAL("downloads/dangerous/dangerous.swf")); + base::FilePath file(FILE_PATH_LITERAL("downloads/dangerous/dangerous.swf")); GURL download_url(URLRequestMockHTTPJob::GetMockUrl(file)); // Null out plugins so that flash plugin won't interfere with testing. @@ -1592,7 +1597,7 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, DownloadHistoryDangerCheck) { // Test for crbug.com/14505. This tests that chrome:// urls are still functional // after download of a file while viewing another chrome://. IN_PROC_BROWSER_TEST_F(DownloadTest, ChromeURLAfterDownload) { - FilePath file(FILE_PATH_LITERAL("download-test1.lib")); + base::FilePath file(FILE_PATH_LITERAL("download-test1.lib")); GURL download_url(URLRequestMockHTTPJob::GetMockUrl(file)); GURL flags_url(chrome::kChromeUIFlagsURL); GURL extensions_url(chrome::kChromeUIExtensionsFrameURL); @@ -1616,7 +1621,7 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, ChromeURLAfterDownload) { // will be able to close. IN_PROC_BROWSER_TEST_F(DownloadTest, BrowserCloseAfterDownload) { GURL downloads_url(chrome::kChromeUIFlagsURL); - FilePath file(FILE_PATH_LITERAL("download-test1.lib")); + base::FilePath file(FILE_PATH_LITERAL("download-test1.lib")); GURL download_url(URLRequestMockHTTPJob::GetMockUrl(file)); ui_test_utils::NavigateToURL(browser(), downloads_url); @@ -1641,7 +1646,7 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, BrowserCloseAfterDownload) { // Test to make sure the 'download' attribute in anchor tag is respected. IN_PROC_BROWSER_TEST_F(DownloadTest, AnchorDownloadTag) { - FilePath file(FILE_PATH_LITERAL("download-anchor-attrib.html")); + base::FilePath file(FILE_PATH_LITERAL("download-anchor-attrib.html")); GURL url(URLRequestMockHTTPJob::GetMockUrl(file)); // Create a download, wait until it's complete, and confirm @@ -1654,14 +1659,14 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, AnchorDownloadTag) { CheckDownloadStates(1, DownloadItem::COMPLETE); // Confirm the downloaded data exists. - FilePath downloaded_file = GetDownloadDirectory(browser()); + base::FilePath downloaded_file = GetDownloadDirectory(browser()); downloaded_file = downloaded_file.Append(FILE_PATH_LITERAL("a_red_dot.png")); EXPECT_TRUE(file_util::PathExists(downloaded_file)); } // Test to make sure auto-open works. IN_PROC_BROWSER_TEST_F(DownloadTest, AutoOpen) { - FilePath file(FILE_PATH_LITERAL("download-autoopen.txt")); + base::FilePath file(FILE_PATH_LITERAL("download-autoopen.txt")); GURL url(URLRequestMockHTTPJob::GetMockUrl(file)); ASSERT_TRUE( @@ -1792,7 +1797,7 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, CrxInstallAcceptPermissions) { // Test installing a CRX that fails integrity checks. IN_PROC_BROWSER_TEST_F(DownloadTest, CrxInvalid) { - FilePath file(FILE_PATH_LITERAL("extensions/bad_signature.crx")); + base::FilePath file(FILE_PATH_LITERAL("extensions/bad_signature.crx")); GURL extension_url(URLRequestMockHTTPJob::GetMockUrl(file)); // Install a mock install UI that simulates a user allowing permission to @@ -1854,7 +1859,7 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, CrxLargeTheme) { // Tests for download initiation functions. IN_PROC_BROWSER_TEST_F(DownloadTest, DownloadUrl) { - FilePath file(FILE_PATH_LITERAL("download-test1.lib")); + base::FilePath file(FILE_PATH_LITERAL("download-test1.lib")); GURL url(URLRequestMockHTTPJob::GetMockUrl(file)); // DownloadUrl always prompts; return acceptance of whatever it prompts. @@ -1884,7 +1889,7 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, DownloadUrl) { } IN_PROC_BROWSER_TEST_F(DownloadTest, DownloadUrlToPath) { - FilePath file(FILE_PATH_LITERAL("download-test1.lib")); + base::FilePath file(FILE_PATH_LITERAL("download-test1.lib")); GURL url(URLRequestMockHTTPJob::GetMockUrl(file)); WebContents* web_contents = @@ -1893,7 +1898,7 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, DownloadUrlToPath) { base::ScopedTempDir other_directory; ASSERT_TRUE(other_directory.CreateUniqueTempDir()); - FilePath target_file_full_path + base::FilePath target_file_full_path = other_directory.path().Append(file.BaseName()); content::DownloadTestObserver* observer(CreateWaiter(browser(), 1)); scoped_ptr<DownloadUrlParameters> params( @@ -2385,13 +2390,13 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, LoadURLExternallyReferrerPolicy) { download_items[0]->GetOriginalUrl()); // Check that the file contains the expected referrer. - FilePath file(download_items[0]->GetFullPath()); + base::FilePath file(download_items[0]->GetFullPath()); std::string expected_contents = test_server()->GetURL("").spec(); ASSERT_TRUE(VerifyFile(file, expected_contents, expected_contents.length())); } IN_PROC_BROWSER_TEST_F(DownloadTest, HiddenDownload) { - FilePath file(FILE_PATH_LITERAL("download-test1.lib")); + base::FilePath file(FILE_PATH_LITERAL("download-test1.lib")); GURL url(URLRequestMockHTTPJob::GetMockUrl(file)); scoped_refptr<DownloadManager> download_manager = diff --git a/chrome/browser/download/download_danger_prompt_browsertest.cc b/chrome/browser/download/download_danger_prompt_browsertest.cc index 9cf5ea5..b3b5ca1 100644 --- a/chrome/browser/download/download_danger_prompt_browsertest.cc +++ b/chrome/browser/download/download_danger_prompt_browsertest.cc @@ -75,7 +75,7 @@ class DownloadDangerPromptTest : public InProcessBrowserTest { private: void SetUpDownloadItemExpectations() { EXPECT_CALL(download_, GetFileNameToReportUser()).WillRepeatedly(Return( - FilePath(FILE_PATH_LITERAL("evil.exe")))); + base::FilePath(FILE_PATH_LITERAL("evil.exe")))); EXPECT_CALL(download_, AddObserver(_)) .WillOnce(SaveArg<0>(&download_observer_)); EXPECT_CALL(download_, RemoveObserver(Eq(ByRef(download_observer_)))); diff --git a/chrome/browser/download/download_extensions.cc b/chrome/browser/download/download_extensions.cc index fe20035..5cb782d 100644 --- a/chrome/browser/download/download_extensions.cc +++ b/chrome/browser/download/download_extensions.cc @@ -212,8 +212,8 @@ static const struct Executables { #endif }; -DownloadDangerLevel GetFileDangerLevel(const FilePath& path) { - FilePath::StringType extension(path.Extension()); +DownloadDangerLevel GetFileDangerLevel(const base::FilePath& path) { + base::FilePath::StringType extension(path.Extension()); if (extension.empty()) return NotDangerous; if (!IsStringASCII(extension)) @@ -225,7 +225,7 @@ DownloadDangerLevel GetFileDangerLevel(const FilePath& path) { #endif // Strip out leading dot if it's still there - if (ascii_extension[0] == FilePath::kExtensionSeparator) + if (ascii_extension[0] == base::FilePath::kExtensionSeparator) ascii_extension.erase(0, 1); for (size_t i = 0; i < arraysize(g_executables); ++i) { diff --git a/chrome/browser/download/download_extensions.h b/chrome/browser/download/download_extensions.h index b3d1a7e..e2ea0df 100644 --- a/chrome/browser/download/download_extensions.h +++ b/chrome/browser/download/download_extensions.h @@ -18,7 +18,7 @@ enum DownloadDangerLevel { }; // Determine the download danger level of a file. -DownloadDangerLevel GetFileDangerLevel(const FilePath& path); +DownloadDangerLevel GetFileDangerLevel(const base::FilePath& path); // Tests if we think the server means for this mime_type to be executable. bool IsExecutableMimeType(const std::string& mime_type); diff --git a/chrome/browser/download/download_file_icon_extractor.h b/chrome/browser/download/download_file_icon_extractor.h index f40effc..8425770 100644 --- a/chrome/browser/download/download_file_icon_extractor.h +++ b/chrome/browser/download/download_file_icon_extractor.h @@ -24,7 +24,7 @@ class DownloadFileIconExtractor { // Should return false if the request was invalid. If the return value is // true, then |callback| should be called with the result. - virtual bool ExtractIconURLForPath(const FilePath& path, + virtual bool ExtractIconURLForPath(const base::FilePath& path, IconLoader::IconSize icon_size, IconURLCallback callback) = 0; }; diff --git a/chrome/browser/download/download_file_picker.cc b/chrome/browser/download/download_file_picker.cc index 2d9f7f2..76b7d81 100644 --- a/chrome/browser/download/download_file_picker.cc +++ b/chrome/browser/download/download_file_picker.cc @@ -44,8 +44,8 @@ void RecordFilePickerResult(DownloadManager* manager, FILE_PICKER_MAX); } -FilePickerResult ComparePaths(const FilePath& suggested_path, - const FilePath& actual_path) { +FilePickerResult ComparePaths(const base::FilePath& suggested_path, + const base::FilePath& actual_path) { if (suggested_path == actual_path) return FILE_PICKER_SAME; if (suggested_path.DirName() != actual_path.DirName()) @@ -61,7 +61,7 @@ DownloadFilePicker::DownloadFilePicker() : download_id_(0) { void DownloadFilePicker::Init( DownloadManager* download_manager, DownloadItem* item, - const FilePath& suggested_path, + const base::FilePath& suggested_path, const ChromeDownloadManagerDelegate::FileSelectedCallback& callback) { download_manager_ = download_manager; download_id_ = item->GetId(); @@ -73,7 +73,7 @@ void DownloadFilePicker::Init( select_file_dialog_ = ui::SelectFileDialog::Create( this, new ChromeSelectFilePolicy(web_contents)); ui::SelectFileDialog::FileTypeInfo file_type_info; - FilePath::StringType extension = suggested_path_.Extension(); + base::FilePath::StringType extension = suggested_path_.Extension(); if (!extension.empty()) { extension.erase(extension.begin()); // drop the . file_type_info.extensions.resize(1); @@ -98,22 +98,23 @@ void DownloadFilePicker::Init( DownloadFilePicker::~DownloadFilePicker() { } -void DownloadFilePicker::InitSuggestedPath(DownloadItem* item, - const FilePath& suggested_path) { +void DownloadFilePicker::InitSuggestedPath( + DownloadItem* item, + const base::FilePath& suggested_path) { set_suggested_path(suggested_path); } -void DownloadFilePicker::OnFileSelected(const FilePath& path) { +void DownloadFilePicker::OnFileSelected(const base::FilePath& path) { file_selected_callback_.Run(path); delete this; } -void DownloadFilePicker::RecordFileSelected(const FilePath& path) { +void DownloadFilePicker::RecordFileSelected(const base::FilePath& path) { FilePickerResult result = ComparePaths(suggested_path_, path); RecordFilePickerResult(download_manager_, result); } -void DownloadFilePicker::FileSelected(const FilePath& path, +void DownloadFilePicker::FileSelected(const base::FilePath& path, int index, void* params) { RecordFileSelected(path); @@ -123,6 +124,6 @@ void DownloadFilePicker::FileSelected(const FilePath& path, void DownloadFilePicker::FileSelectionCanceled(void* params) { RecordFilePickerResult(download_manager_, FILE_PICKER_CANCEL); - OnFileSelected(FilePath()); + OnFileSelected(base::FilePath()); // Deletes |this| } diff --git a/chrome/browser/download/download_file_picker_chromeos.cc b/chrome/browser/download/download_file_picker_chromeos.cc index a216d94..0991285 100644 --- a/chrome/browser/download/download_file_picker_chromeos.cc +++ b/chrome/browser/download/download_file_picker_chromeos.cc @@ -22,23 +22,24 @@ DownloadFilePickerChromeOS::~DownloadFilePickerChromeOS() { } void DownloadFilePickerChromeOS::InitSuggestedPath(DownloadItem* item, - const FilePath& path) { + const base::FilePath& path) { // For Drive downloads, we should pass the drive path instead of the temporary // file path. Profile* profile = Profile::FromBrowserContext(download_manager_->GetBrowserContext()); drive::DriveDownloadHandler* drive_download_handler = drive::DriveDownloadHandler::GetForProfile(profile); - FilePath suggested_path = path; + base::FilePath suggested_path = path; if (drive_download_handler && drive_download_handler->IsDriveDownload(item)) suggested_path = drive_download_handler->GetTargetPath(item); DownloadFilePicker::InitSuggestedPath(item, suggested_path); } -void DownloadFilePickerChromeOS::FileSelected(const FilePath& selected_path, - int index, - void* params) { +void DownloadFilePickerChromeOS::FileSelected( + const base::FilePath& selected_path, + int index, + void* params) { FileSelectedWithExtraInfo( ui::SelectedFileInfo(selected_path, selected_path), index, @@ -49,7 +50,7 @@ void DownloadFilePickerChromeOS::FileSelectedWithExtraInfo( const ui::SelectedFileInfo& file_info, int index, void* params) { - FilePath path = file_info.file_path; + base::FilePath path = file_info.file_path; file_util::NormalizeFileNameEncoding(&path); // Need to do this before we substitute with a temporary path. Otherwise we @@ -71,7 +72,7 @@ void DownloadFilePickerChromeOS::FileSelectedWithExtraInfo( OnFileSelected(path); } } else { - OnFileSelected(FilePath()); + OnFileSelected(base::FilePath()); } // The OnFileSelected() call deletes |this| } diff --git a/chrome/browser/download/download_file_picker_chromeos.h b/chrome/browser/download/download_file_picker_chromeos.h index 6d824fc..2d97318 100644 --- a/chrome/browser/download/download_file_picker_chromeos.h +++ b/chrome/browser/download/download_file_picker_chromeos.h @@ -18,7 +18,7 @@ class DownloadFilePickerChromeOS : public DownloadFilePicker { private: // SelectFileDialog::Listener implementation. - virtual void FileSelected(const FilePath& path, + virtual void FileSelected(const base::FilePath& path, int index, void* params) OVERRIDE; virtual void FileSelectedWithExtraInfo( @@ -29,7 +29,7 @@ class DownloadFilePickerChromeOS : public DownloadFilePicker { // DownloadFilePicker implementation. // This looks up the gdata path instead of the temporary local path. virtual void InitSuggestedPath(content::DownloadItem* item, - const FilePath& suggested_path) OVERRIDE; + const base::FilePath& suggested_path) OVERRIDE; DISALLOW_COPY_AND_ASSIGN(DownloadFilePickerChromeOS); }; diff --git a/chrome/browser/download/download_history_unittest.cc b/chrome/browser/download/download_history_unittest.cc index 08fa7d5..63528cd 100644 --- a/chrome/browser/download/download_history_unittest.cc +++ b/chrome/browser/download/download_history_unittest.cc @@ -335,8 +335,8 @@ class DownloadHistoryTest : public testing::Test { // routine. void InitItem( int32 id, - const FilePath& current_path, - const FilePath& target_path, + const base::FilePath& current_path, + const base::FilePath& target_path, const std::vector<GURL>& url_chain, const GURL& referrer, const base::Time& start_time, @@ -431,7 +431,7 @@ TEST_F(DownloadHistoryTest, DownloadHistoryTest_Load) { // Load a download from history, create the item, OnDownloadCreated, // OnDownloadUpdated, OnDownloadRemoved. history::DownloadRow info; - FilePath path(FILE_PATH_LITERAL("/foo/bar.pdf")); + base::FilePath path(FILE_PATH_LITERAL("/foo/bar.pdf")); GURL url("http://example.com/bar.pdf"); GURL referrer("http://example.com/referrer.html"); std::vector<GURL> url_chain; @@ -481,7 +481,7 @@ TEST_F(DownloadHistoryTest, DownloadHistoryTest_Create) { // Note that db_handle must be -1 at first because it isn't in the db yet. history::DownloadRow info; - FilePath path(FILE_PATH_LITERAL("/foo/bar.pdf")); + base::FilePath path(FILE_PATH_LITERAL("/foo/bar.pdf")); GURL url("http://example.com/bar.pdf"); GURL referrer("http://example.com/referrer.html"); std::vector<GURL> url_chain; @@ -533,7 +533,7 @@ TEST_F(DownloadHistoryTest, DownloadHistoryTest_Temporary) { // Note that db_handle must be -1 at first because it isn't in the db yet. history::DownloadRow info; - FilePath path(FILE_PATH_LITERAL("/foo/bar.pdf")); + base::FilePath path(FILE_PATH_LITERAL("/foo/bar.pdf")); GURL url("http://example.com/bar.pdf"); GURL referrer("http://example.com/referrer.html"); std::vector<GURL> url_chain; @@ -599,7 +599,7 @@ TEST_F(DownloadHistoryTest, // Note that db_handle must be -1 at first because it isn't in the db yet. history::DownloadRow info; - FilePath path(FILE_PATH_LITERAL("/foo/bar.pdf")); + base::FilePath path(FILE_PATH_LITERAL("/foo/bar.pdf")); GURL url("http://example.com/bar.pdf"); GURL referrer("http://example.com/referrer.html"); std::vector<GURL> url_chain; @@ -655,7 +655,7 @@ TEST_F(DownloadHistoryTest, DownloadHistoryTest_Multiple) { // Load a download from history, create the item, OnDownloadCreated, // OnDownloadUpdated, OnDownloadRemoved. history::DownloadRow info0, info1; - FilePath path0(FILE_PATH_LITERAL("/foo/bar.pdf")); + base::FilePath path0(FILE_PATH_LITERAL("/foo/bar.pdf")); GURL url0("http://example.com/bar.pdf"); GURL referrer0("http://example.com/referrer.html"); std::vector<GURL> url0_chain; @@ -675,7 +675,7 @@ TEST_F(DownloadHistoryTest, DownloadHistoryTest_Multiple) { base::RandInt(0, 1 << 10), false, &info0); - FilePath path1(FILE_PATH_LITERAL("/foo/qux.pdf")); + base::FilePath path1(FILE_PATH_LITERAL("/foo/qux.pdf")); GURL url1("http://example.com/qux.pdf"); GURL referrer1("http://example.com/referrer.html"); std::vector<GURL> url1_chain; @@ -723,7 +723,7 @@ TEST_F(DownloadHistoryTest, DownloadHistoryTest_CreateFailed) { // Note that db_handle must be -1 at first because it isn't in the db yet. history::DownloadRow info; - FilePath path(FILE_PATH_LITERAL("/foo/bar.pdf")); + base::FilePath path(FILE_PATH_LITERAL("/foo/bar.pdf")); GURL url("http://example.com/bar.pdf"); GURL referrer("http://example.com/referrer.html"); std::vector<GURL> url_chain; @@ -766,7 +766,7 @@ TEST_F(DownloadHistoryTest, // Note that db_handle must be -1 at first because it isn't in the db yet. history::DownloadRow info; - FilePath path(FILE_PATH_LITERAL("/foo/bar.pdf")); + base::FilePath path(FILE_PATH_LITERAL("/foo/bar.pdf")); GURL url("http://example.com/bar.pdf"); GURL referrer("http://example.com/referrer.html"); std::vector<GURL> url_chain; diff --git a/chrome/browser/download/download_item_model_unittest.cc b/chrome/browser/download/download_item_model_unittest.cc index aa448b5..01ad709 100644 --- a/chrome/browser/download/download_item_model_unittest.cc +++ b/chrome/browser/download/download_item_model_unittest.cc @@ -43,10 +43,10 @@ char kInterruptReasonCounter[] = { const size_t kInterruptReasonCount = ARRAYSIZE_UNSAFE(kInterruptReasonCounter); // Default target path for a mock download item in DownloadItemModelTest. -const FilePath::CharType kDefaultTargetFilePath[] = +const base::FilePath::CharType kDefaultTargetFilePath[] = FILE_PATH_LITERAL("/foo/bar/foo.bar"); -const FilePath::CharType kDefaultDisplayFileName[] = +const base::FilePath::CharType kDefaultDisplayFileName[] = FILE_PATH_LITERAL("foo.bar"); // Default URL for a mock download item in DownloadItemModelTest. @@ -77,9 +77,9 @@ class DownloadItemModelTest : public testing::Test { ON_CALL(item_, GetURL()) .WillByDefault(ReturnRefOfCopy(GURL(kDefaultURL))); ON_CALL(item_, GetFileNameToReportUser()) - .WillByDefault(Return(FilePath(kDefaultDisplayFileName))); + .WillByDefault(Return(base::FilePath(kDefaultDisplayFileName))); ON_CALL(item_, GetTargetFilePath()) - .WillByDefault(ReturnRefOfCopy(FilePath(kDefaultTargetFilePath))); + .WillByDefault(ReturnRefOfCopy(base::FilePath(kDefaultTargetFilePath))); ON_CALL(item_, GetTargetDisposition()) .WillByDefault( Return(DownloadItem::TARGET_DISPOSITION_OVERWRITE)); diff --git a/chrome/browser/download/download_path_reservation_tracker.cc b/chrome/browser/download/download_path_reservation_tracker.cc index eab0190..bb0deb2 100644 --- a/chrome/browser/download/download_path_reservation_tracker.cc +++ b/chrome/browser/download/download_path_reservation_tracker.cc @@ -24,7 +24,7 @@ using content::DownloadItem; namespace { -typedef std::map<content::DownloadId, FilePath> ReservationMap; +typedef std::map<content::DownloadId, base::FilePath> ReservationMap; // Map of download path reservations. Each reserved path is associated with a // DownloadId. This object is destroyed in |Revoke()| when there are no more @@ -52,13 +52,13 @@ class DownloadItemObserver : public DownloadItem::Observer { DownloadItem& download_item_; // Last known target path for the download. - FilePath last_target_path_; + base::FilePath last_target_path_; DISALLOW_COPY_AND_ASSIGN(DownloadItemObserver); }; // Returns true if the given path is in use by a path reservation. -bool IsPathReserved(const FilePath& path) { +bool IsPathReserved(const base::FilePath& path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); // No reservation map => no reservations. if (g_reservation_map == NULL) @@ -77,7 +77,7 @@ bool IsPathReserved(const FilePath& path) { // Returns true if the given path is in use by any path reservation or the // file system. Called on the FILE thread. -bool IsPathInUse(const FilePath& path) { +bool IsPathInUse(const base::FilePath& path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); // If there is a reservation, then the path is in use. if (IsPathReserved(path)) @@ -99,8 +99,8 @@ bool IsPathInUse(const FilePath& path) { // indicating whether the returned path has been successfully verified. void CreateReservation( DownloadId download_id, - const FilePath& suggested_path, - const FilePath& default_download_path, + const base::FilePath& suggested_path, + const base::FilePath& default_download_path, bool should_uniquify, const DownloadPathReservationTracker::ReservedPathCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); @@ -115,7 +115,7 @@ void CreateReservation( ReservationMap& reservations = *g_reservation_map; DCHECK(!ContainsKey(reservations, download_id)); - FilePath target_path(suggested_path.NormalizePathSeparators()); + base::FilePath target_path(suggested_path.NormalizePathSeparators()); bool is_path_writeable = true; bool has_conflicts = false; @@ -130,8 +130,8 @@ void CreateReservation( // Check writability of the suggested path. If we can't write to it, default // to the user's "My Documents" directory. We'll prompt them in this case. - FilePath dir = target_path.DirName(); - FilePath filename = target_path.BaseName(); + base::FilePath dir = target_path.DirName(); + base::FilePath filename = target_path.BaseName(); if (!file_util::PathIsWritable(dir)) { DVLOG(1) << "Unable to write to directory \"" << dir.value() << "\""; is_path_writeable = false; @@ -144,7 +144,7 @@ void CreateReservation( for (int uniquifier = 1; uniquifier <= DownloadPathReservationTracker::kMaxUniqueFiles; ++uniquifier) { - FilePath path_to_check(target_path.InsertBeforeExtensionASCII( + base::FilePath path_to_check(target_path.InsertBeforeExtensionASCII( StringPrintf(" (%d)", uniquifier))); if (!IsPathInUse(path_to_check)) { target_path = path_to_check; @@ -161,7 +161,7 @@ void CreateReservation( // Called on the FILE thread to update the path of the reservation associated // with |download_id| to |new_path|. -void UpdateReservation(DownloadId download_id, const FilePath& new_path) { +void UpdateReservation(DownloadId download_id, const base::FilePath& new_path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); DCHECK(g_reservation_map != NULL); ReservationMap::iterator iter = g_reservation_map->find(download_id); @@ -204,7 +204,7 @@ void DownloadItemObserver::OnDownloadUpdated(DownloadItem* download) { switch (download->GetState()) { case DownloadItem::IN_PROGRESS: { // Update the reservation. - FilePath new_target_path = download->GetTargetFilePath(); + base::FilePath new_target_path = download->GetTargetFilePath(); if (new_target_path != last_target_path_) { BrowserThread::PostTask( BrowserThread::FILE, FROM_HERE, @@ -253,8 +253,8 @@ void DownloadItemObserver::OnDownloadDestroyed(DownloadItem* download) { // static void DownloadPathReservationTracker::GetReservedPath( DownloadItem& download_item, - const FilePath& target_path, - const FilePath& default_path, + const base::FilePath& target_path, + const base::FilePath& default_path, bool uniquify_path, const ReservedPathCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); @@ -271,6 +271,6 @@ void DownloadPathReservationTracker::GetReservedPath( // static bool DownloadPathReservationTracker::IsPathInUseForTesting( - const FilePath& path) { + const base::FilePath& path) { return IsPathInUse(path); } diff --git a/chrome/browser/download/download_path_reservation_tracker_unittest.cc b/chrome/browser/download/download_path_reservation_tracker_unittest.cc index cecfdbd..13d8149 100644 --- a/chrome/browser/download/download_path_reservation_tracker_unittest.cc +++ b/chrome/browser/download/download_path_reservation_tracker_unittest.cc @@ -70,30 +70,34 @@ class DownloadPathReservationTrackerTest : public testing::Test { virtual void TearDown() OVERRIDE; FakeDownloadItem* CreateDownloadItem(int32 id); - FilePath GetPathInDownloadsDirectory(const FilePath::CharType* suffix); - bool IsPathInUse(const FilePath& path); - void CallGetReservedPath(DownloadItem& download_item, - const FilePath& target_path, bool uniquify_path, - FilePath* return_path, bool* return_verified); - - const FilePath& default_download_path() const { + base::FilePath GetPathInDownloadsDirectory( + const base::FilePath::CharType* suffix); + bool IsPathInUse(const base::FilePath& path); + void CallGetReservedPath( + DownloadItem& download_item, + const base::FilePath& target_path, + bool uniquify_path, + base::FilePath* return_path, + bool* return_verified); + + const base::FilePath& default_download_path() const { return default_download_path_; } - void set_default_download_path(const FilePath& path) { + void set_default_download_path(const base::FilePath& path) { default_download_path_ = path; } protected: base::ScopedTempDir test_download_dir_; - FilePath default_download_path_; + base::FilePath default_download_path_; MessageLoopForUI message_loop_; content::TestBrowserThread ui_thread_; content::TestBrowserThread file_thread_; private: - void TestReservedPathCallback(FilePath* return_path, bool* return_verified, - bool* did_run_callback, - const FilePath& path, bool verified); + void TestReservedPathCallback(base::FilePath* return_path, + bool* return_verified, bool* did_run_callback, + const base::FilePath& path, bool verified); }; DownloadPathReservationTrackerTest::DownloadPathReservationTrackerTest() @@ -117,24 +121,25 @@ FakeDownloadItem* DownloadPathReservationTrackerTest::CreateDownloadItem( EXPECT_CALL(*item, GetGlobalId()) .WillRepeatedly(Return(download_id)); EXPECT_CALL(*item, GetTargetFilePath()) - .WillRepeatedly(ReturnRefOfCopy(FilePath())); + .WillRepeatedly(ReturnRefOfCopy(base::FilePath())); return item; } -FilePath DownloadPathReservationTrackerTest::GetPathInDownloadsDirectory( - const FilePath::CharType* suffix) { +base::FilePath DownloadPathReservationTrackerTest::GetPathInDownloadsDirectory( + const base::FilePath::CharType* suffix) { return default_download_path().Append(suffix).NormalizePathSeparators(); } -bool DownloadPathReservationTrackerTest::IsPathInUse(const FilePath& path) { +bool DownloadPathReservationTrackerTest::IsPathInUse( + const base::FilePath& path) { return DownloadPathReservationTracker::IsPathInUseForTesting(path); } void DownloadPathReservationTrackerTest::CallGetReservedPath( DownloadItem& download_item, - const FilePath& target_path, + const base::FilePath& target_path, bool uniquify_path, - FilePath* return_path, + base::FilePath* return_path, bool* return_verified) { // Weak pointer factory to prevent the callback from running after this // function has returned. @@ -151,8 +156,8 @@ void DownloadPathReservationTrackerTest::CallGetReservedPath( } void DownloadPathReservationTrackerTest::TestReservedPathCallback( - FilePath* return_path, bool* return_verified, bool* did_run_callback, - const FilePath& path, bool verified) { + base::FilePath* return_path, bool* return_verified, bool* did_run_callback, + const base::FilePath& path, bool verified) { *did_run_callback = true; *return_path = path; *return_verified = verified; @@ -163,10 +168,11 @@ void DownloadPathReservationTrackerTest::TestReservedPathCallback( // A basic reservation is acquired and committed. TEST_F(DownloadPathReservationTrackerTest, BasicReservation) { scoped_ptr<FakeDownloadItem> item(CreateDownloadItem(1)); - FilePath path(GetPathInDownloadsDirectory(FILE_PATH_LITERAL("foo.txt"))); + base::FilePath path( + GetPathInDownloadsDirectory(FILE_PATH_LITERAL("foo.txt"))); ASSERT_FALSE(IsPathInUse(path)); - FilePath reserved_path; + base::FilePath reserved_path; bool verified = false; CallGetReservedPath(*item, path, false, &reserved_path, &verified); EXPECT_TRUE(IsPathInUse(path)); @@ -182,10 +188,11 @@ TEST_F(DownloadPathReservationTrackerTest, BasicReservation) { // A download that is interrupted should lose its reservation. TEST_F(DownloadPathReservationTrackerTest, InterruptedDownload) { scoped_ptr<FakeDownloadItem> item(CreateDownloadItem(1)); - FilePath path(GetPathInDownloadsDirectory(FILE_PATH_LITERAL("foo.txt"))); + base::FilePath path( + GetPathInDownloadsDirectory(FILE_PATH_LITERAL("foo.txt"))); ASSERT_FALSE(IsPathInUse(path)); - FilePath reserved_path; + base::FilePath reserved_path; bool verified = false; CallGetReservedPath(*item, path, false, &reserved_path, &verified); EXPECT_TRUE(IsPathInUse(path)); @@ -201,10 +208,11 @@ TEST_F(DownloadPathReservationTrackerTest, InterruptedDownload) { // A completed download should also lose its reservation. TEST_F(DownloadPathReservationTrackerTest, CompleteDownload) { scoped_ptr<FakeDownloadItem> item(CreateDownloadItem(1)); - FilePath path(GetPathInDownloadsDirectory(FILE_PATH_LITERAL("foo.txt"))); + base::FilePath path( + GetPathInDownloadsDirectory(FILE_PATH_LITERAL("foo.txt"))); ASSERT_FALSE(IsPathInUse(path)); - FilePath reserved_path; + base::FilePath reserved_path; bool verified = false; CallGetReservedPath(*item, path, false, &reserved_path, &verified); EXPECT_TRUE(IsPathInUse(path)); @@ -224,15 +232,17 @@ TEST_F(DownloadPathReservationTrackerTest, CompleteDownload) { // around it. TEST_F(DownloadPathReservationTrackerTest, ConflictingFiles) { scoped_ptr<FakeDownloadItem> item(CreateDownloadItem(1)); - FilePath path(GetPathInDownloadsDirectory(FILE_PATH_LITERAL("foo.txt"))); - FilePath path1(GetPathInDownloadsDirectory(FILE_PATH_LITERAL("foo (1).txt"))); + base::FilePath path( + GetPathInDownloadsDirectory(FILE_PATH_LITERAL("foo.txt"))); + base::FilePath path1( + GetPathInDownloadsDirectory(FILE_PATH_LITERAL("foo (1).txt"))); // Create a file at |path|, and a .crdownload file at |path1|. ASSERT_EQ(0, file_util::WriteFile(path, "", 0)); ASSERT_EQ(0, file_util::WriteFile(download_util::GetCrDownloadPath(path1), "", 0)); ASSERT_TRUE(IsPathInUse(path)); - FilePath reserved_path; + base::FilePath reserved_path; bool verified = false; CallGetReservedPath(*item, path, true, &reserved_path, &verified); EXPECT_TRUE(IsPathInUse(path)); @@ -253,13 +263,14 @@ TEST_F(DownloadPathReservationTrackerTest, ConflictingFiles) { // Multiple reservations for the same path should uniquify around each other. TEST_F(DownloadPathReservationTrackerTest, ConflictingReservations) { scoped_ptr<FakeDownloadItem> item1(CreateDownloadItem(1)); - FilePath path(GetPathInDownloadsDirectory(FILE_PATH_LITERAL("foo.txt"))); - FilePath uniquified_path( + base::FilePath path( + GetPathInDownloadsDirectory(FILE_PATH_LITERAL("foo.txt"))); + base::FilePath uniquified_path( GetPathInDownloadsDirectory(FILE_PATH_LITERAL("foo (1).txt"))); ASSERT_FALSE(IsPathInUse(path)); ASSERT_FALSE(IsPathInUse(uniquified_path)); - FilePath reserved_path1; + base::FilePath reserved_path1; bool verified = false; CallGetReservedPath(*item1, path, true, &reserved_path1, &verified); @@ -270,7 +281,7 @@ TEST_F(DownloadPathReservationTrackerTest, ConflictingReservations) { // Requesting a reservation for the same path with uniquification results in // a uniquified path. scoped_ptr<FakeDownloadItem> item2(CreateDownloadItem(2)); - FilePath reserved_path2; + base::FilePath reserved_path2; CallGetReservedPath(*item2, path, true, &reserved_path2, &verified); EXPECT_TRUE(IsPathInUse(path)); EXPECT_TRUE(IsPathInUse(uniquified_path)); @@ -284,7 +295,7 @@ TEST_F(DownloadPathReservationTrackerTest, ConflictingReservations) { // Since the previous download item was removed, requesting a reservation // for the same path should result in the same uniquified path. scoped_ptr<FakeDownloadItem> item2(CreateDownloadItem(2)); - FilePath reserved_path2; + base::FilePath reserved_path2; CallGetReservedPath(*item2, path, true, &reserved_path2, &verified); EXPECT_TRUE(IsPathInUse(path)); EXPECT_TRUE(IsPathInUse(uniquified_path)); @@ -295,7 +306,7 @@ TEST_F(DownloadPathReservationTrackerTest, ConflictingReservations) { // Now acquire an overwriting reservation. We should end up with the same // non-uniquified path for both reservations. scoped_ptr<FakeDownloadItem> item3(CreateDownloadItem(2)); - FilePath reserved_path3; + base::FilePath reserved_path3; CallGetReservedPath(*item3, path, false, &reserved_path3, &verified); EXPECT_TRUE(IsPathInUse(path)); EXPECT_FALSE(IsPathInUse(uniquified_path)); @@ -308,14 +319,15 @@ TEST_F(DownloadPathReservationTrackerTest, ConflictingReservations) { // uniquifiers, then the callback should notified that verification failed, and // the returned path should be set to the original requested path. TEST_F(DownloadPathReservationTrackerTest, UnresolvedConflicts) { - FilePath path(GetPathInDownloadsDirectory(FILE_PATH_LITERAL("foo.txt"))); + base::FilePath path( + GetPathInDownloadsDirectory(FILE_PATH_LITERAL("foo.txt"))); scoped_ptr<FakeDownloadItem> items[ DownloadPathReservationTracker::kMaxUniqueFiles + 1]; // Create |kMaxUniqueFiles + 1| reservations for |path|. The first reservation // will have no uniquifier. The |kMaxUniqueFiles| remaining reservations do. for (int i = 0; i <= DownloadPathReservationTracker::kMaxUniqueFiles; i++) { - FilePath reserved_path; - FilePath expected_path; + base::FilePath reserved_path; + base::FilePath expected_path; bool verified = false; if (i > 0) expected_path = path.InsertBeforeExtensionASCII(StringPrintf(" (%d)", i)); @@ -331,7 +343,7 @@ TEST_F(DownloadPathReservationTrackerTest, UnresolvedConflicts) { // The next reservation for |path| will fail to be unique. scoped_ptr<FakeDownloadItem> item( CreateDownloadItem(DownloadPathReservationTracker::kMaxUniqueFiles + 1)); - FilePath reserved_path; + base::FilePath reserved_path; bool verified = true; CallGetReservedPath(*item, path, true, &reserved_path, &verified); EXPECT_FALSE(verified); @@ -342,15 +354,16 @@ TEST_F(DownloadPathReservationTrackerTest, UnresolvedConflicts) { // verification failed. TEST_F(DownloadPathReservationTrackerTest, UnwriteableDirectory) { scoped_ptr<FakeDownloadItem> item(CreateDownloadItem(1)); - FilePath path(GetPathInDownloadsDirectory(FILE_PATH_LITERAL("foo.txt"))); - FilePath dir(path.DirName()); + base::FilePath path( + GetPathInDownloadsDirectory(FILE_PATH_LITERAL("foo.txt"))); + base::FilePath dir(path.DirName()); ASSERT_FALSE(IsPathInUse(path)); { // Scope for PermissionRestorer file_util::PermissionRestorer restorer(dir); EXPECT_TRUE(file_util::MakeFileUnwritable(dir)); - FilePath reserved_path; + base::FilePath reserved_path; bool verified = true; CallGetReservedPath(*item, path, false, &reserved_path, &verified); // Verification fails. @@ -362,13 +375,14 @@ TEST_F(DownloadPathReservationTrackerTest, UnwriteableDirectory) { // If the default download directory doesn't exist, then it should be // created. But only if we are actually going to create the download path there. TEST_F(DownloadPathReservationTrackerTest, CreateDefaultDownloadPath) { - FilePath path(GetPathInDownloadsDirectory(FILE_PATH_LITERAL("foo/foo.txt"))); - FilePath dir(path.DirName()); + base::FilePath path( + GetPathInDownloadsDirectory(FILE_PATH_LITERAL("foo/foo.txt"))); + base::FilePath dir(path.DirName()); ASSERT_FALSE(file_util::DirectoryExists(dir)); { scoped_ptr<FakeDownloadItem> item(CreateDownloadItem(1)); - FilePath reserved_path; + base::FilePath reserved_path; bool verified = true; CallGetReservedPath(*item, path, false, &reserved_path, &verified); // Verification fails because the directory doesn't exist. @@ -377,7 +391,7 @@ TEST_F(DownloadPathReservationTrackerTest, CreateDefaultDownloadPath) { ASSERT_FALSE(IsPathInUse(path)); { scoped_ptr<FakeDownloadItem> item(CreateDownloadItem(1)); - FilePath reserved_path; + base::FilePath reserved_path; bool verified = true; set_default_download_path(dir); CallGetReservedPath(*item, path, false, &reserved_path, &verified); @@ -391,10 +405,11 @@ TEST_F(DownloadPathReservationTrackerTest, CreateDefaultDownloadPath) { // updated to match. TEST_F(DownloadPathReservationTrackerTest, UpdatesToTargetPath) { scoped_ptr<FakeDownloadItem> item(CreateDownloadItem(1)); - FilePath path(GetPathInDownloadsDirectory(FILE_PATH_LITERAL("foo.txt"))); + base::FilePath path( + GetPathInDownloadsDirectory(FILE_PATH_LITERAL("foo.txt"))); ASSERT_FALSE(IsPathInUse(path)); - FilePath reserved_path; + base::FilePath reserved_path; bool verified = false; CallGetReservedPath(*item, path, false, &reserved_path, &verified); EXPECT_TRUE(IsPathInUse(path)); @@ -403,13 +418,13 @@ TEST_F(DownloadPathReservationTrackerTest, UpdatesToTargetPath) { // The target path is initially empty. If an OnDownloadUpdated() is issued in // this state, we shouldn't lose the reservation. - ASSERT_EQ(FilePath::StringType(), item->GetTargetFilePath().value()); + ASSERT_EQ(base::FilePath::StringType(), item->GetTargetFilePath().value()); item->UpdateObservers(); message_loop_.RunUntilIdle(); EXPECT_TRUE(IsPathInUse(path)); // If the target path changes, we should update the reservation to match. - FilePath new_target_path( + base::FilePath new_target_path( GetPathInDownloadsDirectory(FILE_PATH_LITERAL("bar.txt"))); ASSERT_FALSE(IsPathInUse(new_target_path)); EXPECT_CALL(*item, GetTargetFilePath()) diff --git a/chrome/browser/download/download_prefs.cc b/chrome/browser/download/download_prefs.cc index 39f3327..bd7c8ba 100644 --- a/chrome/browser/download/download_prefs.cc +++ b/chrome/browser/download/download_prefs.cc @@ -52,9 +52,9 @@ DownloadPrefs::DownloadPrefs(Profile* profile) : profile_(profile) { for (size_t i = 0; i < extensions.size(); ++i) { #if defined(OS_POSIX) - FilePath path(extensions[i]); + base::FilePath path(extensions[i]); #elif defined(OS_WIN) - FilePath path(UTF8ToWide(extensions[i])); + base::FilePath path(UTF8ToWide(extensions[i])); #endif if (!extensions[i].empty() && download_util::GetFileDangerLevel(path) == download_util::NotDangerous) @@ -82,7 +82,7 @@ void DownloadPrefs::RegisterUserPrefs(PrefServiceSyncable* prefs) { PrefServiceSyncable::UNSYNCABLE_PREF); // The default download path is userprofile\download. - const FilePath& default_download_path = + const base::FilePath& default_download_path = download_util::GetDefaultDownloadDirectory(); prefs->RegisterFilePathPref(prefs::kDownloadDefaultDirectory, default_download_path, @@ -100,7 +100,7 @@ void DownloadPrefs::RegisterUserPrefs(PrefServiceSyncable* prefs) { // so we set a flag to make sure we only do it once, to avoid fighting // the user if he really wants it on an unsafe place such as the desktop. if (!prefs->GetBoolean(prefs::kDownloadDirUpgraded)) { - FilePath current_download_dir = prefs->GetFilePath( + base::FilePath current_download_dir = prefs->GetFilePath( prefs::kDownloadDefaultDirectory); if (download_util::DownloadPathIsDangerous(current_download_dir)) { prefs->SetFilePath(prefs::kDownloadDefaultDirectory, @@ -125,7 +125,7 @@ DownloadPrefs* DownloadPrefs::FromBrowserContext( return FromDownloadManager(BrowserContext::GetDownloadManager(context)); } -FilePath DownloadPrefs::DownloadPath() const { +base::FilePath DownloadPrefs::DownloadPath() const { #if defined(OS_CHROMEOS) // If the download path is under /drive, and DriveSystemService isn't // available (which it isn't for incognito mode, for instance), use the @@ -153,15 +153,16 @@ bool DownloadPrefs::IsAutoOpenUsed() const { } bool DownloadPrefs::IsAutoOpenEnabledForExtension( - const FilePath::StringType& extension) const { + const base::FilePath::StringType& extension) const { return auto_open_.find(extension) != auto_open_.end(); } -bool DownloadPrefs::EnableAutoOpenBasedOnExtension(const FilePath& file_name) { - FilePath::StringType extension = file_name.Extension(); +bool DownloadPrefs::EnableAutoOpenBasedOnExtension( + const base::FilePath& file_name) { + base::FilePath::StringType extension = file_name.Extension(); if (extension.empty()) return false; - DCHECK(extension[0] == FilePath::kExtensionSeparator); + DCHECK(extension[0] == base::FilePath::kExtensionSeparator); extension.erase(0, 1); auto_open_.insert(extension); @@ -169,11 +170,12 @@ bool DownloadPrefs::EnableAutoOpenBasedOnExtension(const FilePath& file_name) { return true; } -void DownloadPrefs::DisableAutoOpenBasedOnExtension(const FilePath& file_name) { - FilePath::StringType extension = file_name.Extension(); +void DownloadPrefs::DisableAutoOpenBasedOnExtension( + const base::FilePath& file_name) { + base::FilePath::StringType extension = file_name.Extension(); if (extension.empty()) return; - DCHECK(extension[0] == FilePath::kExtensionSeparator); + DCHECK(extension[0] == base::FilePath::kExtensionSeparator); extension.erase(0, 1); auto_open_.erase(extension); SaveAutoOpenState(); @@ -203,7 +205,7 @@ void DownloadPrefs::SaveAutoOpenState() { } bool DownloadPrefs::AutoOpenCompareFunctor::operator()( - const FilePath::StringType& a, - const FilePath::StringType& b) const { - return FilePath::CompareLessIgnoreCase(a, b); + const base::FilePath::StringType& a, + const base::FilePath::StringType& b) const { + return base::FilePath::CompareLessIgnoreCase(a, b); } diff --git a/chrome/browser/download/download_prefs.h b/chrome/browser/download/download_prefs.h index e8dfefb..516bcfd 100644 --- a/chrome/browser/download/download_prefs.h +++ b/chrome/browser/download/download_prefs.h @@ -33,7 +33,7 @@ class DownloadPrefs { static DownloadPrefs* FromBrowserContext( content::BrowserContext* browser_context); - FilePath DownloadPath() const; + base::FilePath DownloadPath() const; int save_file_type() const { return *save_file_type_; } // Returns true if the prompt_for_download preference has been set and the @@ -49,14 +49,14 @@ class DownloadPrefs { bool IsAutoOpenUsed() const; bool IsAutoOpenEnabledForExtension( - const FilePath::StringType& extension) const; + const base::FilePath::StringType& extension) const; // Enables auto-open based on file extension. Returns true on success. // TODO(phajdan.jr): Add WARN_UNUSED_RESULT here. - bool EnableAutoOpenBasedOnExtension(const FilePath& file_name); + bool EnableAutoOpenBasedOnExtension(const base::FilePath& file_name); // Disables auto-open based on file extension. - void DisableAutoOpenBasedOnExtension(const FilePath& file_name); + void DisableAutoOpenBasedOnExtension(const base::FilePath& file_name); void ResetAutoOpen(); @@ -71,10 +71,11 @@ class DownloadPrefs { // Set of file extensions to open at download completion. struct AutoOpenCompareFunctor { - bool operator()(const FilePath::StringType& a, - const FilePath::StringType& b) const; + bool operator()(const base::FilePath::StringType& a, + const base::FilePath::StringType& b) const; }; - typedef std::set<FilePath::StringType, AutoOpenCompareFunctor> AutoOpenSet; + typedef std::set<base::FilePath::StringType, + AutoOpenCompareFunctor> AutoOpenSet; AutoOpenSet auto_open_; DISALLOW_COPY_AND_ASSIGN(DownloadPrefs); diff --git a/chrome/browser/download/download_query_unittest.cc b/chrome/browser/download/download_query_unittest.cc index c5a5c01..e45b5a9 100644 --- a/chrome/browser/download/download_query_unittest.cc +++ b/chrome/browser/download/download_query_unittest.cc @@ -168,10 +168,10 @@ TEST_F(DownloadQueryTest, DownloadQueryTest_FilterGenericQueryFilename) { static_cast<content::BrowserContext*>(NULL))); EXPECT_CALL(mock(1), GetBrowserContext()).WillRepeatedly(Return( static_cast<content::BrowserContext*>(NULL))); - FilePath match_filename(FILE_PATH_LITERAL("query")); + base::FilePath match_filename(FILE_PATH_LITERAL("query")); EXPECT_CALL(mock(0), GetTargetFilePath()).WillRepeatedly(ReturnRef( match_filename)); - FilePath fail_filename(FILE_PATH_LITERAL("fail")); + base::FilePath fail_filename(FILE_PATH_LITERAL("fail")); EXPECT_CALL(mock(1), GetTargetFilePath()).WillRepeatedly(ReturnRef( fail_filename)); GURL fail_url("http://example.com/fail"); @@ -187,7 +187,7 @@ TEST_F(DownloadQueryTest, DownloadQueryTest_FilterGenericQueryUrl) { static_cast<content::BrowserContext*>(NULL))); EXPECT_CALL(mock(1), GetBrowserContext()).WillRepeatedly(Return( static_cast<content::BrowserContext*>(NULL))); - FilePath fail_filename(FILE_PATH_LITERAL("fail")); + base::FilePath fail_filename(FILE_PATH_LITERAL("fail")); EXPECT_CALL(mock(0), GetTargetFilePath()).WillRepeatedly(ReturnRef( fail_filename)); EXPECT_CALL(mock(1), GetTargetFilePath()).WillRepeatedly(ReturnRef( @@ -206,17 +206,17 @@ TEST_F(DownloadQueryTest, DownloadQueryTest_FilterGenericQueryFilenameI18N) { static_cast<content::BrowserContext*>(NULL))); EXPECT_CALL(mock(1), GetBrowserContext()).WillRepeatedly(Return( static_cast<content::BrowserContext*>(NULL))); - const FilePath::StringType kTestString( + const base::FilePath::StringType kTestString( #if defined(OS_POSIX) "/\xe4\xbd\xa0\xe5\xa5\xbd\xe4\xbd\xa0\xe5\xa5\xbd" #elif defined(OS_WIN) L"/\x4f60\x597d\x4f60\x597d" #endif ); - FilePath match_filename(kTestString); + base::FilePath match_filename(kTestString); EXPECT_CALL(mock(0), GetTargetFilePath()).WillRepeatedly(ReturnRef( match_filename)); - FilePath fail_filename(FILE_PATH_LITERAL("fail")); + base::FilePath fail_filename(FILE_PATH_LITERAL("fail")); EXPECT_CALL(mock(1), GetTargetFilePath()).WillRepeatedly(ReturnRef( fail_filename)); GURL fail_url("http://example.com/fail"); @@ -228,10 +228,10 @@ TEST_F(DownloadQueryTest, DownloadQueryTest_FilterGenericQueryFilenameI18N) { TEST_F(DownloadQueryTest, DownloadQueryTest_FilterFilenameRegex) { CreateMocks(2); - FilePath match_filename(FILE_PATH_LITERAL("query")); + base::FilePath match_filename(FILE_PATH_LITERAL("query")); EXPECT_CALL(mock(0), GetTargetFilePath()).WillRepeatedly(ReturnRef( match_filename)); - FilePath fail_filename(FILE_PATH_LITERAL("fail")); + base::FilePath fail_filename(FILE_PATH_LITERAL("fail")); EXPECT_CALL(mock(1), GetTargetFilePath()).WillRepeatedly(ReturnRef( fail_filename)); AddFilter(DownloadQuery::FILTER_FILENAME_REGEX, "y"); @@ -240,10 +240,10 @@ TEST_F(DownloadQueryTest, DownloadQueryTest_FilterFilenameRegex) { TEST_F(DownloadQueryTest, DownloadQueryTest_SortFilename) { CreateMocks(2); - FilePath b_filename(FILE_PATH_LITERAL("b")); + base::FilePath b_filename(FILE_PATH_LITERAL("b")); EXPECT_CALL(mock(0), GetTargetFilePath()).WillRepeatedly(ReturnRef( b_filename)); - FilePath a_filename(FILE_PATH_LITERAL("a")); + base::FilePath a_filename(FILE_PATH_LITERAL("a")); EXPECT_CALL(mock(1), GetTargetFilePath()).WillRepeatedly(ReturnRef( a_filename)); query()->AddSorter(DownloadQuery::SORT_FILENAME, DownloadQuery::ASCENDING); @@ -252,10 +252,10 @@ TEST_F(DownloadQueryTest, DownloadQueryTest_SortFilename) { TEST_F(DownloadQueryTest, DownloadQueryTest_FilterFilename) { CreateMocks(2); - FilePath match_filename(FILE_PATH_LITERAL("query")); + base::FilePath match_filename(FILE_PATH_LITERAL("query")); EXPECT_CALL(mock(0), GetTargetFilePath()).WillRepeatedly(ReturnRef( match_filename)); - FilePath fail_filename(FILE_PATH_LITERAL("fail")); + base::FilePath fail_filename(FILE_PATH_LITERAL("fail")); EXPECT_CALL(mock(1), GetTargetFilePath()).WillRepeatedly(ReturnRef( fail_filename)); AddFilter(DownloadQuery::FILTER_FILENAME, match_filename.value().c_str()); diff --git a/chrome/browser/download/download_shelf_context_menu.cc b/chrome/browser/download/download_shelf_context_menu.cc index d940db6..33e9233 100644 --- a/chrome/browser/download/download_shelf_context_menu.cc +++ b/chrome/browser/download/download_shelf_context_menu.cc @@ -115,7 +115,7 @@ void DownloadShelfContextMenu::ExecuteCommand(int command_id) { case ALWAYS_OPEN_TYPE: { DownloadPrefs* prefs = DownloadPrefs::FromBrowserContext( download_item_->GetBrowserContext()); - FilePath path = download_item_->GetUserVerifiedFilePath(); + base::FilePath path = download_item_->GetUserVerifiedFilePath(); if (!IsCommandIdChecked(ALWAYS_OPEN_TYPE)) prefs->EnableAutoOpenBasedOnExtension(path); else diff --git a/chrome/browser/download/download_status_updater_mac.mm b/chrome/browser/download/download_status_updater_mac.mm index 61d07fb..08d937d 100644 --- a/chrome/browser/download/download_status_updater_mac.mm +++ b/chrome/browser/download/download_status_updater_mac.mm @@ -156,7 +156,7 @@ const char kCrNSProgressUserDataKey[] = "CrNSProgressUserData"; class CrNSProgressUserData : public base::SupportsUserData::Data { public: - CrNSProgressUserData(NSProgress* progress, const FilePath& target) + CrNSProgressUserData(NSProgress* progress, const base::FilePath& target) : target_(target) { progress_.reset(progress); } @@ -165,12 +165,12 @@ class CrNSProgressUserData : public base::SupportsUserData::Data { } NSProgress* progress() const { return progress_.get(); } - FilePath target() const { return target_; } - void setTarget(const FilePath& target) { target_ = target; } + base::FilePath target() const { return target_; } + void setTarget(const base::FilePath& target) { target_ = target; } private: scoped_nsobject<NSProgress> progress_; - FilePath target_; + base::FilePath target_; }; void UpdateAppIcon(int download_count, @@ -186,7 +186,7 @@ void UpdateAppIcon(int download_count, void CreateNSProgress(content::DownloadItem* download) { NSURL* source_url = [NSURL URLWithString: base::SysUTF8ToNSString(download->GetURL().possibly_invalid_spec())]; - FilePath destination_path = download->GetFullPath(); + base::FilePath destination_path = download->GetFullPath(); NSURL* destination_url = [NSURL fileURLWithPath: base::mac::FilePathToNSString(destination_path)]; @@ -237,7 +237,7 @@ void UpdateNSProgress(content::DownloadItem* download, progress.totalUnitCount = download->GetTotalBytes(); progress.completedUnitCount = download->GetReceivedBytes(); - FilePath download_path = download->GetFullPath(); + base::FilePath download_path = download->GetFullPath(); if (progress_data->target() != download_path) { progress_data->setTarget(download_path); NSURL* download_url = [NSURL fileURLWithPath: diff --git a/chrome/browser/download/download_status_updater_win.cc b/chrome/browser/download/download_status_updater_win.cc index 921a132..adf9458 100644 --- a/chrome/browser/download/download_status_updater_win.cc +++ b/chrome/browser/download/download_status_updater_win.cc @@ -78,9 +78,9 @@ void MetroDownloadNotificationClickedHandler(const wchar_t* download_path) { // Ensure that we invoke the function to display the downloaded item on the // UI thread. - content::BrowserThread::PostTask( - content::BrowserThread::UI, FROM_HERE, - base::Bind(platform_util::ShowItemInFolder, FilePath(download_path))); + content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE, + base::Bind(platform_util::ShowItemInFolder, + base::FilePath(download_path))); } } // namespace diff --git a/chrome/browser/download/download_test_file_activity_observer.cc b/chrome/browser/download/download_test_file_activity_observer.cc index 3959ee7..2137409 100644 --- a/chrome/browser/download/download_test_file_activity_observer.cc +++ b/chrome/browser/download/download_test_file_activity_observer.cc @@ -39,14 +39,13 @@ class DownloadTestFileActivityObserver::MockDownloadManagerDelegate protected: virtual void ChooseDownloadPath(content::DownloadItem* item, - const FilePath& suggested_path, + const base::FilePath& suggested_path, const FileSelectedCallback& callback) OVERRIDE { file_chooser_displayed_ = true; MessageLoop::current()->PostTask( - FROM_HERE, - base::Bind(callback, - (file_chooser_enabled_ ? suggested_path : FilePath()))); + FROM_HERE, base::Bind(callback, (file_chooser_enabled_ ? suggested_path + : base::FilePath()))); } virtual void OpenDownload(content::DownloadItem* item) OVERRIDE {} diff --git a/chrome/browser/download/download_util.cc b/chrome/browser/download/download_util.cc index 5dfbc92..8b52e3f 100644 --- a/chrome/browser/download/download_util.cc +++ b/chrome/browser/download/download_util.cc @@ -97,7 +97,7 @@ using content::DownloadItem; class DefaultDownloadDirectory { public: - const FilePath& path() const { return path_; } + const base::FilePath& path() const { return path_; } private: DefaultDownloadDirectory() { if (!PathService::Get(chrome::DIR_DEFAULT_DOWNLOADS, &path_)) { @@ -112,21 +112,21 @@ class DefaultDownloadDirectory { } } friend struct base::DefaultLazyInstanceTraits<DefaultDownloadDirectory>; - FilePath path_; + base::FilePath path_; }; static base::LazyInstance<DefaultDownloadDirectory> g_default_download_directory = LAZY_INSTANCE_INITIALIZER; -const FilePath& GetDefaultDownloadDirectory() { +const base::FilePath& GetDefaultDownloadDirectory() { return g_default_download_directory.Get().path(); } // Consider downloads 'dangerous' if they go to the home directory on Linux and // to the desktop on any platform. -bool DownloadPathIsDangerous(const FilePath& download_path) { +bool DownloadPathIsDangerous(const base::FilePath& download_path) { #if defined(OS_LINUX) - FilePath home_dir = file_util::GetHomeDir(); + base::FilePath home_dir = file_util::GetHomeDir(); if (download_path == home_dir) { return true; } @@ -136,7 +136,7 @@ bool DownloadPathIsDangerous(const FilePath& download_path) { // Android does not have a desktop dir. return false; #else - FilePath desktop_dir; + base::FilePath desktop_dir; if (!PathService::Get(base::DIR_USER_DESKTOP, &desktop_dir)) { NOTREACHED(); return false; @@ -358,7 +358,7 @@ void DragDownload(const DownloadItem* download, download->GetFileNameToReportUser(), icon->ToImageSkia(), &data); } - const FilePath full_path = download->GetTargetFilePath(); + const base::FilePath full_path = download->GetTargetFilePath(); data.SetFilename(full_path); std::string mime_type = download->GetMimeType(); @@ -459,8 +459,9 @@ string16 GetProgressStatusText(DownloadItem* download) { speed_text, amount, time_remaining); } -FilePath GetCrDownloadPath(const FilePath& suggested_path) { - return FilePath(suggested_path.value() + FILE_PATH_LITERAL(".crdownload")); +base::FilePath GetCrDownloadPath(const base::FilePath& suggested_path) { + return base::FilePath(suggested_path.value() + + FILE_PATH_LITERAL(".crdownload")); } bool IsSavableURL(const GURL& url) { diff --git a/chrome/browser/download/download_util.h b/chrome/browser/download/download_util.h index c25aaca..e3b3cdc 100644 --- a/chrome/browser/download/download_util.h +++ b/chrome/browser/download/download_util.h @@ -41,10 +41,10 @@ namespace download_util { // Download temporary file creation -------------------------------------------- // Return the default download directory. -const FilePath& GetDefaultDownloadDirectory(); +const base::FilePath& GetDefaultDownloadDirectory(); // Return true if the |download_path| is dangerous path. -bool DownloadPathIsDangerous(const FilePath& download_path); +bool DownloadPathIsDangerous(const base::FilePath& download_path); // Download progress animations ------------------------------------------------ @@ -144,7 +144,7 @@ void DragDownload(const content::DownloadItem* download, string16 GetProgressStatusText(content::DownloadItem* download); // Returns a .crdownload intermediate path for the |suggested_path|. -FilePath GetCrDownloadPath(const FilePath& suggested_path); +base::FilePath GetCrDownloadPath(const base::FilePath& suggested_path); // Check whether we can do the saving page operation for the specified URL. bool IsSavableURL(const GURL& url); diff --git a/chrome/browser/download/save_package_file_picker.cc b/chrome/browser/download/save_package_file_picker.cc index a3b2640..4bea024 100644 --- a/chrome/browser/download/save_package_file_picker.cc +++ b/chrome/browser/download/save_package_file_picker.cc @@ -74,16 +74,16 @@ bool SavePackageFilePicker::ShouldSaveAsMHTML() const { SavePackageFilePicker::SavePackageFilePicker( content::WebContents* web_contents, - const FilePath& suggested_path_const, - const FilePath::StringType& default_extension_const, + const base::FilePath& suggested_path_const, + const base::FilePath::StringType& default_extension_const, bool can_save_as_complete, DownloadPrefs* download_prefs, const content::SavePackagePathPickedCallback& callback) : render_process_id_(web_contents->GetRenderProcessHost()->GetID()), can_save_as_complete_(can_save_as_complete), callback_(callback) { - FilePath suggested_path = suggested_path_const; - FilePath::StringType default_extension = default_extension_const; + base::FilePath suggested_path = suggested_path_const; + base::FilePath::StringType default_extension = default_extension_const; int file_type_index = SavePackageTypeToIndex( static_cast<SavePageType>(download_prefs->save_file_type())); DCHECK_NE(-1, file_type_index); @@ -98,7 +98,7 @@ SavePackageFilePicker::SavePackageFilePicker( suggested_path = suggested_path.ReplaceExtension(default_extension); } else if (can_save_as_complete) { bool add_extra_extension = false; - FilePath::StringType extra_extension; + base::FilePath::StringType extra_extension; if (!suggested_path.Extension().empty() && suggested_path.Extension().compare(FILE_PATH_LITERAL("htm")) && suggested_path.Extension().compare(FILE_PATH_LITERAL("html"))) { @@ -182,7 +182,7 @@ void SavePackageFilePicker::SetShouldPromptUser(bool should_prompt) { g_should_prompt_for_filename = should_prompt; } -void SavePackageFilePicker::FileSelected(const FilePath& path, +void SavePackageFilePicker::FileSelected(const base::FilePath& path, int index, void* unused_params) { RenderProcessHost* process = RenderProcessHost::FromID(render_process_id_); diff --git a/chrome/browser/download/save_package_file_picker.h b/chrome/browser/download/save_package_file_picker.h index 5893bfb..f697ef0 100644 --- a/chrome/browser/download/save_package_file_picker.h +++ b/chrome/browser/download/save_package_file_picker.h @@ -15,8 +15,8 @@ class DownloadPrefs; class SavePackageFilePicker : public ui::SelectFileDialog::Listener { public: SavePackageFilePicker(content::WebContents* web_contents, - const FilePath& suggested_path, - const FilePath::StringType& default_extension, + const base::FilePath& suggested_path, + const base::FilePath::StringType& default_extension, bool can_save_as_complete, DownloadPrefs* download_prefs, const content::SavePackagePathPickedCallback& callback); @@ -28,7 +28,7 @@ class SavePackageFilePicker : public ui::SelectFileDialog::Listener { private: // SelectFileDialog::Listener implementation. - virtual void FileSelected(const FilePath& path, + virtual void FileSelected(const base::FilePath& path, int index, void* unused_params) OVERRIDE; virtual void FileSelectionCanceled(void* unused_params) OVERRIDE; diff --git a/chrome/browser/download/save_package_file_picker_chromeos.cc b/chrome/browser/download/save_package_file_picker_chromeos.cc index 57f32de..20f681d 100644 --- a/chrome/browser/download/save_package_file_picker_chromeos.cc +++ b/chrome/browser/download/save_package_file_picker_chromeos.cc @@ -27,8 +27,8 @@ bool g_should_prompt_for_filename = true; void ContinueSettingUpDriveDownload( const content::SavePackagePathPickedCallback& callback, Profile* profile, - const FilePath& drive_path, - const FilePath& drive_tmp_download_path) { + const base::FilePath& drive_path, + const base::FilePath& drive_tmp_download_path) { if (drive_tmp_download_path.empty()) // Substitution failed. return; @@ -44,7 +44,7 @@ void ContinueSettingUpDriveDownload( SavePackageFilePickerChromeOS::SavePackageFilePickerChromeOS( content::WebContents* web_contents, - const FilePath& suggested_path, + const base::FilePath& suggested_path, const content::SavePackagePathPickedCallback& callback) : content::WebContentsObserver(web_contents), callback_(callback) { @@ -75,7 +75,7 @@ SavePackageFilePickerChromeOS::~SavePackageFilePickerChromeOS() { } void SavePackageFilePickerChromeOS::FileSelected( - const FilePath& selected_path, + const base::FilePath& selected_path, int unused_index, void* unused_params) { FileSelectedWithExtraInfo( @@ -92,7 +92,7 @@ void SavePackageFilePickerChromeOS::FileSelectedWithExtraInfo( delete this; return; } - FilePath selected_path = selected_file_info.file_path; + base::FilePath selected_path = selected_file_info.file_path; file_util::NormalizeFileNameEncoding(&selected_path); Profile* profile = Profile::FromBrowserContext( web_contents()->GetBrowserContext()); diff --git a/chrome/browser/download/save_package_file_picker_chromeos.h b/chrome/browser/download/save_package_file_picker_chromeos.h index edfc0aa..9458b46 100644 --- a/chrome/browser/download/save_package_file_picker_chromeos.h +++ b/chrome/browser/download/save_package_file_picker_chromeos.h @@ -21,7 +21,7 @@ class SavePackageFilePickerChromeOS : public ui::SelectFileDialog::Listener, public: SavePackageFilePickerChromeOS( content::WebContents* web_contents, - const FilePath& suggested_path, + const base::FilePath& suggested_path, const content::SavePackagePathPickedCallback& callback); // Used to disable prompting the user for a directory/filename of the saved @@ -32,7 +32,7 @@ class SavePackageFilePickerChromeOS : public ui::SelectFileDialog::Listener, virtual ~SavePackageFilePickerChromeOS(); // SelectFileDialog::Listener implementation. - virtual void FileSelected(const FilePath& selected_path, + virtual void FileSelected(const base::FilePath& selected_path, int unused_index, void* unused_params) OVERRIDE; virtual void FileSelectedWithExtraInfo( @@ -45,7 +45,7 @@ class SavePackageFilePickerChromeOS : public ui::SelectFileDialog::Listener, // For managing select file dialogs. scoped_refptr<ui::SelectFileDialog> select_file_dialog_; - FilePath selected_path_; + base::FilePath selected_path_; DISALLOW_COPY_AND_ASSIGN(SavePackageFilePickerChromeOS); }; diff --git a/chrome/browser/download/save_page_browsertest.cc b/chrome/browser/download/save_page_browsertest.cc index 8b44cdb..f0793e6 100644 --- a/chrome/browser/download/save_page_browsertest.cc +++ b/chrome/browser/download/save_page_browsertest.cc @@ -142,7 +142,7 @@ class DownloadRemovedObserver : public DownloadPersistedObserver { bool DownloadStoredProperly( const GURL& expected_url, - const FilePath& expected_path, + const base::FilePath& expected_path, int64 num_files, DownloadItem::DownloadState expected_state, DownloadItem* item, @@ -178,7 +178,7 @@ bool DownloadStoredProperly( return true; } -const FilePath::CharType kTestDir[] = FILE_PATH_LITERAL("save_page"); +const base::FilePath::CharType kTestDir[] = FILE_PATH_LITERAL("save_page"); static const char kAppendedExtension[] = #if defined(OS_WIN) @@ -300,15 +300,15 @@ class SavePageBrowserTest : public InProcessBrowserTest { GURL NavigateToMockURL(const std::string& prefix) { GURL url = URLRequestMockHTTPJob::GetMockUrl( - FilePath(kTestDir).AppendASCII(prefix + ".htm")); + base::FilePath(kTestDir).AppendASCII(prefix + ".htm")); ui_test_utils::NavigateToURL(browser(), url); return url; } // Returns full paths of destination file and directory. void GetDestinationPaths(const std::string& prefix, - FilePath* full_file_name, - FilePath* dir) { + base::FilePath* full_file_name, + base::FilePath* dir) { *full_file_name = save_dir_.path().AppendASCII(prefix + ".htm"); *dir = save_dir_.path().AppendASCII(prefix + "_files"); } @@ -364,7 +364,7 @@ class SavePageBrowserTest : public InProcessBrowserTest { } // Path to directory containing test data. - FilePath test_dir_; + base::FilePath test_dir_; // Temporary directory we will save pages to. base::ScopedTempDir save_dir_; @@ -385,7 +385,7 @@ SavePageBrowserTest::~SavePageBrowserTest() { IN_PROC_BROWSER_TEST_F(SavePageBrowserTest, MAYBE_SaveHTMLOnly) { GURL url = NavigateToMockURL("a"); - FilePath full_file_name, dir; + base::FilePath full_file_name, dir; GetDestinationPaths("a", &full_file_name, &dir); DownloadPersistedObserver persisted(browser()->profile(), base::Bind( &DownloadStoredProperly, url, full_file_name, 1, @@ -403,9 +403,8 @@ IN_PROC_BROWSER_TEST_F(SavePageBrowserTest, MAYBE_SaveHTMLOnly) { EXPECT_TRUE(browser()->window()->IsDownloadShelfVisible()); EXPECT_TRUE(file_util::PathExists(full_file_name)); EXPECT_FALSE(file_util::PathExists(dir)); - EXPECT_TRUE(file_util::ContentsEqual( - test_dir_.Append(FilePath(kTestDir)).Append(FILE_PATH_LITERAL("a.htm")), - full_file_name)); + EXPECT_TRUE(file_util::ContentsEqual(test_dir_.Append(base::FilePath( + kTestDir)).Append(FILE_PATH_LITERAL("a.htm")), full_file_name)); } // Disabled on Windows due to flakiness. http://crbug.com/162323 @@ -421,7 +420,7 @@ IN_PROC_BROWSER_TEST_F(SavePageBrowserTest, MAYBE_SaveHTMLOnlyCancel) { manager->GetAllDownloads(&downloads); ASSERT_EQ(0u, downloads.size()); - FilePath full_file_name, dir; + base::FilePath full_file_name, dir; GetDestinationPaths("a", &full_file_name, &dir); DownloadItemCreatedObserver creation_observer(manager); DownloadPersistedObserver persisted(browser()->profile(), base::Bind( @@ -456,7 +455,7 @@ IN_PROC_BROWSER_TEST_F(SavePageBrowserTest, SaveHTMLOnlyTabDestroy) { manager->GetAllDownloads(&downloads); ASSERT_EQ(0u, downloads.size()); - FilePath full_file_name, dir; + base::FilePath full_file_name, dir; GetDestinationPaths("a", &full_file_name, &dir); DownloadItemCreatedObserver creation_observer(manager); ASSERT_TRUE(GetCurrentTab(browser())->SavePage(full_file_name, dir, @@ -480,14 +479,14 @@ IN_PROC_BROWSER_TEST_F(SavePageBrowserTest, SaveHTMLOnlyTabDestroy) { #define MAYBE_SaveViewSourceHTMLOnly SaveViewSourceHTMLOnly #endif IN_PROC_BROWSER_TEST_F(SavePageBrowserTest, MAYBE_SaveViewSourceHTMLOnly) { - FilePath file_name(FILE_PATH_LITERAL("a.htm")); + base::FilePath file_name(FILE_PATH_LITERAL("a.htm")); GURL view_source_url = URLRequestMockHTTPJob::GetMockViewSourceUrl( - FilePath(kTestDir).Append(file_name)); + base::FilePath(kTestDir).Append(file_name)); GURL actual_page_url = URLRequestMockHTTPJob::GetMockUrl( - FilePath(kTestDir).Append(file_name)); + base::FilePath(kTestDir).Append(file_name)); ui_test_utils::NavigateToURL(browser(), view_source_url); - FilePath full_file_name, dir; + base::FilePath full_file_name, dir; GetDestinationPaths("a", &full_file_name, &dir); DownloadPersistedObserver persisted(browser()->profile(), base::Bind( &DownloadStoredProperly, actual_page_url, full_file_name, 1, @@ -508,7 +507,7 @@ IN_PROC_BROWSER_TEST_F(SavePageBrowserTest, MAYBE_SaveViewSourceHTMLOnly) { EXPECT_TRUE(file_util::PathExists(full_file_name)); EXPECT_FALSE(file_util::PathExists(dir)); EXPECT_TRUE(file_util::ContentsEqual( - test_dir_.Append(FilePath(kTestDir)).Append(file_name), + test_dir_.Append(base::FilePath(kTestDir)).Append(file_name), full_file_name)); } @@ -521,7 +520,7 @@ IN_PROC_BROWSER_TEST_F(SavePageBrowserTest, MAYBE_SaveViewSourceHTMLOnly) { IN_PROC_BROWSER_TEST_F(SavePageBrowserTest, MAYBE_SaveCompleteHTML) { GURL url = NavigateToMockURL("b"); - FilePath full_file_name, dir; + base::FilePath full_file_name, dir; GetDestinationPaths("b", &full_file_name, &dir); DownloadPersistedObserver persisted(browser()->profile(), base::Bind( &DownloadStoredProperly, url, full_file_name, 3, @@ -542,13 +541,13 @@ IN_PROC_BROWSER_TEST_F(SavePageBrowserTest, MAYBE_SaveCompleteHTML) { EXPECT_TRUE(file_util::PathExists(full_file_name)); EXPECT_TRUE(file_util::PathExists(dir)); EXPECT_TRUE(file_util::TextContentsEqual( - test_dir_.Append(FilePath(kTestDir)).AppendASCII("b.saved1.htm"), + test_dir_.Append(base::FilePath(kTestDir)).AppendASCII("b.saved1.htm"), full_file_name)); EXPECT_TRUE(file_util::ContentsEqual( - test_dir_.Append(FilePath(kTestDir)).AppendASCII("1.png"), + test_dir_.Append(base::FilePath(kTestDir)).AppendASCII("1.png"), dir.AppendASCII("1.png"))); EXPECT_TRUE(file_util::ContentsEqual( - test_dir_.Append(FilePath(kTestDir)).AppendASCII("1.css"), + test_dir_.Append(base::FilePath(kTestDir)).AppendASCII("1.css"), dir.AppendASCII("1.css"))); } @@ -573,12 +572,12 @@ IN_PROC_BROWSER_TEST_F(SavePageBrowserTest, // Navigate, unblocking with new tab. GURL url = URLRequestMockHTTPJob::GetMockUrl( - FilePath(kTestDir).AppendASCII("b.htm")); + base::FilePath(kTestDir).AppendASCII("b.htm")); NavigateToURLWithDisposition(incognito, url, NEW_FOREGROUND_TAB, ui_test_utils::BROWSER_TEST_WAIT_FOR_TAB); // Save the page before completion. - FilePath full_file_name, dir; + base::FilePath full_file_name, dir; GetDestinationPaths("b", &full_file_name, &dir); scoped_refptr<content::MessageLoopRunner> loop_runner( new content::MessageLoopRunner); @@ -615,9 +614,9 @@ IN_PROC_BROWSER_TEST_F(SavePageBrowserTest, NoSave) { IN_PROC_BROWSER_TEST_F(SavePageBrowserTest, MAYBE_FileNameFromPageTitle) { GURL url = NavigateToMockURL("b"); - FilePath full_file_name = save_dir_.path().AppendASCII( + base::FilePath full_file_name = save_dir_.path().AppendASCII( std::string("Test page for saving page feature") + kAppendedExtension); - FilePath dir = save_dir_.path().AppendASCII( + base::FilePath dir = save_dir_.path().AppendASCII( "Test page for saving page feature_files"); DownloadPersistedObserver persisted(browser()->profile(), base::Bind( &DownloadStoredProperly, url, full_file_name, 3, @@ -639,13 +638,13 @@ IN_PROC_BROWSER_TEST_F(SavePageBrowserTest, MAYBE_FileNameFromPageTitle) { EXPECT_TRUE(file_util::PathExists(full_file_name)); EXPECT_TRUE(file_util::PathExists(dir)); EXPECT_TRUE(file_util::TextContentsEqual( - test_dir_.Append(FilePath(kTestDir)).AppendASCII("b.saved2.htm"), + test_dir_.Append(base::FilePath(kTestDir)).AppendASCII("b.saved2.htm"), full_file_name)); EXPECT_TRUE(file_util::ContentsEqual( - test_dir_.Append(FilePath(kTestDir)).AppendASCII("1.png"), + test_dir_.Append(base::FilePath(kTestDir)).AppendASCII("1.png"), dir.AppendASCII("1.png"))); EXPECT_TRUE(file_util::ContentsEqual( - test_dir_.Append(FilePath(kTestDir)).AppendASCII("1.css"), + test_dir_.Append(base::FilePath(kTestDir)).AppendASCII("1.css"), dir.AppendASCII("1.css"))); } @@ -658,7 +657,7 @@ IN_PROC_BROWSER_TEST_F(SavePageBrowserTest, MAYBE_FileNameFromPageTitle) { IN_PROC_BROWSER_TEST_F(SavePageBrowserTest, MAYBE_RemoveFromList) { GURL url = NavigateToMockURL("a"); - FilePath full_file_name, dir; + base::FilePath full_file_name, dir; GetDestinationPaths("a", &full_file_name, &dir); DownloadPersistedObserver persisted(browser()->profile(), base::Bind( &DownloadStoredProperly, url, full_file_name, 1, @@ -689,9 +688,8 @@ IN_PROC_BROWSER_TEST_F(SavePageBrowserTest, MAYBE_RemoveFromList) { EXPECT_TRUE(file_util::PathExists(full_file_name)); EXPECT_FALSE(file_util::PathExists(dir)); - EXPECT_TRUE(file_util::ContentsEqual( - test_dir_.Append(FilePath(kTestDir)).Append(FILE_PATH_LITERAL("a.htm")), - full_file_name)); + EXPECT_TRUE(file_util::ContentsEqual(test_dir_.Append(base::FilePath( + kTestDir)).Append(FILE_PATH_LITERAL("a.htm")), full_file_name)); } // This tests that a webpage with the title "test.exe" is saved as @@ -699,17 +697,17 @@ IN_PROC_BROWSER_TEST_F(SavePageBrowserTest, MAYBE_RemoveFromList) { // We probably don't care to handle this on Linux or Mac. #if defined(OS_WIN) IN_PROC_BROWSER_TEST_F(SavePageBrowserTest, CleanFilenameFromPageTitle) { - const FilePath file_name(FILE_PATH_LITERAL("c.htm")); - FilePath download_dir = + const base::FilePath file_name(FILE_PATH_LITERAL("c.htm")); + base::FilePath download_dir = DownloadPrefs::FromDownloadManager(GetDownloadManager())-> DownloadPath(); - FilePath full_file_name = + base::FilePath full_file_name = download_dir.AppendASCII(std::string("test.exe") + kAppendedExtension); - FilePath dir = download_dir.AppendASCII("test.exe_files"); + base::FilePath dir = download_dir.AppendASCII("test.exe_files"); EXPECT_FALSE(file_util::PathExists(full_file_name)); GURL url = URLRequestMockHTTPJob::GetMockUrl( - FilePath(kTestDir).Append(file_name)); + base::FilePath(kTestDir).Append(file_name)); ui_test_utils::NavigateToURL(browser(), url); SavePackageFilePicker::SetShouldPromptUser(false); @@ -746,9 +744,9 @@ SavePageAsMHTMLBrowserTest::~SavePageAsMHTMLBrowserTest() { IN_PROC_BROWSER_TEST_F(SavePageAsMHTMLBrowserTest, SavePageAsMHTML) { static const int64 kFileSizeMin = 2758; GURL url = NavigateToMockURL("b"); - FilePath download_dir = DownloadPrefs::FromDownloadManager( + base::FilePath download_dir = DownloadPrefs::FromDownloadManager( GetDownloadManager())->DownloadPath(); - FilePath full_file_name = download_dir.AppendASCII(std::string( + base::FilePath full_file_name = download_dir.AppendASCII(std::string( "Test page for saving page feature.mhtml")); #if defined(OS_CHROMEOS) SavePackageFilePickerChromeOS::SetShouldPromptUser(false); diff --git a/chrome/browser/enumerate_modules_model_win.cc b/chrome/browser/enumerate_modules_model_win.cc index b5234a7..396a772 100644 --- a/chrome/browser/enumerate_modules_model_win.cc +++ b/chrome/browser/enumerate_modules_model_win.cc @@ -540,7 +540,7 @@ void ModuleEnumerator::EnumerateWinsockModules() { entry.location.c_str(), expanded, MAX_PATH); if (size != 0 && size <= MAX_PATH) { entry.digital_signer = - GetSubjectNameFromDigitalSignature(FilePath(expanded)); + GetSubjectNameFromDigitalSignature(base::FilePath(expanded)); } entry.version = base::IntToString16(layered_providers[i].version); @@ -555,10 +555,10 @@ void ModuleEnumerator::PopulateModuleInformation(Module* module) { module->duplicate_count = 0; module->normalized = false; module->digital_signer = - GetSubjectNameFromDigitalSignature(FilePath(module->location)); + GetSubjectNameFromDigitalSignature(base::FilePath(module->location)); module->recommended_action = NONE; scoped_ptr<FileVersionInfo> version_info( - FileVersionInfo::CreateFileVersionInfo(FilePath(module->location))); + FileVersionInfo::CreateFileVersionInfo(base::FilePath(module->location))); if (version_info.get()) { FileVersionInfoWin* version_info_win = static_cast<FileVersionInfoWin*>(version_info.get()); @@ -683,7 +683,7 @@ void ModuleEnumerator::ReportBack() { } string16 ModuleEnumerator::GetSubjectNameFromDigitalSignature( - const FilePath& filename) { + const base::FilePath& filename) { HCERTSTORE store = NULL; HCRYPTMSG message = NULL; diff --git a/chrome/browser/errorpage_browsertest.cc b/chrome/browser/errorpage_browsertest.cc index a48542e..76d9c02 100644 --- a/chrome/browser/errorpage_browsertest.cc +++ b/chrome/browser/errorpage_browsertest.cc @@ -29,10 +29,10 @@ class ErrorPageTest : public InProcessBrowserTest { }; // Navigates the active tab to a mock url created for the file at |file_path|. - void NavigateToFileURL(const FilePath::StringType& file_path) { + void NavigateToFileURL(const base::FilePath::StringType& file_path) { ui_test_utils::NavigateToURL( browser(), - content::URLRequestMockHTTPJob::GetMockUrl(FilePath(file_path))); + content::URLRequestMockHTTPJob::GetMockUrl(base::FilePath(file_path))); } // Navigates to the given URL and waits for |num_navigations| to occur, and @@ -203,7 +203,7 @@ IN_PROC_BROWSER_TEST_F(ErrorPageTest, DNSError_GoBack2Forward2) { IN_PROC_BROWSER_TEST_F(ErrorPageTest, IFrameDNSError_Basic) { NavigateToURLAndWaitForTitle( content::URLRequestMockHTTPJob::GetMockUrl( - FilePath(FILE_PATH_LITERAL("iframe_dns_error.html"))), + base::FilePath(FILE_PATH_LITERAL("iframe_dns_error.html"))), "Blah", 1); } @@ -241,7 +241,7 @@ IN_PROC_BROWSER_TEST_F(ErrorPageTest, MAYBE_IFrameDNSError_GoBackAndForward) { IN_PROC_BROWSER_TEST_F(ErrorPageTest, Page404) { NavigateToURLAndWaitForTitle( content::URLRequestMockHTTPJob::GetMockUrl( - FilePath(FILE_PATH_LITERAL("page404.html"))), + base::FilePath(FILE_PATH_LITERAL("page404.html"))), "SUCCESS", 1); } diff --git a/chrome/browser/extensions/activity_database.cc b/chrome/browser/extensions/activity_database.cc index 7ec6cce..576aee7 100644 --- a/chrome/browser/extensions/activity_database.cc +++ b/chrome/browser/extensions/activity_database.cc @@ -28,7 +28,7 @@ void ActivityDatabase::SetErrorDelegate(sql::ErrorDelegate* error_delegate) { db_.set_error_delegate(error_delegate); } -void ActivityDatabase::Init(const FilePath& db_name) { +void ActivityDatabase::Init(const base::FilePath& db_name) { db_.set_page_size(4096); db_.set_cache_size(32); diff --git a/chrome/browser/extensions/activity_database_unittest.cc b/chrome/browser/extensions/activity_database_unittest.cc index fff0a12..1c1938c 100644 --- a/chrome/browser/extensions/activity_database_unittest.cc +++ b/chrome/browser/extensions/activity_database_unittest.cc @@ -18,7 +18,7 @@ namespace extensions { // Check that the database is initialized properly. TEST(ActivityDatabaseTest, Init) { base::ScopedTempDir temp_dir; - FilePath db_file; + base::FilePath db_file; ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); db_file = temp_dir.path().AppendASCII("ActivityInit.db"); file_util::Delete(db_file, false); @@ -40,7 +40,7 @@ TEST(ActivityDatabaseTest, Init) { // Check that actions are recorded in the db. TEST(ActivityDatabaseTest, RecordAction) { base::ScopedTempDir temp_dir; - FilePath db_file; + base::FilePath db_file; ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); db_file = temp_dir.path().AppendASCII("ActivityRecord.db"); file_util::Delete(db_file, false); @@ -79,7 +79,7 @@ TEST(ActivityDatabaseTest, RecordAction) { // Check that nothing explodes if the DB isn't initialized. TEST(ActivityDatabaseTest, InitFailure) { base::ScopedTempDir temp_dir; - FilePath db_file; + base::FilePath db_file; ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); db_file = temp_dir.path().AppendASCII("ActivityRecord.db"); file_util::Delete(db_file, false); diff --git a/chrome/browser/extensions/activity_log.cc b/chrome/browser/extensions/activity_log.cc index bdc9b5f..5b24bef 100644 --- a/chrome/browser/extensions/activity_log.cc +++ b/chrome/browser/extensions/activity_log.cc @@ -146,8 +146,8 @@ ActivityLog::ActivityLog(Profile* profile) { // is being written to the database. db_ = new ActivityDatabase(); if (!IsLogEnabled()) return; - FilePath base_dir = profile->GetPath(); - FilePath database_name = base_dir.Append( + base::FilePath base_dir = profile->GetPath(); + base::FilePath database_name = base_dir.Append( chrome::kExtensionActivityLogFilename); KillActivityDatabaseErrorDelegate* error_delegate = new KillActivityDatabaseErrorDelegate(this); diff --git a/chrome/browser/extensions/activity_log_unittest.cc b/chrome/browser/extensions/activity_log_unittest.cc index 9fea99c..15ac11f 100644 --- a/chrome/browser/extensions/activity_log_unittest.cc +++ b/chrome/browser/extensions/activity_log_unittest.cc @@ -34,7 +34,7 @@ class ActivityLogTest : public ChromeRenderViewHostTestHarness { Profile::FromBrowserContext(web_contents()->GetBrowserContext()); extension_service_ = static_cast<TestExtensionSystem*>( ExtensionSystem::Get(profile_))->CreateExtensionService( - &command_line, FilePath(), false); + &command_line, base::FilePath(), false); CommandLine::ForCurrentProcess()->AppendSwitch( switches::kEnableExtensionActivityUI); ActivityLog::RecomputeLoggingIsEnabled(); @@ -90,7 +90,7 @@ TEST_F(ActivityLogTest, ConstructAndLog) { // whether the writes have been completed, instead of waiting. #if 0 base::PlatformThread::Sleep(base::TimeDelta::FromSeconds(3)); - FilePath db_file = profile_->GetPath().Append( + base::FilePath db_file = profile_->GetPath().Append( chrome::kExtensionActivityLogFilename); sql::Connection db; ASSERT_TRUE(db.Open(db_file)); diff --git a/chrome/browser/extensions/admin_policy_unittest.cc b/chrome/browser/extensions/admin_policy_unittest.cc index d74e361..3818cc6 100644 --- a/chrome/browser/extensions/admin_policy_unittest.cc +++ b/chrome/browser/extensions/admin_policy_unittest.cc @@ -36,7 +36,7 @@ class ExtensionAdminPolicyTest : public testing::Test { values->SetString(extension_manifest_keys::kName, "test"); values->SetString(extension_manifest_keys::kVersion, "0.1"); std::string error; - extension_ = Extension::Create(FilePath(), location, *values, + extension_ = Extension::Create(base::FilePath(), location, *values, Extension::NO_FLAGS, &error); ASSERT_TRUE(extension_.get()); } diff --git a/chrome/browser/extensions/all_urls_apitest.cc b/chrome/browser/extensions/all_urls_apitest.cc index f19dead..233e2f4 100644 --- a/chrome/browser/extensions/all_urls_apitest.cc +++ b/chrome/browser/extensions/all_urls_apitest.cc @@ -24,9 +24,9 @@ typedef ExtensionApiTest AllUrlsApiTest; #endif IN_PROC_BROWSER_TEST_F(AllUrlsApiTest, MAYBE_WhitelistedExtension) { // First setup the two extensions. - FilePath extension_dir1 = test_data_dir_.AppendASCII("all_urls") + base::FilePath extension_dir1 = test_data_dir_.AppendASCII("all_urls") .AppendASCII("content_script"); - FilePath extension_dir2 = test_data_dir_.AppendASCII("all_urls") + base::FilePath extension_dir2 = test_data_dir_.AppendASCII("all_urls") .AppendASCII("execute_script"); // Then add the two extensions to the whitelist. @@ -92,9 +92,9 @@ IN_PROC_BROWSER_TEST_F(AllUrlsApiTest, MAYBE_WhitelistedExtension) { // and run scripts on non-restricted all pages. IN_PROC_BROWSER_TEST_F(AllUrlsApiTest, RegularExtensions) { // First load the two extensions. - FilePath extension_dir1 = test_data_dir_.AppendASCII("all_urls") + base::FilePath extension_dir1 = test_data_dir_.AppendASCII("all_urls") .AppendASCII("content_script"); - FilePath extension_dir2 = test_data_dir_.AppendASCII("all_urls") + base::FilePath extension_dir2 = test_data_dir_.AppendASCII("all_urls") .AppendASCII("execute_script"); ExtensionService* service = extensions::ExtensionSystem::Get( diff --git a/chrome/browser/extensions/api/bookmarks/bookmarks_api.cc b/chrome/browser/extensions/api/bookmarks/bookmarks_api.cc index 6faf572..1ee7036 100644 --- a/chrome/browser/extensions/api/bookmarks/bookmarks_api.cc +++ b/chrome/browser/extensions/api/bookmarks/bookmarks_api.cc @@ -64,23 +64,23 @@ namespace { // Generates a default path (including a default filename) that will be // used for pre-populating the "Export Bookmarks" file chooser dialog box. -FilePath GetDefaultFilepathForBookmarkExport() { +base::FilePath GetDefaultFilepathForBookmarkExport() { base::Time time = base::Time::Now(); // Concatenate a date stamp to the filename. #if defined(OS_POSIX) - FilePath::StringType filename = + base::FilePath::StringType filename = l10n_util::GetStringFUTF8(IDS_EXPORT_BOOKMARKS_DEFAULT_FILENAME, base::TimeFormatShortDateNumeric(time)); #elif defined(OS_WIN) - FilePath::StringType filename = + base::FilePath::StringType filename = l10n_util::GetStringFUTF16(IDS_EXPORT_BOOKMARKS_DEFAULT_FILENAME, base::TimeFormatShortDateNumeric(time)); #endif file_util::ReplaceIllegalCharactersInPath(&filename, '_'); - FilePath default_path; + base::FilePath default_path; PathService::Get(chrome::DIR_USER_DOCUMENTS, &default_path); return default_path.Append(filename); } @@ -900,7 +900,7 @@ void BookmarksIOFunction::SelectFile(ui::SelectFileDialog::Type type) { // Pre-populating the filename field in case this is a SELECT_SAVEAS_FILE // dialog. If not, there is no filename field in the dialog box. - FilePath default_path; + base::FilePath default_path; if (type == ui::SelectFileDialog::SELECT_SAVEAS_FILE) default_path = GetDefaultFilepathForBookmarkExport(); else @@ -912,8 +912,9 @@ void BookmarksIOFunction::SelectFile(ui::SelectFileDialog::Type type) { type, default_path)); } -void BookmarksIOFunction::ShowSelectFileDialog(ui::SelectFileDialog::Type type, - const FilePath& default_path) { +void BookmarksIOFunction::ShowSelectFileDialog( + ui::SelectFileDialog::Type type, + const base::FilePath& default_path) { // Balanced in one of the three callbacks of SelectFileDialog: // either FileSelectionCanceled, MultiFilesSelected, or FileSelected AddRef(); @@ -948,7 +949,7 @@ void BookmarksIOFunction::FileSelectionCanceled(void* params) { } void BookmarksIOFunction::MultiFilesSelected( - const std::vector<FilePath>& files, void* params) { + const std::vector<base::FilePath>& files, void* params) { Release(); // Balanced in BookmarsIOFunction::SelectFile() NOTREACHED() << "Should not be able to select multiple files"; } @@ -960,7 +961,7 @@ bool BookmarksImportFunction::RunImpl() { return true; } -void BookmarksImportFunction::FileSelected(const FilePath& path, +void BookmarksImportFunction::FileSelected(const base::FilePath& path, int index, void* params) { #if !defined(OS_ANDROID) @@ -985,7 +986,7 @@ bool BookmarksExportFunction::RunImpl() { return true; } -void BookmarksExportFunction::FileSelected(const FilePath& path, +void BookmarksExportFunction::FileSelected(const base::FilePath& path, int index, void* params) { #if !defined(OS_ANDROID) diff --git a/chrome/browser/extensions/api/content_settings/content_settings_apitest.cc b/chrome/browser/extensions/api/content_settings/content_settings_apitest.cc index 381346e..a37f37a 100644 --- a/chrome/browser/extensions/api/content_settings/content_settings_apitest.cc +++ b/chrome/browser/extensions/api/content_settings/content_settings_apitest.cc @@ -100,20 +100,22 @@ IN_PROC_BROWSER_TEST_F(ExtensionApiTest, CommandLine::ForCurrentProcess()->AppendSwitch( switches::kEnableExperimentalExtensionApis); - FilePath::CharType kFooPath[] = FILE_PATH_LITERAL("/plugins/foo.plugin"); - FilePath::CharType kBarPath[] = FILE_PATH_LITERAL("/plugins/bar.plugin"); + base::FilePath::CharType kFooPath[] = + FILE_PATH_LITERAL("/plugins/foo.plugin"); + base::FilePath::CharType kBarPath[] = + FILE_PATH_LITERAL("/plugins/bar.plugin"); const char* kFooName = "Foo Plugin"; const char* kBarName = "Bar Plugin"; webkit::npapi::MockPluginList plugin_list; plugin_list.AddPluginToLoad( webkit::WebPluginInfo(ASCIIToUTF16(kFooName), - FilePath(kFooPath), + base::FilePath(kFooPath), ASCIIToUTF16("1.2.3"), ASCIIToUTF16("foo"))); plugin_list.AddPluginToLoad( webkit::WebPluginInfo(ASCIIToUTF16(kBarName), - FilePath(kBarPath), + base::FilePath(kBarPath), ASCIIToUTF16("2.3.4"), ASCIIToUTF16("bar"))); diff --git a/chrome/browser/extensions/api/declarative_webrequest/webrequest_condition_attribute_unittest.cc b/chrome/browser/extensions/api/declarative_webrequest/webrequest_condition_attribute_unittest.cc index e5f2784..1586b3b 100644 --- a/chrome/browser/extensions/api/declarative_webrequest/webrequest_condition_attribute_unittest.cc +++ b/chrome/browser/extensions/api/declarative_webrequest/webrequest_condition_attribute_unittest.cc @@ -110,7 +110,7 @@ TEST(WebRequestConditionAttributeTest, ContentType) { net::TestServer test_server( net::TestServer::TYPE_HTTP, net::TestServer::kLocalhost, - FilePath(FILE_PATH_LITERAL( + base::FilePath(FILE_PATH_LITERAL( "chrome/test/data/extensions/api_test/webrequest/declarative"))); ASSERT_TRUE(test_server.Start()); @@ -480,7 +480,7 @@ TEST(WebRequestConditionAttributeTest, ResponseHeaders) { net::TestServer test_server( net::TestServer::TYPE_HTTP, net::TestServer::kLocalhost, - FilePath(FILE_PATH_LITERAL( + base::FilePath(FILE_PATH_LITERAL( "chrome/test/data/extensions/api_test/webrequest/declarative"))); ASSERT_TRUE(test_server.Start()); diff --git a/chrome/browser/extensions/api/developer_private/developer_private_api.cc b/chrome/browser/extensions/api/developer_private/developer_private_api.cc index 31f956c..7ee4eb8 100644 --- a/chrome/browser/extensions/api/developer_private/developer_private_api.cc +++ b/chrome/browser/extensions/api/developer_private/developer_private_api.cc @@ -81,7 +81,7 @@ void DeveloperPrivateAPI::Observe( } } -void DeveloperPrivateAPI::SetLastUnpackedDirectory(const FilePath& path) { +void DeveloperPrivateAPI::SetLastUnpackedDirectory(const base::FilePath& path) { last_unpacked_directory_ = path; } @@ -517,7 +517,7 @@ bool DeveloperPrivateLoadUnpackedFunction::RunImpl() { const ui::SelectFileDialog::Type kSelectType = ui::SelectFileDialog::SELECT_FOLDER; - const FilePath& last_unpacked_directory = + const base::FilePath& last_unpacked_directory = DeveloperPrivateAPI::Get(profile())->getLastUnpackedDirectory(); SetResult(Value::CreateBooleanValue(true)); // Balanced in FileSelected / FileSelectionCanceled. @@ -528,7 +528,7 @@ bool DeveloperPrivateLoadUnpackedFunction::RunImpl() { bool DeveloperPrivateChooseEntryFunction::ShowPicker( ui::SelectFileDialog::Type picker_type, - const FilePath& last_directory, + const base::FilePath& last_directory, const string16& select_title) { ShellWindowRegistry* registry = ShellWindowRegistry::Get(profile()); DCHECK(registry); @@ -551,8 +551,8 @@ bool DeveloperPrivateChooseEntryFunction::RunImpl() { return false; } DeveloperPrivateChooseEntryFunction::~DeveloperPrivateChooseEntryFunction() {} -void DeveloperPrivateLoadUnpackedFunction::FileSelected(const FilePath& path) { - +void DeveloperPrivateLoadUnpackedFunction::FileSelected( + const base::FilePath& path) { ExtensionService* service = profile()->GetExtensionService(); extensions::UnpackedInstaller::Create(service)->Load(path); DeveloperPrivateAPI::Get(profile())->SetLastUnpackedDirectory(path); diff --git a/chrome/browser/extensions/api/developer_private/developer_private_api.h b/chrome/browser/extensions/api/developer_private/developer_private_api.h index 15f9a5c..599ee4d 100644 --- a/chrome/browser/extensions/api/developer_private/developer_private_api.h +++ b/chrome/browser/extensions/api/developer_private/developer_private_api.h @@ -58,9 +58,11 @@ class DeveloperPrivateAPI : public ProfileKeyedService, explicit DeveloperPrivateAPI(Profile* profile); virtual ~DeveloperPrivateAPI(); - void SetLastUnpackedDirectory(const FilePath& path); + void SetLastUnpackedDirectory(const base::FilePath& path); - FilePath& getLastUnpackedDirectory() { return last_unpacked_directory_; } + base::FilePath& getLastUnpackedDirectory() { + return last_unpacked_directory_; + } // ProfileKeyedService implementation virtual void Shutdown() OVERRIDE; @@ -75,7 +77,7 @@ class DeveloperPrivateAPI : public ProfileKeyedService, // Used to start the load |load_extension_dialog_| in the last directory that // was loaded. - FilePath last_unpacked_directory_; + base::FilePath last_unpacked_directory_; content::NotificationRegistrar registrar_; @@ -201,11 +203,11 @@ class DeveloperPrivateChooseEntryFunction : public SyncExtensionFunction, virtual ~DeveloperPrivateChooseEntryFunction(); virtual bool RunImpl() OVERRIDE; bool ShowPicker(ui::SelectFileDialog::Type picker_type, - const FilePath& last_directory, + const base::FilePath& last_directory, const string16& select_title); // EntryPickerCLient functions. - virtual void FileSelected(const FilePath& path) = 0; + virtual void FileSelected(const base::FilePath& path) = 0; virtual void FileSelectionCanceled() = 0; }; @@ -221,7 +223,7 @@ class DeveloperPrivateLoadUnpackedFunction virtual bool RunImpl() OVERRIDE; // EntryPickerCLient implementation. - virtual void FileSelected(const FilePath& path) OVERRIDE; + virtual void FileSelected(const base::FilePath& path) OVERRIDE; virtual void FileSelectionCanceled() OVERRIDE; }; diff --git a/chrome/browser/extensions/api/developer_private/developer_private_apitest.cc b/chrome/browser/extensions/api/developer_private/developer_private_apitest.cc index 687342a..94db34b 100644 --- a/chrome/browser/extensions/api/developer_private/developer_private_apitest.cc +++ b/chrome/browser/extensions/api/developer_private/developer_private_apitest.cc @@ -18,19 +18,19 @@ class DeveloperPrivateApiTest : public ExtensionApiTest { } virtual void LoadExtensions() { - FilePath base_dir = test_data_dir_.AppendASCII("developer"); + base::FilePath base_dir = test_data_dir_.AppendASCII("developer"); LoadNamedExtension(base_dir, "hosted_app"); } protected: - void LoadNamedExtension(const FilePath& path, + void LoadNamedExtension(const base::FilePath& path, const std::string& name) { const Extension* extension = LoadExtension(path.AppendASCII(name)); ASSERT_TRUE(extension); extension_name_to_ids_[name] = extension->id(); } - void InstallNamedExtension(const FilePath& path, + void InstallNamedExtension(const base::FilePath& path, const std::string& name, Manifest::Location install_source) { const Extension* extension = InstallExtension(path.AppendASCII(name), 1, @@ -45,7 +45,7 @@ class DeveloperPrivateApiTest : public ExtensionApiTest { IN_PROC_BROWSER_TEST_F(DeveloperPrivateApiTest, Basics) { LoadExtensions(); - FilePath basedir = test_data_dir_.AppendASCII("developer"); + base::FilePath basedir = test_data_dir_.AppendASCII("developer"); InstallNamedExtension(basedir, "packaged_app", Manifest::INTERNAL); InstallNamedExtension(basedir, "simple_extension", Manifest::INTERNAL); diff --git a/chrome/browser/extensions/api/developer_private/entry_picker.cc b/chrome/browser/extensions/api/developer_private/entry_picker.cc index beec2405..2528314 100644 --- a/chrome/browser/extensions/api/developer_private/entry_picker.cc +++ b/chrome/browser/extensions/api/developer_private/entry_picker.cc @@ -19,7 +19,7 @@ namespace { bool g_skip_picker_for_test = false; -FilePath* g_path_to_be_picked_for_test = NULL; +base::FilePath* g_path_to_be_picked_for_test = NULL; } // namespace @@ -30,7 +30,7 @@ namespace api { EntryPicker::EntryPicker(EntryPickerClient* client, content::WebContents* web_contents, ui::SelectFileDialog::Type picker_type, - const FilePath& last_directory, + const base::FilePath& last_directory, const string16& select_title) : client_(client) { select_file_dialog_ = ui::SelectFileDialog::Create( @@ -65,7 +65,7 @@ EntryPicker::EntryPicker(EntryPickerClient* client, EntryPicker::~EntryPicker() {} -void EntryPicker::FileSelected(const FilePath& path, +void EntryPicker::FileSelected(const base::FilePath& path, int index, void* params) { client_->FileSelected(path); @@ -79,7 +79,7 @@ void EntryPicker::FileSelectionCanceled(void* params) { // static void EntryPicker::SkipPickerAndAlwaysSelectPathForTest( - FilePath* path) { + base::FilePath* path) { g_skip_picker_for_test = true; g_path_to_be_picked_for_test = path; } diff --git a/chrome/browser/extensions/api/developer_private/entry_picker.h b/chrome/browser/extensions/api/developer_private/entry_picker.h index b2025f7..91aa3a9 100644 --- a/chrome/browser/extensions/api/developer_private/entry_picker.h +++ b/chrome/browser/extensions/api/developer_private/entry_picker.h @@ -18,7 +18,7 @@ namespace api { class EntryPickerClient { public: - virtual void FileSelected(const FilePath& path) = 0; + virtual void FileSelected(const base::FilePath& path) = 0; virtual void FileSelectionCanceled() = 0; }; @@ -28,11 +28,11 @@ class EntryPicker : public ui::SelectFileDialog::Listener { EntryPicker(EntryPickerClient* client, content::WebContents* web_contents, ui::SelectFileDialog::Type picker_type, - const FilePath& last_directory, + const base::FilePath& last_directory, const string16& select_title); // Allow picker UI to be skipped in testing. - static void SkipPickerAndAlwaysSelectPathForTest(FilePath* path); + static void SkipPickerAndAlwaysSelectPathForTest(base::FilePath* path); static void SkipPickerAndAlwaysCancelForTest(); static void StopSkippingPickerForTest(); @@ -42,7 +42,7 @@ class EntryPicker : public ui::SelectFileDialog::Listener { private: // ui::SelectFileDialog::Listener implementation. - virtual void FileSelected(const FilePath& path, + virtual void FileSelected(const base::FilePath& path, int index, void* params) OVERRIDE; diff --git a/chrome/browser/extensions/api/downloads/downloads_api.cc b/chrome/browser/extensions/api/downloads/downloads_api.cc index 823c894..df50565 100644 --- a/chrome/browser/extensions/api/downloads/downloads_api.cc +++ b/chrome/browser/extensions/api/downloads/downloads_api.cc @@ -245,7 +245,7 @@ class DownloadFileIconExtractorImpl : public DownloadFileIconExtractor { virtual ~DownloadFileIconExtractorImpl() {} - virtual bool ExtractIconURLForPath(const FilePath& path, + virtual bool ExtractIconURLForPath(const base::FilePath& path, IconLoader::IconSize icon_size, IconURLCallback callback) OVERRIDE; private: @@ -256,7 +256,7 @@ class DownloadFileIconExtractorImpl : public DownloadFileIconExtractor { }; bool DownloadFileIconExtractorImpl::ExtractIconURLForPath( - const FilePath& path, + const base::FilePath& path, IconLoader::IconSize icon_size, IconURLCallback callback) { callback_ = callback; diff --git a/chrome/browser/extensions/api/downloads/downloads_api.h b/chrome/browser/extensions/api/downloads/downloads_api.h index 725d114..6efb8df 100644 --- a/chrome/browser/extensions/api/downloads/downloads_api.h +++ b/chrome/browser/extensions/api/downloads/downloads_api.h @@ -205,7 +205,7 @@ class DownloadsGetFileIconFunction : public AsyncExtensionFunction { private: void OnIconURLExtracted(const std::string& url); - FilePath path_; + base::FilePath path_; scoped_ptr<DownloadFileIconExtractor> icon_extractor_; DISALLOW_COPY_AND_ASSIGN(DownloadsGetFileIconFunction); }; diff --git a/chrome/browser/extensions/api/downloads/downloads_api_unittest.cc b/chrome/browser/extensions/api/downloads/downloads_api_unittest.cc index 32c192c..23f758a 100644 --- a/chrome/browser/extensions/api/downloads/downloads_api_unittest.cc +++ b/chrome/browser/extensions/api/downloads/downloads_api_unittest.cc @@ -239,7 +239,7 @@ class DownloadExtensionTest : public ExtensionApiTest { struct HistoryDownloadInfo { // Filename to use. CreateHistoryDownloads will append this filename to the // temporary downloads directory specified by downloads_directory(). - const FilePath::CharType* filename; + const base::FilePath::CharType* filename; // State for the download. Note that IN_PROGRESS downloads will be created // as CANCELLED. @@ -502,7 +502,7 @@ class DownloadExtensionTest : public ExtensionApiTest { return base::StringPrintf("[%d]", download_item->GetId()); } - const FilePath& downloads_directory() { + const base::FilePath& downloads_directory() { return downloads_directory_.path(); } @@ -539,15 +539,16 @@ class DownloadExtensionTest : public ExtensionApiTest { class MockIconExtractorImpl : public DownloadFileIconExtractor { public: - MockIconExtractorImpl(const FilePath& path, IconLoader::IconSize icon_size, + MockIconExtractorImpl(const base::FilePath& path, + IconLoader::IconSize icon_size, const std::string& response) - : expected_path_(path), - expected_icon_size_(icon_size), - response_(response) { + : expected_path_(path), + expected_icon_size_(icon_size), + response_(response) { } virtual ~MockIconExtractorImpl() {} - virtual bool ExtractIconURLForPath(const FilePath& path, + virtual bool ExtractIconURLForPath(const base::FilePath& path, IconLoader::IconSize icon_size, IconURLCallback callback) OVERRIDE { EXPECT_STREQ(expected_path_.value().c_str(), path.value().c_str()); @@ -570,7 +571,7 @@ class MockIconExtractorImpl : public DownloadFileIconExtractor { callback_.Run(response_); } - FilePath expected_path_; + base::FilePath expected_path_; IconLoader::IconSize expected_icon_size_; std::string response_; IconURLCallback callback_; @@ -939,7 +940,7 @@ IN_PROC_BROWSER_TEST_F(DownloadExtensionTest, } scoped_refptr<UIThreadExtensionFunction> MockedGetFileIconFunction( - const FilePath& expected_path, + const base::FilePath& expected_path, IconLoader::IconSize icon_size, const std::string& response) { scoped_refptr<DownloadsGetFileIconFunction> function( @@ -1044,8 +1045,8 @@ IN_PROC_BROWSER_TEST_F(DownloadExtensionTest, ASSERT_TRUE(CreateHistoryDownloads(kHistoryInfo, arraysize(kHistoryInfo), &all_downloads)); - FilePath real_path = all_downloads[0]->GetFullPath(); - FilePath fake_path = all_downloads[1]->GetFullPath(); + base::FilePath real_path = all_downloads[0]->GetFullPath(); + base::FilePath fake_path = all_downloads[1]->GetFullPath(); EXPECT_EQ(0, file_util::WriteFile(real_path, "", 0)); ASSERT_TRUE(file_util::PathExists(real_path)); @@ -1310,7 +1311,7 @@ IN_PROC_BROWSER_TEST_F(DownloadExtensionTest, ASSERT_EQ(1UL, result_list->GetSize()); base::DictionaryValue* item_value = NULL; ASSERT_TRUE(result_list->GetDictionary(0, &item_value)); - FilePath::StringType item_name; + base::FilePath::StringType item_name; ASSERT_TRUE(item_value->GetString("filename", &item_name)); ASSERT_EQ(items[2]->GetFullPath().value(), item_name); } @@ -1324,7 +1325,7 @@ IN_PROC_BROWSER_TEST_F(DownloadExtensionTest, scoped_ptr<base::Value> result_value; base::ListValue* result_list = NULL; base::DictionaryValue* result_dict = NULL; - FilePath::StringType filename; + base::FilePath::StringType filename; bool is_incognito = false; std::string error; std::string on_item_arg; @@ -1357,12 +1358,12 @@ IN_PROC_BROWSER_TEST_F(DownloadExtensionTest, ASSERT_TRUE(result_list->GetDictionary(0, &result_dict)); ASSERT_TRUE(result_dict->GetString("filename", &filename)); ASSERT_TRUE(result_dict->GetBoolean("incognito", &is_incognito)); - EXPECT_TRUE(on_item->GetFullPath() == FilePath(filename)); + EXPECT_TRUE(on_item->GetFullPath() == base::FilePath(filename)); EXPECT_FALSE(is_incognito); ASSERT_TRUE(result_list->GetDictionary(1, &result_dict)); ASSERT_TRUE(result_dict->GetString("filename", &filename)); ASSERT_TRUE(result_dict->GetBoolean("incognito", &is_incognito)); - EXPECT_TRUE(off_item->GetFullPath() == FilePath(filename)); + EXPECT_TRUE(off_item->GetFullPath() == base::FilePath(filename)); EXPECT_TRUE(is_incognito); // Extensions running in the on-record window should have access only to the @@ -1375,7 +1376,7 @@ IN_PROC_BROWSER_TEST_F(DownloadExtensionTest, ASSERT_EQ(1UL, result_list->GetSize()); ASSERT_TRUE(result_list->GetDictionary(0, &result_dict)); ASSERT_TRUE(result_dict->GetString("filename", &filename)); - EXPECT_TRUE(on_item->GetFullPath() == FilePath(filename)); + EXPECT_TRUE(on_item->GetFullPath() == base::FilePath(filename)); ASSERT_TRUE(result_dict->GetBoolean("incognito", &is_incognito)); EXPECT_FALSE(is_incognito); diff --git a/chrome/browser/extensions/api/file_system/file_system_api.cc b/chrome/browser/extensions/api/file_system/file_system_api.cc index 6fa41df..f60283e 100644 --- a/chrome/browser/extensions/api/file_system/file_system_api.cc +++ b/chrome/browser/extensions/api/file_system/file_system_api.cc @@ -58,7 +58,7 @@ namespace { #if defined(OS_MACOSX) // Retrieves the localized display name for the base name of the given path. // If the path is not localized, this will just return the base name. -std::string GetDisplayBaseName(const FilePath& path) { +std::string GetDisplayBaseName(const base::FilePath& path) { base::mac::ScopedCFTypeRef<CFURLRef> url( CFURLCreateFromFileSystemRepresentation( NULL, @@ -80,8 +80,8 @@ std::string GetDisplayBaseName(const FilePath& path) { // Prettifies |source_path| for OS X, by localizing every component of the // path. Additionally, if the path is inside the user's home directory, then // replace the home directory component with "~". -FilePath PrettifyPath(const FilePath& source_path) { - FilePath home_path; +base::FilePath PrettifyPath(const base::FilePath& source_path) { + base::FilePath home_path; PathService::Get(base::DIR_HOME, &home_path); DCHECK(source_path.IsAbsolute()); @@ -90,16 +90,16 @@ FilePath PrettifyPath(const FilePath& source_path) { // and localized subfolders of the user's home directory. // Don't grab the display name of the first component, i.e., "/", as it'll // show up as the HDD name. - std::vector<FilePath::StringType> components; + std::vector<base::FilePath::StringType> components; source_path.GetComponents(&components); - FilePath display_path = FilePath(components[0]); - FilePath actual_path = display_path; - for (std::vector<FilePath::StringType>::iterator i = components.begin() + 1; - i != components.end(); ++i) { + base::FilePath display_path = base::FilePath(components[0]); + base::FilePath actual_path = display_path; + for (std::vector<base::FilePath::StringType>::iterator i = + components.begin() + 1; i != components.end(); ++i) { actual_path = actual_path.Append(*i); if (actual_path == home_path) { - display_path = FilePath("~"); - home_path = FilePath(); + display_path = base::FilePath("~"); + home_path = base::FilePath(); continue; } std::string display = GetDisplayBaseName(actual_path); @@ -111,15 +111,15 @@ FilePath PrettifyPath(const FilePath& source_path) { #else // defined(OS_MACOSX) // Prettifies |source_path|, by replacing the user's home directory with "~" // (if applicable). -FilePath PrettifyPath(const FilePath& source_path) { +base::FilePath PrettifyPath(const base::FilePath& source_path) { #if defined(OS_WIN) || defined(OS_POSIX) #if defined(OS_WIN) int home_key = base::DIR_PROFILE; #elif defined(OS_POSIX) int home_key = base::DIR_HOME; #endif - FilePath home_path; - FilePath display_path = FilePath::FromUTF8Unsafe("~"); + base::FilePath home_path; + base::FilePath display_path = base::FilePath::FromUTF8Unsafe("~"); if (PathService::Get(home_key, &home_path) && home_path.AppendRelativePath(source_path, &display_path)) return display_path; @@ -129,12 +129,12 @@ FilePath PrettifyPath(const FilePath& source_path) { #endif // defined(OS_MACOSX) bool g_skip_picker_for_test = false; -FilePath* g_path_to_be_picked_for_test; +base::FilePath* g_path_to_be_picked_for_test; bool GetFilePathOfFileEntry(const std::string& filesystem_name, const std::string& filesystem_path, const content::RenderViewHost* render_view_host, - FilePath* file_path, + base::FilePath* file_path, std::string* error) { std::string filesystem_id; if (!fileapi::CrackIsolatedFileSystemName(filesystem_name, &filesystem_id)) { @@ -153,8 +153,9 @@ bool GetFilePathOfFileEntry(const std::string& filesystem_name, } IsolatedContext* context = IsolatedContext::GetInstance(); - FilePath relative_path = FilePath::FromUTF8Unsafe(filesystem_path); - FilePath virtual_path = context->CreateVirtualRootPath(filesystem_id) + base::FilePath relative_path = + base::FilePath::FromUTF8Unsafe(filesystem_path); + base::FilePath virtual_path = context->CreateVirtualRootPath(filesystem_id) .Append(relative_path); if (!context->CrackVirtualPath(virtual_path, &filesystem_id, @@ -167,7 +168,7 @@ bool GetFilePathOfFileEntry(const std::string& filesystem_name, return true; } -bool DoCheckWritableFile(const FilePath& path) { +bool DoCheckWritableFile(const base::FilePath& path) { // Don't allow links. if (file_util::PathExists(path) && file_util::IsLink(path)) return false; @@ -191,9 +192,9 @@ bool DoCheckWritableFile(const FilePath& path) { // were found. bool GetFileTypesFromAcceptOption( const file_system::AcceptOption& accept_option, - std::vector<FilePath::StringType>* extensions, + std::vector<base::FilePath::StringType>* extensions, string16* description) { - std::set<FilePath::StringType> extension_set; + std::set<base::FilePath::StringType> extension_set; int description_id = 0; if (accept_option.mime_types.get()) { @@ -201,7 +202,7 @@ bool GetFileTypesFromAcceptOption( bool valid_type = false; for (std::vector<std::string>::const_iterator iter = list->begin(); iter != list->end(); ++iter) { - std::vector<FilePath::StringType> inner; + std::vector<base::FilePath::StringType> inner; std::string accept_type = *iter; StringToLowerASCII(&accept_type); net::GetExtensionsForMimeType(accept_type, &inner); @@ -259,7 +260,7 @@ bool FileSystemGetDisplayPathFunction::RunImpl() { EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &filesystem_name)); EXTENSION_FUNCTION_VALIDATE(args_->GetString(1, &filesystem_path)); - FilePath file_path; + base::FilePath file_path; if (!GetFilePathOfFileEntry(filesystem_name, filesystem_path, render_view_host_, &file_path, &error_)) return false; @@ -277,7 +278,7 @@ bool FileSystemEntryFunction::HasFileSystemWritePermission() { return extension->HasAPIPermission(APIPermission::kFileSystemWrite); } -void FileSystemEntryFunction::CheckWritableFile(const FilePath& path) { +void FileSystemEntryFunction::CheckWritableFile(const base::FilePath& path) { DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::FILE)); if (DoCheckWritableFile(path)) { content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE, @@ -291,7 +292,7 @@ void FileSystemEntryFunction::CheckWritableFile(const FilePath& path) { } void FileSystemEntryFunction::RegisterFileSystemAndSendResponse( - const FilePath& path, EntryType entry_type) { + const base::FilePath& path, EntryType entry_type) { DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); fileapi::IsolatedContext* isolated_context = @@ -339,7 +340,7 @@ bool FileSystemGetWritableEntryFunction::RunImpl() { return false; } - FilePath path; + base::FilePath path; if (!GetFilePathOfFileEntry(filesystem_name, filesystem_path, render_view_host_, &path, &error_)) return false; @@ -379,7 +380,7 @@ class FileSystemChooseEntryFunction::FilePicker public: FilePicker(FileSystemChooseEntryFunction* function, content::WebContents* web_contents, - const FilePath& suggested_name, + const base::FilePath& suggested_name, const ui::SelectFileDialog::FileTypeInfo& file_type_info, ui::SelectFileDialog::Type picker_type, EntryType entry_type) @@ -419,7 +420,7 @@ class FileSystemChooseEntryFunction::FilePicker private: // ui::SelectFileDialog::Listener implementation. - virtual void FileSelected(const FilePath& path, + virtual void FileSelected(const base::FilePath& path, int index, void* params) OVERRIDE { function_->FileSelected(path, entry_type_); @@ -431,7 +432,7 @@ class FileSystemChooseEntryFunction::FilePicker delete this; } - FilePath suggested_name_; + base::FilePath suggested_name_; EntryType entry_type_; @@ -442,7 +443,7 @@ class FileSystemChooseEntryFunction::FilePicker }; bool FileSystemChooseEntryFunction::ShowPicker( - const FilePath& suggested_name, + const base::FilePath& suggested_name, const ui::SelectFileDialog::FileTypeInfo& file_type_info, ui::SelectFileDialog::Type picker_type, EntryType entry_type) { @@ -466,7 +467,7 @@ bool FileSystemChooseEntryFunction::ShowPicker( // static void FileSystemChooseEntryFunction::SkipPickerAndAlwaysSelectPathForTest( - FilePath* path) { + base::FilePath* path) { g_skip_picker_for_test = true; g_path_to_be_picked_for_test = path; } @@ -482,7 +483,7 @@ void FileSystemChooseEntryFunction::StopSkippingPickerForTest() { g_skip_picker_for_test = false; } -void FileSystemChooseEntryFunction::FileSelected(const FilePath& path, +void FileSystemChooseEntryFunction::FileSelected(const base::FilePath& path, EntryType entry_type) { if (entry_type == WRITABLE) { content::BrowserThread::PostTask(content::BrowserThread::FILE, FROM_HERE, @@ -502,7 +503,7 @@ void FileSystemChooseEntryFunction::FileSelectionCanceled() { void FileSystemChooseEntryFunction::BuildFileTypeInfo( ui::SelectFileDialog::FileTypeInfo* file_type_info, - const FilePath::StringType& suggested_extension, + const base::FilePath::StringType& suggested_extension, const AcceptOptions* accepts, const bool* acceptsAllTypes) { file_type_info->include_all_files = true; @@ -517,7 +518,7 @@ void FileSystemChooseEntryFunction::BuildFileTypeInfo( for (std::vector<linked_ptr<AcceptOption> >::const_iterator iter = accepts->begin(); iter != accepts->end(); ++iter) { string16 description; - std::vector<FilePath::StringType> extensions; + std::vector<base::FilePath::StringType> extensions; if (!GetFileTypesFromAcceptOption(**iter, &extensions, &description)) continue; // No extensions were found. @@ -542,17 +543,17 @@ void FileSystemChooseEntryFunction::BuildFileTypeInfo( void FileSystemChooseEntryFunction::BuildSuggestion( const std::string *opt_name, - FilePath* suggested_name, - FilePath::StringType* suggested_extension) { + base::FilePath* suggested_name, + base::FilePath::StringType* suggested_extension) { if (opt_name) { - *suggested_name = FilePath::FromUTF8Unsafe(*opt_name); + *suggested_name = base::FilePath::FromUTF8Unsafe(*opt_name); // Don't allow any path components; shorten to the base name. This should // result in a relative path, but in some cases may not. Clear the // suggestion for safety if this is the case. *suggested_name = suggested_name->BaseName(); if (suggested_name->IsAbsolute()) - *suggested_name = FilePath(); + *suggested_name = base::FilePath(); *suggested_extension = suggested_name->Extension(); if (!suggested_extension->empty()) @@ -564,7 +565,7 @@ bool FileSystemChooseEntryFunction::RunImpl() { scoped_ptr<ChooseEntry::Params> params(ChooseEntry::Params::Create(*args_)); EXTENSION_FUNCTION_VALIDATE(params.get()); - FilePath suggested_name; + base::FilePath suggested_name; ui::SelectFileDialog::FileTypeInfo file_type_info; EntryType entry_type = READ_ONLY; ui::SelectFileDialog::Type picker_type = @@ -584,7 +585,7 @@ bool FileSystemChooseEntryFunction::RunImpl() { } } - FilePath::StringType suggested_extension; + base::FilePath::StringType suggested_extension; BuildSuggestion(options->suggested_name.get(), &suggested_name, &suggested_extension); diff --git a/chrome/browser/extensions/api/file_system/file_system_api.h b/chrome/browser/extensions/api/file_system/file_system_api.h index 6e5e58a..6e72a0f 100644 --- a/chrome/browser/extensions/api/file_system/file_system_api.h +++ b/chrome/browser/extensions/api/file_system/file_system_api.h @@ -35,12 +35,12 @@ class FileSystemEntryFunction : public AsyncExtensionFunction { // Called on the FILE thread. This is called when a writable file entry is // being returned. The function will ensure the file exists, creating it if // necessary, and also check that the file is not a link. - void CheckWritableFile(const FilePath& path); + void CheckWritableFile(const base::FilePath& path); // This will finish the choose file process. This is either called directly // from FileSelected, or from CreateFileIfNecessary. It is called on the UI // thread. - void RegisterFileSystemAndSendResponse(const FilePath& path, + void RegisterFileSystemAndSendResponse(const base::FilePath& path, EntryType entry_type); // called on the UI thread if there is a problem checking a writable file. @@ -70,7 +70,7 @@ class FileSystemIsWritableEntryFunction : public SyncExtensionFunction { class FileSystemChooseEntryFunction : public FileSystemEntryFunction { public: // Allow picker UI to be skipped in testing. - static void SkipPickerAndAlwaysSelectPathForTest(FilePath* path); + static void SkipPickerAndAlwaysSelectPathForTest(base::FilePath* path); static void SkipPickerAndAlwaysCancelForTest(); static void StopSkippingPickerForTest(); @@ -81,26 +81,26 @@ class FileSystemChooseEntryFunction : public FileSystemEntryFunction { static void BuildFileTypeInfo( ui::SelectFileDialog::FileTypeInfo* file_type_info, - const FilePath::StringType& suggested_extension, + const base::FilePath::StringType& suggested_extension, const AcceptOptions* accepts, const bool* acceptsAllTypes); static void BuildSuggestion(const std::string* opt_name, - FilePath* suggested_name, - FilePath::StringType* suggested_extension); + base::FilePath* suggested_name, + base::FilePath::StringType* suggested_extension); protected: class FilePicker; virtual ~FileSystemChooseEntryFunction() {} virtual bool RunImpl() OVERRIDE; - bool ShowPicker(const FilePath& suggested_path, + bool ShowPicker(const base::FilePath& suggested_path, const ui::SelectFileDialog::FileTypeInfo& file_type_info, ui::SelectFileDialog::Type picker_type, EntryType entry_type); private: // FileSelected and FileSelectionCanceled are called by the file picker. - void FileSelected(const FilePath& path, EntryType entry_type); + void FileSelected(const base::FilePath& path, EntryType entry_type); void FileSelectionCanceled(); }; diff --git a/chrome/browser/extensions/api/file_system/file_system_api_unittest.cc b/chrome/browser/extensions/api/file_system/file_system_api_unittest.cc index f411160..b008b9f 100644 --- a/chrome/browser/extensions/api/file_system/file_system_api_unittest.cc +++ b/chrome/browser/extensions/api/file_system/file_system_api_unittest.cc @@ -15,8 +15,8 @@ using extensions::api::file_system::AcceptOption; namespace { -void CheckExtensions(std::vector<FilePath::StringType>& expected, - std::vector<FilePath::StringType>& actual) { +void CheckExtensions(std::vector<base::FilePath::StringType>& expected, + std::vector<base::FilePath::StringType>& actual) { EXPECT_EQ(expected.size(), actual.size()); if (expected.size() != actual.size()) return; @@ -63,7 +63,7 @@ TEST_F(FileSystemApiUnitTest, FileSystemChooseEntryFunctionFileTypeInfoTest) { ui::SelectFileDialog::FileTypeInfo file_type_info; bool acceptsAllTypes = false; FileSystemChooseEntryFunction::BuildFileTypeInfo(&file_type_info, - FilePath::StringType(), NULL, &acceptsAllTypes); + base::FilePath::StringType(), NULL, &acceptsAllTypes); EXPECT_TRUE(file_type_info.include_all_files); EXPECT_TRUE(file_type_info.extensions.empty()); @@ -74,14 +74,14 @@ TEST_F(FileSystemApiUnitTest, FileSystemChooseEntryFunctionFileTypeInfoTest) { BuildAcceptOption("", "application/x-chrome-extension", "jso"))); acceptsAllTypes = false; FileSystemChooseEntryFunction::BuildFileTypeInfo(&file_type_info, - FilePath::StringType(), &options, &acceptsAllTypes); + base::FilePath::StringType(), &options, &acceptsAllTypes); EXPECT_FALSE(file_type_info.include_all_files); ASSERT_EQ(file_type_info.extensions.size(), (size_t) 1); EXPECT_TRUE(file_type_info.extension_description_overrides[0].empty()) << "No override must be specified for boring accept types"; // Note here (and below) that the expectedTypes are sorted, because we use a // set internally to generate the output: thus, the output is sorted. - std::vector<FilePath::StringType> expectedTypes; + std::vector<base::FilePath::StringType> expectedTypes; expectedTypes.push_back(ToStringType("crx")); expectedTypes.push_back(ToStringType("jso")); CheckExtensions(expectedTypes, file_type_info.extensions[0]); @@ -105,7 +105,7 @@ TEST_F(FileSystemApiUnitTest, FileSystemChooseEntryFunctionFileTypeInfoTest) { BuildAcceptOption("", "", "cpp,cc"))); acceptsAllTypes = false; FileSystemChooseEntryFunction::BuildFileTypeInfo(&file_type_info, - FilePath::StringType(), &options, &acceptsAllTypes); + base::FilePath::StringType(), &options, &acceptsAllTypes); ASSERT_EQ(file_type_info.extensions.size(), options.size()); expectedTypes.clear(); @@ -125,7 +125,7 @@ TEST_F(FileSystemApiUnitTest, FileSystemChooseEntryFunctionFileTypeInfoTest) { BuildAcceptOption("", "image/*", "html"))); acceptsAllTypes = false; FileSystemChooseEntryFunction::BuildFileTypeInfo(&file_type_info, - FilePath::StringType(), &options, &acceptsAllTypes); + base::FilePath::StringType(), &options, &acceptsAllTypes); ASSERT_EQ(file_type_info.extension_description_overrides.size(), (size_t) 1); EXPECT_FALSE(file_type_info.extension_description_overrides[0].empty()) << "Accept type \"image/*\" must generate description override"; @@ -138,7 +138,7 @@ TEST_F(FileSystemApiUnitTest, FileSystemChooseEntryFunctionFileTypeInfoTest) { BuildAcceptOption("", "image/*,audio/*,video/*", ""))); acceptsAllTypes = false; FileSystemChooseEntryFunction::BuildFileTypeInfo(&file_type_info, - FilePath::StringType(), &options, &acceptsAllTypes); + base::FilePath::StringType(), &options, &acceptsAllTypes); ASSERT_EQ(file_type_info.extension_description_overrides.size(), (size_t) 1); EXPECT_TRUE(file_type_info.extension_description_overrides[0].empty()); @@ -149,15 +149,15 @@ TEST_F(FileSystemApiUnitTest, FileSystemChooseEntryFunctionFileTypeInfoTest) { BuildAcceptOption("File Types 101", "image/jpeg", ""))); acceptsAllTypes = false; FileSystemChooseEntryFunction::BuildFileTypeInfo(&file_type_info, - FilePath::StringType(), &options, &acceptsAllTypes); + base::FilePath::StringType(), &options, &acceptsAllTypes); EXPECT_EQ(file_type_info.extension_description_overrides[0], UTF8ToUTF16("File Types 101")); } TEST_F(FileSystemApiUnitTest, FileSystemChooseEntryFunctionSuggestionTest) { std::string opt_name; - FilePath suggested_name; - FilePath::StringType suggested_extension; + base::FilePath suggested_name; + base::FilePath::StringType suggested_extension; opt_name = std::string("normal_path.txt"); FileSystemChooseEntryFunction::BuildSuggestion(&opt_name, &suggested_name, diff --git a/chrome/browser/extensions/api/file_system/file_system_apitest.cc b/chrome/browser/extensions/api/file_system/file_system_apitest.cc index 8ce4cec..fd2a4db 100644 --- a/chrome/browser/extensions/api/file_system/file_system_apitest.cc +++ b/chrome/browser/extensions/api/file_system/file_system_apitest.cc @@ -23,25 +23,26 @@ class FileSystemApiTest : public extensions::PlatformAppBrowserTest { }; protected: - FilePath TempFilePath(const std::string& destination_name, bool copy_gold) { + base::FilePath TempFilePath(const std::string& destination_name, + bool copy_gold) { if (!temp_dir_.CreateUniqueTempDir()) { ADD_FAILURE() << "CreateUniqueTempDir failed"; - return FilePath(); + return base::FilePath(); } - FilePath destination = temp_dir_.path().AppendASCII(destination_name); + base::FilePath destination = temp_dir_.path().AppendASCII(destination_name); if (copy_gold) { - FilePath source = test_root_folder_.AppendASCII("gold.txt"); + base::FilePath source = test_root_folder_.AppendASCII("gold.txt"); EXPECT_TRUE(file_util::CopyFile(source, destination)); } return destination; } - FilePath test_root_folder_; + base::FilePath test_root_folder_; base::ScopedTempDir temp_dir_; }; IN_PROC_BROWSER_TEST_F(FileSystemApiTest, FileSystemApiGetDisplayPath) { - FilePath test_file = test_root_folder_.AppendASCII("gold.txt"); + base::FilePath test_file = test_root_folder_.AppendASCII("gold.txt"); FileSystemChooseEntryFunction::SkipPickerAndAlwaysSelectPathForTest( &test_file); ASSERT_TRUE(RunPlatformAppTest("api_test/file_system/get_display_path")) @@ -58,7 +59,7 @@ IN_PROC_BROWSER_TEST_F(FileSystemApiTest, FileSystemApiGetDisplayPathPrettify) { ASSERT_TRUE(PathService::OverrideAndCreateIfNeeded(override, test_root_folder_, false)); - FilePath test_file = test_root_folder_.AppendASCII("gold.txt"); + base::FilePath test_file = test_root_folder_.AppendASCII("gold.txt"); FileSystemChooseEntryFunction::SkipPickerAndAlwaysSelectPathForTest( &test_file); ASSERT_TRUE(RunPlatformAppTest( @@ -70,11 +71,11 @@ IN_PROC_BROWSER_TEST_F(FileSystemApiTest, FileSystemApiGetDisplayPathPrettify) { IN_PROC_BROWSER_TEST_F(FileSystemApiTest, FileSystemApiGetDisplayPathPrettifyMac) { // On Mac, "test.localized" will be localized into just "test". - FilePath test_path = TempFilePath("test.localized", false); + base::FilePath test_path = TempFilePath("test.localized", false); ASSERT_TRUE(file_util::CreateDirectory(test_path)); - FilePath test_file = test_path.AppendASCII("gold.txt"); - FilePath source = test_root_folder_.AppendASCII("gold.txt"); + base::FilePath test_file = test_path.AppendASCII("gold.txt"); + base::FilePath source = test_root_folder_.AppendASCII("gold.txt"); EXPECT_TRUE(file_util::CopyFile(source, test_file)); FileSystemChooseEntryFunction::SkipPickerAndAlwaysSelectPathForTest( @@ -85,7 +86,7 @@ IN_PROC_BROWSER_TEST_F(FileSystemApiTest, #endif IN_PROC_BROWSER_TEST_F(FileSystemApiTest, FileSystemApiOpenExistingFileTest) { - FilePath test_file = TempFilePath("open_existing.txt", true); + base::FilePath test_file = TempFilePath("open_existing.txt", true); ASSERT_FALSE(test_file.empty()); FileSystemChooseEntryFunction::SkipPickerAndAlwaysSelectPathForTest( &test_file); @@ -95,7 +96,7 @@ IN_PROC_BROWSER_TEST_F(FileSystemApiTest, FileSystemApiOpenExistingFileTest) { IN_PROC_BROWSER_TEST_F(FileSystemApiTest, FileSystemApiInvalidChooseEntryTypeTest) { - FilePath test_file = TempFilePath("open_existing.txt", true); + base::FilePath test_file = TempFilePath("open_existing.txt", true); ASSERT_FALSE(test_file.empty()); FileSystemChooseEntryFunction::SkipPickerAndAlwaysSelectPathForTest( &test_file); @@ -105,7 +106,7 @@ IN_PROC_BROWSER_TEST_F(FileSystemApiTest, IN_PROC_BROWSER_TEST_F(FileSystemApiTest, FileSystemApiOpenExistingFileWithWriteTest) { - FilePath test_file = TempFilePath("open_existing.txt", true); + base::FilePath test_file = TempFilePath("open_existing.txt", true); ASSERT_FALSE(test_file.empty()); FileSystemChooseEntryFunction::SkipPickerAndAlwaysSelectPathForTest( &test_file); @@ -115,7 +116,7 @@ IN_PROC_BROWSER_TEST_F(FileSystemApiTest, IN_PROC_BROWSER_TEST_F(FileSystemApiTest, FileSystemApiOpenWritableExistingFileTest) { - FilePath test_file = TempFilePath("open_existing.txt", true); + base::FilePath test_file = TempFilePath("open_existing.txt", true); ASSERT_FALSE(test_file.empty()); FileSystemChooseEntryFunction::SkipPickerAndAlwaysSelectPathForTest( &test_file); @@ -125,7 +126,7 @@ IN_PROC_BROWSER_TEST_F(FileSystemApiTest, IN_PROC_BROWSER_TEST_F(FileSystemApiTest, FileSystemApiOpenWritableExistingFileWithWriteTest) { - FilePath test_file = TempFilePath("open_existing.txt", true); + base::FilePath test_file = TempFilePath("open_existing.txt", true); ASSERT_FALSE(test_file.empty()); FileSystemChooseEntryFunction::SkipPickerAndAlwaysSelectPathForTest( &test_file); @@ -145,7 +146,7 @@ IN_PROC_BROWSER_TEST_F(FileSystemApiTest, FileSystemApiOpenBackgroundTest) { } IN_PROC_BROWSER_TEST_F(FileSystemApiTest, FileSystemApiSaveNewFileTest) { - FilePath test_file = TempFilePath("save_new.txt", false); + base::FilePath test_file = TempFilePath("save_new.txt", false); ASSERT_FALSE(test_file.empty()); FileSystemChooseEntryFunction::SkipPickerAndAlwaysSelectPathForTest( &test_file); @@ -154,7 +155,7 @@ IN_PROC_BROWSER_TEST_F(FileSystemApiTest, FileSystemApiSaveNewFileTest) { } IN_PROC_BROWSER_TEST_F(FileSystemApiTest, FileSystemApiSaveExistingFileTest) { - FilePath test_file = TempFilePath("save_existing.txt", true); + base::FilePath test_file = TempFilePath("save_existing.txt", true); ASSERT_FALSE(test_file.empty()); FileSystemChooseEntryFunction::SkipPickerAndAlwaysSelectPathForTest( &test_file); @@ -164,7 +165,7 @@ IN_PROC_BROWSER_TEST_F(FileSystemApiTest, FileSystemApiSaveExistingFileTest) { IN_PROC_BROWSER_TEST_F(FileSystemApiTest, FileSystemApiSaveNewFileWithWriteTest) { - FilePath test_file = TempFilePath("save_new.txt", false); + base::FilePath test_file = TempFilePath("save_new.txt", false); ASSERT_FALSE(test_file.empty()); FileSystemChooseEntryFunction::SkipPickerAndAlwaysSelectPathForTest( &test_file); @@ -174,7 +175,7 @@ IN_PROC_BROWSER_TEST_F(FileSystemApiTest, IN_PROC_BROWSER_TEST_F(FileSystemApiTest, FileSystemApiSaveExistingFileWithWriteTest) { - FilePath test_file = TempFilePath("save_existing.txt", true); + base::FilePath test_file = TempFilePath("save_existing.txt", true); ASSERT_FALSE(test_file.empty()); FileSystemChooseEntryFunction::SkipPickerAndAlwaysSelectPathForTest( &test_file); @@ -194,7 +195,7 @@ IN_PROC_BROWSER_TEST_F(FileSystemApiTest, FileSystemApiSaveBackgroundTest) { } IN_PROC_BROWSER_TEST_F(FileSystemApiTest, FileSystemApiGetWritableTest) { - FilePath test_file = TempFilePath("writable.txt", true); + base::FilePath test_file = TempFilePath("writable.txt", true); ASSERT_FALSE(test_file.empty()); FileSystemChooseEntryFunction::SkipPickerAndAlwaysSelectPathForTest( &test_file); @@ -204,7 +205,7 @@ IN_PROC_BROWSER_TEST_F(FileSystemApiTest, FileSystemApiGetWritableTest) { IN_PROC_BROWSER_TEST_F(FileSystemApiTest, FileSystemApiGetWritableWithWriteTest) { - FilePath test_file = TempFilePath("writable.txt", true); + base::FilePath test_file = TempFilePath("writable.txt", true); ASSERT_FALSE(test_file.empty()); FileSystemChooseEntryFunction::SkipPickerAndAlwaysSelectPathForTest( &test_file); @@ -213,7 +214,7 @@ IN_PROC_BROWSER_TEST_F(FileSystemApiTest, } IN_PROC_BROWSER_TEST_F(FileSystemApiTest, FileSystemApiIsWritableTest) { - FilePath test_file = TempFilePath("writable.txt", true); + base::FilePath test_file = TempFilePath("writable.txt", true); ASSERT_FALSE(test_file.empty()); FileSystemChooseEntryFunction::SkipPickerAndAlwaysSelectPathForTest( &test_file); @@ -222,7 +223,7 @@ IN_PROC_BROWSER_TEST_F(FileSystemApiTest, FileSystemApiIsWritableTest) { } IN_PROC_BROWSER_TEST_F(FileSystemApiTest, FileSystemApiGetEntryId) { - FilePath test_file = TempFilePath("writable.txt", true); + base::FilePath test_file = TempFilePath("writable.txt", true); ASSERT_FALSE(test_file.empty()); FileSystemChooseEntryFunction::SkipPickerAndAlwaysSelectPathForTest( &test_file); diff --git a/chrome/browser/extensions/api/managed_mode/managed_mode_apitest.cc b/chrome/browser/extensions/api/managed_mode/managed_mode_apitest.cc index 638a88a..f7c6e0a 100644 --- a/chrome/browser/extensions/api/managed_mode/managed_mode_apitest.cc +++ b/chrome/browser/extensions/api/managed_mode/managed_mode_apitest.cc @@ -24,7 +24,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionApiTest, ManagedModeOnChange) { // We can't just call RunComponentExtension() like above, because we need to // fire the event while the page is waiting. - FilePath extension_path = + base::FilePath extension_path = test_data_dir_.AppendASCII("managed_mode/on_change"); const extensions::Extension* extension = LoadExtensionAsComponent(extension_path); diff --git a/chrome/browser/extensions/api/management/management_api.cc b/chrome/browser/extensions/api/management/management_api.cc index 5308e7a..18aa8cd 100644 --- a/chrome/browser/extensions/api/management/management_api.cc +++ b/chrome/browser/extensions/api/management/management_api.cc @@ -382,7 +382,7 @@ void ManagementGetPermissionWarningsByManifestFunction::OnParseSuccess( CHECK(parsed_manifest); scoped_refptr<Extension> extension = Extension::Create( - FilePath(), Manifest::INVALID_LOCATION, *parsed_manifest, + base::FilePath(), Manifest::INVALID_LOCATION, *parsed_manifest, Extension::NO_FLAGS, &error_); if (!extension.get()) { OnParseFailure(keys::kExtensionCreateError); diff --git a/chrome/browser/extensions/api/management/management_api_browsertest.cc b/chrome/browser/extensions/api/management/management_api_browsertest.cc index 3250a3b..aa4da64 100644 --- a/chrome/browser/extensions/api/management/management_api_browsertest.cc +++ b/chrome/browser/extensions/api/management/management_api_browsertest.cc @@ -171,18 +171,18 @@ class ExtensionManagementApiEscalationTest : virtual void SetUpOnMainThread() OVERRIDE { EXPECT_TRUE(scoped_temp_dir_.CreateUniqueTempDir()); - FilePath pem_path = test_data_dir_. + base::FilePath pem_path = test_data_dir_. AppendASCII("permissions_increase").AppendASCII("permissions.pem"); - FilePath path_v1 = PackExtensionWithOptions( + base::FilePath path_v1 = PackExtensionWithOptions( test_data_dir_.AppendASCII("permissions_increase").AppendASCII("v1"), scoped_temp_dir_.path().AppendASCII("permissions1.crx"), pem_path, - FilePath()); - FilePath path_v2 = PackExtensionWithOptions( + base::FilePath()); + base::FilePath path_v2 = PackExtensionWithOptions( test_data_dir_.AppendASCII("permissions_increase").AppendASCII("v2"), scoped_temp_dir_.path().AppendASCII("permissions2.crx"), pem_path, - FilePath()); + base::FilePath()); ExtensionService* service = ExtensionSystem::Get(browser()->profile())-> extension_service(); diff --git a/chrome/browser/extensions/api/management/management_apitest.cc b/chrome/browser/extensions/api/management/management_apitest.cc index 6243f9a..707ef65 100644 --- a/chrome/browser/extensions/api/management/management_apitest.cc +++ b/chrome/browser/extensions/api/management/management_apitest.cc @@ -48,7 +48,7 @@ class ExtensionManagementApiTest : public ExtensionApiTest { } virtual void LoadExtensions() { - FilePath basedir = test_data_dir_.AppendASCII("management"); + base::FilePath basedir = test_data_dir_.AppendASCII("management"); // Load 4 enabled items. LoadNamedExtension(basedir, "enabled_extension"); @@ -77,14 +77,14 @@ class ExtensionManagementApiTest : public ExtensionApiTest { } protected: - void LoadNamedExtension(const FilePath& path, + void LoadNamedExtension(const base::FilePath& path, const std::string& name) { const Extension* extension = LoadExtension(path.AppendASCII(name)); ASSERT_TRUE(extension); extension_ids_[name] = extension->id(); } - void InstallNamedExtension(const FilePath& path, + void InstallNamedExtension(const base::FilePath& path, const std::string& name, Manifest::Location install_source) { const Extension* extension = InstallExtension(path.AppendASCII(name), 1, @@ -100,7 +100,7 @@ class ExtensionManagementApiTest : public ExtensionApiTest { IN_PROC_BROWSER_TEST_F(ExtensionManagementApiTest, Basics) { LoadExtensions(); - FilePath basedir = test_data_dir_.AppendASCII("management"); + base::FilePath basedir = test_data_dir_.AppendASCII("management"); InstallNamedExtension(basedir, "internal_extension", Manifest::INTERNAL); InstallNamedExtension(basedir, "external_extension", Manifest::EXTERNAL_PREF); diff --git a/chrome/browser/extensions/api/management/management_browsertest.cc b/chrome/browser/extensions/api/management/management_browsertest.cc index 2fa3a91..55cc2c3 100644 --- a/chrome/browser/extensions/api/management/management_browsertest.cc +++ b/chrome/browser/extensions/api/management/management_browsertest.cc @@ -81,14 +81,14 @@ IN_PROC_BROWSER_TEST_F(ExtensionManagementTest, MAYBE_InstallSameVersion) { const Extension* extension = InstallExtension( test_data_dir_.AppendASCII("install/install.crx"), 1); ASSERT_TRUE(extension); - FilePath old_path = extension->path(); + base::FilePath old_path = extension->path(); // Install an extension with the same version. The previous install should be // overwritten. extension = InstallExtension( test_data_dir_.AppendASCII("install/install_same_version.crx"), 0); ASSERT_TRUE(extension); - FilePath new_path = extension->path(); + base::FilePath new_path = extension->path(); EXPECT_FALSE(IsExtensionAtVersion(extension, "1.0")); EXPECT_NE(old_path.value(), new_path.value()); @@ -248,7 +248,7 @@ class NotificationListener : public content::NotificationObserver { // Tests extension autoupdate. IN_PROC_BROWSER_TEST_F(ExtensionManagementTest, MAYBE_AutoUpdate) { NotificationListener notification_listener; - FilePath basedir = test_data_dir_.AppendASCII("autoupdate"); + base::FilePath basedir = test_data_dir_.AppendASCII("autoupdate"); // Note: This interceptor gets requests on the IO thread. content::URLRequestPrepackagedInterceptor interceptor; net::URLFetcher::SetEnableInterceptionForTests(true); @@ -334,7 +334,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionManagementTest, MAYBE_AutoUpdate) { IN_PROC_BROWSER_TEST_F(ExtensionManagementTest, MAYBE_AutoUpdateDisabledExtensions) { NotificationListener notification_listener; - FilePath basedir = test_data_dir_.AppendASCII("autoupdate"); + base::FilePath basedir = test_data_dir_.AppendASCII("autoupdate"); // Note: This interceptor gets requests on the IO thread. content::URLRequestPrepackagedInterceptor interceptor; net::URLFetcher::SetEnableInterceptionForTests(true); @@ -409,7 +409,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionManagementTest, MAYBE_ExternalUrlUpdate) { extensions::ExtensionUpdater::CheckParams params; params.check_blacklist = false; - FilePath basedir = test_data_dir_.AppendASCII("autoupdate"); + base::FilePath basedir = test_data_dir_.AppendASCII("autoupdate"); // Note: This interceptor gets requests on the IO thread. content::URLRequestPrepackagedInterceptor interceptor; @@ -495,7 +495,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionManagementTest, ExternalPolicyRefresh) { extensions::ExtensionUpdater::CheckParams params; params.check_blacklist = false; - FilePath basedir = test_data_dir_.AppendASCII("autoupdate"); + base::FilePath basedir = test_data_dir_.AppendASCII("autoupdate"); // Note: This interceptor gets requests on the IO thread. content::URLRequestPrepackagedInterceptor interceptor; @@ -569,7 +569,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionManagementTest, params.check_blacklist = false; service->updater()->set_default_check_params(params); const size_t size_before = service->extensions()->size(); - FilePath basedir = test_data_dir_.AppendASCII("autoupdate"); + base::FilePath basedir = test_data_dir_.AppendASCII("autoupdate"); ASSERT_TRUE(service->disabled_extensions()->is_empty()); // Note: This interceptor gets requests on the IO thread. diff --git a/chrome/browser/extensions/api/media_galleries_private/media_galleries_private_apitest.cc b/chrome/browser/extensions/api/media_galleries_private/media_galleries_private_apitest.cc index 24c2a95..7587f2c 100644 --- a/chrome/browser/extensions/api/media_galleries_private/media_galleries_private_apitest.cc +++ b/chrome/browser/extensions/api/media_galleries_private/media_galleries_private_apitest.cc @@ -48,7 +48,7 @@ const char kDetachTestOk[] = "detach_test_ok"; // Dummy device properties. const char kDeviceId[] = "testDeviceId"; const char kDeviceName[] = "foobar"; -FilePath::CharType kDevicePath[] = FILE_PATH_LITERAL("/qux"); +base::FilePath::CharType kDevicePath[] = FILE_PATH_LITERAL("/qux"); } // namespace diff --git a/chrome/browser/extensions/api/media_galleries_private/media_galleries_watch_apitest.cc b/chrome/browser/extensions/api/media_galleries_private/media_galleries_watch_apitest.cc index c205b89..d116461 100644 --- a/chrome/browser/extensions/api/media_galleries_private/media_galleries_watch_apitest.cc +++ b/chrome/browser/extensions/api/media_galleries_private/media_galleries_watch_apitest.cc @@ -91,10 +91,10 @@ class MediaGalleriesPrivateGalleryWatchApiTest : public ExtensionApiTest { (gallery_directory_key != chrome::DIR_USER_VIDEOS)) return false; - FilePath gallery_dir; + base::FilePath gallery_dir; if (!PathService::Get(gallery_directory_key, &gallery_dir)) return false; - FilePath gallery_file = + base::FilePath gallery_file = gallery_dir.Append(FILE_PATH_LITERAL("test1.txt")); std::string content("new content"); int write_size = file_util::WriteFile(gallery_file, content.c_str(), diff --git a/chrome/browser/extensions/api/messaging/native_message_process_host_unittest.cc b/chrome/browser/extensions/api/messaging/native_message_process_host_unittest.cc index 088715b..aa0ae5b 100644 --- a/chrome/browser/extensions/api/messaging/native_message_process_host_unittest.cc +++ b/chrome/browser/extensions/api/messaging/native_message_process_host_unittest.cc @@ -35,8 +35,8 @@ namespace { const char kTestMessage[] = "{\"text\": \"Hello.\"}"; -FilePath GetTestDir() { - FilePath test_dir; +base::FilePath GetTestDir() { + base::FilePath test_dir; PathService::Get(chrome::DIR_TEST_DATA, &test_dir); test_dir = test_dir.AppendASCII("native_messaging"); return test_dir; @@ -48,7 +48,7 @@ namespace extensions { class FakeLauncher : public NativeProcessLauncher { public: - FakeLauncher(FilePath read_file, FilePath write_file) { + FakeLauncher(base::FilePath read_file, base::FilePath write_file) { read_file_ = base::CreatePlatformFile( read_file, base::PLATFORM_FILE_OPEN | base::PLATFORM_FILE_READ | @@ -122,8 +122,8 @@ class NativeMessagingTest : public ::testing::Test, pickle.payload_size()); } - FilePath CreateTempFileWithMessage(const std::string& message) { - FilePath filename = temp_dir_.path().AppendASCII("input"); + base::FilePath CreateTempFileWithMessage(const std::string& message) { + base::FilePath filename = temp_dir_.path().AppendASCII("input"); file_util::CreateTemporaryFile(&filename); std::string message_with_header = FormatMessage(message); EXPECT_TRUE(file_util::WriteFile( @@ -135,7 +135,7 @@ class NativeMessagingTest : public ::testing::Test, base::ScopedTempDir temp_dir_; Feature::ScopedCurrentChannel current_channel_; scoped_ptr<NativeMessageProcessHost> native_message_process_host_; - FilePath user_data_dir_; + base::FilePath user_data_dir_; MessageLoopForIO message_loop_; base::RunLoop read_message_run_loop_; scoped_ptr<content::TestBrowserThread> ui_thread_; @@ -145,8 +145,8 @@ class NativeMessagingTest : public ::testing::Test, // Read a single message from a local file. TEST_F(NativeMessagingTest, SingleSendMessageRead) { - FilePath temp_output_file = temp_dir_.path().AppendASCII("output"); - FilePath temp_input_file = CreateTempFileWithMessage(kTestMessage); + base::FilePath temp_output_file = temp_dir_.path().AppendASCII("output"); + base::FilePath temp_input_file = CreateTempFileWithMessage(kTestMessage); scoped_ptr<NativeProcessLauncher> launcher( new FakeLauncher(temp_input_file, temp_output_file)); @@ -163,8 +163,8 @@ TEST_F(NativeMessagingTest, SingleSendMessageRead) { // Tests sending a single message. The message should get written to // |temp_file| and should match the contents of single_message_request.msg. TEST_F(NativeMessagingTest, SingleSendMessageWrite) { - FilePath temp_output_file = temp_dir_.path().AppendASCII("output"); - FilePath temp_input_file = CreateTempFileWithMessage(std::string()); + base::FilePath temp_output_file = temp_dir_.path().AppendASCII("output"); + base::FilePath temp_input_file = CreateTempFileWithMessage(std::string()); scoped_ptr<NativeProcessLauncher> launcher( new FakeLauncher(temp_input_file, temp_output_file)); diff --git a/chrome/browser/extensions/api/messaging/native_messaging_apitest_posix.cc b/chrome/browser/extensions/api/messaging/native_messaging_apitest_posix.cc index dd17239..6450b78 100644 --- a/chrome/browser/extensions/api/messaging/native_messaging_apitest_posix.cc +++ b/chrome/browser/extensions/api/messaging/native_messaging_apitest_posix.cc @@ -17,7 +17,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionApiTest, NativeMessageBasic) { // Override the user data dir to point to our native app. extensions::Feature::ScopedCurrentChannel current_channel(chrome::VersionInfo::CHANNEL_DEV); - FilePath test_user_data_dir; + base::FilePath test_user_data_dir; ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &test_user_data_dir)); test_user_data_dir = test_user_data_dir.AppendASCII("native_messaging"); ASSERT_TRUE(PathService::Override(chrome::DIR_USER_DATA, test_user_data_dir)); diff --git a/chrome/browser/extensions/api/messaging/native_process_launcher.cc b/chrome/browser/extensions/api/messaging/native_process_launcher.cc index 0f1b5be..ce223ae 100644 --- a/chrome/browser/extensions/api/messaging/native_process_launcher.cc +++ b/chrome/browser/extensions/api/messaging/native_process_launcher.cc @@ -81,8 +81,8 @@ void NativeProcessLauncherImpl::Core::DoLaunchOnThreadPool( LaunchedCallback callback) { DCHECK(content::BrowserThread::GetBlockingPool()->RunsTasksOnCurrentThread()); - FilePath native_host_program; - FilePath native_host_registry; + base::FilePath native_host_program; + base::FilePath native_host_registry; CHECK(PathService::Get(chrome::DIR_USER_DATA, &native_host_registry)); native_host_registry = native_host_registry.AppendASCII(kNativeHostsDirectoryName); diff --git a/chrome/browser/extensions/api/messaging/native_process_launcher_posix.cc b/chrome/browser/extensions/api/messaging/native_process_launcher_posix.cc index 60a5afe..6297271 100644 --- a/chrome/browser/extensions/api/messaging/native_process_launcher_posix.cc +++ b/chrome/browser/extensions/api/messaging/native_process_launcher_posix.cc @@ -14,7 +14,7 @@ namespace extensions { // static bool NativeProcessLauncher::LaunchNativeProcess( - const FilePath& path, + const base::FilePath& path, base::ProcessHandle* native_process_handle, base::PlatformFile* read_file, base::PlatformFile* write_file) { diff --git a/chrome/browser/extensions/api/messaging/native_process_launcher_win.cc b/chrome/browser/extensions/api/messaging/native_process_launcher_win.cc index c373d42..5a0d9c9 100644 --- a/chrome/browser/extensions/api/messaging/native_process_launcher_win.cc +++ b/chrome/browser/extensions/api/messaging/native_process_launcher_win.cc @@ -15,7 +15,7 @@ namespace extensions { // static bool NativeProcessLauncher::LaunchNativeProcess( - const FilePath& path, + const base::FilePath& path, base::ProcessHandle* native_process_handle, base::PlatformFile* read_file, base::PlatformFile* write_file) { diff --git a/chrome/browser/extensions/api/page_capture/page_capture_api.cc b/chrome/browser/extensions/api/page_capture/page_capture_api.cc index 172e931..c72206b 100644 --- a/chrome/browser/extensions/api/page_capture/page_capture_api.cc +++ b/chrome/browser/extensions/api/page_capture/page_capture_api.cc @@ -134,8 +134,9 @@ void PageCaptureSaveAsMHTMLFunction::TemporaryFileCreated(bool success) { base::Bind(&PageCaptureSaveAsMHTMLFunction::MHTMLGenerated, this)); } -void PageCaptureSaveAsMHTMLFunction::MHTMLGenerated(const FilePath& file_path, - int64 mhtml_file_size) { +void PageCaptureSaveAsMHTMLFunction::MHTMLGenerated( + const base::FilePath& file_path, + int64 mhtml_file_size) { DCHECK(mhtml_path_ == file_path); if (mhtml_file_size <= 0) { ReturnFailure(kMHTMLGenerationFailedError); diff --git a/chrome/browser/extensions/api/page_capture/page_capture_apitest.cc b/chrome/browser/extensions/api/page_capture/page_capture_apitest.cc index 78bff7e..e0a7ad8 100644 --- a/chrome/browser/extensions/api/page_capture/page_capture_apitest.cc +++ b/chrome/browser/extensions/api/page_capture/page_capture_apitest.cc @@ -46,11 +46,12 @@ class PageCaptureSaveAsMHTMLDelegate PageCaptureSaveAsMHTMLFunction::SetTestDelegate(NULL); } - virtual void OnTemporaryFileCreated(const FilePath& temp_file) OVERRIDE { + virtual void OnTemporaryFileCreated( + const base::FilePath& temp_file) OVERRIDE { temp_file_ = temp_file; } - FilePath temp_file_; + base::FilePath temp_file_; }; IN_PROC_BROWSER_TEST_F(ExtensionPageCaptureApiTest, MAYBE_SaveAsMHTML) { diff --git a/chrome/browser/extensions/api/preference/preference_apitest.cc b/chrome/browser/extensions/api/preference/preference_apitest.cc index 8b63e9c..d9cd21a 100644 --- a/chrome/browser/extensions/api/preference/preference_apitest.cc +++ b/chrome/browser/extensions/api/preference/preference_apitest.cc @@ -178,7 +178,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionApiTest, PreferenceOnChangeSplit) { ExtensionTestMessageListener listener_incognito10( "clearDefault incognito ready", true); - FilePath extension_data_dir = + base::FilePath extension_data_dir = test_data_dir_.AppendASCII("preference").AppendASCII("onchange_split"); ASSERT_TRUE(LoadExtensionIncognito(extension_data_dir)); diff --git a/chrome/browser/extensions/api/record/record_api.cc b/chrome/browser/extensions/api/record/record_api.cc index 7b12f69..ac2a992 100644 --- a/chrome/browser/extensions/api/record/record_api.cc +++ b/chrome/browser/extensions/api/record/record_api.cc @@ -108,7 +108,7 @@ void RunPageCyclerFunction::RunTestBrowser() { // Create and fill a temp file to communicate the URL list to the test // browser. - FilePath url_path; + base::FilePath url_path; file_util::CreateTemporaryFile(&url_path); file_util::WriteFile(url_path, url_contents_.c_str(), url_contents_.size()); line.AppendSwitchPath(switches::kVisitURLs, url_path); @@ -116,9 +116,9 @@ void RunPageCyclerFunction::RunTestBrowser() { // Set up Capture- or Replay-specific commandline switches. AddSwitches(&line); - FilePath error_file_path = url_path.DirName(). + base::FilePath error_file_path = url_path.DirName(). Append(url_path.BaseName().value() + - FilePath::StringType(kURLErrorsSuffix)); + base::FilePath::StringType(kURLErrorsSuffix)); LOG(ERROR) << "Test browser commandline: " << line.GetCommandLineString() << " will be repeated " << repeat_count_ << " times...."; @@ -169,7 +169,7 @@ bool RecordCaptureURLsFunction::ParseJSParameters() { url_contents_ = JoinString(params->urls, '\n'); // TODO(cstaley): Can't just use captureName -- gotta stick it in a temp dir. // TODO(cstaley): Ensure that capture name is suitable as directory name. - user_data_dir_ = FilePath::FromUTF8Unsafe(params->capture_name); + user_data_dir_ = base::FilePath::FromUTF8Unsafe(params->capture_name); return true; } @@ -208,7 +208,7 @@ bool RecordReplayURLsFunction::ParseJSParameters() { // TODO(cstaley): Must build full temp dir from capture_name - user_data_dir_ = FilePath::FromUTF8Unsafe(params->capture_name); + user_data_dir_ = base::FilePath::FromUTF8Unsafe(params->capture_name); // TODO(cstaley): Get this from user data dir ultimately url_contents_ = "http://www.google.com\nhttp://www.amazon.com"; @@ -218,7 +218,7 @@ bool RecordReplayURLsFunction::ParseJSParameters() { if (params->details.get()) { if (params->details->extension_path.get()) extension_path_ = - FilePath::FromUTF8Unsafe(*params->details->extension_path); + base::FilePath::FromUTF8Unsafe(*params->details->extension_path); } return true; diff --git a/chrome/browser/extensions/api/record/record_api.h b/chrome/browser/extensions/api/record/record_api.h index 3911b12..6c8b62f 100644 --- a/chrome/browser/extensions/api/record/record_api.h +++ b/chrome/browser/extensions/api/record/record_api.h @@ -12,7 +12,8 @@ namespace { -const FilePath::CharType kURLErrorsSuffix[] = FILE_PATH_LITERAL(".errors"); +const base::FilePath::CharType kURLErrorsSuffix[] = + FILE_PATH_LITERAL(".errors"); const char kErrorsKey[] = "errors"; const char kStatsKey[] = "stats"; @@ -93,7 +94,7 @@ class RunPageCyclerFunction : public AsyncExtensionFunction { // logic is in subclasses. virtual void Finish() {} - FilePath user_data_dir_; + base::FilePath user_data_dir_; std::string url_contents_; int repeat_count_; std::vector<std::string> errors_; @@ -151,8 +152,8 @@ class RecordReplayURLsFunction : public RunPageCyclerFunction { // These data are additional information added to the sub-browser // commandline or used to repeatedly run the sub-browser. - FilePath extension_path_; - FilePath stats_file_path_; + base::FilePath extension_path_; + base::FilePath stats_file_path_; // This time datum marks the start and end of the sub-browser run. base::Time timer_; diff --git a/chrome/browser/extensions/api/record/record_api_test.cc b/chrome/browser/extensions/api/record/record_api_test.cc index 5af4b93..03b905a 100644 --- a/chrome/browser/extensions/api/record/record_api_test.cc +++ b/chrome/browser/extensions/api/record/record_api_test.cc @@ -55,18 +55,19 @@ const char kCaptureArgs1[] = const char kPlaybackArgs1[] = "[\"%s\", 2, {\"extensionPath\": \"MockExtension\"}]"; -// Use this as the value of FilePath switches (e.g. user-data-dir) that +// Use this as the value of base::FilePath switches (e.g. user-data-dir) that // should be replaced by the record methods. -const FilePath::CharType kDummyDirName[] = FILE_PATH_LITERAL("ReplaceMe"); +const base::FilePath::CharType kDummyDirName[] = FILE_PATH_LITERAL("ReplaceMe"); // Use this as the filename for a mock "cache" file in the user-data-dir. -const FilePath::CharType kMockCacheFile[] = FILE_PATH_LITERAL("MockCache"); +const base::FilePath::CharType kMockCacheFile[] = + FILE_PATH_LITERAL("MockCache"); } class TestProcessStrategy : public ProcessStrategy { public: - explicit TestProcessStrategy(std::vector<FilePath>* temp_files) + explicit TestProcessStrategy(std::vector<base::FilePath>* temp_files) : command_line_(CommandLine::NO_PROGRAM), temp_files_(temp_files) {} virtual ~TestProcessStrategy() {} @@ -92,15 +93,15 @@ class TestProcessStrategy : public ProcessStrategy { visited_urls_.clear(); if (command_line.HasSwitch(switches::kVisitURLs)) { - FilePath url_path = + base::FilePath url_path = command_line.GetSwitchValuePath(switches::kVisitURLs); temp_files_->push_back(url_path); if (command_line.HasSwitch(switches::kRecordMode) || command_line.HasSwitch(switches::kPlaybackMode)) { - FilePath url_path_copy = command_line.GetSwitchValuePath( + base::FilePath url_path_copy = command_line.GetSwitchValuePath( switches::kUserDataDir).Append( - FilePath(FilePath::StringType(kMockCacheFile))); + base::FilePath(base::FilePath::StringType(kMockCacheFile))); if (command_line.HasSwitch(switches::kRecordMode)) { file_util::CopyFile(url_path, url_path_copy); @@ -129,9 +130,9 @@ class TestProcessStrategy : public ProcessStrategy { } if (!bad_urls.empty()) { - FilePath url_errors_path = url_path.DirName() + base::FilePath url_errors_path = url_path.DirName() .Append(url_path.BaseName().value() + - FilePath::StringType(kURLErrorsSuffix)); + base::FilePath::StringType(kURLErrorsSuffix)); std::string error_content = JoinString(bad_urls, '\n'); temp_files_->push_back(url_errors_path); file_util::WriteFile(url_errors_path, error_content.c_str(), @@ -140,7 +141,7 @@ class TestProcessStrategy : public ProcessStrategy { } if (command_line.HasSwitch(switches::kRecordStats)) { - FilePath record_stats_path(command_line.GetSwitchValuePath( + base::FilePath record_stats_path(command_line.GetSwitchValuePath( switches::kRecordStats)); temp_files_->push_back(record_stats_path); file_util::WriteFile(record_stats_path, kTestStatistics.c_str(), @@ -159,7 +160,7 @@ class TestProcessStrategy : public ProcessStrategy { private: CommandLine command_line_; std::vector<std::string> visited_urls_; - std::vector<FilePath>* temp_files_; + std::vector<base::FilePath>* temp_files_; }; class RecordApiTest : public InProcessBrowserTest { @@ -171,7 +172,7 @@ class RecordApiTest : public InProcessBrowserTest { // browser test. virtual void SetUp() OVERRIDE { InProcessBrowserTest::SetUp(); - if (!scoped_temp_user_data_dir_.Set(FilePath(kDummyDirName))) + if (!scoped_temp_user_data_dir_.Set(base::FilePath(kDummyDirName))) NOTREACHED(); } @@ -185,7 +186,7 @@ class RecordApiTest : public InProcessBrowserTest { // Override to delete temporary files created during execution. virtual void CleanUpOnMainThread() OVERRIDE { InProcessBrowserTest::CleanUpOnMainThread(); - for (std::vector<FilePath>::const_iterator it = temp_files_.begin(); + for (std::vector<base::FilePath>::const_iterator it = temp_files_.begin(); it != temp_files_.end(); ++it) { if (!file_util::Delete(*it, false)) NOTREACHED(); @@ -207,7 +208,7 @@ class RecordApiTest : public InProcessBrowserTest { remove_switches); command_line->AppendSwitchPath(switches::kUserDataDir, - FilePath(kDummyDirName)); + base::FilePath(kDummyDirName)); // Adding a dummy load-extension switch is rather complex since the // preent design of InProcessBrowserTest requires a *real* extension // for the flag, even if we're just testing its replacement. Opted @@ -220,7 +221,7 @@ class RecordApiTest : public InProcessBrowserTest { // RecordCaptureURLsFunction that was used, so that its state may be // queried. scoped_refptr<RecordCaptureURLsFunction> RunCapture( - const FilePath& user_data_dir, + const base::FilePath& user_data_dir, scoped_ptr<base::ListValue>* out_list) { scoped_refptr<RecordCaptureURLsFunction> capture_function( @@ -264,7 +265,7 @@ class RecordApiTest : public InProcessBrowserTest { } protected: - std::vector<FilePath> temp_files_; + std::vector<base::FilePath> temp_files_; private: base::ScopedTempDir scoped_temp_user_data_dir_; @@ -289,7 +290,7 @@ IN_PROC_BROWSER_TEST_F(RecordApiTest, DISABLED_CheckCapture) { EXPECT_TRUE(command_line.HasSwitch(switches::kUserDataDir)); EXPECT_TRUE(command_line.GetSwitchValuePath(switches::kUserDataDir) != - FilePath(kDummyDirName)); + base::FilePath(kDummyDirName)); EXPECT_TRUE(VerifyURLHandling(result.get(), strategy)); } @@ -333,12 +334,12 @@ IN_PROC_BROWSER_TEST_F(RecordApiTest, MAYBE_CheckPlayback) { EXPECT_TRUE(command_line.HasSwitch(switches::kUserDataDir)); EXPECT_TRUE(command_line.GetSwitchValuePath(switches::kUserDataDir) != - FilePath(kDummyDirName)); + base::FilePath(kDummyDirName)); // Check that command line load-extension was overridden. EXPECT_TRUE(command_line.HasSwitch(switches::kLoadExtension) && command_line.GetSwitchValuePath(switches::kLoadExtension) - != FilePath(kDummyDirName)); + != base::FilePath(kDummyDirName)); // Check for return value with proper stats. EXPECT_EQ(kTestStatistics, utils::GetString(result.get(), kStatsKey)); diff --git a/chrome/browser/extensions/api/serial/serial_connection.cc b/chrome/browser/extensions/api/serial/serial_connection.cc index 372dc9b..b976762 100644 --- a/chrome/browser/extensions/api/serial/serial_connection.cc +++ b/chrome/browser/extensions/api/serial/serial_connection.cc @@ -31,7 +31,8 @@ bool SerialConnection::Open() { // validate the supplied path against the set of valid port names, and // it is a reasonable assumption that serial port names are ASCII. CHECK(IsStringASCII(port_)); - FilePath file_path(FilePath::FromUTF8Unsafe(MaybeFixUpPortName(port_))); + base::FilePath file_path( + base::FilePath::FromUTF8Unsafe(MaybeFixUpPortName(port_))); file_ = base::CreatePlatformFile(file_path, base::PLATFORM_FILE_OPEN | base::PLATFORM_FILE_READ | diff --git a/chrome/browser/extensions/api/serial/serial_port_enumerator_posix.cc b/chrome/browser/extensions/api/serial/serial_port_enumerator_posix.cc index 6afad8f..ed27ebc 100644 --- a/chrome/browser/extensions/api/serial/serial_port_enumerator_posix.cc +++ b/chrome/browser/extensions/api/serial/serial_port_enumerator_posix.cc @@ -65,7 +65,7 @@ SerialPortEnumerator::StringSet SerialPortEnumerator::GenerateValidPatterns() { SerialPortEnumerator::StringSet SerialPortEnumerator::GenerateValidSerialPortNames() { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); - const FilePath kDevRoot("/dev"); + const base::FilePath kDevRoot("/dev"); const int kFilesAndSymLinks = file_util::FileEnumerator::FILES | file_util::FileEnumerator::SHOW_SYM_LINKS; @@ -75,7 +75,7 @@ SerialPortEnumerator::GenerateValidSerialPortNames() { file_util::FileEnumerator enumerator( kDevRoot, false, kFilesAndSymLinks); do { - const FilePath next_device_path(enumerator.Next()); + const base::FilePath next_device_path(enumerator.Next()); const std::string next_device = next_device_path.value(); if (next_device.empty()) break; diff --git a/chrome/browser/extensions/api/socket/socket_apitest.cc b/chrome/browser/extensions/api/socket/socket_apitest.cc index 2bb65cb..73e62fa 100644 --- a/chrome/browser/extensions/api/socket/socket_apitest.cc +++ b/chrome/browser/extensions/api/socket/socket_apitest.cc @@ -124,7 +124,7 @@ IN_PROC_BROWSER_TEST_F(SocketApiTest, SocketUDPExtension) { scoped_ptr<net::TestServer> test_server( new net::TestServer(net::TestServer::TYPE_UDP_ECHO, net::TestServer::kLocalhost, - FilePath(FILE_PATH_LITERAL("net/data")))); + base::FilePath(FILE_PATH_LITERAL("net/data")))); EXPECT_TRUE(test_server->Start()); net::HostPortPair host_port_pair = test_server->host_port_pair(); @@ -151,7 +151,7 @@ IN_PROC_BROWSER_TEST_F(SocketApiTest, SocketTCPExtension) { scoped_ptr<net::TestServer> test_server( new net::TestServer(net::TestServer::TYPE_TCP_ECHO, net::TestServer::kLocalhost, - FilePath(FILE_PATH_LITERAL("net/data")))); + base::FilePath(FILE_PATH_LITERAL("net/data")))); EXPECT_TRUE(test_server->Start()); net::HostPortPair host_port_pair = test_server->host_port_pair(); diff --git a/chrome/browser/extensions/api/storage/leveldb_settings_storage_factory.cc b/chrome/browser/extensions/api/storage/leveldb_settings_storage_factory.cc index 6fbffbf..f58ff7c 100644 --- a/chrome/browser/extensions/api/storage/leveldb_settings_storage_factory.cc +++ b/chrome/browser/extensions/api/storage/leveldb_settings_storage_factory.cc @@ -10,7 +10,7 @@ namespace extensions { ValueStore* LeveldbSettingsStorageFactory::Create( - const FilePath& base_path, + const base::FilePath& base_path, const std::string& extension_id) { return new LeveldbValueStore(base_path.AppendASCII(extension_id)); } diff --git a/chrome/browser/extensions/api/storage/leveldb_settings_storage_factory.h b/chrome/browser/extensions/api/storage/leveldb_settings_storage_factory.h index 395fcfc..e5a211d 100644 --- a/chrome/browser/extensions/api/storage/leveldb_settings_storage_factory.h +++ b/chrome/browser/extensions/api/storage/leveldb_settings_storage_factory.h @@ -12,7 +12,7 @@ namespace extensions { // Factory for creating LeveldbValueStore instances. class LeveldbSettingsStorageFactory : public SettingsStorageFactory { public: - virtual ValueStore* Create(const FilePath& base_path, + virtual ValueStore* Create(const base::FilePath& base_path, const std::string& extension_id) OVERRIDE; private: diff --git a/chrome/browser/extensions/api/storage/managed_value_store_cache.cc b/chrome/browser/extensions/api/storage/managed_value_store_cache.cc index b7dcba1..febe5f6 100644 --- a/chrome/browser/extensions/api/storage/managed_value_store_cache.cc +++ b/chrome/browser/extensions/api/storage/managed_value_store_cache.cc @@ -29,7 +29,7 @@ ManagedValueStoreCache::ManagedValueStoreCache( EventRouter* event_router, const scoped_refptr<SettingsStorageFactory>& factory, const scoped_refptr<SettingsObserverList>& observers, - const FilePath& profile_path) + const base::FilePath& profile_path) : ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)), weak_this_on_ui_(weak_factory_.GetWeakPtr()), policy_service_(policy_service), diff --git a/chrome/browser/extensions/api/storage/managed_value_store_cache.h b/chrome/browser/extensions/api/storage/managed_value_store_cache.h index c31da15..b21fd89 100644 --- a/chrome/browser/extensions/api/storage/managed_value_store_cache.h +++ b/chrome/browser/extensions/api/storage/managed_value_store_cache.h @@ -50,7 +50,7 @@ class ManagedValueStoreCache : public ValueStoreCache, EventRouter* event_router, const scoped_refptr<SettingsStorageFactory>& factory, const scoped_refptr<SettingsObserverList>& observers, - const FilePath& profile_path); + const base::FilePath& profile_path); virtual ~ManagedValueStoreCache(); private: @@ -139,7 +139,7 @@ class ManagedValueStoreCache : public ValueStoreCache, // These live on the FILE thread. scoped_refptr<SettingsStorageFactory> storage_factory_; scoped_refptr<SettingsObserverList> observers_; - FilePath base_path_; + base::FilePath base_path_; // All the PolicyValueStores live on the FILE thread, and |store_map_| can be // accessed only on the FILE thread as well. diff --git a/chrome/browser/extensions/api/storage/policy_value_store_unittest.cc b/chrome/browser/extensions/api/storage/policy_value_store_unittest.cc index 06f1ad9..0e00f45 100644 --- a/chrome/browser/extensions/api/storage/policy_value_store_unittest.cc +++ b/chrome/browser/extensions/api/storage/policy_value_store_unittest.cc @@ -39,7 +39,7 @@ class MockSettingsObserver : public SettingsObserver { // tests. class MutablePolicyValueStore : public PolicyValueStore { public: - explicit MutablePolicyValueStore(const FilePath& path) + explicit MutablePolicyValueStore(const base::FilePath& path) : PolicyValueStore(kTestExtensionId, make_scoped_refptr(new SettingsObserverList()), scoped_ptr<ValueStore>(new LeveldbValueStore(path))) {} @@ -73,7 +73,7 @@ class MutablePolicyValueStore : public PolicyValueStore { DISALLOW_COPY_AND_ASSIGN(MutablePolicyValueStore); }; -ValueStore* Param(const FilePath& file_path) { +ValueStore* Param(const base::FilePath& file_path) { return new MutablePolicyValueStore(file_path); } diff --git a/chrome/browser/extensions/api/storage/settings_backend.cc b/chrome/browser/extensions/api/storage/settings_backend.cc index 1d8a5d5..bf02fbd 100644 --- a/chrome/browser/extensions/api/storage/settings_backend.cc +++ b/chrome/browser/extensions/api/storage/settings_backend.cc @@ -18,7 +18,7 @@ namespace extensions { SettingsBackend::SettingsBackend( const scoped_refptr<SettingsStorageFactory>& storage_factory, - const FilePath& base_path, + const base::FilePath& base_path, const SettingsStorageQuotaEnforcer::Limits& quota, const scoped_refptr<SettingsObserverList>& observers) : storage_factory_(storage_factory), @@ -110,7 +110,8 @@ std::set<std::string> SettingsBackend::GetKnownExtensionIDs() const { base_path_, false, file_util::FileEnumerator::DIRECTORIES); while (!extension_dirs.Next().empty()) { extension_dirs.GetFindInfo(&find_info); - FilePath extension_dir(file_util::FileEnumerator::GetFilename(find_info)); + base::FilePath extension_dir( + file_util::FileEnumerator::GetFilename(find_info)); DCHECK(!extension_dir.IsAbsolute()); // Extension IDs are created as std::strings so they *should* be ASCII. std::string maybe_as_ascii(extension_dir.MaybeAsASCII()); diff --git a/chrome/browser/extensions/api/storage/settings_backend.h b/chrome/browser/extensions/api/storage/settings_backend.h index 60073b2..1a3965e 100644 --- a/chrome/browser/extensions/api/storage/settings_backend.h +++ b/chrome/browser/extensions/api/storage/settings_backend.h @@ -39,7 +39,7 @@ class SettingsBackend : public syncer::SyncableService { // |observers| is the list of observers to settings changes. SettingsBackend( const scoped_refptr<SettingsStorageFactory>& storage_factory, - const FilePath& base_path, + const base::FilePath& base_path, const SettingsStorageQuotaEnforcer::Limits& quota, const scoped_refptr<SettingsObserverList>& observers); @@ -84,7 +84,7 @@ class SettingsBackend : public syncer::SyncableService { const scoped_refptr<SettingsStorageFactory> storage_factory_; // The base file path to create any leveldb databases at. - const FilePath base_path_; + const base::FilePath base_path_; // Quota limits (see SettingsStorageQuotaEnforcer). const SettingsStorageQuotaEnforcer::Limits quota_; diff --git a/chrome/browser/extensions/api/storage/settings_frontend.cc b/chrome/browser/extensions/api/storage/settings_frontend.cc index 240bc66..cd12a46 100644 --- a/chrome/browser/extensions/api/storage/settings_frontend.cc +++ b/chrome/browser/extensions/api/storage/settings_frontend.cc @@ -102,7 +102,7 @@ SettingsFrontend::SettingsFrontend( observers_->AddObserver(profile_observer_.get()); - const FilePath& profile_path = profile->GetPath(); + const base::FilePath& profile_path = profile->GetPath(); caches_[settings_namespace::LOCAL] = new SyncOrLocalValueStoreCache( settings_namespace::LOCAL, diff --git a/chrome/browser/extensions/api/storage/settings_storage_factory.h b/chrome/browser/extensions/api/storage/settings_storage_factory.h index 4fce4f6..e0d955b 100644 --- a/chrome/browser/extensions/api/storage/settings_storage_factory.h +++ b/chrome/browser/extensions/api/storage/settings_storage_factory.h @@ -23,7 +23,7 @@ class SettingsStorageFactory public: // Creates a new ValueStore area for an extension under |base_path|. // Return NULL to indicate failure. Must be called on the FILE thread. - virtual ValueStore* Create(const FilePath& base_path, + virtual ValueStore* Create(const base::FilePath& base_path, const std::string& extension_id) = 0; protected: diff --git a/chrome/browser/extensions/api/storage/settings_sync_unittest.cc b/chrome/browser/extensions/api/storage/settings_sync_unittest.cc index 2306afb..ec530e8 100644 --- a/chrome/browser/extensions/api/storage/settings_sync_unittest.cc +++ b/chrome/browser/extensions/api/storage/settings_sync_unittest.cc @@ -178,7 +178,7 @@ class TestingValueStoreFactory : public SettingsStorageFactory { } // SettingsStorageFactory implementation. - virtual ValueStore* Create(const FilePath& base_path, + virtual ValueStore* Create(const base::FilePath& base_path, const std::string& extension_id) OVERRIDE { TestingValueStore* new_storage = new TestingValueStore(); DCHECK(!created_.count(extension_id)); diff --git a/chrome/browser/extensions/api/storage/settings_test_util.cc b/chrome/browser/extensions/api/storage/settings_test_util.cc index 6c156f1..3c2d5c7 100644 --- a/chrome/browser/extensions/api/storage/settings_test_util.cc +++ b/chrome/browser/extensions/api/storage/settings_test_util.cc @@ -90,7 +90,7 @@ void MockExtensionService::AddExtensionWithIdAndPermissions( std::string error; scoped_refptr<Extension> extension(Extension::Create( - FilePath(), + base::FilePath(), Manifest::INTERNAL, manifest, Extension::NO_FLAGS, @@ -130,7 +130,7 @@ ProfileKeyedService* BuildMockExtensionSystem(Profile* profile) { // MockProfile -MockProfile::MockProfile(const FilePath& file_path) +MockProfile::MockProfile(const base::FilePath& file_path) : TestingProfile(file_path) { ExtensionSystemFactory::GetInstance()->SetTestingFactoryAndUse(this, &BuildMockExtensionSystem); @@ -154,7 +154,7 @@ void ScopedSettingsStorageFactory::Reset( } ValueStore* ScopedSettingsStorageFactory::Create( - const FilePath& base_path, + const base::FilePath& base_path, const std::string& extension_id) { DCHECK(delegate_.get()); return delegate_->Create(base_path, extension_id); diff --git a/chrome/browser/extensions/api/storage/settings_test_util.h b/chrome/browser/extensions/api/storage/settings_test_util.h index 43922b3..73b660a 100644 --- a/chrome/browser/extensions/api/storage/settings_test_util.h +++ b/chrome/browser/extensions/api/storage/settings_test_util.h @@ -84,7 +84,7 @@ class MockExtensionSystem : public TestExtensionSystem { // the tests. class MockProfile : public TestingProfile { public: - explicit MockProfile(const FilePath& file_path); + explicit MockProfile(const base::FilePath& file_path); virtual ~MockProfile(); }; @@ -100,7 +100,7 @@ class ScopedSettingsStorageFactory : public SettingsStorageFactory { void Reset(const scoped_refptr<SettingsStorageFactory>& delegate); // SettingsStorageFactory implementation. - virtual ValueStore* Create(const FilePath& base_path, + virtual ValueStore* Create(const base::FilePath& base_path, const std::string& extension_id) OVERRIDE; private: diff --git a/chrome/browser/extensions/api/storage/sync_or_local_value_store_cache.cc b/chrome/browser/extensions/api/storage/sync_or_local_value_store_cache.cc index 7855b46..cd41bf4 100644 --- a/chrome/browser/extensions/api/storage/sync_or_local_value_store_cache.cc +++ b/chrome/browser/extensions/api/storage/sync_or_local_value_store_cache.cc @@ -26,7 +26,7 @@ SyncOrLocalValueStoreCache::SyncOrLocalValueStoreCache( const scoped_refptr<SettingsStorageFactory>& factory, const SettingsStorageQuotaEnforcer::Limits& quota, const scoped_refptr<SettingsObserverList>& observers, - const FilePath& profile_path) + const base::FilePath& profile_path) : settings_namespace_(settings_namespace) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(settings_namespace_ == settings_namespace::LOCAL || @@ -96,15 +96,15 @@ void SyncOrLocalValueStoreCache::InitOnFileThread( const scoped_refptr<SettingsStorageFactory>& factory, const SettingsStorageQuotaEnforcer::Limits& quota, const scoped_refptr<SettingsObserverList>& observers, - const FilePath& profile_path) { + const base::FilePath& profile_path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); DCHECK(!app_backend_.get()); DCHECK(!extension_backend_.get()); const bool local = settings_namespace_ == settings_namespace::LOCAL; - const FilePath app_path = profile_path.AppendASCII( + const base::FilePath app_path = profile_path.AppendASCII( local ? ExtensionService::kLocalAppSettingsDirectoryName : ExtensionService::kSyncAppSettingsDirectoryName); - const FilePath extension_path = profile_path.AppendASCII( + const base::FilePath extension_path = profile_path.AppendASCII( local ? ExtensionService::kLocalExtensionSettingsDirectoryName : ExtensionService::kSyncExtensionSettingsDirectoryName); app_backend_.reset(new SettingsBackend(factory, app_path, quota, observers)); diff --git a/chrome/browser/extensions/api/sync_file_system/extension_sync_event_observer.cc b/chrome/browser/extensions/api/sync_file_system/extension_sync_event_observer.cc index 6a79d08..5bd576f 100644 --- a/chrome/browser/extensions/api/sync_file_system/extension_sync_event_observer.cc +++ b/chrome/browser/extensions/api/sync_file_system/extension_sync_event_observer.cc @@ -145,7 +145,7 @@ void ExtensionSyncEventObserver::OnFileSynced( url.type()); GURL root_url = fileapi::GetSyncableFileSystemRootURI(url.origin(), url.filesystem_id()); - FilePath file_path = url.path(); + base::FilePath file_path = url.path(); // Arguments must all be basic types. scoped_ptr<base::ListValue> params(new ListValue()); diff --git a/chrome/browser/extensions/api/sync_file_system/sync_file_system_apitest.cc b/chrome/browser/extensions/api/sync_file_system/sync_file_system_apitest.cc index a3de5a4..c2cad35 100644 --- a/chrome/browser/extensions/api/sync_file_system/sync_file_system_apitest.cc +++ b/chrome/browser/extensions/api/sync_file_system/sync_file_system_apitest.cc @@ -86,7 +86,7 @@ ACTION_P5(ReturnWithFakeFileAddedStatus, fileapi::FileSystemURL mock_url = fileapi::CreateSyncableFileSystemURL( *origin, "drive", - FilePath(FILE_PATH_LITERAL("foo.txt"))); + base::FilePath(FILE_PATH_LITERAL("foo.txt"))); mock_remote_service->NotifyRemoteChangeQueueUpdated(0); base::MessageLoopProxy::current()->PostTask( FROM_HERE, base::Bind(arg1, diff --git a/chrome/browser/extensions/api/system_indicator/system_indicator_apitest.cc b/chrome/browser/extensions/api/system_indicator/system_indicator_apitest.cc index 59a0354..c8c2961 100644 --- a/chrome/browser/extensions/api/system_indicator/system_indicator_apitest.cc +++ b/chrome/browser/extensions/api/system_indicator/system_indicator_apitest.cc @@ -27,7 +27,7 @@ class SystemIndicatorApiTest : public ExtensionApiTest { const extensions::Extension* LoadExtensionAndWait( const std::string& test_name) { LazyBackgroundObserver page_complete; - FilePath extdir = test_data_dir_.AppendASCII(test_name); + base::FilePath extdir = test_data_dir_.AppendASCII(test_name); const extensions::Extension* extension = LoadExtension(extdir); if (extension) page_complete.Wait(); diff --git a/chrome/browser/extensions/api/system_info_cpu/cpu_info_provider_linux.cc b/chrome/browser/extensions/api/system_info_cpu/cpu_info_provider_linux.cc index 7f38b3f..f76bd29 100644 --- a/chrome/browser/extensions/api/system_info_cpu/cpu_info_provider_linux.cc +++ b/chrome/browser/extensions/api/system_info_cpu/cpu_info_provider_linux.cc @@ -22,7 +22,7 @@ bool CpuInfoProvider::QueryCpuTimePerProcessor(std::vector<CpuTime>* times) { DCHECK(times); std::string contents; - if (!file_util::ReadFileToString(FilePath(kProcStat), &contents)) + if (!file_util::ReadFileToString(base::FilePath(kProcStat), &contents)) return false; std::istringstream iss(contents); diff --git a/chrome/browser/extensions/api/system_info_storage/storage_info_provider_linux.cc b/chrome/browser/extensions/api/system_info_storage/storage_info_provider_linux.cc index 507fbb0..6a75c91 100644 --- a/chrome/browser/extensions/api/system_info_storage/storage_info_provider_linux.cc +++ b/chrome/browser/extensions/api/system_info_storage/storage_info_provider_linux.cc @@ -27,9 +27,10 @@ StorageInfoProviderLinux::StorageInfoProviderLinux() StorageInfoProviderLinux::~StorageInfoProviderLinux() {} -StorageInfoProviderLinux::StorageInfoProviderLinux(const FilePath& mtab_path) - : udev_context_(udev_new()), - mtab_file_path_(mtab_path) { +StorageInfoProviderLinux::StorageInfoProviderLinux( + const base::FilePath& mtab_path) + : udev_context_(udev_new()), + mtab_file_path_(mtab_path) { } bool StorageInfoProviderLinux::QueryInfo(StorageInfo* info) { diff --git a/chrome/browser/extensions/api/system_info_storage/storage_info_provider_linux.h b/chrome/browser/extensions/api/system_info_storage/storage_info_provider_linux.h index da9cecb..24115bb 100644 --- a/chrome/browser/extensions/api/system_info_storage/storage_info_provider_linux.h +++ b/chrome/browser/extensions/api/system_info_storage/storage_info_provider_linux.h @@ -19,7 +19,7 @@ class StorageInfoProviderLinux : public StorageInfoProvider { virtual ~StorageInfoProviderLinux(); // For unit test. - explicit StorageInfoProviderLinux(const FilePath& mtab_path); + explicit StorageInfoProviderLinux(const base::FilePath& mtab_path); virtual bool QueryInfo(StorageInfo* info) OVERRIDE; @@ -35,7 +35,7 @@ class StorageInfoProviderLinux : public StorageInfoProvider { chrome::ScopedUdevObject udev_context_; // The mtab file path on the system. - const FilePath mtab_file_path_; + const base::FilePath mtab_file_path_; }; } // namespace extensions diff --git a/chrome/browser/extensions/api/system_info_storage/storage_info_provider_linux_unittest.cc b/chrome/browser/extensions/api/system_info_storage/storage_info_provider_linux_unittest.cc index 666645a..4c508ea 100644 --- a/chrome/browser/extensions/api/system_info_storage/storage_info_provider_linux_unittest.cc +++ b/chrome/browser/extensions/api/system_info_storage/storage_info_provider_linux_unittest.cc @@ -48,7 +48,7 @@ typedef std::map<std::string, struct TestMountEntry> TestMountEntryMap; class StorageInfoProviderLinuxWrapper : public StorageInfoProviderLinux { public: - explicit StorageInfoProviderLinuxWrapper(const FilePath& mtab_path) + explicit StorageInfoProviderLinuxWrapper(const base::FilePath& mtab_path) : StorageInfoProviderLinux(mtab_path) { for (size_t i = 0; i < arraysize(mount_entries); i++) { std::string mnt_path = mount_entries[i].mnt_path; @@ -110,7 +110,7 @@ class StorageInfoProviderLinuxTest : public testing::Test { } scoped_refptr<StorageInfoProviderLinuxWrapper> storage_info_provider_; - FilePath mtab_file_; + base::FilePath mtab_file_; }; TEST_F(StorageInfoProviderLinuxTest, QueryInfo) { @@ -132,7 +132,7 @@ TEST_F(StorageInfoProviderLinuxTest, QueryInfo) { TEST_F(StorageInfoProviderLinuxTest, QueryInfoFailed) { storage_info_provider_ = - new StorageInfoProviderLinuxWrapper(FilePath("/invalid/file/path")); + new StorageInfoProviderLinuxWrapper(base::FilePath("/invalid/file/path")); StorageInfo info; ASSERT_FALSE(QueryInfo(&info)); EXPECT_EQ(0u, info.size()); diff --git a/chrome/browser/extensions/api/tabs/tabs_api.cc b/chrome/browser/extensions/api/tabs/tabs_api.cc index a967d70..cfc2d29 100644 --- a/chrome/browser/extensions/api/tabs/tabs_api.cc +++ b/chrome/browser/extensions/api/tabs/tabs_api.cc @@ -2040,7 +2040,7 @@ void ExecuteCodeInTabFunction::DidLoadFile(bool success, void ExecuteCodeInTabFunction::LocalizeCSS( const std::string& data, const std::string& extension_id, - const FilePath& extension_path, + const base::FilePath& extension_path, const std::string& extension_default_locale) { scoped_ptr<SubstitutionMap> localization_messages( extension_file_util::LoadMessageBundleSubstitutionMap( diff --git a/chrome/browser/extensions/api/tabs/tabs_api.h b/chrome/browser/extensions/api/tabs/tabs_api.h index 851aa77..2e41121 100644 --- a/chrome/browser/extensions/api/tabs/tabs_api.h +++ b/chrome/browser/extensions/api/tabs/tabs_api.h @@ -243,7 +243,7 @@ class ExecuteCodeInTabFunction : public AsyncExtensionFunction { void LocalizeCSS( const std::string& data, const std::string& extension_id, - const FilePath& extension_path, + const base::FilePath& extension_path, const std::string& extension_default_locale); // Called when contents from the loaded file have been localized. diff --git a/chrome/browser/extensions/api/web_request/web_request_api_unittest.cc b/chrome/browser/extensions/api/web_request/web_request_api_unittest.cc index eead84e..2b5c2bc 100644 --- a/chrome/browser/extensions/api/web_request/web_request_api_unittest.cc +++ b/chrome/browser/extensions/api/web_request/web_request_api_unittest.cc @@ -501,7 +501,7 @@ void ExtensionWebRequestTest::FireURLRequestWithData( element_readers.push_back(new net::UploadBytesElementReader( &(bytes_1[0]), bytes_1.size())); element_readers.push_back(new net::UploadFileElementReader( - base::MessageLoopProxy::current(), ::FilePath(), 0, 0, base::Time())); + base::MessageLoopProxy::current(), base::FilePath(), 0, 0, base::Time())); element_readers.push_back(new net::UploadBytesElementReader( &(bytes_2[0]), bytes_2.size())); request.set_upload(make_scoped_ptr( diff --git a/chrome/browser/extensions/api/webstore_private/webstore_private_apitest.cc b/chrome/browser/extensions/api/webstore_private/webstore_private_apitest.cc index 5b1ba4a..3d24fab 100644 --- a/chrome/browser/extensions/api/webstore_private/webstore_private_apitest.cc +++ b/chrome/browser/extensions/api/webstore_private/webstore_private_apitest.cc @@ -180,9 +180,10 @@ class ExtensionWebstorePrivateBundleTest ASSERT_TRUE(tmp.CreateUniqueTempDir()); ASSERT_TRUE(file_util::CreateDirectory(tmp.path())); - FilePath tmp_manifest = tmp.path().AppendASCII("manifest.json"); - FilePath data_path = test_data_dir_.AppendASCII("webstore_private/bundle"); - FilePath manifest_path = data_path.AppendASCII(manifest); + base::FilePath tmp_manifest = tmp.path().AppendASCII("manifest.json"); + base::FilePath data_path = + test_data_dir_.AppendASCII("webstore_private/bundle"); + base::FilePath manifest_path = data_path.AppendASCII(manifest); ASSERT_TRUE(file_util::PathExists(manifest_path)); ASSERT_TRUE(file_util::CopyFile(manifest_path, tmp_manifest)); @@ -191,12 +192,13 @@ class ExtensionWebstorePrivateBundleTest } // Packs the extension at |ext_path| using |id|'s PEM key. - void PackCRX(const std::string& id, const FilePath& ext_path) { - FilePath data_path = tmp_.path().AppendASCII("webstore_private/bundle"); - FilePath pem_path = data_path.AppendASCII(id + ".pem"); - FilePath crx_path = data_path.AppendASCII(id + ".crx"); - FilePath destination = PackExtensionWithOptions( - ext_path, crx_path, pem_path, FilePath()); + void PackCRX(const std::string& id, const base::FilePath& ext_path) { + base::FilePath data_path = + tmp_.path().AppendASCII("webstore_private/bundle"); + base::FilePath pem_path = data_path.AppendASCII(id + ".pem"); + base::FilePath crx_path = data_path.AppendASCII(id + ".crx"); + base::FilePath destination = PackExtensionWithOptions( + ext_path, crx_path, pem_path, base::FilePath()); ASSERT_FALSE(destination.empty()); ASSERT_EQ(destination, crx_path); @@ -206,10 +208,10 @@ class ExtensionWebstorePrivateBundleTest // Creates an invalid CRX. void PackInvalidCRX(const std::string& id) { - FilePath contents = test_data_dir_ + base::FilePath contents = test_data_dir_ .AppendASCII("webstore_private") .AppendASCII("install_bundle_invalid.html"); - FilePath crx_path = test_data_dir_ + base::FilePath crx_path = test_data_dir_ .AppendASCII("webstore_private/bundle") .AppendASCII(id + ".crx"); @@ -219,7 +221,7 @@ class ExtensionWebstorePrivateBundleTest } private: - std::vector<FilePath> test_crx_; + std::vector<base::FilePath> test_crx_; }; class ExtensionWebstoreGetWebGLStatusTest : public InProcessBrowserTest { @@ -293,7 +295,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionWebstorePrivateApiTest, MissingDownloadDir) { // Set a non-existent directory as the download path. base::ScopedTempDir temp_dir; EXPECT_TRUE(temp_dir.CreateUniqueTempDir()); - FilePath missing_directory = temp_dir.Take(); + base::FilePath missing_directory = temp_dir.Take(); EXPECT_TRUE(file_util::Delete(missing_directory, true)); WebstoreInstaller::SetDownloadDirectoryForTests(&missing_directory); diff --git a/chrome/browser/extensions/app_background_page_apitest.cc b/chrome/browser/extensions/app_background_page_apitest.cc index 7d32eda..af85b86 100644 --- a/chrome/browser/extensions/app_background_page_apitest.cc +++ b/chrome/browser/extensions/app_background_page_apitest.cc @@ -31,12 +31,12 @@ class AppBackgroundPageApiTest : public ExtensionApiTest { } bool CreateApp(const std::string& app_manifest, - FilePath* app_dir) { + base::FilePath* app_dir) { if (!app_dir_.CreateUniqueTempDir()) { LOG(ERROR) << "Unable to create a temporary directory."; return false; } - FilePath manifest_path = app_dir_.path().AppendASCII("manifest.json"); + base::FilePath manifest_path = app_dir_.path().AppendASCII("manifest.json"); int bytes_written = file_util::WriteFile(manifest_path, app_manifest.data(), app_manifest.size()); @@ -108,7 +108,7 @@ IN_PROC_BROWSER_TEST_F(AppBackgroundPageApiTest, MAYBE_Basic) { "}", test_server()->host_port_pair().port()); - FilePath app_dir; + base::FilePath app_dir; ASSERT_TRUE(CreateApp(app_manifest, &app_dir)); ASSERT_TRUE(LoadExtension(app_dir)); // Background mode should not be active until a background page is created. @@ -140,7 +140,7 @@ IN_PROC_BROWSER_TEST_F(AppBackgroundPageApiTest, DISABLED_LacksPermission) { "}", test_server()->host_port_pair().port()); - FilePath app_dir; + base::FilePath app_dir; ASSERT_TRUE(CreateApp(app_manifest, &app_dir)); ASSERT_TRUE(LoadExtension(app_dir)); ASSERT_TRUE(RunExtensionTest("app_background_page/lacks_permission")) @@ -173,7 +173,7 @@ IN_PROC_BROWSER_TEST_F(AppBackgroundPageApiTest, ManifestBackgroundPage) { test_server()->host_port_pair().port(), test_server()->host_port_pair().port()); - FilePath app_dir; + base::FilePath app_dir; ASSERT_TRUE(CreateApp(app_manifest, &app_dir)); // Background mode should not be active now because no background app was // loaded. @@ -219,7 +219,7 @@ IN_PROC_BROWSER_TEST_F(AppBackgroundPageApiTest, NoJsBackgroundPage) { "}", test_server()->host_port_pair().port()); - FilePath app_dir; + base::FilePath app_dir; ASSERT_TRUE(CreateApp(app_manifest, &app_dir)); ASSERT_TRUE(LoadExtension(app_dir)); @@ -264,7 +264,7 @@ IN_PROC_BROWSER_TEST_F(AppBackgroundPageApiTest, NoJsManifestBackgroundPage) { test_server()->host_port_pair().port(), test_server()->host_port_pair().port()); - FilePath app_dir; + base::FilePath app_dir; ASSERT_TRUE(CreateApp(app_manifest, &app_dir)); ASSERT_TRUE(LoadExtension(app_dir)); @@ -298,7 +298,7 @@ IN_PROC_BROWSER_TEST_F(AppBackgroundPageApiTest, OpenTwoBackgroundPages) { "}", test_server()->host_port_pair().port()); - FilePath app_dir; + base::FilePath app_dir; ASSERT_TRUE(CreateApp(app_manifest, &app_dir)); ASSERT_TRUE(LoadExtension(app_dir)); ASSERT_TRUE(RunExtensionTest("app_background_page/two_pages")) << message_; @@ -329,7 +329,7 @@ IN_PROC_BROWSER_TEST_F(AppBackgroundPageApiTest, OpenTwoPagesWithManifest) { test_server()->host_port_pair().port(), test_server()->host_port_pair().port()); - FilePath app_dir; + base::FilePath app_dir; ASSERT_TRUE(CreateApp(app_manifest, &app_dir)); ASSERT_TRUE(LoadExtension(app_dir)); ASSERT_TRUE(RunExtensionTest("app_background_page/two_with_manifest")) << @@ -361,7 +361,7 @@ IN_PROC_BROWSER_TEST_F(AppBackgroundPageApiTest, DISABLED_OpenPopupFromBGPage) { test_server()->host_port_pair().port(), test_server()->host_port_pair().port()); - FilePath app_dir; + base::FilePath app_dir; ASSERT_TRUE(CreateApp(app_manifest, &app_dir)); ASSERT_TRUE(LoadExtension(app_dir)); ASSERT_TRUE(RunExtensionTest("app_background_page/bg_open")) << message_; @@ -388,7 +388,7 @@ IN_PROC_BROWSER_TEST_F(AppBackgroundPageApiTest, DISABLED_OpenThenClose) { "}", test_server()->host_port_pair().port()); - FilePath app_dir; + base::FilePath app_dir; ASSERT_TRUE(CreateApp(app_manifest, &app_dir)); ASSERT_TRUE(LoadExtension(app_dir)); // There isn't a background page loaded initially. diff --git a/chrome/browser/extensions/app_host/app_host_main.cc b/chrome/browser/extensions/app_host/app_host_main.cc index 387a356..578f18e 100644 --- a/chrome/browser/extensions/app_host/app_host_main.cc +++ b/chrome/browser/extensions/app_host/app_host_main.cc @@ -19,7 +19,7 @@ int APIENTRY wWinMain(HINSTANCE, HINSTANCE, wchar_t*, int) { // Initialize the commandline singleton from the environment. CommandLine::Init(0, NULL); - FilePath chrome_exe(chrome_launcher_support::GetAnyChromePath()); + base::FilePath chrome_exe(chrome_launcher_support::GetAnyChromePath()); if (chrome_exe.empty()) { LOG(INFO) << "No Chrome executable could be found. Let's install it."; HRESULT hr = app_host::InstallBinaries(); diff --git a/chrome/browser/extensions/app_host/update.cc b/chrome/browser/extensions/app_host/update.cc index 7985e42..4d466f7 100644 --- a/chrome/browser/extensions/app_host/update.cc +++ b/chrome/browser/extensions/app_host/update.cc @@ -66,7 +66,7 @@ Version GetAppVersionFromRegistry(const wchar_t* app_guid) { // Calls setup.exe to update App Host, using the system-level setup.exe. bool LaunchAppHostUpdate() { // Get the path to the setup.exe. - FilePath setup_exe( + base::FilePath setup_exe( chrome_launcher_support::GetSetupExeForInstallationLevel( chrome_launcher_support::SYSTEM_LEVEL_INSTALLATION)); if (setup_exe.empty()) { diff --git a/chrome/browser/extensions/app_notification_manager.cc b/chrome/browser/extensions/app_notification_manager.cc index 25bdfb8..986c40d 100644 --- a/chrome/browser/extensions/app_notification_manager.cc +++ b/chrome/browser/extensions/app_notification_manager.cc @@ -77,7 +77,8 @@ AppNotificationManager::AppNotificationManager(Profile* profile) } void AppNotificationManager::Init() { - FilePath storage_path = profile_->GetPath().AppendASCII("App Notifications"); + base::FilePath storage_path = + profile_->GetPath().AppendASCII("App Notifications"); load_timer_.reset(new PerfTimer()); BrowserThread::PostTask( BrowserThread::FILE, @@ -370,7 +371,8 @@ AppNotificationManager::~AppNotificationManager() { storage_.release()); } -void AppNotificationManager::LoadOnFileThread(const FilePath& storage_path) { +void AppNotificationManager::LoadOnFileThread( + const base::FilePath& storage_path) { PerfTimer timer; CHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); DCHECK(!loaded()); diff --git a/chrome/browser/extensions/app_notification_storage.cc b/chrome/browser/extensions/app_notification_storage.cc index 9a0d2f8a..e527d43 100644 --- a/chrome/browser/extensions/app_notification_storage.cc +++ b/chrome/browser/extensions/app_notification_storage.cc @@ -26,7 +26,7 @@ namespace extensions { // LevelDb for backing storage. class LevelDbAppNotificationStorage : public AppNotificationStorage { public: - explicit LevelDbAppNotificationStorage(const FilePath& path); + explicit LevelDbAppNotificationStorage(const base::FilePath& path); virtual ~LevelDbAppNotificationStorage(); // Implementing the AppNotificationStorage interface. @@ -44,7 +44,7 @@ class LevelDbAppNotificationStorage : public AppNotificationStorage { bool OpenDbIfNeeded(bool create_if_missing); // The path where the database will reside. - FilePath path_; + base::FilePath path_; // This should be used for all read operations on the db. leveldb::ReadOptions read_options_; @@ -59,7 +59,7 @@ class LevelDbAppNotificationStorage : public AppNotificationStorage { // static AppNotificationStorage* AppNotificationStorage::Create( - const FilePath& path) { + const base::FilePath& path) { return new LevelDbAppNotificationStorage(path); } @@ -112,7 +112,7 @@ void LogLevelDbError(const tracked_objects::Location& location, LevelDbAppNotificationStorage::LevelDbAppNotificationStorage( - const FilePath& path) : path_(path) { + const base::FilePath& path) : path_(path) { CHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); read_options_.verify_checksums = true; } diff --git a/chrome/browser/extensions/app_notification_storage_unittest.cc b/chrome/browser/extensions/app_notification_storage_unittest.cc index ac073a9..a0a0bdd 100644 --- a/chrome/browser/extensions/app_notification_storage_unittest.cc +++ b/chrome/browser/extensions/app_notification_storage_unittest.cc @@ -47,7 +47,7 @@ class AppNotificationStorageTest : public testing::Test { MessageLoop message_loop_; content::TestBrowserThread file_thread_; base::ScopedTempDir dir_; - FilePath storage_path_; + base::FilePath storage_path_; scoped_ptr<AppNotificationStorage> storage_; }; diff --git a/chrome/browser/extensions/browser_action_apitest.cc b/chrome/browser/extensions/browser_action_apitest.cc index 8c5cdf92e..c09a3d2 100644 --- a/chrome/browser/extensions/browser_action_apitest.cc +++ b/chrome/browser/extensions/browser_action_apitest.cc @@ -12,7 +12,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, TitleLocalizationBrowserAction) { ExtensionService* service = extensions::ExtensionSystem::Get( browser()->profile())->extension_service(); const size_t size_before = service->extensions()->size(); - FilePath extension_path(test_data_dir_.AppendASCII("browsertest") + base::FilePath extension_path(test_data_dir_.AppendASCII("browsertest") .AppendASCII("title_localized")); const Extension* extension = LoadExtension(extension_path); ASSERT_TRUE(extension); diff --git a/chrome/browser/extensions/bundle_installer.cc b/chrome/browser/extensions/bundle_installer.cc index 1c43557..97005be 100644 --- a/chrome/browser/extensions/bundle_installer.cc +++ b/chrome/browser/extensions/bundle_installer.cc @@ -50,7 +50,7 @@ scoped_refptr<Extension> CreateDummyExtension(const BundleInstaller::Item& item, CHECK(!item.localized_name.empty()); std::string error; - return Extension::Create(FilePath(), + return Extension::Create(base::FilePath(), Manifest::INTERNAL, *manifest, Extension::NO_FLAGS, diff --git a/chrome/browser/extensions/component_loader.cc b/chrome/browser/extensions/component_loader.cc index 6139a13..392c00e 100644 --- a/chrome/browser/extensions/component_loader.cc +++ b/chrome/browser/extensions/component_loader.cc @@ -45,7 +45,8 @@ namespace { static bool enable_background_extensions_during_testing = false; -std::string GenerateId(const DictionaryValue* manifest, const FilePath& path) { +std::string GenerateId(const DictionaryValue* manifest, + const base::FilePath& path) { std::string raw_key; std::string id_input; std::string id; @@ -58,7 +59,7 @@ std::string GenerateId(const DictionaryValue* manifest, const FilePath& path) { } // namespace ComponentLoader::ComponentExtensionInfo::ComponentExtensionInfo( - const DictionaryValue* manifest, const FilePath& directory) + const DictionaryValue* manifest, const base::FilePath& directory) : manifest(manifest), root_directory(directory) { if (!root_directory.IsAbsolute()) { @@ -120,7 +121,7 @@ void ComponentLoader::ClearAllRegistered() { } std::string ComponentLoader::Add(int manifest_resource_id, - const FilePath& root_directory) { + const base::FilePath& root_directory) { std::string manifest_contents = ResourceBundle::GetSharedInstance().GetRawDataResource( manifest_resource_id).as_string(); @@ -128,7 +129,7 @@ std::string ComponentLoader::Add(int manifest_resource_id, } std::string ComponentLoader::Add(const std::string& manifest_contents, - const FilePath& root_directory) { + const base::FilePath& root_directory) { // The Value is kept for the lifetime of the ComponentLoader. This is // required in case LoadAll() is called again. DictionaryValue* manifest = ParseManifest(manifest_contents); @@ -138,7 +139,7 @@ std::string ComponentLoader::Add(const std::string& manifest_contents, } std::string ComponentLoader::Add(const DictionaryValue* parsed_manifest, - const FilePath& root_directory) { + const base::FilePath& root_directory) { ComponentExtensionInfo info(parsed_manifest, root_directory); component_extensions_.push_back(info); if (extension_service_->is_ready()) @@ -146,8 +147,8 @@ std::string ComponentLoader::Add(const DictionaryValue* parsed_manifest, return info.extension_id; } -std::string ComponentLoader::AddOrReplace(const FilePath& path) { - FilePath absolute_path = path; +std::string ComponentLoader::AddOrReplace(const base::FilePath& path) { + base::FilePath absolute_path = path; file_util::AbsolutePath(&absolute_path); std::string error; scoped_ptr<DictionaryValue> manifest( @@ -203,7 +204,7 @@ void ComponentLoader::RemoveAll() { component_extensions_.clear(); } -void ComponentLoader::Remove(const FilePath& root_directory) { +void ComponentLoader::Remove(const base::FilePath& root_directory) { // Find the ComponentExtensionInfo for the extension. RegisteredComponentExtensions::iterator it = component_extensions_.begin(); for (; it != component_extensions_.end(); ++it) { @@ -242,13 +243,13 @@ void ComponentLoader::AddFileManagerExtension() { IDR_FILEMANAGER_MANIFEST_V1; #ifndef NDEBUG if (command_line->HasSwitch(switches::kFileManagerExtensionPath)) { - FilePath filemgr_extension_path( + base::FilePath filemgr_extension_path( command_line->GetSwitchValuePath(switches::kFileManagerExtensionPath)); Add(manifest_id, filemgr_extension_path); return; } #endif // NDEBUG - Add(manifest_id, FilePath(FILE_PATH_LITERAL("file_manager"))); + Add(manifest_id, base::FilePath(FILE_PATH_LITERAL("file_manager"))); #endif // defined(FILE_MANAGER_EXTENSION) } @@ -256,17 +257,17 @@ void ComponentLoader::AddFileManagerExtension() { void ComponentLoader::AddGaiaAuthExtension() { const CommandLine* command_line = CommandLine::ForCurrentProcess(); if (command_line->HasSwitch(switches::kAuthExtensionPath)) { - FilePath auth_extension_path = + base::FilePath auth_extension_path = command_line->GetSwitchValuePath(switches::kAuthExtensionPath); Add(IDR_GAIA_TEST_AUTH_MANIFEST, auth_extension_path); return; } - Add(IDR_GAIA_AUTH_MANIFEST, FilePath(FILE_PATH_LITERAL("gaia_auth"))); + Add(IDR_GAIA_AUTH_MANIFEST, base::FilePath(FILE_PATH_LITERAL("gaia_auth"))); } #endif // NDEBUG void ComponentLoader::AddOrReloadEnterpriseWebStore() { - FilePath path(FILE_PATH_LITERAL("enterprise_web_store")); + base::FilePath path(FILE_PATH_LITERAL("enterprise_web_store")); // Remove the extension if it was already loaded. Remove(path); @@ -307,7 +308,7 @@ void ComponentLoader::AddChromeApp() { l10n_util::GetStringUTF8(IDS_SHORT_PRODUCT_NAME)); if (manifest) - Add(manifest, FilePath(FILE_PATH_LITERAL("chrome_app"))); + Add(manifest, base::FilePath(FILE_PATH_LITERAL("chrome_app"))); #endif } @@ -322,15 +323,15 @@ void ComponentLoader::AddDefaultComponentExtensions( // to AddDefaultComponentExtensionsWithBackgroundPages. #if defined(OS_CHROMEOS) Add(IDR_MOBILE_MANIFEST, - FilePath(FILE_PATH_LITERAL("/usr/share/chromeos-assets/mobile"))); + base::FilePath(FILE_PATH_LITERAL("/usr/share/chromeos-assets/mobile"))); if (skip_session_components) AddGaiaAuthExtension(); #if defined(OFFICIAL_BUILD) if (browser_defaults::enable_help_app) { - Add(IDR_HELP_MANIFEST, - FilePath(FILE_PATH_LITERAL("/usr/share/chromeos-assets/helpapp"))); + Add(IDR_HELP_MANIFEST, base::FilePath(FILE_PATH_LITERAL( + "/usr/share/chromeos-assets/helpapp"))); } #endif @@ -339,20 +340,22 @@ void ComponentLoader::AddDefaultComponentExtensions( const CommandLine* command_line = CommandLine::ForCurrentProcess(); if (!command_line->HasSwitch(switches::kGuestSession)) Add(IDR_BOOKMARKS_MANIFEST, - FilePath(FILE_PATH_LITERAL("bookmark_manager"))); + base::FilePath(FILE_PATH_LITERAL("bookmark_manager"))); - Add(IDR_CROSH_BUILTIN_MANIFEST, FilePath(FILE_PATH_LITERAL( + Add(IDR_CROSH_BUILTIN_MANIFEST, base::FilePath(FILE_PATH_LITERAL( "/usr/share/chromeos-assets/crosh_builtin"))); } #else // !defined(OS_CHROMEOS) DCHECK(!skip_session_components); - Add(IDR_BOOKMARKS_MANIFEST, FilePath(FILE_PATH_LITERAL("bookmark_manager"))); + Add(IDR_BOOKMARKS_MANIFEST, + base::FilePath(FILE_PATH_LITERAL("bookmark_manager"))); // Cloud Print component app. Not required on Chrome OS. - Add(IDR_CLOUDPRINT_MANIFEST, FilePath(FILE_PATH_LITERAL("cloud_print"))); + Add(IDR_CLOUDPRINT_MANIFEST, + base::FilePath(FILE_PATH_LITERAL("cloud_print"))); #endif if (!skip_session_components) { - Add(IDR_WEBSTORE_MANIFEST, FilePath(FILE_PATH_LITERAL("web_store"))); + Add(IDR_WEBSTORE_MANIFEST, base::FilePath(FILE_PATH_LITERAL("web_store"))); // If a URL for the enterprise webstore has been specified, load the // component extension. This extension might also be loaded later, because @@ -382,22 +385,23 @@ void ComponentLoader::AddDefaultComponentExtensionsWithBackgroundPages( if (CommandLine::ForCurrentProcess()->HasSwitch( switches::kAppsDebugger)) { Add(IDR_APPS_DEBUGGER_MANIFEST, - FilePath(FILE_PATH_LITERAL("apps_debugger"))); + base::FilePath(FILE_PATH_LITERAL("apps_debugger"))); } AddFileManagerExtension(); #if defined(ENABLE_SETTINGS_APP) - Add(IDR_SETTINGS_APP_MANIFEST, FilePath(FILE_PATH_LITERAL("settings_app"))); + Add(IDR_SETTINGS_APP_MANIFEST, + base::FilePath(FILE_PATH_LITERAL("settings_app"))); #endif } #if defined(OS_CHROMEOS) if (!skip_session_components) { Add(IDR_WALLPAPERMANAGER_MANIFEST, - FilePath(FILE_PATH_LITERAL("chromeos/wallpaper_manager"))); + base::FilePath(FILE_PATH_LITERAL("chromeos/wallpaper_manager"))); - FilePath echo_extension_path(FILE_PATH_LITERAL( + base::FilePath echo_extension_path(FILE_PATH_LITERAL( "/usr/share/chromeos-assets/echo")); if (command_line->HasSwitch(switches::kEchoExtensionPath)) { echo_extension_path = @@ -408,7 +412,8 @@ void ComponentLoader::AddDefaultComponentExtensionsWithBackgroundPages( // Load ChromeVox extension now if spoken feedback is enabled. if (local_state_->GetBoolean(prefs::kSpokenFeedbackEnabled)) { - FilePath path = FilePath(extension_misc::kChromeVoxExtensionPath); + base::FilePath path = + base::FilePath(extension_misc::kChromeVoxExtensionPath); Add(IDR_CHROMEVOX_MANIFEST, path); } #endif @@ -416,7 +421,8 @@ void ComponentLoader::AddDefaultComponentExtensionsWithBackgroundPages( #if defined(ENABLE_GOOGLE_NOW) if (CommandLine::ForCurrentProcess()->HasSwitch( switches::kEnableGoogleNowIntegration)) { - Add(IDR_GOOGLE_NOW_MANIFEST, FilePath(FILE_PATH_LITERAL("google_now"))); + Add(IDR_GOOGLE_NOW_MANIFEST, + base::FilePath(FILE_PATH_LITERAL("google_now"))); } #endif } diff --git a/chrome/browser/extensions/component_loader.h b/chrome/browser/extensions/component_loader.h index 37df8f0..95e1a653 100644 --- a/chrome/browser/extensions/component_loader.h +++ b/chrome/browser/extensions/component_loader.h @@ -52,22 +52,22 @@ class ComponentLoader { // ssh-keygen -t rsa -b 1024 -N '' -f /tmp/key.pem // openssl rsa -pubout -outform DER < /tmp/key.pem 2>/dev/null | base64 -w 0 std::string Add(const std::string& manifest_contents, - const FilePath& root_directory); + const base::FilePath& root_directory); // Convenience method for registering a component extension by resource id. std::string Add(int manifest_resource_id, - const FilePath& root_directory); + const base::FilePath& root_directory); // Loads a component extension from file system. Replaces previously added // extension with the same ID. - std::string AddOrReplace(const FilePath& path); + std::string AddOrReplace(const base::FilePath& path); // Returns true if an extension with the specified id has been added. bool Exists(const std::string& id) const; // Unloads a component extension and removes it from the list of component // extensions to be loaded. - void Remove(const FilePath& root_directory); + void Remove(const base::FilePath& root_directory); void Remove(const std::string& id); // Call this during test setup to load component extensions that have @@ -96,20 +96,20 @@ class ComponentLoader { // Information about a registered component extension. struct ComponentExtensionInfo { ComponentExtensionInfo(const DictionaryValue* manifest, - const FilePath& root_directory); + const base::FilePath& root_directory); // The parsed contents of the extensions's manifest file. const DictionaryValue* manifest; // Directory where the extension is stored. - FilePath root_directory; + base::FilePath root_directory; // The component extension's ID. std::string extension_id; }; std::string Add(const DictionaryValue* parsed_manifest, - const FilePath& root_directory); + const base::FilePath& root_directory); // Loads a registered component extension. void Load(const ComponentExtensionInfo& info); diff --git a/chrome/browser/extensions/component_loader_unittest.cc b/chrome/browser/extensions/component_loader_unittest.cc index 09612ac6..6b270af 100644 --- a/chrome/browser/extensions/component_loader_unittest.cc +++ b/chrome/browser/extensions/component_loader_unittest.cc @@ -113,13 +113,13 @@ class ComponentLoaderTest : public testing::Test { ComponentLoader component_loader_; // The root directory of the text extension. - FilePath extension_path_; + base::FilePath extension_path_; // The contents of the text extension's manifest file. std::string manifest_contents_; - FilePath GetBasePath() { - FilePath test_data_dir; + base::FilePath GetBasePath() { + base::FilePath test_data_dir; PathService::Get(chrome::DIR_TEST_DATA, &test_data_dir); return test_data_dir.AppendASCII("extensions"); } @@ -286,9 +286,9 @@ TEST_F(ComponentLoaderTest, AddOrReplace) { EXPECT_EQ(0u, component_loader_.registered_extensions_count()); component_loader_.AddDefaultComponentExtensions(false); size_t const default_count = component_loader_.registered_extensions_count(); - FilePath known_extension = GetBasePath() + base::FilePath known_extension = GetBasePath() .AppendASCII("override_component_extension"); - FilePath unknow_extension = extension_path_; + base::FilePath unknow_extension = extension_path_; // Replace a default component extension. component_loader_.AddOrReplace(known_extension); diff --git a/chrome/browser/extensions/convert_user_script.cc b/chrome/browser/extensions/convert_user_script.cc index 4115b0d..8e06161 100644 --- a/chrome/browser/extensions/convert_user_script.cc +++ b/chrome/browser/extensions/convert_user_script.cc @@ -30,8 +30,8 @@ namespace values = extension_manifest_values; namespace extensions { scoped_refptr<Extension> ConvertUserScriptToExtension( - const FilePath& user_script_path, const GURL& original_url, - const FilePath& extensions_dir, string16* error) { + const base::FilePath& user_script_path, const GURL& original_url, + const base::FilePath& extensions_dir, string16* error) { std::string content; if (!file_util::ReadFileToString(user_script_path, &content)) { *error = ASCIIToUTF16("Could not read source file."); @@ -50,7 +50,7 @@ scoped_refptr<Extension> ConvertUserScriptToExtension( return NULL; } - FilePath install_temp_dir = + base::FilePath install_temp_dir = extension_file_util::GetInstallTempDir(extensions_dir); if (install_temp_dir.empty()) { *error = ASCIIToUTF16("Could not get path to profile temporary directory."); @@ -155,7 +155,7 @@ scoped_refptr<Extension> ConvertUserScriptToExtension( root->Set(keys::kContentScripts, content_scripts); - FilePath manifest_path = temp_dir.path().Append( + base::FilePath manifest_path = temp_dir.path().Append( Extension::kManifestFilename); JSONFileValueSerializer serializer(manifest_path); if (!serializer.Serialize(*root)) { diff --git a/chrome/browser/extensions/convert_user_script_unittest.cc b/chrome/browser/extensions/convert_user_script_unittest.cc index 960bf9e..3c5901e 100644 --- a/chrome/browser/extensions/convert_user_script_unittest.cc +++ b/chrome/browser/extensions/convert_user_script_unittest.cc @@ -31,7 +31,7 @@ TEST(ExtensionFromUserScript, Basic) { base::ScopedTempDir extensions_dir; ASSERT_TRUE(extensions_dir.CreateUniqueTempDir()); - FilePath test_file; + base::FilePath test_file; ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &test_file)); test_file = test_file.AppendASCII("extensions") .AppendASCII("user_script_basic.user.js"); @@ -81,7 +81,7 @@ TEST(ExtensionFromUserScript, NoMetdata) { base::ScopedTempDir extensions_dir; ASSERT_TRUE(extensions_dir.CreateUniqueTempDir()); - FilePath test_file; + base::FilePath test_file; ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &test_file)); test_file = test_file.AppendASCII("extensions") .AppendASCII("user_script_no_metadata.user.js"); @@ -127,7 +127,7 @@ TEST(ExtensionFromUserScript, NotUTF8) { base::ScopedTempDir extensions_dir; ASSERT_TRUE(extensions_dir.CreateUniqueTempDir()); - FilePath test_file; + base::FilePath test_file; ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &test_file)); test_file = test_file.AppendASCII("extensions") .AppendASCII("user_script_not_utf8.user.js"); @@ -145,7 +145,7 @@ TEST(ExtensionFromUserScript, RunAtDocumentStart) { base::ScopedTempDir extensions_dir; ASSERT_TRUE(extensions_dir.CreateUniqueTempDir()); - FilePath test_file; + base::FilePath test_file; ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &test_file)); test_file = test_file.AppendASCII("extensions") .AppendASCII("user_script_run_at_start.user.js"); @@ -178,7 +178,7 @@ TEST(ExtensionFromUserScript, RunAtDocumentEnd) { base::ScopedTempDir extensions_dir; ASSERT_TRUE(extensions_dir.CreateUniqueTempDir()); - FilePath test_file; + base::FilePath test_file; ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &test_file)); test_file = test_file.AppendASCII("extensions") .AppendASCII("user_script_run_at_end.user.js"); @@ -211,7 +211,7 @@ TEST(ExtensionFromUserScript, RunAtDocumentIdle) { base::ScopedTempDir extensions_dir; ASSERT_TRUE(extensions_dir.CreateUniqueTempDir()); - FilePath test_file; + base::FilePath test_file; ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &test_file)); test_file = test_file.AppendASCII("extensions") .AppendASCII("user_script_run_at_idle.user.js"); diff --git a/chrome/browser/extensions/convert_web_app.cc b/chrome/browser/extensions/convert_web_app.cc index f1d8960..820a09d 100644 --- a/chrome/browser/extensions/convert_web_app.cc +++ b/chrome/browser/extensions/convert_web_app.cc @@ -86,8 +86,8 @@ std::string ConvertTimeToExtensionVersion(const Time& create_time) { scoped_refptr<Extension> ConvertWebAppToExtension( const WebApplicationInfo& web_app, const Time& create_time, - const FilePath& extensions_dir) { - FilePath install_temp_dir = + const base::FilePath& extensions_dir) { + base::FilePath install_temp_dir = extension_file_util::GetInstallTempDir(extensions_dir); if (install_temp_dir.empty()) { LOG(ERROR) << "Could not get path to profile temporary directory."; @@ -143,7 +143,7 @@ scoped_refptr<Extension> ConvertWebAppToExtension( } // Write the manifest. - FilePath manifest_path = temp_dir.path().Append( + base::FilePath manifest_path = temp_dir.path().Append( Extension::kManifestFilename); JSONFileValueSerializer serializer(manifest_path); if (!serializer.Serialize(*root)) { @@ -152,7 +152,7 @@ scoped_refptr<Extension> ConvertWebAppToExtension( } // Write the icon files. - FilePath icons_dir = temp_dir.path().AppendASCII(kIconsDirName); + base::FilePath icons_dir = temp_dir.path().AppendASCII(kIconsDirName); if (!file_util::CreateDirectory(icons_dir)) { LOG(ERROR) << "Could not create icons directory."; return NULL; @@ -162,7 +162,7 @@ scoped_refptr<Extension> ConvertWebAppToExtension( if (web_app.icons[i].data.config() == SkBitmap::kNo_Config) continue; - FilePath icon_file = icons_dir.AppendASCII( + base::FilePath icon_file = icons_dir.AppendASCII( StringPrintf("%i.png", web_app.icons[i].width)); std::vector<unsigned char> image_data; if (!gfx::PNGCodec::EncodeBGRASkBitmap(web_app.icons[i].data, diff --git a/chrome/browser/extensions/convert_web_app_unittest.cc b/chrome/browser/extensions/convert_web_app_unittest.cc index fe97b66..60db8dc 100644 --- a/chrome/browser/extensions/convert_web_app_unittest.cc +++ b/chrome/browser/extensions/convert_web_app_unittest.cc @@ -35,7 +35,7 @@ namespace { WebApplicationInfo::IconInfo GetIconInfo(const GURL& url, int size) { WebApplicationInfo::IconInfo result; - FilePath icon_file; + base::FilePath icon_file; if (!PathService::Get(chrome::DIR_TEST_DATA, &icon_file)) { ADD_FAILURE() << "Could not get test data directory."; return result; diff --git a/chrome/browser/extensions/crx_installer.cc b/chrome/browser/extensions/crx_installer.cc index dd54f06..5ba1d5e 100644 --- a/chrome/browser/extensions/crx_installer.cc +++ b/chrome/browser/extensions/crx_installer.cc @@ -139,7 +139,7 @@ CrxInstaller::~CrxInstaller() { } } -void CrxInstaller::InstallCrx(const FilePath& source_file) { +void CrxInstaller::InstallCrx(const base::FilePath& source_file) { source_file_ = source_file; scoped_refptr<SandboxedUnpacker> unpacker( @@ -158,7 +158,7 @@ void CrxInstaller::InstallCrx(const FilePath& source_file) { NOTREACHED(); } -void CrxInstaller::InstallUserScript(const FilePath& source_file, +void CrxInstaller::InstallUserScript(const base::FilePath& source_file, const GURL& download_url) { DCHECK(!download_url.is_empty()); @@ -194,7 +194,8 @@ void CrxInstaller::InstallWebApp(const WebApplicationInfo& web_app) { } void CrxInstaller::ConvertWebAppOnFileThread( - const WebApplicationInfo& web_app, const FilePath& install_directory) { + const WebApplicationInfo& web_app, + const base::FilePath& install_directory) { string16 error; scoped_refptr<Extension> extension( ConvertWebAppToExtension(web_app, base::Time::Now(), install_directory)); @@ -351,8 +352,8 @@ void CrxInstaller::OnUnpackFailure(const string16& error_message) { ReportFailureFromFileThread(CrxInstallerError(error_message)); } -void CrxInstaller::OnUnpackSuccess(const FilePath& temp_dir, - const FilePath& extension_dir, +void CrxInstaller::OnUnpackSuccess(const base::FilePath& temp_dir, + const base::FilePath& extension_dir, const DictionaryValue* original_manifest, const Extension* extension) { DCHECK(installer_task_runner_->RunsTasksOnCurrentThread()); @@ -515,7 +516,7 @@ void CrxInstaller::CompleteInstall() { "Extensions.CrxInstallDirPathLength", install_directory_.value().length(), 0, 500, 100); - FilePath version_dir = extension_file_util::InstallExtension( + base::FilePath version_dir = extension_file_util::InstallExtension( unpacked_extension_root_, extension_->id(), extension_->VersionString(), @@ -665,12 +666,12 @@ void CrxInstaller::CleanupTempFiles() { // Delete the temp directory and crx file as necessary. if (!temp_dir_.value().empty()) { extension_file_util::DeleteFile(temp_dir_, true); - temp_dir_ = FilePath(); + temp_dir_ = base::FilePath(); } if (delete_source_ && !source_file_.value().empty()) { extension_file_util::DeleteFile(source_file_, false); - source_file_ = FilePath(); + source_file_ = base::FilePath(); } } diff --git a/chrome/browser/extensions/crx_installer.h b/chrome/browser/extensions/crx_installer.h index b0e368a..a939003 100644 --- a/chrome/browser/extensions/crx_installer.h +++ b/chrome/browser/extensions/crx_installer.h @@ -89,10 +89,10 @@ class CrxInstaller const WebstoreInstaller::Approval* approval); // Install the crx in |source_file|. - void InstallCrx(const FilePath& source_file); + void InstallCrx(const base::FilePath& source_file); // Convert the specified user script into an extension and install it. - void InstallUserScript(const FilePath& source_file, + void InstallUserScript(const base::FilePath& source_file, const GURL& download_url); // Convert the specified web app into an extension and install it. @@ -108,7 +108,7 @@ class CrxInstaller const GURL& download_url() const { return download_url_; } void set_download_url(const GURL& val) { download_url_ = val; } - const FilePath& source_file() const { return source_file_; } + const base::FilePath& source_file() const { return source_file_; } Manifest::Location install_source() const { return install_source_; @@ -204,7 +204,7 @@ class CrxInstaller // Converts the source web app to an extension. void ConvertWebAppOnFileThread(const WebApplicationInfo& web_app, - const FilePath& install_directory); + const base::FilePath& install_directory); // Called after OnUnpackSuccess as a last check to see whether the install // should complete. @@ -212,8 +212,8 @@ class CrxInstaller // SandboxedUnpackerClient virtual void OnUnpackFailure(const string16& error_message) OVERRIDE; - virtual void OnUnpackSuccess(const FilePath& temp_dir, - const FilePath& extension_dir, + virtual void OnUnpackSuccess(const base::FilePath& temp_dir, + const base::FilePath& extension_dir, const base::DictionaryValue* original_manifest, const Extension* extension) OVERRIDE; @@ -249,13 +249,13 @@ class CrxInstaller scoped_refptr<base::SequencedTaskRunner> CreateSequencedTaskRunner(); // The file we're installing. - FilePath source_file_; + base::FilePath source_file_; // The URL the file was downloaded from. GURL download_url_; // The directory extensions are installed to. - FilePath install_directory_; + base::FilePath install_directory_; // The location the installation came from (bundled with Chromium, registry, // manual install, etc). This metadata is saved with the installation if @@ -319,7 +319,7 @@ class CrxInstaller // The temp directory extension resources were unpacked to. We own this and // must delete it when we are done with it. - FilePath temp_dir_; + base::FilePath temp_dir_; // The frontend we will report results back to. base::WeakPtr<ExtensionService> frontend_weak_; @@ -335,7 +335,7 @@ class CrxInstaller // The root of the unpacked extension directory. This is a subdirectory of // temp_dir_, so we don't have to delete it explicitly. - FilePath unpacked_extension_root_; + base::FilePath unpacked_extension_root_; // True when the CRX being installed was just downloaded. // Used to trigger extra checks before installing. diff --git a/chrome/browser/extensions/crx_installer_browsertest.cc b/chrome/browser/extensions/crx_installer_browsertest.cc index 7278736..f3b60ef 100644 --- a/chrome/browser/extensions/crx_installer_browsertest.cc +++ b/chrome/browser/extensions/crx_installer_browsertest.cc @@ -86,7 +86,7 @@ class ExtensionCrxInstallerTest : public ExtensionBrowserTest { MockInstallPrompt* mock_install_prompt) { ExtensionService* service = extensions::ExtensionSystem::Get( browser()->profile())->extension_service(); - FilePath ext_path = test_data_dir_.AppendASCII(ext_relpath); + base::FilePath ext_path = test_data_dir_.AppendASCII(ext_relpath); std::string error; base::DictionaryValue* parsed_manifest = @@ -165,7 +165,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionCrxInstallerTest, CommandLine* command_line = CommandLine::ForCurrentProcess(); CommandLine old_command_line = *command_line; command_line->AppendSwitch(switches::kEnableExperimentalExtensionApis); - FilePath crx_path = PackExtension( + base::FilePath crx_path = PackExtension( test_data_dir_.AppendASCII("experimental")); ASSERT_FALSE(crx_path.empty()); @@ -198,7 +198,7 @@ IN_PROC_BROWSER_TEST_F( const int kNumDownloadsExpected = 1; LOG(ERROR) << "PackAndInstallExtension: Packing extension"; - FilePath crx_path = PackExtension( + base::FilePath crx_path = PackExtension( test_data_dir_.AppendASCII("common/background_page")); ASSERT_FALSE(crx_path.empty()); std::string crx_path_string(crx_path.value().begin(), crx_path.value().end()); diff --git a/chrome/browser/extensions/docs/examples/apps/calculator_browsertest.cc b/chrome/browser/extensions/docs/examples/apps/calculator_browsertest.cc index 0f4a4da..a4cfe60 100644 --- a/chrome/browser/extensions/docs/examples/apps/calculator_browsertest.cc +++ b/chrome/browser/extensions/docs/examples/apps/calculator_browsertest.cc @@ -17,7 +17,7 @@ class CalculatorBrowserTest : public InProcessBrowserTest { }; IN_PROC_BROWSER_TEST_F(CalculatorBrowserTest, Model) { - FilePath test_file; + base::FilePath test_file; PathService::Get(chrome::DIR_TEST_DATA, &test_file); test_file = test_file.DirName().DirName() .AppendASCII("common").AppendASCII("extensions").AppendASCII("docs") diff --git a/chrome/browser/extensions/extension_action_icon_factory_unittest.cc b/chrome/browser/extensions/extension_action_icon_factory_unittest.cc index e75775b..9267b51 100644 --- a/chrome/browser/extensions/extension_action_icon_factory_unittest.cc +++ b/chrome/browser/extensions/extension_action_icon_factory_unittest.cc @@ -59,7 +59,7 @@ gfx::ImageSkiaRep CreateBlankRep(int size_dip, ui::ScaleFactor scale_factor) { } gfx::Image LoadIcon(const std::string& filename) { - FilePath path; + base::FilePath path; PathService::Get(chrome::DIR_TEST_DATA, &path); path = path.AppendASCII("extensions/api_test").AppendASCII(filename); @@ -97,7 +97,7 @@ class ExtensionActionIconFactoryTest scoped_refptr<Extension> CreateExtension(const char* name, Manifest::Location location) { // Create and load an extension. - FilePath test_file; + base::FilePath test_file; if (!PathService::Get(chrome::DIR_TEST_DATA, &test_file)) { EXPECT_FALSE(true); return NULL; @@ -134,7 +134,7 @@ class ExtensionActionIconFactoryTest CommandLine command_line(CommandLine::NO_PROGRAM); extension_service_ = static_cast<extensions::TestExtensionSystem*>( extensions::ExtensionSystem::Get(profile_.get()))-> - CreateExtensionService(&command_line, FilePath(), false); + CreateExtensionService(&command_line, base::FilePath(), false); } virtual void TearDown() OVERRIDE { diff --git a/chrome/browser/extensions/extension_apitest.cc b/chrome/browser/extensions/extension_apitest.cc index 6c279cf..e3534e4 100644 --- a/chrome/browser/extensions/extension_apitest.cc +++ b/chrome/browser/extensions/extension_apitest.cc @@ -192,7 +192,7 @@ bool ExtensionApiTest::RunExtensionTestImpl(const char* extension_name, const extensions::Extension* extension = NULL; if (!std::string(extension_name).empty()) { - FilePath extension_path = test_data_dir_.AppendASCII(extension_name); + base::FilePath extension_path = test_data_dir_.AppendASCII(extension_name); if (load_as_component) { extension = LoadExtensionAsComponent(extension_path); } else { @@ -294,7 +294,8 @@ bool ExtensionApiTest::StartTestServer() { return true; } -bool ExtensionApiTest::StartWebSocketServer(const FilePath& root_directory) { +bool ExtensionApiTest::StartWebSocketServer( + const base::FilePath& root_directory) { websocket_server_.reset(new net::TestServer( net::TestServer::TYPE_WS, net::TestServer::kLocalhost, diff --git a/chrome/browser/extensions/extension_browsertest.cc b/chrome/browser/extensions/extension_browsertest.cc index 37c3672..152b244 100644 --- a/chrome/browser/extensions/extension_browsertest.cc +++ b/chrome/browser/extensions/extension_browsertest.cc @@ -93,7 +93,7 @@ void ExtensionBrowserTest::SetUpCommandLine(CommandLine* command_line) { } const Extension* ExtensionBrowserTest::LoadExtensionWithFlags( - const FilePath& path, int flags) { + const base::FilePath& path, int flags) { ExtensionService* service = extensions::ExtensionSystem::Get( profile())->extension_service(); { @@ -111,7 +111,7 @@ const Extension* ExtensionBrowserTest::LoadExtensionWithFlags( // Find the loaded extension by its path. See crbug.com/59531 for why // we cannot just use last_loaded_extension_id_. - FilePath extension_path = path; + base::FilePath extension_path = path; file_util::AbsolutePath(&extension_path); const Extension* extension = NULL; for (ExtensionSet::const_iterator iter = service->extensions()->begin(); @@ -188,18 +188,19 @@ const Extension* ExtensionBrowserTest::LoadExtensionWithFlags( return extension; } -const Extension* ExtensionBrowserTest::LoadExtension(const FilePath& path) { +const Extension* ExtensionBrowserTest::LoadExtension( + const base::FilePath& path) { return LoadExtensionWithFlags(path, kFlagEnableFileAccess); } const Extension* ExtensionBrowserTest::LoadExtensionIncognito( - const FilePath& path) { + const base::FilePath& path) { return LoadExtensionWithFlags(path, kFlagEnableFileAccess | kFlagEnableIncognito); } const Extension* ExtensionBrowserTest::LoadExtensionAsComponent( - const FilePath& path) { + const base::FilePath& path) { ExtensionService* service = extensions::ExtensionSystem::Get( profile())->extension_service(); @@ -216,42 +217,44 @@ const Extension* ExtensionBrowserTest::LoadExtensionAsComponent( return extension; } -FilePath ExtensionBrowserTest::PackExtension(const FilePath& dir_path) { - FilePath crx_path = temp_dir_.path().AppendASCII("temp.crx"); +base::FilePath ExtensionBrowserTest::PackExtension( + const base::FilePath& dir_path) { + base::FilePath crx_path = temp_dir_.path().AppendASCII("temp.crx"); if (!file_util::Delete(crx_path, false)) { ADD_FAILURE() << "Failed to delete crx: " << crx_path.value(); - return FilePath(); + return base::FilePath(); } // Look for PEM files with the same name as the directory. - FilePath pem_path = dir_path.ReplaceExtension(FILE_PATH_LITERAL(".pem")); - FilePath pem_path_out; + base::FilePath pem_path = + dir_path.ReplaceExtension(FILE_PATH_LITERAL(".pem")); + base::FilePath pem_path_out; if (!file_util::PathExists(pem_path)) { - pem_path = FilePath(); + pem_path = base::FilePath(); pem_path_out = crx_path.DirName().AppendASCII("temp.pem"); if (!file_util::Delete(pem_path_out, false)) { ADD_FAILURE() << "Failed to delete pem: " << pem_path_out.value(); - return FilePath(); + return base::FilePath(); } } return PackExtensionWithOptions(dir_path, crx_path, pem_path, pem_path_out); } -FilePath ExtensionBrowserTest::PackExtensionWithOptions( - const FilePath& dir_path, - const FilePath& crx_path, - const FilePath& pem_path, - const FilePath& pem_out_path) { +base::FilePath ExtensionBrowserTest::PackExtensionWithOptions( + const base::FilePath& dir_path, + const base::FilePath& crx_path, + const base::FilePath& pem_path, + const base::FilePath& pem_out_path) { if (!file_util::PathExists(dir_path)) { ADD_FAILURE() << "Extension dir not found: " << dir_path.value(); - return FilePath(); + return base::FilePath(); } if (!file_util::PathExists(pem_path) && pem_out_path.empty()) { ADD_FAILURE() << "Must specify a PEM file or PEM output path"; - return FilePath(); + return base::FilePath(); } scoped_ptr<ExtensionCreator> creator(new ExtensionCreator()); @@ -262,12 +265,12 @@ FilePath ExtensionBrowserTest::PackExtensionWithOptions( ExtensionCreator::kOverwriteCRX)) { ADD_FAILURE() << "ExtensionCreator::Run() failed: " << creator->error_message(); - return FilePath(); + return base::FilePath(); } if (!file_util::PathExists(crx_path)) { ADD_FAILURE() << crx_path.value() << " was not created."; - return FilePath(); + return base::FilePath(); } return crx_path; } @@ -310,7 +313,7 @@ class MockAutoConfirmExtensionInstallPrompt : public ExtensionInstallPrompt { }; const Extension* ExtensionBrowserTest::InstallExtensionFromWebstore( - const FilePath& path, + const base::FilePath& path, int expected_change) { return InstallOrUpdateExtension("", path, INSTALL_UI_TYPE_NONE, expected_change, Manifest::INTERNAL, @@ -319,7 +322,7 @@ const Extension* ExtensionBrowserTest::InstallExtensionFromWebstore( const Extension* ExtensionBrowserTest::InstallOrUpdateExtension( const std::string& id, - const FilePath& path, + const base::FilePath& path, InstallUIType ui_type, int expected_change) { return InstallOrUpdateExtension(id, path, ui_type, expected_change, @@ -328,7 +331,7 @@ const Extension* ExtensionBrowserTest::InstallOrUpdateExtension( const Extension* ExtensionBrowserTest::InstallOrUpdateExtension( const std::string& id, - const FilePath& path, + const base::FilePath& path, InstallUIType ui_type, int expected_change, Browser* browser, @@ -339,7 +342,7 @@ const Extension* ExtensionBrowserTest::InstallOrUpdateExtension( const Extension* ExtensionBrowserTest::InstallOrUpdateExtension( const std::string& id, - const FilePath& path, + const base::FilePath& path, InstallUIType ui_type, int expected_change, Manifest::Location install_source) { @@ -349,7 +352,7 @@ const Extension* ExtensionBrowserTest::InstallOrUpdateExtension( const Extension* ExtensionBrowserTest::InstallOrUpdateExtension( const std::string& id, - const FilePath& path, + const base::FilePath& path, InstallUIType ui_type, int expected_change, Manifest::Location install_source, @@ -373,7 +376,7 @@ const Extension* ExtensionBrowserTest::InstallOrUpdateExtension( // TODO(tessamac): Update callers to always pass an unpacked extension // and then always pack the extension here. - FilePath crx_path = path; + base::FilePath crx_path = path; if (crx_path.Extension() != FILE_PATH_LITERAL(".crx")) { crx_path = PackExtension(path); } diff --git a/chrome/browser/extensions/extension_browsertest.h b/chrome/browser/extensions/extension_browsertest.h index a26b80b..375b15e 100644 --- a/chrome/browser/extensions/extension_browsertest.h +++ b/chrome/browser/extensions/extension_browsertest.h @@ -66,35 +66,37 @@ class ExtensionBrowserTest : virtual public InProcessBrowserTest, // InProcessBrowserTest virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE; - const extensions::Extension* LoadExtension(const FilePath& path); + const extensions::Extension* LoadExtension(const base::FilePath& path); // Same as above, but enables the extension in incognito mode first. - const extensions::Extension* LoadExtensionIncognito(const FilePath& path); + const extensions::Extension* LoadExtensionIncognito( + const base::FilePath& path); const extensions::Extension* LoadExtensionWithFlags( - const FilePath& path, int flags); + const base::FilePath& path, int flags); // Loads extension and imitates that it is a component extension. - const extensions::Extension* LoadExtensionAsComponent(const FilePath& path); + const extensions::Extension* LoadExtensionAsComponent( + const base::FilePath& path); // Pack the extension in |dir_path| into a crx file and return its path. // Return an empty FilePath if there were errors. - FilePath PackExtension(const FilePath& dir_path); + base::FilePath PackExtension(const base::FilePath& dir_path); // Pack the extension in |dir_path| into a crx file at |crx_path|, using the // key |pem_path|. If |pem_path| does not exist, create a new key at // |pem_out_path|. // Return the path to the crx file, or an empty FilePath if there were errors. - FilePath PackExtensionWithOptions(const FilePath& dir_path, - const FilePath& crx_path, - const FilePath& pem_path, - const FilePath& pem_out_path); + base::FilePath PackExtensionWithOptions(const base::FilePath& dir_path, + const base::FilePath& crx_path, + const base::FilePath& pem_path, + const base::FilePath& pem_out_path); // |expected_change| indicates how many extensions should be installed (or // disabled, if negative). // 1 means you expect a new install, 0 means you expect an upgrade, -1 means // you expect a failed upgrade. - const extensions::Extension* InstallExtension(const FilePath& path, + const extensions::Extension* InstallExtension(const base::FilePath& path, int expected_change) { return InstallOrUpdateExtension("", path, INSTALL_UI_TYPE_NONE, expected_change); @@ -103,7 +105,7 @@ class ExtensionBrowserTest : virtual public InProcessBrowserTest, // Same as above, but an install source other than Manifest::INTERNAL can be // specified. const extensions::Extension* InstallExtension( - const FilePath& path, + const base::FilePath& path, int expected_change, extensions::Manifest::Location install_source) { return InstallOrUpdateExtension("", path, INSTALL_UI_TYPE_NONE, @@ -112,12 +114,12 @@ class ExtensionBrowserTest : virtual public InProcessBrowserTest, // Installs extension as if it came from the Chrome Webstore. const extensions::Extension* InstallExtensionFromWebstore( - const FilePath& path, int expected_change); + const base::FilePath& path, int expected_change); // Same as above but passes an id to CrxInstaller and does not allow a // privilege increase. const extensions::Extension* UpdateExtension(const std::string& id, - const FilePath& path, + const base::FilePath& path, int expected_change) { return InstallOrUpdateExtension(id, path, INSTALL_UI_TYPE_NONE, expected_change); @@ -125,14 +127,15 @@ class ExtensionBrowserTest : virtual public InProcessBrowserTest, // Same as |InstallExtension| but with the normal extension UI showing up // (for e.g. info bar on success). - const extensions::Extension* InstallExtensionWithUI(const FilePath& path, - int expected_change) { + const extensions::Extension* InstallExtensionWithUI( + const base::FilePath& path, + int expected_change) { return InstallOrUpdateExtension("", path, INSTALL_UI_TYPE_NORMAL, expected_change); } const extensions::Extension* InstallExtensionWithUIAutoConfirm( - const FilePath& path, + const base::FilePath& path, int expected_change, Browser* browser) { return InstallOrUpdateExtension("", path, INSTALL_UI_TYPE_AUTO_CONFIRM, @@ -140,7 +143,8 @@ class ExtensionBrowserTest : virtual public InProcessBrowserTest, } // Begins install process but simulates a user cancel. - const extensions::Extension* StartInstallButCancel(const FilePath& path) { + const extensions::Extension* StartInstallButCancel( + const base::FilePath& path) { return InstallOrUpdateExtension("", path, INSTALL_UI_TYPE_CANCEL, 0); } @@ -209,7 +213,7 @@ class ExtensionBrowserTest : virtual public InProcessBrowserTest, bool installed_; // test_data/extensions. - FilePath test_data_dir_; + base::FilePath test_data_dir_; std::string last_loaded_extension_id_; int extension_installs_observed_; int extension_load_errors_observed_; @@ -228,25 +232,27 @@ class ExtensionBrowserTest : virtual public InProcessBrowserTest, INSTALL_UI_TYPE_AUTO_CONFIRM, }; - const extensions::Extension* InstallOrUpdateExtension(const std::string& id, - const FilePath& path, - InstallUIType ui_type, - int expected_change); - const extensions::Extension* InstallOrUpdateExtension(const std::string& id, - const FilePath& path, - InstallUIType ui_type, - int expected_change, - Browser* browser, - bool from_webstore); const extensions::Extension* InstallOrUpdateExtension( const std::string& id, - const FilePath& path, + const base::FilePath& path, + InstallUIType ui_type, + int expected_change); + const extensions::Extension* InstallOrUpdateExtension( + const std::string& id, + const base::FilePath& path, + InstallUIType ui_type, + int expected_change, + Browser* browser, + bool from_webstore); + const extensions::Extension* InstallOrUpdateExtension( + const std::string& id, + const base::FilePath& path, InstallUIType ui_type, int expected_change, extensions::Manifest::Location install_source); const extensions::Extension* InstallOrUpdateExtension( const std::string& id, - const FilePath& path, + const base::FilePath& path, InstallUIType ui_type, int expected_change, extensions::Manifest::Location install_source, diff --git a/chrome/browser/extensions/extension_context_menu_browsertest.cc b/chrome/browser/extensions/extension_context_menu_browsertest.cc index 3108636..e79f5f2 100644 --- a/chrome/browser/extensions/extension_context_menu_browsertest.cc +++ b/chrome/browser/extensions/extension_context_menu_browsertest.cc @@ -89,14 +89,14 @@ class ExtensionContextMenuBrowserTest : public ExtensionBrowserTest { // extensions test data dir. const extensions::Extension* LoadContextMenuExtension( std::string subdirectory) { - FilePath extension_dir = + base::FilePath extension_dir = test_data_dir_.AppendASCII("context_menus").AppendASCII(subdirectory); return LoadExtension(extension_dir); } const extensions::Extension* LoadContextMenuExtensionIncognito( std::string subdirectory) { - FilePath extension_dir = + base::FilePath extension_dir = test_data_dir_.AppendASCII("context_menus").AppendASCII(subdirectory); return LoadExtensionIncognito(extension_dir); } diff --git a/chrome/browser/extensions/extension_crash_recovery_browsertest.cc b/chrome/browser/extensions/extension_crash_recovery_browsertest.cc index 9df5411..fda42d1 100644 --- a/chrome/browser/extensions/extension_crash_recovery_browsertest.cc +++ b/chrome/browser/extensions/extension_crash_recovery_browsertest.cc @@ -237,9 +237,10 @@ IN_PROC_BROWSER_TEST_F(MAYBE_ExtensionCrashRecoveryTest, ASSERT_EQ(1U, CountBalloons()); // Navigate to another page. - ui_test_utils::NavigateToURL(browser(), - ui_test_utils::GetTestUrl(FilePath(FilePath::kCurrentDirectory), - FilePath(FILE_PATH_LITERAL("title1.html")))); + ui_test_utils::NavigateToURL( + browser(), ui_test_utils::GetTestUrl( + base::FilePath(base::FilePath::kCurrentDirectory), + base::FilePath(FILE_PATH_LITERAL("title1.html")))); ASSERT_EQ(1U, CountBalloons()); ReloadExtension(first_extension_id_); diff --git a/chrome/browser/extensions/extension_creator.cc b/chrome/browser/extensions/extension_creator.cc index f76790f..c4bc70d 100644 --- a/chrome/browser/extensions/extension_creator.cc +++ b/chrome/browser/extensions/extension_creator.cc @@ -33,10 +33,10 @@ ExtensionCreator::ExtensionCreator() : error_type_(kOtherError) { } bool ExtensionCreator::InitializeInput( - const FilePath& extension_dir, - const FilePath& crx_path, - const FilePath& private_key_path, - const FilePath& private_key_output_path, + const base::FilePath& extension_dir, + const base::FilePath& crx_path, + const base::FilePath& private_key_path, + const base::FilePath& private_key_output_path, int run_flags) { // Validate input |extension_dir|. if (extension_dir.value().empty() || @@ -46,7 +46,7 @@ bool ExtensionCreator::InitializeInput( return false; } - FilePath absolute_extension_dir = extension_dir; + base::FilePath absolute_extension_dir = extension_dir; if (!file_util::AbsolutePath(&absolute_extension_dir)) { error_message_ = l10n_util::GetStringUTF8(IDS_EXTENSION_CANT_GET_ABSOLUTE_PATH); @@ -83,7 +83,7 @@ bool ExtensionCreator::InitializeInput( return true; } -bool ExtensionCreator::ValidateManifest(const FilePath& extension_dir, +bool ExtensionCreator::ValidateManifest(const base::FilePath& extension_dir, crypto::RSAPrivateKey* key_pair, int run_flags) { std::vector<uint8> public_key_bytes; @@ -118,7 +118,7 @@ bool ExtensionCreator::ValidateManifest(const FilePath& extension_dir, return !!extension.get(); } -crypto::RSAPrivateKey* ExtensionCreator::ReadInputKey(const FilePath& +crypto::RSAPrivateKey* ExtensionCreator::ReadInputKey(const base::FilePath& private_key_path) { if (!file_util::PathExists(private_key_path)) { error_message_ = @@ -146,7 +146,7 @@ crypto::RSAPrivateKey* ExtensionCreator::ReadInputKey(const FilePath& std::vector<uint8>(private_key_bytes.begin(), private_key_bytes.end())); } -crypto::RSAPrivateKey* ExtensionCreator::GenerateKey(const FilePath& +crypto::RSAPrivateKey* ExtensionCreator::GenerateKey(const base::FilePath& output_private_key_path) { scoped_ptr<crypto::RSAPrivateKey> key_pair( crypto::RSAPrivateKey::Create(kRSAKeySize)); @@ -192,13 +192,13 @@ crypto::RSAPrivateKey* ExtensionCreator::GenerateKey(const FilePath& return key_pair.release(); } -bool ExtensionCreator::CreateZip(const FilePath& extension_dir, - const FilePath& temp_path, - FilePath* zip_path) { +bool ExtensionCreator::CreateZip(const base::FilePath& extension_dir, + const base::FilePath& temp_path, + base::FilePath* zip_path) { *zip_path = temp_path.Append(FILE_PATH_LITERAL("extension.zip")); scoped_refptr<ExtensionCreatorFilter> filter = new ExtensionCreatorFilter(); - const base::Callback<bool(const FilePath&)>& filter_cb = + const base::Callback<bool(const base::FilePath&)>& filter_cb = base::Bind(&ExtensionCreatorFilter::ShouldPackageFile, filter.get()); if (!zip::ZipWithFilterCallback(extension_dir, *zip_path, filter_cb)) { error_message_ = @@ -209,7 +209,7 @@ bool ExtensionCreator::CreateZip(const FilePath& extension_dir, return true; } -bool ExtensionCreator::SignZip(const FilePath& zip_path, +bool ExtensionCreator::SignZip(const base::FilePath& zip_path, crypto::RSAPrivateKey* private_key, std::vector<uint8>* signature) { scoped_ptr<crypto::SignatureCreator> signature_creator( @@ -232,10 +232,10 @@ bool ExtensionCreator::SignZip(const FilePath& zip_path, return true; } -bool ExtensionCreator::WriteCRX(const FilePath& zip_path, +bool ExtensionCreator::WriteCRX(const base::FilePath& zip_path, crypto::RSAPrivateKey* private_key, const std::vector<uint8>& signature, - const FilePath& crx_path) { + const base::FilePath& crx_path) { if (file_util::PathExists(crx_path)) file_util::Delete(crx_path, false); ScopedStdioHandle crx_handle(file_util::OpenFile(crx_path, "wb")); @@ -282,10 +282,10 @@ bool ExtensionCreator::WriteCRX(const FilePath& zip_path, return true; } -bool ExtensionCreator::Run(const FilePath& extension_dir, - const FilePath& crx_path, - const FilePath& private_key_path, - const FilePath& output_private_key_path, +bool ExtensionCreator::Run(const base::FilePath& extension_dir, + const base::FilePath& crx_path, + const base::FilePath& private_key_path, + const base::FilePath& output_private_key_path, int run_flags) { // Check input diretory and read manifest. if (!InitializeInput(extension_dir, crx_path, private_key_path, @@ -313,7 +313,7 @@ bool ExtensionCreator::Run(const FilePath& extension_dir, return false; // Zip up the extension. - FilePath zip_path; + base::FilePath zip_path; std::vector<uint8> signature; bool result = false; if (CreateZip(extension_dir, temp_dir.path(), &zip_path) && diff --git a/chrome/browser/extensions/extension_creator_filter.cc b/chrome/browser/extensions/extension_creator_filter.cc index fdca45a..31fe356 100644 --- a/chrome/browser/extensions/extension_creator_filter.cc +++ b/chrome/browser/extensions/extension_creator_filter.cc @@ -12,14 +12,15 @@ namespace extensions { -bool ExtensionCreatorFilter::ShouldPackageFile(const FilePath& file_path) { - const FilePath& base_name = file_path.BaseName(); +bool ExtensionCreatorFilter::ShouldPackageFile( + const base::FilePath& file_path) { + const base::FilePath& base_name = file_path.BaseName(); if (base_name.empty()) { return false; } - FilePath::CharType first_character = base_name.value()[0]; - FilePath::CharType last_character = + base::FilePath::CharType first_character = base_name.value()[0]; + base::FilePath::CharType last_character = base_name.value()[base_name.value().length() - 1]; // dotfile diff --git a/chrome/browser/extensions/extension_creator_filter_unittest.cc b/chrome/browser/extensions/extension_creator_filter_unittest.cc index 657624b..45e9941 100644 --- a/chrome/browser/extensions/extension_creator_filter_unittest.cc +++ b/chrome/browser/extensions/extension_creator_filter_unittest.cc @@ -22,9 +22,9 @@ class ExtensionCreatorFilterTest : public PlatformTest { filter_ = new extensions::ExtensionCreatorFilter(); } - FilePath CreateEmptyTestFile(const FilePath& file_path) { - FilePath test_file(test_dir_.Append(file_path)); - FilePath temp_file; + base::FilePath CreateEmptyTestFile(const base::FilePath& file_path) { + base::FilePath test_file(test_dir_.Append(file_path)); + base::FilePath temp_file; EXPECT_TRUE(file_util::CreateTemporaryFileInDir(test_dir_, &temp_file)); EXPECT_TRUE(file_util::Move(temp_file, test_file)); return test_file; @@ -34,11 +34,11 @@ class ExtensionCreatorFilterTest : public PlatformTest { base::ScopedTempDir temp_dir_; - FilePath test_dir_; + base::FilePath test_dir_; }; struct UnaryBooleanTestData { - const FilePath::CharType* input; + const base::FilePath::CharType* input; bool expected; }; @@ -56,8 +56,8 @@ TEST_F(ExtensionCreatorFilterTest, NormalCases) { }; for (size_t i = 0; i < arraysize(cases); ++i) { - FilePath input(cases[i].input); - FilePath test_file(CreateEmptyTestFile(input)); + base::FilePath input(cases[i].input); + base::FilePath test_file(CreateEmptyTestFile(input)); bool observed = filter_->ShouldPackageFile(test_file); EXPECT_EQ(cases[i].expected, observed) << @@ -67,7 +67,7 @@ TEST_F(ExtensionCreatorFilterTest, NormalCases) { #if defined(OS_WIN) struct StringBooleanWithBooleanTestData { - const FilePath::CharType* input_char; + const base::FilePath::CharType* input_char; bool input_bool; bool expected; }; @@ -84,9 +84,9 @@ TEST_F(ExtensionCreatorFilterTest, WindowsHiddenFiles) { }; for (size_t i = 0; i < arraysize(cases); ++i) { - FilePath input(cases[i].input_char); + base::FilePath input(cases[i].input_char); bool should_hide = cases[i].input_bool; - FilePath test_file(CreateEmptyTestFile(input)); + base::FilePath test_file(CreateEmptyTestFile(input)); if (should_hide) { SetFileAttributes(test_file.value().c_str(), FILE_ATTRIBUTE_HIDDEN); diff --git a/chrome/browser/extensions/extension_disabled_ui_browsertest.cc b/chrome/browser/extensions/extension_disabled_ui_browsertest.cc index 3aa3ced..31ca7b3 100644 --- a/chrome/browser/extensions/extension_disabled_ui_browsertest.cc +++ b/chrome/browser/extensions/extension_disabled_ui_browsertest.cc @@ -32,23 +32,23 @@ class ExtensionDisabledGlobalErrorTest : public ExtensionBrowserTest { virtual void SetUpOnMainThread() OVERRIDE { EXPECT_TRUE(scoped_temp_dir_.CreateUniqueTempDir()); service_ = browser()->profile()->GetExtensionService(); - FilePath pem_path = test_data_dir_. + base::FilePath pem_path = test_data_dir_. AppendASCII("permissions_increase").AppendASCII("permissions.pem"); path_v1_ = PackExtensionWithOptions( test_data_dir_.AppendASCII("permissions_increase").AppendASCII("v1"), scoped_temp_dir_.path().AppendASCII("permissions1.crx"), pem_path, - FilePath()); + base::FilePath()); path_v2_ = PackExtensionWithOptions( test_data_dir_.AppendASCII("permissions_increase").AppendASCII("v2"), scoped_temp_dir_.path().AppendASCII("permissions2.crx"), pem_path, - FilePath()); + base::FilePath()); path_v3_ = PackExtensionWithOptions( test_data_dir_.AppendASCII("permissions_increase").AppendASCII("v3"), scoped_temp_dir_.path().AppendASCII("permissions3.crx"), pem_path, - FilePath()); + base::FilePath()); } // Returns the ExtensionDisabledGlobalError, if present. @@ -73,7 +73,7 @@ class ExtensionDisabledGlobalErrorTest : public ExtensionBrowserTest { // extension and prompt the user to reenable. const Extension* UpdateIncreasingPermissionExtension( const Extension* extension, - const FilePath& crx_path, + const base::FilePath& crx_path, int expected_change) { size_t size_before = service_->extensions()->size(); if (UpdateExtension(extension->id(), crx_path, expected_change)) @@ -95,9 +95,9 @@ class ExtensionDisabledGlobalErrorTest : public ExtensionBrowserTest { ExtensionService* service_; base::ScopedTempDir scoped_temp_dir_; - FilePath path_v1_; - FilePath path_v2_; - FilePath path_v3_; + base::FilePath path_v1_; + base::FilePath path_v2_; + base::FilePath path_v3_; }; // Tests the process of updating an extension to one that requires higher diff --git a/chrome/browser/extensions/extension_function_test_utils.cc b/chrome/browser/extensions/extension_function_test_utils.cc index af7f44e..b2d9283 100644 --- a/chrome/browser/extensions/extension_function_test_utils.cc +++ b/chrome/browser/extensions/extension_function_test_utils.cc @@ -132,7 +132,7 @@ scoped_refptr<Extension> CreateExtension( base::DictionaryValue* test_extension_value, const std::string& id_input) { std::string error; - const FilePath test_extension_path; + const base::FilePath test_extension_path; std::string id; if (!id_input.empty()) CHECK(Extension::GenerateId(id_input, &id)); diff --git a/chrome/browser/extensions/extension_icon_image_unittest.cc b/chrome/browser/extensions/extension_icon_image_unittest.cc index 11130dd..112a7bc 100644 --- a/chrome/browser/extensions/extension_icon_image_unittest.cc +++ b/chrome/browser/extensions/extension_icon_image_unittest.cc @@ -144,7 +144,7 @@ class ExtensionIconImageTest : public testing::Test, scoped_refptr<Extension> CreateExtension(const char* name, Manifest::Location location) { // Create and load an extension. - FilePath test_file; + base::FilePath test_file; if (!PathService::Get(chrome::DIR_TEST_DATA, &test_file)) { EXPECT_FALSE(true); return NULL; diff --git a/chrome/browser/extensions/extension_icon_manager_unittest.cc b/chrome/browser/extensions/extension_icon_manager_unittest.cc index d715a0b..957d030 100644 --- a/chrome/browser/extensions/extension_icon_manager_unittest.cc +++ b/chrome/browser/extensions/extension_icon_manager_unittest.cc @@ -105,9 +105,9 @@ TEST_F(ExtensionIconManagerTest, LoadRemoveLoad) { scoped_ptr<Profile> profile(new TestingProfile()); SkBitmap default_icon = GetDefaultIcon(); - FilePath test_dir; + base::FilePath test_dir; ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &test_dir)); - FilePath manifest_path = test_dir.AppendASCII( + base::FilePath manifest_path = test_dir.AppendASCII( "extensions/image_loading_tracker/app.json"); JSONFileValueSerializer serializer(manifest_path); @@ -146,9 +146,9 @@ TEST_F(ExtensionIconManagerTest, LoadRemoveLoad) { TEST_F(ExtensionIconManagerTest, LoadComponentExtensionResource) { SkBitmap default_icon = GetDefaultIcon(); - FilePath test_dir; + base::FilePath test_dir; ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &test_dir)); - FilePath manifest_path = test_dir.AppendASCII( + base::FilePath manifest_path = test_dir.AppendASCII( "extensions/file_manager/app.json"); JSONFileValueSerializer serializer(manifest_path); diff --git a/chrome/browser/extensions/extension_icon_source_apitest.cc b/chrome/browser/extensions/extension_icon_source_apitest.cc index 3ab665f..9c5c4b8 100644 --- a/chrome/browser/extensions/extension_icon_source_apitest.cc +++ b/chrome/browser/extensions/extension_icon_source_apitest.cc @@ -24,7 +24,7 @@ class ExtensionIconSourceTest : public ExtensionApiTest { }; IN_PROC_BROWSER_TEST_F(ExtensionIconSourceTest, IconsLoaded) { - FilePath basedir = test_data_dir_.AppendASCII("icons"); + base::FilePath basedir = test_data_dir_.AppendASCII("icons"); ASSERT_TRUE(LoadExtension(basedir.AppendASCII("extension_with_permission"))); ASSERT_TRUE(LoadExtension(basedir.AppendASCII("extension_no_permission"))); std::string result; @@ -68,7 +68,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionIconSourceTest, InvalidURL) { } IN_PROC_BROWSER_TEST_F(ExtensionIconSourceTest, IconsLoadedIncognito) { - FilePath basedir = test_data_dir_.AppendASCII("icons"); + base::FilePath basedir = test_data_dir_.AppendASCII("icons"); ASSERT_TRUE(LoadExtensionIncognito( basedir.AppendASCII("extension_with_permission"))); ASSERT_TRUE(LoadExtensionIncognito( diff --git a/chrome/browser/extensions/extension_info_map_unittest.cc b/chrome/browser/extensions/extension_info_map_unittest.cc index 05ba73f..d88f32a 100644 --- a/chrome/browser/extensions/extension_info_map_unittest.cc +++ b/chrome/browser/extensions/extension_info_map_unittest.cc @@ -41,9 +41,9 @@ class ExtensionInfoMapTest : public testing::Test { // Returns a barebones test Extension object with the given name. static scoped_refptr<Extension> CreateExtension(const std::string& name) { #if defined(OS_WIN) - FilePath path(FILE_PATH_LITERAL("c:\\foo")); + base::FilePath path(FILE_PATH_LITERAL("c:\\foo")); #elif defined(OS_POSIX) - FilePath path(FILE_PATH_LITERAL("/foo")); + base::FilePath path(FILE_PATH_LITERAL("/foo")); #endif DictionaryValue manifest; @@ -61,7 +61,7 @@ static scoped_refptr<Extension> CreateExtension(const std::string& name) { static scoped_refptr<Extension> LoadManifest(const std::string& dir, const std::string& test_file) { - FilePath path; + base::FilePath path; PathService::Get(chrome::DIR_TEST_DATA, &path); path = path.AppendASCII("extensions") .AppendASCII(dir) diff --git a/chrome/browser/extensions/extension_install_prompt.cc b/chrome/browser/extensions/extension_install_prompt.cc index c8b3521..2d039fb 100644 --- a/chrome/browser/extensions/extension_install_prompt.cc +++ b/chrome/browser/extensions/extension_install_prompt.cc @@ -396,7 +396,7 @@ scoped_refptr<Extension> } return Extension::Create( - FilePath(), + base::FilePath(), Manifest::INTERNAL, localized_manifest.get() ? *localized_manifest.get() : *manifest, flags, diff --git a/chrome/browser/extensions/extension_install_ui_browsertest.cc b/chrome/browser/extensions/extension_install_ui_browsertest.cc index e7ffa74..803b25f 100644 --- a/chrome/browser/extensions/extension_install_ui_browsertest.cc +++ b/chrome/browser/extensions/extension_install_ui_browsertest.cc @@ -42,7 +42,7 @@ class ExtensionInstallUIBrowserTest : public ExtensionBrowserTest { // Install the given theme from the data dir and verify expected name. void InstallThemeAndVerify(const char* theme_name, const std::string& expected_name) { - const FilePath theme_path = test_data_dir_.AppendASCII(theme_name); + const base::FilePath theme_path = test_data_dir_.AppendASCII(theme_name); ASSERT_TRUE(InstallExtensionWithUIAutoConfirm(theme_path, 1, browser())); const Extension* theme = GetTheme(); ASSERT_TRUE(theme); @@ -65,7 +65,7 @@ class ExtensionInstallUIBrowserTest : public ExtensionBrowserTest { IN_PROC_BROWSER_TEST_F(ExtensionInstallUIBrowserTest, MAYBE_TestThemeInstallUndoResetsToDefault) { // Install theme once and undo to verify we go back to default theme. - FilePath theme_crx = PackExtension(test_data_dir_.AppendASCII("theme")); + base::FilePath theme_crx = PackExtension(test_data_dir_.AppendASCII("theme")); ASSERT_TRUE(InstallExtensionWithUIAutoConfirm(theme_crx, 1, browser())); const Extension* theme = GetTheme(); ASSERT_TRUE(theme); @@ -134,7 +134,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionInstallUIBrowserTest, MAYBE_AppInstallConfirmation) { int num_tabs = browser()->tab_strip_model()->count(); - FilePath app_dir = test_data_dir_.AppendASCII("app"); + base::FilePath app_dir = test_data_dir_.AppendASCII("app"); ASSERT_TRUE(InstallExtensionWithUIAutoConfirm(app_dir, 1, browser())); if (NewTabUI::ShouldShowApps()) { @@ -156,7 +156,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionInstallUIBrowserTest, int num_incognito_tabs = incognito_browser->tab_strip_model()->count(); int num_normal_tabs = browser()->tab_strip_model()->count(); - FilePath app_dir = test_data_dir_.AppendASCII("app"); + base::FilePath app_dir = test_data_dir_.AppendASCII("app"); ASSERT_TRUE(InstallExtensionWithUIAutoConfirm(app_dir, 1, incognito_browser)); diff --git a/chrome/browser/extensions/extension_nacl_browsertest.cc b/chrome/browser/extensions/extension_nacl_browsertest.cc index c0d4142..6f0a0da 100644 --- a/chrome/browser/extensions/extension_nacl_browsertest.cc +++ b/chrome/browser/extensions/extension_nacl_browsertest.cc @@ -47,7 +47,7 @@ class NaClExtensionTest : public ExtensionBrowserTest { }; const Extension* InstallExtension(InstallType install_type) { - FilePath file_path = test_data_dir_.AppendASCII("native_client"); + base::FilePath file_path = test_data_dir_.AppendASCII("native_client"); ExtensionService* service = extensions::ExtensionSystem::Get( browser()->profile())->extension_service(); const Extension* extension = NULL; @@ -85,7 +85,7 @@ class NaClExtensionTest : public ExtensionBrowserTest { } bool IsNaClPluginLoaded() { - FilePath path; + base::FilePath path; if (PathService::Get(chrome::FILE_NACL_PLUGIN, &path)) { webkit::WebPluginInfo info; return PluginService::GetInstance()->GetPluginInfoByPath(path, &info); diff --git a/chrome/browser/extensions/extension_prefs.cc b/chrome/browser/extensions/extension_prefs.cc index 9178929..c4a1296 100644 --- a/chrome/browser/extensions/extension_prefs.cc +++ b/chrome/browser/extensions/extension_prefs.cc @@ -371,7 +371,7 @@ base::Time ExtensionPrefs::TimeProvider::GetCurrentTime() const { // static scoped_ptr<ExtensionPrefs> ExtensionPrefs::Create( PrefServiceSyncable* prefs, - const FilePath& root_dir, + const base::FilePath& root_dir, ExtensionPrefValueMap* extension_pref_value_map, bool extensions_disabled) { return ExtensionPrefs::Create(prefs, @@ -384,7 +384,7 @@ scoped_ptr<ExtensionPrefs> ExtensionPrefs::Create( // static scoped_ptr<ExtensionPrefs> ExtensionPrefs::Create( PrefServiceSyncable* pref_service, - const FilePath& root_dir, + const base::FilePath& root_dir, ExtensionPrefValueMap* extension_pref_value_map, bool extensions_disabled, scoped_ptr<TimeProvider> time_provider) { @@ -403,14 +403,14 @@ ExtensionPrefs::~ExtensionPrefs() { // static const char ExtensionPrefs::kExtensionsPref[] = "extensions.settings"; -static FilePath::StringType MakePathRelative(const FilePath& parent, - const FilePath& child) { +static base::FilePath::StringType MakePathRelative(const base::FilePath& parent, + const base::FilePath& child) { if (!parent.IsParent(child)) return child.value(); - FilePath::StringType retval = child.value().substr( + base::FilePath::StringType retval = child.value().substr( parent.value().length()); - if (FilePath::IsSeparator(retval[0])) + if (base::FilePath::IsSeparator(retval[0])) return retval.substr(1); else return retval; @@ -434,10 +434,10 @@ void ExtensionPrefs::MakePathsRelative() { // Unpacked extensions can have absolute paths. continue; } - FilePath::StringType path_string; + base::FilePath::StringType path_string; if (!extension_dict->GetString(kPrefPath, &path_string)) continue; - FilePath path(path_string); + base::FilePath path(path_string); if (path.IsAbsolute()) absolute_keys.insert(*i); } @@ -454,9 +454,9 @@ void ExtensionPrefs::MakePathsRelative() { NOTREACHED() << "Control should never reach here for extension " << *i; continue; } - FilePath::StringType path_string; + base::FilePath::StringType path_string; extension_dict->GetString(kPrefPath, &path_string); - FilePath path(path_string); + base::FilePath path(path_string); extension_dict->SetString(kPrefPath, MakePathRelative(install_directory_, path)); } @@ -1539,16 +1539,18 @@ void ExtensionPrefs::UpdateManifest(const Extension* extension) { } } -FilePath ExtensionPrefs::GetExtensionPath(const std::string& extension_id) { +base::FilePath ExtensionPrefs::GetExtensionPath( + const std::string& extension_id) { const DictionaryValue* dict = GetExtensionPref(extension_id); if (!dict) - return FilePath(); + return base::FilePath(); std::string path; if (!dict->GetString(kPrefPath, &path)) - return FilePath(); + return base::FilePath(); - return install_directory_.Append(FilePath::FromWStringHack(UTF8ToWide(path))); + return install_directory_.Append( + base::FilePath::FromWStringHack(UTF8ToWide(path))); } void ExtensionPrefs::UpdateExtensionPref(const std::string& extension_id, @@ -1602,7 +1604,7 @@ scoped_ptr<ExtensionInfo> ExtensionPrefs::GetInstalledExtensionInfo( << " has been uninstalled by the user"; return scoped_ptr<ExtensionInfo>(); } - FilePath::StringType path; + base::FilePath::StringType path; int location_value; if (!ext->GetInteger(kPrefLocation, &location_value)) return scoped_ptr<ExtensionInfo>(); @@ -1614,7 +1616,7 @@ scoped_ptr<ExtensionInfo> ExtensionPrefs::GetInstalledExtensionInfo( // otherwise make it so. if (location_value != Manifest::LOAD) { DCHECK(location_value == Manifest::COMPONENT || - !FilePath(path).IsAbsolute()); + !base::FilePath(path).IsAbsolute()); path = install_directory_.Append(path).value(); } @@ -1637,7 +1639,8 @@ scoped_ptr<ExtensionInfo> ExtensionPrefs::GetInstalledExtensionInfo( } return scoped_ptr<ExtensionInfo>( - new ExtensionInfo(manifest, extension_id, FilePath(path), location)); + new ExtensionInfo(manifest, extension_id, base::FilePath(path), + location)); } scoped_ptr<ExtensionPrefs::ExtensionsInfo> @@ -1734,7 +1737,7 @@ scoped_ptr<ExtensionInfo> ExtensionPrefs::GetDelayedInstallInfo( return scoped_ptr<ExtensionInfo>(); // TODO(mek): share code with GetInstalledExtensionInfo - FilePath::StringType path; + base::FilePath::StringType path; int location_value; if (!ext->GetInteger(kPrefLocation, &location_value)) return scoped_ptr<ExtensionInfo>(); @@ -1746,7 +1749,7 @@ scoped_ptr<ExtensionInfo> ExtensionPrefs::GetDelayedInstallInfo( // otherwise make it so. if (location_value != Manifest::LOAD) { DCHECK(location_value == Manifest::COMPONENT || - !FilePath(path).IsAbsolute()); + !base::FilePath(path).IsAbsolute()); path = install_directory_.Append(path).value(); } @@ -1769,7 +1772,8 @@ scoped_ptr<ExtensionInfo> ExtensionPrefs::GetDelayedInstallInfo( } return scoped_ptr<ExtensionInfo>( - new ExtensionInfo(manifest, extension_id, FilePath(path), location)); + new ExtensionInfo(manifest, extension_id, base::FilePath(path), + location)); } scoped_ptr<ExtensionPrefs::ExtensionsInfo> ExtensionPrefs:: @@ -2185,7 +2189,7 @@ void ExtensionPrefs::SetGeometryCache( ExtensionPrefs::ExtensionPrefs( PrefServiceSyncable* prefs, - const FilePath& root_dir, + const base::FilePath& root_dir, ExtensionPrefValueMap* extension_pref_value_map, scoped_ptr<TimeProvider> time_provider) : prefs_(prefs), @@ -2312,7 +2316,7 @@ void ExtensionPrefs::PopulateExtensionInfoPrefs( Value::CreateStringValue( base::Int64ToString(install_time.ToInternalValue()))); - FilePath::StringType path = MakePathRelative(install_directory_, + base::FilePath::StringType path = MakePathRelative(install_directory_, extension->path()); extension_dict->Set(kPrefPath, Value::CreateStringValue(path)); // We store prefs about LOAD extensions, but don't cache their manifest diff --git a/chrome/browser/extensions/extension_prefs.h b/chrome/browser/extensions/extension_prefs.h index c11e7e5..fd6121d 100644 --- a/chrome/browser/extensions/extension_prefs.h +++ b/chrome/browser/extensions/extension_prefs.h @@ -94,7 +94,7 @@ class ExtensionPrefs : public ContentSettingsStore::Observer, // Does not take ownership of |prefs| and |extension_pref_value_map|. static scoped_ptr<ExtensionPrefs> Create( PrefServiceSyncable* prefs, - const FilePath& root_dir, + const base::FilePath& root_dir, ExtensionPrefValueMap* extension_pref_value_map, bool extensions_disabled); @@ -102,7 +102,7 @@ class ExtensionPrefs : public ContentSettingsStore::Observer, // Use this as needed for testing. static scoped_ptr<ExtensionPrefs> Create( PrefServiceSyncable* prefs, - const FilePath& root_dir, + const base::FilePath& root_dir, ExtensionPrefValueMap* extension_pref_value_map, bool extensions_disabled, scoped_ptr<TimeProvider> time_provider); @@ -192,10 +192,10 @@ class ExtensionPrefs : public ContentSettingsStore::Observer, void UpdateManifest(const Extension* extension); // Returns extension path based on extension ID, or empty FilePath on error. - FilePath GetExtensionPath(const std::string& extension_id); + base::FilePath GetExtensionPath(const std::string& extension_id); // Returns base extensions install directory. - const FilePath& install_directory() const { return install_directory_; } + const base::FilePath& install_directory() const { return install_directory_; } // Returns whether the extension with |id| has its blacklist bit set. // @@ -516,7 +516,7 @@ class ExtensionPrefs : public ContentSettingsStore::Observer, // See the Create methods. ExtensionPrefs(PrefServiceSyncable* prefs, - const FilePath& root_dir, + const base::FilePath& root_dir, ExtensionPrefValueMap* extension_pref_value_map, scoped_ptr<TimeProvider> time_provider); @@ -638,7 +638,7 @@ class ExtensionPrefs : public ContentSettingsStore::Observer, PrefServiceSyncable* prefs_; // Base extensions install directory. - FilePath install_directory_; + base::FilePath install_directory_; // Weak pointer, owned by Profile. ExtensionPrefValueMap* extension_pref_value_map_; diff --git a/chrome/browser/extensions/extension_prefs_unittest.cc b/chrome/browser/extensions/extension_prefs_unittest.cc index d955323..f328378 100644 --- a/chrome/browser/extensions/extension_prefs_unittest.cc +++ b/chrome/browser/extensions/extension_prefs_unittest.cc @@ -588,7 +588,8 @@ class ExtensionPrefsDelayedInstallInfo : public ExtensionPrefsTest { manifest.SetString(extension_manifest_keys::kName, "test"); manifest.SetString(extension_manifest_keys::kVersion, "1." + base::IntToString(num)); - FilePath path = prefs_.extensions_dir().AppendASCII(base::IntToString(num)); + base::FilePath path = + prefs_.extensions_dir().AppendASCII(base::IntToString(num)); std::string errors; scoped_refptr<Extension> extension = Extension::Create( path, Manifest::INTERNAL, manifest, Extension::NO_FLAGS, id, &errors); @@ -680,7 +681,7 @@ class ExtensionPrefsDelayedInstallInfo : public ExtensionPrefsTest { protected: Time now_; - FilePath basedir_; + base::FilePath basedir_; std::string id1_; std::string id2_; std::string id3_; diff --git a/chrome/browser/extensions/extension_protocols.cc b/chrome/browser/extensions/extension_protocols.cc index 0b55cd1..be7bab6 100644 --- a/chrome/browser/extensions/extension_protocols.cc +++ b/chrome/browser/extensions/extension_protocols.cc @@ -62,7 +62,7 @@ net::HttpResponseHeaders* BuildHttpHeaders( return new net::HttpResponseHeaders(raw_headers); } -void ReadMimeTypeFromFile(const FilePath& filename, +void ReadMimeTypeFromFile(const base::FilePath& filename, std::string* mime_type, bool* result) { *result = net::GetMimeTypeFromFile(filename, mime_type); @@ -72,7 +72,7 @@ class URLRequestResourceBundleJob : public net::URLRequestSimpleJob { public: URLRequestResourceBundleJob(net::URLRequest* request, net::NetworkDelegate* network_delegate, - const FilePath& filename, + const base::FilePath& filename, int resource_id, const std::string& content_security_policy, bool send_cors_header) @@ -136,7 +136,7 @@ class URLRequestResourceBundleJob : public net::URLRequestSimpleJob { } // We need the filename of the resource to determine the mime type. - FilePath filename_; + base::FilePath filename_; // The resource bundle id to load. int resource_id_; @@ -189,7 +189,7 @@ class GeneratedBackgroundPageJob : public net::URLRequestSimpleJob { }; void ReadResourceFilePath(const ExtensionResource& resource, - FilePath* file_path) { + base::FilePath* file_path) { *file_path = resource.GetFilePath(); } @@ -198,10 +198,10 @@ class URLRequestExtensionJob : public net::URLRequestFileJob { URLRequestExtensionJob(net::URLRequest* request, net::NetworkDelegate* network_delegate, const std::string& extension_id, - const FilePath& directory_path, + const base::FilePath& directory_path, const std::string& content_security_policy, bool send_cors_header) - : net::URLRequestFileJob(request, network_delegate, FilePath()), + : net::URLRequestFileJob(request, network_delegate, base::FilePath()), // TODO(tc): Move all of these files into resources.pak so we don't break // when updating on Linux. resource_(extension_id, directory_path, @@ -217,7 +217,7 @@ class URLRequestExtensionJob : public net::URLRequestFileJob { } virtual void Start() OVERRIDE { - FilePath* read_file_path = new FilePath; + base::FilePath* read_file_path = new base::FilePath; bool posted = base::WorkerPool::PostTaskAndReply( FROM_HERE, base::Bind(&ReadResourceFilePath, resource_, @@ -232,7 +232,7 @@ class URLRequestExtensionJob : public net::URLRequestFileJob { private: virtual ~URLRequestExtensionJob() {} - void OnFilePathRead(FilePath* read_file_path) { + void OnFilePathRead(base::FilePath* read_file_path) { file_path_ = *read_file_path; URLRequestFileJob::Start(); } @@ -333,7 +333,7 @@ ExtensionProtocolHandler::MaybeCreateJob( const std::string& extension_id = request->url().host(); const Extension* extension = extension_info_map_->extensions().GetByID(extension_id); - FilePath directory_path; + base::FilePath directory_path; if (extension) directory_path = extension->path(); if (directory_path.value().empty()) { @@ -368,8 +368,8 @@ ExtensionProtocolHandler::MaybeCreateJob( request, network_delegate, extension, content_security_policy); } - FilePath resources_path; - FilePath relative_path; + base::FilePath resources_path; + base::FilePath relative_path; // Try to load extension resources from chrome resource file if // directory_path is a descendant of resources_path. resources_path // corresponds to src/chrome/browser/resources in source tree. @@ -378,7 +378,7 @@ ExtensionProtocolHandler::MaybeCreateJob( // component_extension_resources.pak file in resources_path, calculate // extension relative path against resources_path. resources_path.AppendRelativePath(directory_path, &relative_path)) { - FilePath request_path = + base::FilePath request_path = extension_file_util::ExtensionURLToRelativeFilePath(request->url()); int resource_id; if (extensions::ImageLoader::IsComponentExtensionResource( diff --git a/chrome/browser/extensions/extension_protocols_unittest.cc b/chrome/browser/extensions/extension_protocols_unittest.cc index b9297e0..01f861c 100644 --- a/chrome/browser/extensions/extension_protocols_unittest.cc +++ b/chrome/browser/extensions/extension_protocols_unittest.cc @@ -33,7 +33,7 @@ scoped_refptr<Extension> CreateTestExtension(const std::string& name, manifest.SetString("version", "1"); manifest.SetString("incognito", incognito_split_mode ? "split" : "spanning"); - FilePath path; + base::FilePath path; EXPECT_TRUE(file_util::GetCurrentDirectory(&path)); std::string error; @@ -50,7 +50,7 @@ scoped_refptr<Extension> CreateWebStoreExtension() { manifest.SetString("version", "1"); manifest.SetString("icons.16", "webstore_icon_16.png"); - FilePath path; + base::FilePath path; EXPECT_TRUE(PathService::Get(chrome::DIR_RESOURCES, &path)); path = path.AppendASCII("web_store"); diff --git a/chrome/browser/extensions/extension_resource_protocols.cc b/chrome/browser/extensions/extension_resource_protocols.cc index b7fbf137..0e613dd 100644 --- a/chrome/browser/extensions/extension_resource_protocols.cc +++ b/chrome/browser/extensions/extension_resource_protocols.cc @@ -17,7 +17,7 @@ class ExtensionResourcesJob : public net::URLRequestFileJob { public: ExtensionResourcesJob(net::URLRequest* request, net::NetworkDelegate* network_delegate) - : net::URLRequestFileJob(request, network_delegate, FilePath()), + : net::URLRequestFileJob(request, network_delegate, base::FilePath()), thread_id_(content::BrowserThread::UI) { } @@ -43,7 +43,7 @@ void ExtensionResourcesJob::Start() { } void ExtensionResourcesJob::ResolvePath() { - FilePath root_path; + base::FilePath root_path; PathService::Get(chrome::DIR_RESOURCES_EXTENSION, &root_path); file_path_ = extension_file_util::ExtensionResourceURLToFilePath( request()->url(), root_path); diff --git a/chrome/browser/extensions/extension_service.cc b/chrome/browser/extensions/extension_service.cc index 619ed3c..759f3b7 100644 --- a/chrome/browser/extensions/extension_service.cc +++ b/chrome/browser/extensions/extension_service.cc @@ -331,7 +331,7 @@ bool ExtensionService::UninstallExtensionHelper( ExtensionService::ExtensionService(Profile* profile, const CommandLine* command_line, - const FilePath& install_directory, + const base::FilePath& install_directory, extensions::ExtensionPrefs* extension_prefs, extensions::Blacklist* blacklist, bool autoupdate_enabled, @@ -618,7 +618,7 @@ void ExtensionService::Init() { } bool ExtensionService::UpdateExtension(const std::string& id, - const FilePath& extension_path, + const base::FilePath& extension_path, const GURL& download_url, CrxInstaller** out_crx_installer) { CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); @@ -712,7 +712,7 @@ void ExtensionService::ReloadExtensionWithEvents( const std::string& extension_id, int events) { CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - FilePath path; + base::FilePath path; const Extension* current_extension = GetExtensionById(extension_id, false); // Disable the extension if it's loaded. It might not be loaded if it crashed. @@ -1997,7 +1997,7 @@ void ExtensionService::GarbageCollectExtensions() { scoped_ptr<extensions::ExtensionPrefs::ExtensionsInfo> info( extension_prefs_->GetInstalledExtensionsInfo()); - std::multimap<std::string, FilePath> extension_paths; + std::multimap<std::string, base::FilePath> extension_paths; for (size_t i = 0; i < info->size(); ++i) extension_paths.insert(std::make_pair(info->at(i)->extension_id, info->at(i)->extension_path)); @@ -2558,7 +2558,7 @@ bool ExtensionService::ShouldBlockUrlInBrowserTab(GURL* url) { bool ExtensionService::OnExternalExtensionFileFound( const std::string& id, const Version* version, - const FilePath& path, + const base::FilePath& path, Manifest::Location location, int creation_flags, bool mark_acknowledged) { @@ -2629,7 +2629,7 @@ bool ExtensionService::OnExternalExtensionFileFound( } void ExtensionService::ReportExtensionLoadError( - const FilePath& extension_path, + const base::FilePath& extension_path, const std::string &error, bool be_noisy) { content::NotificationService::current()->Notify( @@ -2864,7 +2864,7 @@ void ExtensionService::UpdatePluginListWithNaClModules() { // there is a MIME type that module wants to handle, so we need to add that // MIME type to plugins which handle NaCl modules in order to allow the // individual modules to handle these types. - FilePath path; + base::FilePath path; if (!PathService::Get(chrome::FILE_NACL_PLUGIN, &path)) return; const content::PepperPluginInfo* pepper_info = @@ -2947,7 +2947,7 @@ void ExtensionService::LaunchApplication( #if !defined(OS_ANDROID) extensions::LaunchPlatformApp(extension_host->profile(), extension_host->extension(), - NULL, FilePath()); + NULL, base::FilePath()); #endif } @@ -3036,8 +3036,8 @@ bool ExtensionService::ShouldDelayExtensionUpdate( } void ExtensionService::GarbageCollectIsolatedStorage() { - scoped_ptr<base::hash_set<FilePath> > active_paths( - new base::hash_set<FilePath>()); + scoped_ptr<base::hash_set<base::FilePath> > active_paths( + new base::hash_set<base::FilePath>()); for (ExtensionSet::const_iterator it = extensions_.begin(); it != extensions_.end(); ++it) { if ((*it)->is_storage_isolated()) { diff --git a/chrome/browser/extensions/extension_service.h b/chrome/browser/extensions/extension_service.h index f2dc4b8..9ba30f6 100644 --- a/chrome/browser/extensions/extension_service.h +++ b/chrome/browser/extensions/extension_service.h @@ -92,7 +92,7 @@ class ExtensionServiceInterface : public syncer::SyncableService { // Set out_crx_installer to the installer if one was started. virtual bool UpdateExtension( const std::string& id, - const FilePath& path, + const base::FilePath& path, const GURL& download_url, extensions::CrxInstaller** out_crx_installer) = 0; virtual const extensions::Extension* GetExtensionById( @@ -196,7 +196,7 @@ class ExtensionService // ownership remains at caller. ExtensionService(Profile* profile, const CommandLine* command_line, - const FilePath& install_directory, + const base::FilePath& install_directory, extensions::ExtensionPrefs* extension_prefs, extensions::Blacklist* blacklist, bool autoupdate_enabled, @@ -222,7 +222,7 @@ class ExtensionService virtual extensions::PendingExtensionManager* pending_extension_manager() OVERRIDE; - const FilePath& install_directory() const { return install_directory_; } + const base::FilePath& install_directory() const { return install_directory_; } extensions::ProcessMap* process_map() { return &process_map_; } @@ -337,7 +337,7 @@ class ExtensionService // CrxInstaller directly instead. virtual bool UpdateExtension( const std::string& id, - const FilePath& extension_path, + const base::FilePath& extension_path, const GURL& download_url, extensions::CrxInstaller** out_crx_installer) OVERRIDE; @@ -567,7 +567,7 @@ class ExtensionService // can post to here. // TODO(aa): Remove this. It doesn't do enough to be worth the dependency // of these classes on ExtensionService. - void ReportExtensionLoadError(const FilePath& extension_path, + void ReportExtensionLoadError(const base::FilePath& extension_path, const std::string& error, bool be_noisy); @@ -594,7 +594,7 @@ class ExtensionService virtual bool OnExternalExtensionFileFound( const std::string& id, const Version* version, - const FilePath& path, + const base::FilePath& path, extensions::Manifest::Location location, int creation_flags, bool mark_acknowledged) OVERRIDE; @@ -890,7 +890,7 @@ class ExtensionService ExtensionRuntimeDataMap extension_runtime_data_; // The full path to the directory where extensions are installed. - FilePath install_directory_; + base::FilePath install_directory_; // Whether or not extensions are enabled. bool extensions_enabled_; @@ -918,13 +918,13 @@ class ExtensionService // Map unloaded extensions' ids to their paths. When a temporarily loaded // extension is unloaded, we lose the information about it and don't have // any in the extension preferences file. - typedef std::map<std::string, FilePath> UnloadedExtensionPathMap; + typedef std::map<std::string, base::FilePath> UnloadedExtensionPathMap; UnloadedExtensionPathMap unloaded_extension_paths_; // Map disabled extensions' ids to their paths. When a temporarily loaded // extension is disabled before it is reloaded, keep track of the path so that // it can be re-enabled upon a successful load. - typedef std::map<std::string, FilePath> DisabledExtensionPathMap; + typedef std::map<std::string, base::FilePath> DisabledExtensionPathMap; DisabledExtensionPathMap disabled_extension_paths_; // Map of inspector cookies that are detached, waiting for an extension to be diff --git a/chrome/browser/extensions/extension_service_unittest.cc b/chrome/browser/extensions/extension_service_unittest.cc index 2589d40..86e9ecd 100644 --- a/chrome/browser/extensions/extension_service_unittest.cc +++ b/chrome/browser/extensions/extension_service_unittest.cc @@ -174,8 +174,8 @@ static void AddPattern(URLPatternSet* extent, const std::string& pattern) { extent->AddPattern(URLPattern(schemes, pattern)); } -FilePath GetTemporaryFile() { - FilePath temp_file; +base::FilePath GetTemporaryFile() { + base::FilePath temp_file; CHECK(file_util::CreateTemporaryFile(&temp_file)); return temp_file; } @@ -194,7 +194,7 @@ class MockExtensionProvider : public extensions::ExternalProviderInterface { void UpdateOrAddExtension(const std::string& id, const std::string& version, - const FilePath& path) { + const base::FilePath& path) { extension_map_[id] = std::make_pair(version, path); } @@ -250,7 +250,8 @@ class MockExtensionProvider : public extensions::ExternalProviderInterface { } private: - typedef std::map< std::string, std::pair<std::string, FilePath> > DataMap; + typedef std::map< std::string, std::pair<std::string, base::FilePath> > + DataMap; DataMap extension_map_; Manifest::Location location_; VisitorInterface* visitor_; @@ -270,13 +271,14 @@ class MockProviderVisitor // The provider will return |fake_base_path| from // GetBaseCrxFilePath(). User can test the behavior with // and without an empty path using this parameter. - explicit MockProviderVisitor(FilePath fake_base_path) + explicit MockProviderVisitor(base::FilePath fake_base_path) : ids_found_(0), fake_base_path_(fake_base_path), expected_creation_flags_(Extension::NO_FLAGS) { } - MockProviderVisitor(FilePath fake_base_path, int expected_creation_flags) + MockProviderVisitor(base::FilePath fake_base_path, + int expected_creation_flags) : ids_found_(0), fake_base_path_(fake_base_path), expected_creation_flags_(expected_creation_flags) { @@ -315,7 +317,7 @@ class MockProviderVisitor virtual bool OnExternalExtensionFileFound(const std::string& id, const Version* version, - const FilePath& path, + const base::FilePath& path, Manifest::Location unused, int creation_flags, bool mark_acknowledged) OVERRIDE { @@ -339,7 +341,7 @@ class MockProviderVisitor // Ask provider if the extension we got back is registered. Manifest::Location location = Manifest::INVALID_LOCATION; scoped_ptr<Version> v1; - FilePath crx_path; + base::FilePath crx_path; EXPECT_TRUE(provider_->GetExtensionDetails(id, NULL, &v1)); EXPECT_STREQ(version->GetString().c_str(), v1->GetString().c_str()); @@ -392,7 +394,7 @@ class MockProviderVisitor private: int ids_found_; - FilePath fake_base_path_; + base::FilePath fake_base_path_; int expected_creation_flags_; scoped_ptr<extensions::ExternalProviderImpl> provider_; scoped_ptr<DictionaryValue> prefs_; @@ -414,7 +416,7 @@ ExtensionServiceTestBase::ExtensionServiceTestBase() io_thread_(BrowserThread::IO, &loop_), override_sideload_wipeout_( FeatureSwitch::sideload_wipeout(), false) { - FilePath test_data_dir; + base::FilePath test_data_dir; if (!PathService::Get(chrome::DIR_TEST_DATA, &test_data_dir)) { ADD_FAILURE(); return; @@ -433,9 +435,9 @@ ExtensionServiceTestBase::~ExtensionServiceTestBase() { } void ExtensionServiceTestBase::InitializeExtensionService( - const FilePath& profile_path, - const FilePath& pref_file, - const FilePath& extensions_install_dir, + const base::FilePath& profile_path, + const base::FilePath& pref_file, + const base::FilePath& extensions_install_dir, bool autoupdate_enabled) { TestingProfile::Builder profile_builder; // Create a PrefService that only contains user defined preference values. @@ -477,13 +479,14 @@ void ExtensionServiceTestBase::InitializeExtensionService( } void ExtensionServiceTestBase::InitializeInstalledExtensionService( - const FilePath& prefs_file, const FilePath& source_install_dir) { + const base::FilePath& prefs_file, + const base::FilePath& source_install_dir) { ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); - FilePath path = temp_dir_.path(); + base::FilePath path = temp_dir_.path(); path = path.Append(FILE_PATH_LITERAL("TestingExtensionsPath")); file_util::Delete(path, true); file_util::CreateDirectory(path); - FilePath temp_prefs = path.Append(FILE_PATH_LITERAL("Preferences")); + base::FilePath temp_prefs = path.Append(FILE_PATH_LITERAL("Preferences")); file_util::CopyFile(prefs_file, temp_prefs); extensions_install_dir_ = path.Append(FILE_PATH_LITERAL("Extensions")); @@ -511,11 +514,12 @@ void ExtensionServiceTestBase::InitializeExtensionServiceWithUpdater() { void ExtensionServiceTestBase::InitializeExtensionServiceHelper( bool autoupdate_enabled) { ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); - FilePath path = temp_dir_.path(); + base::FilePath path = temp_dir_.path(); path = path.Append(FILE_PATH_LITERAL("TestingExtensionsPath")); file_util::Delete(path, true); file_util::CreateDirectory(path); - FilePath prefs_filename = path.Append(FILE_PATH_LITERAL("TestPreferences")); + base::FilePath prefs_filename = + path.Append(FILE_PATH_LITERAL("TestPreferences")); extensions_install_dir_ = path.Append(FILE_PATH_LITERAL("Extensions")); file_util::Delete(extensions_install_dir_, true); file_util::CreateDirectory(extensions_install_dir_); @@ -606,11 +610,11 @@ class ExtensionServiceTest void TestExternalProvider(MockExtensionProvider* provider, Manifest::Location location); - void PackCRX(const FilePath& dir_path, - const FilePath& pem_path, - const FilePath& crx_path) { + void PackCRX(const base::FilePath& dir_path, + const base::FilePath& pem_path, + const base::FilePath& crx_path) { // Use the existing pem key, if provided. - FilePath pem_output_path; + base::FilePath pem_output_path; if (pem_path.value().empty()) { pem_output_path = crx_path.DirName().AppendASCII("temp.pem"); } else { @@ -633,11 +637,11 @@ class ExtensionServiceTest // to happen, use loop_.RunUntilIdle();. Most tests will not use this // method directly. Instead, use InstallCrx(), which waits for // the crx to be installed and does extra error checking. - void StartCRXInstall(const FilePath& crx_path) { + void StartCRXInstall(const base::FilePath& crx_path) { StartCRXInstall(crx_path, Extension::NO_FLAGS); } - void StartCRXInstall(const FilePath& crx_path, int creation_flags) { + void StartCRXInstall(const base::FilePath& crx_path, int creation_flags) { ASSERT_TRUE(file_util::PathExists(crx_path)) << "Path does not exist: "<< crx_path.value().c_str(); scoped_refptr<CrxInstaller> installer(CrxInstaller::Create(service_, NULL)); @@ -655,11 +659,11 @@ class ExtensionServiceTest INSTALL_WITHOUT_LOAD, }; - const Extension* PackAndInstallCRX(const FilePath& dir_path, - const FilePath& pem_path, + const Extension* PackAndInstallCRX(const base::FilePath& dir_path, + const base::FilePath& pem_path, InstallState install_state, int creation_flags) { - FilePath crx_path; + base::FilePath crx_path; base::ScopedTempDir temp_dir; EXPECT_TRUE(temp_dir.CreateUniqueTempDir()); crx_path = temp_dir.path().AppendASCII("temp.crx"); @@ -668,20 +672,20 @@ class ExtensionServiceTest return InstallCRX(crx_path, install_state, creation_flags); } - const Extension* PackAndInstallCRX(const FilePath& dir_path, - const FilePath& pem_path, + const Extension* PackAndInstallCRX(const base::FilePath& dir_path, + const base::FilePath& pem_path, InstallState install_state) { return PackAndInstallCRX(dir_path, pem_path, install_state, Extension::NO_FLAGS); } - const Extension* PackAndInstallCRX(const FilePath& dir_path, + const Extension* PackAndInstallCRX(const base::FilePath& dir_path, InstallState install_state) { - return PackAndInstallCRX(dir_path, FilePath(), install_state, + return PackAndInstallCRX(dir_path, base::FilePath(), install_state, Extension::NO_FLAGS); } - const Extension* InstallCRX(const FilePath& path, + const Extension* InstallCRX(const base::FilePath& path, InstallState install_state, int creation_flags) { StartCRXInstall(path, creation_flags); @@ -690,18 +694,18 @@ class ExtensionServiceTest // Attempts to install an extension. Use INSTALL_FAILED if the installation // is expected to fail. - const Extension* InstallCRX(const FilePath& path, + const Extension* InstallCRX(const base::FilePath& path, InstallState install_state) { return InstallCRX(path, install_state, Extension::NO_FLAGS); } - const Extension* InstallCRXFromWebStore(const FilePath& path, + const Extension* InstallCRXFromWebStore(const base::FilePath& path, InstallState install_state) { StartCRXInstall(path, Extension::FROM_WEBSTORE); return WaitForCrxInstall(path, install_state); } - const Extension* InstallCRXWithLocation(const FilePath& crx_path, + const Extension* InstallCRXWithLocation(const base::FilePath& crx_path, Manifest::Location install_location, InstallState install_state) { EXPECT_TRUE(file_util::PathExists(crx_path)) @@ -717,7 +721,7 @@ class ExtensionServiceTest // Wait for a CrxInstaller to finish. Used by InstallCRX. Set the // |install_state| to INSTALL_FAILED if the installation is expected to fail. // Returns an Extension pointer if the install succeeded, NULL otherwise. - const Extension* WaitForCrxInstall(const FilePath& path, + const Extension* WaitForCrxInstall(const base::FilePath& path, InstallState install_state) { loop_.RunUntilIdle(); std::vector<string16> errors = GetErrors(); @@ -781,13 +785,13 @@ class ExtensionServiceTest json_blacklist, gpu_info); } - void UpdateExtension(const std::string& id, const FilePath& in_path, + void UpdateExtension(const std::string& id, const base::FilePath& in_path, UpdateState expected_state) { ASSERT_TRUE(file_util::PathExists(in_path)); // We need to copy this to a temporary location because Update() will delete // it. - FilePath path = temp_dir_.path(); + base::FilePath path = temp_dir_.path(); path = path.Append(in_path.BaseName()); ASSERT_TRUE(file_util::CopyFile(in_path, path)); @@ -851,7 +855,7 @@ class ExtensionServiceTest void UninstallExtension(const std::string& id, bool use_helper) { // Verify that the extension is installed. - FilePath extension_path = extensions_install_dir_.AppendASCII(id); + base::FilePath extension_path = extensions_install_dir_.AppendASCII(id); EXPECT_TRUE(file_util::PathExists(extension_path)); size_t pref_key_count = GetPrefKeyCount(); EXPECT_GT(pref_key_count, 0u); @@ -1060,29 +1064,30 @@ class ExtensionServiceTest // packing succeeded or that there was some error. class PackExtensionTestClient : public extensions::PackExtensionJob::Client { public: - PackExtensionTestClient(const FilePath& expected_crx_path, - const FilePath& expected_private_key_path); - virtual void OnPackSuccess(const FilePath& crx_path, - const FilePath& private_key_path) OVERRIDE; + PackExtensionTestClient(const base::FilePath& expected_crx_path, + const base::FilePath& expected_private_key_path); + virtual void OnPackSuccess(const base::FilePath& crx_path, + const base::FilePath& private_key_path) OVERRIDE; virtual void OnPackFailure(const std::string& error_message, ExtensionCreator::ErrorType type) OVERRIDE; private: - const FilePath expected_crx_path_; - const FilePath expected_private_key_path_; + const base::FilePath expected_crx_path_; + const base::FilePath expected_private_key_path_; DISALLOW_COPY_AND_ASSIGN(PackExtensionTestClient); }; PackExtensionTestClient::PackExtensionTestClient( - const FilePath& expected_crx_path, - const FilePath& expected_private_key_path) + const base::FilePath& expected_crx_path, + const base::FilePath& expected_private_key_path) : expected_crx_path_(expected_crx_path), expected_private_key_path_(expected_private_key_path) {} // If packing succeeded, we make sure that the package names match our // expectations. -void PackExtensionTestClient::OnPackSuccess(const FilePath& crx_path, - const FilePath& private_key_path) { +void PackExtensionTestClient::OnPackSuccess( + const base::FilePath& crx_path, + const base::FilePath& private_key_path) { // We got the notification and processed it; we don't expect any further tasks // to be posted to the current thread, so we should stop blocking and continue // on with the rest of the test. @@ -1108,10 +1113,10 @@ TEST_F(ExtensionServiceTest, LoadAllExtensionsFromDirectorySuccess) { InitPluginService(); // Initialize the test dir with a good Preferences/extensions. - FilePath source_install_dir = data_dir_ + base::FilePath source_install_dir = data_dir_ .AppendASCII("good") .AppendASCII("Extensions"); - FilePath pref_path = source_install_dir + base::FilePath pref_path = source_install_dir .DirName() .AppendASCII("Preferences"); InitializeInstalledExtensionService(pref_path, source_install_dir); @@ -1150,7 +1155,7 @@ TEST_F(ExtensionServiceTest, LoadAllExtensionsFromDirectorySuccess) { ExtensionResource resource00(extension->id(), scripts[0].js_scripts()[0].extension_root(), scripts[0].js_scripts()[0].relative_path()); - FilePath expected_path(extension->path().AppendASCII("script1.js")); + base::FilePath expected_path(extension->path().AppendASCII("script1.js")); ASSERT_TRUE(file_util::AbsolutePath(&expected_path)); EXPECT_TRUE(resource00.ComparePathWithDefault(expected_path)); ExtensionResource resource01(extension->id(), @@ -1209,10 +1214,10 @@ TEST_F(ExtensionServiceTest, LoadAllExtensionsFromDirectorySuccess) { // Test loading bad extensions from the profile directory. TEST_F(ExtensionServiceTest, LoadAllExtensionsFromDirectoryFail) { // Initialize the test dir with a bad Preferences/extensions. - FilePath source_install_dir = data_dir_ + base::FilePath source_install_dir = data_dir_ .AppendASCII("bad") .AppendASCII("Extensions"); - FilePath pref_path = source_install_dir + base::FilePath pref_path = source_install_dir .DirName() .AppendASCII("Preferences"); @@ -1249,10 +1254,10 @@ TEST_F(ExtensionServiceTest, LoadAllExtensionsFromDirectoryFail) { TEST_F(ExtensionServiceTest, CleanupOnStartup) { InitPluginService(); - FilePath source_install_dir = data_dir_ + base::FilePath source_install_dir = data_dir_ .AppendASCII("good") .AppendASCII("Extensions"); - FilePath pref_path = source_install_dir + base::FilePath pref_path = source_install_dir .DirName() .AppendASCII("Preferences"); @@ -1280,7 +1285,7 @@ TEST_F(ExtensionServiceTest, CleanupOnStartup) { EXPECT_EQ(2u, count); // And extension1 dir should now be toast. - FilePath extension_dir = extensions_install_dir_ + base::FilePath extension_dir = extensions_install_dir_ .AppendASCII("behllobkkfkfnphdnhnkndlbkcpglgmj"); ASSERT_FALSE(file_util::PathExists(extension_dir)); } @@ -1290,10 +1295,10 @@ TEST_F(ExtensionServiceTest, CleanupOnStartup) { TEST_F(ExtensionServiceTest, GarbageCollectWithPendingUpdates) { InitPluginService(); - FilePath source_install_dir = data_dir_ + base::FilePath source_install_dir = data_dir_ .AppendASCII("pending_updates") .AppendASCII("Extensions"); - FilePath pref_path = source_install_dir + base::FilePath pref_path = source_install_dir .DirName() .AppendASCII("Preferences"); @@ -1324,10 +1329,10 @@ TEST_F(ExtensionServiceTest, GarbageCollectWithPendingUpdates) { TEST_F(ExtensionServiceTest, UpdateOnStartup) { InitPluginService(); - FilePath source_install_dir = data_dir_ + base::FilePath source_install_dir = data_dir_ .AppendASCII("pending_updates") .AppendASCII("Extensions"); - FilePath pref_path = source_install_dir + base::FilePath pref_path = source_install_dir .DirName() .AppendASCII("Preferences"); @@ -1366,7 +1371,7 @@ TEST_F(ExtensionServiceTest, InstallExtension) { // Extensions not enabled. set_extensions_enabled(false); - FilePath path = data_dir_.AppendASCII("good.crx"); + base::FilePath path = data_dir_.AppendASCII("good.crx"); InstallCRX(path, INSTALL_FAILED); set_extensions_enabled(true); @@ -1423,7 +1428,7 @@ TEST_F(ExtensionServiceTest, InstallingExternalExtensionWithFlags) { InitializeEmptyExtensionService(); - FilePath path = data_dir_.AppendASCII("good.crx"); + base::FilePath path = data_dir_.AppendASCII("good.crx"); set_extensions_enabled(true); // Register and install an external extension. @@ -1455,7 +1460,7 @@ TEST_F(ExtensionServiceTest, InstallingExternalExtensionWithFlags) { TEST_F(ExtensionServiceTest, UninstallingExternalExtensions) { InitializeEmptyExtensionService(); - FilePath path = data_dir_.AppendASCII("good.crx"); + base::FilePath path = data_dir_.AppendASCII("good.crx"); set_extensions_enabled(true); Version version("1.0.0.0"); @@ -1505,12 +1510,12 @@ TEST_F(ExtensionServiceTest, UninstallingExternalExtensions) { // This extension shown in preferences file requires an experimental permission. // It could not be loaded without such permission. TEST_F(ExtensionServiceTest, UninstallingNotLoadedExtension) { - FilePath source_install_dir = data_dir_ + base::FilePath source_install_dir = data_dir_ .AppendASCII("good") .AppendASCII("Extensions"); // The preference contains an external extension // that requires 'experimental' permission. - FilePath pref_path = source_install_dir + base::FilePath pref_path = source_install_dir .DirName() .AppendASCII("PreferencesExperimental"); @@ -1531,7 +1536,7 @@ TEST_F(ExtensionServiceTest, UninstallingNotLoadedExtension) { // Test that external extensions with incorrect IDs are not installed. TEST_F(ExtensionServiceTest, FailOnWrongId) { InitializeEmptyExtensionService(); - FilePath path = data_dir_.AppendASCII("good.crx"); + base::FilePath path = data_dir_.AppendASCII("good.crx"); set_extensions_enabled(true); Version version("1.0.0.0"); @@ -1560,7 +1565,7 @@ TEST_F(ExtensionServiceTest, FailOnWrongId) { // Test that external extensions with incorrect versions are not installed. TEST_F(ExtensionServiceTest, FailOnWrongVersion) { InitializeEmptyExtensionService(); - FilePath path = data_dir_.AppendASCII("good.crx"); + base::FilePath path = data_dir_.AppendASCII("good.crx"); set_extensions_enabled(true); // Install an external extension with a version from the external @@ -1589,7 +1594,7 @@ TEST_F(ExtensionServiceTest, InstallUserScript) { // integration with ExtensionService. InitializeEmptyExtensionService(); - FilePath path = data_dir_ + base::FilePath path = data_dir_ .AppendASCII("user_script_basic.user.js"); ASSERT_TRUE(file_util::PathExists(path)); @@ -1620,7 +1625,7 @@ TEST_F(ExtensionServiceTest, InstallExtensionDuringShutdown) { // Simulate shutdown. service_->set_browser_terminating_for_test(true); - FilePath path = data_dir_.AppendASCII("good.crx"); + base::FilePath path = data_dir_.AppendASCII("good.crx"); scoped_refptr<CrxInstaller> installer(CrxInstaller::Create(service_, NULL)); installer->set_allow_silent_install(true); installer->InstallCrx(path); @@ -1634,10 +1639,10 @@ TEST_F(ExtensionServiceTest, InstallExtensionDuringShutdown) { // installing an extension. TEST_F(ExtensionServiceTest, GrantedPermissions) { InitializeEmptyExtensionService(); - FilePath path = data_dir_ + base::FilePath path = data_dir_ .AppendASCII("permissions"); - FilePath pem_path = path.AppendASCII("unknown.pem"); + base::FilePath pem_path = path.AppendASCII("unknown.pem"); path = path.AppendASCII("unknown"); ASSERT_TRUE(file_util::PathExists(pem_path)); @@ -1683,10 +1688,10 @@ TEST_F(ExtensionServiceTest, GrantedPermissions) { TEST_F(ExtensionServiceTest, DefaultAppsGrantedPermissions) { InitializeEmptyExtensionService(); InitializeRequestContext(); - FilePath path = data_dir_ + base::FilePath path = data_dir_ .AppendASCII("permissions"); - FilePath pem_path = path.AppendASCII("unknown.pem"); + base::FilePath pem_path = path.AppendASCII("unknown.pem"); path = path.AppendASCII("unknown"); ASSERT_TRUE(file_util::PathExists(pem_path)); @@ -1730,7 +1735,7 @@ TEST_F(ExtensionServiceTest, GrantedFullAccessPermissions) { InitializeEmptyExtensionService(); - FilePath path = data_dir_ + base::FilePath path = data_dir_ .AppendASCII("good") .AppendASCII("Extensions") .AppendASCII(good1) @@ -1760,7 +1765,7 @@ TEST_F(ExtensionServiceTest, GrantedFullAccessPermissions) { TEST_F(ExtensionServiceTest, GrantedAPIAndHostPermissions) { InitializeEmptyExtensionService(); - FilePath path = data_dir_ + base::FilePath path = data_dir_ .AppendASCII("permissions") .AppendASCII("unknown"); @@ -1859,7 +1864,7 @@ TEST_F(ExtensionServiceTest, GrantedAPIAndHostPermissions) { // Test Packaging and installing an extension. TEST_F(ExtensionServiceTest, PackExtension) { InitializeEmptyExtensionService(); - FilePath input_directory = data_dir_ + base::FilePath input_directory = data_dir_ .AppendASCII("good") .AppendASCII("Extensions") .AppendASCII("behllobkkfkfnphdnhnkndlbkcpglgmj") @@ -1867,13 +1872,13 @@ TEST_F(ExtensionServiceTest, PackExtension) { base::ScopedTempDir temp_dir; ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); - FilePath output_directory = temp_dir.path(); + base::FilePath output_directory = temp_dir.path(); - FilePath crx_path(output_directory.AppendASCII("ex1.crx")); - FilePath privkey_path(output_directory.AppendASCII("privkey.pem")); + base::FilePath crx_path(output_directory.AppendASCII("ex1.crx")); + base::FilePath privkey_path(output_directory.AppendASCII("privkey.pem")); scoped_ptr<ExtensionCreator> creator(new ExtensionCreator()); - ASSERT_TRUE(creator->Run(input_directory, crx_path, FilePath(), + ASSERT_TRUE(creator->Run(input_directory, crx_path, base::FilePath(), privkey_path, ExtensionCreator::kNoRunFlags)); ASSERT_TRUE(file_util::PathExists(crx_path)); ASSERT_TRUE(file_util::PathExists(privkey_path)); @@ -1881,16 +1886,16 @@ TEST_F(ExtensionServiceTest, PackExtension) { // Repeat the run with the pem file gone, and no special flags // Should refuse to overwrite the existing crx. file_util::Delete(privkey_path, false); - ASSERT_FALSE(creator->Run(input_directory, crx_path, FilePath(), + ASSERT_FALSE(creator->Run(input_directory, crx_path, base::FilePath(), privkey_path, ExtensionCreator::kNoRunFlags)); // OK, now try it with a flag to overwrite existing crx. Should work. - ASSERT_TRUE(creator->Run(input_directory, crx_path, FilePath(), + ASSERT_TRUE(creator->Run(input_directory, crx_path, base::FilePath(), privkey_path, ExtensionCreator::kOverwriteCRX)); // Repeat the run allowing existing crx, but the existing pem is still // an error. Should fail. - ASSERT_FALSE(creator->Run(input_directory, crx_path, FilePath(), + ASSERT_FALSE(creator->Run(input_directory, crx_path, base::FilePath(), privkey_path, ExtensionCreator::kOverwriteCRX)); ASSERT_TRUE(file_util::PathExists(privkey_path)); @@ -1898,8 +1903,9 @@ TEST_F(ExtensionServiceTest, PackExtension) { // Try packing with invalid paths. creator.reset(new ExtensionCreator()); - ASSERT_FALSE(creator->Run(FilePath(), FilePath(), FilePath(), FilePath(), - ExtensionCreator::kOverwriteCRX)); + ASSERT_FALSE( + creator->Run(base::FilePath(), base::FilePath(), base::FilePath(), + base::FilePath(), ExtensionCreator::kOverwriteCRX)); // Try packing an empty directory. Should fail because an empty directory is // not a valid extension. @@ -1907,7 +1913,7 @@ TEST_F(ExtensionServiceTest, PackExtension) { ASSERT_TRUE(temp_dir2.CreateUniqueTempDir()); creator.reset(new ExtensionCreator()); ASSERT_FALSE(creator->Run(temp_dir2.path(), crx_path, privkey_path, - FilePath(), ExtensionCreator::kOverwriteCRX)); + base::FilePath(), ExtensionCreator::kOverwriteCRX)); // Try packing with an invalid manifest. std::string invalid_manifest_content = "I am not a manifest."; @@ -1916,13 +1922,13 @@ TEST_F(ExtensionServiceTest, PackExtension) { invalid_manifest_content.c_str(), invalid_manifest_content.size())); creator.reset(new ExtensionCreator()); ASSERT_FALSE(creator->Run(temp_dir2.path(), crx_path, privkey_path, - FilePath(), ExtensionCreator::kOverwriteCRX)); + base::FilePath(), ExtensionCreator::kOverwriteCRX)); } // Test Packaging and installing an extension whose name contains punctuation. TEST_F(ExtensionServiceTest, PackPunctuatedExtension) { InitializeEmptyExtensionService(); - FilePath input_directory = data_dir_ + base::FilePath input_directory = data_dir_ .AppendASCII("good") .AppendASCII("Extensions") .AppendASCII(good0) @@ -1933,38 +1939,42 @@ TEST_F(ExtensionServiceTest, PackPunctuatedExtension) { // Extension names containing punctuation, and the expected names for the // packed extensions. - const FilePath punctuated_names[] = { - FilePath(FILE_PATH_LITERAL("this.extensions.name.has.periods")), - FilePath(FILE_PATH_LITERAL(".thisextensionsnamestartswithaperiod")), - FilePath(FILE_PATH_LITERAL("thisextensionhasaslashinitsname/")). + const base::FilePath punctuated_names[] = { + base::FilePath(FILE_PATH_LITERAL("this.extensions.name.has.periods")), + base::FilePath(FILE_PATH_LITERAL(".thisextensionsnamestartswithaperiod")), + base::FilePath(FILE_PATH_LITERAL("thisextensionhasaslashinitsname/")). NormalizePathSeparators(), }; - const FilePath expected_crx_names[] = { - FilePath(FILE_PATH_LITERAL("this.extensions.name.has.periods.crx")), - FilePath(FILE_PATH_LITERAL(".thisextensionsnamestartswithaperiod.crx")), - FilePath(FILE_PATH_LITERAL("thisextensionhasaslashinitsname.crx")), + const base::FilePath expected_crx_names[] = { + base::FilePath(FILE_PATH_LITERAL("this.extensions.name.has.periods.crx")), + base::FilePath( + FILE_PATH_LITERAL(".thisextensionsnamestartswithaperiod.crx")), + base::FilePath(FILE_PATH_LITERAL("thisextensionhasaslashinitsname.crx")), }; - const FilePath expected_private_key_names[] = { - FilePath(FILE_PATH_LITERAL("this.extensions.name.has.periods.pem")), - FilePath(FILE_PATH_LITERAL(".thisextensionsnamestartswithaperiod.pem")), - FilePath(FILE_PATH_LITERAL("thisextensionhasaslashinitsname.pem")), + const base::FilePath expected_private_key_names[] = { + base::FilePath(FILE_PATH_LITERAL("this.extensions.name.has.periods.pem")), + base::FilePath( + FILE_PATH_LITERAL(".thisextensionsnamestartswithaperiod.pem")), + base::FilePath(FILE_PATH_LITERAL("thisextensionhasaslashinitsname.pem")), }; for (size_t i = 0; i < arraysize(punctuated_names); ++i) { SCOPED_TRACE(punctuated_names[i].value().c_str()); - FilePath output_dir = temp_dir.path().Append(punctuated_names[i]); + base::FilePath output_dir = temp_dir.path().Append(punctuated_names[i]); // Copy the extension into the output directory, as PackExtensionJob doesn't // let us choose where to output the packed extension. ASSERT_TRUE(file_util::CopyDirectory(input_directory, output_dir, true)); - FilePath expected_crx_path = temp_dir.path().Append(expected_crx_names[i]); - FilePath expected_private_key_path = + base::FilePath expected_crx_path = + temp_dir.path().Append(expected_crx_names[i]); + base::FilePath expected_private_key_path = temp_dir.path().Append(expected_private_key_names[i]); PackExtensionTestClient pack_client(expected_crx_path, expected_private_key_path); scoped_refptr<extensions::PackExtensionJob> packer( - new extensions::PackExtensionJob(&pack_client, output_dir, FilePath(), + new extensions::PackExtensionJob(&pack_client, output_dir, + base::FilePath(), ExtensionCreator::kOverwriteCRX)); packer->Start(); @@ -1987,7 +1997,7 @@ TEST_F(ExtensionServiceTest, PackExtensionContainingKeyFails) { base::ScopedTempDir extension_temp_dir; ASSERT_TRUE(extension_temp_dir.CreateUniqueTempDir()); - FilePath input_directory = extension_temp_dir.path().AppendASCII("ext"); + base::FilePath input_directory = extension_temp_dir.path().AppendASCII("ext"); ASSERT_TRUE(file_util::CopyDirectory( data_dir_ .AppendASCII("good") @@ -1999,14 +2009,14 @@ TEST_F(ExtensionServiceTest, PackExtensionContainingKeyFails) { base::ScopedTempDir output_temp_dir; ASSERT_TRUE(output_temp_dir.CreateUniqueTempDir()); - FilePath output_directory = output_temp_dir.path(); + base::FilePath output_directory = output_temp_dir.path(); - FilePath crx_path(output_directory.AppendASCII("ex1.crx")); - FilePath privkey_path(output_directory.AppendASCII("privkey.pem")); + base::FilePath crx_path(output_directory.AppendASCII("ex1.crx")); + base::FilePath privkey_path(output_directory.AppendASCII("privkey.pem")); // Pack the extension once to get a private key. scoped_ptr<ExtensionCreator> creator(new ExtensionCreator()); - ASSERT_TRUE(creator->Run(input_directory, crx_path, FilePath(), + ASSERT_TRUE(creator->Run(input_directory, crx_path, base::FilePath(), privkey_path, ExtensionCreator::kNoRunFlags)) << creator->error_message(); ASSERT_TRUE(file_util::PathExists(crx_path)); @@ -2018,7 +2028,7 @@ TEST_F(ExtensionServiceTest, PackExtensionContainingKeyFails) { input_directory.AppendASCII("privkey.pem")); // This pack should fail because of the contained private key. - EXPECT_FALSE(creator->Run(input_directory, crx_path, FilePath(), + EXPECT_FALSE(creator->Run(input_directory, crx_path, base::FilePath(), privkey_path, ExtensionCreator::kNoRunFlags)); EXPECT_THAT(creator->error_message(), testing::ContainsRegex( @@ -2033,24 +2043,24 @@ TEST_F(ExtensionServiceTest, PackExtensionContainingKeyFails) { // PrivateKeyInfo ASN.1 structure, we our RSAPrivateKey expects. TEST_F(ExtensionServiceTest, PackExtensionOpenSSLKey) { InitializeEmptyExtensionService(); - FilePath input_directory = data_dir_ + base::FilePath input_directory = data_dir_ .AppendASCII("good") .AppendASCII("Extensions") .AppendASCII("behllobkkfkfnphdnhnkndlbkcpglgmj") .AppendASCII("1.0.0.0"); - FilePath privkey_path(data_dir_.AppendASCII( + base::FilePath privkey_path(data_dir_.AppendASCII( "openssl_privkey_asn1.pem")); ASSERT_TRUE(file_util::PathExists(privkey_path)); base::ScopedTempDir temp_dir; ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); - FilePath output_directory = temp_dir.path(); + base::FilePath output_directory = temp_dir.path(); - FilePath crx_path(output_directory.AppendASCII("ex1.crx")); + base::FilePath crx_path(output_directory.AppendASCII("ex1.crx")); scoped_ptr<ExtensionCreator> creator(new ExtensionCreator()); ASSERT_TRUE(creator->Run(input_directory, crx_path, privkey_path, - FilePath(), ExtensionCreator::kOverwriteCRX)); + base::FilePath(), ExtensionCreator::kOverwriteCRX)); InstallCRX(crx_path, INSTALL_NEW); } @@ -2059,7 +2069,7 @@ TEST_F(ExtensionServiceTest, InstallTheme) { InitializeEmptyExtensionService(); // A theme. - FilePath path = data_dir_.AppendASCII("theme.crx"); + base::FilePath path = data_dir_.AppendASCII("theme.crx"); InstallCRX(path, INSTALL_NEW); int pref_count = 0; ValidatePrefKeyCount(++pref_count); @@ -2096,7 +2106,7 @@ TEST_F(ExtensionServiceTest, InstallTheme) { TEST_F(ExtensionServiceTest, LoadLocalizedTheme) { // Load. InitializeEmptyExtensionService(); - FilePath extension_path = data_dir_ + base::FilePath extension_path = data_dir_ .AppendASCII("theme_i18n"); extensions::UnpackedInstaller::Create(service_)->Load(extension_path); @@ -2111,7 +2121,7 @@ TEST_F(ExtensionServiceTest, LoadLocalizedTheme) { // Cleanup the "Cached Theme.pak" file. Ideally, this would be installed in a // temporary directory, but it automatically installs to the extension's // directory, and we don't want to copy the whole extension for a unittest. - FilePath theme_file = extension_path.Append(chrome::kThemePackFilename); + base::FilePath theme_file = extension_path.Append(chrome::kThemePackFilename); ASSERT_TRUE(file_util::PathExists(theme_file)); ASSERT_TRUE(file_util::Delete(theme_file, false)); // Not recursive. } @@ -2124,13 +2134,14 @@ TEST_F(ExtensionServiceTest, UnpackedExtensionCanChangeID) { base::ScopedTempDir temp; ASSERT_TRUE(temp.CreateUniqueTempDir()); - FilePath extension_path = temp.path(); - FilePath manifest_path = extension_path.Append(Extension::kManifestFilename); - FilePath manifest_no_key = data_dir_. + base::FilePath extension_path = temp.path(); + base::FilePath manifest_path = + extension_path.Append(Extension::kManifestFilename); + base::FilePath manifest_no_key = data_dir_. AppendASCII("unpacked"). AppendASCII("manifest_no_key.json"); - FilePath manifest_with_key = data_dir_. + base::FilePath manifest_with_key = data_dir_. AppendASCII("unpacked"). AppendASCII("manifest_with_key.json"); @@ -2162,22 +2173,22 @@ TEST_F(ExtensionServiceTest, UnpackedExtensionCanChangeID) { #if defined(OS_POSIX) TEST_F(ExtensionServiceTest, UnpackedExtensionMayContainSymlinkedFiles) { - FilePath source_data_dir = data_dir_. + base::FilePath source_data_dir = data_dir_. AppendASCII("unpacked"). AppendASCII("symlinks_allowed"); // Paths to test data files. - FilePath source_manifest = source_data_dir.AppendASCII("manifest.json"); + base::FilePath source_manifest = source_data_dir.AppendASCII("manifest.json"); ASSERT_TRUE(file_util::PathExists(source_manifest)); - FilePath source_icon = source_data_dir.AppendASCII("icon.png"); + base::FilePath source_icon = source_data_dir.AppendASCII("icon.png"); ASSERT_TRUE(file_util::PathExists(source_icon)); // Set up the temporary extension directory. base::ScopedTempDir temp; ASSERT_TRUE(temp.CreateUniqueTempDir()); - FilePath extension_path = temp.path(); - FilePath manifest = extension_path.Append(Extension::kManifestFilename); - FilePath icon_symlink = extension_path.AppendASCII("icon.png"); + base::FilePath extension_path = temp.path(); + base::FilePath manifest = extension_path.Append(Extension::kManifestFilename); + base::FilePath icon_symlink = extension_path.AppendASCII("icon.png"); file_util::CopyFile(source_manifest, manifest); file_util::CreateSymbolicLink(source_icon, icon_symlink); @@ -2194,7 +2205,7 @@ TEST_F(ExtensionServiceTest, UnpackedExtensionMayContainSymlinkedFiles) { TEST_F(ExtensionServiceTest, InstallLocalizedTheme) { InitializeEmptyExtensionService(); - FilePath theme_path = data_dir_ + base::FilePath theme_path = data_dir_ .AppendASCII("theme_i18n"); const Extension* theme = PackAndInstallCRX(theme_path, INSTALL_NEW); @@ -2241,7 +2252,7 @@ TEST_F(ExtensionServiceTest, DefaultFileAccess) { TEST_F(ExtensionServiceTest, UpdateApps) { InitializeEmptyExtensionService(); - FilePath extensions_path = data_dir_.AppendASCII("app_update"); + base::FilePath extensions_path = data_dir_.AppendASCII("app_update"); // First install v1 of a hosted app. const Extension* extension = @@ -2262,7 +2273,7 @@ TEST_F(ExtensionServiceTest, UpdateApps) { TEST_F(ExtensionServiceTest, UpdateAppsRetainOrdinals) { InitializeEmptyExtensionService(); ExtensionSorting* sorting = service_->extension_prefs()->extension_sorting(); - FilePath extensions_path = data_dir_.AppendASCII("app_update"); + base::FilePath extensions_path = data_dir_.AppendASCII("app_update"); // First install v1 of a hosted app. const Extension* extension = @@ -2293,8 +2304,8 @@ TEST_F(ExtensionServiceTest, UpdateAppsRetainOrdinals) { // Ensures that the CWS has properly initialized ordinals. TEST_F(ExtensionServiceTest, EnsureCWSOrdinalsInitialized) { InitializeEmptyExtensionService(); - service_->component_loader()->Add(IDR_WEBSTORE_MANIFEST, - FilePath(FILE_PATH_LITERAL("web_store"))); + service_->component_loader()->Add( + IDR_WEBSTORE_MANIFEST, base::FilePath(FILE_PATH_LITERAL("web_store"))); service_->Init(); ExtensionSorting* sorting = service_->extension_prefs()->extension_sorting(); @@ -2406,7 +2417,7 @@ TEST_F(ExtensionServiceTest, Reinstall) { InitializeEmptyExtensionService(); // A simple extension that should install without error. - FilePath path = data_dir_.AppendASCII("good.crx"); + base::FilePath path = data_dir_.AppendASCII("good.crx"); InstallCRX(path, INSTALL_NEW); ValidatePrefKeyCount(1); @@ -2427,7 +2438,7 @@ TEST_F(ExtensionServiceTest, FromWebStore) { InitializeEmptyExtensionService(); // A simple extension that should install without error. - FilePath path = data_dir_.AppendASCII("good.crx"); + base::FilePath path = data_dir_.AppendASCII("good.crx"); // Not from web store. const Extension* extension = InstallCRX(path, INSTALL_NEW); std::string id = extension->id(); @@ -2458,7 +2469,7 @@ TEST_F(ExtensionServiceTest, FromWebStore) { TEST_F(ExtensionServiceTest, UpgradeSignedGood) { InitializeEmptyExtensionService(); - FilePath path = data_dir_.AppendASCII("good.crx"); + base::FilePath path = data_dir_.AppendASCII("good.crx"); const Extension* extension = InstallCRX(path, INSTALL_NEW); std::string id = extension->id(); @@ -2478,7 +2489,7 @@ TEST_F(ExtensionServiceTest, UpgradeSignedGood) { TEST_F(ExtensionServiceTest, UpgradeSignedBad) { InitializeEmptyExtensionService(); - FilePath path = data_dir_.AppendASCII("good.crx"); + base::FilePath path = data_dir_.AppendASCII("good.crx"); InstallCRX(path, INSTALL_NEW); // Try upgrading with a bad signature. This should fail during the unpack, @@ -2491,7 +2502,7 @@ TEST_F(ExtensionServiceTest, UpgradeSignedBad) { TEST_F(ExtensionServiceTest, UpdateExtension) { InitializeEmptyExtensionService(); - FilePath path = data_dir_.AppendASCII("good.crx"); + base::FilePath path = data_dir_.AppendASCII("good.crx"); const Extension* good = InstallCRX(path, INSTALL_NEW); ASSERT_EQ("1.0.0.0", good->VersionString()); @@ -2509,7 +2520,7 @@ TEST_F(ExtensionServiceTest, UpdateExtensionDuringShutdown) { InitializeEmptyExtensionService(); // Install an extension. - FilePath path = data_dir_.AppendASCII("good.crx"); + base::FilePath path = data_dir_.AppendASCII("good.crx"); const Extension* good = InstallCRX(path, INSTALL_NEW); ASSERT_EQ(good_crx, good->id()); @@ -2529,7 +2540,7 @@ TEST_F(ExtensionServiceTest, UpdateExtensionDuringShutdown) { TEST_F(ExtensionServiceTest, UpdateNotInstalledExtension) { InitializeEmptyExtensionService(); - FilePath path = data_dir_.AppendASCII("good.crx"); + base::FilePath path = data_dir_.AppendASCII("good.crx"); UpdateExtension(good_crx, path, UPDATED); loop_.RunUntilIdle(); @@ -2542,7 +2553,7 @@ TEST_F(ExtensionServiceTest, UpdateNotInstalledExtension) { TEST_F(ExtensionServiceTest, UpdateWillNotDowngrade) { InitializeEmptyExtensionService(); - FilePath path = data_dir_.AppendASCII("good2.crx"); + base::FilePath path = data_dir_.AppendASCII("good2.crx"); const Extension* good = InstallCRX(path, INSTALL_NEW); ASSERT_EQ("1.0.0.1", good->VersionString()); @@ -2560,7 +2571,7 @@ TEST_F(ExtensionServiceTest, UpdateWillNotDowngrade) { TEST_F(ExtensionServiceTest, UpdateToSameVersionIsNoop) { InitializeEmptyExtensionService(); - FilePath path = data_dir_.AppendASCII("good.crx"); + base::FilePath path = data_dir_.AppendASCII("good.crx"); const Extension* good = InstallCRX(path, INSTALL_NEW); ASSERT_EQ(good_crx, good->id()); @@ -2571,7 +2582,7 @@ TEST_F(ExtensionServiceTest, UpdateToSameVersionIsNoop) { TEST_F(ExtensionServiceTest, UpdateExtensionPreservesState) { InitializeEmptyExtensionService(); - FilePath path = data_dir_.AppendASCII("good.crx"); + base::FilePath path = data_dir_.AppendASCII("good.crx"); const Extension* good = InstallCRX(path, INSTALL_NEW); ASSERT_EQ("1.0.0.0", good->VersionString()); @@ -2597,7 +2608,7 @@ TEST_F(ExtensionServiceTest, UpdateExtensionPreservesState) { TEST_F(ExtensionServiceTest, UpdateExtensionPreservesLocation) { InitializeEmptyExtensionService(); - FilePath path = data_dir_.AppendASCII("good.crx"); + base::FilePath path = data_dir_.AppendASCII("good.crx"); const Extension* good = InstallCRXWithLocation(path, Manifest::EXTERNAL_PREF, INSTALL_NEW); @@ -2621,8 +2632,9 @@ TEST_F(ExtensionServiceTest, LoadExtensionsCanDowngrade) { // We'll write the extension manifest dynamically to a temporary path // to make it easier to change the version number. - FilePath extension_path = temp.path(); - FilePath manifest_path = extension_path.Append(Extension::kManifestFilename); + base::FilePath extension_path = temp.path(); + base::FilePath manifest_path = + extension_path.Append(Extension::kManifestFilename); ASSERT_FALSE(file_util::PathExists(manifest_path)); // Start with version 2.0. @@ -2661,12 +2673,12 @@ TEST_F(ExtensionServiceTest, LoadExtensionsCanDowngrade) { #if !defined(OS_CHROMEOS) // LOAD extensions with plugins require approval. TEST_F(ExtensionServiceTest, LoadExtensionsWithPlugins) { - FilePath extension_with_plugin_path = data_dir_ + base::FilePath extension_with_plugin_path = data_dir_ .AppendASCII("good") .AppendASCII("Extensions") .AppendASCII(good1) .AppendASCII("2"); - FilePath extension_no_plugin_path = data_dir_ + base::FilePath extension_no_plugin_path = data_dir_ .AppendASCII("good") .AppendASCII("Extensions") .AppendASCII(good2) @@ -2781,7 +2793,7 @@ TEST_F(ExtensionServiceTest, UpdatePendingExtension) { kGoodInstallSilently)); EXPECT_TRUE(service_->pending_extension_manager()->IsIdPending(kGoodId)); - FilePath path = data_dir_.AppendASCII("good.crx"); + base::FilePath path = data_dir_.AppendASCII("good.crx"); UpdateExtension(kGoodId, path, ENABLED); EXPECT_FALSE(service_->pending_extension_manager()->IsIdPending(kGoodId)); @@ -2806,7 +2818,7 @@ TEST_F(ExtensionServiceTest, DISABLED_UpdatePendingTheme) { theme_crx, GURL(), &IsTheme, false)); EXPECT_TRUE(service_->pending_extension_manager()->IsIdPending(theme_crx)); - FilePath path = data_dir_.AppendASCII("theme.crx"); + base::FilePath path = data_dir_.AppendASCII("theme.crx"); UpdateExtension(theme_crx, path, ENABLED); EXPECT_FALSE(service_->pending_extension_manager()->IsIdPending(theme_crx)); @@ -2835,7 +2847,7 @@ TEST_F(ExtensionServiceTest, MAYBE_UpdatePendingExternalCrx) { EXPECT_TRUE(service_->pending_extension_manager()->IsIdPending(theme_crx)); - FilePath path = data_dir_.AppendASCII("theme.crx"); + base::FilePath path = data_dir_.AppendASCII("theme.crx"); UpdateExtension(theme_crx, path, ENABLED); EXPECT_FALSE(service_->pending_extension_manager()->IsIdPending(theme_crx)); @@ -2899,7 +2911,7 @@ TEST_F(ExtensionServiceTest, UpdatePendingCrxThemeMismatch) { EXPECT_TRUE(service_->pending_extension_manager()->IsIdPending(theme_crx)); - FilePath path = data_dir_.AppendASCII("theme.crx"); + base::FilePath path = data_dir_.AppendASCII("theme.crx"); UpdateExtension(theme_crx, path, FAILED_SILENTLY); EXPECT_FALSE(service_->pending_extension_manager()->IsIdPending(theme_crx)); @@ -2920,7 +2932,7 @@ TEST_F(ExtensionServiceTest, UpdatePendingExtensionFailedShouldInstallTest) { kGoodId, GURL(kGoodUpdateURL), &IsTheme, kGoodInstallSilently)); EXPECT_TRUE(service_->pending_extension_manager()->IsIdPending(kGoodId)); - FilePath path = data_dir_.AppendASCII("good.crx"); + base::FilePath path = data_dir_.AppendASCII("good.crx"); UpdateExtension(kGoodId, path, UPDATED); // TODO(akalin): Figure out how to check that the extensions @@ -2936,7 +2948,7 @@ TEST_F(ExtensionServiceTest, UpdatePendingExtensionFailedShouldInstallTest) { TEST_F(ExtensionServiceTest, UpdatePendingExtensionNotPending) { InitializeEmptyExtensionService(); - FilePath path = data_dir_.AppendASCII("good.crx"); + base::FilePath path = data_dir_.AppendASCII("good.crx"); UpdateExtension(kGoodId, path, UPDATED); EXPECT_FALSE(service_->pending_extension_manager()->IsIdPending(kGoodId)); @@ -2947,7 +2959,7 @@ TEST_F(ExtensionServiceTest, UpdatePendingExtensionNotPending) { TEST_F(ExtensionServiceTest, UpdatePendingExtensionAlreadyInstalled) { InitializeEmptyExtensionService(); - FilePath path = data_dir_.AppendASCII("good.crx"); + base::FilePath path = data_dir_.AppendASCII("good.crx"); const Extension* good = InstallCRX(path, INSTALL_NEW); ASSERT_EQ(1u, service_->extensions()->size()); @@ -2999,7 +3011,7 @@ TEST_F(ExtensionServiceTest, SetUnsetBlacklistInPrefs) { TEST_F(ExtensionServiceTest, UnloadBlacklistedExtension) { InitializeEmptyExtensionService(); - FilePath path = data_dir_.AppendASCII("good.crx"); + base::FilePath path = data_dir_.AppendASCII("good.crx"); const Extension* good = InstallCRX(path, INSTALL_NEW); EXPECT_EQ(good_crx, good->id()); @@ -3043,7 +3055,7 @@ TEST_F(ExtensionServiceTest, BlacklistedExtensionWillNotInstall) { ValidateBooleanPref(good_crx, "blacklist", true); // We can not install good_crx. - FilePath path = data_dir_.AppendASCII("good.crx"); + base::FilePath path = data_dir_.AppendASCII("good.crx"); InstallCRX(path, INSTALL_WITHOUT_LOAD); EXPECT_EQ(0u, service_->extensions()->size()); ValidateBooleanPref(good_crx, "blacklist", true); @@ -3052,7 +3064,7 @@ TEST_F(ExtensionServiceTest, BlacklistedExtensionWillNotInstall) { // Unload blacklisted extension on policy change. TEST_F(ExtensionServiceTest, UnloadBlacklistedExtensionPolicy) { InitializeEmptyExtensionService(); - FilePath path = data_dir_.AppendASCII("good.crx"); + base::FilePath path = data_dir_.AppendASCII("good.crx"); const Extension* good = InstallCRX(path, INSTALL_NEW); EXPECT_EQ(good_crx, good->id()); @@ -3081,10 +3093,10 @@ TEST_F(ExtensionServiceTest, UnloadBlacklistedExtensionPolicy) { // blacklisted ones. TEST_F(ExtensionServiceTest, WillNotLoadBlacklistedExtensionsFromDirectory) { // Initialize the test dir with a good Preferences/extensions. - FilePath source_install_dir = data_dir_ + base::FilePath source_install_dir = data_dir_ .AppendASCII("good") .AppendASCII("Extensions"); - FilePath pref_path = source_install_dir + base::FilePath pref_path = source_install_dir .DirName() .AppendASCII("Preferences"); InitializeInstalledExtensionService(pref_path, source_install_dir); @@ -3129,7 +3141,7 @@ TEST_F(ExtensionServiceTest, BlacklistedByPolicyWillNotInstall) { } // Blacklist prevents us from installing good_crx. - FilePath path = data_dir_.AppendASCII("good.crx"); + base::FilePath path = data_dir_.AppendASCII("good.crx"); InstallCRX(path, INSTALL_FAILED); EXPECT_EQ(0u, service_->extensions()->size()); @@ -3151,7 +3163,7 @@ TEST_F(ExtensionServiceTest, BlacklistedByPolicyRemovedIfRunning) { InitializeEmptyExtensionService(); // Install good_crx. - FilePath path = data_dir_.AppendASCII("good.crx"); + base::FilePath path = data_dir_.AppendASCII("good.crx"); InstallCRX(path, INSTALL_NEW); EXPECT_EQ(1u, service_->extensions()->size()); @@ -3183,7 +3195,7 @@ TEST_F(ExtensionServiceTest, ComponentExtensionWhitelisted) { } // Install a component extension. - FilePath path = data_dir_ + base::FilePath path = data_dir_ .AppendASCII("good") .AppendASCII("Extensions") .AppendASCII(good0) @@ -3282,7 +3294,7 @@ TEST_F(ExtensionServiceTest, ManagementPolicyProhibitsLoadFromPrefs) { InitializeEmptyExtensionService(); // Create a fake extension to be loaded as though it were read from prefs. - FilePath path = data_dir_.AppendASCII("management") + base::FilePath path = data_dir_.AppendASCII("management") .AppendASCII("simple_extension"); DictionaryValue manifest; manifest.SetString(keys::kName, "simple_extension"); @@ -3511,7 +3523,7 @@ TEST_F(ExtensionServiceTest, DisableTerminatedExtension) { TEST_F(ExtensionServiceTest, DisableAllExtensions) { InitializeEmptyExtensionService(); - FilePath path = data_dir_.AppendASCII("good.crx"); + base::FilePath path = data_dir_.AppendASCII("good.crx"); InstallCRX(path, INSTALL_NEW); EXPECT_EQ(1u, service_->extensions()->size()); @@ -3547,7 +3559,7 @@ TEST_F(ExtensionServiceTest, ReloadExtensions) { InitializeRequestContext(); // Simple extension that should install without error. - FilePath path = data_dir_.AppendASCII("good.crx"); + base::FilePath path = data_dir_.AppendASCII("good.crx"); InstallCRX(path, INSTALL_NEW, Extension::FROM_WEBSTORE | Extension::WAS_INSTALLED_BY_DEFAULT); const char* extension_id = good_crx; @@ -3620,8 +3632,8 @@ TEST_F(ExtensionServiceTest, UpgradingRequirementsEnabled) { InitializeEmptyExtensionService(); BlackListWebGL(); - FilePath path = data_dir_.AppendASCII("requirements"); - FilePath pem_path = data_dir_.AppendASCII("requirements") + base::FilePath path = data_dir_.AppendASCII("requirements"); + base::FilePath pem_path = data_dir_.AppendASCII("requirements") .AppendASCII("v1_good.pem"); const Extension* extension_v1 = PackAndInstallCRX(path.AppendASCII("v1_good"), pem_path, @@ -3629,7 +3641,7 @@ TEST_F(ExtensionServiceTest, UpgradingRequirementsEnabled) { std::string id = extension_v1->id(); EXPECT_TRUE(service_->IsExtensionEnabled(id)); - FilePath v2_bad_requirements_crx = GetTemporaryFile(); + base::FilePath v2_bad_requirements_crx = GetTemporaryFile(); PackCRX(path.AppendASCII("v2_bad_requirements"), pem_path, @@ -3637,7 +3649,7 @@ TEST_F(ExtensionServiceTest, UpgradingRequirementsEnabled) { UpdateExtension(id, v2_bad_requirements_crx, INSTALLED); EXPECT_FALSE(service_->IsExtensionEnabled(id)); - FilePath v3_good_crx = GetTemporaryFile(); + base::FilePath v3_good_crx = GetTemporaryFile(); PackCRX(path.AppendASCII("v3_good"), pem_path, v3_good_crx); UpdateExtension(id, v3_good_crx, ENABLED); @@ -3649,8 +3661,8 @@ TEST_F(ExtensionServiceTest, UpgradingRequirementsDisabled) { InitializeEmptyExtensionService(); BlackListWebGL(); - FilePath path = data_dir_.AppendASCII("requirements"); - FilePath pem_path = data_dir_.AppendASCII("requirements") + base::FilePath path = data_dir_.AppendASCII("requirements"); + base::FilePath pem_path = data_dir_.AppendASCII("requirements") .AppendASCII("v1_good.pem"); const Extension* extension_v1 = PackAndInstallCRX(path.AppendASCII("v1_good"), pem_path, @@ -3659,7 +3671,7 @@ TEST_F(ExtensionServiceTest, UpgradingRequirementsDisabled) { service_->DisableExtension(id, Extension::DISABLE_USER_ACTION); EXPECT_FALSE(service_->IsExtensionEnabled(id)); - FilePath v2_bad_requirements_crx = GetTemporaryFile(); + base::FilePath v2_bad_requirements_crx = GetTemporaryFile(); PackCRX(path.AppendASCII("v2_bad_requirements"), pem_path, @@ -3667,7 +3679,7 @@ TEST_F(ExtensionServiceTest, UpgradingRequirementsDisabled) { UpdateExtension(id, v2_bad_requirements_crx, INSTALLED); EXPECT_FALSE(service_->IsExtensionEnabled(id)); - FilePath v3_good_crx = GetTemporaryFile(); + base::FilePath v3_good_crx = GetTemporaryFile(); PackCRX(path.AppendASCII("v3_good"), pem_path, v3_good_crx); UpdateExtension(id, v3_good_crx, INSTALLED); @@ -3680,8 +3692,8 @@ TEST_F(ExtensionServiceTest, UpgradingRequirementsPermissions) { InitializeEmptyExtensionService(); BlackListWebGL(); - FilePath path = data_dir_.AppendASCII("requirements"); - FilePath pem_path = data_dir_.AppendASCII("requirements") + base::FilePath path = data_dir_.AppendASCII("requirements"); + base::FilePath pem_path = data_dir_.AppendASCII("requirements") .AppendASCII("v1_good.pem"); const Extension* extension_v1 = PackAndInstallCRX(path.AppendASCII("v1_good"), pem_path, @@ -3689,7 +3701,7 @@ TEST_F(ExtensionServiceTest, UpgradingRequirementsPermissions) { std::string id = extension_v1->id(); EXPECT_TRUE(service_->IsExtensionEnabled(id)); - FilePath v2_bad_requirements_and_permissions_crx = GetTemporaryFile(); + base::FilePath v2_bad_requirements_and_permissions_crx = GetTemporaryFile(); PackCRX(path.AppendASCII("v2_bad_requirements_and_permissions"), pem_path, @@ -3697,7 +3709,7 @@ TEST_F(ExtensionServiceTest, UpgradingRequirementsPermissions) { UpdateExtension(id, v2_bad_requirements_and_permissions_crx, INSTALLED); EXPECT_FALSE(service_->IsExtensionEnabled(id)); - FilePath v3_bad_permissions_crx = GetTemporaryFile(); + base::FilePath v3_bad_permissions_crx = GetTemporaryFile(); PackCRX(path.AppendASCII("v3_bad_permissions"), pem_path, @@ -3712,7 +3724,7 @@ TEST_F(ExtensionServiceTest, UnpackedRequirements) { InitializeEmptyExtensionService(); BlackListWebGL(); - FilePath path = data_dir_.AppendASCII("requirements") + base::FilePath path = data_dir_.AppendASCII("requirements") .AppendASCII("v2_bad_requirements"); extensions::UnpackedInstaller::Create(service_)->Load(path); loop_.RunUntilIdle(); @@ -3748,7 +3760,7 @@ TEST_F(ExtensionServiceTest, ClearExtensionData) { ExtensionCookieCallback callback; // Load a test extension. - FilePath path = data_dir_; + base::FilePath path = data_dir_; path = path.AppendASCII("good.crx"); const Extension* extension = InstallCRX(path, INSTALL_NEW); ASSERT_TRUE(extension); @@ -3793,8 +3805,9 @@ TEST_F(ExtensionServiceTest, ClearExtensionData) { // Create local storage. We only simulate this by creating the backing files. // Note: This test depends on details of how the dom_storage library // stores data in the host file system. - FilePath lso_dir_path = profile_->GetPath().AppendASCII("Local Storage"); - FilePath lso_file_path = lso_dir_path.AppendASCII( + base::FilePath lso_dir_path = + profile_->GetPath().AppendASCII("Local Storage"); + base::FilePath lso_file_path = lso_dir_path.AppendASCII( UTF16ToUTF8(origin_id) + ".localstorage"); EXPECT_TRUE(file_util::CreateDirectory(lso_dir_path)); EXPECT_EQ(0, file_util::WriteFile(lso_file_path, NULL, 0)); @@ -3805,7 +3818,7 @@ TEST_F(ExtensionServiceTest, ClearExtensionData) { IndexedDBContext* idb_context = BrowserContext::GetDefaultStoragePartition(profile_.get())-> GetIndexedDBContext(); - FilePath idb_path = idb_context->GetFilePathForTesting(origin_id); + base::FilePath idb_path = idb_context->GetFilePathForTesting(origin_id); EXPECT_TRUE(file_util::CreateDirectory(idb_path)); EXPECT_TRUE(file_util::DirectoryExists(idb_path)); @@ -3906,8 +3919,9 @@ TEST_F(ExtensionServiceTest, ClearAppData) { // Create local storage. We only simulate this by creating the backing files. // Note: This test depends on details of how the dom_storage library // stores data in the host file system. - FilePath lso_dir_path = profile_->GetPath().AppendASCII("Local Storage"); - FilePath lso_file_path = lso_dir_path.AppendASCII( + base::FilePath lso_dir_path = + profile_->GetPath().AppendASCII("Local Storage"); + base::FilePath lso_file_path = lso_dir_path.AppendASCII( UTF16ToUTF8(origin_id) + ".localstorage"); EXPECT_TRUE(file_util::CreateDirectory(lso_dir_path)); EXPECT_EQ(0, file_util::WriteFile(lso_file_path, NULL, 0)); @@ -3918,7 +3932,7 @@ TEST_F(ExtensionServiceTest, ClearAppData) { IndexedDBContext* idb_context = BrowserContext::GetDefaultStoragePartition(profile_.get())-> GetIndexedDBContext(); - FilePath idb_path = idb_context->GetFilePathForTesting(origin_id); + base::FilePath idb_path = idb_context->GetFilePathForTesting(origin_id); EXPECT_TRUE(file_util::CreateDirectory(idb_path)); EXPECT_TRUE(file_util::DirectoryExists(idb_path)); @@ -3967,7 +3981,7 @@ TEST_F(ExtensionServiceTest, ClearAppData) { TEST_F(ExtensionServiceTest, LoadExtension) { InitializeEmptyExtensionService(); - FilePath ext1 = data_dir_ + base::FilePath ext1 = data_dir_ .AppendASCII("good") .AppendASCII("Extensions") .AppendASCII("behllobkkfkfnphdnhnkndlbkcpglgmj") @@ -3981,7 +3995,7 @@ TEST_F(ExtensionServiceTest, LoadExtension) { ValidatePrefKeyCount(1); - FilePath no_manifest = data_dir_ + base::FilePath no_manifest = data_dir_ .AppendASCII("bad") // .AppendASCII("Extensions") .AppendASCII("cccccccccccccccccccccccccccccccc") @@ -4007,7 +4021,7 @@ TEST_F(ExtensionServiceTest, LoadExtension) { TEST_F(ExtensionServiceTest, GenerateID) { InitializeEmptyExtensionService(); - FilePath no_id_ext = data_dir_.AppendASCII("no_id"); + base::FilePath no_id_ext = data_dir_.AppendASCII("no_id"); extensions::UnpackedInstaller::Create(service_)->Load(no_id_ext); loop_.RunUntilIdle(); EXPECT_EQ(0u, GetErrors().size()); @@ -4035,7 +4049,7 @@ void ExtensionServiceTest::TestExternalProvider( provider->set_visit_count(0); // Register a test extension externally using the mock registry provider. - FilePath source_path = data_dir_.AppendASCII("good.crx"); + base::FilePath source_path = data_dir_.AppendASCII("good.crx"); // Add the extension. provider->UpdateOrAddExtension(good_crx, "1.0.0.0", source_path); @@ -4085,7 +4099,7 @@ void ExtensionServiceTest::TestExternalProvider( service_->UninstallExtension(id, false, NULL); loop_.RunUntilIdle(); - FilePath install_path = extensions_install_dir_.AppendASCII(id); + base::FilePath install_path = extensions_install_dir_.AppendASCII(id); if (no_uninstall) { // Policy controlled extensions should not have been touched by uninstall. ASSERT_TRUE(file_util::PathExists(install_path)); @@ -4226,10 +4240,10 @@ TEST_F(ExtensionServiceTest, ExternalInstallPolicyUpdateUrl) { // providers can't account for them. TEST_F(ExtensionServiceTest, ExternalUninstall) { // Start the extensions service with one external extension already installed. - FilePath source_install_dir = data_dir_ + base::FilePath source_install_dir = data_dir_ .AppendASCII("good") .AppendASCII("Extensions"); - FilePath pref_path = source_install_dir + base::FilePath pref_path = source_install_dir .DirName() .AppendASCII("PreferencesExternal"); @@ -4276,7 +4290,7 @@ TEST_F(ExtensionServiceTest, MultipleExternalUpdateCheck) { EXPECT_EQ(0u, loaded_.size()); // Register a test extension externally using the mock registry provider. - FilePath source_path = data_dir_.AppendASCII("good.crx"); + base::FilePath source_path = data_dir_.AppendASCII("good.crx"); provider->UpdateOrAddExtension(good_crx, "1.0.0.0", source_path); // Two checks for external updates should find the extension, and install it @@ -4332,7 +4346,7 @@ TEST_F(ExtensionServiceTest, ExternalPrefProvider) { // Test some valid extension records. // Set a base path to avoid erroring out on relative paths. // Paths starting with // are absolute on every platform we support. - FilePath base_path(FILE_PATH_LITERAL("//base/path")); + base::FilePath base_path(FILE_PATH_LITERAL("//base/path")); ASSERT_TRUE(base_path.IsAbsolute()); MockProviderVisitor visitor(base_path); std::string json_data = @@ -4406,7 +4420,7 @@ TEST_F(ExtensionServiceTest, ExternalPrefProvider) { // Check that if a base path is not provided, use of a relative // path fails. - FilePath empty; + base::FilePath empty; MockProviderVisitor visitor_no_relative_paths(empty); // Use absolute paths. Expect success. @@ -4490,9 +4504,9 @@ TEST_F(ExtensionServiceTest, LoadAndRelocalizeExtensions) { extension_l10n_util::ScopedLocaleForTest testLocale("en"); // Initialize the test dir with a good Preferences/extensions. - FilePath source_install_dir = data_dir_ + base::FilePath source_install_dir = data_dir_ .AppendASCII("l10n"); - FilePath pref_path = source_install_dir.AppendASCII("Preferences"); + base::FilePath pref_path = source_install_dir.AppendASCII("Preferences"); InitializeInstalledExtensionService(pref_path, source_install_dir); service_->Init(); @@ -4558,7 +4572,7 @@ TEST(ExtensionServiceTestSimple, Enabledness) { content::TestBrowserThread ui_thread(BrowserThread::UI, &loop); content::TestBrowserThread file_thread(BrowserThread::FILE, &loop); scoped_ptr<CommandLine> command_line; - FilePath install_dir = profile->GetPath() + base::FilePath install_dir = profile->GetPath() .AppendASCII(ExtensionService::kInstallDirectoryName); #if defined(ENABLE_PLUGINS) @@ -4641,19 +4655,19 @@ TEST(ExtensionServiceTestSimple, Enabledness) { TEST_F(ExtensionServiceTest, StorageQuota) { InitializeEmptyExtensionService(); - FilePath extensions_path = data_dir_ + base::FilePath extensions_path = data_dir_ .AppendASCII("storage_quota"); - FilePath limited_quota_ext = + base::FilePath limited_quota_ext = extensions_path.AppendASCII("limited_quota") .AppendASCII("1.0"); // The old permission name for unlimited quota was "unlimited_storage", but // we changed it to "unlimitedStorage". This tests both versions. - FilePath unlimited_quota_ext = + base::FilePath unlimited_quota_ext = extensions_path.AppendASCII("unlimited_quota") .AppendASCII("1.0"); - FilePath unlimited_quota_ext2 = + base::FilePath unlimited_quota_ext2 = extensions_path.AppendASCII("unlimited_quota") .AppendASCII("2.0"); extensions::UnpackedInstaller::Create(service_)->Load(limited_quota_ext); @@ -4679,7 +4693,7 @@ TEST_F(ExtensionServiceTest, ComponentExtensions) { // Component extensions should work even when extensions are disabled. set_extensions_enabled(false); - FilePath path = data_dir_ + base::FilePath path = data_dir_ .AppendASCII("good") .AppendASCII("Extensions") .AppendASCII("behllobkkfkfnphdnhnkndlbkcpglgmj") @@ -5006,7 +5020,7 @@ TEST_F(ExtensionServiceTest, ProcessSyncDataUninstall) { EXPECT_FALSE(service_->GetExtensionById(good_crx, true)); // Install the extension. - FilePath extension_path = data_dir_.AppendASCII("good.crx"); + base::FilePath extension_path = data_dir_.AppendASCII("good.crx"); InstallCRX(extension_path, INSTALL_NEW); EXPECT_TRUE(service_->GetExtensionById(good_crx, true)); @@ -5023,7 +5037,7 @@ TEST_F(ExtensionServiceTest, ProcessSyncDataWrongType) { InitializeEmptyExtensionService(); // Install the extension. - FilePath extension_path = data_dir_.AppendASCII("good.crx"); + base::FilePath extension_path = data_dir_.AppendASCII("good.crx"); InstallCRX(extension_path, INSTALL_NEW); EXPECT_TRUE(service_->GetExtensionById(good_crx, true)); @@ -5280,7 +5294,7 @@ TEST_F(ExtensionServiceTest, ProcessSyncDataNotInstalled) { TEST_F(ExtensionServiceTest, InstallPriorityExternalUpdateUrl) { InitializeEmptyExtensionService(); - FilePath path = data_dir_.AppendASCII("good.crx"); + base::FilePath path = data_dir_.AppendASCII("good.crx"); InstallCRX(path, INSTALL_NEW); ValidatePrefKeyCount(1u); ValidateIntegerPref(good_crx, "state", Extension::ENABLED); @@ -5326,7 +5340,7 @@ TEST_F(ExtensionServiceTest, InstallPriorityExternalLocalFile) { // We don't want the extension to be installed. A path that doesn't // point to a valid CRX ensures this. - const FilePath kInvalidPathToCrx = FilePath(); + const base::FilePath kInvalidPathToCrx = base::FilePath(); const int kCreationFlags = 0; const bool kDontMarkAcknowledged = false; @@ -5408,7 +5422,7 @@ TEST_F(ExtensionServiceTest, InstallPriorityExternalLocalFile) { pending->Remove(kGoodId); // Install the extension. - FilePath path = data_dir_.AppendASCII("good.crx"); + base::FilePath path = data_dir_.AppendASCII("good.crx"); const Extension* ext = InstallCRX(path, INSTALL_NEW); ValidatePrefKeyCount(1u); ValidateIntegerPref(good_crx, "state", Extension::ENABLED); @@ -5482,7 +5496,7 @@ TEST_F(ExtensionServiceTest, ConcurrentExternalLocalFile) { Version kVersion123("1.2.3"); Version kVersion124("1.2.4"); Version kVersion125("1.2.5"); - const FilePath kInvalidPathToCrx = FilePath(); + const base::FilePath kInvalidPathToCrx = base::FilePath(); const int kCreationFlags = 0; const bool kDontMarkAcknowledged = false; @@ -5547,9 +5561,9 @@ TEST_F(ExtensionServiceTest, InstallWhitelistedExtension) { switches::kWhitelistedExtensionID, test_id); InitializeEmptyExtensionService(); - FilePath path = data_dir_ + base::FilePath path = data_dir_ .AppendASCII("permissions"); - FilePath pem_path = path + base::FilePath pem_path = path .AppendASCII("whitelist.pem"); path = path .AppendASCII("whitelist"); @@ -5633,7 +5647,7 @@ class ExtensionSourcePriorityTest : public ExtensionServiceTest { // All tests use a single extension. Making the id and path member // vars avoids pasing the same argument to every method. std::string crx_id_; - FilePath crx_path_; + base::FilePath crx_path_; }; // Test that a pending request for installation of an external CRX from @@ -5729,7 +5743,7 @@ TEST_F(ExtensionServiceTest, ExternalInstallGlobalError) { // This is a normal extension, installed normally. // This should NOT trigger an alert. set_extensions_enabled(true); - FilePath path = data_dir_.AppendASCII("good.crx"); + base::FilePath path = data_dir_.AppendASCII("good.crx"); InstallCRX(path, INSTALL_NEW); service_->CheckForExternalUpdates(); diff --git a/chrome/browser/extensions/extension_service_unittest.h b/chrome/browser/extensions/extension_service_unittest.h index 2da36f6..1414ad2 100644 --- a/chrome/browser/extensions/extension_service_unittest.h +++ b/chrome/browser/extensions/extension_service_unittest.h @@ -27,13 +27,14 @@ class ExtensionServiceTestBase : public testing::Test { ExtensionServiceTestBase(); virtual ~ExtensionServiceTestBase(); - void InitializeExtensionService(const FilePath& profile_path, - const FilePath& pref_file, - const FilePath& extensions_install_dir, + void InitializeExtensionService(const base::FilePath& profile_path, + const base::FilePath& pref_file, + const base::FilePath& extensions_install_dir, bool autoupdate_enabled); - void InitializeInstalledExtensionService(const FilePath& prefs_file, - const FilePath& source_install_dir); + void InitializeInstalledExtensionService( + const base::FilePath& prefs_file, + const base::FilePath& source_install_dir); void InitializeEmptyExtensionService(); @@ -58,8 +59,8 @@ class ExtensionServiceTestBase : public testing::Test { base::ShadowingAtExitManager at_exit_manager_; base::ScopedTempDir temp_dir_; scoped_ptr<TestingProfile> profile_; - FilePath extensions_install_dir_; - FilePath data_dir_; + base::FilePath extensions_install_dir_; + base::FilePath data_dir_; // Managed by extensions::ExtensionSystemFactory. ExtensionService* service_; extensions::ManagementPolicy* management_policy_; diff --git a/chrome/browser/extensions/extension_special_storage_policy_unittest.cc b/chrome/browser/extensions/extension_special_storage_policy_unittest.cc index 8216a52..5220587 100644 --- a/chrome/browser/extensions/extension_special_storage_policy_unittest.cc +++ b/chrome/browser/extensions/extension_special_storage_policy_unittest.cc @@ -37,9 +37,9 @@ class ExtensionSpecialStoragePolicyTest : public testing::Test { protected: scoped_refptr<Extension> CreateProtectedApp() { #if defined(OS_WIN) - FilePath path(FILE_PATH_LITERAL("c:\\foo")); + base::FilePath path(FILE_PATH_LITERAL("c:\\foo")); #elif defined(OS_POSIX) - FilePath path(FILE_PATH_LITERAL("/foo")); + base::FilePath path(FILE_PATH_LITERAL("/foo")); #endif DictionaryValue manifest; manifest.SetString(keys::kName, "Protected"); @@ -59,9 +59,9 @@ class ExtensionSpecialStoragePolicyTest : public testing::Test { scoped_refptr<Extension> CreateUnlimitedApp() { #if defined(OS_WIN) - FilePath path(FILE_PATH_LITERAL("c:\\bar")); + base::FilePath path(FILE_PATH_LITERAL("c:\\bar")); #elif defined(OS_POSIX) - FilePath path(FILE_PATH_LITERAL("/bar")); + base::FilePath path(FILE_PATH_LITERAL("/bar")); #endif DictionaryValue manifest; manifest.SetString(keys::kName, "Unlimited"); @@ -84,9 +84,9 @@ class ExtensionSpecialStoragePolicyTest : public testing::Test { scoped_refptr<Extension> CreateComponentApp() { #if defined(OS_WIN) - FilePath path(FILE_PATH_LITERAL("c:\\component")); + base::FilePath path(FILE_PATH_LITERAL("c:\\component")); #elif defined(OS_POSIX) - FilePath path(FILE_PATH_LITERAL("/component")); + base::FilePath path(FILE_PATH_LITERAL("/component")); #endif DictionaryValue manifest; manifest.SetString(keys::kName, "Component"); @@ -110,9 +110,9 @@ class ExtensionSpecialStoragePolicyTest : public testing::Test { scoped_refptr<Extension> CreateHandlerApp() { #if defined(OS_WIN) - FilePath path(FILE_PATH_LITERAL("c:\\handler")); + base::FilePath path(FILE_PATH_LITERAL("c:\\handler")); #elif defined(OS_POSIX) - FilePath path(FILE_PATH_LITERAL("/handler")); + base::FilePath path(FILE_PATH_LITERAL("/handler")); #endif DictionaryValue manifest; manifest.SetString(keys::kName, "Handler"); @@ -137,9 +137,9 @@ class ExtensionSpecialStoragePolicyTest : public testing::Test { #if defined(ENABLE_WEB_INTENTS) scoped_refptr<Extension> CreateWebIntentViewApp() { #if defined(OS_WIN) - FilePath path(FILE_PATH_LITERAL("c:\\bar")); + base::FilePath path(FILE_PATH_LITERAL("c:\\bar")); #elif defined(OS_POSIX) - FilePath path(FILE_PATH_LITERAL("/bar")); + base::FilePath path(FILE_PATH_LITERAL("/bar")); #endif DictionaryValue manifest; manifest.SetString(keys::kName, "WebIntent"); diff --git a/chrome/browser/extensions/extension_startup_browsertest.cc b/chrome/browser/extensions/extension_startup_browsertest.cc index 8fa8b9e..50d01f5 100644 --- a/chrome/browser/extensions/extension_startup_browsertest.cc +++ b/chrome/browser/extensions/extension_startup_browsertest.cc @@ -49,7 +49,7 @@ class ExtensionStartupTestBase : public InProcessBrowserTest { command_line->AppendSwitch(switches::kDisableExtensions); if (!load_extensions_.empty()) { - FilePath::StringType paths = JoinString(load_extensions_, ','); + base::FilePath::StringType paths = JoinString(load_extensions_, ','); command_line->AppendSwitchNative(switches::kLoadExtension, paths); command_line->AppendSwitch(switches::kDisableExtensionsFileAccessCheck); @@ -57,7 +57,7 @@ class ExtensionStartupTestBase : public InProcessBrowserTest { } virtual bool SetUpUserDataDirectory() OVERRIDE { - FilePath profile_dir; + base::FilePath profile_dir; PathService::Get(chrome::DIR_USER_DATA, &profile_dir); profile_dir = profile_dir.AppendASCII(TestingProfile::kTestUserProfileDir); file_util::CreateDirectory(profile_dir); @@ -67,7 +67,7 @@ class ExtensionStartupTestBase : public InProcessBrowserTest { extensions_dir_ = profile_dir.AppendASCII("Extensions"); if (enable_extensions_ && load_extensions_.empty()) { - FilePath src_dir; + base::FilePath src_dir; PathService::Get(chrome::DIR_TEST_DATA, &src_dir); src_dir = src_dir.AppendASCII("extensions").AppendASCII("good"); @@ -118,7 +118,7 @@ class ExtensionStartupTestBase : public InProcessBrowserTest { void TestInjection(bool expect_css, bool expect_script) { // Load a page affected by the content script and test to see the effect. - FilePath test_file; + base::FilePath test_file; PathService::Get(chrome::DIR_TEST_DATA, &test_file); test_file = test_file.AppendASCII("extensions") .AppendASCII("test_file.html"); @@ -142,12 +142,12 @@ class ExtensionStartupTestBase : public InProcessBrowserTest { EXPECT_EQ(expect_script, result); } - FilePath preferences_file_; - FilePath extensions_dir_; - FilePath user_scripts_dir_; + base::FilePath preferences_file_; + base::FilePath extensions_dir_; + base::FilePath user_scripts_dir_; bool enable_extensions_; // Extensions to load from the command line. - std::vector<FilePath::StringType> load_extensions_; + std::vector<base::FilePath::StringType> load_extensions_; // Disable the sideload wipeout UI. FeatureSwitch::ScopedOverride override_sideload_wipeout_; @@ -216,7 +216,7 @@ class ExtensionsLoadTest : public ExtensionStartupTestBase { public: ExtensionsLoadTest() { enable_extensions_ = true; - FilePath one_extension_path; + base::FilePath one_extension_path; PathService::Get(chrome::DIR_TEST_DATA, &one_extension_path); one_extension_path = one_extension_path .AppendASCII("extensions") @@ -243,7 +243,7 @@ class ExtensionsLoadMultipleTest : public ExtensionStartupTestBase { public: ExtensionsLoadMultipleTest() { enable_extensions_ = true; - FilePath one_extension_path; + base::FilePath one_extension_path; PathService::Get(chrome::DIR_TEST_DATA, &one_extension_path); one_extension_path = one_extension_path .AppendASCII("extensions") @@ -253,21 +253,21 @@ class ExtensionsLoadMultipleTest : public ExtensionStartupTestBase { .AppendASCII("1.0.0.0"); load_extensions_.push_back(one_extension_path.value()); - FilePath second_extension_path; + base::FilePath second_extension_path; PathService::Get(chrome::DIR_TEST_DATA, &second_extension_path); second_extension_path = second_extension_path .AppendASCII("extensions") .AppendASCII("app"); load_extensions_.push_back(second_extension_path.value()); - FilePath third_extension_path; + base::FilePath third_extension_path; PathService::Get(chrome::DIR_TEST_DATA, &third_extension_path); third_extension_path = third_extension_path .AppendASCII("extensions") .AppendASCII("app1"); load_extensions_.push_back(third_extension_path.value()); - FilePath fourth_extension_path; + base::FilePath fourth_extension_path; PathService::Get(chrome::DIR_TEST_DATA, &fourth_extension_path); fourth_extension_path = fourth_extension_path .AppendASCII("extensions") diff --git a/chrome/browser/extensions/extension_sync_data_unittest.cc b/chrome/browser/extensions/extension_sync_data_unittest.cc index df8d11a..80147a8 100644 --- a/chrome/browser/extensions/extension_sync_data_unittest.cc +++ b/chrome/browser/extensions/extension_sync_data_unittest.cc @@ -15,9 +15,10 @@ namespace { #if defined(OS_WIN) -const FilePath::CharType kExtensionFilePath[] = FILE_PATH_LITERAL("c:\\foo"); +const base::FilePath::CharType kExtensionFilePath[] = + FILE_PATH_LITERAL("c:\\foo"); #elif defined(OS_POSIX) -const FilePath::CharType kExtensionFilePath[] = FILE_PATH_LITERAL("/foo"); +const base::FilePath::CharType kExtensionFilePath[] = FILE_PATH_LITERAL("/foo"); #endif const char kValidId[] = "abcdefghijklmnopabcdefghijklmnop"; diff --git a/chrome/browser/extensions/extension_system.cc b/chrome/browser/extensions/extension_system.cc index d09a0c3..daffa3d 100644 --- a/chrome/browser/extensions/extension_system.cc +++ b/chrome/browser/extensions/extension_system.cc @@ -177,7 +177,7 @@ void ExtensionSystemImpl::Shared::Init(bool extensions_enabled) { // this flag designated for developers. base::ThreadRestrictions::ScopedAllowIO allow_io; extension_service_->component_loader()->AddOrReplace( - FilePath(t.token())); + base::FilePath(t.token())); } } extension_service_->Init(); @@ -194,7 +194,7 @@ void ExtensionSystemImpl::Shared::Init(bool extensions_enabled) { FILE_PATH_LITERAL(",")); while (t.GetNext()) { UnpackedInstaller::Create(extension_service_.get())-> - LoadFromCommandLine(FilePath(t.token())); + LoadFromCommandLine(base::FilePath(t.token())); } } } diff --git a/chrome/browser/extensions/extension_toolbar_model_browsertest.cc b/chrome/browser/extensions/extension_toolbar_model_browsertest.cc index 934121c..238c60e 100644 --- a/chrome/browser/extensions/extension_toolbar_model_browsertest.cc +++ b/chrome/browser/extensions/extension_toolbar_model_browsertest.cc @@ -116,7 +116,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionToolbarModelTest, ReorderAndReinsert) { switches::kEnableExperimentalExtensionApis); // Load an extension with a browser action. - FilePath extension_a_path(test_data_dir_.AppendASCII("api_test") + base::FilePath extension_a_path(test_data_dir_.AppendASCII("api_test") .AppendASCII("browser_action") .AppendASCII("basics")); ASSERT_TRUE(LoadExtension(extension_a_path)); @@ -130,7 +130,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionToolbarModelTest, ReorderAndReinsert) { extensionA->name().c_str()); // Load another extension with a browser action. - FilePath extension_b_path(test_data_dir_.AppendASCII("api_test") + base::FilePath extension_b_path(test_data_dir_.AppendASCII("api_test") .AppendASCII("browser_action") .AppendASCII("popup")); ASSERT_TRUE(LoadExtension(extension_b_path)); @@ -143,7 +143,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionToolbarModelTest, ReorderAndReinsert) { EXPECT_STREQ("Popup tester", extensionB->name().c_str()); // Load yet another extension with a browser action. - FilePath extension_c_path(test_data_dir_.AppendASCII("api_test") + base::FilePath extension_c_path(test_data_dir_.AppendASCII("api_test") .AppendASCII("browser_action") .AppendASCII("remove_popup")); ASSERT_TRUE(LoadExtension(extension_c_path)); diff --git a/chrome/browser/extensions/extension_ui_unittest.cc b/chrome/browser/extensions/extension_ui_unittest.cc index 2d5ef01..60e7eaa 100644 --- a/chrome/browser/extensions/extension_ui_unittest.cc +++ b/chrome/browser/extensions/extension_ui_unittest.cc @@ -35,7 +35,7 @@ class ExtensionUITest : public testing::Test { static_cast<extensions::TestExtensionSystem*>( extensions::ExtensionSystem::Get(profile_.get())); extension_service_ = system->CreateExtensionService( - CommandLine::ForCurrentProcess(), FilePath(), false); + CommandLine::ForCurrentProcess(), base::FilePath(), false); management_policy_ = system->management_policy(); handler_.reset(new ExtensionSettingsHandler(extension_service_, @@ -49,7 +49,7 @@ class ExtensionUITest : public testing::Test { message_loop_.RunUntilIdle(); } - static DictionaryValue* DeserializeJSONTestData(const FilePath& path, + static DictionaryValue* DeserializeJSONTestData(const base::FilePath& path, std::string *error) { Value* value; @@ -60,12 +60,12 @@ class ExtensionUITest : public testing::Test { } DictionaryValue* CreateExtensionDetailViewFromPath( - const FilePath& extension_path, + const base::FilePath& extension_path, const std::vector<ExtensionPage>& pages, Manifest::Location location) { std::string error; - FilePath manifest_path = extension_path.Append( + base::FilePath manifest_path = extension_path.Append( Extension::kManifestFilename); scoped_ptr<DictionaryValue> extension_data(DeserializeJSONTestData( manifest_path, &error)); @@ -81,9 +81,9 @@ class ExtensionUITest : public testing::Test { } void CompareExpectedAndActualOutput( - const FilePath& extension_path, + const base::FilePath& extension_path, const std::vector<ExtensionPage>& pages, - const FilePath& expected_output_path) { + const base::FilePath& expected_output_path) { std::string error; scoped_ptr<DictionaryValue> expected_output_data(DeserializeJSONTestData( @@ -128,7 +128,7 @@ class ExtensionUITest : public testing::Test { }; TEST_F(ExtensionUITest, GenerateExtensionsJSONData) { - FilePath data_test_dir_path, extension_path, expected_output_path; + base::FilePath data_test_dir_path, extension_path, expected_output_path; EXPECT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &data_test_dir_path)); // Test Extension1 @@ -192,7 +192,7 @@ TEST_F(ExtensionUITest, GenerateExtensionsJSONData) { // Test that using Manifest::LOAD for the extension location triggers the // correct values in the details, including location, order, and allow_reload. TEST_F(ExtensionUITest, LocationLoadPropagation) { - FilePath data_test_dir_path, extension_path; + base::FilePath data_test_dir_path, extension_path; EXPECT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &data_test_dir_path)); extension_path = data_test_dir_path.AppendASCII("extensions") @@ -209,14 +209,14 @@ TEST_F(ExtensionUITest, LocationLoadPropagation) { bool ui_allow_reload = false; bool ui_is_unpacked = false; - FilePath::StringType ui_path; + base::FilePath::StringType ui_path; EXPECT_TRUE(extension_details->GetBoolean("allow_reload", &ui_allow_reload)); EXPECT_TRUE(extension_details->GetBoolean("isUnpacked", &ui_is_unpacked)); EXPECT_TRUE(extension_details->GetString("path", &ui_path)); EXPECT_EQ(true, ui_allow_reload); EXPECT_EQ(true, ui_is_unpacked); - EXPECT_EQ(extension_path, FilePath(ui_path)); + EXPECT_EQ(extension_path, base::FilePath(ui_path)); } // Test that using Manifest::EXTERNAL_PREF for the extension location triggers @@ -224,7 +224,7 @@ TEST_F(ExtensionUITest, LocationLoadPropagation) { // allow_reload. Contrast to Manifest::LOAD, which has somewhat different // values. TEST_F(ExtensionUITest, LocationExternalPrefPropagation) { - FilePath data_test_dir_path, extension_path; + base::FilePath data_test_dir_path, extension_path; EXPECT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &data_test_dir_path)); extension_path = data_test_dir_path.AppendASCII("extensions") @@ -241,7 +241,7 @@ TEST_F(ExtensionUITest, LocationExternalPrefPropagation) { bool ui_allow_reload = true; bool ui_is_unpacked = true; - FilePath::StringType ui_path; + base::FilePath::StringType ui_path; EXPECT_TRUE(extension_details->GetBoolean("allow_reload", &ui_allow_reload)); EXPECT_TRUE(extension_details->GetBoolean("isUnpacked", &ui_is_unpacked)); @@ -253,7 +253,7 @@ TEST_F(ExtensionUITest, LocationExternalPrefPropagation) { // Test that the extension path is correctly propagated into the extension // details. TEST_F(ExtensionUITest, PathPropagation) { - FilePath data_test_dir_path, extension_path; + base::FilePath data_test_dir_path, extension_path; EXPECT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &data_test_dir_path)); extension_path = data_test_dir_path.AppendASCII("extensions") @@ -268,8 +268,8 @@ TEST_F(ExtensionUITest, PathPropagation) { CreateExtensionDetailViewFromPath( extension_path, pages, Manifest::LOAD)); - FilePath::StringType ui_path; + base::FilePath::StringType ui_path; EXPECT_TRUE(extension_details->GetString("path", &ui_path)); - EXPECT_EQ(extension_path, FilePath(ui_path)); + EXPECT_EQ(extension_path, base::FilePath(ui_path)); } diff --git a/chrome/browser/extensions/extension_url_rewrite_browsertest.cc b/chrome/browser/extensions/extension_url_rewrite_browsertest.cc index e30da01..b1bb016 100644 --- a/chrome/browser/extensions/extension_url_rewrite_browsertest.cc +++ b/chrome/browser/extensions/extension_url_rewrite_browsertest.cc @@ -50,7 +50,7 @@ class ExtensionURLRewriteBrowserTest : public ExtensionBrowserTest { return GetNavigationController()->GetActiveEntry(); } - FilePath GetTestExtensionPath(const char* extension_name) const { + base::FilePath GetTestExtensionPath(const char* extension_name) const { return test_data_dir_.AppendASCII("browsertest/url_rewrite/"). AppendASCII(extension_name); } diff --git a/chrome/browser/extensions/external_loader.cc b/chrome/browser/extensions/external_loader.cc index 3bbd660..e64d51a 100644 --- a/chrome/browser/extensions/external_loader.cc +++ b/chrome/browser/extensions/external_loader.cc @@ -23,12 +23,12 @@ void ExternalLoader::Init(ExternalProviderImpl* owner) { owner_ = owner; } -const FilePath ExternalLoader::GetBaseCrxFilePath() { +const base::FilePath ExternalLoader::GetBaseCrxFilePath() { CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); // By default, relative paths are not supported. // Subclasses that wish to support them should override this method. - return FilePath(); + return base::FilePath(); } void ExternalLoader::OwnerShutdown() { diff --git a/chrome/browser/extensions/external_loader.h b/chrome/browser/extensions/external_loader.h index 30034e7..20971f0 100644 --- a/chrome/browser/extensions/external_loader.h +++ b/chrome/browser/extensions/external_loader.h @@ -49,7 +49,7 @@ class ExternalLoader : public base::RefCountedThreadSafe<ExternalLoader> { // return the absolute path from which relative paths should be resolved. // By default, return an empty path, which indicates that relative paths // are not allowed. - virtual const FilePath GetBaseCrxFilePath(); + virtual const base::FilePath GetBaseCrxFilePath(); protected: virtual ~ExternalLoader(); diff --git a/chrome/browser/extensions/external_policy_loader_unittest.cc b/chrome/browser/extensions/external_policy_loader_unittest.cc index edc11ee..95dda02 100644 --- a/chrome/browser/extensions/external_policy_loader_unittest.cc +++ b/chrome/browser/extensions/external_policy_loader_unittest.cc @@ -70,7 +70,7 @@ class MockExternalPolicyProviderVisitor virtual bool OnExternalExtensionFileFound(const std::string& id, const Version* version, - const FilePath& path, + const base::FilePath& path, Manifest::Location unused, int unused2, bool unused3) OVERRIDE { diff --git a/chrome/browser/extensions/external_pref_loader.cc b/chrome/browser/extensions/external_pref_loader.cc index 27a4431..0f025a1 100644 --- a/chrome/browser/extensions/external_pref_loader.cc +++ b/chrome/browser/extensions/external_pref_loader.cc @@ -21,14 +21,14 @@ using content::BrowserThread; namespace { -FilePath::CharType kExternalExtensionJson[] = +base::FilePath::CharType kExternalExtensionJson[] = FILE_PATH_LITERAL("external_extensions.json"); -std::set<FilePath> GetPrefsCandidateFilesFromFolder( - const FilePath& external_extension_search_path) { +std::set<base::FilePath> GetPrefsCandidateFilesFromFolder( + const base::FilePath& external_extension_search_path) { CHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); - std::set<FilePath> external_extension_paths; + std::set<base::FilePath> external_extension_paths; if (!file_util::PathExists(external_extension_search_path)) { // Does not have to exist. @@ -40,12 +40,12 @@ std::set<FilePath> GetPrefsCandidateFilesFromFolder( false, // Recursive. file_util::FileEnumerator::FILES); #if defined(OS_WIN) - FilePath::StringType extension = UTF8ToWide(std::string(".json")); + base::FilePath::StringType extension = UTF8ToWide(std::string(".json")); #elif defined(OS_POSIX) - FilePath::StringType extension(".json"); + base::FilePath::StringType extension(".json"); #endif do { - FilePath file = json_files.Next(); + base::FilePath file = json_files.Next(); if (file.BaseName().value() == kExternalExtensionJson) continue; // Already taken care of elsewhere. if (file.empty()) @@ -67,7 +67,7 @@ std::set<FilePath> GetPrefsCandidateFilesFromFolder( // path or json content). // Caller takes ownership of the returned dictionary. DictionaryValue* ExtractExtensionPrefs(base::ValueSerializer* serializer, - const FilePath& path) { + const base::FilePath& path) { std::string error_msg; Value* extensions = serializer->Deserialize(NULL, &error_msg); if (!extensions) { @@ -94,7 +94,7 @@ ExternalPrefLoader::ExternalPrefLoader(int base_path_id, Options options) CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); } -const FilePath ExternalPrefLoader::GetBaseCrxFilePath() { +const base::FilePath ExternalPrefLoader::GetBaseCrxFilePath() { CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); // |base_path_| was set in LoadOnFileThread(). @@ -155,7 +155,7 @@ void ExternalPrefLoader::ReadExternalExtensionPrefFile(DictionaryValue* prefs) { CHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); CHECK(NULL != prefs); - FilePath json_file = base_path_.Append(kExternalExtensionJson); + base::FilePath json_file = base_path_.Append(kExternalExtensionJson); if (!file_util::PathExists(json_file)) { // This is not an error. The file does not exist by default. @@ -194,7 +194,7 @@ void ExternalPrefLoader::ReadStandaloneExtensionPrefFiles( CHECK(NULL != prefs); // First list the potential .json candidates. - std::set<FilePath> + std::set<base::FilePath> candidates = GetPrefsCandidateFilesFromFolder(base_path_); if (candidates.empty()) { DVLOG(1) << "Extension candidates list empty"; @@ -203,10 +203,10 @@ void ExternalPrefLoader::ReadStandaloneExtensionPrefFiles( // For each file read the json description & build the proper // associated prefs. - for (std::set<FilePath>::const_iterator it = candidates.begin(); + for (std::set<base::FilePath>::const_iterator it = candidates.begin(); it != candidates.end(); ++it) { - FilePath extension_candidate_path = base_path_.Append(*it); + base::FilePath extension_candidate_path = base_path_.Append(*it); std::string id = #if defined(OS_WIN) @@ -229,12 +229,13 @@ void ExternalPrefLoader::ReadStandaloneExtensionPrefFiles( } } -ExternalTestingLoader::ExternalTestingLoader(const std::string& json_data, - const FilePath& fake_base_path) +ExternalTestingLoader::ExternalTestingLoader( + const std::string& json_data, + const base::FilePath& fake_base_path) : fake_base_path_(fake_base_path) { CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); JSONStringValueSerializer serializer(json_data); - FilePath fake_json_path = fake_base_path.AppendASCII("fake.json"); + base::FilePath fake_json_path = fake_base_path.AppendASCII("fake.json"); testing_prefs_.reset(ExtractExtensionPrefs(&serializer, fake_json_path)); } @@ -246,7 +247,7 @@ void ExternalTestingLoader::StartLoading() { ExternalTestingLoader::~ExternalTestingLoader() {} -const FilePath ExternalTestingLoader::GetBaseCrxFilePath() { +const base::FilePath ExternalTestingLoader::GetBaseCrxFilePath() { return fake_base_path_; } diff --git a/chrome/browser/extensions/external_pref_loader.h b/chrome/browser/extensions/external_pref_loader.h index 80797fa..49b0ce9 100644 --- a/chrome/browser/extensions/external_pref_loader.h +++ b/chrome/browser/extensions/external_pref_loader.h @@ -35,7 +35,7 @@ class ExternalPrefLoader : public ExternalLoader { // extension files are resolved relative to this path. ExternalPrefLoader(int base_path_id, Options options); - virtual const FilePath GetBaseCrxFilePath() OVERRIDE; + virtual const base::FilePath GetBaseCrxFilePath() OVERRIDE; protected: virtual void StartLoading() OVERRIDE; @@ -74,7 +74,7 @@ class ExternalPrefLoader : public ExternalLoader { // The path (coresponding to |base_path_id_| containing the json files // describing which extensions to load. - FilePath base_path_; + base::FilePath base_path_; DISALLOW_COPY_AND_ASSIGN(ExternalPrefLoader); }; @@ -84,9 +84,9 @@ class ExternalPrefLoader : public ExternalLoader { class ExternalTestingLoader : public ExternalLoader { public: ExternalTestingLoader(const std::string& json_data, - const FilePath& fake_base_path); + const base::FilePath& fake_base_path); - virtual const FilePath GetBaseCrxFilePath() OVERRIDE; + virtual const base::FilePath GetBaseCrxFilePath() OVERRIDE; protected: virtual void StartLoading() OVERRIDE; @@ -96,7 +96,7 @@ class ExternalTestingLoader : public ExternalLoader { virtual ~ExternalTestingLoader(); - FilePath fake_base_path_; + base::FilePath fake_base_path_; scoped_ptr<DictionaryValue> testing_prefs_; DISALLOW_COPY_AND_ASSIGN(ExternalTestingLoader); diff --git a/chrome/browser/extensions/external_provider_impl.cc b/chrome/browser/extensions/external_provider_impl.cc index 641996e..cef7903 100644 --- a/chrome/browser/extensions/external_provider_impl.cc +++ b/chrome/browser/extensions/external_provider_impl.cc @@ -112,7 +112,7 @@ void ExternalProviderImpl::SetPrefs(DictionaryValue* prefs) { continue; } - FilePath::StringType external_crx; + base::FilePath::StringType external_crx; Value* external_version_value; std::string external_version; std::string external_update_url; @@ -202,7 +202,7 @@ void ExternalProviderImpl::SetPrefs(DictionaryValue* prefs) { << "extensions from crx files."; continue; } - if (external_crx.find(FilePath::kParentDirectory) != + if (external_crx.find(base::FilePath::kParentDirectory) != base::StringPiece::npos) { LOG(WARNING) << "Path traversal not allowed in path: " << external_crx.c_str(); @@ -211,9 +211,9 @@ void ExternalProviderImpl::SetPrefs(DictionaryValue* prefs) { // If the path is relative, and the provider has a base path, // build the absolute path to the crx file. - FilePath path(external_crx); + base::FilePath path(external_crx); if (!path.IsAbsolute()) { - FilePath base_path = loader_->GetBaseCrxFilePath(); + base::FilePath base_path = loader_->GetBaseCrxFilePath(); if (base_path.empty()) { LOG(WARNING) << "File path " << external_crx.c_str() << " is relative. An absolute path is required."; diff --git a/chrome/browser/extensions/external_registry_loader_win.cc b/chrome/browser/extensions/external_registry_loader_win.cc index a6ccb89..988135b 100644 --- a/chrome/browser/extensions/external_registry_loader_win.cc +++ b/chrome/browser/extensions/external_registry_loader_win.cc @@ -32,7 +32,7 @@ const wchar_t kRegistryExtensionPath[] = L"path"; // Registry value of that key that defines the current version of the .crx file. const wchar_t kRegistryExtensionVersion[] = L"version"; -bool CanOpenFileForReading(const FilePath& path) { +bool CanOpenFileForReading(const base::FilePath& path) { ScopedStdioHandle file_handle(file_util::OpenFile(path, "rb")); return file_handle.get() != NULL; } @@ -92,7 +92,7 @@ void ExternalRegistryLoader::LoadOnFileThread() { continue; } - FilePath extension_path(extension_path_str); + base::FilePath extension_path(extension_path_str); if (!extension_path.IsAbsolute()) { LOG(ERROR) << "File path " << extension_path_str << " needs to be absolute in key " diff --git a/chrome/browser/extensions/file_reader_unittest.cc b/chrome/browser/extensions/file_reader_unittest.cc index ce0de64..3b89e1f 100644 --- a/chrome/browser/extensions/file_reader_unittest.cc +++ b/chrome/browser/extensions/file_reader_unittest.cc @@ -54,11 +54,11 @@ class Receiver { }; void RunBasicTest(const char* filename) { - FilePath path; + base::FilePath path; PathService::Get(chrome::DIR_TEST_DATA, &path); std::string extension_id = extension_test_util::MakeId("test"); ExtensionResource resource(extension_id, path, - FilePath().AppendASCII(filename)); + base::FilePath().AppendASCII(filename)); path = path.AppendASCII(filename); std::string file_contents; @@ -85,10 +85,10 @@ TEST_F(FileReaderTest, BiggerFile) { } TEST_F(FileReaderTest, NonExistantFile) { - FilePath path; + base::FilePath path; PathService::Get(chrome::DIR_TEST_DATA, &path); std::string extension_id = extension_test_util::MakeId("test"); - ExtensionResource resource(extension_id, path, FilePath( + ExtensionResource resource(extension_id, path, base::FilePath( FILE_PATH_LITERAL("file_that_does_not_exist"))); path = path.AppendASCII("file_that_does_not_exist"); diff --git a/chrome/browser/extensions/image_loader.cc b/chrome/browser/extensions/image_loader.cc index c488b57..cc3d435 100644 --- a/chrome/browser/extensions/image_loader.cc +++ b/chrome/browser/extensions/image_loader.cc @@ -74,7 +74,7 @@ void LoadImageOnBlockingPool(const ImageLoader::ImageRepresentation& image_info, // Read the file from disk. std::string file_contents; - FilePath path = image_info.resource.GetFilePath(); + base::FilePath path = image_info.resource.GetFilePath(); if (path.empty() || !file_util::ReadFileToString(path, &file_contents)) { return; } @@ -156,8 +156,8 @@ ImageLoader* ImageLoader::Get(Profile* profile) { // static bool ImageLoader::IsComponentExtensionResource( - const FilePath& extension_path, - const FilePath& resource_path, + const base::FilePath& extension_path, + const base::FilePath& resource_path, int* resource_id) { static const GritResourceMap kExtraComponentExtensionResources[] = { {"web_store/webstore_icon_128.png", IDR_WEBSTORE_ICON}, @@ -174,9 +174,9 @@ bool ImageLoader::IsComponentExtensionResource( static const size_t kExtraComponentExtensionResourcesSize = arraysize(kExtraComponentExtensionResources); - FilePath directory_path = extension_path; - FilePath resources_dir; - FilePath relative_path; + base::FilePath directory_path = extension_path; + base::FilePath resources_dir; + base::FilePath relative_path; if (!PathService::Get(chrome::DIR_RESOURCES, &resources_dir) || !resources_dir.AppendRelativePath(directory_path, &relative_path)) { return false; @@ -184,12 +184,12 @@ bool ImageLoader::IsComponentExtensionResource( relative_path = relative_path.Append(resource_path); relative_path = relative_path.NormalizePathSeparators(); - // TODO(tc): Make a map of FilePath -> resource ids so we don't have to + // TODO(tc): Make a map of base::FilePath -> resource ids so we don't have to // covert to FilePaths all the time. This will be more useful as we add // more resources. for (size_t i = 0; i < kComponentExtensionResourcesSize; ++i) { - FilePath resource_path = - FilePath().AppendASCII(kComponentExtensionResources[i].name); + base::FilePath resource_path = + base::FilePath().AppendASCII(kComponentExtensionResources[i].name); resource_path = resource_path.NormalizePathSeparators(); if (relative_path == resource_path) { @@ -198,8 +198,8 @@ bool ImageLoader::IsComponentExtensionResource( } } for (size_t i = 0; i < kExtraComponentExtensionResourcesSize; ++i) { - FilePath resource_path = - FilePath().AppendASCII(kExtraComponentExtensionResources[i].name); + base::FilePath resource_path = + base::FilePath().AppendASCII(kExtraComponentExtensionResources[i].name); resource_path = resource_path.NormalizePathSeparators(); if (relative_path == resource_path) { diff --git a/chrome/browser/extensions/image_loader.h b/chrome/browser/extensions/image_loader.h index cd73fb5..4f62498 100644 --- a/chrome/browser/extensions/image_loader.h +++ b/chrome/browser/extensions/image_loader.h @@ -77,8 +77,8 @@ class ImageLoader : public ProfileKeyedService { // resources. Otherwise fills |resource_id|. This doesn't check if the // extension the resource is in is actually a component extension. static bool IsComponentExtensionResource( - const FilePath& extension_path, - const FilePath& resource_path, + const base::FilePath& extension_path, + const base::FilePath& resource_path, int* resource_id); // Specify image resource to load. If the loaded image is larger than diff --git a/chrome/browser/extensions/image_loader_unittest.cc b/chrome/browser/extensions/image_loader_unittest.cc index 893148c..353ec6d 100644 --- a/chrome/browser/extensions/image_loader_unittest.cc +++ b/chrome/browser/extensions/image_loader_unittest.cc @@ -60,7 +60,7 @@ class ImageLoaderTest : public testing::Test { scoped_refptr<Extension> CreateExtension(const char* name, Manifest::Location location) { // Create and load an extension. - FilePath test_file; + base::FilePath test_file; if (!PathService::Get(chrome::DIR_TEST_DATA, &test_file)) { EXPECT_FALSE(true); return NULL; diff --git a/chrome/browser/extensions/image_loading_tracker.cc b/chrome/browser/extensions/image_loading_tracker.cc index 7f64e62..288b920 100644 --- a/chrome/browser/extensions/image_loading_tracker.cc +++ b/chrome/browser/extensions/image_loading_tracker.cc @@ -116,7 +116,7 @@ class ImageLoadingTracker::ImageLoader // Read the file from disk. std::string file_contents; - FilePath path = image_info.resource.GetFilePath(); + base::FilePath path = image_info.resource.GetFilePath(); if (path.empty() || !file_util::ReadFileToString(path, &file_contents)) { ReportBack(NULL, image_info, gfx::Size(), id); return; diff --git a/chrome/browser/extensions/image_loading_tracker_unittest.cc b/chrome/browser/extensions/image_loading_tracker_unittest.cc index bb046d6..f722304 100644 --- a/chrome/browser/extensions/image_loading_tracker_unittest.cc +++ b/chrome/browser/extensions/image_loading_tracker_unittest.cc @@ -62,7 +62,7 @@ class ImageLoadingTrackerTest : public testing::Test, scoped_refptr<Extension> CreateExtension(const char* name, Manifest::Location location) { // Create and load an extension. - FilePath test_file; + base::FilePath test_file; if (!PathService::Get(chrome::DIR_TEST_DATA, &test_file)) { EXPECT_FALSE(true); return NULL; diff --git a/chrome/browser/extensions/lazy_background_page_apitest.cc b/chrome/browser/extensions/lazy_background_page_apitest.cc index eeba1dd..bd4ea98 100644 --- a/chrome/browser/extensions/lazy_background_page_apitest.cc +++ b/chrome/browser/extensions/lazy_background_page_apitest.cc @@ -87,7 +87,7 @@ class LazyBackgroundPageApiTest : public ExtensionApiTest { // to dispatch the onInstalled event. We wait until it shuts down again. const Extension* LoadExtensionAndWait(const std::string& test_name) { LazyBackgroundObserver page_complete; - FilePath extdir = test_data_dir_.AppendASCII("lazy_background_page"). + base::FilePath extdir = test_data_dir_.AppendASCII("lazy_background_page"). AppendASCII(test_name); const Extension* extension = LoadExtension(extdir); if (extension) @@ -205,7 +205,7 @@ IN_PROC_BROWSER_TEST_F(LazyBackgroundPageApiTest, OnInstalled) { IN_PROC_BROWSER_TEST_F(LazyBackgroundPageApiTest, WaitForView) { LazyBackgroundObserver page_complete; ResultCatcher catcher; - FilePath extdir = test_data_dir_.AppendASCII("lazy_background_page"). + base::FilePath extdir = test_data_dir_.AppendASCII("lazy_background_page"). AppendASCII("wait_for_view"); const Extension* extension = LoadExtension(extdir); ASSERT_TRUE(extension); @@ -239,7 +239,7 @@ IN_PROC_BROWSER_TEST_F(LazyBackgroundPageApiTest, WaitForRequest) { LazyBackgroundObserver page_complete; ResultCatcher catcher; - FilePath extdir = test_data_dir_.AppendASCII("lazy_background_page"). + base::FilePath extdir = test_data_dir_.AppendASCII("lazy_background_page"). AppendASCII("wait_for_request"); const Extension* extension = LoadExtension(extdir); ASSERT_TRUE(extension); @@ -268,7 +268,7 @@ IN_PROC_BROWSER_TEST_F(LazyBackgroundPageApiTest, WaitForRequest) { IN_PROC_BROWSER_TEST_F(LazyBackgroundPageApiTest, WaitForNTP) { LazyBackgroundObserver lazybg; ResultCatcher catcher; - FilePath extdir = test_data_dir_.AppendASCII("lazy_background_page"). + base::FilePath extdir = test_data_dir_.AppendASCII("lazy_background_page"). AppendASCII("wait_for_ntp"); const Extension* extension = LoadExtension(extdir); ASSERT_TRUE(extension); @@ -303,7 +303,7 @@ IN_PROC_BROWSER_TEST_F(LazyBackgroundPageApiTest, IncognitoSplitMode) { // Load the extension with incognito enabled. { LoadedIncognitoObserver loaded(browser()->profile()); - FilePath extdir = test_data_dir_.AppendASCII("lazy_background_page"). + base::FilePath extdir = test_data_dir_.AppendASCII("lazy_background_page"). AppendASCII("incognito_split"); ASSERT_TRUE(LoadExtensionIncognito(extdir)); loaded.Wait(); diff --git a/chrome/browser/extensions/pack_extension_job.cc b/chrome/browser/extensions/pack_extension_job.cc index 690ccc3..fc85098 100644 --- a/chrome/browser/extensions/pack_extension_job.cc +++ b/chrome/browser/extensions/pack_extension_job.cc @@ -18,8 +18,8 @@ using content::BrowserThread; namespace extensions { PackExtensionJob::PackExtensionJob(Client* client, - const FilePath& root_directory, - const FilePath& key_file, + const base::FilePath& root_directory, + const base::FilePath& key_file, int run_flags) : client_(client), key_file_(key_file), asynchronous_(true), run_flags_(run_flags | ExtensionCreator::kRequireModernManifestVersion) { @@ -44,11 +44,11 @@ void PackExtensionJob::ClearClient() { PackExtensionJob::~PackExtensionJob() {} void PackExtensionJob::Run() { - crx_file_out_ = FilePath(root_directory_.value() + + crx_file_out_ = base::FilePath(root_directory_.value() + chrome::kExtensionFileExtension); if (key_file_.empty()) - key_file_out_ = FilePath(root_directory_.value() + + key_file_out_ = base::FilePath(root_directory_.value() + chrome::kExtensionKeyFileExtension); // TODO(aa): Need to internationalize the errors that ExtensionCreator @@ -90,8 +90,9 @@ void PackExtensionJob::ReportFailureOnClientThread( } // static -string16 PackExtensionJob::StandardSuccessMessage(const FilePath& crx_file, - const FilePath& key_file) { +string16 PackExtensionJob::StandardSuccessMessage( + const base::FilePath& crx_file, + const base::FilePath& key_file) { string16 crx_file_string = crx_file.LossyDisplayName(); string16 key_file_string = key_file.LossyDisplayName(); if (key_file_string.empty()) { diff --git a/chrome/browser/extensions/pack_extension_job.h b/chrome/browser/extensions/pack_extension_job.h index f6d0dbb..348274d 100644 --- a/chrome/browser/extensions/pack_extension_job.h +++ b/chrome/browser/extensions/pack_extension_job.h @@ -22,8 +22,8 @@ class PackExtensionJob : public base::RefCountedThreadSafe<PackExtensionJob> { // Interface for people who want to use PackExtensionJob to implement. class Client { public: - virtual void OnPackSuccess(const FilePath& crx_file, - const FilePath& key_file) = 0; + virtual void OnPackSuccess(const base::FilePath& crx_file, + const base::FilePath& key_file) = 0; virtual void OnPackFailure(const std::string& message, ExtensionCreator::ErrorType error_type) = 0; @@ -32,8 +32,8 @@ class PackExtensionJob : public base::RefCountedThreadSafe<PackExtensionJob> { }; PackExtensionJob(Client* client, - const FilePath& root_directory, - const FilePath& key_file, + const base::FilePath& root_directory, + const base::FilePath& key_file, int run_flags); // Starts the packing job. @@ -44,8 +44,8 @@ class PackExtensionJob : public base::RefCountedThreadSafe<PackExtensionJob> { void ClearClient(); // The standard packing success message. - static string16 StandardSuccessMessage(const FilePath& crx_file, - const FilePath& key_file); + static string16 StandardSuccessMessage(const base::FilePath& crx_file, + const base::FilePath& key_file); void set_asynchronous(bool async) { asynchronous_ = async; } @@ -62,10 +62,10 @@ class PackExtensionJob : public base::RefCountedThreadSafe<PackExtensionJob> { content::BrowserThread::ID client_thread_id_; Client* client_; - FilePath root_directory_; - FilePath key_file_; - FilePath crx_file_out_; - FilePath key_file_out_; + base::FilePath root_directory_; + base::FilePath key_file_; + base::FilePath crx_file_out_; + base::FilePath key_file_out_; bool asynchronous_; int run_flags_; // Bitset of ExtensionCreator::RunFlags values - we always // assume kRequireModernManifestVersion, though. diff --git a/chrome/browser/extensions/page_action_browsertest.cc b/chrome/browser/extensions/page_action_browsertest.cc index f417d25..75a4525 100644 --- a/chrome/browser/extensions/page_action_browsertest.cc +++ b/chrome/browser/extensions/page_action_browsertest.cc @@ -74,7 +74,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, PageAction) { IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, PageActionInPageNavigation) { ASSERT_TRUE(test_server()->Start()); - FilePath extension_path(test_data_dir_.AppendASCII("api_test") + base::FilePath extension_path(test_data_dir_.AppendASCII("api_test") .AppendASCII("page_action") .AppendASCII("hash_change")); ASSERT_TRUE(LoadExtension(extension_path)); @@ -99,7 +99,8 @@ IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, PageActionInPageNavigation) { IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, UnloadPageAction) { ASSERT_TRUE(test_server()->Start()); - FilePath extension_path(test_data_dir_.AppendASCII("subscribe_page_action")); + base::FilePath extension_path( + test_data_dir_.AppendASCII("subscribe_page_action")); ASSERT_TRUE(LoadExtension(extension_path)); // Navigation prompts the location bar to load page actions. @@ -122,7 +123,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, PageActionRefreshCrash) { size_t size_before = service->extensions()->size(); - FilePath base_path = test_data_dir_.AppendASCII("browsertest") + base::FilePath base_path = test_data_dir_.AppendASCII("browsertest") .AppendASCII("crash_44415"); // Load extension A. const Extension* extensionA = LoadExtension(base_path.AppendASCII("ExtA")); @@ -177,7 +178,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, TitleLocalizationPageAction) { browser()->profile())->extension_service(); const size_t size_before = service->extensions()->size(); - FilePath extension_path(test_data_dir_.AppendASCII("browsertest") + base::FilePath extension_path(test_data_dir_.AppendASCII("browsertest") .AppendASCII("title_localized_pa")); const Extension* extension = LoadExtension(extension_path); ASSERT_TRUE(extension); diff --git a/chrome/browser/extensions/page_action_controller_unittest.cc b/chrome/browser/extensions/page_action_controller_unittest.cc index 832d659..60a267b 100644 --- a/chrome/browser/extensions/page_action_controller_unittest.cc +++ b/chrome/browser/extensions/page_action_controller_unittest.cc @@ -43,7 +43,7 @@ class PageActionControllerTest : public ChromeRenderViewHostTestHarness { Profile::FromBrowserContext(web_contents()->GetBrowserContext()); extension_service_ = static_cast<TestExtensionSystem*>( ExtensionSystem::Get(profile))->CreateExtensionService( - &command_line, FilePath(), false); + &command_line, base::FilePath(), false); } protected: diff --git a/chrome/browser/extensions/permissions_updater_unittest.cc b/chrome/browser/extensions/permissions_updater_unittest.cc index 715c7fd..4908146 100644 --- a/chrome/browser/extensions/permissions_updater_unittest.cc +++ b/chrome/browser/extensions/permissions_updater_unittest.cc @@ -88,7 +88,7 @@ class PermissionsUpdaterTest : public ExtensionServiceTestBase { }; scoped_refptr<Extension> LoadManifest(std::string* error) { - FilePath path; + base::FilePath path; PathService::Get(chrome::DIR_TEST_DATA, &path); path = path.AppendASCII("extensions") .AppendASCII("api_test") diff --git a/chrome/browser/extensions/platform_app_browsertest.cc b/chrome/browser/extensions/platform_app_browsertest.cc index ab18387..8045b41 100644 --- a/chrome/browser/extensions/platform_app_browsertest.cc +++ b/chrome/browser/extensions/platform_app_browsertest.cc @@ -167,7 +167,8 @@ IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, OnLaunchedEvent) { // Intent. This test does not test the mechanics of invoking a Web Intent // from a source page, and short-circuits to LaunchPlatformAppWithWebIntent. IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, LaunchReply) { - FilePath path = test_data_dir_.AppendASCII("platform_apps/launch_reply"); + base::FilePath path = + test_data_dir_.AppendASCII("platform_apps/launch_reply"); const extensions::Extension* extension = LoadExtension(path); ASSERT_TRUE(extension) << "Failed to load extension."; @@ -495,7 +496,8 @@ IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, LaunchWithRelativeFile) { // Setup the command line ClearCommandLineArgs(); CommandLine* command_line = CommandLine::ForCurrentProcess(); - FilePath relative_test_doc = FilePath::FromUTF8Unsafe(kTestFilePath); + base::FilePath relative_test_doc = + base::FilePath::FromUTF8Unsafe(kTestFilePath); relative_test_doc = relative_test_doc.NormalizePathSeparators(); command_line->AppendArgPath(relative_test_doc); diff --git a/chrome/browser/extensions/platform_app_browsertest_util.cc b/chrome/browser/extensions/platform_app_browsertest_util.cc index 0476a52..ae11710 100644 --- a/chrome/browser/extensions/platform_app_browsertest_util.cc +++ b/chrome/browser/extensions/platform_app_browsertest_util.cc @@ -133,7 +133,7 @@ void PlatformAppBrowserTest::ClearCommandLineArgs() { void PlatformAppBrowserTest::SetCommandLineArg(const std::string& test_file) { ClearCommandLineArgs(); CommandLine* command_line = CommandLine::ForCurrentProcess(); - FilePath test_doc(test_data_dir_.AppendASCII(test_file)); + base::FilePath test_doc(test_data_dir_.AppendASCII(test_file)); test_doc = test_doc.NormalizePathSeparators(); command_line->AppendArgPath(test_doc); } diff --git a/chrome/browser/extensions/platform_app_launcher.cc b/chrome/browser/extensions/platform_app_launcher.cc index c82094e2..3c9d93d 100644 --- a/chrome/browser/extensions/platform_app_launcher.cc +++ b/chrome/browser/extensions/platform_app_launcher.cc @@ -43,8 +43,8 @@ namespace extensions { namespace { -bool MakePathAbsolute(const FilePath& current_directory, - FilePath* file_path) { +bool MakePathAbsolute(const base::FilePath& current_directory, + base::FilePath* file_path) { DCHECK(file_path); if (file_path->IsAbsolute()) return true; @@ -60,13 +60,13 @@ bool MakePathAbsolute(const FilePath& current_directory, } bool GetAbsolutePathFromCommandLine(const CommandLine* command_line, - const FilePath& current_directory, - FilePath* path) { + const base::FilePath& current_directory, + base::FilePath* path) { if (!command_line || !command_line->GetArgs().size()) return false; - FilePath relative_path(command_line->GetArgs()[0]); - FilePath absolute_path(relative_path); + base::FilePath relative_path(command_line->GetArgs()[0]); + base::FilePath absolute_path(relative_path); if (!MakePathAbsolute(current_directory, &absolute_path)) { LOG(WARNING) << "Cannot make absolute path from " << relative_path.value(); return false; @@ -93,7 +93,7 @@ class PlatformAppPathLauncher public: PlatformAppPathLauncher(Profile* profile, const Extension* extension, - const FilePath& file_path) + const base::FilePath& file_path) : profile_(profile), extension_(extension), file_path_(file_path), @@ -258,7 +258,7 @@ class PlatformAppPathLauncher // The extension providing the app. const Extension* extension_; // The path to be passed through to the app. - const FilePath file_path_; + const base::FilePath file_path_; // The ID of the file handler used to launch the app. std::string handler_id_; @@ -340,7 +340,7 @@ class PlatformAppWebIntentLauncher } else if (data_.data_type == webkit_glue::WebIntentData::FILESYSTEM) { // Grant read filesystem and read directory permission to allow reading // any part of the specified filesystem. - FilePath path; + base::FilePath path; const bool valid = fileapi::IsolatedContext::GetInstance()->GetRegisteredPath( data_.filesystem_id, &path); @@ -379,8 +379,8 @@ class PlatformAppWebIntentLauncher void LaunchPlatformApp(Profile* profile, const Extension* extension, const CommandLine* command_line, - const FilePath& current_directory) { - FilePath path; + const base::FilePath& current_directory) { + base::FilePath path; if (!GetAbsolutePathFromCommandLine(command_line, current_directory, &path)) { LaunchPlatformAppWithNoData(profile, extension); return; @@ -392,7 +392,7 @@ void LaunchPlatformApp(Profile* profile, void LaunchPlatformAppWithPath(Profile* profile, const Extension* extension, - const FilePath& file_path) { + const base::FilePath& file_path) { // launcher will be freed when nothing has a reference to it. The message // queue will retain a reference for any outstanding task, so when the // launcher has finished it will be freed. @@ -404,7 +404,7 @@ void LaunchPlatformAppWithPath(Profile* profile, void LaunchPlatformAppWithFileHandler(Profile* profile, const Extension* extension, const std::string& handler_id, - const FilePath& file_path) { + const base::FilePath& file_path) { scoped_refptr<PlatformAppPathLauncher> launcher = new PlatformAppPathLauncher(profile, extension, file_path); launcher->LaunchWithHandler(handler_id); diff --git a/chrome/browser/extensions/plugin_apitest.cc b/chrome/browser/extensions/plugin_apitest.cc index a125de3..7509eb0 100644 --- a/chrome/browser/extensions/plugin_apitest.cc +++ b/chrome/browser/extensions/plugin_apitest.cc @@ -38,7 +38,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, MAYBE_PluginLoadUnload) { browser()->profile()->GetPrefs()->SetBoolean(prefs::kPluginsAlwaysAuthorize, true); - FilePath extension_dir = + base::FilePath extension_dir = test_data_dir_.AppendASCII("uitest").AppendASCII("plugins"); ui_test_utils::NavigateToURL(browser(), @@ -109,7 +109,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, PluginPrivate) { browser()->profile()->GetPrefs()->SetBoolean(prefs::kPluginsAlwaysAuthorize, true); - FilePath extension_dir = + base::FilePath extension_dir = test_data_dir_.AppendASCII("uitest").AppendASCII("plugins_private"); ExtensionService* service = extensions::ExtensionSystem::Get( diff --git a/chrome/browser/extensions/requirements_checker_browsertest.cc b/chrome/browser/extensions/requirements_checker_browsertest.cc index d840f83..2f54dfa 100644 --- a/chrome/browser/extensions/requirements_checker_browsertest.cc +++ b/chrome/browser/extensions/requirements_checker_browsertest.cc @@ -41,7 +41,7 @@ class RequirementsCheckerBrowserTest : public ExtensionBrowserTest { scoped_refptr<const Extension> LoadExtensionFromDirName( const std::string& extension_dir_name) { - FilePath extension_path; + base::FilePath extension_path; std::string load_error; PathService::Get(chrome::DIR_TEST_DATA, &extension_path); extension_path = extension_path.AppendASCII("requirements_checker") diff --git a/chrome/browser/extensions/sandboxed_unpacker.cc b/chrome/browser/extensions/sandboxed_unpacker.cc index 8c6f209..d772d2a 100644 --- a/chrome/browser/extensions/sandboxed_unpacker.cc +++ b/chrome/browser/extensions/sandboxed_unpacker.cc @@ -57,7 +57,7 @@ using content::UtilityProcessHost; namespace { void RecordSuccessfulUnpackTimeHistograms( - const FilePath& crx_path, const base::TimeDelta unpack_time) { + const base::FilePath& crx_path, const base::TimeDelta unpack_time) { const int64 kBytesPerKb = 1024; const int64 kBytesPerMb = 1024 * 1024; @@ -114,11 +114,11 @@ void RecordSuccessfulUnpackTimeHistograms( // Work horse for FindWritableTempLocation. Creates a temp file in the folder // and uses NormalizeFilePath to check if the path is junction free. -bool VerifyJunctionFreeLocation(FilePath* temp_dir) { +bool VerifyJunctionFreeLocation(base::FilePath* temp_dir) { if (temp_dir->empty()) return false; - FilePath temp_file; + base::FilePath temp_file; if (!file_util::CreateTemporaryFileInDir(*temp_dir, &temp_file)) { LOG(ERROR) << temp_dir->value() << " is not writable"; return false; @@ -128,7 +128,7 @@ bool VerifyJunctionFreeLocation(FilePath* temp_dir) { // exit points delete this temp file! file_util::WriteFile(temp_file, ".", 1); - FilePath normalized_temp_file; + base::FilePath normalized_temp_file; bool normalized = file_util::NormalizeFilePath(temp_file, &normalized_temp_file); if (!normalized) { @@ -150,8 +150,8 @@ bool VerifyJunctionFreeLocation(FilePath* temp_dir) { // proceed and should fail. // The result will be written to |temp_dir|. The function will write to this // parameter even if it returns false. -bool FindWritableTempLocation(const FilePath& extensions_dir, - FilePath* temp_dir) { +bool FindWritableTempLocation(const base::FilePath& extensions_dir, + base::FilePath* temp_dir) { // On ChromeOS, we will only attempt to unpack extension in cryptohome (profile) // directory to provide additional security/privacy and speed up the rest of // the extension install process. @@ -175,11 +175,11 @@ bool FindWritableTempLocation(const FilePath& extensions_dir, namespace extensions { SandboxedUnpacker::SandboxedUnpacker( - const FilePath& crx_path, + const base::FilePath& crx_path, bool run_out_of_process, Manifest::Location location, int creation_flags, - const FilePath& extensions_dir, + const base::FilePath& extensions_dir, base::SequencedTaskRunner* unpacker_io_task_runner, SandboxedUnpackerClient* client) : crx_path_(crx_path), @@ -195,7 +195,7 @@ SandboxedUnpacker::SandboxedUnpacker( bool SandboxedUnpacker::CreateTempDirectory() { CHECK(unpacker_io_task_runner_->RunsTasksOnCurrentThread()); - FilePath temp_dir; + base::FilePath temp_dir; if (!FindWritableTempLocation(extensions_dir_, &temp_dir)) { ReportFailure( COULD_NOT_GET_TEMP_DIRECTORY, @@ -240,7 +240,7 @@ void SandboxedUnpacker::Start() { return; // ValidateSignature() already reported the error. // Copy the crx file into our working directory. - FilePath temp_crx_path = temp_dir_.path().Append(crx_path_.BaseName()); + base::FilePath temp_crx_path = temp_dir_.path().Append(crx_path_.BaseName()); PATH_LENGTH_HISTOGRAM("Extensions.SandboxUnpackTempCrxPathLength", temp_crx_path); @@ -266,7 +266,7 @@ void SandboxedUnpacker::Start() { // reparse point. When the path is used, following the link/reparse point // will cause file system access outside the sandbox path, and the sandbox // will deny the operation. - FilePath link_free_crx_path; + base::FilePath link_free_crx_path; if (!file_util::NormalizeFilePath(temp_crx_path, &link_free_crx_path)) { LOG(ERROR) << "Could not get the normalized path of " << temp_crx_path.value(); @@ -324,7 +324,8 @@ void SandboxedUnpacker::OnProcessCrashed(int exit_code) { ASCIIToUTF16("UTILITY_PROCESS_CRASHED_WHILE_TRYING_TO_INSTALL"))); } -void SandboxedUnpacker::StartProcessOnIOThread(const FilePath& temp_crx_path) { +void SandboxedUnpacker::StartProcessOnIOThread( + const base::FilePath& temp_crx_path) { UtilityProcessHost* host = UtilityProcessHost::Create( this, unpacker_io_task_runner_); // Grant the subprocess access to the entire subdir the extension file is @@ -608,7 +609,7 @@ DictionaryValue* SandboxedUnpacker::RewriteManifestFile( return NULL; } - FilePath manifest_path = + base::FilePath manifest_path = extension_root_.Append(Extension::kManifestFilename); if (!file_util::WriteFile(manifest_path, manifest_json.data(), manifest_json.size())) { @@ -639,7 +640,7 @@ bool SandboxedUnpacker::RewriteImageFiles() { // Delete any images that may be used by the browser. We're going to write // out our own versions of the parsed images, and we want to make sure the // originals are gone for good. - std::set<FilePath> image_paths = extension_->GetBrowserImages(); + std::set<base::FilePath> image_paths = extension_->GetBrowserImages(); if (image_paths.size() != images.size()) { // Decoded images don't match what's in the manifest. ReportFailure( @@ -650,9 +651,9 @@ bool SandboxedUnpacker::RewriteImageFiles() { return false; } - for (std::set<FilePath>::iterator it = image_paths.begin(); + for (std::set<base::FilePath>::iterator it = image_paths.begin(); it != image_paths.end(); ++it) { - FilePath path = *it; + base::FilePath path = *it; if (path.IsAbsolute() || path.ReferencesParent()) { // Invalid path for browser image. ReportFailure( @@ -676,7 +677,7 @@ bool SandboxedUnpacker::RewriteImageFiles() { // Write our parsed images back to disk as well. for (size_t i = 0; i < images.size(); ++i) { const SkBitmap& image = images[i].a; - FilePath path_suffix = images[i].b; + base::FilePath path_suffix = images[i].b; if (path_suffix.IsAbsolute() || path_suffix.ReferencesParent()) { // Invalid path for bitmap image. ReportFailure( @@ -686,7 +687,7 @@ bool SandboxedUnpacker::RewriteImageFiles() { ASCIIToUTF16("INVALID_PATH_FOR_BITMAP_IMAGE"))); return false; } - FilePath path = extension_root_.Append(path_suffix); + base::FilePath path = extension_root_.Append(path_suffix); std::vector<unsigned char> image_data; // TODO(mpcomplete): It's lame that we're encoding all images as PNG, even @@ -747,7 +748,8 @@ bool SandboxedUnpacker::RewriteCatalogFiles() { // TODO(viettrungluu): Fix the |FilePath::FromWStringHack(UTF8ToWide())| // hack and remove the corresponding #include. - FilePath relative_path = FilePath::FromWStringHack(UTF8ToWide(*key_it)); + base::FilePath relative_path = + base::FilePath::FromWStringHack(UTF8ToWide(*key_it)); relative_path = relative_path.Append(Extension::kMessagesFilename); if (relative_path.IsAbsolute() || relative_path.ReferencesParent()) { // Invalid path for catalog. @@ -758,7 +760,7 @@ bool SandboxedUnpacker::RewriteCatalogFiles() { ASCIIToUTF16("INVALID_PATH_FOR_CATALOG"))); return false; } - FilePath path = extension_root_.Append(relative_path); + base::FilePath path = extension_root_.Append(relative_path); std::string catalog_json; JSONStringValueSerializer serializer(&catalog_json); diff --git a/chrome/browser/extensions/sandboxed_unpacker.h b/chrome/browser/extensions/sandboxed_unpacker.h index 302997c..2a8f414 100644 --- a/chrome/browser/extensions/sandboxed_unpacker.h +++ b/chrome/browser/extensions/sandboxed_unpacker.h @@ -35,8 +35,8 @@ class SandboxedUnpackerClient // // extension - The extension that was unpacked. The client is responsible // for deleting this memory. - virtual void OnUnpackSuccess(const FilePath& temp_dir, - const FilePath& extension_root, + virtual void OnUnpackSuccess(const base::FilePath& temp_dir, + const base::FilePath& extension_root, const base::DictionaryValue* original_manifest, const Extension* extension) = 0; virtual void OnUnpackFailure(const string16& error) = 0; @@ -73,11 +73,11 @@ class SandboxedUnpacker : public content::UtilityProcessHostClient { // Unpacks the extension in |crx_path| into a temporary directory and calls // |client| with the result. If |run_out_of_process| is provided, unpacking // is done in a sandboxed subprocess. Otherwise, it is done in-process. - SandboxedUnpacker(const FilePath& crx_path, + SandboxedUnpacker(const base::FilePath& crx_path, bool run_out_of_process, Manifest::Location location, int creation_flags, - const FilePath& extensions_dir, + const base::FilePath& extensions_dir, base::SequencedTaskRunner* unpacker_io_task_runner, SandboxedUnpackerClient* client); @@ -166,7 +166,7 @@ class SandboxedUnpacker : public content::UtilityProcessHostClient { bool ValidateSignature(); // Starts the utility process that unpacks our extension. - void StartProcessOnIOThread(const FilePath& temp_crx_path); + void StartProcessOnIOThread(const base::FilePath& temp_crx_path); // UtilityProcessHostClient virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; @@ -193,7 +193,7 @@ class SandboxedUnpacker : public content::UtilityProcessHostClient { void Cleanup(); // The path to the CRX to unpack. - FilePath crx_path_; + base::FilePath crx_path_; // True if unpacking should be done by the utility process. bool run_out_of_process_; @@ -202,13 +202,13 @@ class SandboxedUnpacker : public content::UtilityProcessHostClient { scoped_refptr<SandboxedUnpackerClient> client_; // The Extensions directory inside the profile. - FilePath extensions_dir_; + base::FilePath extensions_dir_; // A temporary directory to use for unpacking. base::ScopedTempDir temp_dir_; // The root directory of the unpacked extension. This is a child of temp_dir_. - FilePath extension_root_; + base::FilePath extension_root_; // Represents the extension we're unpacking. scoped_refptr<Extension> extension_; diff --git a/chrome/browser/extensions/sandboxed_unpacker_unittest.cc b/chrome/browser/extensions/sandboxed_unpacker_unittest.cc index 7583fc6..1f5cb1b 100644 --- a/chrome/browser/extensions/sandboxed_unpacker_unittest.cc +++ b/chrome/browser/extensions/sandboxed_unpacker_unittest.cc @@ -26,8 +26,8 @@ using testing::Invoke; namespace { -void OnUnpackSuccess(const FilePath& temp_dir, - const FilePath& extension_root, +void OnUnpackSuccess(const base::FilePath& temp_dir, + const base::FilePath& extension_root, const DictionaryValue* original_manifest, const extensions::Extension* extension) { // Don't delete temp_dir here, we need to do some post op checking. @@ -40,8 +40,8 @@ namespace extensions { class MockSandboxedUnpackerClient : public SandboxedUnpackerClient { public: MOCK_METHOD4(OnUnpackSuccess, - void(const FilePath& temp_dir, - const FilePath& extension_root, + void(const base::FilePath& temp_dir, + const base::FilePath& extension_root, const DictionaryValue* original_manifest, const Extension* extension)); @@ -80,7 +80,7 @@ class SandboxedUnpackerTest : public testing::Test { } void SetupUnpacker(const std::string& crx_name) { - FilePath original_path; + base::FilePath original_path; ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &original_path)); original_path = original_path.AppendASCII("extensions") .AppendASCII("unpacker") @@ -90,7 +90,7 @@ class SandboxedUnpackerTest : public testing::Test { // Try bots won't let us write into DIR_TEST_DATA, so we have to write the // CRX to the temp directory, and create a subdirectory into which to // unpack it. - FilePath crx_path = temp_dir_.path().AppendASCII(crx_name); + base::FilePath crx_path = temp_dir_.path().AppendASCII(crx_name); ASSERT_TRUE(file_util::CopyFile(original_path, crx_path)) << "Original path: " << original_path.value() << ", Crx path: " << crx_path.value(); @@ -129,7 +129,7 @@ class SandboxedUnpackerTest : public testing::Test { *unpacker_->parsed_manifest()); } - FilePath GetInstallPath() { + base::FilePath GetInstallPath() { return temp_dir_.path().AppendASCII( extension_filenames::kTempExtensionName); } @@ -145,7 +145,7 @@ class SandboxedUnpackerTest : public testing::Test { files_and_dirs ); int items_not_removed = 0; - FilePath item_in_temp; + base::FilePath item_in_temp; item_in_temp = temp_iterator.Next(); while (!item_in_temp.value().empty()) { items_not_removed++; @@ -159,7 +159,7 @@ class SandboxedUnpackerTest : public testing::Test { protected: base::ScopedTempDir temp_dir_; base::ScopedTempDir extensions_dir_; - FilePath temp_path_; + base::FilePath temp_path_; MockSandboxedUnpackerClient* client_; scoped_ptr<Unpacker> unpacker_; scoped_refptr<SandboxedUnpacker> sandboxed_unpacker_; @@ -177,7 +177,7 @@ TEST_F(SandboxedUnpackerTest, NoCatalogsSuccess) { ASSERT_TRUE(unpacker_->DumpMessageCatalogsToFile()); // Check that there is no _locales folder. - FilePath install_path = + base::FilePath install_path = GetInstallPath().Append(Extension::kLocaleFolder); EXPECT_FALSE(file_util::PathExists(install_path)); @@ -199,7 +199,7 @@ TEST_F(SandboxedUnpackerTest, WithCatalogsSuccess) { ASSERT_TRUE(unpacker_->DumpMessageCatalogsToFile()); // Set timestamp on _locales/en_US/messages.json into the past. - FilePath messages_file; + base::FilePath messages_file; messages_file = GetInstallPath().Append(Extension::kLocaleFolder) .AppendASCII("en_US") .Append(Extension::kMessagesFilename); diff --git a/chrome/browser/extensions/script_badge_controller_unittest.cc b/chrome/browser/extensions/script_badge_controller_unittest.cc index 9d226ba..d2cf6bc 100644 --- a/chrome/browser/extensions/script_badge_controller_unittest.cc +++ b/chrome/browser/extensions/script_badge_controller_unittest.cc @@ -59,7 +59,7 @@ class ScriptBadgeControllerTest : public ChromeRenderViewHostTestHarness { // extensions. CommandLine command_line(CommandLine::NO_PROGRAM); extension_service_ = extension_system->CreateExtensionService( - &command_line, FilePath(), false); + &command_line, base::FilePath(), false); TabHelper::CreateForWebContents(web_contents()); script_badge_controller_ = static_cast<ScriptBadgeController*>( diff --git a/chrome/browser/extensions/script_bubble_controller_unittest.cc b/chrome/browser/extensions/script_bubble_controller_unittest.cc index bb9bdb3..d2b0ef9 100644 --- a/chrome/browser/extensions/script_bubble_controller_unittest.cc +++ b/chrome/browser/extensions/script_bubble_controller_unittest.cc @@ -45,7 +45,7 @@ class ScriptBubbleControllerTest : public ChromeRenderViewHostTestHarness { Profile::FromBrowserContext(web_contents()->GetBrowserContext()); extension_service_ = static_cast<TestExtensionSystem*>( ExtensionSystem::Get(profile))->CreateExtensionService( - &command_line, FilePath(), false); + &command_line, base::FilePath(), false); extension_service_->Init(); TabHelper::CreateForWebContents(web_contents()); @@ -70,9 +70,9 @@ class ScriptBubbleControllerTest : public ChromeRenderViewHostTestHarness { TEST_F(ScriptBubbleControllerTest, Basics) { #if defined(OS_WIN) - FilePath root(FILE_PATH_LITERAL("c:\\")); + base::FilePath root(FILE_PATH_LITERAL("c:\\")); #else - FilePath root(FILE_PATH_LITERAL("/root")); + base::FilePath root(FILE_PATH_LITERAL("/root")); #endif scoped_refptr<const Extension> extension1 = ExtensionBuilder() diff --git a/chrome/browser/extensions/standard_management_policy_provider_unittest.cc b/chrome/browser/extensions/standard_management_policy_provider_unittest.cc index 3462b54..52a396f 100644 --- a/chrome/browser/extensions/standard_management_policy_provider_unittest.cc +++ b/chrome/browser/extensions/standard_management_policy_provider_unittest.cc @@ -36,7 +36,7 @@ class StandardManagementPolicyProviderTest : public testing::Test { values.SetString(extension_manifest_keys::kVersion, "0.1"); std::string error; scoped_refptr<const Extension> extension = Extension::Create( - FilePath(), location, values, Extension::NO_FLAGS, &error); + base::FilePath(), location, values, Extension::NO_FLAGS, &error); CHECK(extension.get()) << error; return extension; } diff --git a/chrome/browser/extensions/startup_helper.cc b/chrome/browser/extensions/startup_helper.cc index 7f92d8e..63ba15f 100644 --- a/chrome/browser/extensions/startup_helper.cc +++ b/chrome/browser/extensions/startup_helper.cc @@ -29,8 +29,9 @@ namespace extensions { StartupHelper::StartupHelper() : pack_job_succeeded_(false) {} -void StartupHelper::OnPackSuccess(const FilePath& crx_path, - const FilePath& output_private_key_path) { +void StartupHelper::OnPackSuccess( + const base::FilePath& crx_path, + const base::FilePath& output_private_key_path) { pack_job_succeeded_ = true; PrintPackExtensionMessage( UTF16ToUTF8( @@ -48,8 +49,9 @@ bool StartupHelper::PackExtension(const CommandLine& cmd_line) { return false; // Input Paths. - FilePath src_dir = cmd_line.GetSwitchValuePath(switches::kPackExtension); - FilePath private_key_path; + base::FilePath src_dir = + cmd_line.GetSwitchValuePath(switches::kPackExtension); + base::FilePath private_key_path; if (cmd_line.HasSwitch(switches::kPackExtensionKey)) { private_key_path = cmd_line.GetSwitchValuePath(switches::kPackExtensionKey); } diff --git a/chrome/browser/extensions/startup_helper.h b/chrome/browser/extensions/startup_helper.h index 1f88d99..dc54491 100644 --- a/chrome/browser/extensions/startup_helper.h +++ b/chrome/browser/extensions/startup_helper.h @@ -19,8 +19,9 @@ class StartupHelper : public PackExtensionJob::Client { StartupHelper(); virtual ~StartupHelper(); - virtual void OnPackSuccess(const FilePath& crx_path, - const FilePath& output_private_key_path) OVERRIDE; + virtual void OnPackSuccess( + const base::FilePath& crx_path, + const base::FilePath& output_private_key_path) OVERRIDE; virtual void OnPackFailure(const std::string& error_message, ExtensionCreator::ErrorType type) OVERRIDE; diff --git a/chrome/browser/extensions/state_store.cc b/chrome/browser/extensions/state_store.cc index 7ca9e84..b4dbb04 100644 --- a/chrome/browser/extensions/state_store.cc +++ b/chrome/browser/extensions/state_store.cc @@ -61,7 +61,7 @@ void StateStore::DelayedTaskQueue::SetReady() { } StateStore::StateStore(Profile* profile, - const FilePath& db_path, + const base::FilePath& db_path, bool deferred_load) : db_path_(db_path), task_queue_(new DelayedTaskQueue()) { registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_INSTALLED, diff --git a/chrome/browser/extensions/state_store.h b/chrome/browser/extensions/state_store.h index 2b950b1..fa11422 100644 --- a/chrome/browser/extensions/state_store.h +++ b/chrome/browser/extensions/state_store.h @@ -27,7 +27,8 @@ class StateStore // If |deferred_load| is true, we won't load the database until the first // page has been loaded. - StateStore(Profile* profile, const FilePath& db_path, bool deferred_load); + StateStore(Profile* profile, const base::FilePath& db_path, + bool deferred_load); // This variant is useful for testing (using a mock ValueStore). StateStore(Profile* profile, ValueStore* store); virtual ~StateStore(); @@ -65,7 +66,7 @@ class StateStore void RemoveKeysForExtension(const std::string& extension_id); // Path to our database, on disk. Empty during testing. - FilePath db_path_; + base::FilePath db_path_; // The store that holds our key/values. ValueStoreFrontend store_; diff --git a/chrome/browser/extensions/system_info_event_router.cc b/chrome/browser/extensions/system_info_event_router.cc index 02509b9..e91f7a1 100644 --- a/chrome/browser/extensions/system_info_event_router.cc +++ b/chrome/browser/extensions/system_info_event_router.cc @@ -167,7 +167,7 @@ void SystemInfoEventRouter::OnStorageFreeSpaceChanged( } void SystemInfoEventRouter::OnRemovableStorageAttached(const std::string& id, - const string16& name, const FilePath::StringType& location) { + const string16& name, const base::FilePath::StringType& location) { // TODO(hongbo): Handle storage device arrival/removal event. } diff --git a/chrome/browser/extensions/system_info_event_router.h b/chrome/browser/extensions/system_info_event_router.h index 2492d92..4569f2a 100644 --- a/chrome/browser/extensions/system_info_event_router.h +++ b/chrome/browser/extensions/system_info_event_router.h @@ -54,7 +54,7 @@ class SystemInfoEventRouter // is fixed. void OnRemovableStorageAttached(const std::string& id, const string16& name, - const FilePath::StringType& location); + const base::FilePath::StringType& location); void OnRemovableStorageDetached(const std::string& id); // gfx::DisplayObserver implementation. diff --git a/chrome/browser/extensions/test_extension_environment.cc b/chrome/browser/extensions/test_extension_environment.cc index ae25ef0..cf5cc15 100644 --- a/chrome/browser/extensions/test_extension_environment.cc +++ b/chrome/browser/extensions/test_extension_environment.cc @@ -46,7 +46,7 @@ ExtensionService* TestExtensionEnvironment::GetExtensionService() { TestExtensionSystem* extension_system = static_cast<TestExtensionSystem*>(ExtensionSystem::Get(profile())); extension_service_ = extension_system->CreateExtensionService( - CommandLine::ForCurrentProcess(), FilePath(), false); + CommandLine::ForCurrentProcess(), base::FilePath(), false); } return extension_service_; } diff --git a/chrome/browser/extensions/test_extension_prefs.cc b/chrome/browser/extensions/test_extension_prefs.cc index a261c0e..08f1e31 100644 --- a/chrome/browser/extensions/test_extension_prefs.cc +++ b/chrome/browser/extensions/test_extension_prefs.cc @@ -137,7 +137,7 @@ scoped_refptr<Extension> TestExtensionPrefs::AddExtensionWithManifestAndFlags( int extra_flags) { std::string name; EXPECT_TRUE(manifest.GetString(extension_manifest_keys::kName, &name)); - FilePath path = extensions_dir_.AppendASCII(name); + base::FilePath path = extensions_dir_.AppendASCII(name); std::string errors; scoped_refptr<Extension> extension = Extension::Create( path, location, manifest, extra_flags, &errors); diff --git a/chrome/browser/extensions/test_extension_prefs.h b/chrome/browser/extensions/test_extension_prefs.h index 7111e09..1b7fc70 100644 --- a/chrome/browser/extensions/test_extension_prefs.h +++ b/chrome/browser/extensions/test_extension_prefs.h @@ -36,8 +36,8 @@ class TestExtensionPrefs { return *prefs_.get(); } PrefServiceSyncable* pref_service() { return pref_service_.get(); } - const FilePath& temp_dir() const { return temp_dir_.path(); } - const FilePath& extensions_dir() const { return extensions_dir_; } + const base::FilePath& temp_dir() const { return temp_dir_.path(); } + const base::FilePath& extensions_dir() const { return extensions_dir_; } // This will cause the ExtensionPrefs to be deleted and recreated, based on // any existing backing file we had previously created. @@ -75,8 +75,8 @@ class TestExtensionPrefs { protected: base::ScopedTempDir temp_dir_; - FilePath preferences_file_; - FilePath extensions_dir_; + base::FilePath preferences_file_; + base::FilePath extensions_dir_; scoped_ptr<PrefServiceSyncable> pref_service_; scoped_ptr<ExtensionPrefs> prefs_; scoped_ptr<ExtensionPrefValueMap> extension_pref_value_map_; diff --git a/chrome/browser/extensions/test_extension_service.cc b/chrome/browser/extensions/test_extension_service.cc index d1ab38b..618af398 100644 --- a/chrome/browser/extensions/test_extension_service.cc +++ b/chrome/browser/extensions/test_extension_service.cc @@ -30,7 +30,7 @@ TestExtensionService::pending_extension_manager() { bool TestExtensionService::UpdateExtension( const std::string& id, - const FilePath& path, + const base::FilePath& path, const GURL& download_url, extensions::CrxInstaller** out_crx_installer) { ADD_FAILURE(); diff --git a/chrome/browser/extensions/test_extension_service.h b/chrome/browser/extensions/test_extension_service.h index 00dbe80..4a0db73 100644 --- a/chrome/browser/extensions/test_extension_service.h +++ b/chrome/browser/extensions/test_extension_service.h @@ -34,7 +34,7 @@ class TestExtensionService : public ExtensionServiceInterface { virtual bool UpdateExtension( const std::string& id, - const FilePath& path, + const base::FilePath& path, const GURL& download_url, extensions::CrxInstaller** out_crx_installer) OVERRIDE; virtual const extensions::Extension* GetExtensionById( diff --git a/chrome/browser/extensions/test_extension_system.cc b/chrome/browser/extensions/test_extension_system.cc index 67067ea..ff28916 100644 --- a/chrome/browser/extensions/test_extension_system.cc +++ b/chrome/browser/extensions/test_extension_system.cc @@ -64,7 +64,7 @@ void TestExtensionSystem::CreateSocketManager() { ExtensionService* TestExtensionSystem::CreateExtensionService( const CommandLine* command_line, - const FilePath& install_directory, + const base::FilePath& install_directory, bool autoupdate_enabled) { bool extensions_disabled = command_line && command_line->HasSwitch(switches::kDisableExtensions); diff --git a/chrome/browser/extensions/unpacked_installer.cc b/chrome/browser/extensions/unpacked_installer.cc index 712a37a..b6bc15f 100644 --- a/chrome/browser/extensions/unpacked_installer.cc +++ b/chrome/browser/extensions/unpacked_installer.cc @@ -108,14 +108,14 @@ UnpackedInstaller::~UnpackedInstaller() { BrowserThread::CurrentlyOn(BrowserThread::FILE)); } -void UnpackedInstaller::Load(const FilePath& path_in) { +void UnpackedInstaller::Load(const base::FilePath& path_in) { DCHECK(extension_path_.empty()); extension_path_ = path_in; BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, base::Bind(&UnpackedInstaller::GetAbsolutePath, this)); } -void UnpackedInstaller::LoadFromCommandLine(const FilePath& path_in) { +void UnpackedInstaller::LoadFromCommandLine(const base::FilePath& path_in) { CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(extension_path_.empty()); diff --git a/chrome/browser/extensions/unpacked_installer.h b/chrome/browser/extensions/unpacked_installer.h index 6b48857..d060aa8 100644 --- a/chrome/browser/extensions/unpacked_installer.h +++ b/chrome/browser/extensions/unpacked_installer.h @@ -35,12 +35,12 @@ class UnpackedInstaller // the top directory of a specific extension where its manifest file lives. // Errors are reported through ExtensionErrorReporter. On success, // ExtensionService::AddExtension() is called. - void Load(const FilePath& extension_path); + void Load(const base::FilePath& extension_path); // Loads the extension from the directory |extension_path|; // for use with command line switch --load-extension=path. // This is equivalent to Load, except that it runs synchronously. - void LoadFromCommandLine(const FilePath& extension_path); + void LoadFromCommandLine(const base::FilePath& extension_path); // Allows prompting for plugins to be disabled; intended for testing only. bool prompt_for_plugins() { return prompt_for_plugins_; } @@ -94,7 +94,7 @@ class UnpackedInstaller // The pathname of the directory to load from, which is an absolute path // after GetAbsolutePath has been called. - FilePath extension_path_; + base::FilePath extension_path_; // If true and the extension contains plugins, we prompt the user before // loading. diff --git a/chrome/browser/extensions/updater/extension_downloader.cc b/chrome/browser/extensions/updater/extension_downloader.cc index aed02ff..ded33d4 100644 --- a/chrome/browser/extensions/updater/extension_downloader.cc +++ b/chrome/browser/extensions/updater/extension_downloader.cc @@ -102,7 +102,7 @@ void RecordFileUpdateHistogram(FileWriteResult file_write_result) { NUM_FILE_WRITE_RESULTS); } -void CheckThatCRXIsReadable(const FilePath& crx_path) { +void CheckThatCRXIsReadable(const base::FilePath& crx_path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); FileWriteResult file_write_result = SUCCESS; @@ -124,7 +124,7 @@ void CheckThatCRXIsReadable(const FilePath& crx_path) { // Record the result of writing a CRX file. Will be used to understand // high failure rates of CRX installs in the field. If |success| is // true, |crx_path| should be set to the path to the CRX file. -void RecordCRXWriteHistogram(bool success, const FilePath& crx_path) { +void RecordCRXWriteHistogram(bool success, const base::FilePath& crx_path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); if (!success) { @@ -710,7 +710,7 @@ void ExtensionDownloader::OnCRXFetchComplete( if (source->FileErrorOccurred(&error_code)) { LOG(ERROR) << "Failed to write update CRX with id " << id << ". " << "Error code is "<< error_code; - RecordCRXWriteHistogram(false, FilePath()); + RecordCRXWriteHistogram(false, base::FilePath()); delegate_->OnExtensionDownloadFailed( id, ExtensionDownloaderDelegate::CRX_FETCH_FAILED, ping, request_ids); } else if (status.status() == net::URLRequestStatus::SUCCESS && @@ -726,7 +726,7 @@ void ExtensionDownloader::OnCRXFetchComplete( data, extensions_queue_.active_request()->package_hash, extensions_queue_.active_request()->version, ping, request_ids); } else { - FilePath crx_path; + base::FilePath crx_path; // Take ownership of the file at |crx_path|. CHECK(source->GetResponseAsFilePath(true, &crx_path)); RecordCRXWriteHistogram(true, crx_path); diff --git a/chrome/browser/extensions/updater/extension_updater.cc b/chrome/browser/extensions/updater/extension_updater.cc index 819c1fc..f73641b 100644 --- a/chrome/browser/extensions/updater/extension_updater.cc +++ b/chrome/browser/extensions/updater/extension_updater.cc @@ -98,7 +98,7 @@ ExtensionUpdater::CheckParams::~CheckParams() {} ExtensionUpdater::FetchedCRXFile::FetchedCRXFile( const std::string& i, - const FilePath& p, + const base::FilePath& p, const GURL& u, const std::set<int>& request_ids) : extension_id(i), @@ -482,7 +482,7 @@ void ExtensionUpdater::OnExtensionDownloadFailed( void ExtensionUpdater::OnExtensionDownloadFinished( const std::string& id, - const FilePath& path, + const base::FilePath& path, const GURL& download_url, const std::string& version, const PingResult& ping, diff --git a/chrome/browser/extensions/updater/extension_updater.h b/chrome/browser/extensions/updater/extension_updater.h index 3bedae2..b51d9a7 100644 --- a/chrome/browser/extensions/updater/extension_updater.h +++ b/chrome/browser/extensions/updater/extension_updater.h @@ -128,13 +128,13 @@ class ExtensionUpdater : public ExtensionDownloaderDelegate, struct FetchedCRXFile { FetchedCRXFile(); FetchedCRXFile(const std::string& id, - const FilePath& path, + const base::FilePath& path, const GURL& download_url, const std::set<int>& request_ids); ~FetchedCRXFile(); std::string extension_id; - FilePath path; + base::FilePath path; GURL download_url; std::set<int> request_ids; }; @@ -181,7 +181,7 @@ class ExtensionUpdater : public ExtensionDownloaderDelegate, virtual void OnExtensionDownloadFinished( const std::string& id, - const FilePath& path, + const base::FilePath& path, const GURL& download_url, const std::string& version, const PingResult& ping, diff --git a/chrome/browser/extensions/updater/extension_updater_unittest.cc b/chrome/browser/extensions/updater/extension_updater_unittest.cc index 7267b61..2f12185 100644 --- a/chrome/browser/extensions/updater/extension_updater_unittest.cc +++ b/chrome/browser/extensions/updater/extension_updater_unittest.cc @@ -121,7 +121,7 @@ class MockExtensionDownloaderDelegate : public ExtensionDownloaderDelegate { const PingResult&, const std::set<int>&)); MOCK_METHOD6(OnExtensionDownloadFinished, void(const std::string&, - const FilePath&, + const base::FilePath&, const GURL&, const std::string&, const PingResult&, @@ -373,7 +373,7 @@ class ServiceForDownloadTests : public MockService { virtual bool UpdateExtension( const std::string& id, - const FilePath& extension_path, + const base::FilePath& extension_path, const GURL& download_url, CrxInstaller** out_crx_installer) OVERRIDE { extension_id_ = id; @@ -399,7 +399,7 @@ class ServiceForDownloadTests : public MockService { } const std::string& extension_id() const { return extension_id_; } - const FilePath& install_path() const { return install_path_; } + const base::FilePath& install_path() const { return install_path_; } const GURL& download_url() const { return download_url_; } private: @@ -410,7 +410,7 @@ class ServiceForDownloadTests : public MockService { std::map<std::string, CrxInstaller*> fake_crx_installers_; std::string extension_id_; - FilePath install_path_; + base::FilePath install_path_; GURL download_url_; // The last extension ID that GetExtensionById was called with. @@ -1009,7 +1009,7 @@ class ExtensionUpdaterTest : public testing::Test { } // Call back the ExtensionUpdater with a 200 response and some test data - FilePath extension_file_path(FILE_PATH_LITERAL("/whatever")); + base::FilePath extension_file_path(FILE_PATH_LITERAL("/whatever")); fetcher = factory.GetFetcherByID(ExtensionDownloader::kExtensionFetcherId); EXPECT_TRUE(fetcher != NULL && fetcher->delegate() != NULL); EXPECT_TRUE(fetcher->GetLoadFlags() == kExpectedLoadFlags); @@ -1039,7 +1039,7 @@ class ExtensionUpdaterTest : public testing::Test { // Expect that ExtensionUpdater asked the mock extensions service to install // a file with the test data for the right id. EXPECT_EQ(id, service->extension_id()); - FilePath tmpfile_path = service->install_path(); + base::FilePath tmpfile_path = service->install_path(); EXPECT_FALSE(tmpfile_path.empty()); EXPECT_EQ(test_url, service->download_url()); EXPECT_EQ(extension_file_path, tmpfile_path); @@ -1141,7 +1141,7 @@ class ExtensionUpdaterTest : public testing::Test { updater.downloader_->FetchUpdatedExtension(fetch2.Pass()); // Make the first fetch complete. - FilePath extension_file_path(FILE_PATH_LITERAL("/whatever")); + base::FilePath extension_file_path(FILE_PATH_LITERAL("/whatever")); fetcher = factory.GetFetcherByID(ExtensionDownloader::kExtensionFetcherId); EXPECT_TRUE(fetcher != NULL && fetcher->delegate() != NULL); @@ -1157,7 +1157,7 @@ class ExtensionUpdaterTest : public testing::Test { ExtensionSystem::Get(&profile))-> CreateExtensionService( CommandLine::ForCurrentProcess(), - FilePath(), + base::FilePath(), false); ExtensionService* extension_service = ExtensionSystem::Get(&profile)->extension_service(); @@ -1187,7 +1187,7 @@ class ExtensionUpdaterTest : public testing::Test { RunUntilIdle(); // Expect that the service was asked to do an install with the right data. - FilePath tmpfile_path = service.install_path(); + base::FilePath tmpfile_path = service.install_path(); EXPECT_FALSE(tmpfile_path.empty()); EXPECT_EQ(id1, service.extension_id()); EXPECT_EQ(url1, service.download_url()); @@ -1195,7 +1195,7 @@ class ExtensionUpdaterTest : public testing::Test { // Make sure the second fetch finished and asked the service to do an // update. - FilePath extension_file_path2(FILE_PATH_LITERAL("/whatever2")); + base::FilePath extension_file_path2(FILE_PATH_LITERAL("/whatever2")); fetcher = factory.GetFetcherByID(ExtensionDownloader::kExtensionFetcherId); EXPECT_TRUE(fetcher != NULL && fetcher->delegate() != NULL); EXPECT_TRUE(fetcher->GetLoadFlags() == kExpectedLoadFlags); diff --git a/chrome/browser/extensions/user_script_listener_unittest.cc b/chrome/browser/extensions/user_script_listener_unittest.cc index a7fafe8..8b14a60 100644 --- a/chrome/browser/extensions/user_script_listener_unittest.cc +++ b/chrome/browser/extensions/user_script_listener_unittest.cc @@ -77,7 +77,8 @@ class SimpleTestJob : public net::URLRequestTestJob { }; // Yoinked from extension_manifest_unittest.cc. -DictionaryValue* LoadManifestFile(const FilePath path, std::string* error) { +DictionaryValue* LoadManifestFile(const base::FilePath path, + std::string* error) { EXPECT_TRUE(file_util::PathExists(path)); JSONFileValueSerializer serializer(path); return static_cast<DictionaryValue*>(serializer.Deserialize(NULL, error)); @@ -85,7 +86,7 @@ DictionaryValue* LoadManifestFile(const FilePath path, std::string* error) { scoped_refptr<Extension> LoadExtension(const std::string& filename, std::string* error) { - FilePath path; + base::FilePath path; PathService::Get(chrome::DIR_TEST_DATA, &path); path = path. AppendASCII("extensions"). @@ -177,9 +178,9 @@ class UserScriptListenerTest : public ExtensionServiceTestBase { } void LoadTestExtension() { - FilePath test_dir; + base::FilePath test_dir; ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &test_dir)); - FilePath extension_path = test_dir + base::FilePath extension_path = test_dir .AppendASCII("extensions") .AppendASCII("good") .AppendASCII("Extensions") diff --git a/chrome/browser/extensions/user_script_master.cc b/chrome/browser/extensions/user_script_master.cc index 9c8738f..3e51c11 100644 --- a/chrome/browser/extensions/user_script_master.cc +++ b/chrome/browser/extensions/user_script_master.cc @@ -183,7 +183,7 @@ void UserScriptMaster::ScriptReloader::NotifyMaster( static bool LoadScriptContent(UserScript::File* script_file, const SubstitutionMap* localization_messages) { std::string content; - const FilePath& path = ExtensionResource::GetFilePath( + const base::FilePath& path = ExtensionResource::GetFilePath( script_file->extension_root(), script_file->relative_path(), ExtensionResource::SYMLINKS_MUST_RESOLVE_WITHIN_ROOT); if (path.empty()) { diff --git a/chrome/browser/extensions/user_script_master_unittest.cc b/chrome/browser/extensions/user_script_master_unittest.cc index 8607652..9f10a42 100644 --- a/chrome/browser/extensions/user_script_master_unittest.cc +++ b/chrome/browser/extensions/user_script_master_unittest.cc @@ -232,7 +232,7 @@ TEST_F(UserScriptMasterTest, Parse8) { } TEST_F(UserScriptMasterTest, SkipBOMAtTheBeginning) { - FilePath path = temp_dir_.path().AppendASCII("script.user.js"); + base::FilePath path = temp_dir_.path().AppendASCII("script.user.js"); const std::string content("\xEF\xBB\xBF alert('hello');"); size_t written = file_util::WriteFile(path, content.c_str(), content.size()); ASSERT_EQ(written, content.size()); @@ -255,7 +255,7 @@ TEST_F(UserScriptMasterTest, SkipBOMAtTheBeginning) { } TEST_F(UserScriptMasterTest, LeaveBOMNotAtTheBeginning) { - FilePath path = temp_dir_.path().AppendASCII("script.user.js"); + base::FilePath path = temp_dir_.path().AppendASCII("script.user.js"); const std::string content("alert('here's a BOOM: \xEF\xBB\xBF');"); size_t written = file_util::WriteFile(path, content.c_str(), content.size()); ASSERT_EQ(written, content.size()); diff --git a/chrome/browser/extensions/webstore_installer.cc b/chrome/browser/extensions/webstore_installer.cc index bc67e7b..5cb0be8 100644 --- a/chrome/browser/extensions/webstore_installer.cc +++ b/chrome/browser/extensions/webstore_installer.cc @@ -66,7 +66,7 @@ const char kInvalidDownloadError[] = "Download was not a CRX"; const char kInlineInstallSource[] = "inline"; const char kDefaultInstallSource[] = ""; -FilePath* g_download_directory_for_tests = NULL; +base::FilePath* g_download_directory_for_tests = NULL; GURL GetWebstoreInstallURL( const std::string& extension_id, const std::string& install_source) { @@ -94,9 +94,9 @@ GURL GetWebstoreInstallURL( // Must be executed on the FILE thread. void GetDownloadFilePath( - const FilePath& download_directory, const std::string& id, - const base::Callback<void(const FilePath&)>& callback) { - FilePath directory(g_download_directory_for_tests ? + const base::FilePath& download_directory, const std::string& id, + const base::Callback<void(const base::FilePath&)>& callback) { + base::FilePath directory(g_download_directory_for_tests ? *g_download_directory_for_tests : download_directory); #if defined (OS_CHROMEOS) @@ -110,7 +110,7 @@ void GetDownloadFilePath( if (!file_util::DirectoryExists(directory)) { if (!file_util::CreateDirectory(directory)) { BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, - base::Bind(callback, FilePath())); + base::Bind(callback, base::FilePath())); return; } } @@ -122,7 +122,8 @@ void GetDownloadFilePath( std::string random_number = base::Uint64ToString(base::RandGenerator(kuint16max)); - FilePath file = directory.AppendASCII(id + "_" + random_number + ".crx"); + base::FilePath file = + directory.AppendASCII(id + "_" + random_number + ".crx"); int uniquifier = file_util::GetUniquePathNumber(file, FILE_PATH_LITERAL("")); if (uniquifier > 0) @@ -215,7 +216,7 @@ void WebstoreInstaller::Start() { return; } - FilePath download_path = DownloadPrefs::FromDownloadManager( + base::FilePath download_path = DownloadPrefs::FromDownloadManager( BrowserContext::GetDownloadManager(profile_))->DownloadPath(); BrowserThread::PostTask( BrowserThread::FILE, FROM_HERE, @@ -272,7 +273,8 @@ void WebstoreInstaller::InvalidateDelegate() { delegate_ = NULL; } -void WebstoreInstaller::SetDownloadDirectoryForTests(FilePath* directory) { +void WebstoreInstaller::SetDownloadDirectoryForTests( + base::FilePath* directory) { g_download_directory_for_tests = directory; } @@ -342,7 +344,7 @@ void WebstoreInstaller::OnDownloadDestroyed(DownloadItem* download) { // reports should narrow down exactly which pointer it is. Collapsing all the // early-returns into a single branch makes it hard to see exactly which pointer // it is. -void WebstoreInstaller::StartDownload(const FilePath& file) { +void WebstoreInstaller::StartDownload(const base::FilePath& file) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DownloadManager* download_manager = diff --git a/chrome/browser/feedback/feedback_util.cc b/chrome/browser/feedback/feedback_util.cc index 262b9cd..36615c5 100644 --- a/chrome/browser/feedback/feedback_util.cc +++ b/chrome/browser/feedback/feedback_util.cc @@ -88,7 +88,8 @@ const int64 kInitialRetryDelay = 900000; // 15 minutes const int64 kRetryDelayIncreaseFactor = 2; const int64 kRetryDelayLimit = 14400000; // 4 hours -void ReadFileToStringNoResult(const FilePath& path, std::string* contents) { +void ReadFileToStringNoResult(const base::FilePath& path, + std::string* contents) { if (!file_util::ReadFileToString(path, contents)) if (contents) contents->clear(); @@ -248,15 +249,15 @@ bool FeedbackUtil::ValidFeedbackSize(const std::string& content) { void FeedbackUtil::SendReport(const FeedbackData& data) { #if defined(OS_CHROMEOS) if (data.attached_filename().size() && - FilePath::IsSeparator(data.attached_filename()[0]) && + base::FilePath::IsSeparator(data.attached_filename()[0]) && !data.attached_filedata()) { // Read the attached file and then send this report. std::string* file_data = new std::string; - FilePath root = + base::FilePath root = ash::Shell::GetInstance()->delegate()-> GetCurrentBrowserContext()->GetPath(); - FilePath filepath = root.Append(data.attached_filename().substr(1)); + base::FilePath filepath = root.Append(data.attached_filename().substr(1)); std::string stripped_filename = filepath.BaseName().value(); // Read the file into file_data, then call send report again with the diff --git a/chrome/browser/file_select_helper.cc b/chrome/browser/file_select_helper.cc index 5eb052b..1c75201 100644 --- a/chrome/browser/file_select_helper.cc +++ b/chrome/browser/file_select_helper.cc @@ -70,7 +70,7 @@ void NotifyRenderViewHost(RenderViewHost* render_view_host, // Converts a list of FilePaths to a list of ui::SelectedFileInfo. std::vector<ui::SelectedFileInfo> FilePathListToSelectedFileInfoList( - const std::vector<FilePath>& paths) { + const std::vector<base::FilePath>& paths) { std::vector<ui::SelectedFileInfo> selected_files; for (size_t i = 0; i < paths.size(); ++i) { selected_files.push_back( @@ -87,7 +87,7 @@ struct FileSelectHelper::ActiveDirectoryEnumeration { scoped_ptr<DirectoryListerDispatchDelegate> delegate_; scoped_ptr<net::DirectoryLister> lister_; RenderViewHost* rvh_; - std::vector<FilePath> results_; + std::vector<base::FilePath> results_; }; FileSelectHelper::FileSelectHelper(Profile* profile) @@ -125,7 +125,7 @@ void FileSelectHelper::DirectoryListerDispatchDelegate::OnListDone(int error) { parent_->OnListDone(id_, error); } -void FileSelectHelper::FileSelected(const FilePath& path, +void FileSelectHelper::FileSelected(const base::FilePath& path, int index, void* params) { FileSelectedWithExtraInfo(ui::SelectedFileInfo(path, path), index, params); } @@ -139,7 +139,7 @@ void FileSelectHelper::FileSelectedWithExtraInfo( profile_->set_last_selected_directory(file.file_path.DirName()); - const FilePath& path = file.local_path; + const base::FilePath& path = file.local_path; if (dialog_type_ == ui::SelectFileDialog::SELECT_FOLDER) { StartNewEnumeration(path, kFileSelectEnumerationId, render_view_host_); return; @@ -153,8 +153,9 @@ void FileSelectHelper::FileSelectedWithExtraInfo( RunFileChooserEnd(); } -void FileSelectHelper::MultiFilesSelected(const std::vector<FilePath>& files, - void* params) { +void FileSelectHelper::MultiFilesSelected( + const std::vector<base::FilePath>& files, + void* params) { std::vector<ui::SelectedFileInfo> selected_files = FilePathListToSelectedFileInfoList(files); @@ -189,7 +190,7 @@ void FileSelectHelper::FileSelectionCanceled(void* params) { RunFileChooserEnd(); } -void FileSelectHelper::StartNewEnumeration(const FilePath& path, +void FileSelectHelper::StartNewEnumeration(const base::FilePath& path, int request_id, RenderViewHost* render_view_host) { scoped_ptr<ActiveDirectoryEnumeration> entry(new ActiveDirectoryEnumeration); @@ -260,7 +261,8 @@ FileSelectHelper::GetFileTypesFromAcceptType( new ui::SelectFileDialog::FileTypeInfo(*base_file_type)); file_type->include_all_files = true; file_type->extensions.resize(1); - std::vector<FilePath::StringType>* extensions = &file_type->extensions.back(); + std::vector<base::FilePath::StringType>* extensions = + &file_type->extensions.back(); // Find the corresponding extensions. int valid_type_count = 0; @@ -274,7 +276,7 @@ FileSelectHelper::GetFileTypesFromAcceptType( if (ascii_type[0] == '.') { // If the type starts with a period it is assumed to be a file extension // so we just have to add it to the list. - FilePath::StringType ext(ascii_type.begin(), ascii_type.end()); + base::FilePath::StringType ext(ascii_type.begin(), ascii_type.end()); extensions->push_back(ext.substr(1)); } else { if (ascii_type == "image/*") @@ -327,7 +329,7 @@ void FileSelectHelper::RunFileChooser(content::WebContents* tab, // static void FileSelectHelper::EnumerateDirectory(content::WebContents* tab, int request_id, - const FilePath& path) { + const base::FilePath& path) { Profile* profile = Profile::FromBrowserContext(tab->GetBrowserContext()); // FileSelectHelper will keep itself alive until it sends the result message. scoped_refptr<FileSelectHelper> file_select_helper( @@ -403,7 +405,7 @@ void FileSelectHelper::RunFileChooserOnUIThread( NOTREACHED(); } - FilePath default_file_name = params.default_file_name.IsAbsolute() ? + base::FilePath default_file_name = params.default_file_name.IsAbsolute() ? params.default_file_name : profile_->last_selected_directory().Append(params.default_file_name); @@ -445,7 +447,7 @@ void FileSelectHelper::RunFileChooserEnd() { void FileSelectHelper::EnumerateDirectory(int request_id, RenderViewHost* render_view_host, - const FilePath& path) { + const base::FilePath& path) { // Because this class returns notifications to the RenderViewHost, it is // difficult for callers to know how long to keep a reference to this diff --git a/chrome/browser/file_select_helper.h b/chrome/browser/file_select_helper.h index 4d50ca4..89f769f 100644 --- a/chrome/browser/file_select_helper.h +++ b/chrome/browser/file_select_helper.h @@ -43,7 +43,7 @@ class FileSelectHelper // Enumerates all the files in directory. static void EnumerateDirectory(content::WebContents* tab, int request_id, - const FilePath& path); + const base::FilePath& path); private: friend class base::RefCountedThreadSafe<FileSelectHelper>; @@ -85,12 +85,12 @@ class FileSelectHelper // SelectFileDialog::Listener overrides. virtual void FileSelected( - const FilePath& path, int index, void* params) OVERRIDE; + const base::FilePath& path, int index, void* params) OVERRIDE; virtual void FileSelectedWithExtraInfo( const ui::SelectedFileInfo& file, int index, void* params) OVERRIDE; - virtual void MultiFilesSelected(const std::vector<FilePath>& files, + virtual void MultiFilesSelected(const std::vector<base::FilePath>& files, void* params) OVERRIDE; virtual void MultiFilesSelectedWithExtraInfo( const std::vector<ui::SelectedFileInfo>& files, @@ -104,10 +104,10 @@ class FileSelectHelper void EnumerateDirectory(int request_id, content::RenderViewHost* render_view_host, - const FilePath& path); + const base::FilePath& path); // Kicks off a new directory enumeration. - void StartNewEnumeration(const FilePath& path, + void StartNewEnumeration(const base::FilePath& path, int request_id, content::RenderViewHost* render_view_host); diff --git a/chrome/browser/first_run/first_run.cc b/chrome/browser/first_run/first_run.cc index 059112d..39eb69a 100644 --- a/chrome/browser/first_run/first_run.cc +++ b/chrome/browser/first_run/first_run.cc @@ -118,14 +118,14 @@ void DoDelayedInstallExtensionsIfNeeded( } } -FilePath GetDefaultPrefFilePath(bool create_profile_dir, - const FilePath& user_data_dir) { - FilePath default_pref_dir = +base::FilePath GetDefaultPrefFilePath(bool create_profile_dir, + const base::FilePath& user_data_dir) { + base::FilePath default_pref_dir = ProfileManager::GetDefaultProfileDir(user_data_dir); if (create_profile_dir) { if (!file_util::PathExists(default_pref_dir)) { if (!file_util::CreateDirectory(default_pref_dir)) - return FilePath(); + return base::FilePath(); } } return ProfileManager::GetProfilePrefsPath(default_pref_dir); @@ -184,7 +184,8 @@ void SetImportItem(PrefService* user_prefs, // Imports bookmarks from an html file. The path to the file is provided in // the command line. int ImportFromFile(Profile* profile, const CommandLine& cmdline) { - FilePath file_path = cmdline.GetSwitchValuePath(switches::kImportFromFile); + base::FilePath file_path = + cmdline.GetSwitchValuePath(switches::kImportFromFile); if (file_path.empty()) { NOTREACHED(); return false; @@ -215,14 +216,15 @@ namespace internal { FirstRunState first_run_ = FIRST_RUN_UNKNOWN; -static base::LazyInstance<FilePath> master_prefs_path_for_testing +static base::LazyInstance<base::FilePath> master_prefs_path_for_testing = LAZY_INSTANCE_INITIALIZER; -installer::MasterPreferences* LoadMasterPrefs(FilePath* master_prefs_path) { +installer::MasterPreferences* + LoadMasterPrefs(base::FilePath* master_prefs_path) { if (!master_prefs_path_for_testing.Get().empty()) *master_prefs_path = master_prefs_path_for_testing.Get(); else - *master_prefs_path = FilePath(MasterPrefsPath()); + *master_prefs_path = base::FilePath(MasterPrefsPath()); if (master_prefs_path->empty()) return NULL; installer::MasterPreferences* install_prefs = @@ -235,9 +237,9 @@ installer::MasterPreferences* LoadMasterPrefs(FilePath* master_prefs_path) { return install_prefs; } -bool CopyPrefFile(const FilePath& user_data_dir, - const FilePath& master_prefs_path) { - FilePath user_prefs = GetDefaultPrefFilePath(true, user_data_dir); +bool CopyPrefFile(const base::FilePath& user_data_dir, + const base::FilePath& master_prefs_path) { + base::FilePath user_prefs = GetDefaultPrefFilePath(true, user_data_dir); if (user_prefs.empty()) return false; @@ -385,7 +387,7 @@ bool IsChromeFirstRun() { if (internal::first_run_ != internal::FIRST_RUN_UNKNOWN) return internal::first_run_ == internal::FIRST_RUN_TRUE; - FilePath first_run_sentinel; + base::FilePath first_run_sentinel; if (!internal::GetFirstRunSentinelFilePath(&first_run_sentinel) || file_util::PathExists(first_run_sentinel)) { internal::first_run_ = internal::FIRST_RUN_FALSE; @@ -396,7 +398,7 @@ bool IsChromeFirstRun() { } bool CreateSentinel() { - FilePath first_run_sentinel; + base::FilePath first_run_sentinel; if (!internal::GetFirstRunSentinelFilePath(&first_run_sentinel)) return false; return file_util::WriteFile(first_run_sentinel, "", 0) != -1; @@ -415,7 +417,7 @@ void RegisterUserPrefs(PrefServiceSyncable* prefs) { } bool RemoveSentinel() { - FilePath first_run_sentinel; + base::FilePath first_run_sentinel; if (!internal::GetFirstRunSentinelFilePath(&first_run_sentinel)) return false; return file_util::Delete(first_run_sentinel, false); @@ -558,12 +560,12 @@ void FirstRunBubbleLauncher::Observe( delete this; } -void SetMasterPrefsPathForTesting(const FilePath& master_prefs) { +void SetMasterPrefsPathForTesting(const base::FilePath& master_prefs) { internal::master_prefs_path_for_testing.Get() = master_prefs; } ProcessMasterPreferencesResult ProcessMasterPreferences( - const FilePath& user_data_dir, + const base::FilePath& user_data_dir, MasterPrefs* out_prefs) { DCHECK(!user_data_dir.empty()); @@ -574,7 +576,7 @@ ProcessMasterPreferencesResult ProcessMasterPreferences( return SKIP_FIRST_RUN_TASKS; #endif - FilePath master_prefs_path; + base::FilePath master_prefs_path; scoped_ptr<installer::MasterPreferences> install_prefs(internal::LoadMasterPrefs(&master_prefs_path)); if (!install_prefs.get()) @@ -626,7 +628,7 @@ void AutoImport( importer_host = new ImporterHost; #endif - FilePath local_state_path; + base::FilePath local_state_path; PathService::Get(chrome::FILE_LOCAL_STATE, &local_state_path); bool local_state_file_exists = file_util::PathExists(local_state_path); @@ -701,7 +703,7 @@ void DoPostImportTasks(Profile* profile, bool make_chrome_default) { } #if !defined(USE_AURA) - FilePath local_state_path; + base::FilePath local_state_path; PathService::Get(chrome::FILE_LOCAL_STATE, &local_state_path); bool local_state_file_exists = file_util::PathExists(local_state_path); diff --git a/chrome/browser/first_run/first_run_browsertest.cc b/chrome/browser/first_run/first_run_browsertest.cc index 3f0e3c6..63e880f 100644 --- a/chrome/browser/first_run/first_run_browsertest.cc +++ b/chrome/browser/first_run/first_run_browsertest.cc @@ -117,7 +117,7 @@ class FirstRunMasterPrefsBrowserTest : public FirstRunIntegrationBrowserTest { } private: - FilePath prefs_file_; + base::FilePath prefs_file_; DISALLOW_COPY_AND_ASSIGN(FirstRunMasterPrefsBrowserTest); }; diff --git a/chrome/browser/first_run/first_run_linux.cc b/chrome/browser/first_run/first_run_linux.cc index f32ba78..c1a2c9d 100644 --- a/chrome/browser/first_run/first_run_linux.cc +++ b/chrome/browser/first_run/first_run_linux.cc @@ -34,7 +34,7 @@ bool IsOrganicFirstRun() { // TODO(port): This is just a piece of the silent import functionality from // ImportSettings for Windows. It would be nice to get the rest of it ported. -bool ImportBookmarks(const FilePath& import_bookmarks_path) { +bool ImportBookmarks(const base::FilePath& import_bookmarks_path) { const CommandLine& cmdline = *CommandLine::ForCurrentProcess(); CommandLine import_cmd(cmdline.GetProgram()); @@ -68,11 +68,11 @@ bool ImportBookmarks(const FilePath& import_bookmarks_path) { namespace first_run { -FilePath MasterPrefsPath() { +base::FilePath MasterPrefsPath() { // The standard location of the master prefs is next to the chrome binary. - FilePath master_prefs; + base::FilePath master_prefs; if (!PathService::Get(base::DIR_EXE, &master_prefs)) - return FilePath(); + return base::FilePath(); return master_prefs.AppendASCII(installer::kDefaultMasterPrefs); } diff --git a/chrome/browser/first_run/first_run_mac.mm b/chrome/browser/first_run/first_run_mac.mm index 27c82d9..c4d2730 100644 --- a/chrome/browser/first_run/first_run_mac.mm +++ b/chrome/browser/first_run/first_run_mac.mm @@ -15,7 +15,7 @@ namespace first_run { namespace internal { -bool ImportBookmarks(const FilePath& import_bookmarks_path) { +bool ImportBookmarks(const base::FilePath& import_bookmarks_path) { // http://crbug.com/48880 return false; } @@ -25,7 +25,7 @@ bool ImportBookmarks(const FilePath& import_bookmarks_path) { namespace first_run { -FilePath MasterPrefsPath() { +base::FilePath MasterPrefsPath() { return master_prefs::MasterPrefsPath(); } diff --git a/chrome/browser/first_run/first_run_posix.cc b/chrome/browser/first_run/first_run_posix.cc index 4b3fae1..57e8f34 100644 --- a/chrome/browser/first_run/first_run_posix.cc +++ b/chrome/browser/first_run/first_run_posix.cc @@ -77,8 +77,8 @@ void DoPostImportPlatformSpecificTasks() { #endif } -bool GetFirstRunSentinelFilePath(FilePath* path) { - FilePath first_run_sentinel; +bool GetFirstRunSentinelFilePath(base::FilePath* path) { + base::FilePath first_run_sentinel; if (!PathService::Get(chrome::DIR_USER_DATA, &first_run_sentinel)) return false; @@ -126,7 +126,7 @@ void SetImportPreferencesAndLaunchImport( &import_bookmarks_path); if (!import_bookmarks_path.empty()) { // There are bookmarks to import from a file. - FilePath path = FilePath::FromWStringHack(UTF8ToWide( + base::FilePath path = base::FilePath::FromWStringHack(UTF8ToWide( import_bookmarks_path)); if (!ImportBookmarks(path)) { LOG(WARNING) << "silent bookmark import failed"; diff --git a/chrome/browser/first_run/first_run_unittest.cc b/chrome/browser/first_run/first_run_unittest.cc index 4d1a566..70834a0 100644 --- a/chrome/browser/first_run/first_run_unittest.cc +++ b/chrome/browser/first_run/first_run_unittest.cc @@ -21,7 +21,7 @@ class FirstRunTest : public testing::Test { first_run::internal::GetFirstRunSentinelFilePath(&sentinel_path_); } - FilePath sentinel_path_; + base::FilePath sentinel_path_; private: base::ScopedPathOverride user_data_dir_override_; diff --git a/chrome/browser/first_run/first_run_win.cc b/chrome/browser/first_run/first_run_win.cc index 5270ce4..f04f4bf 100644 --- a/chrome/browser/first_run/first_run_win.cc +++ b/chrome/browser/first_run/first_run_win.cc @@ -66,12 +66,13 @@ namespace { // in |*ret_code|, and returns true if the exit code is valid. // For metro Windows, it launches setup via ShellExecuteEx and returns in order // to bounce the user back to the desktop, then returns immediately. -bool LaunchSetupForEula(const FilePath::StringType& value, int* ret_code) { - FilePath exe_dir; +bool LaunchSetupForEula(const base::FilePath::StringType& value, + int* ret_code) { + base::FilePath exe_dir; if (!PathService::Get(base::DIR_MODULE, &exe_dir)) return false; exe_dir = exe_dir.Append(installer::kInstallerDir); - FilePath exe_path = exe_dir.Append(installer::kSetupExe); + base::FilePath exe_path = exe_dir.Append(installer::kSetupExe); base::ProcessHandle ph; CommandLine cl(CommandLine::NO_PROGRAM); @@ -114,8 +115,8 @@ bool LaunchSetupForEula(const FilePath::StringType& value, int* ret_code) { // Populates |path| with the path to |file| in the sentinel directory. This is // the application directory for user-level installs, and the default user data // dir for system-level installs. Returns false on error. -bool GetSentinelFilePath(const wchar_t* file, FilePath* path) { - FilePath exe_path; +bool GetSentinelFilePath(const wchar_t* file, base::FilePath* path) { + base::FilePath exe_path; if (!PathService::Get(base::DIR_EXE, &exe_path)) return false; if (InstallUtil::IsPerUserInstall(exe_path.value().c_str())) @@ -126,7 +127,7 @@ bool GetSentinelFilePath(const wchar_t* file, FilePath* path) { return true; } -bool GetEULASentinelFilePath(FilePath* path) { +bool GetEULASentinelFilePath(base::FilePath* path) { return GetSentinelFilePath(installer::kEULASentinelFile, path); } @@ -137,7 +138,7 @@ bool IsEULANotAccepted(installer::MasterPreferences* install_prefs) { bool value = false; if (install_prefs->GetBool(installer::master_preferences::kRequireEula, &value) && value) { - FilePath eula_sentinel; + base::FilePath eula_sentinel; // Be conservative and show the EULA if the path to the sentinel can't be // determined. if (!GetEULASentinelFilePath(&eula_sentinel) || @@ -150,7 +151,7 @@ bool IsEULANotAccepted(installer::MasterPreferences* install_prefs) { // Writes the EULA to a temporary file, returned in |*eula_path|, and returns // true if successful. -bool WriteEULAtoTempFile(FilePath* eula_path) { +bool WriteEULAtoTempFile(base::FilePath* eula_path) { std::string terms = l10n_util::GetStringUTF8(IDS_TERMS_HTML); if (terms.empty()) return false; @@ -165,7 +166,7 @@ bool WriteEULAtoTempFile(FilePath* eula_path) { // Creates the sentinel indicating that the EULA was required and has been // accepted. bool CreateEULASentinel() { - FilePath eula_sentinel; + base::FilePath eula_sentinel; if (!GetEULASentinelFilePath(&eula_sentinel)) return false; @@ -320,7 +321,7 @@ int ImportFromBrowser(Profile* profile, bool ImportSettingsWin(Profile* profile, int importer_type, int items_to_import, - const FilePath& import_bookmarks_path, + const base::FilePath& import_bookmarks_path, bool skip_first_run_ui) { if (!items_to_import && import_bookmarks_path.empty()) { return true; @@ -390,7 +391,7 @@ void DoPostImportPlatformSpecificTasks() { // making sure shortcuts are created promptly to avoid annoying the user by // re-creating shortcuts he previously deleted. static const int64 kTiggerActiveSetupDelaySeconds = 5; - FilePath chrome_exe; + base::FilePath chrome_exe; if (!PathService::Get(base::FILE_EXE, &chrome_exe)) { NOTREACHED(); } else if (!InstallUtil::IsPerUserInstall(chrome_exe.value().c_str())) { @@ -409,11 +410,11 @@ bool ImportSettings(Profile* profile, profile, importer_list->GetSourceProfileAt(0).importer_type, items_to_import, - FilePath(), + base::FilePath(), false); } -bool GetFirstRunSentinelFilePath(FilePath* path) { +bool GetFirstRunSentinelFilePath(base::FilePath* path) { return GetSentinelFilePath(chrome::kFirstRunSentinel, path); } @@ -445,10 +446,10 @@ void SetImportPreferencesAndLaunchImport( // the importer process and blocks until done or until it fails. scoped_refptr<ImporterList> importer_list(new ImporterList(NULL)); importer_list->DetectSourceProfilesHack(); - if (!ImportSettingsWin(NULL, - importer_list->GetSourceProfileAt(0).importer_type, - out_prefs->do_import_items, - FilePath::FromWStringHack(UTF8ToWide(import_bookmarks_path)), true)) { + if (!ImportSettingsWin( + NULL, importer_list->GetSourceProfileAt(0).importer_type, + out_prefs->do_import_items, base::FilePath::FromWStringHack(UTF8ToWide( + import_bookmarks_path)), true)) { LOG(WARNING) << "silent import failed"; } } @@ -462,7 +463,7 @@ bool ShowPostInstallEULAIfNeeded(installer::MasterPreferences* install_prefs) { // The actual eula text is in a resource in chrome. We extract it to // a text file so setup.exe can use it as an inner frame. - FilePath inner_html; + base::FilePath inner_html; if (WriteEULAtoTempFile(&inner_html)) { int retcode = 0; if (!LaunchSetupForEula(inner_html.value(), &retcode) || @@ -500,11 +501,11 @@ int ImportNow(Profile* profile, const CommandLine& cmdline) { return return_code; } -FilePath MasterPrefsPath() { +base::FilePath MasterPrefsPath() { // The standard location of the master prefs is next to the chrome binary. - FilePath master_prefs; + base::FilePath master_prefs; if (!PathService::Get(base::DIR_EXE, &master_prefs)) - return FilePath(); + return base::FilePath(); return master_prefs.AppendASCII(installer::kDefaultMasterPrefs); } diff --git a/chrome/browser/first_run/upgrade_util_linux.cc b/chrome/browser/first_run/upgrade_util_linux.cc index 62aacf4..1a976a4 100644 --- a/chrome/browser/first_run/upgrade_util_linux.cc +++ b/chrome/browser/first_run/upgrade_util_linux.cc @@ -35,9 +35,9 @@ void SaveLastModifiedTimeOfExe() { } double GetLastModifiedTimeOfExe() { - FilePath exe_file_path; + base::FilePath exe_file_path; if (!PathService::Get(base::FILE_EXE, &exe_file_path)) { - LOG(WARNING) << "Failed to get FilePath object for FILE_EXE."; + LOG(WARNING) << "Failed to get base::FilePath object for FILE_EXE."; return saved_last_modified_time_of_exe; } base::PlatformFileInfo exe_file_info; diff --git a/chrome/browser/first_run/upgrade_util_win.cc b/chrome/browser/first_run/upgrade_util_win.cc index ca267a8..a9e9f19 100644 --- a/chrome/browser/first_run/upgrade_util_win.cc +++ b/chrome/browser/first_run/upgrade_util_win.cc @@ -38,7 +38,7 @@ namespace { -bool GetNewerChromeFile(FilePath* path) { +bool GetNewerChromeFile(base::FilePath* path) { if (!PathService::Get(base::DIR_EXE, path)) return false; *path = path->Append(installer::kChromeNewExe); @@ -67,9 +67,9 @@ bool InvokeGoogleUpdateForRename() { return false; } -FilePath GetMetroRelauncherPath(const FilePath& chrome_exe, - const std::string& version_str) { - FilePath path(chrome_exe.DirName()); +base::FilePath GetMetroRelauncherPath(const base::FilePath& chrome_exe, + const std::string& version_str) { + base::FilePath path(chrome_exe.DirName()); // The relauncher is ordinarily in the version directory. When running in a // build tree however (where CHROME_VERSION is not set in the environment) @@ -101,7 +101,7 @@ bool RelaunchChromeHelper(const CommandLine& command_line, bool mode_switch) { // // Pass this Chrome's Start Menu shortcut path to the relauncher so it can // re-activate chrome via ShellExecute. - FilePath chrome_exe; + base::FilePath chrome_exe; if (!PathService::Get(base::FILE_EXE, &chrome_exe)) { NOTREACHED(); return false; @@ -171,19 +171,19 @@ bool RelaunchChromeWithModeSwitch(const CommandLine& command_line) { } bool IsUpdatePendingRestart() { - FilePath new_chrome_exe; + base::FilePath new_chrome_exe; if (!GetNewerChromeFile(&new_chrome_exe)) return false; return file_util::PathExists(new_chrome_exe); } bool SwapNewChromeExeIfPresent() { - FilePath new_chrome_exe; + base::FilePath new_chrome_exe; if (!GetNewerChromeFile(&new_chrome_exe)) return false; if (!file_util::PathExists(new_chrome_exe)) return false; - FilePath cur_chrome_exe; + base::FilePath cur_chrome_exe; if (!PathService::Get(base::FILE_EXE, &cur_chrome_exe)) return false; diff --git a/chrome/browser/google/google_update_settings_posix.cc b/chrome/browser/google/google_update_settings_posix.cc index c47e0c7..f593a9e 100644 --- a/chrome/browser/google/google_update_settings_posix.cc +++ b/chrome/browser/google/google_update_settings_posix.cc @@ -23,7 +23,7 @@ static const char kConsentToSendStats[] = "Consent To Send Stats"; // static bool GoogleUpdateSettings::GetCollectStatsConsent() { - FilePath consent_file; + base::FilePath consent_file; PathService::Get(chrome::DIR_USER_DATA, &consent_file); consent_file = consent_file.Append(kConsentToSendStats); std::string tmp_guid; @@ -35,12 +35,12 @@ bool GoogleUpdateSettings::GetCollectStatsConsent() { // static bool GoogleUpdateSettings::SetCollectStatsConsent(bool consented) { - FilePath consent_dir; + base::FilePath consent_dir; PathService::Get(chrome::DIR_USER_DATA, &consent_dir); if (!file_util::DirectoryExists(consent_dir)) return false; - FilePath consent_file = consent_dir.AppendASCII(kConsentToSendStats); + base::FilePath consent_file = consent_dir.AppendASCII(kConsentToSendStats); if (consented) { if ((!file_util::PathExists(consent_file)) || (file_util::PathExists(consent_file) && @@ -58,7 +58,7 @@ bool GoogleUpdateSettings::SetCollectStatsConsent(bool consented) { bool GoogleUpdateSettings::SetMetricsId(const std::wstring& client_id) { // Make sure that user has consented to send crashes. - FilePath consent_dir; + base::FilePath consent_dir; PathService::Get(chrome::DIR_USER_DATA, &consent_dir); if (!file_util::DirectoryExists(consent_dir) || !GoogleUpdateSettings::GetCollectStatsConsent()) diff --git a/chrome/browser/google/google_update_win.cc b/chrome/browser/google/google_update_win.cc index 83fa005..bdb122d 100644 --- a/chrome/browser/google/google_update_win.cc +++ b/chrome/browser/google/google_update_win.cc @@ -34,18 +34,18 @@ namespace { // Returns GOOGLE_UPDATE_NO_ERROR only if the instance running is a Google // Chrome distribution installed in a standard location. GoogleUpdateErrorCode CanUpdateCurrentChrome( - const FilePath& chrome_exe_path) { + const base::FilePath& chrome_exe_path) { #if !defined(GOOGLE_CHROME_BUILD) return CANNOT_UPGRADE_CHROME_IN_THIS_DIRECTORY; #else // TODO(tommi): Check if using the default distribution is always the right // thing to do. BrowserDistribution* dist = BrowserDistribution::GetDistribution(); - FilePath user_exe_path = installer::GetChromeInstallPath(false, dist); - FilePath machine_exe_path = installer::GetChromeInstallPath(true, dist); - if (!FilePath::CompareEqualIgnoreCase(chrome_exe_path.value(), + base::FilePath user_exe_path = installer::GetChromeInstallPath(false, dist); + base::FilePath machine_exe_path = installer::GetChromeInstallPath(true, dist); + if (!base::FilePath::CompareEqualIgnoreCase(chrome_exe_path.value(), user_exe_path.value()) && - !FilePath::CompareEqualIgnoreCase(chrome_exe_path.value(), + !base::FilePath::CompareEqualIgnoreCase(chrome_exe_path.value(), machine_exe_path.value())) { LOG(ERROR) << L"Google Update cannot update Chrome installed in a " << L"non-standard location: " << chrome_exe_path.value().c_str() @@ -246,7 +246,7 @@ void GoogleUpdate::CheckForUpdate(bool install_if_newer, HWND window) { void GoogleUpdate::InitiateGoogleUpdateCheck(bool install_if_newer, HWND window, MessageLoop* main_loop) { - FilePath chrome_exe; + base::FilePath chrome_exe; if (!PathService::Get(base::DIR_EXE, &chrome_exe)) NOTREACHED(); diff --git a/chrome/browser/google/google_util_chromeos.cc b/chrome/browser/google/google_util_chromeos.cc index 50947e5..5fb4ad9 100644 --- a/chrome/browser/google/google_util_chromeos.cc +++ b/chrome/browser/google/google_util_chromeos.cc @@ -27,7 +27,7 @@ const char kRLZBrandFilePath[] = // Reads the brand code from file |kRLZBrandFilePath|. std::string ReadBrandFromFile() { std::string brand; - FilePath brand_file_path(kRLZBrandFilePath); + base::FilePath brand_file_path(kRLZBrandFilePath); if (!file_util::ReadFileToString(brand_file_path, &brand)) LOG(WARNING) << "Brand code file missing: " << brand_file_path.value(); TrimWhitespace(brand, TRIM_ALL, &brand); diff --git a/chrome/browser/google_apis/base_operations.cc b/chrome/browser/google_apis/base_operations.cc index 9fadd16..346406b 100644 --- a/chrome/browser/google_apis/base_operations.cc +++ b/chrome/browser/google_apis/base_operations.cc @@ -100,7 +100,7 @@ UrlFetchOperationBase::UrlFetchOperationBase( OperationRegistry* registry, net::URLRequestContextGetter* url_request_context_getter, OperationType type, - const FilePath& path) + const base::FilePath& path) : OperationRegistry::Operation(registry, type, path), url_request_context_getter_(url_request_context_getter), re_authenticate_count_(0), @@ -461,8 +461,8 @@ DownloadFileOperation::DownloadFileOperation( const DownloadActionCallback& download_action_callback, const GetContentCallback& get_content_callback, const GURL& download_url, - const FilePath& drive_file_path, - const FilePath& output_file_path) + const base::FilePath& drive_file_path, + const base::FilePath& output_file_path) : UrlFetchOperationBase(registry, url_request_context_getter, OPERATION_DOWNLOAD, @@ -508,7 +508,7 @@ void DownloadFileOperation::ProcessURLFetchResults(const URLFetcher* source) { GDataErrorCode code = GetErrorCode(source); // Take over the ownership of the the downloaded temp file. - FilePath temp_file; + base::FilePath temp_file; if (code == HTTP_SUCCESS && !source->GetResponseAsFilePath(true, // take_ownership &temp_file)) { @@ -520,7 +520,7 @@ void DownloadFileOperation::ProcessURLFetchResults(const URLFetcher* source) { } void DownloadFileOperation::RunCallbackOnPrematureFailure(GDataErrorCode code) { - download_action_callback_.Run(code, FilePath()); + download_action_callback_.Run(code, base::FilePath()); } } // namespace google_apis diff --git a/chrome/browser/google_apis/base_operations.h b/chrome/browser/google_apis/base_operations.h index 41420b5..f221b8a 100644 --- a/chrome/browser/google_apis/base_operations.h +++ b/chrome/browser/google_apis/base_operations.h @@ -106,7 +106,7 @@ class UrlFetchOperationBase : public AuthenticatedOperationInterface, OperationRegistry* registry, net::URLRequestContextGetter* url_request_context_getter, OperationType type, - const FilePath& drive_file_path); + const base::FilePath& drive_file_path); virtual ~UrlFetchOperationBase(); // Gets URL for the request. @@ -157,7 +157,7 @@ class UrlFetchOperationBase : public AuthenticatedOperationInterface, // By default, no file will be saved. Derived classes can set an output // file path in their constructors, if they want to save the downloaded // content to a file at a specific path. - void set_output_file_path(const FilePath& output_file_path) { + void set_output_file_path(const base::FilePath& output_file_path) { output_file_path_ = output_file_path; } @@ -178,7 +178,7 @@ class UrlFetchOperationBase : public AuthenticatedOperationInterface, bool started_; bool save_temp_file_; - FilePath output_file_path_; + base::FilePath output_file_path_; // WeakPtrFactory bound to the UI thread. // Note: This should remain the last member so it'll be destroyed and @@ -350,7 +350,8 @@ class InitiateUploadOperationBase : public UrlFetchOperationBase { // Callback type for DownloadHostedDocument/DownloadFile // DocumentServiceInterface calls. typedef base::Callback<void(GDataErrorCode error, - const FilePath& temp_file)> DownloadActionCallback; + const base::FilePath& temp_file)> + DownloadActionCallback; // This class performs the operation for downloading of a given document/file. class DownloadFileOperation : public UrlFetchOperationBase { @@ -378,8 +379,8 @@ class DownloadFileOperation : public UrlFetchOperationBase { const DownloadActionCallback& download_action_callback, const GetContentCallback& get_content_callback, const GURL& download_url, - const FilePath& drive_file_path, - const FilePath& output_file_path); + const base::FilePath& drive_file_path, + const base::FilePath& output_file_path); virtual ~DownloadFileOperation(); protected: diff --git a/chrome/browser/google_apis/base_operations_server_unittest.cc b/chrome/browser/google_apis/base_operations_server_unittest.cc index 8c7b912..5aeba15 100644 --- a/chrome/browser/google_apis/base_operations_server_unittest.cc +++ b/chrome/browser/google_apis/base_operations_server_unittest.cc @@ -34,7 +34,7 @@ void CopyResultsFromDownloadActionCallbackAndQuit( GDataErrorCode* out_result_code, std::string* contents, GDataErrorCode result_code, - const FilePath& cache_file_path) { + const base::FilePath& cache_file_path) { *out_result_code = result_code; file_util::ReadFileToString(cache_file_path, contents); file_util::Delete(cache_file_path, false); @@ -73,7 +73,7 @@ class BaseOperationsServerTest : public testing::Test { } // Returns a temporary file path suitable for storing the cache file. - FilePath GetTestCachedFilePath(const FilePath& file_name) { + base::FilePath GetTestCachedFilePath(const base::FilePath& file_name) { return profile_->GetPath().Append(file_name); } @@ -103,8 +103,9 @@ TEST_F(BaseOperationsServerTest, DownloadFileOperation_ValidFile) { &contents), GetContentCallback(), test_server_.GetURL("/files/gdata/testfile.txt"), - FilePath::FromUTF8Unsafe("/dummy/gdata/testfile.txt"), - GetTestCachedFilePath(FilePath::FromUTF8Unsafe("cached_testfile.txt"))); + base::FilePath::FromUTF8Unsafe("/dummy/gdata/testfile.txt"), + GetTestCachedFilePath( + base::FilePath::FromUTF8Unsafe("cached_testfile.txt"))); operation->Start(kTestAuthToken, kTestUserAgent, base::Bind(&test_util::DoNothingForReAuthenticateCallback)); MessageLoop::current()->Run(); @@ -113,7 +114,7 @@ TEST_F(BaseOperationsServerTest, DownloadFileOperation_ValidFile) { EXPECT_EQ(test_server::METHOD_GET, http_request_.method); EXPECT_EQ("/files/gdata/testfile.txt", http_request_.relative_url); - const FilePath expected_path = + const base::FilePath expected_path = test_util::GetTestFilePath("gdata/testfile.txt"); std::string expected_contents; file_util::ReadFileToString(expected_path, &expected_contents); @@ -133,9 +134,9 @@ TEST_F(BaseOperationsServerTest, &contents), GetContentCallback(), test_server_.GetURL("/files/gdata/no-such-file.txt"), - FilePath::FromUTF8Unsafe("/dummy/gdata/no-such-file.txt"), + base::FilePath::FromUTF8Unsafe("/dummy/gdata/no-such-file.txt"), GetTestCachedFilePath( - FilePath::FromUTF8Unsafe("cache_no-such-file.txt"))); + base::FilePath::FromUTF8Unsafe("cache_no-such-file.txt"))); operation->Start(kTestAuthToken, kTestUserAgent, base::Bind(&test_util::DoNothingForReAuthenticateCallback)); MessageLoop::current()->Run(); diff --git a/chrome/browser/google_apis/drive_api_operations_unittest.cc b/chrome/browser/google_apis/drive_api_operations_unittest.cc index c8d5b98..b42fb7f 100644 --- a/chrome/browser/google_apis/drive_api_operations_unittest.cc +++ b/chrome/browser/google_apis/drive_api_operations_unittest.cc @@ -85,7 +85,7 @@ class DriveApiOperationsTest : public testing::Test { // This is a path to the file which contains expected response from // the server. See also HandleDataFileRequest below. - FilePath expected_data_file_path_; + base::FilePath expected_data_file_path_; // These are content and its type in the expected response from the server. // See also HandleContentResponse below. diff --git a/chrome/browser/google_apis/drive_api_service.cc b/chrome/browser/google_apis/drive_api_service.cc index d16027e..66edb1b 100644 --- a/chrome/browser/google_apis/drive_api_service.cc +++ b/chrome/browser/google_apis/drive_api_service.cc @@ -226,7 +226,7 @@ void DriveAPIService::CancelAll() { runner_->CancelAll(); } -bool DriveAPIService::CancelForFilePath(const FilePath& file_path) { +bool DriveAPIService::CancelForFilePath(const base::FilePath& file_path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); return operation_registry()->CancelForFilePath(file_path); } @@ -333,8 +333,8 @@ void DriveAPIService::GetAppList(const GetAppListCallback& callback) { } void DriveAPIService::DownloadFile( - const FilePath& virtual_path, - const FilePath& local_cache_path, + const base::FilePath& virtual_path, + const base::FilePath& local_cache_path, const GURL& download_url, const DownloadActionCallback& download_action_callback, const GetContentCallback& get_content_callback) { @@ -468,7 +468,7 @@ void DriveAPIService::ResumeUpload( void DriveAPIService::GetUploadStatus( UploadMode upload_mode, - const FilePath& drive_file_path, + const base::FilePath& drive_file_path, const GURL& upload_url, int64 content_length, const UploadRangeCallback& callback) { diff --git a/chrome/browser/google_apis/drive_api_service.h b/chrome/browser/google_apis/drive_api_service.h index 08960dc..649c79f 100644 --- a/chrome/browser/google_apis/drive_api_service.h +++ b/chrome/browser/google_apis/drive_api_service.h @@ -113,7 +113,7 @@ class DriveAPIService : public DriveServiceInterface, const UploadRangeCallback& callback) OVERRIDE; virtual void GetUploadStatus( UploadMode upload_mode, - const FilePath& drive_file_path, + const base::FilePath& drive_file_path, const GURL& upload_url, int64 content_length, const UploadRangeCallback& callback) OVERRIDE; diff --git a/chrome/browser/google_apis/drive_service_interface.h b/chrome/browser/google_apis/drive_service_interface.h index 1d07a3f..c80f6a1 100644 --- a/chrome/browser/google_apis/drive_service_interface.h +++ b/chrome/browser/google_apis/drive_service_interface.h @@ -92,7 +92,7 @@ class DriveServiceInterface { // Cancels ongoing operation for a given virtual |file_path|. Returns true if // the operation was found and canceled. - virtual bool CancelForFilePath(const FilePath& file_path) = 0; + virtual bool CancelForFilePath(const base::FilePath& file_path) = 0; // Obtains the list of currently active operations. virtual OperationProgressStatusList GetProgressStatusList() const = 0; @@ -226,8 +226,8 @@ class DriveServiceInterface { // |download_action_callback| must not be null. // |get_content_callback| may be null. virtual void DownloadFile( - const FilePath& virtual_path, - const FilePath& local_cache_path, + const base::FilePath& virtual_path, + const base::FilePath& local_cache_path, const GURL& download_url, const DownloadActionCallback& download_action_callback, const GetContentCallback& get_content_callback) = 0; @@ -248,7 +248,7 @@ class DriveServiceInterface { // |callback| must not be null. virtual void GetUploadStatus( UploadMode upload_mode, - const FilePath& drive_file_path, + const base::FilePath& drive_file_path, const GURL& upload_url, int64 content_length, const UploadRangeCallback& callback) = 0; diff --git a/chrome/browser/google_apis/drive_uploader.cc b/chrome/browser/google_apis/drive_uploader.cc index a31c2b1..46a9545 100644 --- a/chrome/browser/google_apis/drive_uploader.cc +++ b/chrome/browser/google_apis/drive_uploader.cc @@ -28,7 +28,7 @@ const int64 kUploadChunkSize = 512 * 1024; // Opens |path| with |file_stream| and returns the file size. // If failed, returns an error code in a negative value. int64 OpenFileStreamAndGetSizeOnBlockingPool(net::FileStream* file_stream, - const FilePath& path) { + const base::FilePath& path) { int result = file_stream->OpenSync( path, base::PLATFORM_FILE_OPEN | base::PLATFORM_FILE_READ); if (result != net::OK) @@ -46,8 +46,8 @@ struct DriveUploader::UploadFileInfo { UploadFileInfo(scoped_refptr<base::SequencedTaskRunner> task_runner, UploadMode upload_mode, const GURL& initial_upload_location, - const FilePath& drive_path, - const FilePath& local_path, + const base::FilePath& drive_path, + const base::FilePath& local_path, const std::string& title, const std::string& content_type, const std::string& etag, @@ -97,10 +97,10 @@ struct DriveUploader::UploadFileInfo { const GURL initial_upload_location; // Final path in gdata. Looks like /special/drive/MyFolder/MyFile. - const FilePath drive_path; + const base::FilePath drive_path; // The local file path of the file to be uploaded. - const FilePath file_path; + const base::FilePath file_path; // Title to be used for file to be uploaded. const std::string title; @@ -153,8 +153,8 @@ DriveUploader::DriveUploader(DriveServiceInterface* drive_service) DriveUploader::~DriveUploader() {} void DriveUploader::UploadNewFile(const GURL& upload_location, - const FilePath& drive_file_path, - const FilePath& local_file_path, + const base::FilePath& drive_file_path, + const base::FilePath& local_file_path, const std::string& title, const std::string& content_type, const UploadCompletionCallback& callback) { @@ -181,8 +181,8 @@ void DriveUploader::UploadNewFile(const GURL& upload_location, void DriveUploader::UploadExistingFile( const GURL& upload_location, - const FilePath& drive_file_path, - const FilePath& local_file_path, + const base::FilePath& drive_file_path, + const base::FilePath& local_file_path, const std::string& content_type, const std::string& etag, const UploadCompletionCallback& callback) { diff --git a/chrome/browser/google_apis/drive_uploader_unittest.cc b/chrome/browser/google_apis/drive_uploader_unittest.cc index 38aafed..c57bae3 100644 --- a/chrome/browser/google_apis/drive_uploader_unittest.cc +++ b/chrome/browser/google_apis/drive_uploader_unittest.cc @@ -35,9 +35,9 @@ const char kTestETag[] = "test_etag"; // Creates a |size| byte file and returns its |path|. The file is filled with // random bytes so that the test assertions can identify correct // portion of the file is being sent. -bool CreateFileOfSpecifiedSize(const FilePath& temp_dir, +bool CreateFileOfSpecifiedSize(const base::FilePath& temp_dir, size_t size, - FilePath* path, + base::FilePath* path, std::string* data) { data->resize(size); for (size_t i = 0; i < size; ++i) @@ -208,8 +208,8 @@ class DriveUploaderTest : public testing::Test { struct UploadCompletionCallbackResult { UploadCompletionCallbackResult() : error(DRIVE_UPLOAD_ERROR_ABORT) {} DriveUploadError error; - FilePath drive_path; - FilePath file_path; + base::FilePath drive_path; + base::FilePath file_path; scoped_ptr<ResourceEntry> resource_entry; }; @@ -217,8 +217,8 @@ struct UploadCompletionCallbackResult { void CopyResultsFromUploadCompletionCallbackAndQuit( UploadCompletionCallbackResult* out, DriveUploadError error, - const FilePath& drive_path, - const FilePath& file_path, + const base::FilePath& drive_path, + const base::FilePath& file_path, scoped_ptr<ResourceEntry> resource_entry) { out->error = error; out->drive_path = drive_path; @@ -230,7 +230,7 @@ void CopyResultsFromUploadCompletionCallbackAndQuit( } // namespace TEST_F(DriveUploaderTest, UploadExisting0KB) { - FilePath local_path; + base::FilePath local_path; std::string data; ASSERT_TRUE(CreateFileOfSpecifiedSize(temp_dir_.path(), 0, &local_path, &data)); @@ -241,7 +241,7 @@ TEST_F(DriveUploaderTest, UploadExisting0KB) { DriveUploader uploader(&mock_service); uploader.UploadExistingFile( GURL(kTestInitialUploadURL), - FilePath::FromUTF8Unsafe(kTestDrivePath), + base::FilePath::FromUTF8Unsafe(kTestDrivePath), local_path, kTestMimeType, "", // etag @@ -251,14 +251,14 @@ TEST_F(DriveUploaderTest, UploadExisting0KB) { EXPECT_EQ(1, mock_service.resume_upload_call_count()); EXPECT_EQ(0, mock_service.received_bytes()); EXPECT_EQ(DRIVE_UPLOAD_OK, out.error); - EXPECT_EQ(FilePath::FromUTF8Unsafe(kTestDrivePath), out.drive_path); + EXPECT_EQ(base::FilePath::FromUTF8Unsafe(kTestDrivePath), out.drive_path); EXPECT_EQ(local_path, out.file_path); ASSERT_TRUE(out.resource_entry); EXPECT_EQ(kTestDummyId, out.resource_entry->id()); } TEST_F(DriveUploaderTest, UploadExisting512KB) { - FilePath local_path; + base::FilePath local_path; std::string data; ASSERT_TRUE(CreateFileOfSpecifiedSize(temp_dir_.path(), 512 * 1024, &local_path, &data)); @@ -269,7 +269,7 @@ TEST_F(DriveUploaderTest, UploadExisting512KB) { DriveUploader uploader(&mock_service); uploader.UploadExistingFile( GURL(kTestInitialUploadURL), - FilePath::FromUTF8Unsafe(kTestDrivePath), + base::FilePath::FromUTF8Unsafe(kTestDrivePath), local_path, kTestMimeType, "", // etag @@ -280,14 +280,14 @@ TEST_F(DriveUploaderTest, UploadExisting512KB) { EXPECT_EQ(1, mock_service.resume_upload_call_count()); EXPECT_EQ(512 * 1024, mock_service.received_bytes()); EXPECT_EQ(DRIVE_UPLOAD_OK, out.error); - EXPECT_EQ(FilePath::FromUTF8Unsafe(kTestDrivePath), out.drive_path); + EXPECT_EQ(base::FilePath::FromUTF8Unsafe(kTestDrivePath), out.drive_path); EXPECT_EQ(local_path, out.file_path); ASSERT_TRUE(out.resource_entry); EXPECT_EQ(kTestDummyId, out.resource_entry->id()); } TEST_F(DriveUploaderTest, UploadExisting1234KB) { - FilePath local_path; + base::FilePath local_path; std::string data; ASSERT_TRUE(CreateFileOfSpecifiedSize(temp_dir_.path(), 1234 * 1024, &local_path, &data)); @@ -298,7 +298,7 @@ TEST_F(DriveUploaderTest, UploadExisting1234KB) { DriveUploader uploader(&mock_service); uploader.UploadExistingFile( GURL(kTestInitialUploadURL), - FilePath::FromUTF8Unsafe(kTestDrivePath), + base::FilePath::FromUTF8Unsafe(kTestDrivePath), local_path, kTestMimeType, "", // etag @@ -309,14 +309,14 @@ TEST_F(DriveUploaderTest, UploadExisting1234KB) { EXPECT_EQ(3, mock_service.resume_upload_call_count()); EXPECT_EQ(1234 * 1024, mock_service.received_bytes()); EXPECT_EQ(DRIVE_UPLOAD_OK, out.error); - EXPECT_EQ(FilePath::FromUTF8Unsafe(kTestDrivePath), out.drive_path); + EXPECT_EQ(base::FilePath::FromUTF8Unsafe(kTestDrivePath), out.drive_path); EXPECT_EQ(local_path, out.file_path); ASSERT_TRUE(out.resource_entry); EXPECT_EQ(kTestDummyId, out.resource_entry->id()); } TEST_F(DriveUploaderTest, UploadNew1234KB) { - FilePath local_path; + base::FilePath local_path; std::string data; ASSERT_TRUE(CreateFileOfSpecifiedSize(temp_dir_.path(), 1234 * 1024, &local_path, &data)); @@ -327,7 +327,7 @@ TEST_F(DriveUploaderTest, UploadNew1234KB) { DriveUploader uploader(&mock_service); uploader.UploadNewFile( GURL(kTestInitialUploadURL), - FilePath::FromUTF8Unsafe(kTestDrivePath), + base::FilePath::FromUTF8Unsafe(kTestDrivePath), local_path, kTestDocumentTitle, kTestMimeType, @@ -338,14 +338,14 @@ TEST_F(DriveUploaderTest, UploadNew1234KB) { EXPECT_EQ(3, mock_service.resume_upload_call_count()); EXPECT_EQ(1234 * 1024, mock_service.received_bytes()); EXPECT_EQ(DRIVE_UPLOAD_OK, out.error); - EXPECT_EQ(FilePath::FromUTF8Unsafe(kTestDrivePath), out.drive_path); + EXPECT_EQ(base::FilePath::FromUTF8Unsafe(kTestDrivePath), out.drive_path); EXPECT_EQ(local_path, out.file_path); ASSERT_TRUE(out.resource_entry); EXPECT_EQ(kTestDummyId, out.resource_entry->id()); } TEST_F(DriveUploaderTest, InitiateUploadFail) { - FilePath local_path; + base::FilePath local_path; std::string data; ASSERT_TRUE(CreateFileOfSpecifiedSize(temp_dir_.path(), 512 * 1024, &local_path, &data)); @@ -356,7 +356,7 @@ TEST_F(DriveUploaderTest, InitiateUploadFail) { DriveUploader uploader(&mock_service); uploader.UploadExistingFile( GURL(kTestInitialUploadURL), - FilePath::FromUTF8Unsafe(kTestDrivePath), + base::FilePath::FromUTF8Unsafe(kTestDrivePath), local_path, kTestMimeType, "", // etag @@ -367,7 +367,7 @@ TEST_F(DriveUploaderTest, InitiateUploadFail) { } TEST_F(DriveUploaderTest, InitiateUploadNoConflict) { - FilePath local_path; + base::FilePath local_path; std::string data; ASSERT_TRUE(CreateFileOfSpecifiedSize(temp_dir_.path(), 512 * 1024, &local_path, &data)); @@ -376,7 +376,7 @@ TEST_F(DriveUploaderTest, InitiateUploadNoConflict) { DriveUploader uploader(&mock_service); uploader.UploadExistingFile( GURL(kTestInitialUploadURL), - FilePath::FromUTF8Unsafe(kTestDrivePath), + base::FilePath::FromUTF8Unsafe(kTestDrivePath), local_path, kTestMimeType, kTestETag, @@ -387,7 +387,7 @@ TEST_F(DriveUploaderTest, InitiateUploadNoConflict) { } TEST_F(DriveUploaderTest, InitiateUploadConflict) { - FilePath local_path; + base::FilePath local_path; std::string data; ASSERT_TRUE(CreateFileOfSpecifiedSize(temp_dir_.path(), 512 * 1024, &local_path, &data)); @@ -398,7 +398,7 @@ TEST_F(DriveUploaderTest, InitiateUploadConflict) { DriveUploader uploader(&mock_service); uploader.UploadExistingFile( GURL(kTestInitialUploadURL), - FilePath::FromUTF8Unsafe(kTestDrivePath), + base::FilePath::FromUTF8Unsafe(kTestDrivePath), local_path, kTestMimeType, kDestinationETag, @@ -409,7 +409,7 @@ TEST_F(DriveUploaderTest, InitiateUploadConflict) { } TEST_F(DriveUploaderTest, ResumeUploadFail) { - FilePath local_path; + base::FilePath local_path; std::string data; ASSERT_TRUE(CreateFileOfSpecifiedSize(temp_dir_.path(), 512 * 1024, &local_path, &data)); @@ -420,7 +420,7 @@ TEST_F(DriveUploaderTest, ResumeUploadFail) { DriveUploader uploader(&mock_service); uploader.UploadExistingFile( GURL(kTestInitialUploadURL), - FilePath::FromUTF8Unsafe(kTestDrivePath), + base::FilePath::FromUTF8Unsafe(kTestDrivePath), local_path, kTestMimeType, "", // etag @@ -436,7 +436,7 @@ TEST_F(DriveUploaderTest, NonExistingSourceFile) { DriveUploader uploader(NULL); // NULL, the service won't be used. uploader.UploadExistingFile( GURL(kTestInitialUploadURL), - FilePath::FromUTF8Unsafe(kTestDrivePath), + base::FilePath::FromUTF8Unsafe(kTestDrivePath), temp_dir_.path().AppendASCII("_this_path_should_not_exist_"), kTestMimeType, "", // etag diff --git a/chrome/browser/google_apis/dummy_drive_service.cc b/chrome/browser/google_apis/dummy_drive_service.cc index 929d1e5..900d63f 100644 --- a/chrome/browser/google_apis/dummy_drive_service.cc +++ b/chrome/browser/google_apis/dummy_drive_service.cc @@ -20,7 +20,7 @@ bool DummyDriveService::CanStartOperation() const { return true; } void DummyDriveService::CancelAll() {} -bool DummyDriveService::CancelForFilePath(const FilePath& file_path) { +bool DummyDriveService::CancelForFilePath(const base::FilePath& file_path) { return true; } @@ -62,8 +62,8 @@ void DummyDriveService::DeleteResource(const std::string& resource_id, const EntryActionCallback& callback) {} void DummyDriveService::DownloadFile( - const FilePath& virtual_path, - const FilePath& local_cache_path, + const base::FilePath& virtual_path, + const base::FilePath& local_cache_path, const GURL& download_url, const DownloadActionCallback& download_action_callback, const GetContentCallback& get_content_callback) {} @@ -101,7 +101,7 @@ void DummyDriveService::ResumeUpload(const ResumeUploadParams& params, void DummyDriveService::GetUploadStatus( UploadMode upload_mode, - const FilePath& drive_file_path, + const base::FilePath& drive_file_path, const GURL& upload_url, int64 content_length, const UploadRangeCallback& callback) {} diff --git a/chrome/browser/google_apis/dummy_drive_service.h b/chrome/browser/google_apis/dummy_drive_service.h index a5c3fb8..97efe23 100644 --- a/chrome/browser/google_apis/dummy_drive_service.h +++ b/chrome/browser/google_apis/dummy_drive_service.h @@ -22,7 +22,7 @@ class DummyDriveService : public DriveServiceInterface { virtual void RemoveObserver(DriveServiceObserver* observer) OVERRIDE; virtual bool CanStartOperation() const OVERRIDE; virtual void CancelAll() OVERRIDE; - virtual bool CancelForFilePath(const FilePath& file_path) OVERRIDE; + virtual bool CancelForFilePath(const base::FilePath& file_path) OVERRIDE; virtual OperationProgressStatusList GetProgressStatusList() const OVERRIDE; virtual bool HasAccessToken() const OVERRIDE; virtual bool HasRefreshToken() const OVERRIDE; @@ -46,8 +46,8 @@ class DummyDriveService : public DriveServiceInterface { const std::string& etag, const EntryActionCallback& callback) OVERRIDE; virtual void DownloadFile( - const FilePath& virtual_path, - const FilePath& local_cache_path, + const base::FilePath& virtual_path, + const base::FilePath& local_cache_path, const GURL& download_url, const DownloadActionCallback& download_action_callback, const GetContentCallback& get_content_callback) OVERRIDE; @@ -76,7 +76,7 @@ class DummyDriveService : public DriveServiceInterface { const UploadRangeCallback& callback) OVERRIDE; virtual void GetUploadStatus( UploadMode upload_mode, - const FilePath& drive_file_path, + const base::FilePath& drive_file_path, const GURL& upload_url, int64 content_length, const UploadRangeCallback& callback) OVERRIDE; diff --git a/chrome/browser/google_apis/fake_drive_service.cc b/chrome/browser/google_apis/fake_drive_service.cc index 9874a34..770f2a5 100644 --- a/chrome/browser/google_apis/fake_drive_service.cc +++ b/chrome/browser/google_apis/fake_drive_service.cc @@ -162,7 +162,7 @@ void FakeDriveService::CancelAll() { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); } -bool FakeDriveService::CancelForFilePath(const FilePath& file_path) { +bool FakeDriveService::CancelForFilePath(const base::FilePath& file_path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); return true; } @@ -428,8 +428,8 @@ void FakeDriveService::DeleteResource( } void FakeDriveService::DownloadFile( - const FilePath& virtual_path, - const FilePath& local_cache_path, + const base::FilePath& virtual_path, + const base::FilePath& local_cache_path, const GURL& download_url, const DownloadActionCallback& download_action_callback, const GetContentCallback& get_content_callback) { @@ -441,7 +441,7 @@ void FakeDriveService::DownloadFile( FROM_HERE, base::Bind(download_action_callback, GDATA_NO_CONNECTION, - FilePath())); + base::FilePath())); return; } @@ -450,7 +450,7 @@ void FakeDriveService::DownloadFile( if (!entry) { base::MessageLoopProxy::current()->PostTask( FROM_HERE, - base::Bind(download_action_callback, HTTP_NOT_FOUND, FilePath())); + base::Bind(download_action_callback, HTTP_NOT_FOUND, base::FilePath())); return; } @@ -478,7 +478,7 @@ void FakeDriveService::DownloadFile( // Failed to write the content. base::MessageLoopProxy::current()->PostTask( FROM_HERE, - base::Bind(download_action_callback, GDATA_FILE_ERROR, FilePath())); + base::Bind(download_action_callback, GDATA_FILE_ERROR, base::FilePath())); } void FakeDriveService::CopyHostedDocument( @@ -892,7 +892,7 @@ void FakeDriveService::InitiateUpload( void FakeDriveService::GetUploadStatus( UploadMode upload_mode, - const FilePath& drive_file_path, + const base::FilePath& drive_file_path, const GURL& upload_url, int64 content_length, const UploadRangeCallback& callback) { diff --git a/chrome/browser/google_apis/fake_drive_service.h b/chrome/browser/google_apis/fake_drive_service.h index acfda38..f21a3d7 100644 --- a/chrome/browser/google_apis/fake_drive_service.h +++ b/chrome/browser/google_apis/fake_drive_service.h @@ -67,7 +67,7 @@ class FakeDriveService : public DriveServiceInterface { virtual void RemoveObserver(DriveServiceObserver* observer) OVERRIDE; virtual bool CanStartOperation() const OVERRIDE; virtual void CancelAll() OVERRIDE; - virtual bool CancelForFilePath(const FilePath& file_path) OVERRIDE; + virtual bool CancelForFilePath(const base::FilePath& file_path) OVERRIDE; virtual OperationProgressStatusList GetProgressStatusList() const OVERRIDE; virtual std::string GetRootResourceId() const OVERRIDE; virtual bool HasAccessToken() const OVERRIDE; @@ -93,8 +93,8 @@ class FakeDriveService : public DriveServiceInterface { const std::string& etag, const EntryActionCallback& callback) OVERRIDE; virtual void DownloadFile( - const FilePath& virtual_path, - const FilePath& local_cache_path, + const base::FilePath& virtual_path, + const base::FilePath& local_cache_path, const GURL& download_url, const DownloadActionCallback& download_action_callback, const GetContentCallback& get_content_callback) OVERRIDE; @@ -125,7 +125,7 @@ class FakeDriveService : public DriveServiceInterface { const UploadRangeCallback& callback) OVERRIDE; virtual void GetUploadStatus( UploadMode upload_mode, - const FilePath& drive_file_path, + const base::FilePath& drive_file_path, const GURL& upload_url, int64 content_length, const UploadRangeCallback& callback) OVERRIDE; diff --git a/chrome/browser/google_apis/fake_drive_service_unittest.cc b/chrome/browser/google_apis/fake_drive_service_unittest.cc index 9c0998c..33f9036 100644 --- a/chrome/browser/google_apis/fake_drive_service_unittest.cc +++ b/chrome/browser/google_apis/fake_drive_service_unittest.cc @@ -549,11 +549,12 @@ TEST_F(FakeDriveServiceTest, DownloadFile_ExistingFile) { ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); const GURL kContentUrl("https://file_content_url/"); - const FilePath kOutputFilePath = temp_dir.path().AppendASCII("whatever.txt"); + const base::FilePath kOutputFilePath = + temp_dir.path().AppendASCII("whatever.txt"); GDataErrorCode error = GDATA_OTHER_ERROR; - FilePath output_file_path; + base::FilePath output_file_path; fake_service_.DownloadFile( - FilePath::FromUTF8Unsafe("/drive/whatever.txt"), // virtual path + base::FilePath::FromUTF8Unsafe("/drive/whatever.txt"), // virtual path kOutputFilePath, kContentUrl, base::Bind(&test_util::CopyResultsFromDownloadActionCallback, @@ -577,11 +578,12 @@ TEST_F(FakeDriveServiceTest, DownloadFile_NonexistingFile) { ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); const GURL kContentUrl("https://non_existing_content_url/"); - const FilePath kOutputFilePath = temp_dir.path().AppendASCII("whatever.txt"); + const base::FilePath kOutputFilePath = + temp_dir.path().AppendASCII("whatever.txt"); GDataErrorCode error = GDATA_OTHER_ERROR; - FilePath output_file_path; + base::FilePath output_file_path; fake_service_.DownloadFile( - FilePath::FromUTF8Unsafe("/drive/whatever.txt"), // virtual path + base::FilePath::FromUTF8Unsafe("/drive/whatever.txt"), // virtual path kOutputFilePath, kContentUrl, base::Bind(&test_util::CopyResultsFromDownloadActionCallback, @@ -601,11 +603,12 @@ TEST_F(FakeDriveServiceTest, DownloadFile_Offline) { ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); const GURL kContentUrl("https://file_content_url/"); - const FilePath kOutputFilePath = temp_dir.path().AppendASCII("whatever.txt"); + const base::FilePath kOutputFilePath = + temp_dir.path().AppendASCII("whatever.txt"); GDataErrorCode error = GDATA_OTHER_ERROR; - FilePath output_file_path; + base::FilePath output_file_path; fake_service_.DownloadFile( - FilePath::FromUTF8Unsafe("/drive/whatever.txt"), // virtual path + base::FilePath::FromUTF8Unsafe("/drive/whatever.txt"), // virtual path kOutputFilePath, kContentUrl, base::Bind(&test_util::CopyResultsFromDownloadActionCallback, @@ -1052,7 +1055,7 @@ TEST_F(FakeDriveServiceTest, InitiateUpload_Offline) { "test/foo", 13, GURL("https://1_folder_resumable_create_media_link"), - FilePath(FILE_PATH_LITERAL("drive/Directory 1")), + base::FilePath(FILE_PATH_LITERAL("drive/Directory 1")), "etag_ignored"), base::Bind(&test_util::CopyResultsFromInitiateUploadCallback, &error, @@ -1075,7 +1078,7 @@ TEST_F(FakeDriveServiceTest, InitiateUpload_NotFound) { "test/foo", 13, GURL("https://non_existent"), - FilePath(FILE_PATH_LITERAL("drive/Directory 1")), + base::FilePath(FILE_PATH_LITERAL("drive/Directory 1")), "etag_ignored"), base::Bind(&test_util::CopyResultsFromInitiateUploadCallback, &error, @@ -1098,7 +1101,7 @@ TEST_F(FakeDriveServiceTest, InitiateUpload_NewFile) { "test/foo", 13, GURL("https://1_folder_resumable_create_media_link"), - FilePath(FILE_PATH_LITERAL("drive/Directory 1")), + base::FilePath(FILE_PATH_LITERAL("drive/Directory 1")), "etag_ignored"), base::Bind(&test_util::CopyResultsFromInitiateUploadCallback, &error, @@ -1123,7 +1126,7 @@ TEST_F(FakeDriveServiceTest, InitiateUpload_WrongETag) { "text/plain", 13, GURL("https://2_file_link_resumable_create_media"), - FilePath(FILE_PATH_LITERAL("drive/File 1.txt")), + base::FilePath(FILE_PATH_LITERAL("drive/File 1.txt")), "invalid_etag"), base::Bind(&test_util::CopyResultsFromInitiateUploadCallback, &error, @@ -1146,7 +1149,7 @@ TEST_F(FakeDriveServiceTest, InitiateUpload_ExistingFile) { "text/plain", 13, GURL("https://2_file_link_resumable_create_media"), - FilePath(FILE_PATH_LITERAL("drive/File 1.txt")), + base::FilePath(FILE_PATH_LITERAL("drive/File 1.txt")), "\"HhMOFgxXHit7ImBr\""), base::Bind(&test_util::CopyResultsFromInitiateUploadCallback, &error, @@ -1170,7 +1173,7 @@ TEST_F(FakeDriveServiceTest, ResumeUpload_Offline) { "test/foo", 15, GURL("https://1_folder_resumable_create_media_link"), - FilePath(FILE_PATH_LITERAL("drive/Directory 1/new file.foo")), + base::FilePath(FILE_PATH_LITERAL("drive/Directory 1/new file.foo")), "etag_ignored"), base::Bind(&test_util::CopyResultsFromInitiateUploadCallback, &error, @@ -1191,7 +1194,7 @@ TEST_F(FakeDriveServiceTest, ResumeUpload_Offline) { 0, 13, 15, "test/foo", scoped_refptr<net::IOBuffer>(), upload_location, - FilePath(FILE_PATH_LITERAL( + base::FilePath(FILE_PATH_LITERAL( "drive/Directory 1/new file.foo"))), base::Bind(&test_util::CopyResultsFromUploadRangeCallback, &response, &entry)); @@ -1213,7 +1216,7 @@ TEST_F(FakeDriveServiceTest, ResumeUpload_NotFound) { "test/foo", 15, GURL("https://1_folder_resumable_create_media_link"), - FilePath(FILE_PATH_LITERAL("drive/Directory 1/new file.foo")), + base::FilePath(FILE_PATH_LITERAL("drive/Directory 1/new file.foo")), "etag_ignored"), base::Bind(&test_util::CopyResultsFromInitiateUploadCallback, &error, @@ -1229,7 +1232,7 @@ TEST_F(FakeDriveServiceTest, ResumeUpload_NotFound) { 0, 13, 15, "test/foo", scoped_refptr<net::IOBuffer>(), GURL("https://foo.com/"), - FilePath(FILE_PATH_LITERAL( + base::FilePath(FILE_PATH_LITERAL( "drive/Directory 1/new file.foo"))), base::Bind(&test_util::CopyResultsFromUploadRangeCallback, &response, &entry)); @@ -1251,7 +1254,7 @@ TEST_F(FakeDriveServiceTest, ResumeUpload_ExistingFile) { "text/plain", 15, GURL("https://2_file_link_resumable_create_media"), - FilePath(FILE_PATH_LITERAL("drive/File 1.txt")), + base::FilePath(FILE_PATH_LITERAL("drive/File 1.txt")), "\"HhMOFgxXHit7ImBr\""), base::Bind(&test_util::CopyResultsFromInitiateUploadCallback, &error, @@ -1267,7 +1270,7 @@ TEST_F(FakeDriveServiceTest, ResumeUpload_ExistingFile) { 0, 13, 15, "text/plain", scoped_refptr<net::IOBuffer>(), upload_location, - FilePath(FILE_PATH_LITERAL( + base::FilePath(FILE_PATH_LITERAL( "drive/File 1.txt"))), base::Bind(&test_util::CopyResultsFromUploadRangeCallback, &response, &entry)); @@ -1281,7 +1284,7 @@ TEST_F(FakeDriveServiceTest, ResumeUpload_ExistingFile) { 14, 15, 15, "text/plain", scoped_refptr<net::IOBuffer>(), upload_location, - FilePath(FILE_PATH_LITERAL( + base::FilePath(FILE_PATH_LITERAL( "drive/File 1.txt"))), base::Bind(&test_util::CopyResultsFromUploadRangeCallback, &response, &entry)); @@ -1305,7 +1308,7 @@ TEST_F(FakeDriveServiceTest, ResumeUpload_NewFile) { "test/foo", 15, GURL("https://1_folder_resumable_create_media_link"), - FilePath(FILE_PATH_LITERAL("drive/Directory 1/new file.foo")), + base::FilePath(FILE_PATH_LITERAL("drive/Directory 1/new file.foo")), "etag_ignored"), base::Bind(&test_util::CopyResultsFromInitiateUploadCallback, &error, @@ -1324,7 +1327,7 @@ TEST_F(FakeDriveServiceTest, ResumeUpload_NewFile) { 0, 13, 15, "test/foo", scoped_refptr<net::IOBuffer>(), upload_location, - FilePath(FILE_PATH_LITERAL( + base::FilePath(FILE_PATH_LITERAL( "drive/Directory 1/new file.foo"))), base::Bind(&test_util::CopyResultsFromUploadRangeCallback, &response, &entry)); @@ -1338,7 +1341,7 @@ TEST_F(FakeDriveServiceTest, ResumeUpload_NewFile) { 14, 15, 15, "test/foo", scoped_refptr<net::IOBuffer>(), upload_location, - FilePath(FILE_PATH_LITERAL( + base::FilePath(FILE_PATH_LITERAL( "drive/Directory 1/new file.foo"))), base::Bind(&test_util::CopyResultsFromUploadRangeCallback, &response, &entry)); diff --git a/chrome/browser/google_apis/gdata_wapi_operations.cc b/chrome/browser/google_apis/gdata_wapi_operations.cc index 3ed0d89..f24cdcd 100644 --- a/chrome/browser/google_apis/gdata_wapi_operations.cc +++ b/chrome/browser/google_apis/gdata_wapi_operations.cc @@ -70,7 +70,7 @@ ResumeUploadParams::ResumeUploadParams( const std::string& content_type, scoped_refptr<net::IOBuffer> buf, const GURL& upload_location, - const FilePath& drive_file_path) : upload_mode(upload_mode), + const base::FilePath& drive_file_path) : upload_mode(upload_mode), start_position(start_position), end_position(end_position), content_length(content_length), @@ -472,7 +472,7 @@ InitiateUploadNewFileOperation::InitiateUploadNewFileOperation( OperationRegistry* registry, net::URLRequestContextGetter* url_request_context_getter, const InitiateUploadCallback& callback, - const FilePath& drive_file_path, + const base::FilePath& drive_file_path, const std::string& content_type, int64 content_length, const GURL& parent_upload_url, @@ -523,7 +523,7 @@ InitiateUploadExistingFileOperation::InitiateUploadExistingFileOperation( OperationRegistry* registry, net::URLRequestContextGetter* url_request_context_getter, const InitiateUploadCallback& callback, - const FilePath& drive_file_path, + const base::FilePath& drive_file_path, const std::string& content_type, int64 content_length, const GURL& upload_url, @@ -576,7 +576,7 @@ UploadRangeOperationBase::UploadRangeOperationBase( net::URLRequestContextGetter* url_request_context_getter, const UploadRangeCallback& callback, const UploadMode upload_mode, - const FilePath& drive_file_path, + const base::FilePath& drive_file_path, const GURL& upload_url) : UrlFetchOperationBase(registry, url_request_context_getter, diff --git a/chrome/browser/google_apis/gdata_wapi_operations.h b/chrome/browser/google_apis/gdata_wapi_operations.h index 2b3dd7e..44cb4bb 100644 --- a/chrome/browser/google_apis/gdata_wapi_operations.h +++ b/chrome/browser/google_apis/gdata_wapi_operations.h @@ -360,7 +360,7 @@ class InitiateUploadNewFileOperation : public InitiateUploadOperationBase { OperationRegistry* registry, net::URLRequestContextGetter* url_request_context_getter, const InitiateUploadCallback& callback, - const FilePath& drive_file_path, + const base::FilePath& drive_file_path, const std::string& content_type, int64 content_length, const GURL& parent_upload_url, @@ -398,7 +398,7 @@ class InitiateUploadExistingFileOperation OperationRegistry* registry, net::URLRequestContextGetter* url_request_context_getter, const InitiateUploadCallback& callback, - const FilePath& drive_file_path, + const base::FilePath& drive_file_path, const std::string& content_type, int64 content_length, const GURL& upload_url, @@ -463,7 +463,7 @@ class UploadRangeOperationBase : public UrlFetchOperationBase { net::URLRequestContextGetter* url_request_context_getter, const UploadRangeCallback& callback, const UploadMode upload_mode, - const FilePath& drive_file_path, + const base::FilePath& drive_file_path, const GURL& upload_url); virtual ~UploadRangeOperationBase(); @@ -481,7 +481,7 @@ class UploadRangeOperationBase : public UrlFetchOperationBase { const UploadRangeCallback callback_; const UploadMode upload_mode_; - const FilePath drive_file_path_; + const base::FilePath drive_file_path_; const GURL upload_url_; bool last_chunk_completed_; @@ -504,7 +504,7 @@ struct ResumeUploadParams { const std::string& content_type, scoped_refptr<net::IOBuffer> buf, const GURL& upload_location, - const FilePath& drive_file_path); + const base::FilePath& drive_file_path); ~ResumeUploadParams(); const UploadMode upload_mode; // Mode of the upload. @@ -522,7 +522,7 @@ struct ResumeUploadParams { // Drive file path of the file seen in the UI. Not necessary for // resuming an upload, but used for adding an entry to OperationRegistry. // TODO(satorux): Remove the drive file path hack. crbug.com/163296 - const FilePath drive_file_path; + const base::FilePath drive_file_path; }; // This class performs the operation for resuming the upload of a file. diff --git a/chrome/browser/google_apis/gdata_wapi_operations_unittest.cc b/chrome/browser/google_apis/gdata_wapi_operations_unittest.cc index 0af98fb..79eb676 100644 --- a/chrome/browser/google_apis/gdata_wapi_operations_unittest.cc +++ b/chrome/browser/google_apis/gdata_wapi_operations_unittest.cc @@ -781,7 +781,7 @@ TEST_F(GDataWapiOperationsTest, UploadNewFile) { base::Bind(&CopyResultFromInitiateUploadCallbackAndQuit, &result_code, &upload_url), - FilePath::FromUTF8Unsafe("drive/newfile.txt"), + base::FilePath::FromUTF8Unsafe("drive/newfile.txt"), "text/plain", kUploadContent.size(), test_server_.GetURL( @@ -823,7 +823,7 @@ TEST_F(GDataWapiOperationsTest, UploadNewFile) { "text/plain", // content_type buffer, upload_url, - FilePath::FromUTF8Unsafe("drive/newfile.txt")); + base::FilePath::FromUTF8Unsafe("drive/newfile.txt")); UploadRangeResponse response; scoped_ptr<ResourceEntry> new_entry; @@ -880,7 +880,7 @@ TEST_F(GDataWapiOperationsTest, UploadNewLargeFile) { base::Bind(&CopyResultFromInitiateUploadCallbackAndQuit, &result_code, &upload_url), - FilePath::FromUTF8Unsafe("drive/newfile.txt"), + base::FilePath::FromUTF8Unsafe("drive/newfile.txt"), "text/plain", kUploadContent.size(), test_server_.GetURL( @@ -935,7 +935,7 @@ TEST_F(GDataWapiOperationsTest, UploadNewLargeFile) { "text/plain", // content_type buffer, upload_url, - FilePath::FromUTF8Unsafe("drive/newfile.txt")); + base::FilePath::FromUTF8Unsafe("drive/newfile.txt")); UploadRangeResponse response; scoped_ptr<ResourceEntry> new_entry; @@ -1004,7 +1004,7 @@ TEST_F(GDataWapiOperationsTest, UploadNewEmptyFile) { base::Bind(&CopyResultFromInitiateUploadCallbackAndQuit, &result_code, &upload_url), - FilePath::FromUTF8Unsafe("drive/newfile.txt"), + base::FilePath::FromUTF8Unsafe("drive/newfile.txt"), "text/plain", kUploadContent.size(), test_server_.GetURL( @@ -1046,7 +1046,7 @@ TEST_F(GDataWapiOperationsTest, UploadNewEmptyFile) { "text/plain", // content_type buffer, upload_url, - FilePath::FromUTF8Unsafe("drive/newfile.txt")); + base::FilePath::FromUTF8Unsafe("drive/newfile.txt")); UploadRangeResponse response; scoped_ptr<ResourceEntry> new_entry; @@ -1097,7 +1097,7 @@ TEST_F(GDataWapiOperationsTest, UploadExistingFile) { base::Bind(&CopyResultFromInitiateUploadCallbackAndQuit, &result_code, &upload_url), - FilePath::FromUTF8Unsafe("drive/existingfile.txt"), + base::FilePath::FromUTF8Unsafe("drive/existingfile.txt"), "text/plain", kUploadContent.size(), test_server_.GetURL( @@ -1139,7 +1139,7 @@ TEST_F(GDataWapiOperationsTest, UploadExistingFile) { "text/plain", // content_type buffer, upload_url, - FilePath::FromUTF8Unsafe("drive/existingfile.txt")); + base::FilePath::FromUTF8Unsafe("drive/existingfile.txt")); UploadRangeResponse response; scoped_ptr<ResourceEntry> new_entry; @@ -1192,7 +1192,7 @@ TEST_F(GDataWapiOperationsTest, UploadExistingFileWithETag) { base::Bind(&CopyResultFromInitiateUploadCallbackAndQuit, &result_code, &upload_url), - FilePath::FromUTF8Unsafe("drive/existingfile.txt"), + base::FilePath::FromUTF8Unsafe("drive/existingfile.txt"), "text/plain", kUploadContent.size(), test_server_.GetURL( @@ -1234,7 +1234,7 @@ TEST_F(GDataWapiOperationsTest, UploadExistingFileWithETag) { "text/plain", // content_type buffer, upload_url, - FilePath::FromUTF8Unsafe("drive/existingfile.txt")); + base::FilePath::FromUTF8Unsafe("drive/existingfile.txt")); UploadRangeResponse response; scoped_ptr<ResourceEntry> new_entry; @@ -1287,7 +1287,7 @@ TEST_F(GDataWapiOperationsTest, UploadExistingFileWithETagConflict) { base::Bind(&CopyResultFromInitiateUploadCallbackAndQuit, &result_code, &upload_url), - FilePath::FromUTF8Unsafe("drive/existingfile.txt"), + base::FilePath::FromUTF8Unsafe("drive/existingfile.txt"), "text/plain", kUploadContent.size(), test_server_.GetURL( diff --git a/chrome/browser/google_apis/gdata_wapi_parser.cc b/chrome/browser/google_apis/gdata_wapi_parser.cc index ebe5af2..1290947 100644 --- a/chrome/browser/google_apis/gdata_wapi_parser.cc +++ b/chrome/browser/google_apis/gdata_wapi_parser.cc @@ -578,7 +578,7 @@ std::string ResourceEntry::GetHostedDocumentExtension() const { } // static -bool ResourceEntry::HasHostedDocumentExtension(const FilePath& file) { +bool ResourceEntry::HasHostedDocumentExtension(const base::FilePath& file) { #if defined(OS_WIN) std::string file_extension = WideToUTF8(file.Extension()); #else diff --git a/chrome/browser/google_apis/gdata_wapi_parser_unittest.cc b/chrome/browser/google_apis/gdata_wapi_parser_unittest.cc index 64b656b..4824d5b 100644 --- a/chrome/browser/google_apis/gdata_wapi_parser_unittest.cc +++ b/chrome/browser/google_apis/gdata_wapi_parser_unittest.cc @@ -308,23 +308,23 @@ TEST(GDataWAPIParserTest, AccountMetadataFeedParser) { // Test file extension checking in ResourceEntry::HasDocumentExtension(). TEST(GDataWAPIParserTest, ResourceEntryHasDocumentExtension) { EXPECT_TRUE(ResourceEntry::HasHostedDocumentExtension( - FilePath(FILE_PATH_LITERAL("Test.gdoc")))); + base::FilePath(FILE_PATH_LITERAL("Test.gdoc")))); EXPECT_TRUE(ResourceEntry::HasHostedDocumentExtension( - FilePath(FILE_PATH_LITERAL("Test.gsheet")))); + base::FilePath(FILE_PATH_LITERAL("Test.gsheet")))); EXPECT_TRUE(ResourceEntry::HasHostedDocumentExtension( - FilePath(FILE_PATH_LITERAL("Test.gslides")))); + base::FilePath(FILE_PATH_LITERAL("Test.gslides")))); EXPECT_TRUE(ResourceEntry::HasHostedDocumentExtension( - FilePath(FILE_PATH_LITERAL("Test.gdraw")))); + base::FilePath(FILE_PATH_LITERAL("Test.gdraw")))); EXPECT_TRUE(ResourceEntry::HasHostedDocumentExtension( - FilePath(FILE_PATH_LITERAL("Test.gtable")))); + base::FilePath(FILE_PATH_LITERAL("Test.gtable")))); EXPECT_FALSE(ResourceEntry::HasHostedDocumentExtension( - FilePath(FILE_PATH_LITERAL("Test.tar.gz")))); + base::FilePath(FILE_PATH_LITERAL("Test.tar.gz")))); EXPECT_FALSE(ResourceEntry::HasHostedDocumentExtension( - FilePath(FILE_PATH_LITERAL("Test.txt")))); + base::FilePath(FILE_PATH_LITERAL("Test.txt")))); EXPECT_FALSE(ResourceEntry::HasHostedDocumentExtension( - FilePath(FILE_PATH_LITERAL("Test")))); + base::FilePath(FILE_PATH_LITERAL("Test")))); EXPECT_FALSE(ResourceEntry::HasHostedDocumentExtension( - FilePath(FILE_PATH_LITERAL("")))); + base::FilePath(FILE_PATH_LITERAL("")))); } TEST(GDataWAPIParserTest, ResourceEntryClassifyEntryKind) { diff --git a/chrome/browser/google_apis/gdata_wapi_service.cc b/chrome/browser/google_apis/gdata_wapi_service.cc index de2c470..a599bc5 100644 --- a/chrome/browser/google_apis/gdata_wapi_service.cc +++ b/chrome/browser/google_apis/gdata_wapi_service.cc @@ -217,7 +217,7 @@ void GDataWapiService::CancelAll() { runner_->CancelAll(); } -bool GDataWapiService::CancelForFilePath(const FilePath& file_path) { +bool GDataWapiService::CancelForFilePath(const base::FilePath& file_path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); return operation_registry()->CancelForFilePath(file_path); } @@ -291,8 +291,8 @@ void GDataWapiService::GetAppList(const GetAppListCallback& callback) { } void GDataWapiService::DownloadFile( - const FilePath& virtual_path, - const FilePath& local_cache_path, + const base::FilePath& virtual_path, + const base::FilePath& local_cache_path, const GURL& download_url, const DownloadActionCallback& download_action_callback, const GetContentCallback& get_content_callback) { @@ -461,7 +461,7 @@ void GDataWapiService::ResumeUpload(const ResumeUploadParams& params, void GDataWapiService::GetUploadStatus( UploadMode upload_mode, - const FilePath& drive_file_path, + const base::FilePath& drive_file_path, const GURL& upload_url, int64 content_length, const UploadRangeCallback& callback) { diff --git a/chrome/browser/google_apis/gdata_wapi_service.h b/chrome/browser/google_apis/gdata_wapi_service.h index 3f0137d..49895ac 100644 --- a/chrome/browser/google_apis/gdata_wapi_service.h +++ b/chrome/browser/google_apis/gdata_wapi_service.h @@ -115,7 +115,7 @@ class GDataWapiService : public DriveServiceInterface, const UploadRangeCallback& callback) OVERRIDE; virtual void GetUploadStatus( UploadMode upload_mode, - const FilePath& drive_file_path, + const base::FilePath& drive_file_path, const GURL& upload_url, int64 content_length, const UploadRangeCallback& callback) OVERRIDE; diff --git a/chrome/browser/google_apis/mock_drive_service.cc b/chrome/browser/google_apis/mock_drive_service.cc index 9507bd2..a49df27 100644 --- a/chrome/browser/google_apis/mock_drive_service.cc +++ b/chrome/browser/google_apis/mock_drive_service.cc @@ -156,8 +156,8 @@ void MockDriveService::CreateDirectoryStub( } void MockDriveService::DownloadFileStub( - const FilePath& virtual_path, - const FilePath& local_tmp_path, + const base::FilePath& virtual_path, + const base::FilePath& local_tmp_path, const GURL& download_url, const DownloadActionCallback& download_action_callback, const GetContentCallback& get_content_callback) { diff --git a/chrome/browser/google_apis/mock_drive_service.h b/chrome/browser/google_apis/mock_drive_service.h index ca12dfa..1539df9 100644 --- a/chrome/browser/google_apis/mock_drive_service.h +++ b/chrome/browser/google_apis/mock_drive_service.h @@ -88,7 +88,7 @@ class MockDriveService : public DriveServiceInterface { const UploadRangeCallback& callback)); MOCK_METHOD5(GetUploadStatus, void(UploadMode upload_mode, - const FilePath& drive_file_path, + const base::FilePath& drive_file_path, const GURL& upload_url, int64 content_length, const UploadRangeCallback& callback)); diff --git a/chrome/browser/google_apis/operation_registry.cc b/chrome/browser/google_apis/operation_registry.cc index b465e17..7f9353a 100644 --- a/chrome/browser/google_apis/operation_registry.cc +++ b/chrome/browser/google_apis/operation_registry.cc @@ -42,7 +42,7 @@ std::string OperationTransferStateToString(OperationTransferState state) { } OperationProgressStatus::OperationProgressStatus(OperationType type, - const FilePath& path) + const base::FilePath& path) : operation_id(-1), operation_type(type), file_path(path), @@ -70,12 +70,12 @@ std::string OperationProgressStatus::DebugString() const { OperationRegistry::Operation::Operation(OperationRegistry* registry) : registry_(registry), - progress_status_(OPERATION_OTHER, FilePath()) { + progress_status_(OPERATION_OTHER, base::FilePath()) { } OperationRegistry::Operation::Operation(OperationRegistry* registry, OperationType type, - const FilePath& path) + const base::FilePath& path) : registry_(registry), progress_status_(type, path) { } @@ -170,7 +170,7 @@ void OperationRegistry::CancelAll() { } } -bool OperationRegistry::CancelForFilePath(const FilePath& file_path) { +bool OperationRegistry::CancelForFilePath(const base::FilePath& file_path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); for (OperationIDMap::iterator iter(&in_flight_operations_); diff --git a/chrome/browser/google_apis/operation_registry.h b/chrome/browser/google_apis/operation_registry.h index 03b3811..2d43658 100644 --- a/chrome/browser/google_apis/operation_registry.h +++ b/chrome/browser/google_apis/operation_registry.h @@ -47,7 +47,7 @@ std::string OperationTransferStateToString(OperationTransferState state); // Structure that packs progress information of each operation. struct OperationProgressStatus { - OperationProgressStatus(OperationType type, const FilePath& file_path); + OperationProgressStatus(OperationType type, const base::FilePath& file_path); // For debugging std::string DebugString() const; @@ -56,7 +56,7 @@ struct OperationProgressStatus { // Type of the operation: upload/download. OperationType operation_type; // GData path of the file dealt with the current operation. - FilePath file_path; + base::FilePath file_path; // Current state of the transfer; OperationTransferState transfer_state; // The time when the operation is initiated. @@ -85,7 +85,7 @@ class OperationRegistry { explicit Operation(OperationRegistry* registry); Operation(OperationRegistry* registry, OperationType type, - const FilePath& file_path); + const base::FilePath& file_path); virtual ~Operation(); // Cancels the ongoing operation. NotifyFinish() is called and the Operation @@ -125,7 +125,7 @@ class OperationRegistry { // Cancels ongoing operation for a given virtual |file_path|. Returns true if // the operation was found and canceled. - bool CancelForFilePath(const FilePath& file_path); + bool CancelForFilePath(const base::FilePath& file_path); // Obtains the list of currently active operations. OperationProgressStatusList GetProgressStatusList(); diff --git a/chrome/browser/google_apis/operation_registry_unittest.cc b/chrome/browser/google_apis/operation_registry_unittest.cc index 6d80a68..ea8d3f3 100644 --- a/chrome/browser/google_apis/operation_registry_unittest.cc +++ b/chrome/browser/google_apis/operation_registry_unittest.cc @@ -23,7 +23,7 @@ class MockOperation : public OperationRegistry::Operation, public: MockOperation(OperationRegistry* registry, OperationType type, - const FilePath& path) + const base::FilePath& path) : OperationRegistry::Operation(registry, type, path) {} MOCK_METHOD0(DoCancel, void()); @@ -39,7 +39,7 @@ class MockUploadOperation : public MockOperation { explicit MockUploadOperation(OperationRegistry* registry) : MockOperation(registry, OPERATION_UPLOAD, - FilePath(FILE_PATH_LITERAL("/dummy/upload"))) {} + base::FilePath(FILE_PATH_LITERAL("/dummy/upload"))) {} }; class MockDownloadOperation : public MockOperation { @@ -47,7 +47,7 @@ class MockDownloadOperation : public MockOperation { explicit MockDownloadOperation(OperationRegistry* registry) : MockOperation(registry, OPERATION_DOWNLOAD, - FilePath(FILE_PATH_LITERAL("/dummy/download"))) {} + base::FilePath(FILE_PATH_LITERAL("/dummy/download"))) {} }; class MockOtherOperation : public MockOperation { @@ -55,7 +55,7 @@ class MockOtherOperation : public MockOperation { explicit MockOtherOperation(OperationRegistry* registry) : MockOperation(registry, OPERATION_OTHER, - FilePath(FILE_PATH_LITERAL("/dummy/other"))) {} + base::FilePath(FILE_PATH_LITERAL("/dummy/other"))) {} }; class TestObserver : public OperationRegistryObserver { diff --git a/chrome/browser/google_apis/test_util.cc b/chrome/browser/google_apis/test_util.cc index b674c85..c7a8e2d 100644 --- a/chrome/browser/google_apis/test_util.cc +++ b/chrome/browser/google_apis/test_util.cc @@ -55,15 +55,15 @@ bool RemovePrefix(const std::string& input, return true; } -FilePath GetTestFilePath(const std::string& relative_path) { - FilePath path; +base::FilePath GetTestFilePath(const std::string& relative_path) { + base::FilePath path; if (!PathService::Get(base::DIR_SOURCE_ROOT, &path)) - return FilePath(); + return base::FilePath(); path = path.AppendASCII("chrome") .AppendASCII("test") .AppendASCII("data") .AppendASCII("chromeos") - .Append(FilePath::FromUTF8Unsafe(relative_path)); + .Append(base::FilePath::FromUTF8Unsafe(relative_path)); return path; } @@ -85,7 +85,7 @@ void RunBlockingPoolTask() { } scoped_ptr<base::Value> LoadJSONFile(const std::string& relative_path) { - FilePath path = GetTestFilePath(relative_path); + base::FilePath path = GetTestFilePath(relative_path); std::string error; JSONFileValueSerializer serializer(path); @@ -161,9 +161,9 @@ void CopyResultsFromGetAppListCallback( void CopyResultsFromDownloadActionCallback( GDataErrorCode* error_out, - FilePath* temp_file_out, + base::FilePath* temp_file_out, GDataErrorCode error_in, - const FilePath& temp_file_in) { + const base::FilePath& temp_file_in) { *error_out = error_in; *temp_file_out = temp_file_in; } @@ -188,7 +188,7 @@ void CopyResultsFromUploadRangeCallback( // Returns a HttpResponse created from the given file path. scoped_ptr<test_server::HttpResponse> CreateHttpResponseFromFile( - const FilePath& file_path) { + const base::FilePath& file_path) { std::string content; if (!file_util::ReadFileToString(file_path, &content)) return scoped_ptr<test_server::HttpResponse>(); @@ -226,7 +226,7 @@ scoped_ptr<test_server::HttpResponse> HandleDownloadRequest( return CreateHttpResponseFromFile(GetTestFilePath(remaining_path)); } -bool VerifyJsonData(const FilePath& expected_json_file_path, +bool VerifyJsonData(const base::FilePath& expected_json_file_path, const base::Value* json_data) { if (!json_data) { LOG(ERROR) << "json_data is NULL"; diff --git a/chrome/browser/history/android/android_cache_database.cc b/chrome/browser/history/android/android_cache_database.cc index ec75e0c..32a6c93 100644 --- a/chrome/browser/history/android/android_cache_database.cc +++ b/chrome/browser/history/android/android_cache_database.cc @@ -20,7 +20,7 @@ AndroidCacheDatabase::~AndroidCacheDatabase() { } sql::InitStatus AndroidCacheDatabase::InitAndroidCacheDatabase( - const FilePath& db_name) { + const base::FilePath& db_name) { if (!CreateDatabase(db_name)) return sql::INIT_FAILURE; @@ -171,7 +171,7 @@ bool AndroidCacheDatabase::DeleteUnusedSearchTerms() { return statement.Run(); } -bool AndroidCacheDatabase::CreateDatabase(const FilePath& db_name) { +bool AndroidCacheDatabase::CreateDatabase(const base::FilePath& db_name) { db_name_ = db_name; if (file_util::PathExists(db_name_)) file_util::Delete(db_name_, false); diff --git a/chrome/browser/history/android/android_cache_database.h b/chrome/browser/history/android/android_cache_database.h index 87cc37a..829efb3 100644 --- a/chrome/browser/history/android/android_cache_database.h +++ b/chrome/browser/history/android/android_cache_database.h @@ -25,7 +25,7 @@ class AndroidCacheDatabase { // Creates the database, deletes existing one if any; also attach it to the // database returned by GetDB(). Returns sql::INIT_OK on success, otherwise // sql::INIT_FAILURE returned. - sql::InitStatus InitAndroidCacheDatabase(const FilePath& db_name); + sql::InitStatus InitAndroidCacheDatabase(const base::FilePath& db_name); // The bookmark_cache table ------------------------------------------------ // @@ -73,7 +73,7 @@ class AndroidCacheDatabase { // Creates the database and make it ready for attaching; returns true on // success. - bool CreateDatabase(const FilePath& db_name); + bool CreateDatabase(const base::FilePath& db_name); // Creates the bookmark_cache table in attached DB; returns true on success. // The created_time, last_visit_time, favicon_id and bookmark are stored. @@ -110,7 +110,7 @@ class AndroidCacheDatabase { // Does the real attach. Returns true on success. bool DoAttach(); - FilePath db_name_; + base::FilePath db_name_; DISALLOW_COPY_AND_ASSIGN(AndroidCacheDatabase); }; diff --git a/chrome/browser/history/android/android_cache_database_unittest.cc b/chrome/browser/history/android/android_cache_database_unittest.cc index 4e4b44e..77382a8 100644 --- a/chrome/browser/history/android/android_cache_database_unittest.cc +++ b/chrome/browser/history/android/android_cache_database_unittest.cc @@ -28,7 +28,8 @@ class AndroidCacheDatabaseTest : public testing::Test { virtual void SetUp() { // Get a temporary directory for the test DB files. ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); - FilePath history_db_name_ = temp_dir_.path().AppendASCII("history.db"); + base::FilePath history_db_name_ = + temp_dir_.path().AppendASCII("history.db"); android_cache_db_name_ = temp_dir_.path().AppendASCII( "TestAndroidCache.db"); ASSERT_EQ(sql::INIT_OK, history_db_.Init(history_db_name_, NULL)); @@ -37,16 +38,16 @@ class AndroidCacheDatabaseTest : public testing::Test { } base::ScopedTempDir temp_dir_; - FilePath android_cache_db_name_; + base::FilePath android_cache_db_name_; HistoryDatabase history_db_; }; TEST(AndroidCacheDatabaseAttachTest, AttachDatabaseInTransactionNesting) { base::ScopedTempDir temp_dir; - FilePath android_cache_db_name; + base::FilePath android_cache_db_name; HistoryDatabase history_db; ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); - FilePath history_db_name = temp_dir.path().AppendASCII("history.db"); + base::FilePath history_db_name = temp_dir.path().AppendASCII("history.db"); android_cache_db_name = temp_dir.path().AppendASCII( "TestAndroidCache.db"); ASSERT_EQ(sql::INIT_OK, history_db.Init(history_db_name, NULL)); diff --git a/chrome/browser/history/android/android_provider_backend.cc b/chrome/browser/history/android/android_provider_backend.cc index 5279203..9548e74 100644 --- a/chrome/browser/history/android/android_provider_backend.cc +++ b/chrome/browser/history/android/android_provider_backend.cc @@ -115,7 +115,7 @@ bool IsHistoryAndBookmarkRowValid(const HistoryAndBookmarkRow& row) { } // namespace AndroidProviderBackend::AndroidProviderBackend( - const FilePath& db_name, + const base::FilePath& db_name, HistoryDatabase* history_db, ThumbnailDatabase* thumbnail_db, BookmarkService* bookmark_service, diff --git a/chrome/browser/history/android/android_provider_backend.h b/chrome/browser/history/android/android_provider_backend.h index c6d0921..bc1ab16 100644 --- a/chrome/browser/history/android/android_provider_backend.h +++ b/chrome/browser/history/android/android_provider_backend.h @@ -45,7 +45,7 @@ class ThumbnailDatabase; // The android_cache database is deleted when shutdown. class AndroidProviderBackend { public: - AndroidProviderBackend(const FilePath& cache_db_name, + AndroidProviderBackend(const base::FilePath& cache_db_name, HistoryDatabase* history_db, ThumbnailDatabase* thumbnail_db, BookmarkService* bookmark_service, @@ -328,7 +328,7 @@ class AndroidProviderBackend { std::vector<SQLHandler*> sql_handlers_; // Android cache database filename. - const FilePath android_cache_db_filename_; + const base::FilePath android_cache_db_filename_; // The history db's connection. sql::Connection* db_; diff --git a/chrome/browser/history/android/android_provider_backend_unittest.cc b/chrome/browser/history/android/android_provider_backend_unittest.cc index e383100..be9e0c9 100644 --- a/chrome/browser/history/android/android_provider_backend_unittest.cc +++ b/chrome/browser/history/android/android_provider_backend_unittest.cc @@ -189,9 +189,9 @@ class AndroidProviderBackendTest : public testing::Test { HistoryDatabase history_db_; ThumbnailDatabase thumbnail_db_; base::ScopedTempDir temp_dir_; - FilePath android_cache_db_name_; - FilePath history_db_name_; - FilePath thumbnail_db_name_; + base::FilePath android_cache_db_name_; + base::FilePath history_db_name_; + base::FilePath thumbnail_db_name_; TestingProfileManager profile_manager_; BookmarkModel* bookmark_model_; diff --git a/chrome/browser/history/android/android_urls_database_unittest.cc b/chrome/browser/history/android/android_urls_database_unittest.cc index 284db97..cfe7a32 100644 --- a/chrome/browser/history/android/android_urls_database_unittest.cc +++ b/chrome/browser/history/android/android_urls_database_unittest.cc @@ -27,7 +27,7 @@ class AndroidURLsMigrationTest : public HistoryUnitTestBase { virtual void SetUp() { profile_.reset(new TestingProfile); - FilePath data_path; + base::FilePath data_path; ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &data_path)); data_path = data_path.AppendASCII("History"); @@ -39,7 +39,7 @@ class AndroidURLsMigrationTest : public HistoryUnitTestBase { } protected: - FilePath history_db_name_; + base::FilePath history_db_name_; scoped_ptr<TestingProfile> profile_; }; diff --git a/chrome/browser/history/android/bookmark_model_sql_handler_unittest.cc b/chrome/browser/history/android/bookmark_model_sql_handler_unittest.cc index 8ae87bb..84a80a3 100644 --- a/chrome/browser/history/android/bookmark_model_sql_handler_unittest.cc +++ b/chrome/browser/history/android/bookmark_model_sql_handler_unittest.cc @@ -56,7 +56,7 @@ class BookmarkModelSQLHandlerTest : public testing::Test { // Create the directory for history database. ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); - FilePath history_db_name = temp_dir_.path().AppendASCII( + base::FilePath history_db_name = temp_dir_.path().AppendASCII( chrome::kHistoryFilename); history_db_.Init(history_db_name, NULL); } diff --git a/chrome/browser/history/android/urls_sql_handler_unittest.cc b/chrome/browser/history/android/urls_sql_handler_unittest.cc index e2d8304..7d79a6e 100644 --- a/chrome/browser/history/android/urls_sql_handler_unittest.cc +++ b/chrome/browser/history/android/urls_sql_handler_unittest.cc @@ -34,7 +34,7 @@ class UrlsSQLHandlerTest : public testing::Test { virtual void SetUp() { // Get a temporary directory for the test DB files. ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); - FilePath history_db_name = temp_dir_.path().AppendASCII( + base::FilePath history_db_name = temp_dir_.path().AppendASCII( chrome::kHistoryFilename); ASSERT_EQ(sql::INIT_OK, history_db_.Init(history_db_name, NULL)); } diff --git a/chrome/browser/history/android/visit_sql_handler_unittest.cc b/chrome/browser/history/android/visit_sql_handler_unittest.cc index 6c12248..c54827a 100644 --- a/chrome/browser/history/android/visit_sql_handler_unittest.cc +++ b/chrome/browser/history/android/visit_sql_handler_unittest.cc @@ -34,7 +34,7 @@ class VisitSQLHandlerTest : public testing::Test { virtual void SetUp() { // Get a temporary directory for the test DB files. ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); - FilePath history_db_name = temp_dir_.path().AppendASCII( + base::FilePath history_db_name = temp_dir_.path().AppendASCII( chrome::kHistoryFilename); ASSERT_EQ(sql::INIT_OK, history_db_.Init(history_db_name, NULL)); } diff --git a/chrome/browser/history/download_database.cc b/chrome/browser/history/download_database.cc index 5c8a61b..0a0ba8f 100644 --- a/chrome/browser/history/download_database.cc +++ b/chrome/browser/history/download_database.cc @@ -164,21 +164,23 @@ content::DownloadDangerType IntToDangerType(int danger_type) { #if defined(OS_POSIX) // Binds/reads the given file path to the given column of the given statement. -void BindFilePath(sql::Statement& statement, const FilePath& path, int col) { +void BindFilePath(sql::Statement& statement, const base::FilePath& path, + int col) { statement.BindString(col, path.value()); } -FilePath ColumnFilePath(sql::Statement& statement, int col) { - return FilePath(statement.ColumnString(col)); +base::FilePath ColumnFilePath(sql::Statement& statement, int col) { + return base::FilePath(statement.ColumnString(col)); } #else // See above. -void BindFilePath(sql::Statement& statement, const FilePath& path, int col) { +void BindFilePath(sql::Statement& statement, const base::FilePath& path, + int col) { statement.BindString16(col, path.value()); } -FilePath ColumnFilePath(sql::Statement& statement, int col) { - return FilePath(statement.ColumnString16(col)); +base::FilePath ColumnFilePath(sql::Statement& statement, int col) { + return base::FilePath(statement.ColumnString16(col)); } #endif diff --git a/chrome/browser/history/download_row.cc b/chrome/browser/history/download_row.cc index d59258c..7858608 100644 --- a/chrome/browser/history/download_row.cc +++ b/chrome/browser/history/download_row.cc @@ -17,8 +17,8 @@ DownloadRow::DownloadRow() } DownloadRow::DownloadRow( - const FilePath& current_path, - const FilePath& target_path, + const base::FilePath& current_path, + const base::FilePath& target_path, const std::vector<GURL>& url_chain, const GURL& referrer, const base::Time& start, diff --git a/chrome/browser/history/download_row.h b/chrome/browser/history/download_row.h index 36f5575..f1435cb1 100644 --- a/chrome/browser/history/download_row.h +++ b/chrome/browser/history/download_row.h @@ -22,8 +22,8 @@ namespace history { struct DownloadRow { DownloadRow(); DownloadRow( - const FilePath& current_path, - const FilePath& target_path, + const base::FilePath& current_path, + const base::FilePath& target_path, const std::vector<GURL>& url_chain, const GURL& referrer, const base::Time& start, @@ -39,10 +39,10 @@ struct DownloadRow { // The current path to the download (potentially different from final if // download is in progress or interrupted). - FilePath current_path; + base::FilePath current_path; // The target path where the download will go when it's complete. - FilePath target_path; + base::FilePath target_path; // The URL redirect chain through which we are downloading. The front // is the url that the initial request went to, and the back is the diff --git a/chrome/browser/history/expire_history_backend.cc b/chrome/browser/history/expire_history_backend.cc index 836043a..7d27e78 100644 --- a/chrome/browser/history/expire_history_backend.cc +++ b/chrome/browser/history/expire_history_backend.cc @@ -729,12 +729,13 @@ void ExpireHistoryBackend::DoExpireHistoryIndexFiles() { TextDatabase::DBIdent cutoff_id = (cutoff_month / 12) * 100 + (cutoff_month % 12); - FilePath::StringType history_index_files_pattern = TextDatabase::file_base(); + base::FilePath::StringType history_index_files_pattern = + TextDatabase::file_base(); history_index_files_pattern.append(FILE_PATH_LITERAL("*")); file_util::FileEnumerator file_enumerator( text_db_->GetDir(), false, file_util::FileEnumerator::FILES, history_index_files_pattern); - for (FilePath file = file_enumerator.Next(); !file.empty(); + for (base::FilePath file = file_enumerator.Next(); !file.empty(); file = file_enumerator.Next()) { TextDatabase::DBIdent file_id = TextDatabase::FileNameToID(file); if (file_id < cutoff_id) diff --git a/chrome/browser/history/expire_history_backend_unittest.cc b/chrome/browser/history/expire_history_backend_unittest.cc index cb18bd9..3a9c08d 100644 --- a/chrome/browser/history/expire_history_backend_unittest.cc +++ b/chrome/browser/history/expire_history_backend_unittest.cc @@ -40,10 +40,11 @@ using base::TimeTicks; using content::BrowserThread; // Filename constants. -static const FilePath::CharType kHistoryFile[] = FILE_PATH_LITERAL("History"); -static const FilePath::CharType kArchivedHistoryFile[] = +static const base::FilePath::CharType kHistoryFile[] = + FILE_PATH_LITERAL("History"); +static const base::FilePath::CharType kArchivedHistoryFile[] = FILE_PATH_LITERAL("Archived History"); -static const FilePath::CharType kThumbnailFile[] = +static const base::FilePath::CharType kThumbnailFile[] = FILE_PATH_LITERAL("Thumbnails"); // The test must be in the history namespace for the gtest forward declarations @@ -93,10 +94,10 @@ class ExpireHistoryTest : public testing::Test, bookmark_model_.bookmark_bar_node(), 0, string16(), url); } - static bool IsStringInFile(const FilePath& filename, const char* str); + static bool IsStringInFile(const base::FilePath& filename, const char* str); // Returns the path the db files are created in. - const FilePath& path() const { return tmp_dir_.path(); } + const base::FilePath& path() const { return tmp_dir_.path(); } // This must be destroyed last. base::ScopedTempDir tmp_dir_; @@ -130,17 +131,17 @@ class ExpireHistoryTest : public testing::Test, virtual void SetUp() { ASSERT_TRUE(tmp_dir_.CreateUniqueTempDir()); - FilePath history_name = path().Append(kHistoryFile); + base::FilePath history_name = path().Append(kHistoryFile); main_db_.reset(new HistoryDatabase); if (main_db_->Init(history_name, NULL) != sql::INIT_OK) main_db_.reset(); - FilePath archived_name = path().Append(kArchivedHistoryFile); + base::FilePath archived_name = path().Append(kArchivedHistoryFile); archived_db_.reset(new ArchivedDatabase); if (!archived_db_->Init(archived_name)) archived_db_.reset(); - FilePath thumb_name = path().Append(kThumbnailFile); + base::FilePath thumb_name = path().Append(kThumbnailFile); thumb_db_.reset(new ThumbnailDatabase); if (thumb_db_->Init(thumb_name, NULL, main_db_.get()) != sql::INIT_OK) thumb_db_.reset(); @@ -434,7 +435,7 @@ TEST_F(ExpireHistoryTest, DeleteFaviconsIfPossible) { } // static -bool ExpireHistoryTest::IsStringInFile(const FilePath& filename, +bool ExpireHistoryTest::IsStringInFile(const base::FilePath& filename, const char* str) { std::string contents; EXPECT_TRUE(file_util::ReadFileToString(filename, &contents)); @@ -468,7 +469,7 @@ TEST_F(ExpireHistoryTest, DISABLED_DeleteURLAndFavicon) { visits[0].visit_time); // Compute the text DB filename. - FilePath fts_filename = path().Append( + base::FilePath fts_filename = path().Append( TextDatabase::IDToFileName(text_db_->TimeToID(visit_times[3]))); // When checking the file, the database must be closed. We then re-initialize diff --git a/chrome/browser/history/history_backend.cc b/chrome/browser/history/history_backend.cc index 7d3156c..727f839 100644 --- a/chrome/browser/history/history_backend.cc +++ b/chrome/browser/history/history_backend.cc @@ -254,7 +254,7 @@ class KillHistoryDatabaseErrorDelegate : public sql::ErrorDelegate { // HistoryBackend -------------------------------------------------------------- -HistoryBackend::HistoryBackend(const FilePath& history_dir, +HistoryBackend::HistoryBackend(const base::FilePath& history_dir, int id, Delegate* delegate, BookmarkService* bookmark_service) @@ -319,20 +319,20 @@ void HistoryBackend::NotifyRenderProcessHostDestruction(const void* host) { tracker_.NotifyRenderProcessHostDestruction(host); } -FilePath HistoryBackend::GetThumbnailFileName() const { +base::FilePath HistoryBackend::GetThumbnailFileName() const { return history_dir_.Append(chrome::kThumbnailsFilename); } -FilePath HistoryBackend::GetFaviconsFileName() const { +base::FilePath HistoryBackend::GetFaviconsFileName() const { return history_dir_.Append(chrome::kFaviconsFilename); } -FilePath HistoryBackend::GetArchivedFileName() const { +base::FilePath HistoryBackend::GetArchivedFileName() const { return history_dir_.Append(chrome::kArchivedHistoryFilename); } #if defined(OS_ANDROID) -FilePath HistoryBackend::GetAndroidCacheFileName() const { +base::FilePath HistoryBackend::GetAndroidCacheFileName() const { return history_dir_.Append(chrome::kAndroidCacheFilename); } #endif @@ -645,9 +645,9 @@ void HistoryBackend::InitImpl(const std::string& languages) { // Compute the file names. Note that the index file can be removed when the // text db manager is finished being hooked up. - FilePath history_name = history_dir_.Append(chrome::kHistoryFilename); - FilePath thumbnail_name = GetThumbnailFileName(); - FilePath archived_name = GetArchivedFileName(); + base::FilePath history_name = history_dir_.Append(chrome::kHistoryFilename); + base::FilePath thumbnail_name = GetThumbnailFileName(); + base::FilePath archived_name = GetArchivedFileName(); // History database. db_.reset(new HistoryDatabase()); @@ -2846,7 +2846,7 @@ void HistoryBackend::DeleteAllHistory() { if (archived_db_.get()) { // Close the database and delete the file. archived_db_.reset(); - FilePath archived_file_name = GetArchivedFileName(); + base::FilePath archived_file_name = GetArchivedFileName(); file_util::Delete(archived_file_name, false); // Now re-initialize the database (which may fail). diff --git a/chrome/browser/history/history_backend.h b/chrome/browser/history/history_backend.h index 58ee994..3437e27 100644 --- a/chrome/browser/history/history_backend.h +++ b/chrome/browser/history/history_backend.h @@ -120,7 +120,7 @@ class HistoryBackend : public base::RefCountedThreadSafe<HistoryBackend>, // may be NULL. // // This constructor is fast and does no I/O, so can be called at any time. - HistoryBackend(const FilePath& history_dir, + HistoryBackend(const base::FilePath& history_dir, int id, Delegate* delegate, BookmarkService* bookmark_service); @@ -540,17 +540,17 @@ class HistoryBackend : public base::RefCountedThreadSafe<HistoryBackend>, friend class ::TestingProfile; // Computes the name of the specified database on disk. - FilePath GetThumbnailFileName() const; + base::FilePath GetThumbnailFileName() const; // Returns the name of the Favicons database. This is the new name // of the Thumbnails database. // See ThumbnailDatabase::RenameAndDropThumbnails. - FilePath GetFaviconsFileName() const; - FilePath GetArchivedFileName() const; + base::FilePath GetFaviconsFileName() const; + base::FilePath GetArchivedFileName() const; #if defined(OS_ANDROID) // Returns the name of android cache database. - FilePath GetAndroidCacheFileName() const; + base::FilePath GetAndroidCacheFileName() const; #endif class URLQuerier; @@ -807,7 +807,7 @@ class HistoryBackend : public base::RefCountedThreadSafe<HistoryBackend>, int id_; // Directory where database files will be stored. - FilePath history_dir_; + base::FilePath history_dir_; // The history/thumbnail databases. Either MAY BE NULL if the database could // not be opened, all users must first check for NULL and return immediately diff --git a/chrome/browser/history/history_backend_unittest.cc b/chrome/browser/history/history_backend_unittest.cc index 5702b18..ba6c328 100644 --- a/chrome/browser/history/history_backend_unittest.cc +++ b/chrome/browser/history/history_backend_unittest.cc @@ -210,7 +210,7 @@ class HistoryBackendTest : public testing::Test { return visits[0].transition; } - FilePath getTestDir() { + base::FilePath getTestDir() { return test_dir_; } @@ -403,7 +403,7 @@ class HistoryBackendTest : public testing::Test { int num_broadcasted_notifications_; MessageLoop message_loop_; - FilePath test_dir_; + base::FilePath test_dir_; history::MostVisitedURLList most_visited_list_; history::FilteredURLList filtered_list_; }; @@ -1219,17 +1219,18 @@ TEST_F(HistoryBackendTest, MigrationVisitSource) { backend_->Closing(); backend_ = NULL; - FilePath old_history_path; + base::FilePath old_history_path; ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &old_history_path)); old_history_path = old_history_path.AppendASCII("History"); old_history_path = old_history_path.AppendASCII("HistoryNoSource"); // Copy history database file to current directory so that it will be deleted // in Teardown. - FilePath new_history_path(getTestDir()); + base::FilePath new_history_path(getTestDir()); file_util::Delete(new_history_path, true); file_util::CreateDirectory(new_history_path); - FilePath new_history_file = new_history_path.Append(chrome::kHistoryFilename); + base::FilePath new_history_file = + new_history_path.Append(chrome::kHistoryFilename); ASSERT_TRUE(file_util::CopyFile(old_history_path, new_history_file)); backend_ = new HistoryBackend(new_history_path, @@ -2403,7 +2404,7 @@ TEST_F(HistoryBackendTest, MigrationVisitDuration) { backend_->Closing(); backend_ = NULL; - FilePath old_history_path, old_history, old_archived; + base::FilePath old_history_path, old_history, old_archived; ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &old_history_path)); old_history_path = old_history_path.AppendASCII("History"); old_history = old_history_path.AppendASCII("HistoryNoDuration"); @@ -2411,11 +2412,12 @@ TEST_F(HistoryBackendTest, MigrationVisitDuration) { // Copy history database file to current directory so that it will be deleted // in Teardown. - FilePath new_history_path(getTestDir()); + base::FilePath new_history_path(getTestDir()); file_util::Delete(new_history_path, true); file_util::CreateDirectory(new_history_path); - FilePath new_history_file = new_history_path.Append(chrome::kHistoryFilename); - FilePath new_archived_file = + base::FilePath new_history_file = + new_history_path.Append(chrome::kHistoryFilename); + base::FilePath new_archived_file = new_history_path.Append(chrome::kArchivedHistoryFilename); ASSERT_TRUE(file_util::CopyFile(old_history, new_history_file)); ASSERT_TRUE(file_util::CopyFile(old_archived, new_archived_file)); diff --git a/chrome/browser/history/history_browsertest.cc b/chrome/browser/history/history_browsertest.cc index 15631e7..633f492 100644 --- a/chrome/browser/history/history_browsertest.cc +++ b/chrome/browser/history/history_browsertest.cc @@ -81,8 +81,8 @@ class HistoryBrowserTest : public InProcessBrowserTest { GURL GetTestUrl() { return ui_test_utils::GetTestUrl( - FilePath(FilePath::kCurrentDirectory), - FilePath(FILE_PATH_LITERAL("title2.html"))); + base::FilePath(base::FilePath::kCurrentDirectory), + base::FilePath(FILE_PATH_LITERAL("title2.html"))); } void WaitForHistoryBackendToRun() { @@ -111,8 +111,8 @@ class HistoryBrowserTest : public InProcessBrowserTest { void LoadAndWaitForFile(const char* filename) { GURL url = ui_test_utils::GetTestUrl( - FilePath().AppendASCII("History"), - FilePath().AppendASCII(filename)); + base::FilePath().AppendASCII("History"), + base::FilePath().AppendASCII(filename)); LoadAndWaitForURL(url); } }; @@ -303,8 +303,8 @@ IN_PROC_BROWSER_TEST_F(HistoryBrowserTest, HistoryPersists) { // Invalid URLs should not go in history. IN_PROC_BROWSER_TEST_F(HistoryBrowserTest, InvalidURLNoHistory) { GURL non_existant = ui_test_utils::GetTestUrl( - FilePath().AppendASCII("History"), - FilePath().AppendASCII("non_existant_file.html")); + base::FilePath().AppendASCII("History"), + base::FilePath().AppendASCII("non_existant_file.html")); ui_test_utils::NavigateToURL(browser(), non_existant); ExpectEmptyHistory(); } @@ -334,11 +334,11 @@ IN_PROC_BROWSER_TEST_F(HistoryBrowserTest, NavigateMultiTimes) { IN_PROC_BROWSER_TEST_F(HistoryBrowserTest, MultiTabsWindowsHistory) { GURL url1 = GetTestUrl(); GURL url2 = ui_test_utils::GetTestUrl( - FilePath(), FilePath(FILE_PATH_LITERAL("title1.html"))); + base::FilePath(), base::FilePath(FILE_PATH_LITERAL("title1.html"))); GURL url3 = ui_test_utils::GetTestUrl( - FilePath(), FilePath(FILE_PATH_LITERAL("title3.html"))); + base::FilePath(), base::FilePath(FILE_PATH_LITERAL("title3.html"))); GURL url4 = ui_test_utils::GetTestUrl( - FilePath(), FilePath(FILE_PATH_LITERAL("simple.html"))); + base::FilePath(), base::FilePath(FILE_PATH_LITERAL("simple.html"))); ui_test_utils::NavigateToURL(browser(), url1); Browser* browser2 = CreateBrowser(browser()->profile()); @@ -361,8 +361,8 @@ IN_PROC_BROWSER_TEST_F(HistoryBrowserTest, MultiTabsWindowsHistory) { // Downloaded URLs should not show up in history. IN_PROC_BROWSER_TEST_F(HistoryBrowserTest, DownloadNoHistory) { GURL download_url = ui_test_utils::GetTestUrl( - FilePath().AppendASCII("downloads"), - FilePath().AppendASCII("a_zip_file.zip")); + base::FilePath().AppendASCII("downloads"), + base::FilePath().AppendASCII("a_zip_file.zip")); ui_test_utils::DownloadURL(browser(), download_url); ExpectEmptyHistory(); } @@ -370,11 +370,11 @@ IN_PROC_BROWSER_TEST_F(HistoryBrowserTest, DownloadNoHistory) { // HTTP meta-refresh redirects should have separate history entries. IN_PROC_BROWSER_TEST_F(HistoryBrowserTest, RedirectHistory) { GURL redirector = ui_test_utils::GetTestUrl( - FilePath().AppendASCII("History"), - FilePath().AppendASCII("redirector.html")); + base::FilePath().AppendASCII("History"), + base::FilePath().AppendASCII("redirector.html")); GURL landing_url = ui_test_utils::GetTestUrl( - FilePath().AppendASCII("History"), - FilePath().AppendASCII("landing.html")); + base::FilePath().AppendASCII("History"), + base::FilePath().AppendASCII("landing.html")); ui_test_utils::NavigateToURLBlockUntilNavigationsComplete( browser(), redirector, 2); ASSERT_EQ(landing_url, @@ -389,7 +389,7 @@ IN_PROC_BROWSER_TEST_F(HistoryBrowserTest, RedirectHistory) { IN_PROC_BROWSER_TEST_F(HistoryBrowserTest, NavigateBringPageToTop) { GURL url1 = GetTestUrl(); GURL url2 = ui_test_utils::GetTestUrl( - FilePath(), FilePath(FILE_PATH_LITERAL("title3.html"))); + base::FilePath(), base::FilePath(FILE_PATH_LITERAL("title3.html"))); ui_test_utils::NavigateToURL(browser(), url1); ui_test_utils::NavigateToURL(browser(), url2); @@ -404,7 +404,7 @@ IN_PROC_BROWSER_TEST_F(HistoryBrowserTest, NavigateBringPageToTop) { IN_PROC_BROWSER_TEST_F(HistoryBrowserTest, ReloadBringPageToTop) { GURL url1 = GetTestUrl(); GURL url2 = ui_test_utils::GetTestUrl( - FilePath(), FilePath(FILE_PATH_LITERAL("title3.html"))); + base::FilePath(), base::FilePath(FILE_PATH_LITERAL("title3.html"))); ui_test_utils::NavigateToURL(browser(), url1); ui_test_utils::NavigateToURLWithDisposition( @@ -431,7 +431,7 @@ IN_PROC_BROWSER_TEST_F(HistoryBrowserTest, ReloadBringPageToTop) { IN_PROC_BROWSER_TEST_F(HistoryBrowserTest, BackForwardBringPageToTop) { GURL url1 = GetTestUrl(); GURL url2 = ui_test_utils::GetTestUrl( - FilePath(), FilePath(FILE_PATH_LITERAL("title3.html"))); + base::FilePath(), base::FilePath(FILE_PATH_LITERAL("title3.html"))); ui_test_utils::NavigateToURL(browser(), url1); ui_test_utils::NavigateToURL(browser(), url2); @@ -457,11 +457,11 @@ IN_PROC_BROWSER_TEST_F(HistoryBrowserTest, BackForwardBringPageToTop) { // Verify that submitting form adds target page to history list. IN_PROC_BROWSER_TEST_F(HistoryBrowserTest, SubmitFormAddsTargetPage) { GURL form = ui_test_utils::GetTestUrl( - FilePath().AppendASCII("History"), - FilePath().AppendASCII("form.html")); + base::FilePath().AppendASCII("History"), + base::FilePath().AppendASCII("form.html")); GURL target = ui_test_utils::GetTestUrl( - FilePath().AppendASCII("History"), - FilePath().AppendASCII("target.html")); + base::FilePath().AppendASCII("History"), + base::FilePath().AppendASCII("target.html")); ui_test_utils::NavigateToURL(browser(), form); content::WebContents* web_contents = diff --git a/chrome/browser/history/history_database.cc b/chrome/browser/history/history_database.cc index 52a2f1e..9ab47fb 100644 --- a/chrome/browser/history/history_database.cc +++ b/chrome/browser/history/history_database.cc @@ -35,7 +35,7 @@ static const char kEarlyExpirationThresholdKey[] = "early_expiration_threshold"; // of history. static const char kNeedsThumbnailMigrationKey[] = "needs_thumbnail_migration"; -void ComputeDatabaseMetrics(const FilePath& history_name, +void ComputeDatabaseMetrics(const base::FilePath& history_name, sql::Connection& db) { if (base::RandInt(1, 100) != 50) return; // Only do this computation sometimes since it can be expensive. @@ -121,7 +121,7 @@ HistoryDatabase::HistoryDatabase() HistoryDatabase::~HistoryDatabase() { } -sql::InitStatus HistoryDatabase::Init(const FilePath& history_name, +sql::InitStatus HistoryDatabase::Init(const base::FilePath& history_name, sql::ErrorDelegate* error_delegate) { db_.set_error_histogram_name("Sqlite.History.Error"); diff --git a/chrome/browser/history/history_database_unittest.cc b/chrome/browser/history/history_database_unittest.cc index 622e706..e5354ad 100644 --- a/chrome/browser/history/history_database_unittest.cc +++ b/chrome/browser/history/history_database_unittest.cc @@ -16,14 +16,14 @@ namespace history { TEST(HistoryDatabaseTest, DropBookmarks) { base::ScopedTempDir temp_dir; - FilePath db_file; + base::FilePath db_file; ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); db_file = temp_dir.path().AppendASCII("DropBookmarks.db"); file_util::Delete(db_file, false); // Copy db file over that contains starred URLs. - FilePath old_history_path; + base::FilePath old_history_path; PathService::Get(chrome::DIR_TEST_DATA, &old_history_path); old_history_path = old_history_path.AppendASCII("bookmarks"); old_history_path = old_history_path.Append( diff --git a/chrome/browser/history/history_querying_unittest.cc b/chrome/browser/history/history_querying_unittest.cc index 51da62d..413a4d3 100644 --- a/chrome/browser/history/history_querying_unittest.cc +++ b/chrome/browser/history/history_querying_unittest.cc @@ -180,7 +180,7 @@ class HistoryQueryTest : public testing::Test { MessageLoop message_loop_; - FilePath history_dir_; + base::FilePath history_dir_; CancelableRequestConsumer consumer_; diff --git a/chrome/browser/history/history_service.cc b/chrome/browser/history/history_service.cc index 7feb3c8f..4c65998 100644 --- a/chrome/browser/history/history_service.cc +++ b/chrome/browser/history/history_service.cc @@ -944,7 +944,7 @@ void HistoryService::RebuildTable( ScheduleAndForget(PRIORITY_NORMAL, &HistoryBackend::IterateURLs, enumerator); } -bool HistoryService::Init(const FilePath& history_dir, +bool HistoryService::Init(const base::FilePath& history_dir, BookmarkService* bookmark_service, bool no_db) { DCHECK(thread_checker_.CalledOnValidThread()); diff --git a/chrome/browser/history/history_unittest.cc b/chrome/browser/history/history_unittest.cc index 56b0d42..a9f0974 100644 --- a/chrome/browser/history/history_unittest.cc +++ b/chrome/browser/history/history_unittest.cc @@ -125,7 +125,7 @@ class HistoryBackendDBTest : public HistoryUnitTestBase { } void CreateDBVersion(int version) { - FilePath data_path; + base::FilePath data_path; ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &data_path)); data_path = data_path.AppendASCII("History"); data_path = data_path.AppendASCII(StringPrintf("history.%d.sql", version)); @@ -162,8 +162,8 @@ class HistoryBackendDBTest : public HistoryUnitTestBase { url_chain.push_back(GURL("foo-url")); DownloadRow download( - FilePath(FILE_PATH_LITERAL("foo-path")), - FilePath(FILE_PATH_LITERAL("foo-path")), + base::FilePath(FILE_PATH_LITERAL("foo-path")), + base::FilePath(FILE_PATH_LITERAL("foo-path")), url_chain, GURL(""), time, @@ -183,7 +183,7 @@ class HistoryBackendDBTest : public HistoryUnitTestBase { MessageLoopForUI message_loop_; // names of the database files - FilePath history_dir_; + base::FilePath history_dir_; // Created via CreateBackendAndDatabase. scoped_refptr<HistoryBackend> backend_; @@ -690,7 +690,7 @@ class HistoryTest : public testing::Test { scoped_ptr<HistoryService> history_service_; // names of the database files - FilePath history_dir_; + base::FilePath history_dir_; // Set by the thumbnail callback when we get data, you should be sure to // clear this before issuing a thumbnail request. @@ -1156,7 +1156,7 @@ TEST_F(HistoryTest, MostVisitedURLs) { // See test/data/profiles/profile_with_default_theme/README.txt for // instructions on how to up the version. TEST(HistoryProfileTest, TypicalProfileVersion) { - FilePath file; + base::FilePath file; ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &file)); file = file.AppendASCII("profiles"); file = file.AppendASCII("profile_with_default_theme"); diff --git a/chrome/browser/history/history_unittest_base.cc b/chrome/browser/history/history_unittest_base.cc index 2a5a761..17c643f 100644 --- a/chrome/browser/history/history_unittest_base.cc +++ b/chrome/browser/history/history_unittest_base.cc @@ -15,8 +15,8 @@ namespace history { HistoryUnitTestBase::~HistoryUnitTestBase() { } -void HistoryUnitTestBase::ExecuteSQLScript(const FilePath& sql_path, - const FilePath& db_path) { +void HistoryUnitTestBase::ExecuteSQLScript(const base::FilePath& sql_path, + const base::FilePath& db_path) { std::string sql; ASSERT_TRUE(file_util::ReadFileToString(sql_path, &sql)); diff --git a/chrome/browser/history/history_unittest_base.h b/chrome/browser/history/history_unittest_base.h index 1d9512d..ad14f33 100644 --- a/chrome/browser/history/history_unittest_base.h +++ b/chrome/browser/history/history_unittest_base.h @@ -18,8 +18,8 @@ class HistoryUnitTestBase : public testing::Test { // Executes the sql from the file |sql_path| in the database at |db_path|. // |sql_path| is the SQL script file name with full path. // |db_path| is the db file name with full path. - static void ExecuteSQLScript(const FilePath& sql_path, - const FilePath& db_path); + static void ExecuteSQLScript(const base::FilePath& sql_path, + const base::FilePath& db_path); protected: HistoryUnitTestBase(); diff --git a/chrome/browser/history/in_memory_database.cc b/chrome/browser/history/in_memory_database.cc index fb03410..27b8a34 100644 --- a/chrome/browser/history/in_memory_database.cc +++ b/chrome/browser/history/in_memory_database.cc @@ -62,7 +62,7 @@ bool InMemoryDatabase::InitFromScratch() { return true; } -bool InMemoryDatabase::InitFromDisk(const FilePath& history_name) { +bool InMemoryDatabase::InitFromDisk(const base::FilePath& history_name) { if (!InitDB()) return false; diff --git a/chrome/browser/history/in_memory_url_index.cc b/chrome/browser/history/in_memory_url_index.cc index 338713f..d55669a 100644 --- a/chrome/browser/history/in_memory_url_index.cc +++ b/chrome/browser/history/in_memory_url_index.cc @@ -28,7 +28,7 @@ namespace history { // Called by DoSaveToCacheFile to delete any old cache file at |path| when // there is no private data to save. Runs on the FILE thread. -void DeleteCacheFile(const FilePath& path) { +void DeleteCacheFile(const base::FilePath& path) { DCHECK(!content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); file_util::Delete(path, false); } @@ -89,7 +89,7 @@ InMemoryURLIndex::RebuildPrivateDataFromHistoryDBTask:: // InMemoryURLIndex ------------------------------------------------------------ InMemoryURLIndex::InMemoryURLIndex(Profile* profile, - const FilePath& history_dir, + const base::FilePath& history_dir, const std::string& languages) : profile_(profile), history_dir_(history_dir), @@ -137,7 +137,7 @@ void InMemoryURLIndex::ShutDown() { registrar_.RemoveAll(); cache_reader_consumer_.CancelAllRequests(); shutdown_ = true; - FilePath path; + base::FilePath path; if (!GetCacheFilePath(&path)) return; URLIndexPrivateData::WritePrivateDataToCacheFileTask(private_data_, path); @@ -148,7 +148,7 @@ void InMemoryURLIndex::ClearPrivateData() { private_data_->Clear(); } -bool InMemoryURLIndex::GetCacheFilePath(FilePath* file_path) { +bool InMemoryURLIndex::GetCacheFilePath(base::FilePath* file_path) { if (history_dir_.empty()) return false; *file_path = history_dir_.Append(FILE_PATH_LITERAL("History Provider Cache")); @@ -227,7 +227,7 @@ void InMemoryURLIndex::OnURLsDeleted(const URLsDeletedDetails* details) { void InMemoryURLIndex::PostRestoreFromCacheFileTask() { DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); - FilePath path; + base::FilePath path; if (!GetCacheFilePath(&path) || shutdown_) { restored_ = true; if (restore_cache_observer_) @@ -256,7 +256,7 @@ void InMemoryURLIndex::OnCacheLoadDone( // When unable to restore from the cache file delete the cache file, if // it exists, and then rebuild from the history database if it's available, // otherwise wait until the history database loaded and then rebuild. - FilePath path; + base::FilePath path; if (!GetCacheFilePath(&path) || shutdown_) return; content::BrowserThread::PostBlockingPoolTask( @@ -310,7 +310,7 @@ void InMemoryURLIndex::RebuildFromHistory(HistoryDatabase* history_db) { // Saving to Cache ------------------------------------------------------------- void InMemoryURLIndex::PostSaveToCacheFileTask() { - FilePath path; + base::FilePath path; if (!GetCacheFilePath(&path)) return; // If there is anything in our private data then make a copy of it and tell diff --git a/chrome/browser/history/in_memory_url_index.h b/chrome/browser/history/in_memory_url_index.h index c3fefff..557793c 100644 --- a/chrome/browser/history/in_memory_url_index.h +++ b/chrome/browser/history/in_memory_url_index.h @@ -101,7 +101,7 @@ class InMemoryURLIndex : public content::NotificationObserver, // journals will be stored. |languages| gives a list of language encodings by // which URLs and omnibox searches are broken down into words and characters. InMemoryURLIndex(Profile* profile, - const FilePath& history_dir, + const base::FilePath& history_dir, const std::string& languages); virtual ~InMemoryURLIndex(); @@ -182,7 +182,7 @@ class InMemoryURLIndex : public content::NotificationObserver, // the history database is kept and saves that path to |file_path|. Returns // true if |file_path| can be successfully constructed. (This function // provided as a hook for unit testing.) - bool GetCacheFilePath(FilePath* file_path); + bool GetCacheFilePath(base::FilePath* file_path); // Restores the index's private data from the cache file stored in the // profile directory. @@ -224,7 +224,7 @@ class InMemoryURLIndex : public content::NotificationObserver, // Saves private_data_ to the given |path|. Runs on the UI thread. // Provided for unit testing so that a test cache file can be used. - void DoSaveToCacheFile(const FilePath& path); + void DoSaveToCacheFile(const base::FilePath& path); // Notifies the observer, if any, of the success of the private data caching. // |succeeded| is true on a successful save. @@ -242,7 +242,9 @@ class InMemoryURLIndex : public content::NotificationObserver, // Sets the directory wherein the cache file will be maintained. // For unit test usage only. - void set_history_dir(const FilePath& dir_path) { history_dir_ = dir_path; } + void set_history_dir(const base::FilePath& dir_path) { + history_dir_ = dir_path; + } // Returns a pointer to our private data. For unit testing only. URLIndexPrivateData* private_data() { return private_data_.get(); } @@ -256,7 +258,7 @@ class InMemoryURLIndex : public content::NotificationObserver, // Directory where cache file resides. This is, except when unit testing, // the same directory in which the profile's history database is found. It // should never be empty. - FilePath history_dir_; + base::FilePath history_dir_; // Languages used during the word-breaking process during indexing. std::string languages_; diff --git a/chrome/browser/history/in_memory_url_index_unittest.cc b/chrome/browser/history/in_memory_url_index_unittest.cc index e0590e3..64857ec 100644 --- a/chrome/browser/history/in_memory_url_index_unittest.cc +++ b/chrome/browser/history/in_memory_url_index_unittest.cc @@ -84,7 +84,7 @@ class InMemoryURLIndexTest : public testing::Test { // Allows the database containing the test data to be customized by // subclasses. - virtual FilePath::StringType TestDBName() const; + virtual base::FilePath::StringType TestDBName() const; // Validates that the given |term| is contained in |cache| and that it is // marked as in-use. @@ -97,8 +97,8 @@ class InMemoryURLIndexTest : public testing::Test { // Pass-through functions to simplify our friendship with InMemoryURLIndex. URLIndexPrivateData* GetPrivateData() const; void ClearPrivateData(); - void set_history_dir(const FilePath& dir_path); - bool GetCacheFilePath(FilePath* file_path) const; + void set_history_dir(const base::FilePath& dir_path); + bool GetCacheFilePath(base::FilePath* file_path) const; void PostRestoreFromCacheFileTask(); void PostSaveToCacheFileTask(); void Observe(int notification_type, @@ -144,11 +144,11 @@ void InMemoryURLIndexTest::ClearPrivateData() { return url_index_->ClearPrivateData(); } -void InMemoryURLIndexTest::set_history_dir(const FilePath& dir_path) { +void InMemoryURLIndexTest::set_history_dir(const base::FilePath& dir_path) { return url_index_->set_history_dir(dir_path); } -bool InMemoryURLIndexTest::GetCacheFilePath(FilePath* file_path) const { +bool InMemoryURLIndexTest::GetCacheFilePath(base::FilePath* file_path) const { DCHECK(file_path); return url_index_->GetCacheFilePath(file_path); } @@ -196,7 +196,7 @@ void InMemoryURLIndexTest::SetUp() { history_database_ = backend->db(); // Create and populate a working copy of the URL history database. - FilePath history_proto_path; + base::FilePath history_proto_path; PathService::Get(chrome::DIR_TEST_DATA, &history_proto_path); history_proto_path = history_proto_path.Append( FILE_PATH_LITERAL("History")); @@ -251,12 +251,12 @@ void InMemoryURLIndexTest::SetUp() { } url_index_.reset( - new InMemoryURLIndex(&profile_, FilePath(), "en,ja,hi,zh")); + new InMemoryURLIndex(&profile_, base::FilePath(), "en,ja,hi,zh")); url_index_->Init(); url_index_->RebuildFromHistory(history_database_); } -FilePath::StringType InMemoryURLIndexTest::TestDBName() const { +base::FilePath::StringType InMemoryURLIndexTest::TestDBName() const { return FILE_PATH_LITERAL("url_history_provider_test.db.txt"); } @@ -385,10 +385,10 @@ void InMemoryURLIndexTest::ExpectPrivateDataEqual( class LimitedInMemoryURLIndexTest : public InMemoryURLIndexTest { protected: - virtual FilePath::StringType TestDBName() const OVERRIDE; + virtual base::FilePath::StringType TestDBName() const OVERRIDE; }; -FilePath::StringType LimitedInMemoryURLIndexTest::TestDBName() const { +base::FilePath::StringType LimitedInMemoryURLIndexTest::TestDBName() const { return FILE_PATH_LITERAL("url_history_provider_test_limited.db.txt"); } @@ -401,7 +401,7 @@ TEST_F(LimitedInMemoryURLIndexTest, Initialization) { while (statement.Step()) ++row_count; EXPECT_EQ(1U, row_count); url_index_.reset( - new InMemoryURLIndex(&profile_, FilePath(), "en,ja,hi,zh")); + new InMemoryURLIndex(&profile_, base::FilePath(), "en,ja,hi,zh")); url_index_->Init(); url_index_->RebuildFromHistory(history_database_); URLIndexPrivateData& private_data(*GetPrivateData()); @@ -979,8 +979,8 @@ class InMemoryURLIndexCacheTest : public testing::Test { virtual void SetUp() OVERRIDE; // Pass-through functions to simplify our friendship with InMemoryURLIndex. - void set_history_dir(const FilePath& dir_path); - bool GetCacheFilePath(FilePath* file_path) const; + void set_history_dir(const base::FilePath& dir_path); + bool GetCacheFilePath(base::FilePath* file_path) const; base::ScopedTempDir temp_dir_; scoped_ptr<InMemoryURLIndex> url_index_; @@ -988,35 +988,37 @@ class InMemoryURLIndexCacheTest : public testing::Test { void InMemoryURLIndexCacheTest::SetUp() { ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); - FilePath path(temp_dir_.path()); + base::FilePath path(temp_dir_.path()); url_index_.reset( new InMemoryURLIndex(NULL, path, "en,ja,hi,zh")); } -void InMemoryURLIndexCacheTest::set_history_dir(const FilePath& dir_path) { +void InMemoryURLIndexCacheTest::set_history_dir( + const base::FilePath& dir_path) { return url_index_->set_history_dir(dir_path); } -bool InMemoryURLIndexCacheTest::GetCacheFilePath(FilePath* file_path) const { +bool InMemoryURLIndexCacheTest::GetCacheFilePath( + base::FilePath* file_path) const { DCHECK(file_path); return url_index_->GetCacheFilePath(file_path); } TEST_F(InMemoryURLIndexCacheTest, CacheFilePath) { - FilePath expectedPath = + base::FilePath expectedPath = temp_dir_.path().Append(FILE_PATH_LITERAL("History Provider Cache")); - std::vector<FilePath::StringType> expected_parts; + std::vector<base::FilePath::StringType> expected_parts; expectedPath.GetComponents(&expected_parts); - FilePath full_file_path; + base::FilePath full_file_path; ASSERT_TRUE(GetCacheFilePath(&full_file_path)); - std::vector<FilePath::StringType> actual_parts; + std::vector<base::FilePath::StringType> actual_parts; full_file_path.GetComponents(&actual_parts); ASSERT_EQ(expected_parts.size(), actual_parts.size()); size_t count = expected_parts.size(); for (size_t i = 0; i < count; ++i) EXPECT_EQ(expected_parts[i], actual_parts[i]); // Must clear the history_dir_ to satisfy the dtor's DCHECK. - set_history_dir(FilePath()); + set_history_dir(base::FilePath()); } } // namespace history diff --git a/chrome/browser/history/redirect_browsertest.cc b/chrome/browser/history/redirect_browsertest.cc index 4db52f7..039af8f 100644 --- a/chrome/browser/history/redirect_browsertest.cc +++ b/chrome/browser/history/redirect_browsertest.cc @@ -132,7 +132,7 @@ IN_PROC_BROWSER_TEST_F(RedirectTest, ClientEmptyReferer) { // Write the contents to a temporary file. base::ScopedTempDir temp_directory; ASSERT_TRUE(temp_directory.CreateUniqueTempDir()); - FilePath temp_file; + base::FilePath temp_file; ASSERT_TRUE(file_util::CreateTemporaryFileInDir(temp_directory.path(), &temp_file)); ASSERT_EQ(static_cast<int>(file_redirect_contents.size()), @@ -155,7 +155,8 @@ IN_PROC_BROWSER_TEST_F(RedirectTest, ClientEmptyReferer) { // flagged as a redirect. IN_PROC_BROWSER_TEST_F(RedirectTest, ClientCancelled) { GURL first_url = ui_test_utils::GetTestUrl( - FilePath(), FilePath().AppendASCII("cancelled_redirect_test.html")); + base::FilePath(), + base::FilePath().AppendASCII("cancelled_redirect_test.html")); ui_test_utils::NavigateToURL(browser(), first_url); content::WebContents* web_contents = @@ -228,7 +229,7 @@ IN_PROC_BROWSER_TEST_F(RedirectTest, ServerReference) { IN_PROC_BROWSER_TEST_F(RedirectTest, NoHttpToFile) { ASSERT_TRUE(test_server()->Start()); GURL file_url = ui_test_utils::GetTestUrl( - FilePath(), FilePath().AppendASCII("http_to_file.html")); + base::FilePath(), base::FilePath().AppendASCII("http_to_file.html")); GURL initial_url = test_server()->GetURL( "client-redirect?" + file_url.spec()); @@ -245,7 +246,7 @@ IN_PROC_BROWSER_TEST_F(RedirectTest, NoHttpToFile) { IN_PROC_BROWSER_TEST_F(RedirectTest, ClientFragments) { ASSERT_TRUE(test_server()->Start()); GURL first_url = ui_test_utils::GetTestUrl( - FilePath(), FilePath().AppendASCII("ref_redirect.html")); + base::FilePath(), base::FilePath().AppendASCII("ref_redirect.html")); ui_test_utils::NavigateToURL(browser(), first_url); std::vector<GURL> redirects = GetRedirects(first_url); EXPECT_EQ(1U, redirects.size()); diff --git a/chrome/browser/history/shortcuts_database.h b/chrome/browser/history/shortcuts_database.h index 613f326..594150a 100644 --- a/chrome/browser/history/shortcuts_database.h +++ b/chrome/browser/history/shortcuts_database.h @@ -82,9 +82,9 @@ class ShortcutsDatabase : public base::RefCountedThreadSafe<ShortcutsDatabase> { // The sql database. Not valid until Init is called. sql::Connection db_; - FilePath database_path_; + base::FilePath database_path_; - static const FilePath::CharType kShortcutsDatabaseName[]; + static const base::FilePath::CharType kShortcutsDatabaseName[]; DISALLOW_COPY_AND_ASSIGN(ShortcutsDatabase); }; diff --git a/chrome/browser/history/text_database.cc b/chrome/browser/history/text_database.cc index 567a4eb..2fd1e27 100644 --- a/chrome/browser/history/text_database.cc +++ b/chrome/browser/history/text_database.cc @@ -54,7 +54,8 @@ const char kTitleColumnIndex[] = "1"; const char kBodyColumnIndex[] = "2"; // The string prepended to the database identifier to generate the filename. -const FilePath::CharType kFilePrefix[] = FILE_PATH_LITERAL("History Index "); +const base::FilePath::CharType kFilePrefix[] = + FILE_PATH_LITERAL("History Index "); } // namespace @@ -62,7 +63,7 @@ TextDatabase::Match::Match() {} TextDatabase::Match::~Match() {} -TextDatabase::TextDatabase(const FilePath& path, +TextDatabase::TextDatabase(const base::FilePath& path, DBIdent id, bool allow_create) : path_(path), @@ -76,26 +77,27 @@ TextDatabase::~TextDatabase() { } // static -const FilePath::CharType* TextDatabase::file_base() { +const base::FilePath::CharType* TextDatabase::file_base() { return kFilePrefix; } // static -FilePath TextDatabase::IDToFileName(DBIdent id) { +base::FilePath TextDatabase::IDToFileName(DBIdent id) { // Identifiers are intended to be a combination of the year and month, for // example, 200801 for January 2008. We convert this to // "History Index 2008-01". However, we don't make assumptions about this // scheme: the caller should assign IDs as it feels fit with the knowledge // that they will apppear on disk in this form. - FilePath::StringType filename(file_base()); + base::FilePath::StringType filename(file_base()); base::StringAppendF(&filename, FILE_PATH_LITERAL("%d-%02d"), id / 100, id % 100); - return FilePath(filename); + return base::FilePath(filename); } // static -TextDatabase::DBIdent TextDatabase::FileNameToID(const FilePath& file_path) { - FilePath::StringType file_name = file_path.BaseName().value(); +TextDatabase::DBIdent TextDatabase::FileNameToID( + const base::FilePath& file_path) { + base::FilePath::StringType file_name = file_path.BaseName().value(); // We don't actually check the prefix here. Since the file system could // be case insensitive in ways we can't predict (NTFS), checking could @@ -103,7 +105,7 @@ TextDatabase::DBIdent TextDatabase::FileNameToID(const FilePath& file_path) { static const size_t kIDStringLength = 7; // Room for "xxxx-xx". if (file_name.length() < kIDStringLength) return 0; - const FilePath::StringType suffix( + const base::FilePath::StringType suffix( &file_name[file_name.length() - kIDStringLength]); if (suffix.length() != kIDStringLength || @@ -114,7 +116,7 @@ TextDatabase::DBIdent TextDatabase::FileNameToID(const FilePath& file_path) { // TODO: Once StringPiece supports a templated interface over the // underlying string type, use it here instead of substr, since that // will avoid needless string copies. StringPiece cannot be used - // right now because FilePath::StringType could use either 8 or 16 bit + // right now because base::FilePath::StringType could use either 8 or 16 bit // characters, depending on the OS. int year, month; base::StringToInt(suffix.substr(0, 4), &year); diff --git a/chrome/browser/history/text_database.h b/chrome/browser/history/text_database.h index 9baa187..7be7870 100644 --- a/chrome/browser/history/text_database.h +++ b/chrome/browser/history/text_database.h @@ -70,7 +70,7 @@ class TextDatabase { // |allow_create| indicates if we want to allow creation of the file if it // doesn't exist. For files associated with older time periods, we don't want // to create them if they don't exist, so this flag would be false. - TextDatabase(const FilePath& path, + TextDatabase(const base::FilePath& path, DBIdent id, bool allow_create); ~TextDatabase(); @@ -89,16 +89,16 @@ class TextDatabase { // For testing, returns the file name of the database so it can be deleted // after the test. This is valid even before Init() is called. - const FilePath& file_name() const { return file_name_; } + const base::FilePath& file_name() const { return file_name_; } // Returns a NULL-terminated string that is the base of history index files, // which is the part before the database identifier. For example // "History Index *". This is for finding existing database files. - static const FilePath::CharType* file_base(); + static const base::FilePath::CharType* file_base(); // Converts a filename on disk (optionally including a path) to a database // identifier. If the filename doesn't have the correct format, returns 0. - static DBIdent FileNameToID(const FilePath& file_path); + static DBIdent FileNameToID(const base::FilePath& file_path); // Changing operations ------------------------------------------------------- @@ -142,7 +142,7 @@ class TextDatabase { // Converts the given database identifier to a filename. This does not include // the path, just the file and extension. - static FilePath IDToFileName(DBIdent id); + static base::FilePath IDToFileName(DBIdent id); private: // Ensures that the tables and indices are created. Returns true on success. @@ -151,12 +151,12 @@ class TextDatabase { // The sql database. Not valid until Init is called. sql::Connection db_; - const FilePath path_; + const base::FilePath path_; const DBIdent ident_; const bool allow_create_; // Full file name of the file on disk, computed in Init(). - FilePath file_name_; + base::FilePath file_name_; sql::MetaTable meta_table_; diff --git a/chrome/browser/history/text_database_manager.cc b/chrome/browser/history/text_database_manager.cc index 613861e..4259d46 100644 --- a/chrome/browser/history/text_database_manager.cc +++ b/chrome/browser/history/text_database_manager.cc @@ -79,7 +79,7 @@ bool TextDatabaseManager::PageInfo::Expired(TimeTicks now) const { // TextDatabaseManager --------------------------------------------------------- -TextDatabaseManager::TextDatabaseManager(const FilePath& dir, +TextDatabaseManager::TextDatabaseManager(const base::FilePath& dir, URLDatabase* url_database, VisitDatabase* visit_database) : dir_(dir), @@ -158,11 +158,11 @@ void TextDatabaseManager::InitDBList() { present_databases_loaded_ = true; // Find files on disk matching our pattern so we can quickly test for them. - FilePath::StringType filepattern(TextDatabase::file_base()); + base::FilePath::StringType filepattern(TextDatabase::file_base()); filepattern.append(FILE_PATH_LITERAL("*")); file_util::FileEnumerator enumerator( dir_, false, file_util::FileEnumerator::FILES, filepattern); - FilePath cur_file; + base::FilePath cur_file; while (!(cur_file = enumerator.Next()).empty()) { // Convert to the number representing this file. TextDatabase::DBIdent id = TextDatabase::FileNameToID(cur_file); @@ -413,7 +413,7 @@ void TextDatabaseManager::DeleteAll() { // Now go through and delete all the files. for (DBIdentSet::iterator i = present_databases_.begin(); i != present_databases_.end(); ++i) { - FilePath file_name = dir_.Append(TextDatabase::IDToFileName(*i)); + base::FilePath file_name = dir_.Append(TextDatabase::IDToFileName(*i)); file_util::Delete(file_name, false); } } diff --git a/chrome/browser/history/text_database_manager.h b/chrome/browser/history/text_database_manager.h index cc58e0a..8d4b296 100644 --- a/chrome/browser/history/text_database_manager.h +++ b/chrome/browser/history/text_database_manager.h @@ -74,7 +74,7 @@ class TextDatabaseManager { // The visit database is a pointer owned by the caller for the main database // (of recent visits). The visit database will be updated to refer to the // added text database entries. - TextDatabaseManager(const FilePath& dir, + TextDatabaseManager(const base::FilePath& dir, URLDatabase* url_database, VisitDatabase* visit_database); ~TextDatabaseManager(); @@ -84,7 +84,7 @@ class TextDatabaseManager { bool Init(const HistoryPublisher* history_publisher); // Returns the directory that holds the full text database files. - const FilePath& GetDir() { return dir_; } + const base::FilePath& GetDir() { return dir_; } // Allows scoping updates. This also allows things to go faster since every // page add doesn't need to be committed to disk (slow). Note that files will @@ -256,7 +256,7 @@ class TextDatabaseManager { void FlushOldChangesForTime(base::TimeTicks now); // Directory holding our index files. - const FilePath dir_; + const base::FilePath dir_; // Non-owning pointers to the recent history databases for URLs and visits. URLDatabase* url_database_; diff --git a/chrome/browser/history/text_database_manager_unittest.cc b/chrome/browser/history/text_database_manager_unittest.cc index a14e051..23402b9 100644 --- a/chrome/browser/history/text_database_manager_unittest.cc +++ b/chrome/browser/history/text_database_manager_unittest.cc @@ -167,7 +167,7 @@ class TextDatabaseManagerTest : public testing::Test { MessageLoop message_loop_; // Directory containing the databases. - FilePath dir_; + base::FilePath dir_; }; // Tests basic querying. diff --git a/chrome/browser/history/text_database_unittest.cc b/chrome/browser/history/text_database_unittest.cc index 7161844..0691e7f 100644 --- a/chrome/browser/history/text_database_unittest.cc +++ b/chrome/browser/history/text_database_unittest.cc @@ -119,7 +119,7 @@ class TextDatabaseTest : public PlatformTest { base::ScopedTempDir temp_dir_; // Name of the main database file. - FilePath file_name_; + base::FilePath file_name_; }; TEST_F(TextDatabaseTest, AttachDetach) { diff --git a/chrome/browser/history/thumbnail_database.cc b/chrome/browser/history/thumbnail_database.cc index 3f047ce..8f506e9 100644 --- a/chrome/browser/history/thumbnail_database.cc +++ b/chrome/browser/history/thumbnail_database.cc @@ -126,7 +126,7 @@ ThumbnailDatabase::~ThumbnailDatabase() { } sql::InitStatus ThumbnailDatabase::Init( - const FilePath& db_name, + const base::FilePath& db_name, const HistoryPublisher* history_publisher, URLDatabase* url_db) { history_publisher_ = history_publisher; @@ -217,7 +217,7 @@ sql::InitStatus ThumbnailDatabase::Init( } sql::InitStatus ThumbnailDatabase::OpenDatabase(sql::Connection* db, - const FilePath& db_name) { + const base::FilePath& db_name) { db->set_error_histogram_name("Sqlite.Thumbnail.Error"); // Thumbnails db now only stores favicons, so we don't need that big a page @@ -948,8 +948,9 @@ bool ThumbnailDatabase::NeedsMigrationToTopSites() { return !use_top_sites_; } -bool ThumbnailDatabase::RenameAndDropThumbnails(const FilePath& old_db_file, - const FilePath& new_db_file) { +bool ThumbnailDatabase::RenameAndDropThumbnails( + const base::FilePath& old_db_file, + const base::FilePath& new_db_file) { // Init favicons tables - same schema as the thumbnails. sql::Connection favicons; if (OpenDatabase(&favicons, new_db_file) != sql::INIT_OK) diff --git a/chrome/browser/history/thumbnail_database_unittest.cc b/chrome/browser/history/thumbnail_database_unittest.cc index a2524b8..f041def 100644 --- a/chrome/browser/history/thumbnail_database_unittest.cc +++ b/chrome/browser/history/thumbnail_database_unittest.cc @@ -80,9 +80,9 @@ class ThumbnailDatabaseTest : public testing::Test { scoped_ptr<SkBitmap> google_bitmap_; base::ScopedTempDir temp_dir_; - FilePath file_name_; - FilePath new_file_name_; - FilePath history_db_name_; + base::FilePath file_name_; + base::FilePath new_file_name_; + base::FilePath history_db_name_; }; class IconMappingMigrationTest : public HistoryUnitTestBase { @@ -96,7 +96,7 @@ class IconMappingMigrationTest : public HistoryUnitTestBase { virtual void SetUp() { profile_.reset(new TestingProfile); - FilePath data_path; + base::FilePath data_path; ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &data_path)); data_path = data_path.AppendASCII("History"); @@ -113,8 +113,8 @@ class IconMappingMigrationTest : public HistoryUnitTestBase { } protected: - FilePath history_db_name_; - FilePath thumbnail_db_name_; + base::FilePath history_db_name_; + base::FilePath thumbnail_db_name_; private: scoped_ptr<TestingProfile> profile_; diff --git a/chrome/browser/history/top_sites.cc b/chrome/browser/history/top_sites.cc index a443500..046e039 100644 --- a/chrome/browser/history/top_sites.cc +++ b/chrome/browser/history/top_sites.cc @@ -194,7 +194,7 @@ TopSites::TopSites(Profile* profile) } } -void TopSites::Init(const FilePath& db_name) { +void TopSites::Init(const base::FilePath& db_name) { // Create the backend here, rather than in the constructor, so that // unit tests that do not need the backend can run without a problem. backend_ = new TopSitesBackend; diff --git a/chrome/browser/history/top_sites_backend.cc b/chrome/browser/history/top_sites_backend.cc index aba305f..93cf6e2 100644 --- a/chrome/browser/history/top_sites_backend.cc +++ b/chrome/browser/history/top_sites_backend.cc @@ -21,7 +21,7 @@ TopSitesBackend::TopSitesBackend() : db_(new TopSitesDatabase()) { } -void TopSitesBackend::Init(const FilePath& path) { +void TopSitesBackend::Init(const base::FilePath& path) { db_path_ = path; BrowserThread::PostTask( BrowserThread::DB, FROM_HERE, @@ -83,7 +83,7 @@ TopSitesBackend::~TopSitesBackend() { // nulling out db). } -void TopSitesBackend::InitDBOnDBThread(const FilePath& path) { +void TopSitesBackend::InitDBOnDBThread(const base::FilePath& path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB)); if (!db_->Init(path)) { NOTREACHED() << "Failed to initialize database."; @@ -132,7 +132,7 @@ void TopSitesBackend::SetPageThumbnailOnDBThread(const MostVisitedURL& url, db_->SetPageThumbnail(url, url_rank, thumbnail); } -void TopSitesBackend::ResetDatabaseOnDBThread(const FilePath& file_path) { +void TopSitesBackend::ResetDatabaseOnDBThread(const base::FilePath& file_path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB)); db_.reset(NULL); file_util::Delete(db_path_, false); diff --git a/chrome/browser/history/top_sites_database.cc b/chrome/browser/history/top_sites_database.cc index 17afb1e..d200e76 100644 --- a/chrome/browser/history/top_sites_database.cc +++ b/chrome/browser/history/top_sites_database.cc @@ -25,7 +25,7 @@ TopSitesDatabase::TopSitesDatabase() : may_need_history_migration_(false) { TopSitesDatabase::~TopSitesDatabase() { } -bool TopSitesDatabase::Init(const FilePath& db_name) { +bool TopSitesDatabase::Init(const base::FilePath& db_name) { bool file_existed = file_util::PathExists(db_name); if (!file_existed) @@ -371,7 +371,7 @@ bool TopSitesDatabase::RemoveURL(const MostVisitedURL& url) { return transaction.Commit(); } -sql::Connection* TopSitesDatabase::CreateDB(const FilePath& db_name) { +sql::Connection* TopSitesDatabase::CreateDB(const base::FilePath& db_name) { scoped_ptr<sql::Connection> db(new sql::Connection()); // Settings copied from ThumbnailDatabase. db->set_error_histogram_name("Sqlite.Thumbnail.Error"); diff --git a/chrome/browser/history/top_sites_database_unittest.cc b/chrome/browser/history/top_sites_database_unittest.cc index f69d82c..ebd956b 100644 --- a/chrome/browser/history/top_sites_database_unittest.cc +++ b/chrome/browser/history/top_sites_database_unittest.cc @@ -19,7 +19,7 @@ class TopSitesDatabaseTest : public testing::Test { } base::ScopedTempDir temp_dir_; - FilePath file_name_; + base::FilePath file_name_; }; TEST_F(TopSitesDatabaseTest, UpgradeToVersion2) { diff --git a/chrome/browser/history/top_sites_unittest.cc b/chrome/browser/history/top_sites_unittest.cc index 4a79b8c..b04fb52 100644 --- a/chrome/browser/history/top_sites_unittest.cc +++ b/chrome/browser/history/top_sites_unittest.cc @@ -346,7 +346,7 @@ class TopSitesMigrationTest : public TopSitesTest { virtual void SetUp() { TopSitesTest::SetUp(); - FilePath data_path; + base::FilePath data_path; ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &data_path)); data_path = data_path.AppendASCII("top_sites"); @@ -1237,7 +1237,7 @@ TEST_F(TopSitesUnloadTest, UnloadHistoryTest) { // loaded we don't hit any assertions. TEST_F(TopSitesUnloadTest, UnloadWithMigration) { // Set up history and thumbnails as they would be before migration. - FilePath data_path; + base::FilePath data_path; ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &data_path)); data_path = data_path.AppendASCII("top_sites"); ASSERT_NO_FATAL_FAILURE(ExecuteSQLScript( diff --git a/chrome/browser/history/url_database_unittest.cc b/chrome/browser/history/url_database_unittest.cc index e93536d..6b4cb28 100644 --- a/chrome/browser/history/url_database_unittest.cc +++ b/chrome/browser/history/url_database_unittest.cc @@ -49,7 +49,7 @@ class URLDatabaseTest : public testing::Test, // Test setup. virtual void SetUp() { ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); - FilePath db_file = temp_dir_.path().AppendASCII("URLTest.db"); + base::FilePath db_file = temp_dir_.path().AppendASCII("URLTest.db"); EXPECT_TRUE(db_.Open(db_file)); diff --git a/chrome/browser/history/url_index_private_data.cc b/chrome/browser/history/url_index_private_data.cc index 3b1a3fa..59e836a 100644 --- a/chrome/browser/history/url_index_private_data.cc +++ b/chrome/browser/history/url_index_private_data.cc @@ -282,7 +282,7 @@ bool URLIndexPrivateData::DeleteURL(const GURL& url) { // static void URLIndexPrivateData::RestoreFromFileTask( - const FilePath& file_path, + const base::FilePath& file_path, scoped_refptr<URLIndexPrivateData> private_data, const std::string& languages) { private_data = URLIndexPrivateData::RestoreFromFile(file_path, languages); @@ -320,7 +320,7 @@ scoped_refptr<URLIndexPrivateData> URLIndexPrivateData::RebuildFromHistory( // static bool URLIndexPrivateData::WritePrivateDataToCacheFileTask( scoped_refptr<URLIndexPrivateData> private_data, - const FilePath& file_path) { + const base::FilePath& file_path) { DCHECK(private_data.get()); DCHECK(!file_path.empty()); return private_data->SaveToFile(file_path); @@ -804,7 +804,7 @@ void URLIndexPrivateData::ResetSearchTermCache() { // Cache Saving ---------------------------------------------------------------- -bool URLIndexPrivateData::SaveToFile(const FilePath& file_path) { +bool URLIndexPrivateData::SaveToFile(const base::FilePath& file_path) { base::TimeTicks beginning_time = base::TimeTicks::Now(); InMemoryURLIndexCacheItem index_cache; SavePrivateData(&index_cache); @@ -953,7 +953,7 @@ void URLIndexPrivateData::SaveWordStartsMap( // static scoped_refptr<URLIndexPrivateData> URLIndexPrivateData::RestoreFromFile( - const FilePath& file_path, + const base::FilePath& file_path, const std::string& languages) { base::TimeTicks beginning_time = base::TimeTicks::Now(); if (!file_util::PathExists(file_path)) diff --git a/chrome/browser/history/url_index_private_data.h b/chrome/browser/history/url_index_private_data.h index 8b63c41..d2d3ebb 100644 --- a/chrome/browser/history/url_index_private_data.h +++ b/chrome/browser/history/url_index_private_data.h @@ -89,7 +89,7 @@ class URLIndexPrivateData // of the cache file stored in |file_path|, and assigns it to |private_data|. // |languages| will be used to break URLs and page titles into words. static void RestoreFromFileTask( - const FilePath& file_path, + const base::FilePath& file_path, scoped_refptr<URLIndexPrivateData> private_data, const std::string& languages); @@ -106,7 +106,7 @@ class URLIndexPrivateData // Writes |private_data| as a cache file to |file_path| and returns success. static bool WritePrivateDataToCacheFileTask( scoped_refptr<URLIndexPrivateData> private_data, - const FilePath& file_path); + const base::FilePath& file_path); // Creates a copy of ourself. scoped_refptr<URLIndexPrivateData> Duplicate() const; @@ -259,7 +259,7 @@ class URLIndexPrivateData // Caches the index private data and writes the cache file to the profile // directory. Called by WritePrivateDataToCacheFileTask. - bool SaveToFile(const FilePath& file_path); + bool SaveToFile(const base::FilePath& file_path); // Encode a data structure into the protobuf |cache|. void SavePrivateData(imui::InMemoryURLIndexCacheItem* cache) const; @@ -275,7 +275,7 @@ class URLIndexPrivateData // restored data but upon failure will be empty. |languages| will be used to // break URLs and page titles into words static scoped_refptr<URLIndexPrivateData> RestoreFromFile( - const FilePath& path, + const base::FilePath& path, const std::string& languages); // Decode a data structure from the protobuf |cache|. Return false if there diff --git a/chrome/browser/history/visit_database_unittest.cc b/chrome/browser/history/visit_database_unittest.cc index caf10dd..a76bef5 100644 --- a/chrome/browser/history/visit_database_unittest.cc +++ b/chrome/browser/history/visit_database_unittest.cc @@ -48,7 +48,7 @@ class VisitDatabaseTest : public PlatformTest, virtual void SetUp() { PlatformTest::SetUp(); ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); - FilePath db_file = temp_dir_.path().AppendASCII("VisitTest.db"); + base::FilePath db_file = temp_dir_.path().AppendASCII("VisitTest.db"); EXPECT_TRUE(db_.Open(db_file)); diff --git a/chrome/browser/icon_loader_linux.cc b/chrome/browser/icon_loader_linux.cc index 9edbd9c..838d070 100644 --- a/chrome/browser/icon_loader_linux.cc +++ b/chrome/browser/icon_loader_linux.cc @@ -33,7 +33,7 @@ void IconLoader::ReadIcon() { NOTREACHED(); } - FilePath filename = base::nix::GetMimeIcon(group_, size_pixels); + base::FilePath filename = base::nix::GetMimeIcon(group_, size_pixels); // We don't support SVG icons; this just spams the terminal so fail quickly // and don't try to read the file from disk first. if (filename.Extension() != ".svg") { diff --git a/chrome/browser/icon_manager.cc b/chrome/browser/icon_manager.cc index 2f1444e..991a214 100644 --- a/chrome/browser/icon_manager.cc +++ b/chrome/browser/icon_manager.cc @@ -38,7 +38,7 @@ IconManager::~IconManager() { STLDeleteValues(&icon_cache_); } -gfx::Image* IconManager::LookupIcon(const FilePath& file_name, +gfx::Image* IconManager::LookupIcon(const base::FilePath& file_name, IconLoader::IconSize size) { IconGroupID group = GetGroupIDFromFilepath(file_name); IconMap::iterator it = icon_cache_.find(CacheKey(group, size)); @@ -49,7 +49,7 @@ gfx::Image* IconManager::LookupIcon(const FilePath& file_name, } CancelableTaskTracker::TaskId IconManager::LoadIcon( - const FilePath& file_name, + const base::FilePath& file_name, IconLoader::IconSize size, const IconRequestCallback& callback, CancelableTaskTracker* tracker) { diff --git a/chrome/browser/icon_manager_android.cc b/chrome/browser/icon_manager_android.cc index 393af5e..f41b5de 100644 --- a/chrome/browser/icon_manager_android.cc +++ b/chrome/browser/icon_manager_android.cc @@ -5,7 +5,8 @@ #include "base/logging.h" #include "chrome/browser/icon_manager.h" -IconGroupID IconManager::GetGroupIDFromFilepath(const base::FilePath& filepath) { +IconGroupID IconManager::GetGroupIDFromFilepath( + const base::FilePath& filepath) { NOTIMPLEMENTED(); return 0; } diff --git a/chrome/browser/icon_manager_chromeos.cc b/chrome/browser/icon_manager_chromeos.cc index 2f82c8f..60d173b 100644 --- a/chrome/browser/icon_manager_chromeos.cc +++ b/chrome/browser/icon_manager_chromeos.cc @@ -7,6 +7,7 @@ #include "base/file_path.h" #include "base/string_util.h" -IconGroupID IconManager::GetGroupIDFromFilepath(const FilePath& filepath) { +IconGroupID IconManager::GetGroupIDFromFilepath( + const base::FilePath& filepath) { return StringToLowerASCII(filepath.Extension()); } diff --git a/chrome/browser/icon_manager_mac.mm b/chrome/browser/icon_manager_mac.mm index 9f13218..09361ba 100644 --- a/chrome/browser/icon_manager_mac.mm +++ b/chrome/browser/icon_manager_mac.mm @@ -7,6 +7,7 @@ #include "base/file_path.h" #include "base/sys_string_conversions.h" -IconGroupID IconManager::GetGroupIDFromFilepath(const FilePath& filepath) { +IconGroupID IconManager::GetGroupIDFromFilepath( + const base::FilePath& filepath) { return filepath.Extension(); } diff --git a/chrome/browser/icon_manager_win.cc b/chrome/browser/icon_manager_win.cc index b1eb860..7bf192f 100644 --- a/chrome/browser/icon_manager_win.cc +++ b/chrome/browser/icon_manager_win.cc @@ -6,7 +6,8 @@ #include "base/file_path.h" -IconGroupID IconManager::GetGroupIDFromFilepath(const FilePath& filepath) { +IconGroupID IconManager::GetGroupIDFromFilepath( + const base::FilePath& filepath) { std::wstring extension = filepath.Extension(); if (extension != L".exe" && extension != L".dll" && extension != L".ico") return extension; diff --git a/chrome/browser/iframe_browsertest.cc b/chrome/browser/iframe_browsertest.cc index f3ef8a29..9e46ba4 100644 --- a/chrome/browser/iframe_browsertest.cc +++ b/chrome/browser/iframe_browsertest.cc @@ -15,7 +15,7 @@ class IFrameTest : public InProcessBrowserTest { protected: void NavigateAndVerifyTitle(const char* file, const char* page_title) { GURL url = ui_test_utils::GetTestUrl( - FilePath(), FilePath().AppendASCII(file)); + base::FilePath(), base::FilePath().AppendASCII(file)); ui_test_utils::NavigateToURL(browser(), url); EXPECT_EQ(ASCIIToUTF16(page_title), diff --git a/chrome/browser/importer/firefox2_importer.cc b/chrome/browser/importer/firefox2_importer.cc index d524b64..8e88d23 100644 --- a/chrome/browser/importer/firefox2_importer.cc +++ b/chrome/browser/importer/firefox2_importer.cc @@ -90,9 +90,9 @@ void Firefox2Importer::StartImport( } // static -void Firefox2Importer::LoadDefaultBookmarks(const FilePath& app_path, +void Firefox2Importer::LoadDefaultBookmarks(const base::FilePath& app_path, std::set<GURL> *urls) { - FilePath file = app_path.AppendASCII("defaults") + base::FilePath file = app_path.AppendASCII("defaults") .AppendASCII("profile") .AppendASCII("bookmarks.html"); @@ -145,7 +145,7 @@ TemplateURL* Firefox2Importer::CreateTemplateURL(const string16& title, // static void Firefox2Importer::ImportBookmarksFile( - const FilePath& file_path, + const base::FilePath& file_path, const std::set<GURL>& default_urls, Importer* importer, std::vector<ProfileWriter::BookmarkEntry>* bookmarks, @@ -299,7 +299,7 @@ void Firefox2Importer::ImportBookmarks() { std::vector<ProfileWriter::BookmarkEntry> bookmarks, toolbar_bookmarks; std::vector<TemplateURL*> template_urls; std::vector<history::ImportedFaviconUsage> favicons; - FilePath file = source_path_; + base::FilePath file = source_path_; if (!parsing_bookmarks_html_file_) file = file.AppendASCII("bookmarks.html"); @@ -331,7 +331,7 @@ void Firefox2Importer::ImportPasswords() { // Firefox 2 uses signons2.txt to store the pssswords. If it doesn't // exist, we try to find its older version. - FilePath file = source_path_.AppendASCII("signons2.txt"); + base::FilePath file = source_path_.AppendASCII("signons2.txt"); if (!file_util::PathExists(file)) { file = source_path_.AppendASCII("signons.txt"); } @@ -349,12 +349,12 @@ void Firefox2Importer::ImportPasswords() { } void Firefox2Importer::ImportHistory() { - FilePath file = source_path_.AppendASCII("history.dat"); + base::FilePath file = source_path_.AppendASCII("history.dat"); ImportHistoryFromFirefox2(file, bridge_); } void Firefox2Importer::ImportSearchEngines() { - std::vector<FilePath> files; + std::vector<base::FilePath> files; GetSearchEnginesXMLFiles(&files); std::vector<TemplateURL*> search_engines; @@ -371,15 +371,15 @@ void Firefox2Importer::ImportHomepage() { } void Firefox2Importer::GetSearchEnginesXMLFiles( - std::vector<FilePath>* files) { + std::vector<base::FilePath>* files) { // Search engines are contained in XML files in a searchplugins directory that // can be found in 2 locations: // - Firefox install dir (default search engines) // - the profile dir (user added search engines) - FilePath dir = app_path_.AppendASCII("searchplugins"); + base::FilePath dir = app_path_.AppendASCII("searchplugins"); FindXMLFilesInDir(dir, files); - FilePath profile_dir = source_path_.AppendASCII("searchplugins"); + base::FilePath profile_dir = source_path_.AppendASCII("searchplugins"); FindXMLFilesInDir(profile_dir, files); } @@ -622,12 +622,12 @@ void Firefox2Importer::HTMLUnescape(string16* text) { // static void Firefox2Importer::FindXMLFilesInDir( - const FilePath& dir, - std::vector<FilePath>* xml_files) { + const base::FilePath& dir, + std::vector<base::FilePath>* xml_files) { file_util::FileEnumerator file_enum(dir, false, file_util::FileEnumerator::FILES, FILE_PATH_LITERAL("*.xml")); - FilePath file(file_enum.Next()); + base::FilePath file(file_enum.Next()); while (!file.empty()) { xml_files->push_back(file); file = file_enum.Next(); diff --git a/chrome/browser/importer/firefox2_importer.h b/chrome/browser/importer/firefox2_importer.h index 8a7337a..a8d880e 100644 --- a/chrome/browser/importer/firefox2_importer.h +++ b/chrome/browser/importer/firefox2_importer.h @@ -30,7 +30,7 @@ class Firefox2Importer : public Importer { // Loads the default bookmarks in the Firefox installed at |firefox_app_path|, // and stores their locations in |urls|. - static void LoadDefaultBookmarks(const FilePath& firefox_app_path, + static void LoadDefaultBookmarks(const base::FilePath& firefox_app_path, std::set<GURL>* urls); // Creates a TemplateURL with the |keyword| and |url|. |title| may be empty. @@ -43,7 +43,7 @@ class Firefox2Importer : public Importer { // |favicons| may be null, in which case TemplateURLs and favicons are // not parsed. Any bookmarks in |default_urls| are ignored. static void ImportBookmarksFile( - const FilePath& file_path, + const base::FilePath& file_path, const std::set<GURL>& default_urls, Importer* importer, std::vector<ProfileWriter::BookmarkEntry>* bookmarks, @@ -67,7 +67,7 @@ class Firefox2Importer : public Importer { // Fills |files| with the paths to the files containing the search engine // descriptions. - void GetSearchEnginesXMLFiles(std::vector<FilePath>* files); + void GetSearchEnginesXMLFiles(std::vector<base::FilePath>* files); // Helper methods for parsing bookmark file. // Firefox 2 saves its bookmarks in a html file. We are interested in the @@ -124,8 +124,8 @@ class Firefox2Importer : public Importer { static void HTMLUnescape(string16* text); // Fills |xml_files| with the file with an xml extension found under |dir|. - static void FindXMLFilesInDir(const FilePath& dir, - std::vector<FilePath>* xml_files); + static void FindXMLFilesInDir(const base::FilePath& dir, + std::vector<base::FilePath>* xml_files); // Given the URL of a page and a favicon data URL, adds an appropriate record // to the given favicon usage vector. Will do nothing if the favicon is not @@ -135,8 +135,8 @@ class Firefox2Importer : public Importer { const GURL& favicon_data, std::vector<history::ImportedFaviconUsage>* favicons); - FilePath source_path_; - FilePath app_path_; + base::FilePath source_path_; + base::FilePath app_path_; // If true, we only parse the bookmarks.html file specified as source_path_. bool parsing_bookmarks_html_file_; diff --git a/chrome/browser/importer/firefox3_importer.cc b/chrome/browser/importer/firefox3_importer.cc index 6a38c66..2cab2ca 100644 --- a/chrome/browser/importer/firefox3_importer.cc +++ b/chrome/browser/importer/firefox3_importer.cc @@ -109,7 +109,7 @@ void Firefox3Importer::StartImport( } void Firefox3Importer::ImportHistory() { - FilePath file = source_path_.AppendASCII("places.sqlite"); + base::FilePath file = source_path_.AppendASCII("places.sqlite"); if (!file_util::PathExists(file)) return; @@ -153,7 +153,7 @@ void Firefox3Importer::ImportHistory() { } void Firefox3Importer::ImportBookmarks() { - FilePath file = source_path_.AppendASCII("places.sqlite"); + base::FilePath file = source_path_.AppendASCII("places.sqlite"); if (!file_util::PathExists(file)) return; @@ -308,8 +308,8 @@ void Firefox3Importer::ImportPasswords() { } std::vector<content::PasswordForm> forms; - FilePath source_path = source_path_; - FilePath file = source_path.AppendASCII("signons.sqlite"); + base::FilePath source_path = source_path_; + base::FilePath file = source_path.AppendASCII("signons.sqlite"); if (file_util::PathExists(file)) { // Since Firefox 3.1, passwords are in signons.sqlite db. decryptor.ReadAndParseSignons(file, &forms); @@ -332,7 +332,7 @@ void Firefox3Importer::ImportPasswords() { } void Firefox3Importer::ImportSearchEngines() { - std::vector<FilePath> files; + std::vector<base::FilePath> files; GetSearchEnginesXMLFiles(&files); std::vector<TemplateURL*> search_engines; @@ -349,8 +349,8 @@ void Firefox3Importer::ImportHomepage() { } void Firefox3Importer::GetSearchEnginesXMLFiles( - std::vector<FilePath>* files) { - FilePath file = source_path_.AppendASCII("search.sqlite"); + std::vector<base::FilePath>* files) { + base::FilePath file = source_path_.AppendASCII("search.sqlite"); if (!file_util::PathExists(file)) return; @@ -368,8 +368,8 @@ void Firefox3Importer::GetSearchEnginesXMLFiles( if (!s.is_valid()) return; - FilePath app_path = app_path_.AppendASCII("searchplugins"); - FilePath profile_path = source_path_.AppendASCII("searchplugins"); + base::FilePath app_path = app_path_.AppendASCII("searchplugins"); + base::FilePath profile_path = source_path_.AppendASCII("searchplugins"); // Firefox doesn't store a search engine in its sqlite database unless the // user has added a engine. So we get search engines from sqlite db as well @@ -378,7 +378,7 @@ void Firefox3Importer::GetSearchEnginesXMLFiles( const std::string kAppPrefix("[app]/"); const std::string kProfilePrefix("[profile]/"); do { - FilePath file; + base::FilePath file; std::string engine(s.ColumnString(0)); // The string contains [app]/<name>.xml or [profile]/<name>.xml where @@ -395,9 +395,9 @@ void Firefox3Importer::GetSearchEnginesXMLFiles( } else { // Looks like absolute path to the file. #if defined(OS_WIN) - file = FilePath(UTF8ToWide(engine)); + file = base::FilePath(UTF8ToWide(engine)); #else - file = FilePath(engine); + file = base::FilePath(engine); #endif } files->push_back(file); @@ -410,8 +410,8 @@ void Firefox3Importer::GetSearchEnginesXMLFiles( // See http://crbug.com/53899 // TODO(jshin): we need to make sure our locale code matches that of // Firefox. - FilePath locale_app_path = app_path.AppendASCII(locale_); - FilePath default_locale_app_path = app_path.AppendASCII("en-US"); + base::FilePath locale_app_path = app_path.AppendASCII(locale_); + base::FilePath default_locale_app_path = app_path.AppendASCII("en-US"); if (file_util::DirectoryExists(locale_app_path)) app_path = locale_app_path; else if (file_util::DirectoryExists(default_locale_app_path)) @@ -421,8 +421,8 @@ void Firefox3Importer::GetSearchEnginesXMLFiles( // Get search engine definition from file system. file_util::FileEnumerator engines(app_path, false, file_util::FileEnumerator::FILES); - for (FilePath engine_path = engines.Next(); !engine_path.value().empty(); - engine_path = engines.Next()) { + for (base::FilePath engine_path = engines.Next(); + !engine_path.value().empty(); engine_path = engines.Next()) { files->push_back(engine_path); } } diff --git a/chrome/browser/importer/firefox3_importer.h b/chrome/browser/importer/firefox3_importer.h index 550d0d2..877a0fa 100644 --- a/chrome/browser/importer/firefox3_importer.h +++ b/chrome/browser/importer/firefox3_importer.h @@ -49,7 +49,7 @@ class Firefox3Importer : public Importer { // Import the user's home page, unless it is set to default home page as // defined in browserconfig.properties. void ImportHomepage(); - void GetSearchEnginesXMLFiles(std::vector<FilePath>* files); + void GetSearchEnginesXMLFiles(std::vector<base::FilePath>* files); // The struct stores the information about a bookmark item. struct BookmarkItem; @@ -78,8 +78,8 @@ class Firefox3Importer : public Importer { const FaviconMap& favicon_map, std::vector<history::ImportedFaviconUsage>* favicons); - FilePath source_path_; - FilePath app_path_; + base::FilePath source_path_; + base::FilePath app_path_; #if defined(OS_POSIX) && !defined(OS_MACOSX) // Stored because we can only access it from the UI thread. Not usable diff --git a/chrome/browser/importer/firefox_importer_unittest.cc b/chrome/browser/importer/firefox_importer_unittest.cc index 7ec2f21..6551b35 100644 --- a/chrome/browser/importer/firefox_importer_unittest.cc +++ b/chrome/browser/importer/firefox_importer_unittest.cc @@ -373,7 +373,7 @@ class FirefoxProfileImporterTest : public ImporterTest { virtual void SetUp() OVERRIDE { ImporterTest::SetUp(); // Creates a new profile in a new subdirectory in the temp directory. - FilePath test_path = temp_dir_.path().AppendASCII("ImporterTest"); + base::FilePath test_path = temp_dir_.path().AppendASCII("ImporterTest"); file_util::Delete(test_path, true); file_util::CreateDirectory(test_path); profile_path_ = test_path.AppendASCII("profile"); @@ -385,7 +385,7 @@ class FirefoxProfileImporterTest : public ImporterTest { importer::ImporterProgressObserver* observer, ProfileWriter* writer, bool import_search_plugins) { - FilePath data_path; + base::FilePath data_path; ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &data_path)); data_path = data_path.AppendASCII(profile_dir); ASSERT_TRUE(file_util::CopyDirectory(data_path, profile_path_, true)); @@ -393,7 +393,7 @@ class FirefoxProfileImporterTest : public ImporterTest { data_path = data_path.AppendASCII("firefox3_nss"); ASSERT_TRUE(file_util::CopyDirectory(data_path, profile_path_, false)); - FilePath search_engine_path = app_path_; + base::FilePath search_engine_path = app_path_; search_engine_path = search_engine_path.AppendASCII("searchplugins"); file_util::CreateDirectory(search_engine_path); if (import_search_plugins) { @@ -424,12 +424,12 @@ class FirefoxProfileImporterTest : public ImporterTest { loop->Run(); } - FilePath profile_path_; - FilePath app_path_; + base::FilePath profile_path_; + base::FilePath app_path_; }; TEST_F(FirefoxProfileImporterTest, MAYBE(Firefox2Importer)) { - FilePath data_path; + base::FilePath data_path; ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &data_path)); data_path = data_path.AppendASCII("firefox2_profile"); ASSERT_TRUE(file_util::CopyDirectory(data_path, profile_path_, true)); @@ -437,7 +437,7 @@ TEST_F(FirefoxProfileImporterTest, MAYBE(Firefox2Importer)) { data_path = data_path.AppendASCII("firefox2_nss"); ASSERT_TRUE(file_util::CopyDirectory(data_path, profile_path_, false)); - FilePath search_engine_path = app_path_; + base::FilePath search_engine_path = app_path_; search_engine_path = search_engine_path.AppendASCII("searchplugins"); file_util::CreateDirectory(search_engine_path); ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &data_path)); @@ -488,14 +488,14 @@ TEST_F(FirefoxProfileImporterTest, MAYBE(Firefox35Importer)) { // to run in a separate process, so we use a proxy object so we can share the // same test between platforms. TEST(FirefoxImporterTest, Firefox2NSS3Decryptor) { - FilePath nss_path; + base::FilePath nss_path; ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &nss_path)); #ifdef OS_MACOSX nss_path = nss_path.AppendASCII("firefox2_nss_mac"); #else nss_path = nss_path.AppendASCII("firefox2_nss"); #endif // !OS_MACOSX - FilePath db_path; + base::FilePath db_path; ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &db_path)); db_path = db_path.AppendASCII("firefox2_profile"); @@ -513,14 +513,14 @@ TEST(FirefoxImporterTest, Firefox2NSS3Decryptor) { } TEST(FirefoxImporterTest, Firefox3NSS3Decryptor) { - FilePath nss_path; + base::FilePath nss_path; ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &nss_path)); #ifdef OS_MACOSX nss_path = nss_path.AppendASCII("firefox3_nss_mac"); #else nss_path = nss_path.AppendASCII("firefox3_nss"); #endif // !OS_MACOSX - FilePath db_path; + base::FilePath db_path; ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &db_path)); db_path = db_path.AppendASCII("firefox3_profile"); @@ -654,12 +654,12 @@ TEST(FirefoxImporterTest, Firefox2BookmarkParse) { } TEST(FirefoxImporterTest, Firefox2BookmarkFileImport) { - FilePath path; + base::FilePath path; ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &path)); path = path.AppendASCII("firefox2_importer"); // Import all bookmarks from a file which include an empty folder entry. - FilePath empty_folder_path = path.AppendASCII("empty_folder.html"); + base::FilePath empty_folder_path = path.AppendASCII("empty_folder.html"); std::set<GURL> default_urls; Firefox2Importer* importer = new Firefox2Importer(); importer->AddRef(); @@ -726,7 +726,7 @@ TEST(FirefoxImporterTest, Firefox2BookmarkFileImport) { } // Import Epiphany bookmarks from a file - FilePath epiphany_path = path.AppendASCII("epiphany.html"); + base::FilePath epiphany_path = path.AppendASCII("epiphany.html"); bookmarks.clear(); default_urls.clear(); importer->ImportBookmarksFile(epiphany_path, default_urls, diff --git a/chrome/browser/importer/firefox_importer_unittest_messages_internal.h b/chrome/browser/importer/firefox_importer_unittest_messages_internal.h index b0e25c2..ce29947 100644 --- a/chrome/browser/importer/firefox_importer_unittest_messages_internal.h +++ b/chrome/browser/importer/firefox_importer_unittest_messages_internal.h @@ -11,8 +11,8 @@ // Server->Child: Initialize the decrytor with the following paramters. IPC_MESSAGE_CONTROL2(Msg_Decryptor_Init, - FilePath /* dll_path */, - FilePath /* db_path */) + base::FilePath /* dll_path */, + base::FilePath /* db_path */) // Child->Server: Return paramter from init call. IPC_MESSAGE_CONTROL1(Msg_Decryptor_InitReturnCode, bool /* ret */) diff --git a/chrome/browser/importer/firefox_importer_unittest_utils.h b/chrome/browser/importer/firefox_importer_unittest_utils.h index 51d40ac..1d6cc69 100644 --- a/chrome/browser/importer/firefox_importer_unittest_utils.h +++ b/chrome/browser/importer/firefox_importer_unittest_utils.h @@ -34,10 +34,11 @@ class FFUnitTestDecryptorProxy { // Initialize a decryptor, returns true if the object was // constructed successfully. - bool Setup(const FilePath& nss_path); + bool Setup(const base::FilePath& nss_path); // This match the parallel functions in NSSDecryptor. - bool DecryptorInit(const FilePath& dll_path, const FilePath& db_path); + bool DecryptorInit(const base::FilePath& dll_path, + const base::FilePath& db_path); string16 Decrypt(const std::string& crypt); private: @@ -67,12 +68,12 @@ FFUnitTestDecryptorProxy::FFUnitTestDecryptorProxy() { FFUnitTestDecryptorProxy::~FFUnitTestDecryptorProxy() { } -bool FFUnitTestDecryptorProxy::Setup(const FilePath& nss_path) { +bool FFUnitTestDecryptorProxy::Setup(const base::FilePath& nss_path) { return true; } -bool FFUnitTestDecryptorProxy::DecryptorInit(const FilePath& dll_path, - const FilePath& db_path) { +bool FFUnitTestDecryptorProxy::DecryptorInit(const base::FilePath& dll_path, + const base::FilePath& db_path) { return decryptor_.Init(dll_path, db_path); } diff --git a/chrome/browser/importer/firefox_importer_unittest_utils_mac.cc b/chrome/browser/importer/firefox_importer_unittest_utils_mac.cc index 077571a..f9891c5 100644 --- a/chrome/browser/importer/firefox_importer_unittest_utils_mac.cc +++ b/chrome/browser/importer/firefox_importer_unittest_utils_mac.cc @@ -33,7 +33,7 @@ const char kTestChannelID[] = "T1"; // |channel| - IPC Channel to use for communication. // |handle| - On return, the process handle to use to communicate with the // child. -bool LaunchNSSDecrypterChildProcess(const FilePath& nss_path, +bool LaunchNSSDecrypterChildProcess(const base::FilePath& nss_path, IPC::Channel* channel, base::ProcessHandle* handle) { CommandLine cl(*CommandLine::ForCurrentProcess()); cl.AppendSwitchASCII(switches::kTestChildProcess, "NSSDecrypterChildProcess"); @@ -130,7 +130,7 @@ FFUnitTestDecryptorProxy::FFUnitTestDecryptorProxy() : child_process_(0) { } -bool FFUnitTestDecryptorProxy::Setup(const FilePath& nss_path) { +bool FFUnitTestDecryptorProxy::Setup(const base::FilePath& nss_path) { // Create a new message loop and spawn the child process. message_loop_.reset(new MessageLoopForIO()); @@ -196,8 +196,8 @@ bool FFUnitTestDecryptorProxy::WaitForClientResponse() { return ret; } -bool FFUnitTestDecryptorProxy::DecryptorInit(const FilePath& dll_path, - const FilePath& db_path) { +bool FFUnitTestDecryptorProxy::DecryptorInit(const base::FilePath& dll_path, + const base::FilePath& db_path) { channel_->Send(new Msg_Decryptor_Init(dll_path, db_path)); bool ok = WaitForClientResponse(); if (ok && listener_->got_result) { @@ -230,7 +230,7 @@ class FFDecryptorClientChannelListener : public IPC::Listener { sender_ = sender; } - void OnDecryptor_Init(FilePath dll_path, FilePath db_path) { + void OnDecryptor_Init(base::FilePath dll_path, base::FilePath db_path) { bool ret = decryptor_.Init(dll_path, db_path); sender_->Send(new Msg_Decryptor_InitReturnCode(ret)); } diff --git a/chrome/browser/importer/firefox_importer_utils.cc b/chrome/browser/importer/firefox_importer_utils.cc index 071423e..2bbcb39 100644 --- a/chrome/browser/importer/firefox_importer_utils.cc +++ b/chrome/browser/importer/firefox_importer_utils.cc @@ -49,12 +49,12 @@ class FirefoxURLParameterFilter : public TemplateURLParser::ParameterFilter { }; } // namespace -FilePath GetFirefoxProfilePath() { +base::FilePath GetFirefoxProfilePath() { DictionaryValue root; - FilePath ini_file = GetProfilesINI(); + base::FilePath ini_file = GetProfilesINI(); ParseProfileINI(ini_file, &root); - FilePath source_path; + base::FilePath source_path; for (int i = 0; ; ++i) { std::string current_profile = StringPrintf("Profile%d", i); if (!root.HasKey(current_profile)) { @@ -70,7 +70,8 @@ FilePath GetFirefoxProfilePath() { ReplaceSubstringsAfterOffset( &path16, 0, ASCIIToUTF16("/"), ASCIIToUTF16("\\")); #endif - FilePath path = FilePath::FromWStringHack(UTF16ToWide(path16)); + base::FilePath path = + base::FilePath::FromWStringHack(UTF16ToWide(path16)); // IsRelative=1 means the folder path would be relative to the // path of profiles.ini. IsRelative=0 refers to a custom profile @@ -90,15 +91,16 @@ FilePath GetFirefoxProfilePath() { } } } - return FilePath(); + return base::FilePath(); } -bool GetFirefoxVersionAndPathFromProfile(const FilePath& profile_path, +bool GetFirefoxVersionAndPathFromProfile(const base::FilePath& profile_path, int* version, - FilePath* app_path) { + base::FilePath* app_path) { bool ret = false; - FilePath compatibility_file = profile_path.AppendASCII("compatibility.ini"); + base::FilePath compatibility_file = + profile_path.AppendASCII("compatibility.ini"); std::string content; file_util::ReadFileToString(compatibility_file, &content); ReplaceSubstringsAfterOffset(&content, 0, "\r\n", "\n"); @@ -120,7 +122,7 @@ bool GetFirefoxVersionAndPathFromProfile(const FilePath& profile_path, // UTF-8, what does Firefox do? If it puts raw bytes in the // file, we could go straight from bytes -> filepath; // otherwise, we're out of luck here. - *app_path = FilePath::FromWStringHack( + *app_path = base::FilePath::FromWStringHack( UTF8ToWide(line.substr(equal + 1))); } } @@ -128,7 +130,7 @@ bool GetFirefoxVersionAndPathFromProfile(const FilePath& profile_path, return ret; } -void ParseProfileINI(const FilePath& file, DictionaryValue* root) { +void ParseProfileINI(const base::FilePath& file, DictionaryValue* root) { // Reads the whole INI file. std::string content; file_util::ReadFileToString(file, &content); @@ -188,8 +190,9 @@ bool CanImportURL(const GURL& url) { return true; } -void ParseSearchEnginesFromXMLFiles(const std::vector<FilePath>& xml_files, - std::vector<TemplateURL*>* search_engines) { +void ParseSearchEnginesFromXMLFiles( + const std::vector<base::FilePath>& xml_files, + std::vector<TemplateURL*>* search_engines) { DCHECK(search_engines); typedef std::map<std::string, TemplateURL*> SearchEnginesMap; @@ -198,8 +201,8 @@ void ParseSearchEnginesFromXMLFiles(const std::vector<FilePath>& xml_files, // The first XML file represents the default search engine in Firefox 3, so we // need to keep it on top of the list. SearchEnginesMap::const_iterator default_turl = search_engine_for_url.end(); - for (std::vector<FilePath>::const_iterator file_iter = xml_files.begin(); - file_iter != xml_files.end(); ++file_iter) { + for (std::vector<base::FilePath>::const_iterator file_iter = + xml_files.begin(); file_iter != xml_files.end(); ++file_iter) { file_util::ReadFileToString(*file_iter, &content); FirefoxURLParameterFilter param_filter; TemplateURL* template_url = TemplateURLParser::Parse(NULL, true, @@ -234,7 +237,7 @@ void ParseSearchEnginesFromXMLFiles(const std::vector<FilePath>& xml_files, } } -bool ReadPrefFile(const FilePath& path, std::string* content) { +bool ReadPrefFile(const base::FilePath& path, std::string* content) { if (content == NULL) return false; @@ -248,7 +251,7 @@ bool ReadPrefFile(const FilePath& path, std::string* content) { return true; } -std::string ReadBrowserConfigProp(const FilePath& app_path, +std::string ReadBrowserConfigProp(const base::FilePath& app_path, const std::string& pref_key) { std::string content; if (!ReadPrefFile(app_path.AppendASCII("browserconfig.properties"), &content)) @@ -273,7 +276,7 @@ std::string ReadBrowserConfigProp(const FilePath& app_path, return content.substr(start + 1, stop - start - 1); } -std::string ReadPrefsJsValue(const FilePath& profile_path, +std::string ReadPrefsJsValue(const base::FilePath& profile_path, const std::string& pref_key) { std::string content; if (!ReadPrefFile(profile_path.AppendASCII("prefs.js"), &content)) @@ -282,7 +285,7 @@ std::string ReadPrefsJsValue(const FilePath& profile_path, return GetPrefsJsValue(content, pref_key); } -GURL GetHomepage(const FilePath& profile_path) { +GURL GetHomepage(const base::FilePath& profile_path) { std::string home_page_list = ReadPrefsJsValue(profile_path, "browser.startup.homepage"); @@ -293,7 +296,7 @@ GURL GetHomepage(const FilePath& profile_path) { return GURL(home_page_list.substr(0, seperator)); } -bool IsDefaultHomepage(const GURL& homepage, const FilePath& app_path) { +bool IsDefaultHomepage(const GURL& homepage, const base::FilePath& app_path) { if (!homepage.is_valid()) return false; @@ -316,7 +319,7 @@ bool IsDefaultHomepage(const GURL& homepage, const FilePath& app_path) { return false; } -bool ParsePrefFile(const FilePath& pref_file, DictionaryValue* prefs) { +bool ParsePrefFile(const base::FilePath& pref_file, DictionaryValue* prefs) { // The string that is before a pref key. const std::string kUserPrefString = "user_pref(\""; std::string contents; @@ -432,8 +435,8 @@ std::string GetPrefsJsValue(const std::string& content, // ID={ec8030f7-c20a-464f-9b0e-13a3a9e97384} // ......................................... // In this example the function returns "Iceweasel" (or a localized equivalent). -string16 GetFirefoxImporterName(const FilePath& app_path) { - const FilePath app_ini_file = app_path.AppendASCII("application.ini"); +string16 GetFirefoxImporterName(const base::FilePath& app_path) { + const base::FilePath app_ini_file = app_path.AppendASCII("application.ini"); std::string branding_name; if (file_util::PathExists(app_ini_file)) { std::string content; diff --git a/chrome/browser/importer/firefox_importer_utils_linux.cc b/chrome/browser/importer/firefox_importer_utils_linux.cc index eeefd38..98f9c2a4 100644 --- a/chrome/browser/importer/firefox_importer_utils_linux.cc +++ b/chrome/browser/importer/firefox_importer_utils_linux.cc @@ -6,16 +6,16 @@ #include "base/file_util.h" -FilePath GetProfilesINI() { - FilePath ini_file; +base::FilePath GetProfilesINI() { + base::FilePath ini_file; // The default location of the profile folder containing user data is // under user HOME directory in .mozilla/firefox folder on Linux. - FilePath home = file_util::GetHomeDir(); + base::FilePath home = file_util::GetHomeDir(); if (!home.empty()) { ini_file = home.Append(".mozilla/firefox/profiles.ini"); } if (file_util::PathExists(ini_file)) return ini_file; - return FilePath(); + return base::FilePath(); } diff --git a/chrome/browser/importer/firefox_importer_utils_mac.mm b/chrome/browser/importer/firefox_importer_utils_mac.mm index fa82369c..6aa9040 100644 --- a/chrome/browser/importer/firefox_importer_utils_mac.mm +++ b/chrome/browser/importer/firefox_importer_utils_mac.mm @@ -11,26 +11,27 @@ #include "base/mac/foundation_util.h" #include "base/path_service.h" -FilePath GetProfilesINI() { - FilePath app_data_path; +base::FilePath GetProfilesINI() { + base::FilePath app_data_path; if (!PathService::Get(base::DIR_APP_DATA, &app_data_path)) { - return FilePath(); + return base::FilePath(); } - FilePath ini_file = app_data_path.Append("Firefox").Append("profiles.ini"); + base::FilePath ini_file = + app_data_path.Append("Firefox").Append("profiles.ini"); if (!file_util::PathExists(ini_file)) { - return FilePath(); + return base::FilePath(); } return ini_file; } -FilePath GetFirefoxDylibPath() { +base::FilePath GetFirefoxDylibPath() { CFURLRef appURL = nil; if (LSFindApplicationForInfo(kLSUnknownCreator, CFSTR("org.mozilla.firefox"), NULL, NULL, &appURL) != noErr) { - return FilePath(); + return base::FilePath(); } NSBundle *ff_bundle = [NSBundle bundleWithPath:[base::mac::CFToNSCast(appURL) path]]; @@ -39,6 +40,6 @@ FilePath GetFirefoxDylibPath() { [[ff_bundle executablePath] stringByDeletingLastPathComponent]; char buf[MAXPATHLEN]; if (![ff_library_path getFileSystemRepresentation:buf maxLength:sizeof(buf)]) - return FilePath(); - return FilePath(buf); + return base::FilePath(); + return base::FilePath(buf); } diff --git a/chrome/browser/importer/firefox_importer_utils_unittest.cc b/chrome/browser/importer/firefox_importer_utils_unittest.cc index 914a4b7..b393d71 100644 --- a/chrome/browser/importer/firefox_importer_utils_unittest.cc +++ b/chrome/browser/importer/firefox_importer_utils_unittest.cc @@ -102,7 +102,8 @@ TEST(FirefoxImporterUtilsTest, GetPrefsJsValue) { TEST(FirefoxImporterUtilsTest, GetFirefoxImporterName) { base::ScopedTempDir temp_dir; ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); - const FilePath app_ini_file(temp_dir.path().AppendASCII("application.ini")); + const base::FilePath app_ini_file( + temp_dir.path().AppendASCII("application.ini")); for (size_t i = 0; i < arraysize(GetFirefoxImporterNameCases); ++i) { file_util::WriteFile(app_ini_file, GetFirefoxImporterNameCases[i].app_ini_content.c_str(), @@ -110,6 +111,8 @@ TEST(FirefoxImporterUtilsTest, GetFirefoxImporterName) { EXPECT_EQ(GetFirefoxImporterName(temp_dir.path()), l10n_util::GetStringUTF16(GetFirefoxImporterNameCases[i].resource_id)); } - EXPECT_EQ(l10n_util::GetStringUTF16(IDS_IMPORT_FROM_FIREFOX), - GetFirefoxImporterName(FilePath(FILE_PATH_LITERAL("/invalid/path")))); + EXPECT_EQ(l10n_util::GetStringUTF16( + IDS_IMPORT_FROM_FIREFOX), + GetFirefoxImporterName(base::FilePath( + FILE_PATH_LITERAL("/invalid/path")))); } diff --git a/chrome/browser/importer/firefox_importer_utils_win.cc b/chrome/browser/importer/firefox_importer_utils_win.cc index f289207..dc6e1ad 100644 --- a/chrome/browser/importer/firefox_importer_utils_win.cc +++ b/chrome/browser/importer/firefox_importer_utils_win.cc @@ -45,7 +45,7 @@ int GetCurrentFirefoxMajorVersionFromRegistry() { return highest_version; } -FilePath GetFirefoxInstallPathFromRegistry() { +base::FilePath GetFirefoxInstallPathFromRegistry() { // Detects the path that Firefox is installed in. string16 registry_path = kFirefoxPath; wchar_t buffer[MAX_PATH]; @@ -55,7 +55,7 @@ FilePath GetFirefoxInstallPathFromRegistry() { LONG result = reg_key.ReadValue(kCurrentVersion, buffer, &buffer_length, NULL); if (result != ERROR_SUCCESS) - return FilePath(); + return base::FilePath(); registry_path += L"\\" + string16(buffer) + L"\\Main"; buffer_length = sizeof(buffer); @@ -64,19 +64,19 @@ FilePath GetFirefoxInstallPathFromRegistry() { result = reg_key_directory.ReadValue(L"Install Directory", buffer, &buffer_length, NULL); - return (result != ERROR_SUCCESS) ? FilePath() : FilePath(buffer); + return (result != ERROR_SUCCESS) ? base::FilePath() : base::FilePath(buffer); } -FilePath GetProfilesINI() { - FilePath ini_file; +base::FilePath GetProfilesINI() { + base::FilePath ini_file; // The default location of the profile folder containing user data is // under the "Application Data" folder in Windows XP, Vista, and 7. if (!PathService::Get(base::DIR_APP_DATA, &ini_file)) - return FilePath(); + return base::FilePath(); ini_file = ini_file.AppendASCII("Mozilla"); ini_file = ini_file.AppendASCII("Firefox"); ini_file = ini_file.AppendASCII("profiles.ini"); - return file_util::PathExists(ini_file) ? ini_file : FilePath(); + return file_util::PathExists(ini_file) ? ini_file : base::FilePath(); } diff --git a/chrome/browser/importer/firefox_profile_lock.cc b/chrome/browser/importer/firefox_profile_lock.cc index aa66bff..1232890 100644 --- a/chrome/browser/importer/firefox_profile_lock.cc +++ b/chrome/browser/importer/firefox_profile_lock.cc @@ -54,22 +54,22 @@ // static #if defined(OS_MACOSX) -const FilePath::CharType* FirefoxProfileLock::kLockFileName = +const base::FilePath::CharType* FirefoxProfileLock::kLockFileName = FILE_PATH_LITERAL(".parentlock"); -const FilePath::CharType* FirefoxProfileLock::kOldLockFileName = +const base::FilePath::CharType* FirefoxProfileLock::kOldLockFileName = FILE_PATH_LITERAL("parent.lock"); #elif defined(OS_POSIX) // http://www.google.com/codesearch/p?hl=en#e_ObwTAVPyo/profile/dirserviceprovider/src/nsProfileLock.cpp&l=433 -const FilePath::CharType* FirefoxProfileLock::kLockFileName = +const base::FilePath::CharType* FirefoxProfileLock::kLockFileName = FILE_PATH_LITERAL(".parentlock"); -const FilePath::CharType* FirefoxProfileLock::kOldLockFileName = +const base::FilePath::CharType* FirefoxProfileLock::kOldLockFileName = FILE_PATH_LITERAL("lock"); #else -const FilePath::CharType* FirefoxProfileLock::kLockFileName = +const base::FilePath::CharType* FirefoxProfileLock::kLockFileName = FILE_PATH_LITERAL("parent.lock"); #endif -FirefoxProfileLock::FirefoxProfileLock(const FilePath& path) { +FirefoxProfileLock::FirefoxProfileLock(const base::FilePath& path) { Init(); lock_file_ = path.Append(kLockFileName); Lock(); diff --git a/chrome/browser/importer/firefox_profile_lock.h b/chrome/browser/importer/firefox_profile_lock.h index 210d878..98141675 100644 --- a/chrome/browser/importer/firefox_profile_lock.h +++ b/chrome/browser/importer/firefox_profile_lock.h @@ -67,7 +67,7 @@ class FirefoxProfileLock { public: - explicit FirefoxProfileLock(const FilePath& path); + explicit FirefoxProfileLock(const base::FilePath& path); ~FirefoxProfileLock(); // Locks and releases the profile. @@ -81,13 +81,13 @@ class FirefoxProfileLock { FRIEND_TEST_ALL_PREFIXES(FirefoxProfileLockTest, ProfileLock); FRIEND_TEST_ALL_PREFIXES(FirefoxProfileLockTest, ProfileLockOrphaned); - static const FilePath::CharType* kLockFileName; - static const FilePath::CharType* kOldLockFileName; + static const base::FilePath::CharType* kLockFileName; + static const base::FilePath::CharType* kOldLockFileName; void Init(); // Full path of the lock file in the profile folder. - FilePath lock_file_; + base::FilePath lock_file_; // The handle of the lock file. #if defined(OS_WIN) @@ -98,7 +98,7 @@ class FirefoxProfileLock { // On Posix systems Firefox apparently first tries to put a fcntl lock // on a file and if that fails, it does a regular exculsive open on another // file. This variable contains the location of this other file. - FilePath old_lock_file_; + base::FilePath old_lock_file_; // Method that tries to put a fcntl lock on file specified by |lock_file_|. // Returns false if lock is already held by another process. true in all diff --git a/chrome/browser/importer/firefox_profile_lock_unittest.cc b/chrome/browser/importer/firefox_profile_lock_unittest.cc index a9a2257..1f1f043 100644 --- a/chrome/browser/importer/firefox_profile_lock_unittest.cc +++ b/chrome/browser/importer/firefox_profile_lock_unittest.cc @@ -33,8 +33,9 @@ TEST_F(FirefoxProfileLockTest, LockTest) { // Tests basic functionality and verifies that the lock file is deleted after // use. TEST_F(FirefoxProfileLockTest, ProfileLock) { - FilePath test_path = temp_dir_.path(); - FilePath lock_file_path = test_path.Append(FirefoxProfileLock::kLockFileName); + base::FilePath test_path = temp_dir_.path(); + base::FilePath lock_file_path = + test_path.Append(FirefoxProfileLock::kLockFileName); scoped_ptr<FirefoxProfileLock> lock; EXPECT_EQ(static_cast<FirefoxProfileLock*>(NULL), lock.get()); @@ -65,8 +66,9 @@ TEST_F(FirefoxProfileLockTest, ProfileLock) { // If for some reason the lock file is left behind by the previous owner, we // should still be able to lock it, at least in the Windows implementation. TEST_F(FirefoxProfileLockTest, ProfileLockOrphaned) { - FilePath test_path = temp_dir_.path(); - FilePath lock_file_path = test_path.Append(FirefoxProfileLock::kLockFileName); + base::FilePath test_path = temp_dir_.path(); + base::FilePath lock_file_path = + test_path.Append(FirefoxProfileLock::kLockFileName); // Create the orphaned lock file. FILE* lock_file = file_util::OpenFile(lock_file_path, "w"); @@ -87,7 +89,7 @@ TEST_F(FirefoxProfileLockTest, ProfileLockOrphaned) { #if !defined(OS_POSIX) // Tests two locks contending for the same lock file. TEST_F(FirefoxProfileLockTest, ProfileLockContention) { - FilePath test_path = temp_dir_.path(); + base::FilePath test_path = temp_dir_.path(); scoped_ptr<FirefoxProfileLock> lock1; EXPECT_EQ(static_cast<FirefoxProfileLock*>(NULL), lock1.get()); diff --git a/chrome/browser/importer/firefox_proxy_settings.cc b/chrome/browser/importer/firefox_proxy_settings.cc index f92df2e..427bca84 100644 --- a/chrome/browser/importer/firefox_proxy_settings.cc +++ b/chrome/browser/importer/firefox_proxy_settings.cc @@ -88,10 +88,10 @@ bool FirefoxProxySettings::GetSettings(FirefoxProxySettings* settings) { DCHECK(settings); settings->Reset(); - FilePath profile_path = GetFirefoxProfilePath(); + base::FilePath profile_path = GetFirefoxProfilePath(); if (profile_path.empty()) return false; - FilePath pref_file = profile_path.AppendASCII(kPrefFileName); + base::FilePath pref_file = profile_path.AppendASCII(kPrefFileName); return GetSettingsFromFile(pref_file, settings); } @@ -159,7 +159,7 @@ bool FirefoxProxySettings::ToProxyConfig(net::ProxyConfig* config) { } // static -bool FirefoxProxySettings::GetSettingsFromFile(const FilePath& pref_file, +bool FirefoxProxySettings::GetSettingsFromFile(const base::FilePath& pref_file, FirefoxProxySettings* settings) { DictionaryValue dictionary; if (!ParsePrefFile(pref_file, &dictionary)) diff --git a/chrome/browser/importer/firefox_proxy_settings_unittest.cc b/chrome/browser/importer/firefox_proxy_settings_unittest.cc index 3781741..3912793 100644 --- a/chrome/browser/importer/firefox_proxy_settings_unittest.cc +++ b/chrome/browser/importer/firefox_proxy_settings_unittest.cc @@ -17,7 +17,7 @@ class TestFirefoxProxySettings : public FirefoxProxySettings { public: TestFirefoxProxySettings() {} - static bool TestGetSettingsFromFile(const FilePath& pref_file, + static bool TestGetSettingsFromFile(const base::FilePath& pref_file, FirefoxProxySettings* settings) { return GetSettingsFromFile(pref_file, settings); } @@ -26,7 +26,7 @@ class TestFirefoxProxySettings : public FirefoxProxySettings { TEST_F(FirefoxProxySettingsTest, TestParse) { FirefoxProxySettings settings; - FilePath js_pref_path; + base::FilePath js_pref_path; ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &js_pref_path)); js_pref_path = js_pref_path.AppendASCII("firefox3_pref.js"); @@ -68,7 +68,7 @@ TEST_F(FirefoxProxySettingsTest, TestParse) { TEST_F(FirefoxProxySettingsTest, TestParseAutoConfigUrl) { FirefoxProxySettings settings; - FilePath js_pref_path; + base::FilePath js_pref_path; ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &js_pref_path)); js_pref_path = js_pref_path.AppendASCII("firefox3_pref_pac_url.js"); diff --git a/chrome/browser/importer/ie_importer.cc b/chrome/browser/importer/ie_importer.cc index 481b1228..b1d606b 100644 --- a/chrome/browser/importer/ie_importer.cc +++ b/chrome/browser/importer/ie_importer.cc @@ -120,21 +120,21 @@ struct IEOrderBookmarkComparator { bool operator()(const ProfileWriter::BookmarkEntry& lhs, const ProfileWriter::BookmarkEntry& rhs) const { static const uint32 kNotSorted = 0xfffffffb; // IE uses this magic value. - FilePath lhs_prefix; - FilePath rhs_prefix; + base::FilePath lhs_prefix; + base::FilePath rhs_prefix; for (size_t i = 0; i <= lhs.path.size() && i <= rhs.path.size(); ++i) { - const FilePath::StringType lhs_i = + const base::FilePath::StringType lhs_i = (i < lhs.path.size() ? lhs.path[i] : lhs.title + L".url"); - const FilePath::StringType rhs_i = + const base::FilePath::StringType rhs_i = (i < rhs.path.size() ? rhs.path[i] : rhs.title + L".url"); lhs_prefix = lhs_prefix.Append(lhs_i); rhs_prefix = rhs_prefix.Append(rhs_i); if (lhs_i == rhs_i) continue; // The first path element that differs between the two. - std::map<FilePath, uint32>::const_iterator lhs_iter = + std::map<base::FilePath, uint32>::const_iterator lhs_iter = sort_index_->find(lhs_prefix); - std::map<FilePath, uint32>::const_iterator rhs_iter = + std::map<base::FilePath, uint32>::const_iterator rhs_iter = sort_index_->find(rhs_prefix); uint32 lhs_sort_index = (lhs_iter == sort_index_->end() ? kNotSorted : lhs_iter->second); @@ -147,7 +147,7 @@ struct IEOrderBookmarkComparator { } return lhs.path.size() < rhs.path.size(); } - const std::map<FilePath, uint32>* sort_index_; + const std::map<base::FilePath, uint32>* sort_index_; }; // IE stores the order of the Favorites menu in registry under: @@ -169,8 +169,8 @@ struct IEOrderBookmarkComparator { bool ParseFavoritesOrderBlob( const Importer* importer, const std::vector<uint8>& blob, - const FilePath& path, - std::map<FilePath, uint32>* sort_index) WARN_UNUSED_RESULT { + const base::FilePath& path, + std::map<base::FilePath, uint32>* sort_index) WARN_UNUSED_RESULT { static const int kItemCountOffset = 16; static const int kItemListStartOffset = 20; @@ -204,8 +204,8 @@ bool ParseFavoritesOrderBlob( TCHAR item_filename[MAX_PATH]; if (!idlist || FAILED(SHGetPathFromIDList(idlist, item_filename))) return false; - FilePath item_relative_path = - path.Append(FilePath(item_filename).BaseName()); + base::FilePath item_relative_path = + path.Append(base::FilePath(item_filename).BaseName()); // Record the retrieved information and go to the next item. sort_index->insert(std::make_pair(item_relative_path, item_sort_index)); @@ -217,8 +217,8 @@ bool ParseFavoritesOrderBlob( bool ParseFavoritesOrderRegistryTree( const Importer* importer, const base::win::RegKey& key, - const FilePath& path, - std::map<FilePath, uint32>* sort_index) WARN_UNUSED_RESULT { + const base::FilePath& path, + std::map<base::FilePath, uint32>* sort_index) WARN_UNUSED_RESULT { // Parse the order information of the current folder. DWORD blob_length = 0; if (key.ReadValue(L"Order", NULL, &blob_length, NULL) == ERROR_SUCCESS) { @@ -237,7 +237,7 @@ bool ParseFavoritesOrderRegistryTree( ++child) { base::win::RegKey subkey(key.Handle(), child.Name(), KEY_READ); if (subkey.Valid()) { - FilePath subpath(path.Append(child.Name())); + base::FilePath subpath(path.Append(child.Name())); if (!ParseFavoritesOrderRegistryTree(importer, subkey, subpath, sort_index)) { return false; @@ -249,11 +249,12 @@ bool ParseFavoritesOrderRegistryTree( bool ParseFavoritesOrderInfo( const Importer* importer, - std::map<FilePath, uint32>* sort_index) WARN_UNUSED_RESULT { + std::map<base::FilePath, uint32>* sort_index) WARN_UNUSED_RESULT { base::win::RegKey key(HKEY_CURRENT_USER, kIEFavoritesOrderKey, KEY_READ); if (!key.Valid()) return false; - return ParseFavoritesOrderRegistryTree(importer, key, FilePath(), sort_index); + return ParseFavoritesOrderRegistryTree(importer, key, base::FilePath(), + sort_index); } // Reads the sort order from registry. If failed, we don't touch the list @@ -261,7 +262,7 @@ bool ParseFavoritesOrderInfo( void SortBookmarksInIEOrder( const Importer* importer, std::vector<ProfileWriter::BookmarkEntry>* bookmarks) { - std::map<FilePath, uint32> sort_index; + std::map<base::FilePath, uint32> sort_index; if (!ParseFavoritesOrderInfo(importer, &sort_index)) return; IEOrderBookmarkComparator compare = {&sort_index}; @@ -327,7 +328,8 @@ GURL ReadFaviconURLFromInternetShortcut(IUniformResourceLocator* url_locator) { // IE7 and above store the data. bool ReadFaviconDataFromInternetShortcut(const string16& file, std::string* data) { - return file_util::ReadFileToString(FilePath(file + kFaviconStreamName), data); + return file_util::ReadFileToString( + base::FilePath(file + kFaviconStreamName), data); } // Reads the favicon imaga data in the Internet cache. IE6 doesn't hold the data @@ -347,7 +349,8 @@ bool ReadFaviconDataFromCache(const GURL& favicon_url, std::string* data) { NULL, NULL, 0)) { return false; } - return file_util::ReadFileToString(FilePath(cache->lpszLocalFileName), data); + return file_util::ReadFileToString(base::FilePath(cache->lpszLocalFileName), + data); } // Reads the binary image data of favicon of an internet shortcut file |file|. @@ -774,7 +777,7 @@ bool IEImporter::GetFavoritesInfo(IEImporter::FavoritesInfo* info) { if (FAILED(SHGetFolderPath(NULL, CSIDL_FAVORITES, NULL, SHGFP_TYPE_CURRENT, buffer))) return false; - info->path = FilePath(buffer); + info->path = base::FilePath(buffer); // There is a Links folder under Favorites folder in Windows Vista, but it // is not recording in Vista's registry. So in Vista, we assume the Links @@ -799,9 +802,9 @@ void IEImporter::ParseFavoritesFolder( const FavoritesInfo& info, BookmarkVector* bookmarks, std::vector<history::ImportedFaviconUsage>* favicons) { - FilePath file; - std::vector<FilePath::StringType> file_list; - FilePath favorites_path(info.path); + base::FilePath file; + std::vector<base::FilePath::StringType> file_list; + base::FilePath favorites_path(info.path); // Favorites path length. Make sure it doesn't include the trailing \. size_t favorites_path_len = favorites_path.StripTrailingSeparators().value().size(); @@ -818,9 +821,9 @@ void IEImporter::ParseFavoritesFolder( typedef std::map<GURL, history::ImportedFaviconUsage> FaviconMap; FaviconMap favicon_map; - for (std::vector<FilePath::StringType>::iterator it = file_list.begin(); + for (std::vector<base::FilePath::StringType>::iterator it = file_list.begin(); it != file_list.end(); ++it) { - FilePath shortcut(*it); + base::FilePath shortcut(*it); if (!LowerCaseEqualsASCII(shortcut.Extension(), ".url")) continue; @@ -845,11 +848,12 @@ void IEImporter::ParseFavoritesFolder( // ex. Suppose that the Favorites folder is C:\Users\Foo\Favorites. // C:\Users\Foo\Favorites\Foo.url -> "" // C:\Users\Foo\Favorites\Links\Bar\Baz.url -> "Links\Bar" - FilePath::StringType relative_string = + base::FilePath::StringType relative_string = shortcut.DirName().value().substr(favorites_path_len); - if (!relative_string.empty() && FilePath::IsSeparator(relative_string[0])) + if (!relative_string.empty() && + base::FilePath::IsSeparator(relative_string[0])) relative_string = relative_string.substr(1); - FilePath relative_path(relative_string); + base::FilePath relative_path(relative_string); ProfileWriter::BookmarkEntry entry; // Remove the dot, the file extension, and the directory path. diff --git a/chrome/browser/importer/ie_importer.h b/chrome/browser/importer/ie_importer.h index 59790d3..f072d5a 100644 --- a/chrome/browser/importer/ie_importer.h +++ b/chrome/browser/importer/ie_importer.h @@ -29,7 +29,7 @@ class IEImporter : public Importer { // A struct that hosts the information of IE Favorite folder. struct FavoritesInfo { - FilePath path; + base::FilePath path; string16 links_folder; }; @@ -77,7 +77,7 @@ class IEImporter : public Importer { // IE does not have source path. It's used in unit tests only for providing a // fake source. - FilePath source_path_; + base::FilePath source_path_; DISALLOW_COPY_AND_ASSIGN(IEImporter); }; diff --git a/chrome/browser/importer/ie_importer_unittest_win.cc b/chrome/browser/importer/ie_importer_unittest_win.cc index e815102..7dd282f 100644 --- a/chrome/browser/importer/ie_importer_unittest_win.cc +++ b/chrome/browser/importer/ie_importer_unittest_win.cc @@ -118,7 +118,7 @@ const FaviconGroup kIEFaviconGroup[2] = { L"http://chinese-title-favorite/"}}, }; -bool CreateOrderBlob(const FilePath& favorites_folder, +bool CreateOrderBlob(const base::FilePath& favorites_folder, const string16& path, const std::vector<string16>& entries) { if (entries.size() > 255) @@ -163,7 +163,7 @@ bool CreateOrderBlob(const FilePath& favorites_folder, return true; } -bool CreateUrlFileWithFavicon(const FilePath& file, +bool CreateUrlFileWithFavicon(const base::FilePath& file, const std::wstring& url, const std::wstring& favicon_url) { base::win::ScopedComPtr<IUniformResourceLocator> locator; @@ -212,7 +212,7 @@ bool CreateUrlFileWithFavicon(const FilePath& file, sizeof kDummyFaviconImageData) != -1); } -bool CreateUrlFile(const FilePath& file, const std::wstring& url) { +bool CreateUrlFile(const base::FilePath& file, const std::wstring& url) { return CreateUrlFileWithFavicon(file, url, std::wstring()); } @@ -443,10 +443,10 @@ class IEImporterTest : public ImporterTest { TEST_F(IEImporterTest, IEImporter) { // Sets up a favorites folder. base::win::ScopedCOMInitializer com_init; - FilePath path = temp_dir_.path().AppendASCII("Favorites"); + base::FilePath path = temp_dir_.path().AppendASCII("Favorites"); CreateDirectory(path.value().c_str(), NULL); CreateDirectory(path.AppendASCII("SubFolder").value().c_str(), NULL); - FilePath links_path = path.AppendASCII("Links"); + base::FilePath links_path = path.AppendASCII("Links"); CreateDirectory(links_path.value().c_str(), NULL); CreateDirectory(links_path.AppendASCII("SubFolderOfLinks").value().c_str(), NULL); @@ -488,7 +488,7 @@ TEST_F(IEImporterTest, IEImporter) { L"SubFolder.url", }; ASSERT_TRUE(CreateOrderBlob( - FilePath(path), L"", + base::FilePath(path), L"", std::vector<string16>(root_links, root_links + arraysize(root_links)))); HRESULT res; @@ -532,7 +532,7 @@ TEST_F(IEImporterTest, IEImporter) { TEST_F(IEImporterTest, IEImporterMalformedFavoritesRegistry) { // Sets up a favorites folder. base::win::ScopedCOMInitializer com_init; - FilePath path = temp_dir_.path().AppendASCII("Favorites"); + base::FilePath path = temp_dir_.path().AppendASCII("Favorites"); CreateDirectory(path.value().c_str(), NULL); CreateDirectory(path.AppendASCII("b").value().c_str(), NULL); ASSERT_TRUE(CreateUrlFile(path.AppendASCII("a.url"), diff --git a/chrome/browser/importer/importer_data_types.h b/chrome/browser/importer/importer_data_types.h index e8fbfde..996d2be 100644 --- a/chrome/browser/importer/importer_data_types.h +++ b/chrome/browser/importer/importer_data_types.h @@ -36,8 +36,8 @@ struct SourceProfile { string16 importer_name; ImporterType importer_type; - FilePath source_path; - FilePath app_path; + base::FilePath source_path; + base::FilePath app_path; uint16 services_supported; // Bitmask of ImportItem. // The URLRequestContextGetter is only used for Google Toolbar. scoped_refptr<net::URLRequestContextGetter> request_context_getter; diff --git a/chrome/browser/importer/importer_list.cc b/chrome/browser/importer/importer_list.cc index 53b9249..2e29b67 100644 --- a/chrome/browser/importer/importer_list.cc +++ b/chrome/browser/importer/importer_list.cc @@ -56,13 +56,13 @@ void DetectSafariProfiles(std::vector<importer::SourceProfile*>* profiles) { #endif // defined(OS_MACOSX) void DetectFirefoxProfiles(std::vector<importer::SourceProfile*>* profiles) { - FilePath profile_path = GetFirefoxProfilePath(); + base::FilePath profile_path = GetFirefoxProfilePath(); if (profile_path.empty()) return; // Detects which version of Firefox is installed. importer::ImporterType firefox_type; - FilePath app_path; + base::FilePath app_path; int version = 0; #if defined(OS_WIN) version = GetCurrentFirefoxMajorVersionFromRegistry(); diff --git a/chrome/browser/importer/mork_reader.cc b/chrome/browser/importer/mork_reader.cc index ccfa98e..0181468 100644 --- a/chrome/browser/importer/mork_reader.cc +++ b/chrome/browser/importer/mork_reader.cc @@ -113,7 +113,7 @@ MorkReader::~MorkReader() { delete i->second; } -bool MorkReader::Read(const FilePath& path) { +bool MorkReader::Read(const base::FilePath& path) { stream_.open(path.value().c_str()); if (!stream_.is_open()) return false; @@ -545,7 +545,8 @@ void AddToHistory(MorkReader::ColumnDataList* column_values, // It sets up the file stream and loops over the lines in the file to // parse them, then adds the resulting row set to history. -void ImportHistoryFromFirefox2(const FilePath& file, ImporterBridge* bridge) { +void ImportHistoryFromFirefox2(const base::FilePath& file, + ImporterBridge* bridge) { MorkReader reader; reader.Read(file); diff --git a/chrome/browser/importer/nss_decryptor_mac.mm b/chrome/browser/importer/nss_decryptor_mac.mm index d9d3d7a..ebcd271 100644 --- a/chrome/browser/importer/nss_decryptor_mac.mm +++ b/chrome/browser/importer/nss_decryptor_mac.mm @@ -19,12 +19,13 @@ // fallback path needs to be set to the directory containing the libraries. // To do so, the process this function runs in must have the // DYLD_FALLBACK_LIBRARY_PATH set on startup to said directory. -bool NSSDecryptor::Init(const FilePath& dll_path, const FilePath& db_path) { +bool NSSDecryptor::Init(const base::FilePath& dll_path, + const base::FilePath& db_path) { if (getenv("DYLD_FALLBACK_LIBRARY_PATH") == NULL) { LOG(ERROR) << "DYLD_FALLBACK_LIBRARY_PATH variable not set"; return false; } - FilePath nss3_path = dll_path.Append("libnss3.dylib"); + base::FilePath nss3_path = dll_path.Append("libnss3.dylib"); void* nss_3_lib = dlopen(nss3_path.value().c_str(), RTLD_LAZY); if (!nss_3_lib) { diff --git a/chrome/browser/importer/nss_decryptor_system_nss.cc b/chrome/browser/importer/nss_decryptor_system_nss.cc index 078f83e..10a4c62 100644 --- a/chrome/browser/importer/nss_decryptor_system_nss.cc +++ b/chrome/browser/importer/nss_decryptor_system_nss.cc @@ -24,7 +24,8 @@ NSSDecryptor::~NSSDecryptor() { } } -bool NSSDecryptor::Init(const FilePath& dll_path, const FilePath& db_path) { +bool NSSDecryptor::Init(const base::FilePath& dll_path, + const base::FilePath& db_path) { crypto::EnsureNSSInit(); is_nss_initialized_ = true; const std::string modspec = diff --git a/chrome/browser/importer/nss_decryptor_win.cc b/chrome/browser/importer/nss_decryptor_win.cc index bb1b2d4..a6fe5453e 100644 --- a/chrome/browser/importer/nss_decryptor_win.cc +++ b/chrome/browser/importer/nss_decryptor_win.cc @@ -37,7 +37,8 @@ const wchar_t NSSDecryptor::kSoftokn3Library[] = L"softokn3.dll"; const wchar_t NSSDecryptor::kPLDS4Library[] = L"plds4.dll"; const wchar_t NSSDecryptor::kNSPR4Library[] = L"nspr4.dll"; -bool NSSDecryptor::Init(const FilePath& dll_path, const FilePath& db_path) { +bool NSSDecryptor::Init(const base::FilePath& dll_path, + const base::FilePath& db_path) { // We call SetDllDirectory to work around a Purify bug (GetModuleHandle // fails inside Purify under certain conditions). SetDllDirectory only // exists on Windows XP SP1 or later, so we look up its address at run time. @@ -59,7 +60,7 @@ bool NSSDecryptor::Init(const FilePath& dll_path, const FilePath& db_path) { // Fall back on LoadLibraryEx if SetDllDirectory isn't available. We // actually prefer this method because it doesn't change the DLL search // path, which is a process-wide property. - FilePath path = dll_path.Append(kNSS3Library); + base::FilePath path = dll_path.Append(kNSS3Library); nss3_dll_ = LoadLibraryEx(path.value().c_str(), NULL, LOAD_WITH_ALTERED_SEARCH_PATH); if (nss3_dll_ == NULL) @@ -75,7 +76,7 @@ bool NSSDecryptor::Init(const FilePath& dll_path, const FilePath& db_path) { // LOAD_WITH_ALTERED_SEARCH_PATH flag. This helps because LoadLibrary // doesn't load a DLL again if it's already loaded. This workaround is // harmless for NSS 3.11. - path = FilePath(dll_path).Append(kSoftokn3Library); + path = base::FilePath(dll_path).Append(kSoftokn3Library); softokn3_dll_ = LoadLibraryEx(path.value().c_str(), NULL, LOAD_WITH_ALTERED_SEARCH_PATH); if (softokn3_dll_ == NULL) { @@ -102,7 +103,7 @@ NSSDecryptor::~NSSDecryptor() { Free(); } -bool NSSDecryptor::InitNSS(const FilePath& db_path, +bool NSSDecryptor::InitNSS(const base::FilePath& db_path, base::NativeLibrary plds4_dll, base::NativeLibrary nspr4_dll) { // NSPR DLLs are already loaded now. diff --git a/chrome/browser/importer/safari_importer.h b/chrome/browser/importer/safari_importer.h index a5dbba4..bf01630 100644 --- a/chrome/browser/importer/safari_importer.h +++ b/chrome/browser/importer/safari_importer.h @@ -40,7 +40,7 @@ class SafariImporter : public Importer { public: // |library_dir| is the full path to the ~/Library directory, // We pass it in as a parameter for testing purposes. - explicit SafariImporter(const FilePath& library_dir); + explicit SafariImporter(const base::FilePath& library_dir); // Importer: virtual void StartImport(const importer::SourceProfile& source_profile, @@ -52,7 +52,8 @@ class SafariImporter : public Importer { // in: library_dir - ~/Library or a standin for testing purposes. // out: services_supported - the service supported for import. // Returns true if we can import the Safari profile. - static bool CanImport(const FilePath& library_dir, uint16* services_supported); + static bool CanImport(const base::FilePath& library_dir, + uint16* services_supported); private: FRIEND_TEST_ALL_PREFIXES(SafariImporterTest, BookmarkImport); @@ -104,7 +105,7 @@ class SafariImporter : public Importer { const FaviconMap& favicon_map, std::vector<history::ImportedFaviconUsage>* favicons); - FilePath library_dir_; + base::FilePath library_dir_; DISALLOW_COPY_AND_ASSIGN(SafariImporter); }; diff --git a/chrome/browser/importer/safari_importer.mm b/chrome/browser/importer/safari_importer.mm index 921ebc4..6b8809a 100644 --- a/chrome/browser/importer/safari_importer.mm +++ b/chrome/browser/importer/safari_importer.mm @@ -41,7 +41,7 @@ bool CanImportSafariURL(const GURL& url) { } // namespace -SafariImporter::SafariImporter(const FilePath& library_dir) +SafariImporter::SafariImporter(const base::FilePath& library_dir) : library_dir_(library_dir) { } @@ -49,7 +49,7 @@ SafariImporter::~SafariImporter() { } // static -bool SafariImporter::CanImport(const FilePath& library_dir, +bool SafariImporter::CanImport(const base::FilePath& library_dir, uint16* services_supported) { DCHECK(services_supported); *services_supported = importer::NONE; @@ -57,9 +57,9 @@ bool SafariImporter::CanImport(const FilePath& library_dir, // Import features are toggled by the following: // bookmarks import: existence of ~/Library/Safari/Bookmarks.plist file. // history import: existence of ~/Library/Safari/History.plist file. - FilePath safari_dir = library_dir.Append("Safari"); - FilePath bookmarks_path = safari_dir.Append("Bookmarks.plist"); - FilePath history_path = safari_dir.Append("History.plist"); + base::FilePath safari_dir = library_dir.Append("Safari"); + base::FilePath bookmarks_path = safari_dir.Append("Bookmarks.plist"); + base::FilePath history_path = safari_dir.Append("History.plist"); if (file_util::PathExists(bookmarks_path)) *services_supported |= importer::FAVORITES; @@ -135,7 +135,7 @@ bool SafariImporter::OpenDatabase(sql::Connection* db) { stringByAppendingPathComponent:@"WebpageIcons.db"]; const char* db_path = [favicons_db_path fileSystemRepresentation]; - return db->Open(FilePath(db_path)); + return db->Open(base::FilePath(db_path)); } void SafariImporter::ImportFaviconURLs(sql::Connection* db, diff --git a/chrome/browser/importer/safari_importer_unittest.mm b/chrome/browser/importer/safari_importer_unittest.mm index ff29c6d..ca9e700 100644 --- a/chrome/browser/importer/safari_importer_unittest.mm +++ b/chrome/browser/importer/safari_importer_unittest.mm @@ -23,19 +23,19 @@ // simulated Library directory containing dummy data files in the same // structure as ~/Library in the Chrome test data directory. // This function returns the path to that directory. -FilePath GetTestSafariLibraryPath() { - FilePath test_dir; - PathService::Get(chrome::DIR_TEST_DATA, &test_dir); +base::FilePath GetTestSafariLibraryPath() { + base::FilePath test_dir; + PathService::Get(chrome::DIR_TEST_DATA, &test_dir); - // Our simulated ~/Library directory - test_dir = test_dir.AppendASCII("safari_import"); - return test_dir; + // Our simulated ~/Library directory + test_dir = test_dir.AppendASCII("safari_import"); + return test_dir; } class SafariImporterTest : public PlatformTest { public: SafariImporter* GetSafariImporter() { - FilePath test_library_dir = GetTestSafariLibraryPath(); + base::FilePath test_library_dir = GetTestSafariLibraryPath(); CHECK(file_util::PathExists(test_library_dir)) << "Missing test data directory"; diff --git a/chrome/browser/infobars/infobars_browsertest.cc b/chrome/browser/infobars/infobars_browsertest.cc index e99764b..255488c 100644 --- a/chrome/browser/infobars/infobars_browsertest.cc +++ b/chrome/browser/infobars/infobars_browsertest.cc @@ -29,8 +29,9 @@ class InfoBarsTest : public InProcessBrowserTest { } void InstallExtension(const char* filename) { - FilePath path = ui_test_utils::GetTestFilePath( - FilePath().AppendASCII("extensions"), FilePath().AppendASCII(filename)); + base::FilePath path = ui_test_utils::GetTestFilePath( + base::FilePath().AppendASCII("extensions"), + base::FilePath().AppendASCII(filename)); Profile* profile = browser()->profile(); ExtensionService* service = profile->GetExtensionService(); diff --git a/chrome/browser/instant/instant_test_utils.h b/chrome/browser/instant/instant_test_utils.h index f4fdd47..cee9243 100644 --- a/chrome/browser/instant/instant_test_utils.h +++ b/chrome/browser/instant/instant_test_utils.h @@ -43,7 +43,7 @@ class InstantTestBase : public InProcessBrowserTest { : https_test_server_( net::TestServer::TYPE_HTTPS, net::BaseTestServer::SSLOptions(), - FilePath(FILE_PATH_LITERAL("chrome/test/data"))) { + base::FilePath(FILE_PATH_LITERAL("chrome/test/data"))) { } protected: diff --git a/chrome/browser/intents/native_services_browsertest.cc b/chrome/browser/intents/native_services_browsertest.cc index 1f18cf6..e8442c64 100644 --- a/chrome/browser/intents/native_services_browsertest.cc +++ b/chrome/browser/intents/native_services_browsertest.cc @@ -37,8 +37,8 @@ namespace { const std::string kPoodlePath = "/home/poodles/skippy.png"; const int64 kTestFileSize = 193; -FilePath CreateTestFile() { - FilePath file; +base::FilePath CreateTestFile() { + base::FilePath file; PathService::Get(chrome::DIR_TEST_DATA, &file); file = file.AppendASCII("web_intents").AppendASCII("test.png"); return file; @@ -89,10 +89,10 @@ class FakeSelectFileDialog : public ui::SelectFileDialog { virtual void SelectFileImpl( Type type, const string16& title, - const FilePath& default_path, + const base::FilePath& default_path, const FileTypeInfo* file_types, int file_type_index, - const FilePath::StringType& default_extension, + const base::FilePath::StringType& default_extension, gfx::NativeWindow owning_window, void* params) OVERRIDE { if (should_succeed_) @@ -103,7 +103,7 @@ class FakeSelectFileDialog : public ui::SelectFileDialog { private: bool should_succeed_; - FilePath test_file_; + base::FilePath test_file_; DISALLOW_COPY_AND_ASSIGN(FakeSelectFileDialog); }; @@ -155,7 +155,7 @@ class NativeServicesBrowserTest : public InProcessBrowserTest { scoped_ptr<TestIntentsDispatcher> dispatcher_; scoped_ptr<TestSelectFileDialogFactory> factory_; - FilePath test_file_; + base::FilePath test_file_; }; IN_PROC_BROWSER_TEST_F(NativeServicesBrowserTest, PickFileSelected) { diff --git a/chrome/browser/intents/web_intents_registry_unittest.cc b/chrome/browser/intents/web_intents_registry_unittest.cc index 045de49..921108a 100644 --- a/chrome/browser/intents/web_intents_registry_unittest.cc +++ b/chrome/browser/intents/web_intents_registry_unittest.cc @@ -43,7 +43,7 @@ class MockExtensionService: public TestExtensionService { namespace { // TODO(groby): Unify loading functions with extension_manifest_unittest code. -DictionaryValue* LoadManifestFile(const FilePath& path, +DictionaryValue* LoadManifestFile(const base::FilePath& path, std::string* error) { EXPECT_TRUE(file_util::PathExists(path)); JSONFileValueSerializer serializer(path); @@ -54,7 +54,7 @@ scoped_refptr<Extension> LoadExtensionWithLocation( const std::string& name, Manifest::Location location, std::string* error) { - FilePath path; + base::FilePath path; PathService::Get(chrome::DIR_TEST_DATA, &path); path = path.AppendASCII("extensions") .AppendASCII("manifest_tests") diff --git a/chrome/browser/jumplist_win.cc b/chrome/browser/jumplist_win.cc index 97891f9..a13706f 100644 --- a/chrome/browser/jumplist_win.cc +++ b/chrome/browser/jumplist_win.cc @@ -225,12 +225,12 @@ HRESULT AddShellLink(base::win::ScopedComPtr<IObjectCollection> collection, // Creates a temporary icon file to be shown in JumpList. bool CreateIconFile(const SkBitmap& bitmap, - const FilePath& icon_dir, - FilePath* icon_path) { + const base::FilePath& icon_dir, + base::FilePath* icon_path) { // Retrieve the path to a temporary file. // We don't have to care about the extension of this temporary file because // JumpList does not care about it. - FilePath path; + base::FilePath path; if (!file_util::CreateTemporaryFileInDir(icon_dir, &path)) return false; @@ -399,13 +399,13 @@ bool UpdateJumpList(const wchar_t* app_id, return false; // Retrieve the absolute path to "chrome.exe". - FilePath chrome_path; + base::FilePath chrome_path; if (!PathService::Get(base::FILE_EXE, &chrome_path)) return false; // Retrieve the command-line switches of this process. CommandLine command_line(CommandLine::NO_PROGRAM); - FilePath user_data_dir = CommandLine::ForCurrentProcess()-> + base::FilePath user_data_dir = CommandLine::ForCurrentProcess()-> GetSwitchValuePath(switches::kUserDataDir); if (!user_data_dir.empty()) command_line.AppendSwitchPath(switches::kUserDataDir, user_data_dir); @@ -730,7 +730,7 @@ void JumpList::RunUpdate() { // Delete the directory which contains old icon files, rename the current // icon directory, and create a new directory which contains new JumpList // icon files. - FilePath icon_dir_old(icon_dir_.value() + L"Old"); + base::FilePath icon_dir_old(icon_dir_.value() + L"Old"); if (file_util::PathExists(icon_dir_old)) file_util::Delete(icon_dir_old, true); file_util::Move(icon_dir_, icon_dir_old); @@ -753,7 +753,7 @@ void JumpList::RunUpdate() { void JumpList::CreateIconFiles(const ShellLinkItemList& item_list) { for (ShellLinkItemList::const_iterator item = item_list.begin(); item != item_list.end(); ++item) { - FilePath icon_path; + base::FilePath icon_path; if (CreateIconFile((*item)->data(), icon_dir_, &icon_path)) (*item)->SetIcon(icon_path.value(), 0, true); } diff --git a/chrome/browser/logging_chrome_browsertest.cc b/chrome/browser/logging_chrome_browsertest.cc index 0a809db..4240c06 100644 --- a/chrome/browser/logging_chrome_browsertest.cc +++ b/chrome/browser/logging_chrome_browsertest.cc @@ -46,8 +46,8 @@ class ChromeLoggingTest : public testing::Test { TEST_F(ChromeLoggingTest, LogFileName) { SaveEnvironmentVariable(""); - FilePath filename = logging::GetLogFileName(); - ASSERT_NE(FilePath::StringType::npos, + base::FilePath filename = logging::GetLogFileName(); + ASSERT_NE(base::FilePath::StringType::npos, filename.value().find(FILE_PATH_LITERAL("chrome_debug.log"))); RestoreEnvironmentVariable(); @@ -57,8 +57,8 @@ TEST_F(ChromeLoggingTest, LogFileName) { TEST_F(ChromeLoggingTest, EnvironmentLogFileName) { SaveEnvironmentVariable("test value"); - FilePath filename = logging::GetLogFileName(); - ASSERT_EQ(FilePath(FILE_PATH_LITERAL("test value")).value(), + base::FilePath filename = logging::GetLogFileName(); + ASSERT_EQ(base::FilePath(FILE_PATH_LITERAL("test value")).value(), filename.value()); RestoreEnvironmentVariable(); diff --git a/chrome/browser/mac/install_from_dmg.mm b/chrome/browser/mac/install_from_dmg.mm index 40a608d..e6cbe72 100644 --- a/chrome/browser/mac/install_from_dmg.mm +++ b/chrome/browser/mac/install_from_dmg.mm @@ -359,9 +359,9 @@ bool InstallFromDiskImage(AuthorizationRef authorization_arg, // call EjectAndTrashDiskImage on dmg_bsd_device_name. bool LaunchInstalledApp(NSString* installed_path, const std::string& dmg_bsd_device_name) { - FilePath browser_path([installed_path fileSystemRepresentation]); + base::FilePath browser_path([installed_path fileSystemRepresentation]); - FilePath helper_path = browser_path.Append("Contents/Versions"); + base::FilePath helper_path = browser_path.Append("Contents/Versions"); helper_path = helper_path.Append(chrome::kChromeVersion); helper_path = helper_path.Append(chrome::kHelperProcessExecutablePath); @@ -672,10 +672,10 @@ void EjectAndTrashDiskImage(const std::string& dmg_bsd_device_name) { // Dock indicating that any garbage has been placed within it. Using the // trash path that FSPathMoveObjectToTrashSync claims to have used, call // FNNotifyByPath to fatten up the icon. - FilePath disk_image_path_in_trash(disk_image_path_in_trash_c); + base::FilePath disk_image_path_in_trash(disk_image_path_in_trash_c); free(disk_image_path_in_trash_c); - FilePath trash_path = disk_image_path_in_trash.DirName(); + base::FilePath trash_path = disk_image_path_in_trash.DirName(); const UInt8* trash_path_u8 = reinterpret_cast<const UInt8*>( trash_path.value().c_str()); status = FNNotifyByPath(trash_path_u8, diff --git a/chrome/browser/mac/master_prefs.h b/chrome/browser/mac/master_prefs.h index 6f96c3e..fc7ccd6 100644 --- a/chrome/browser/mac/master_prefs.h +++ b/chrome/browser/mac/master_prefs.h @@ -12,7 +12,7 @@ namespace master_prefs { // Returns the path to the master preferences file. Note that this path may be // empty (in the case where this type of build cannot have a master preferences // file) or may not actually exist on the filesystem. -FilePath MasterPrefsPath(); +base::FilePath MasterPrefsPath(); } // namespace master_prefs diff --git a/chrome/browser/mac/master_prefs.mm b/chrome/browser/mac/master_prefs.mm index 4fadea9..2355b2c 100644 --- a/chrome/browser/mac/master_prefs.mm +++ b/chrome/browser/mac/master_prefs.mm @@ -28,12 +28,12 @@ const char kMasterPreferencesFileName[] = "Chromium Master Preferences"; namespace master_prefs { -FilePath MasterPrefsPath() { +base::FilePath MasterPrefsPath() { #if defined(GOOGLE_CHROME_BUILD) // Don't load master preferences for the canary. chrome::VersionInfo::Channel channel = chrome::VersionInfo::GetChannel(); if (channel == chrome::VersionInfo::CHANNEL_CANARY) - return FilePath(); + return base::FilePath(); #endif // GOOGLE_CHROME_BUILD // On official builds, try @@ -41,7 +41,7 @@ FilePath MasterPrefsPath() { // On chromium builds, try //~/Library/Application Support/Chromium/Chromium Master Preferences // This intentionally doesn't use eventual --user-data-dir overrides. - FilePath user_application_support_path; + base::FilePath user_application_support_path; if (chrome::GetDefaultUserDataDirectory(&user_application_support_path)) { user_application_support_path = user_application_support_path.Append(kMasterPreferencesFileName); @@ -52,9 +52,9 @@ FilePath MasterPrefsPath() { // On official builds, try /Library/Google/Google Chrome Master Preferences // On chromium builds, try // /Library/Application Support/Chromium/Chromium Master Preferences - FilePath search_path; + base::FilePath search_path; if (!base::mac::GetLocalDirectory(kSearchPath, &search_path)) - return FilePath(); + return base::FilePath(); return search_path.Append(kMasterPreferencesDirectory) .Append(kMasterPreferencesFileName); diff --git a/chrome/browser/mac/relauncher.cc b/chrome/browser/mac/relauncher.cc index ef24660..4eeaa52 100644 --- a/chrome/browser/mac/relauncher.cc +++ b/chrome/browser/mac/relauncher.cc @@ -90,7 +90,7 @@ bool RelaunchApp(const std::vector<std::string>& args) { // been applied. In fact, it's safer than using the updated version of the // helper process, because there's no guarantee that the updated version's // relauncher implementation will be compatible with the running version's. - FilePath child_path; + base::FilePath child_path; if (!PathService::Get(content::CHILD_PROCESS_EXE, &child_path)) { LOG(ERROR) << "No CHILD_PROCESS_EXE"; return false; diff --git a/chrome/browser/managed_mode/managed_mode_site_list.cc b/chrome/browser/managed_mode/managed_mode_site_list.cc index ceb1e29..a81a8b0 100644 --- a/chrome/browser/managed_mode/managed_mode_site_list.cc +++ b/chrome/browser/managed_mode/managed_mode_site_list.cc @@ -194,7 +194,7 @@ bool ManagedModeSiteList::LazyLoad() { if (sites_.get()) return true; - FilePath path = path_.GetFilePath(); + base::FilePath path = path_.GetFilePath(); JSONFileValueSerializer serializer(path); std::string error; scoped_ptr<base::Value> value(serializer.Deserialize(NULL, &error)); diff --git a/chrome/browser/managed_mode/managed_user_service_unittest.cc b/chrome/browser/managed_mode/managed_user_service_unittest.cc index bb08984..f920063 100644 --- a/chrome/browser/managed_mode/managed_user_service_unittest.cc +++ b/chrome/browser/managed_mode/managed_user_service_unittest.cc @@ -145,9 +145,9 @@ TEST_F(ManagedUserServiceExtensionTest, InstallContentPacks) { scoped_refptr<extensions::UnpackedInstaller> installer( extensions::UnpackedInstaller::Create(service_)); installer->set_prompt_for_plugins(false); - FilePath test_data_dir; + base::FilePath test_data_dir; ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &test_data_dir)); - FilePath extension_path = + base::FilePath extension_path = test_data_dir.AppendASCII("extensions/managed_mode/content_pack"); content::WindowedNotificationObserver extension_load_observer( chrome::NOTIFICATION_EXTENSION_LOADED, diff --git a/chrome/browser/media/chrome_webrtc_browsertest.cc b/chrome/browser/media/chrome_webrtc_browsertest.cc index 5265140..e309fac 100644 --- a/chrome/browser/media/chrome_webrtc_browsertest.cc +++ b/chrome/browser/media/chrome_webrtc_browsertest.cc @@ -23,7 +23,7 @@ #include "content/public/test/browser_test_utils.h" #include "net/test/test_server.h" -static const FilePath::CharType kPeerConnectionServer[] = +static const base::FilePath::CharType kPeerConnectionServer[] = #if defined(OS_WIN) FILE_PATH_LITERAL("peerconnection_server.exe"); #else @@ -174,7 +174,7 @@ class WebrtcBrowserTest : public InProcessBrowserTest { private: void RunPeerConnectionServer() { - FilePath peerconnection_server; + base::FilePath peerconnection_server; EXPECT_TRUE(PathService::Get(base::DIR_MODULE, &peerconnection_server)); peerconnection_server = peerconnection_server.Append(kPeerConnectionServer); diff --git a/chrome/browser/memory_details_mac.cc b/chrome/browser/memory_details_mac.cc index ab55c8b..ad158d5b 100644 --- a/chrome/browser/memory_details_mac.cc +++ b/chrome/browser/memory_details_mac.cc @@ -157,8 +157,8 @@ void MemoryDetails::CollectProcessData( ProcessInfoSnapshot::ProcInfoEntry proc_info; if (process_info.GetProcInfo(info.pid, &proc_info)) { if (proc_info.command.length() > 1 && proc_info.command[0] == '/') { - FilePath bundle_name = - base::mac::GetAppBundlePath(FilePath(proc_info.command)); + base::FilePath bundle_name = + base::mac::GetAppBundlePath(base::FilePath(proc_info.command)); if (!bundle_name.empty()) { version_info.reset(FileVersionInfo::CreateFileVersionInfo( bundle_name)); diff --git a/chrome/browser/memory_details_win.cc b/chrome/browser/memory_details_win.cc index 3c41a8f..63e7949 100644 --- a/chrome/browser/memory_details_win.cc +++ b/chrome/browser/memory_details_win.cc @@ -136,7 +136,7 @@ void MemoryDetails::CollectProcessData( MAX_PATH - 1)) { std::wstring str_name(name); scoped_ptr<FileVersionInfo> version_info( - FileVersionInfo::CreateFileVersionInfo(FilePath(str_name))); + FileVersionInfo::CreateFileVersionInfo(base::FilePath(str_name))); if (version_info != NULL) { info.version = version_info->product_version(); info.product_name = version_info->product_name(); diff --git a/chrome/browser/metrics/metrics_service.cc b/chrome/browser/metrics/metrics_service.cc index 0d99759..da89ce6 100644 --- a/chrome/browser/metrics/metrics_service.cc +++ b/chrome/browser/metrics/metrics_service.cc @@ -1745,7 +1745,7 @@ void MetricsService::LogChromeOSCrash(const std::string &crash_type) { } #endif // OS_CHROMEOS -void MetricsService::LogPluginLoadingError(const FilePath& plugin_path) { +void MetricsService::LogPluginLoadingError(const base::FilePath& plugin_path) { webkit::WebPluginInfo plugin; bool success = content::PluginService::GetInstance()->GetPluginInfoByPath(plugin_path, diff --git a/chrome/browser/metrics/metrics_service.h b/chrome/browser/metrics/metrics_service.h index d14be3d..4b4b403 100644 --- a/chrome/browser/metrics/metrics_service.h +++ b/chrome/browser/metrics/metrics_service.h @@ -176,7 +176,7 @@ class MetricsService bool recording_active() const; bool reporting_active() const; - void LogPluginLoadingError(const FilePath& plugin_path); + void LogPluginLoadingError(const base::FilePath& plugin_path); // Redundant test to ensure that we are notified of a clean exit. // This value should be true when process has completed shutdown. diff --git a/chrome/browser/metrics/metrics_service_browsertest.cc b/chrome/browser/metrics/metrics_service_browsertest.cc index 89267c5..542edbf 100644 --- a/chrome/browser/metrics/metrics_service_browsertest.cc +++ b/chrome/browser/metrics/metrics_service_browsertest.cc @@ -38,17 +38,17 @@ class MetricsServiceTest : public InProcessBrowserTest { ui_test_utils::BROWSER_TEST_WAIT_FOR_TAB | ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION; - FilePath test_directory; + base::FilePath test_directory; ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &test_directory)); - FilePath page1_path = test_directory.AppendASCII("title2.html"); + base::FilePath page1_path = test_directory.AppendASCII("title2.html"); ui_test_utils::NavigateToURLWithDisposition( browser(), net::FilePathToFileURL(page1_path), NEW_FOREGROUND_TAB, kBrowserTestFlags); - FilePath page2_path = test_directory.AppendASCII("iframe.html"); + base::FilePath page2_path = test_directory.AppendASCII("iframe.html"); ui_test_utils::NavigateToURLWithDisposition( browser(), net::FilePathToFileURL(page2_path), diff --git a/chrome/browser/metrics/variations/variations_registry_syncer_win.cc b/chrome/browser/metrics/variations/variations_registry_syncer_win.cc index 452ecaf..842a1a0 100644 --- a/chrome/browser/metrics/variations/variations_registry_syncer_win.cc +++ b/chrome/browser/metrics/variations/variations_registry_syncer_win.cc @@ -131,7 +131,7 @@ string16 VariationsRegistrySyncer::ExtractNonVariationLabels( void VariationsRegistrySyncer::SyncWithRegistry() { // Note that all registry operations are done here on the UI thread as there // are no threading restrictions on them. - FilePath chrome_exe; + base::FilePath chrome_exe; if (!PathService::Get(base::FILE_EXE, &chrome_exe)) { NOTREACHED() << "Failed to get chrome exe path"; return; diff --git a/chrome/browser/mouseleave_browsertest.cc b/chrome/browser/mouseleave_browsertest.cc index e4cffbb..e11e442 100644 --- a/chrome/browser/mouseleave_browsertest.cc +++ b/chrome/browser/mouseleave_browsertest.cc @@ -22,7 +22,7 @@ class MouseLeaveTest : public InProcessBrowserTest { void MouseLeaveTestCommon() { GURL test_url = ui_test_utils::GetTestUrl( - FilePath(), FilePath(FILE_PATH_LITERAL("mouseleave.html"))); + base::FilePath(), base::FilePath(FILE_PATH_LITERAL("mouseleave.html"))); content::WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); diff --git a/chrome/browser/nacl_host/nacl_broker_host_win.cc b/chrome/browser/nacl_host/nacl_broker_host_win.cc index 53f48fc..39ca8bd 100644 --- a/chrome/browser/nacl_host/nacl_broker_host_win.cc +++ b/chrome/browser/nacl_host/nacl_broker_host_win.cc @@ -33,11 +33,11 @@ bool NaClBrokerHost::Init() { return false; // Create the path to the nacl broker/loader executable. - FilePath module_path; + base::FilePath module_path; if (!PathService::Get(base::FILE_MODULE, &module_path)) return false; - FilePath nacl_path = module_path.DirName().Append(chrome::kNaClAppName); + base::FilePath nacl_path = module_path.DirName().Append(chrome::kNaClAppName); CommandLine* cmd_line = new CommandLine(nacl_path); nacl::CopyNaClCommandLineArguments(cmd_line); @@ -47,7 +47,7 @@ bool NaClBrokerHost::Init() { if (logging::DialogsAreSuppressed()) cmd_line->AppendSwitch(switches::kNoErrorDialogs); - process_->Launch(FilePath(), cmd_line); + process_->Launch(base::FilePath(), cmd_line); return true; } diff --git a/chrome/browser/nacl_host/nacl_browser.cc b/chrome/browser/nacl_host/nacl_browser.cc index 5960d20..6d04f14 100644 --- a/chrome/browser/nacl_host/nacl_browser.cc +++ b/chrome/browser/nacl_host/nacl_browser.cc @@ -24,7 +24,7 @@ namespace { // An arbitrary delay to coalesce multiple writes to the cache. const int kValidationCacheCoalescingTimeMS = 6000; const char kValidationCacheSequenceName[] = "NaClValidationCache"; -const FilePath::CharType kValidationCacheFileName[] = +const base::FilePath::CharType kValidationCacheFileName[] = FILE_PATH_LITERAL("nacl_validation_cache.bin"); const bool kValidationCacheEnabledByDefault = true; @@ -35,8 +35,8 @@ enum ValidationCacheStatus { CACHE_MAX }; -const FilePath::StringType NaClIrtName() { - FilePath::StringType irt_name(FILE_PATH_LITERAL("nacl_irt_")); +const base::FilePath::StringType NaClIrtName() { + base::FilePath::StringType irt_name(FILE_PATH_LITERAL("nacl_irt_")); #if defined(ARCH_CPU_X86_FAMILY) #if defined(ARCH_CPU_X86_64) @@ -75,19 +75,20 @@ bool CheckEnvVar(const char* name, bool default_value) { return result; } -void ReadCache(const FilePath& filename, std::string* data) { +void ReadCache(const base::FilePath& filename, std::string* data) { if (!file_util::ReadFileToString(filename, data)) { // Zero-size data used as an in-band error code. data->clear(); } } -void WriteCache(const FilePath& filename, const Pickle* pickle) { +void WriteCache(const base::FilePath& filename, const Pickle* pickle) { file_util::WriteFile(filename, static_cast<const char*>(pickle->data()), pickle->size()); } -void RemoveCache(const FilePath& filename, const base::Closure& callback) { +void RemoveCache(const base::FilePath& filename, + const base::Closure& callback) { file_util::Delete(filename, false); content::BrowserThread::PostTask(content::BrowserThread::IO, FROM_HERE, callback); @@ -135,11 +136,11 @@ void NaClBrowser::InitIrtFilePath() { // variable that the standalone NaCl PPAPI plugin accepts. const char* irt_path_var = getenv("NACL_IRT_LIBRARY"); if (irt_path_var != NULL) { - FilePath::StringType path_string( + base::FilePath::StringType path_string( irt_path_var, const_cast<const char*>(strchr(irt_path_var, '\0'))); - irt_filepath_ = FilePath(path_string); + irt_filepath_ = base::FilePath(path_string); } else { - FilePath plugin_dir; + base::FilePath plugin_dir; if (!PathService::Get(chrome::DIR_INTERNAL_PLUGINS, &plugin_dir)) { DLOG(ERROR) << "Failed to locate the plugins directory, NaCl disabled."; MarkAsFailed(); @@ -278,13 +279,13 @@ void NaClBrowser::InitValidationCacheFilePath() { // exists in Chrome's cache directory and is not tied to any specific // profile. // Start by finding the user data directory. - FilePath user_data_dir; + base::FilePath user_data_dir; if (!PathService::Get(chrome::DIR_USER_DATA, &user_data_dir)) { RunWithoutValidationCache(); return; } // The cache directory may or may not be the user data directory. - FilePath cache_file_path; + base::FilePath cache_file_path; chrome::GetUserCacheDirectory(user_data_dir, &cache_file_path); // Append the base file name to the cache directory. @@ -366,7 +367,7 @@ void NaClBrowser::WaitForResources(const base::Closure& reply) { CheckWaiting(); } -const FilePath& NaClBrowser::GetIrtFilePath() { +const base::FilePath& NaClBrowser::GetIrtFilePath() { return irt_filepath_; } diff --git a/chrome/browser/nacl_host/nacl_browser.h b/chrome/browser/nacl_host/nacl_browser.h index de752b4..f3d8646 100644 --- a/chrome/browser/nacl_host/nacl_browser.h +++ b/chrome/browser/nacl_host/nacl_browser.h @@ -41,7 +41,7 @@ class NaClBrowser { void EnsureIrtAvailable(); // Path to IRT. Available even before IRT is loaded. - const FilePath& GetIrtFilePath(); + const base::FilePath& GetIrtFilePath(); // IRT file handle, only available when IsReady(). base::PlatformFile IrtFile() const; @@ -111,13 +111,13 @@ class NaClBrowser { base::WeakPtrFactory<NaClBrowser> weak_factory_; base::PlatformFile irt_platform_file_; - FilePath irt_filepath_; + base::FilePath irt_filepath_; NaClResourceState irt_state_; std::vector<URLPattern> debug_patterns_; bool inverse_debug_patterns_; NaClValidationCache validation_cache_; NaClValidationCache off_the_record_validation_cache_; - FilePath validation_cache_file_path_; + base::FilePath validation_cache_file_path_; bool validation_cache_is_enabled_; bool validation_cache_is_modified_; NaClResourceState validation_cache_state_; diff --git a/chrome/browser/nacl_host/nacl_process_host.cc b/chrome/browser/nacl_host/nacl_process_host.cc index 4f42e13..b41bd0d 100644 --- a/chrome/browser/nacl_host/nacl_process_host.cc +++ b/chrome/browser/nacl_host/nacl_process_host.cc @@ -347,21 +347,21 @@ bool NaClProcessHost::Send(IPC::Message* msg) { #if defined(OS_WIN) scoped_ptr<CommandLine> NaClProcessHost::GetCommandForLaunchWithGdb( - const FilePath& nacl_gdb, + const base::FilePath& nacl_gdb, CommandLine* line) { CommandLine* cmd_line = new CommandLine(nacl_gdb); // We can't use PrependWrapper because our parameters contain spaces. cmd_line->AppendArg("--eval-command"); - const FilePath::StringType& irt_path = + const base::FilePath::StringType& irt_path = NaClBrowser::GetInstance()->GetIrtFilePath().value(); cmd_line->AppendArgNative(FILE_PATH_LITERAL("nacl-irt ") + irt_path); - FilePath manifest_path = GetManifestPath(); + base::FilePath manifest_path = GetManifestPath(); if (!manifest_path.empty()) { cmd_line->AppendArg("--eval-command"); cmd_line->AppendArgNative(FILE_PATH_LITERAL("nacl-manifest ") + manifest_path.value()); } - FilePath script = CommandLine::ForCurrentProcess()->GetSwitchValuePath( + base::FilePath script = CommandLine::ForCurrentProcess()->GetSwitchValuePath( switches::kNaClGdbScript); if (!script.empty()) { cmd_line->AppendArg("--command"); @@ -418,10 +418,10 @@ bool NaClProcessHost::LaunchNaClGdb(base::ProcessId pid) { base::SplitString(nacl_gdb, static_cast<CommandLine::CharType>(' '), &argv); CommandLine cmd_line(argv); cmd_line.AppendArg("--eval-command"); - const FilePath::StringType& irt_path = + const base::FilePath::StringType& irt_path = NaClBrowser::GetInstance()->GetIrtFilePath().value(); cmd_line.AppendArgNative(FILE_PATH_LITERAL("nacl-irt ") + irt_path); - FilePath manifest_path = GetManifestPath(); + base::FilePath manifest_path = GetManifestPath(); if (!manifest_path.empty()) { cmd_line.AppendArg("--eval-command"); cmd_line.AppendArgNative(FILE_PATH_LITERAL("nacl-manifest ") + @@ -440,7 +440,7 @@ bool NaClProcessHost::LaunchNaClGdb(base::ProcessId pid) { cmd_line.AppendArg("dump binary value /proc/" + base::IntToString(base::GetCurrentProcId()) + "/fd/" + base::IntToString(fds[1]) + " (char)0"); - FilePath script = CommandLine::ForCurrentProcess()->GetSwitchValuePath( + base::FilePath script = CommandLine::ForCurrentProcess()->GetSwitchValuePath( switches::kNaClGdbScript); if (!script.empty()) { cmd_line.AppendArg("--command"); @@ -471,7 +471,7 @@ void NaClProcessHost::OnNaClGdbAttached() { } #endif -FilePath NaClProcessHost::GetManifestPath() { +base::FilePath NaClProcessHost::GetManifestPath() { const extensions::Extension* extension = extension_info_map_->extensions() .GetExtensionOrAppByURL(ExtensionURLInfo(manifest_url_)); if (extension != NULL && @@ -480,7 +480,7 @@ FilePath NaClProcessHost::GetManifestPath() { TrimString(path, "/", &path); // Remove first slash return extension->path().AppendASCII(path); } - return FilePath(); + return base::FilePath(); } bool NaClProcessHost::LaunchSelLdr() { @@ -513,14 +513,14 @@ bool NaClProcessHost::LaunchSelLdr() { int flags = ChildProcessHost::CHILD_NORMAL; #endif - FilePath exe_path = ChildProcessHost::GetChildPath(flags); + base::FilePath exe_path = ChildProcessHost::GetChildPath(flags); if (exe_path.empty()) return false; #if defined(OS_WIN) // On Windows 64-bit NaCl loader is called nacl64.exe instead of chrome.exe if (RunningOnWOW64()) { - FilePath module_path; + base::FilePath module_path; if (!PathService::Get(base::FILE_MODULE, &module_path)) { LOG(ERROR) << "NaCl process launch failed: could not resolve module"; return false; @@ -541,8 +541,8 @@ bool NaClProcessHost::LaunchSelLdr() { if (!nacl_loader_prefix.empty()) cmd_line->PrependWrapper(nacl_loader_prefix); - FilePath nacl_gdb = CommandLine::ForCurrentProcess()->GetSwitchValuePath( - switches::kNaClGdb); + base::FilePath nacl_gdb = + CommandLine::ForCurrentProcess()->GetSwitchValuePath(switches::kNaClGdb); if (!nacl_gdb.empty()) { #if defined(OS_WIN) cmd_line->AppendSwitch(switches::kNoSandbox); @@ -572,7 +572,7 @@ bool NaClProcessHost::LaunchSelLdr() { return false; } } else { - process_->Launch(FilePath(), cmd_line.release()); + process_->Launch(base::FilePath(), cmd_line.release()); } #elif defined(OS_POSIX) process_->Launch(nacl_loader_prefix.empty(), // use_zygote diff --git a/chrome/browser/nacl_host/nacl_process_host.h b/chrome/browser/nacl_host/nacl_process_host.h index 8e0c892..eabf06b 100644 --- a/chrome/browser/nacl_host/nacl_process_host.h +++ b/chrome/browser/nacl_host/nacl_process_host.h @@ -97,8 +97,8 @@ class NaClProcessHost : public content::BrowserChildProcessHostDelegate { #if defined(OS_WIN) // Create command line for launching loader under nacl-gdb. - scoped_ptr<CommandLine> GetCommandForLaunchWithGdb(const FilePath& nacl_gdb, - CommandLine* line); + scoped_ptr<CommandLine> GetCommandForLaunchWithGdb( + const base::FilePath& nacl_gdb, CommandLine* line); #elif defined(OS_LINUX) bool LaunchNaClGdb(base::ProcessId pid); void OnNaClGdbAttached(); @@ -110,7 +110,7 @@ class NaClProcessHost : public content::BrowserChildProcessHostDelegate { SocketDescriptor GetDebugStubSocketHandle(); #endif // Get path to manifest on local disk if possible. - FilePath GetManifestPath(); + base::FilePath GetManifestPath(); bool LaunchSelLdr(); // BrowserChildProcessHostDelegate implementation: diff --git a/chrome/browser/nacl_host/pnacl_file_host.cc b/chrome/browser/nacl_host/pnacl_file_host.cc index f9454f3..966fc7f 100644 --- a/chrome/browser/nacl_host/pnacl_file_host.cc +++ b/chrome/browser/nacl_host/pnacl_file_host.cc @@ -35,7 +35,7 @@ void NotifyRendererOfError( chrome_render_message_filter->Send(reply_msg); } -bool PnaclDoOpenFile(const FilePath& file_to_open, +bool PnaclDoOpenFile(const base::FilePath& file_to_open, base::PlatformFile* out_file) { base::PlatformFileError error_code; *out_file = base::CreatePlatformFile(file_to_open, @@ -54,7 +54,7 @@ void DoOpenPnaclFile( const std::string& filename, IPC::Message* reply_msg) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); - FilePath full_filepath; + base::FilePath full_filepath; // Do some validation. if (!pnacl_file_host::PnaclCanOpenFile(filename, &full_filepath)) { @@ -88,7 +88,7 @@ void DoCreateTemporaryFile( IPC::Message* reply_msg) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); - FilePath file_path; + base::FilePath file_path; if (!file_util::CreateTemporaryFile(&file_path)) { NotifyRendererOfError(chrome_render_message_filter, reply_msg); return; @@ -144,7 +144,7 @@ void GetReadonlyPnaclFd( // This function is security sensitive. Be sure to check with a security // person before you modify it. bool PnaclCanOpenFile(const std::string& filename, - FilePath* file_to_open) { + base::FilePath* file_to_open) { if (filename.length() > kMaxFileLength) return false; @@ -162,13 +162,13 @@ bool PnaclCanOpenFile(const std::string& filename, } // PNaCl must be installed. - FilePath pnacl_dir; + base::FilePath pnacl_dir; if (!PathService::Get(chrome::DIR_PNACL_COMPONENT, &pnacl_dir) || pnacl_dir.empty()) return false; // Prepend the prefix to restrict files to a whitelisted set. - FilePath full_path = pnacl_dir.AppendASCII( + base::FilePath full_path = pnacl_dir.AppendASCII( std::string(kExpectedFilePrefix) + filename); *file_to_open = full_path; return true; diff --git a/chrome/browser/nacl_host/pnacl_file_host_unittest.cc b/chrome/browser/nacl_host/pnacl_file_host_unittest.cc index 76eee82..7c60893 100644 --- a/chrome/browser/nacl_host/pnacl_file_host_unittest.cc +++ b/chrome/browser/nacl_host/pnacl_file_host_unittest.cc @@ -16,16 +16,16 @@ using pnacl_file_host::PnaclCanOpenFile; // Try to pass a few funny filenames with a dummy pnacl directory set. TEST(PnaclFileHostTest, TestFilenamesWithPnaclPath) { - FilePath kDummyPnaclPath(FILE_PATH_LITERAL("dummy_pnacl_path")); + base::FilePath kDummyPnaclPath(FILE_PATH_LITERAL("dummy_pnacl_path")); base::ScopedPathOverride pnach_dir_override(chrome::DIR_PNACL_COMPONENT, kDummyPnaclPath); ASSERT_TRUE(PathService::Get(chrome::DIR_PNACL_COMPONENT, &kDummyPnaclPath)); // Check allowed strings, and check that the expected prefix is added. - FilePath out_path; + base::FilePath out_path; EXPECT_TRUE(PnaclCanOpenFile("pnacl_json", &out_path)); - FilePath expected_path = kDummyPnaclPath.Append( + base::FilePath expected_path = kDummyPnaclPath.Append( FILE_PATH_LITERAL("pnacl_public_pnacl_json")); EXPECT_EQ(out_path, expected_path); diff --git a/chrome/browser/nacl_host/test/gdb_debug_stub_browsertest.cc b/chrome/browser/nacl_host/test/gdb_debug_stub_browsertest.cc index 3addab8..71f04ed 100644 --- a/chrome/browser/nacl_host/test/gdb_debug_stub_browsertest.cc +++ b/chrome/browser/nacl_host/test/gdb_debug_stub_browsertest.cc @@ -34,8 +34,8 @@ void NaClGdbDebugStubTest::StartTestScript(base::ProcessHandle* test_process, std::string test_name, int debug_stub_port) { // We call python script to reuse GDB RSP protocol implementation. - CommandLine cmd(FilePath(FILE_PATH_LITERAL("python"))); - FilePath script; + CommandLine cmd(base::FilePath(FILE_PATH_LITERAL("python"))); + base::FilePath script; PathService::Get(base::DIR_SOURCE_ROOT, &script); script = script.AppendASCII( "chrome/browser/nacl_host/test/debug_stub_browser_tests.py"); diff --git a/chrome/browser/nacl_host/test/mock_nacl_gdb.cc b/chrome/browser/nacl_host/test/mock_nacl_gdb.cc index e7a75d0..fa9a28c 100644 --- a/chrome/browser/nacl_host/test/mock_nacl_gdb.cc +++ b/chrome/browser/nacl_host/test/mock_nacl_gdb.cc @@ -25,14 +25,15 @@ void SendMessage(const char* arg) { const char* file_end = strchr(arg, ' '); CHECK(file_end); char buf = '\0'; - file_util::WriteFile(FilePath(FilePath::StringType(arg, file_end)), &buf, 1); + file_util::WriteFile( + base::FilePath(base::FilePath::StringType(arg, file_end)), &buf, 1); } int main(int argc, char** argv) { scoped_ptr<base::Environment> env(base::Environment::Create()); std::string mock_nacl_gdb_file; env->GetVar("MOCK_NACL_GDB", &mock_nacl_gdb_file); - file_util::WriteFile(FilePath::FromUTF8Unsafe(mock_nacl_gdb_file), + file_util::WriteFile(base::FilePath::FromUTF8Unsafe(mock_nacl_gdb_file), kPass, strlen(kPass)); CHECK_GE(argc, 3); // First argument should be --eval-command. @@ -70,7 +71,7 @@ int main(int argc, char** argv) { i += 2; CHECK_LE(i, argc); std::string nacl_gdb_script(argv[i - 1]); - file_util::WriteFile(FilePath::FromUTF8Unsafe(nacl_gdb_script), + file_util::WriteFile(base::FilePath::FromUTF8Unsafe(nacl_gdb_script), kPass, strlen(kPass)); continue; } diff --git a/chrome/browser/nacl_host/test/nacl_gdb_browsertest.cc b/chrome/browser/nacl_host/test/nacl_gdb_browsertest.cc index 22e6d23..141008e 100644 --- a/chrome/browser/nacl_host/test/nacl_gdb_browsertest.cc +++ b/chrome/browser/nacl_host/test/nacl_gdb_browsertest.cc @@ -10,7 +10,7 @@ #include "chrome/common/chrome_switches.h" #include "chrome/test/ppapi/ppapi_test.h" -static const FilePath::CharType kMockNaClGdb[] = +static const base::FilePath::CharType kMockNaClGdb[] = #if defined(OS_WIN) FILE_PATH_LITERAL("mock_nacl_gdb.exe"); #else @@ -25,7 +25,7 @@ class NaClGdbTest : public PPAPINaClNewlibTest { virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { PPAPINaClNewlibTest::SetUpCommandLine(command_line); - FilePath mock_nacl_gdb; + base::FilePath mock_nacl_gdb; EXPECT_TRUE(PathService::Get(base::DIR_EXE, &mock_nacl_gdb)); mock_nacl_gdb = mock_nacl_gdb.Append(kMockNaClGdb); command_line->AppendSwitchPath(switches::kNaClGdb, mock_nacl_gdb); @@ -34,7 +34,7 @@ class NaClGdbTest : public PPAPINaClNewlibTest { } void RunWithNaClGdb(std::string test_name) { - FilePath mock_nacl_gdb_file; + base::FilePath mock_nacl_gdb_file; scoped_ptr<base::Environment> env(base::Environment::Create()); std::string content; // TODO(halyavin): Make this test work on Windows 32-bit. Currently this @@ -65,7 +65,7 @@ class NaClGdbTest : public PPAPINaClNewlibTest { } private: - FilePath script_; + base::FilePath script_; }; // Fails on the ASAN test bot. See http://crbug.com/122219 diff --git a/chrome/browser/net/chrome_network_delegate.cc b/chrome/browser/net/chrome_network_delegate.cc index d05a93a..7125e73 100644 --- a/chrome/browser/net/chrome_network_delegate.cc +++ b/chrome/browser/net/chrome_network_delegate.cc @@ -582,7 +582,7 @@ bool ChromeNetworkDelegate::OnCanSetCookie(const net::URLRequest& request, } bool ChromeNetworkDelegate::OnCanAccessFile(const net::URLRequest& request, - const FilePath& path) const { + const base::FilePath& path) const { if (g_allow_file_access_) return true; @@ -610,7 +610,7 @@ bool ChromeNetworkDelegate::OnCanAccessFile(const net::URLRequest& request, }; #elif defined(OS_ANDROID) // Access to files in external storage is allowed. - FilePath external_storage_path; + base::FilePath external_storage_path; PathService::Get(base::DIR_ANDROID_EXTERNAL_STORAGE, &external_storage_path); if (external_storage_path.IsParent(path)) return true; @@ -623,8 +623,8 @@ bool ChromeNetworkDelegate::OnCanAccessFile(const net::URLRequest& request, #endif for (size_t i = 0; i < arraysize(kLocalAccessWhiteList); ++i) { - const FilePath white_listed_path(kLocalAccessWhiteList[i]); - // FilePath::operator== should probably handle trailing separators. + const base::FilePath white_listed_path(kLocalAccessWhiteList[i]); + // base::FilePath::operator== should probably handle trailing separators. if (white_listed_path == path.StripTrailingSeparators() || white_listed_path.IsParent(path)) { return true; diff --git a/chrome/browser/net/connection_tester_unittest.cc b/chrome/browser/net/connection_tester_unittest.cc index 308e511..b6becad 100644 --- a/chrome/browser/net/connection_tester_unittest.cc +++ b/chrome/browser/net/connection_tester_unittest.cc @@ -92,7 +92,7 @@ class ConnectionTesterTest : public PlatformTest { test_server_(net::TestServer::TYPE_HTTP, net::TestServer::kLocalhost, // Nothing is read in this directory. - FilePath(FILE_PATH_LITERAL("chrome"))), + base::FilePath(FILE_PATH_LITERAL("chrome"))), proxy_script_fetcher_context_(new net::URLRequestContext) { InitializeRequestContext(); } diff --git a/chrome/browser/net/ftp_browsertest.cc b/chrome/browser/net/ftp_browsertest.cc index a48bd628..8e54e318 100644 --- a/chrome/browser/net/ftp_browsertest.cc +++ b/chrome/browser/net/ftp_browsertest.cc @@ -13,7 +13,7 @@ class FtpBrowserTest : public InProcessBrowserTest { FtpBrowserTest() : ftp_server_(net::TestServer::TYPE_FTP, net::TestServer::kLocalhost, - FilePath()) { + base::FilePath()) { } protected: diff --git a/chrome/browser/net/http_pipelining_compatibility_client_unittest.cc b/chrome/browser/net/http_pipelining_compatibility_client_unittest.cc index 239f2b9..04dddfe 100644 --- a/chrome/browser/net/http_pipelining_compatibility_client_unittest.cc +++ b/chrome/browser/net/http_pipelining_compatibility_client_unittest.cc @@ -81,10 +81,10 @@ using testing::StrEq; class HttpPipeliningCompatibilityClientTest : public testing::Test { public: HttpPipeliningCompatibilityClientTest() - : test_server_( - net::TestServer::TYPE_HTTP, - net::TestServer::kLocalhost, - FilePath(FILE_PATH_LITERAL("chrome/test/data/http_pipelining"))), + : test_server_(net::TestServer::TYPE_HTTP, + net::TestServer::kLocalhost, + base::FilePath(FILE_PATH_LITERAL( + "chrome/test/data/http_pipelining"))), io_thread_(BrowserThread::IO, &message_loop_) { } diff --git a/chrome/browser/net/net_log_logger.cc b/chrome/browser/net/net_log_logger.cc index 03c0647..a172dc3 100644 --- a/chrome/browser/net/net_log_logger.cc +++ b/chrome/browser/net/net_log_logger.cc @@ -14,7 +14,7 @@ #include "base/values.h" #include "chrome/browser/ui/webui/net_internals/net_internals_ui.h" -NetLogLogger::NetLogLogger(const FilePath &log_path) { +NetLogLogger::NetLogLogger(const base::FilePath &log_path) { if (!log_path.empty()) { base::ThreadRestrictions::ScopedAllowIO allow_io; FILE* fp = file_util::OpenFile(log_path, "w"); diff --git a/chrome/browser/net/net_log_temp_file.cc b/chrome/browser/net/net_log_temp_file.cc index b6f7d43..4af46c2 100644 --- a/chrome/browser/net/net_log_temp_file.cc +++ b/chrome/browser/net/net_log_temp_file.cc @@ -115,7 +115,7 @@ void NetLogTempFile::StopNetLog() { state_ = STATE_ALLOW_START_SEND; } -bool NetLogTempFile::GetFilePath(FilePath* path) { +bool NetLogTempFile::GetFilePath(base::FilePath* path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE_USER_BLOCKING)); if (state_ != STATE_ALLOW_START_SEND) return false; @@ -136,7 +136,7 @@ bool NetLogTempFile::GetFilePath(FilePath* path) { bool NetLogTempFile::GetNetExportLog() { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE_USER_BLOCKING)); - FilePath temp_dir; + base::FilePath temp_dir; if (!GetNetExportLogDirectory(&temp_dir)) return false; @@ -144,7 +144,7 @@ bool NetLogTempFile::GetNetExportLog() { return true; } -bool NetLogTempFile::GetNetExportLogDirectory(FilePath* path) { +bool NetLogTempFile::GetNetExportLogDirectory(base::FilePath* path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE_USER_BLOCKING)); return file_util::GetTempDir(path); } diff --git a/chrome/browser/net/net_log_temp_file.h b/chrome/browser/net/net_log_temp_file.h index 0d6f51d..b47899b 100644 --- a/chrome/browser/net/net_log_temp_file.h +++ b/chrome/browser/net/net_log_temp_file.h @@ -51,7 +51,7 @@ class NetLogTempFile { // Returns true and the path to the temporary file. If there is no file to // send, then it returns false. It also returns false when actively logging to // the file. - bool GetFilePath(FilePath* path); + bool GetFilePath(base::FilePath* path); // Creates a Value summary of the state of the NetLogTempFile. The caller is // responsible for deleting the returned value. @@ -64,7 +64,7 @@ class NetLogTempFile { // Returns path name to file_util::GetTempDir() directory. Returns false if // file_util::GetTempDir() fails. - virtual bool GetNetExportLogDirectory(FilePath* path); + virtual bool GetNetExportLogDirectory(base::FilePath* path); // Returns true if |log_path_| exists. virtual bool NetExportLogExists(); @@ -105,7 +105,7 @@ class NetLogTempFile { // are not collecting data into a file. void StopNetLog(); - // Updates |log_path_| with FilePath to |log_filename_| in the + // Updates |log_path_| with base::FilePath to |log_filename_| in the // file_util::GetTempDir() directory. Returns false if file_util::GetTempDir() // fails. bool GetNetExportLog(); @@ -117,9 +117,9 @@ class NetLogTempFile { // Name of the file. It defaults to chrome-net-export-log.json, but can be // overwritten by unit tests. - FilePath::StringType log_filename_; + base::FilePath::StringType log_filename_; - FilePath log_path_; // FilePath to the temporary file. + base::FilePath log_path_; // base::FilePath to the temporary file. // |net_log_logger_| watches the NetLog event stream, and sends all entries to // the file created in StartNetLog(). diff --git a/chrome/browser/net/net_log_temp_file_unittest.cc b/chrome/browser/net/net_log_temp_file_unittest.cc index d89e60f..688206d 100644 --- a/chrome/browser/net/net_log_temp_file_unittest.cc +++ b/chrome/browser/net/net_log_temp_file_unittest.cc @@ -25,7 +25,7 @@ class TestNetLogTempFile : public NetLogTempFile { } // NetLogTempFile implementation: - virtual bool GetNetExportLogDirectory(FilePath* path) OVERRIDE { + virtual bool GetNetExportLogDirectory(base::FilePath* path) OVERRIDE { if (lie_about_net_export_log_directory_) return false; return NetLogTempFile::GetNetExportLogDirectory(path); @@ -63,7 +63,7 @@ class NetLogTempFileTest : public ::testing::Test { // ::testing::Test implementation: virtual void SetUp() OVERRIDE { // Get a temporary file name for unit tests. - FilePath net_log_dir; + base::FilePath net_log_dir; ASSERT_TRUE(net_log_temp_file_->GetNetExportLogDirectory(&net_log_dir)); ASSERT_TRUE(file_util::CreateTemporaryFileInDir(net_log_dir, &net_export_log_)); @@ -107,7 +107,7 @@ class NetLogTempFileTest : public ::testing::Test { EXPECT_EQ(NetLogTempFile::STATE_UNINITIALIZED, net_log_temp_file_->state()); - FilePath net_export_file_path; + base::FilePath net_export_file_path; EXPECT_FALSE(net_log_temp_file_->GetFilePath(&net_export_file_path)); } @@ -117,7 +117,7 @@ class NetLogTempFileTest : public ::testing::Test { EXPECT_EQ("ALLOW_START", GetStateString()); EXPECT_EQ(NetLogTempFile::STATE_ALLOW_START, net_log_temp_file_->state()); - FilePath net_export_file_path; + base::FilePath net_export_file_path; EXPECT_FALSE(net_log_temp_file_->GetFilePath(&net_export_file_path)); EXPECT_FALSE(net_log_temp_file_->NetExportLogExists()); } @@ -128,7 +128,7 @@ class NetLogTempFileTest : public ::testing::Test { EXPECT_EQ(NetLogTempFile::STATE_ALLOW_STOP, net_log_temp_file_->state()); // Check GetFilePath returns false, if we are still writing to file. - FilePath net_export_file_path; + base::FilePath net_export_file_path; EXPECT_FALSE(net_log_temp_file_->GetFilePath(&net_export_file_path)); VerifyNetExportLog(); @@ -140,7 +140,7 @@ class NetLogTempFileTest : public ::testing::Test { EXPECT_EQ(NetLogTempFile::STATE_ALLOW_START_SEND, net_log_temp_file_->state()); - FilePath net_export_file_path; + base::FilePath net_export_file_path; EXPECT_TRUE(net_log_temp_file_->GetFilePath(&net_export_file_path)); EXPECT_TRUE(file_util::PathExists(net_export_file_path)); EXPECT_EQ(net_export_log_, net_export_file_path); @@ -152,7 +152,7 @@ class NetLogTempFileTest : public ::testing::Test { // |net_log_temp_file_| is initialized after |net_log_| so that it can stop // obvserving on destruction. scoped_ptr<TestNetLogTempFile> net_log_temp_file_; - FilePath net_export_log_; + base::FilePath net_export_log_; private: MessageLoop message_loop_; @@ -189,7 +189,7 @@ TEST_F(NetLogTempFileTest, EnsureInitAllowStartOrSend) { EXPECT_EQ(net_export_log_, net_log_temp_file_->log_path_); EXPECT_TRUE(file_util::PathExists(net_export_log_)); - FilePath net_export_file_path; + base::FilePath net_export_file_path; EXPECT_TRUE(net_log_temp_file_->GetFilePath(&net_export_file_path)); EXPECT_TRUE(file_util::PathExists(net_export_file_path)); EXPECT_EQ(net_export_log_, net_export_file_path); diff --git a/chrome/browser/net/network_stats_unittest.cc b/chrome/browser/net/network_stats_unittest.cc index 4d0fe71..e3c1a4a 100644 --- a/chrome/browser/net/network_stats_unittest.cc +++ b/chrome/browser/net/network_stats_unittest.cc @@ -32,7 +32,7 @@ class NetworkStatsTestUDP : public NetworkStatsTest { NetworkStatsTestUDP() : test_server_(net::TestServer::TYPE_UDP_ECHO, net::TestServer::kLocalhost, - FilePath(FILE_PATH_LITERAL("net/data"))) { + base::FilePath(FILE_PATH_LITERAL("net/data"))) { } protected: diff --git a/chrome/browser/net/proxy_browsertest.cc b/chrome/browser/net/proxy_browsertest.cc index 1ca47ca..791c16ba 100644 --- a/chrome/browser/net/proxy_browsertest.cc +++ b/chrome/browser/net/proxy_browsertest.cc @@ -60,7 +60,7 @@ class ProxyBrowserTest : public InProcessBrowserTest { ProxyBrowserTest() : proxy_server_(net::TestServer::TYPE_BASIC_AUTH_PROXY, net::TestServer::kLocalhost, - FilePath()) { + base::FilePath()) { } virtual void SetUp() OVERRIDE { diff --git a/chrome/browser/net/sqlite_persistent_cookie_store.cc b/chrome/browser/net/sqlite_persistent_cookie_store.cc index 863a82d..09b3792 100644 --- a/chrome/browser/net/sqlite_persistent_cookie_store.cc +++ b/chrome/browser/net/sqlite_persistent_cookie_store.cc @@ -62,7 +62,7 @@ using content::BrowserThread; class SQLitePersistentCookieStore::Backend : public base::RefCountedThreadSafe<SQLitePersistentCookieStore::Backend> { public: - Backend(const FilePath& path, + Backend(const base::FilePath& path, bool restore_old_session_cookies, ClearOnExitPolicy* clear_on_exit_policy) : path_(path), @@ -216,7 +216,7 @@ class SQLitePersistentCookieStore::Backend void KillDatabase(); void ScheduleKillDatabase(); - FilePath path_; + base::FilePath path_; scoped_ptr<sql::Connection> db_; sql::MetaTable meta_table_; @@ -531,7 +531,7 @@ bool SQLitePersistentCookieStore::Backend::InitializeDatabase() { base::Time start = base::Time::Now(); - const FilePath dir = path_.DirName(); + const base::FilePath dir = path_.DirName(); if (!file_util::PathExists(dir) && !file_util::CreateDirectory(dir)) { return false; } @@ -1063,7 +1063,7 @@ void SQLitePersistentCookieStore::Backend::DeleteSessionCookiesOnStartup() { } SQLitePersistentCookieStore::SQLitePersistentCookieStore( - const FilePath& path, + const base::FilePath& path, bool restore_old_session_cookies, ClearOnExitPolicy* clear_on_exit_policy) : backend_( diff --git a/chrome/browser/net/sqlite_persistent_cookie_store_unittest.cc b/chrome/browser/net/sqlite_persistent_cookie_store_unittest.cc index b35df3c..4744d75 100644 --- a/chrome/browser/net/sqlite_persistent_cookie_store_unittest.cc +++ b/chrome/browser/net/sqlite_persistent_cookie_store_unittest.cc @@ -259,7 +259,7 @@ TEST_F(SQLitePersistentCookieStoreTest, TestFlush) { InitializeStore(false); // File timestamps don't work well on all platforms, so we'll determine // whether the DB file has been modified by checking its size. - FilePath path = temp_dir_.path().Append(chrome::kCookieFilename); + base::FilePath path = temp_dir_.path().Append(chrome::kCookieFilename); base::PlatformFileInfo info; ASSERT_TRUE(file_util::GetFileInfo(path, &info)); int64 base_size = info.size; diff --git a/chrome/browser/net/sqlite_server_bound_cert_store.cc b/chrome/browser/net/sqlite_server_bound_cert_store.cc index c4a004c..1bbe05d 100644 --- a/chrome/browser/net/sqlite_server_bound_cert_store.cc +++ b/chrome/browser/net/sqlite_server_bound_cert_store.cc @@ -33,7 +33,7 @@ using content::BrowserThread; class SQLiteServerBoundCertStore::Backend : public base::RefCountedThreadSafe<SQLiteServerBoundCertStore::Backend> { public: - Backend(const FilePath& path, ClearOnExitPolicy* clear_on_exit_policy) + Backend(const base::FilePath& path, ClearOnExitPolicy* clear_on_exit_policy) : path_(path), db_(NULL), num_pending_(0), @@ -111,7 +111,7 @@ class SQLiteServerBoundCertStore::Backend void DeleteCertificatesOnShutdown(); - FilePath path_; + base::FilePath path_; scoped_ptr<sql::Connection> db_; sql::MetaTable meta_table_; @@ -193,7 +193,7 @@ void SQLiteServerBoundCertStore::Backend::LoadOnDBThread( // Ensure the parent directory for storing certs is created before reading // from it. - const FilePath dir = path_.DirName(); + const base::FilePath dir = path_.DirName(); if (!file_util::PathExists(dir) && !file_util::CreateDirectory(dir)) return; @@ -565,7 +565,7 @@ void SQLiteServerBoundCertStore::Backend::SetForceKeepSessionState() { } SQLiteServerBoundCertStore::SQLiteServerBoundCertStore( - const FilePath& path, + const base::FilePath& path, ClearOnExitPolicy* clear_on_exit_policy) : backend_(new Backend(path, clear_on_exit_policy)) { } diff --git a/chrome/browser/net/sqlite_server_bound_cert_store_unittest.cc b/chrome/browser/net/sqlite_server_bound_cert_store_unittest.cc index 3dc1b45..8e21d212 100644 --- a/chrome/browser/net/sqlite_server_bound_cert_store_unittest.cc +++ b/chrome/browser/net/sqlite_server_bound_cert_store_unittest.cc @@ -50,9 +50,9 @@ class SQLiteServerBoundCertStoreTest : public testing::Test { protected: static void ReadTestKeyAndCert(std::string* key, std::string* cert) { - FilePath key_path = net::GetTestCertsDirectory().AppendASCII( + base::FilePath key_path = net::GetTestCertsDirectory().AppendASCII( "unittest.originbound.key.der"); - FilePath cert_path = net::GetTestCertsDirectory().AppendASCII( + base::FilePath cert_path = net::GetTestCertsDirectory().AppendASCII( "unittest.originbound.der"); ASSERT_TRUE(file_util::ReadFileToString(key_path, key)); ASSERT_TRUE(file_util::ReadFileToString(cert_path, cert)); @@ -173,7 +173,7 @@ TEST_F(SQLiteServerBoundCertStoreTest, TestUpgradeV1) { // Reset the store. We'll be using a different database for this test. store_ = NULL; - FilePath v1_db_path(temp_dir_.path().AppendASCII("v1db")); + base::FilePath v1_db_path(temp_dir_.path().AppendASCII("v1db")); std::string key_data; std::string cert_data; @@ -257,7 +257,7 @@ TEST_F(SQLiteServerBoundCertStoreTest, TestUpgradeV2) { // Reset the store. We'll be using a different database for this test. store_ = NULL; - FilePath v2_db_path(temp_dir_.path().AppendASCII("v2db")); + base::FilePath v2_db_path(temp_dir_.path().AppendASCII("v2db")); std::string key_data; std::string cert_data; @@ -345,7 +345,7 @@ TEST_F(SQLiteServerBoundCertStoreTest, TestUpgradeV3) { // Reset the store. We'll be using a different database for this test. store_ = NULL; - FilePath v3_db_path(temp_dir_.path().AppendASCII("v3db")); + base::FilePath v3_db_path(temp_dir_.path().AppendASCII("v3db")); std::string key_data; std::string cert_data; @@ -437,7 +437,7 @@ TEST_F(SQLiteServerBoundCertStoreTest, TestUpgradeV3) { TEST_F(SQLiteServerBoundCertStoreTest, TestFlush) { // File timestamps don't work well on all platforms, so we'll determine // whether the DB file has been modified by checking its size. - FilePath path = temp_dir_.path().Append(chrome::kOBCertFilename); + base::FilePath path = temp_dir_.path().Append(chrome::kOBCertFilename); base::PlatformFileInfo info; ASSERT_TRUE(file_util::GetFileInfo(path, &info)); int64 base_size = info.size; diff --git a/chrome/browser/net/transport_security_persister.cc b/chrome/browser/net/transport_security_persister.cc index b288e21..f6b84cc 100644 --- a/chrome/browser/net/transport_security_persister.cc +++ b/chrome/browser/net/transport_security_persister.cc @@ -84,7 +84,7 @@ const char kCreated[] = "created"; class TransportSecurityPersister::Loader { public: Loader(const base::WeakPtr<TransportSecurityPersister>& persister, - const FilePath& path) + const base::FilePath& path) : persister_(persister), path_(path), state_valid_(false) { @@ -109,7 +109,7 @@ class TransportSecurityPersister::Loader { private: base::WeakPtr<TransportSecurityPersister> persister_; - FilePath path_; + base::FilePath path_; std::string state_; bool state_valid_; @@ -119,7 +119,7 @@ class TransportSecurityPersister::Loader { TransportSecurityPersister::TransportSecurityPersister( TransportSecurityState* state, - const FilePath& profile_path, + const base::FilePath& profile_path, bool readonly) : transport_security_state_(state), writer_(profile_path.AppendASCII("TransportSecurity"), diff --git a/chrome/browser/net/transport_security_persister.h b/chrome/browser/net/transport_security_persister.h index 8458453..acd78bf 100644 --- a/chrome/browser/net/transport_security_persister.h +++ b/chrome/browser/net/transport_security_persister.h @@ -47,7 +47,7 @@ class TransportSecurityPersister public base::ImportantFileWriter::DataSerializer { public: TransportSecurityPersister(net::TransportSecurityState* state, - const FilePath& profile_path, + const base::FilePath& profile_path, bool readonly); virtual ~TransportSecurityPersister(); diff --git a/chrome/browser/net/transport_security_persister_unittest.cc b/chrome/browser/net/transport_security_persister_unittest.cc index 81edf7d..bd6e95b 100644 --- a/chrome/browser/net/transport_security_persister_unittest.cc +++ b/chrome/browser/net/transport_security_persister_unittest.cc @@ -138,7 +138,7 @@ TEST_F(TransportSecurityPersisterTest, SerializeData3) { // just do it directly rather than call persister_->StateIsDirty. (That uses // ImportantFileWriter, which has an asynchronous commit interval rather // than block.) Use a different basename just for cleanliness. - FilePath path = + base::FilePath path = temp_dir_.path().AppendASCII("TransportSecurityPersisterTest"); EXPECT_TRUE(file_util::WriteFile(path, serialized.c_str(), serialized.size())); diff --git a/chrome/browser/net/url_fixer_upper.cc b/chrome/browser/net/url_fixer_upper.cc index 8d61593..f590702 100644 --- a/chrome/browser/net/url_fixer_upper.cc +++ b/chrome/browser/net/url_fixer_upper.cc @@ -90,8 +90,8 @@ TrimPositions TrimWhitespaceUTF8(const std::string& input, } // namespace // does some basic fixes for input that we want to test for file-ness -static void PrepareStringForFileOps(const FilePath& text, - FilePath::StringType* output) { +static void PrepareStringForFileOps(const base::FilePath& text, + base::FilePath::StringType* output) { #if defined(OS_WIN) TrimWhitespace(text.value(), TRIM_ALL, output); replace(output->begin(), output->end(), '/', '\\'); @@ -103,9 +103,9 @@ static void PrepareStringForFileOps(const FilePath& text, // Tries to create a full path from |text|. If the result is valid and the // file exists, returns true and sets |full_path| to the result. Otherwise, // returns false and leaves |full_path| unchanged. -static bool ValidPathForFile(const FilePath::StringType& text, - FilePath* full_path) { - FilePath file_path(text); +static bool ValidPathForFile(const base::FilePath::StringType& text, + base::FilePath* full_path) { + base::FilePath file_path(text); if (!file_util::AbsolutePath(&file_path)) return false; @@ -154,23 +154,23 @@ static std::string FixupHomedir(const std::string& text) { static std::string FixupPath(const std::string& text) { DCHECK(!text.empty()); - FilePath::StringType filename; + base::FilePath::StringType filename; #if defined(OS_WIN) - FilePath input_path(UTF8ToWide(text)); + base::FilePath input_path(UTF8ToWide(text)); PrepareStringForFileOps(input_path, &filename); // Fixup Windows-style drive letters, where "C:" gets rewritten to "C|". if (filename.length() > 1 && filename[1] == '|') filename[1] = ':'; #elif defined(OS_POSIX) - FilePath input_path(text); + base::FilePath input_path(text); PrepareStringForFileOps(input_path, &filename); if (filename.length() > 0 && filename[0] == '~') filename = FixupHomedir(filename); #endif // Here, we know the input looks like a file. - GURL file_url = net::FilePathToFileURL(FilePath(filename)); + GURL file_url = net::FilePathToFileURL(base::FilePath(filename)); if (file_url.is_valid()) { return UTF16ToUTF8(net::FormatUrl(file_url, std::string(), net::kFormatUrlOmitUsernamePassword, net::UnescapeRule::NORMAL, NULL, @@ -393,7 +393,8 @@ std::string URLFixerUpper::SegmentURL(const std::string& text, url_parse::DoesBeginUNCPath(trimmed.data(), 0, trimmed_length, true)) return "file"; #elif defined(OS_POSIX) - if (FilePath::IsSeparator(trimmed.data()[0]) || trimmed.data()[0] == '~') + if (base::FilePath::IsSeparator(trimmed.data()[0]) || + trimmed.data()[0] == '~') return "file"; #endif @@ -538,9 +539,9 @@ GURL URLFixerUpper::FixupURL(const std::string& text, // fixup will look for cues that it is actually a file path before trying to // figure out what file it is. If our logic doesn't work, we will fall back on // regular fixup. -GURL URLFixerUpper::FixupRelativeFile(const FilePath& base_dir, - const FilePath& text) { - FilePath old_cur_directory; +GURL URLFixerUpper::FixupRelativeFile(const base::FilePath& base_dir, + const base::FilePath& text) { + base::FilePath old_cur_directory; if (!base_dir.empty()) { // Save the old current directory before we move to the new one. file_util::GetCurrentDirectory(&old_cur_directory); @@ -548,7 +549,7 @@ GURL URLFixerUpper::FixupRelativeFile(const FilePath& base_dir, } // Allow funny input with extra whitespace and the wrong kind of slashes. - FilePath::StringType trimmed; + base::FilePath::StringType trimmed; PrepareStringForFileOps(text, &trimmed); bool is_file = true; @@ -556,7 +557,7 @@ GURL URLFixerUpper::FixupRelativeFile(const FilePath& base_dir, GURL gurl(trimmed); if (gurl.is_valid() && gurl.IsStandard()) is_file = false; - FilePath full_path; + base::FilePath full_path; if (is_file && !ValidPathForFile(trimmed, &full_path)) { // Not a path as entered, try unescaping it in case the user has // escaped things. We need to go through 8-bit since the escaped values diff --git a/chrome/browser/net/url_fixer_upper_unittest.cc b/chrome/browser/net/url_fixer_upper_unittest.cc index abe248f..8c6cfc8 100644 --- a/chrome/browser/net/url_fixer_upper_unittest.cc +++ b/chrome/browser/net/url_fixer_upper_unittest.cc @@ -221,16 +221,16 @@ TEST(URLFixerUpperTest, SegmentURL) { // full_path = "c:\foo\bar.txt" // dir = "c:\foo" // file_name = "bar.txt" -static bool MakeTempFile(const FilePath& dir, - const FilePath& file_name, - FilePath* full_path) { +static bool MakeTempFile(const base::FilePath& dir, + const base::FilePath& file_name, + base::FilePath* full_path) { *full_path = dir.Append(file_name); return file_util::WriteFile(*full_path, "", 0) == 0; } // Returns true if the given URL is a file: URL that matches the given file static bool IsMatchingFileURL(const std::string& url, - const FilePath& full_file_path) { + const base::FilePath& full_file_path) { if (url.length() <= 8) return false; if (std::string("file:///") != url.substr(0, 8)) @@ -238,10 +238,10 @@ static bool IsMatchingFileURL(const std::string& url, if (url.find('\\') != std::string::npos) return false; // contains backslashes - FilePath derived_path; + base::FilePath derived_path; net::FileURLToFilePath(GURL(url), &derived_path); - return FilePath::CompareEqualIgnoreCase(derived_path.value(), + return base::FilePath::CompareEqualIgnoreCase(derived_path.value(), full_file_path.value()); } @@ -353,12 +353,12 @@ TEST(URLFixerUpperTest, FixupURL) { // has to exist. TEST(URLFixerUpperTest, FixupFile) { // this "original" filename is the one we tweak to get all the variations - FilePath dir; - FilePath original; + base::FilePath dir; + base::FilePath original; ASSERT_TRUE(PathService::Get(chrome::DIR_APP, &dir)); ASSERT_TRUE(MakeTempFile( dir, - FilePath(FILE_PATH_LITERAL("url fixer upper existing file.txt")), + base::FilePath(FILE_PATH_LITERAL("url fixer upper existing file.txt")), &original)); // reference path @@ -450,8 +450,9 @@ TEST(URLFixerUpperTest, FixupFile) { } TEST(URLFixerUpperTest, FixupRelativeFile) { - FilePath full_path, dir; - FilePath file_part(FILE_PATH_LITERAL("url_fixer_upper_existing_file.txt")); + base::FilePath full_path, dir; + base::FilePath file_part( + FILE_PATH_LITERAL("url_fixer_upper_existing_file.txt")); ASSERT_TRUE(PathService::Get(chrome::DIR_APP, &dir)); ASSERT_TRUE(MakeTempFile(dir, file_part, &full_path)); ASSERT_TRUE(file_util::AbsolutePath(&full_path)); @@ -460,9 +461,9 @@ TEST(URLFixerUpperTest, FixupRelativeFile) { for (size_t i = 0; i < arraysize(fixup_cases); ++i) { fixup_case value = fixup_cases[i]; #if defined(OS_WIN) - FilePath input(UTF8ToWide(value.input)); + base::FilePath input(UTF8ToWide(value.input)); #elif defined(OS_POSIX) - FilePath input(value.input); + base::FilePath input(value.input); #endif EXPECT_EQ(value.output, URLFixerUpper::FixupRelativeFile(dir, input).possibly_invalid_spec()); @@ -476,7 +477,7 @@ TEST(URLFixerUpperTest, FixupRelativeFile) { // create a filename we know doesn't exist and make sure it doesn't get // fixed up to a file URL - FilePath nonexistent_file( + base::FilePath nonexistent_file( FILE_PATH_LITERAL("url_fixer_upper_nonexistent_file.txt")); std::string fixedup(URLFixerUpper::FixupRelativeFile(dir, nonexistent_file).possibly_invalid_spec()); @@ -486,32 +487,33 @@ TEST(URLFixerUpperTest, FixupRelativeFile) { // make a subdir to make sure relative paths with directories work, also // test spaces: // "app_dir\url fixer-upper dir\url fixer-upper existing file.txt" - FilePath sub_dir(FILE_PATH_LITERAL("url fixer-upper dir")); - FilePath sub_file(FILE_PATH_LITERAL("url fixer-upper existing file.txt")); - FilePath new_dir = dir.Append(sub_dir); + base::FilePath sub_dir(FILE_PATH_LITERAL("url fixer-upper dir")); + base::FilePath sub_file( + FILE_PATH_LITERAL("url fixer-upper existing file.txt")); + base::FilePath new_dir = dir.Append(sub_dir); file_util::CreateDirectory(new_dir); ASSERT_TRUE(MakeTempFile(new_dir, sub_file, &full_path)); ASSERT_TRUE(file_util::AbsolutePath(&full_path)); // test file in the subdir - FilePath relative_file = sub_dir.Append(sub_file); + base::FilePath relative_file = sub_dir.Append(sub_file); EXPECT_TRUE(IsMatchingFileURL(URLFixerUpper::FixupRelativeFile(dir, relative_file).possibly_invalid_spec(), full_path)); // test file in the subdir with different slashes and escaping. - FilePath::StringType relative_file_str = sub_dir.value() + + base::FilePath::StringType relative_file_str = sub_dir.value() + FILE_PATH_LITERAL("/") + sub_file.value(); ReplaceSubstringsAfterOffset(&relative_file_str, 0, FILE_PATH_LITERAL(" "), FILE_PATH_LITERAL("%20")); EXPECT_TRUE(IsMatchingFileURL(URLFixerUpper::FixupRelativeFile(dir, - FilePath(relative_file_str)).possibly_invalid_spec(), full_path)); + base::FilePath(relative_file_str)).possibly_invalid_spec(), full_path)); // test relative directories and duplicate slashes // (should resolve to the same file as above) relative_file_str = sub_dir.value() + FILE_PATH_LITERAL("/../") + sub_dir.value() + FILE_PATH_LITERAL("///./") + sub_file.value(); EXPECT_TRUE(IsMatchingFileURL(URLFixerUpper::FixupRelativeFile(dir, - FilePath(relative_file_str)).possibly_invalid_spec(), full_path)); + base::FilePath(relative_file_str)).possibly_invalid_spec(), full_path)); // done with the subdir EXPECT_TRUE(file_util::Delete(full_path, false)); @@ -519,8 +521,8 @@ TEST(URLFixerUpperTest, FixupRelativeFile) { // Test that an obvious HTTP URL isn't accidentally treated as an absolute // file path (on account of system-specific craziness). - FilePath empty_path; - FilePath http_url_path(FILE_PATH_LITERAL("http://../")); + base::FilePath empty_path; + base::FilePath http_url_path(FILE_PATH_LITERAL("http://../")); EXPECT_TRUE(URLFixerUpper::FixupRelativeFile( empty_path, http_url_path).SchemeIs("http")); } diff --git a/chrome/browser/net/url_request_mock_util.cc b/chrome/browser/net/url_request_mock_util.cc index d71e726..a3af607 100644 --- a/chrome/browser/net/url_request_mock_util.cc +++ b/chrome/browser/net/url_request_mock_util.cc @@ -36,7 +36,7 @@ void SetUrlRequestMocksEnabled(bool enabled) { content::URLRequestFailedJob::AddUrlHandler(); content::URLRequestSlowDownloadJob::AddUrlHandler(); - FilePath root_http; + base::FilePath root_http; PathService::Get(chrome::DIR_TEST_DATA, &root_http); content::URLRequestMockHTTPJob::AddUrlHandler(root_http); content::URLRequestMockHTTPJob::AddHostnameToFileHandler( diff --git a/chrome/browser/page_cycler/page_cycler.cc b/chrome/browser/page_cycler/page_cycler.cc index 675d174..c6813a6d 100644 --- a/chrome/browser/page_cycler/page_cycler.cc +++ b/chrome/browser/page_cycler/page_cycler.cc @@ -32,7 +32,7 @@ using content::Referrer; using content::WebContents; PageCycler::PageCycler(Browser* browser, - const FilePath& urls_file) + const base::FilePath& urls_file) : content::WebContentsObserver( browser->tab_strip_model()->GetActiveWebContents()), browser_(browser), diff --git a/chrome/browser/page_cycler/page_cycler.h b/chrome/browser/page_cycler/page_cycler.h index 65eb204..6d19c3a 100644 --- a/chrome/browser/page_cycler/page_cycler.h +++ b/chrome/browser/page_cycler/page_cycler.h @@ -29,7 +29,7 @@ class PageCycler : public base::RefCountedThreadSafe<PageCycler>, public chrome::BrowserListObserver, public content::WebContentsObserver { public: - PageCycler(Browser* browser, const FilePath& urls_file); + PageCycler(Browser* browser, const base::FilePath& urls_file); // Begin running the page cycler. void Run(); @@ -52,8 +52,10 @@ class PageCycler : public base::RefCountedThreadSafe<PageCycler>, // for testing purposes only. const std::vector<GURL>* urls_for_test() { return &urls_; } - void set_stats_file(const FilePath& stats_file) { stats_file_ = stats_file; } - void set_errors_file(const FilePath& errors_file) { + void set_stats_file(const base::FilePath& stats_file) { + stats_file_ = stats_file; + } + void set_errors_file(const base::FilePath& errors_file) { errors_file_ = errors_file; } @@ -112,14 +114,14 @@ class PageCycler : public base::RefCountedThreadSafe<PageCycler>, Browser* browser_; // The path to the file containing the list of urls to visit. - FilePath urls_file_; + base::FilePath urls_file_; // The path to the file to which we write any errors encountered. - FilePath errors_file_; + base::FilePath errors_file_; // The path to the file to which we write the statistics (optional, may be // an empty path). - FilePath stats_file_; + base::FilePath stats_file_; // The list of urls to visit. std::vector<GURL> urls_; diff --git a/chrome/browser/page_cycler/page_cycler_browsertest.cc b/chrome/browser/page_cycler/page_cycler_browsertest.cc index 15f9ad1..3d4b2f3 100644 --- a/chrome/browser/page_cycler/page_cycler_browsertest.cc +++ b/chrome/browser/page_cycler/page_cycler_browsertest.cc @@ -40,7 +40,7 @@ class PageCyclerBrowserTest : public content::NotificationObserver, // Initialize file paths within a temporary directory; this should be // empty and nonexistent. - virtual void InitFilePaths(FilePath temp_path) { + virtual void InitFilePaths(base::FilePath temp_path) { temp_path_ = temp_path; urls_file_ = temp_path.AppendASCII("urls_file"); errors_file_ = temp_path.AppendASCII("errors"); @@ -59,9 +59,9 @@ class PageCyclerBrowserTest : public content::NotificationObserver, page_cycler_->set_stats_file(stats_file()); } - void InitPageCycler(FilePath urls_file, - FilePath errors_file, - FilePath stats_file) { + void InitPageCycler(base::FilePath urls_file, + base::FilePath errors_file, + base::FilePath stats_file) { page_cycler_ = new PageCycler(browser(), urls_file); page_cycler_->set_errors_file(errors_file); page_cycler_->set_stats_file(stats_file); @@ -120,16 +120,16 @@ class PageCyclerBrowserTest : public content::NotificationObserver, } } - FilePath urls_file() { return urls_file_; } - FilePath errors_file() { return errors_file_; } - FilePath stats_file() { return stats_file_; } + base::FilePath urls_file() { return urls_file_; } + base::FilePath errors_file() { return errors_file_; } + base::FilePath stats_file() { return stats_file_; } PageCycler* page_cycler() { return page_cycler_; } protected: - FilePath temp_path_; - FilePath urls_file_; - FilePath errors_file_; - FilePath stats_file_; + base::FilePath temp_path_; + base::FilePath urls_file_; + base::FilePath errors_file_; + base::FilePath stats_file_; PageCycler* page_cycler_; content::NotificationRegistrar registrar_; }; @@ -141,16 +141,16 @@ class PageCyclerCachedBrowserTest : public PageCyclerBrowserTest { // For a cached test, we use the provided user data directory from the test // directory. virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { - FilePath test_dir; + base::FilePath test_dir; ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &test_dir)); test_dir = test_dir.AppendASCII("page_cycler"); - FilePath source_data_dir = test_dir.AppendASCII("cached_data_dir"); + base::FilePath source_data_dir = test_dir.AppendASCII("cached_data_dir"); CHECK(file_util::PathExists(source_data_dir)); CHECK(user_data_dir_.CreateUniqueTempDir()); - FilePath dest_data_dir = + base::FilePath dest_data_dir = user_data_dir_.path().AppendASCII("cached_data_dir"); CHECK(!file_util::PathExists(dest_data_dir)); @@ -166,7 +166,7 @@ class PageCyclerCachedBrowserTest : public PageCyclerBrowserTest { // Initialize the file paths to use the UserDataDir's urls file, instead // of one to be written. - virtual void InitFilePaths(FilePath temp_path) OVERRIDE { + virtual void InitFilePaths(base::FilePath temp_path) OVERRIDE { urls_file_ = user_data_dir_.path().AppendASCII("cached_data_dir") .AppendASCII("urls"); errors_file_ = temp_path.AppendASCII("errors"); @@ -368,7 +368,7 @@ IN_PROC_BROWSER_TEST_F(PageCyclerCachedBrowserTest, MAYBE_URLNotInCache) { // scenario, and makes things faster than needlessly cycling through all the // other URLs. - FilePath new_urls_file = temp.path().AppendASCII("urls"); + base::FilePath new_urls_file = temp.path().AppendASCII("urls"); ASSERT_FALSE(file_util::PathExists(new_urls_file)); ASSERT_TRUE(file_util::WriteFile(new_urls_file, kCacheMissURL, diff --git a/chrome/browser/page_cycler/page_cycler_unittest.cc b/chrome/browser/page_cycler/page_cycler_unittest.cc index 015504c..b624152 100644 --- a/chrome/browser/page_cycler/page_cycler_unittest.cc +++ b/chrome/browser/page_cycler/page_cycler_unittest.cc @@ -40,15 +40,16 @@ const GURL kAboutURL = GURL(chrome::kAboutBlankURL); class MockPageCycler : public PageCycler { public: - MockPageCycler(Browser* browser, FilePath urls_file, FilePath errors_file) + MockPageCycler(Browser* browser, base::FilePath urls_file, + base::FilePath errors_file) : PageCycler(browser, urls_file) { set_errors_file(errors_file); } MockPageCycler(Browser* browser, - FilePath urls_file, - FilePath errors_file, - FilePath stats_file) + base::FilePath urls_file, + base::FilePath errors_file, + base::FilePath stats_file) : PageCycler(browser, urls_file) { set_stats_file(stats_file); set_errors_file(errors_file); @@ -117,7 +118,7 @@ class PageCyclerTest : public BrowserWithTestWindowTest { ASSERT_FALSE(browser()->tab_strip_model()->GetActiveWebContents() == NULL); } - void InitFilePaths(const FilePath& temp_path) { + void InitFilePaths(const base::FilePath& temp_path) { errors_file_ = temp_path.AppendASCII("errors_file"); stats_file_ = temp_path.AppendASCII("stats_file"); @@ -170,33 +171,33 @@ class PageCyclerTest : public BrowserWithTestWindowTest { return page_cycler_->urls_for_test(); } - FilePath stats_file() { + base::FilePath stats_file() { return stats_file_; } - FilePath errors_file() { + base::FilePath errors_file() { return errors_file_; } - FilePath urls_file() { + base::FilePath urls_file() { return test_data_dir_.AppendASCII("about_url"); } - FilePath test_data_dir() { + base::FilePath test_data_dir() { return test_data_dir_; } private: ObserverList<WebContentsObserver> observers_; scoped_refptr<MockPageCycler> page_cycler_; - FilePath test_data_dir_; - FilePath stats_file_; - FilePath errors_file_; - FilePath urls_file_; + base::FilePath test_data_dir_; + base::FilePath stats_file_; + base::FilePath errors_file_; + base::FilePath urls_file_; }; TEST_F(PageCyclerTest, FailProvisionalLoads) { - const FilePath errors_expected_file = + const base::FilePath errors_expected_file = test_data_dir().AppendASCII("errors_expected"); base::ScopedTempDir temp; @@ -290,7 +291,7 @@ TEST_F(PageCyclerTest, StatsFile) { } TEST_F(PageCyclerTest, KillBrowserAndAbort) { - const FilePath errors_expected_file = + const base::FilePath errors_expected_file = test_data_dir().AppendASCII("abort_expected"); base::ScopedTempDir temp; diff --git a/chrome/browser/parsers/metadata_parser_filebase.cc b/chrome/browser/parsers/metadata_parser_filebase.cc index 9105fe3..56207e1 100644 --- a/chrome/browser/parsers/metadata_parser_filebase.cc +++ b/chrome/browser/parsers/metadata_parser_filebase.cc @@ -8,7 +8,7 @@ #include "base/strings/string_number_conversions.h" #include "base/utf_string_conversions.h" -FileMetadataParser::FileMetadataParser(const FilePath& path) +FileMetadataParser::FileMetadataParser(const base::FilePath& path) : MetadataParser(path), path_(path) { } diff --git a/chrome/browser/parsers/metadata_parser_filebase.h b/chrome/browser/parsers/metadata_parser_filebase.h index 4309959..1a8fa7d 100644 --- a/chrome/browser/parsers/metadata_parser_filebase.h +++ b/chrome/browser/parsers/metadata_parser_filebase.h @@ -18,7 +18,7 @@ typedef base::hash_map<std::string, std::string> PropertyMap; // properties associated with files. class FileMetadataParser : public MetadataParser { public: - explicit FileMetadataParser(const FilePath& path); + explicit FileMetadataParser(const base::FilePath& path); virtual ~FileMetadataParser(); @@ -30,7 +30,7 @@ class FileMetadataParser : public MetadataParser { protected: PropertyMap properties_; - FilePath path_; + base::FilePath path_; private: DISALLOW_COPY_AND_ASSIGN(FileMetadataParser); diff --git a/chrome/browser/parsers/metadata_parser_filebase_unittest.cc b/chrome/browser/parsers/metadata_parser_filebase_unittest.cc index 99fc871..0dc6237 100644 --- a/chrome/browser/parsers/metadata_parser_filebase_unittest.cc +++ b/chrome/browser/parsers/metadata_parser_filebase_unittest.cc @@ -46,7 +46,7 @@ class FileMetaDataParserTest : public testing::Test { } base::ScopedTempDir temp_dir_; - FilePath test_file_; + base::FilePath test_file_; }; TEST_F(FileMetaDataParserTest, Parse) { diff --git a/chrome/browser/parsers/metadata_parser_jpeg.cc b/chrome/browser/parsers/metadata_parser_jpeg.cc index 3e78978..4018af5 100644 --- a/chrome/browser/parsers/metadata_parser_jpeg.cc +++ b/chrome/browser/parsers/metadata_parser_jpeg.cc @@ -4,7 +4,7 @@ #include "chrome/browser/parsers/metadata_parser_jpeg.h" -JpegMetadataParser::JpegMetadataParser(const FilePath& path) +JpegMetadataParser::JpegMetadataParser(const base::FilePath& path) : FileMetadataParser(path) {} bool JpegMetadataParser::Parse() { diff --git a/chrome/browser/parsers/metadata_parser_jpeg.h b/chrome/browser/parsers/metadata_parser_jpeg.h index d1a3fb0..fcb232c 100644 --- a/chrome/browser/parsers/metadata_parser_jpeg.h +++ b/chrome/browser/parsers/metadata_parser_jpeg.h @@ -9,7 +9,7 @@ class JpegMetadataParser : public FileMetadataParser { public: - explicit JpegMetadataParser(const FilePath& path); + explicit JpegMetadataParser(const base::FilePath& path); // Implementation of MetadataParser virtual bool Parse() OVERRIDE; diff --git a/chrome/browser/parsers/metadata_parser_jpeg_factory.cc b/chrome/browser/parsers/metadata_parser_jpeg_factory.cc index 5793984..16021c2 100644 --- a/chrome/browser/parsers/metadata_parser_jpeg_factory.cc +++ b/chrome/browser/parsers/metadata_parser_jpeg_factory.cc @@ -12,18 +12,19 @@ MetadataParserJpegFactory::MetadataParserJpegFactory() : MetadataParserFactory() { } -bool MetadataParserJpegFactory::CanParse(const FilePath& path, +bool MetadataParserJpegFactory::CanParse(const base::FilePath& path, char* bytes, int bytes_size) { #if defined(OS_WIN) - FilePath::StringType ext = UTF8ToWide(std::string(".jpg")); + base::FilePath::StringType ext = UTF8ToWide(std::string(".jpg")); #elif defined(OS_POSIX) - FilePath::StringType ext = ".jpg"; + base::FilePath::StringType ext = ".jpg"; #endif return path.MatchesExtension(ext); } -MetadataParser* MetadataParserJpegFactory::CreateParser(const FilePath& path) { +MetadataParser* MetadataParserJpegFactory::CreateParser( + const base::FilePath& path) { JpegMetadataParser* parser; parser = new JpegMetadataParser(path); return parser; diff --git a/chrome/browser/parsers/metadata_parser_manager.cc b/chrome/browser/parsers/metadata_parser_manager.cc index 8336d23..1b10f98 100644 --- a/chrome/browser/parsers/metadata_parser_manager.cc +++ b/chrome/browser/parsers/metadata_parser_manager.cc @@ -34,8 +34,8 @@ MetadataParserManager::MetadataParserManager() { MetadataParserManager::~MetadataParserManager() {} -MetadataParser* MetadataParserManager::GetParserForFile(const FilePath& path) { - +MetadataParser* MetadataParserManager::GetParserForFile( + const base::FilePath& path) { char buffer[kAmountToRead]; int amount_read = 0; DLOG(ERROR) << path.value(); diff --git a/chrome/browser/password_manager/login_database.cc b/chrome/browser/password_manager/login_database.cc index a2f4d03..078c417 100644 --- a/chrome/browser/password_manager/login_database.cc +++ b/chrome/browser/password_manager/login_database.cc @@ -48,7 +48,7 @@ LoginDatabase::LoginDatabase() { LoginDatabase::~LoginDatabase() { } -bool LoginDatabase::Init(const FilePath& db_path) { +bool LoginDatabase::Init(const base::FilePath& db_path) { // Set pragmas for a small, private database (based on WebDatabase). db_.set_page_size(2048); db_.set_cache_size(32); diff --git a/chrome/browser/password_manager/login_database.h b/chrome/browser/password_manager/login_database.h index e37b966..b5e38ef 100644 --- a/chrome/browser/password_manager/login_database.h +++ b/chrome/browser/password_manager/login_database.h @@ -24,7 +24,7 @@ class LoginDatabase { // Initialize the database with an sqlite file at the given path. // If false is returned, no other method should be called. - bool Init(const FilePath& db_path); + bool Init(const base::FilePath& db_path); // Reports usage metrics to UMA. void ReportMetrics(); @@ -95,7 +95,7 @@ class LoginDatabase { bool GetAllLoginsWithBlacklistSetting( bool blacklisted, std::vector<content::PasswordForm*>* forms) const; - FilePath db_path_; + base::FilePath db_path_; mutable sql::Connection db_; sql::MetaTable meta_table_; diff --git a/chrome/browser/password_manager/login_database_unittest.cc b/chrome/browser/password_manager/login_database_unittest.cc index c8d960a..4b53ac1 100644 --- a/chrome/browser/password_manager/login_database_unittest.cc +++ b/chrome/browser/password_manager/login_database_unittest.cc @@ -24,7 +24,7 @@ class LoginDatabaseTest : public testing::Test { file_ = temp_dir_.path().AppendASCII("TestMetadataStoreMacDatabase"); } - FilePath file_; + base::FilePath file_; base::ScopedTempDir temp_dir_; }; diff --git a/chrome/browser/password_manager/password_store_factory.cc b/chrome/browser/password_manager/password_store_factory.cc index d2da9db..e69a12e 100644 --- a/chrome/browser/password_manager/password_store_factory.cc +++ b/chrome/browser/password_manager/password_store_factory.cc @@ -96,7 +96,7 @@ LocalProfileId PasswordStoreFactory::GetLocalProfileId( scoped_refptr<RefcountedProfileKeyedService> PasswordStoreFactory::BuildServiceInstanceFor(Profile* profile) const { scoped_refptr<PasswordStore> ps; - FilePath login_db_file_path = profile->GetPath(); + base::FilePath login_db_file_path = profile->GetPath(); login_db_file_path = login_db_file_path.Append(chrome::kLoginDataFileName); LoginDatabase* login_db = new LoginDatabase(); { diff --git a/chrome/browser/password_manager/password_store_mac_unittest.cc b/chrome/browser/password_manager/password_store_mac_unittest.cc index d48d9ef..d32d63b 100644 --- a/chrome/browser/password_manager/password_store_mac_unittest.cc +++ b/chrome/browser/password_manager/password_store_mac_unittest.cc @@ -906,7 +906,7 @@ class PasswordStoreMacTest : public testing::Test { virtual void SetUp() { login_db_ = new LoginDatabase(); ASSERT_TRUE(db_dir_.CreateUniqueTempDir()); - FilePath db_file = db_dir_.path().AppendASCII("login.db"); + base::FilePath db_file = db_dir_.path().AppendASCII("login.db"); ASSERT_TRUE(login_db_->Init(db_file)); keychain_ = new MockAppleKeychain(); diff --git a/chrome/browser/password_manager/password_store_x_unittest.cc b/chrome/browser/password_manager/password_store_x_unittest.cc index f07555f..95ae367 100644 --- a/chrome/browser/password_manager/password_store_x_unittest.cc +++ b/chrome/browser/password_manager/password_store_x_unittest.cc @@ -418,7 +418,7 @@ TEST_P(PasswordStoreXTest, NativeMigration) { // Get the initial size of the login DB file, before we populate it. // This will be used later to make sure it gets back to this size. - const FilePath login_db_file = temp_dir_.path().Append("login_test"); + const base::FilePath login_db_file = temp_dir_.path().Append("login_test"); base::PlatformFileInfo db_file_start_info; ASSERT_TRUE(file_util::GetFileInfo(login_db_file, &db_file_start_info)); diff --git a/chrome/browser/pepper_broker_infobar_delegate.cc b/chrome/browser/pepper_broker_infobar_delegate.cc index 8a22734..25986b9 100644 --- a/chrome/browser/pepper_broker_infobar_delegate.cc +++ b/chrome/browser/pepper_broker_infobar_delegate.cc @@ -35,7 +35,7 @@ using content::WebContents; void PepperBrokerInfoBarDelegate::Create( WebContents* web_contents, const GURL& url, - const FilePath& plugin_path, + const base::FilePath& plugin_path, const base::Callback<void(bool)>& callback) { Profile* profile = Profile::FromBrowserContext(web_contents->GetBrowserContext()); @@ -147,7 +147,7 @@ gfx::Image* PepperBrokerInfoBarDelegate::GetIcon() const { PepperBrokerInfoBarDelegate::PepperBrokerInfoBarDelegate( InfoBarService* infobar_service, const GURL& url, - const FilePath& plugin_path, + const base::FilePath& plugin_path, const std::string& languages, HostContentSettingsMap* content_settings, const base::Callback<void(bool)>& callback) diff --git a/chrome/browser/pepper_broker_infobar_delegate.h b/chrome/browser/pepper_broker_infobar_delegate.h index d2aeee6..910544f 100644 --- a/chrome/browser/pepper_broker_infobar_delegate.h +++ b/chrome/browser/pepper_broker_infobar_delegate.h @@ -28,7 +28,7 @@ class PepperBrokerInfoBarDelegate : public ConfirmInfoBarDelegate { // |web_contents|. static void Create(content::WebContents* web_contents, const GURL& url, - const FilePath& plugin_path, + const base::FilePath& plugin_path, const base::Callback<void(bool)>& callback); // ConfirmInfoBarDelegate: @@ -45,7 +45,7 @@ class PepperBrokerInfoBarDelegate : public ConfirmInfoBarDelegate { PepperBrokerInfoBarDelegate( InfoBarService* infobar_service, const GURL& url, - const FilePath& plugin_path, + const base::FilePath& plugin_path, const std::string& languages, HostContentSettingsMap* content_settings, const base::Callback<void(bool)>& callback); @@ -54,7 +54,7 @@ class PepperBrokerInfoBarDelegate : public ConfirmInfoBarDelegate { void DispatchCallback(bool result); const GURL url_; - const FilePath plugin_path_; + const base::FilePath plugin_path_; const std::string languages_; HostContentSettingsMap* content_settings_; base::Callback<void(bool)> callback_; diff --git a/chrome/browser/pepper_flash_settings_manager.cc b/chrome/browser/pepper_flash_settings_manager.cc index 3f78afe..6964693 100644 --- a/chrome/browser/pepper_flash_settings_manager.cc +++ b/chrome/browser/pepper_flash_settings_manager.cc @@ -177,7 +177,7 @@ class PepperFlashSettingsManager::Core base::WeakPtr<PepperFlashSettingsManager> manager_; // Used only on the I/O thread. - FilePath plugin_data_path_; + base::FilePath plugin_data_path_; // The channel is NULL until we have opened a connection to the broker // process. Used only on the I/O thread. @@ -198,7 +198,7 @@ class PepperFlashSettingsManager::Core // Path for the current profile. Must be retrieved on the UI thread from the // browser context when we start so we can use it later on the I/O thread. - FilePath browser_context_path_; + base::FilePath browser_context_path_; scoped_refptr<PluginPrefs> plugin_prefs_; }; @@ -401,7 +401,7 @@ void PepperFlashSettingsManager::Core::InitializeOnIOThread() { return; } - FilePath profile_path = + base::FilePath profile_path = browser_context_path_.Append(content::kPepperDataDirname); #if defined(OS_WIN) plugin_data_path_ = profile_path.Append(plugin_info.name); diff --git a/chrome/browser/performance_monitor/database.cc b/chrome/browser/performance_monitor/database.cc index ed1c504..67095a0 100644 --- a/chrome/browser/performance_monitor/database.cc +++ b/chrome/browser/performance_monitor/database.cc @@ -84,7 +84,7 @@ base::Time Database::SystemClock::GetTime() { } // Static -scoped_ptr<Database> Database::Create(FilePath path) { +scoped_ptr<Database> Database::Create(base::FilePath path) { CHECK(!content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); if (path.empty()) { CHECK(PathService::Get(chrome::DIR_USER_DATA, &path)); @@ -416,7 +416,7 @@ Database::MetricVectorMap Database::GetStatsForMetricByActivity( return results; } -Database::Database(const FilePath& path) +Database::Database(const base::FilePath& path) : key_builder_(new KeyBuilder()), path_(path), read_options_(leveldb::ReadOptions()), diff --git a/chrome/browser/performance_monitor/database.h b/chrome/browser/performance_monitor/database.h index ea005e9..27db256 100644 --- a/chrome/browser/performance_monitor/database.h +++ b/chrome/browser/performance_monitor/database.h @@ -117,7 +117,7 @@ class Database { virtual ~Database(); - static scoped_ptr<Database> Create(FilePath path); + static scoped_ptr<Database> Create(base::FilePath path); // A "state" value is anything that can only have one value at a time, and // usually describes the state of the browser eg. version. @@ -229,7 +229,7 @@ class Database { std::vector<TimeRange> GetActiveIntervals(const base::Time& start, const base::Time& end); - FilePath path() const { return path_; } + base::FilePath path() const { return path_; } void set_clock(scoped_ptr<Clock> clock) { clock_ = clock.Pass(); @@ -249,7 +249,7 @@ class Database { virtual base::Time GetTime() OVERRIDE; }; - explicit Database(const FilePath& path); + explicit Database(const base::FilePath& path); void InitDBs(); @@ -278,7 +278,7 @@ class Database { MaxValueMap max_value_map_; // The directory where all the databases will reside. - FilePath path_; + base::FilePath path_; // The key for the beginning of the active interval. std::string start_time_key_; diff --git a/chrome/browser/performance_monitor/performance_monitor.cc b/chrome/browser/performance_monitor/performance_monitor.cc index dce9b53..3219fa7 100644 --- a/chrome/browser/performance_monitor/performance_monitor.cc +++ b/chrome/browser/performance_monitor/performance_monitor.cc @@ -98,7 +98,7 @@ PerformanceMonitor::PerformanceMonitor() : database_(NULL), PerformanceMonitor::~PerformanceMonitor() { } -bool PerformanceMonitor::SetDatabasePath(const FilePath& path) { +bool PerformanceMonitor::SetDatabasePath(const base::FilePath& path) { if (!database_.get()) { database_path_ = path; return true; diff --git a/chrome/browser/performance_monitor/performance_monitor.h b/chrome/browser/performance_monitor/performance_monitor.h index c6f56c9..0da96d3 100644 --- a/chrome/browser/performance_monitor/performance_monitor.h +++ b/chrome/browser/performance_monitor/performance_monitor.h @@ -65,7 +65,7 @@ class PerformanceMonitor : public content::NotificationObserver { // PerformanceMonitor. Returns true on success, false on failure (failure // likely indicates that PerformanceMonitor has already been started at the // time of the call). - bool SetDatabasePath(const FilePath& path); + bool SetDatabasePath(const base::FilePath& path); // Returns the current PerformanceMonitor instance if one exists; otherwise // constructs a new PerformanceMonitor. @@ -88,7 +88,7 @@ class PerformanceMonitor : public content::NotificationObserver { const content::NotificationDetails& details) OVERRIDE; Database* database() { return database_.get(); } - FilePath database_path() { return database_path_; } + base::FilePath database_path() { return database_path_; } static bool initialized() { return initialized_; } private: @@ -185,7 +185,7 @@ class PerformanceMonitor : public content::NotificationObserver { // The location at which the database files are stored; if empty, the database // will default to '<user_data_dir>/performance_monitor_dbs'. - FilePath database_path_; + base::FilePath database_path_; scoped_ptr<Database> database_; diff --git a/chrome/browser/performance_monitor/performance_monitor_browsertest.cc b/chrome/browser/performance_monitor/performance_monitor_browsertest.cc index 1ac03a3..65943e9 100644 --- a/chrome/browser/performance_monitor/performance_monitor_browsertest.cc +++ b/chrome/browser/performance_monitor/performance_monitor_browsertest.cc @@ -275,7 +275,7 @@ class PerformanceMonitorUncleanExitBrowserTest : public PerformanceMonitorBrowserTest { public: virtual bool SetUpUserDataDirectory() OVERRIDE { - FilePath user_data_directory; + base::FilePath user_data_directory; PathService::Get(chrome::DIR_USER_DATA, &user_data_directory); // On CrOS, if we are "logged in" with the --login-profile switch, @@ -294,17 +294,17 @@ class PerformanceMonitorUncleanExitBrowserTest first_profile_name_ = chrome::kInitialProfile; #endif - FilePath first_profile = + base::FilePath first_profile = user_data_directory.AppendASCII(first_profile_name_); CHECK(file_util::CreateDirectory(first_profile)); - FilePath stock_prefs_file; + base::FilePath stock_prefs_file; PathService::Get(chrome::DIR_TEST_DATA, &stock_prefs_file); stock_prefs_file = stock_prefs_file.AppendASCII("performance_monitor") .AppendASCII("unclean_exit_prefs"); CHECK(file_util::PathExists(stock_prefs_file)); - FilePath first_profile_prefs_file = + base::FilePath first_profile_prefs_file = first_profile.Append(chrome::kPreferencesFilename); CHECK(file_util::CopyFile(stock_prefs_file, first_profile_prefs_file)); CHECK(file_util::PathExists(first_profile_prefs_file)); @@ -313,11 +313,11 @@ class PerformanceMonitorUncleanExitBrowserTest std::string(chrome::kMultiProfileDirPrefix) .append(base::IntToString(1)); - FilePath second_profile = + base::FilePath second_profile = user_data_directory.AppendASCII(second_profile_name_); CHECK(file_util::CreateDirectory(second_profile)); - FilePath second_profile_prefs_file = + base::FilePath second_profile_prefs_file = second_profile.Append(chrome::kPreferencesFilename); CHECK(file_util::CopyFile(stock_prefs_file, second_profile_prefs_file)); CHECK(file_util::PathExists(second_profile_prefs_file)); @@ -381,7 +381,7 @@ class PerformanceMonitorSessionRestoreBrowserTest // Test that PerformanceMonitor will correctly record an extension installation // event. IN_PROC_BROWSER_TEST_F(PerformanceMonitorBrowserTest, InstallExtensionEvent) { - FilePath extension_path; + base::FilePath extension_path; PathService::Get(chrome::DIR_TEST_DATA, &extension_path); extension_path = extension_path.AppendASCII("performance_monitor") .AppendASCII("extensions") @@ -405,7 +405,7 @@ IN_PROC_BROWSER_TEST_F(PerformanceMonitorBrowserTest, DISABLED_DisableAndEnableExtensionEvent) { const int kNumEvents = 3; - FilePath extension_path; + base::FilePath extension_path; PathService::Get(chrome::DIR_TEST_DATA, &extension_path); extension_path = extension_path.AppendASCII("performance_monitor") .AppendASCII("extensions") @@ -437,23 +437,23 @@ IN_PROC_BROWSER_TEST_F(PerformanceMonitorBrowserTest, UpdateExtensionEvent) { base::ScopedTempDir temp_dir; ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); - FilePath test_data_dir; + base::FilePath test_data_dir; PathService::Get(chrome::DIR_TEST_DATA, &test_data_dir); test_data_dir = test_data_dir.AppendASCII("performance_monitor") .AppendASCII("extensions"); // We need two versions of the same extension. - FilePath pem_path = test_data_dir.AppendASCII("simple_extension.pem"); - FilePath path_v1_ = PackExtensionWithOptions( + base::FilePath pem_path = test_data_dir.AppendASCII("simple_extension.pem"); + base::FilePath path_v1_ = PackExtensionWithOptions( test_data_dir.AppendASCII("simple_extension_v1"), temp_dir.path().AppendASCII("simple_extension1.crx"), pem_path, - FilePath()); - FilePath path_v2_ = PackExtensionWithOptions( + base::FilePath()); + base::FilePath path_v2_ = PackExtensionWithOptions( test_data_dir.AppendASCII("simple_extension_v2"), temp_dir.path().AppendASCII("simple_extension2.crx"), pem_path, - FilePath()); + base::FilePath()); const extensions::Extension* extension = InstallExtension(path_v1_, 1); @@ -496,7 +496,7 @@ IN_PROC_BROWSER_TEST_F(PerformanceMonitorBrowserTest, UpdateExtensionEvent) { IN_PROC_BROWSER_TEST_F(PerformanceMonitorBrowserTest, UninstallExtensionEvent) { const int kNumEvents = 2; - FilePath extension_path; + base::FilePath extension_path; PathService::Get(chrome::DIR_TEST_DATA, &extension_path); extension_path = extension_path.AppendASCII("performance_monitor") .AppendASCII("extensions") @@ -572,10 +572,10 @@ IN_PROC_BROWSER_TEST_F(PerformanceMonitorBrowserTest, // Open new tabs to incur CPU usage. for (int i = 0; i < 10; ++i) { chrome::NavigateParams params( - browser(), - ui_test_utils::GetTestUrl(FilePath(FilePath::kCurrentDirectory), - FilePath(FILE_PATH_LITERAL("title1.html"))), - content::PAGE_TRANSITION_LINK); + browser(), ui_test_utils::GetTestUrl( + base::FilePath(base::FilePath::kCurrentDirectory), + base::FilePath(FILE_PATH_LITERAL("title1.html"))), + content::PAGE_TRANSITION_LINK); params.disposition = NEW_BACKGROUND_TAB; ui_test_utils::NavigateToURL(¶ms); } @@ -661,7 +661,7 @@ IN_PROC_BROWSER_TEST_F(PerformanceMonitorUncleanExitBrowserTest, IN_PROC_BROWSER_TEST_F(PerformanceMonitorUncleanExitBrowserTest, TwoProfileUncleanExit) { - FilePath second_profile_path; + base::FilePath second_profile_path; PathService::Get(chrome::DIR_USER_DATA, &second_profile_path); second_profile_path = second_profile_path.AppendASCII(second_profile_name_); @@ -714,9 +714,9 @@ IN_PROC_BROWSER_TEST_F(PerformanceMonitorBrowserTest, StartupTime) { IN_PROC_BROWSER_TEST_F(PerformanceMonitorSessionRestoreBrowserTest, StartupWithSessionRestore) { ui_test_utils::NavigateToURL( - browser(), - ui_test_utils::GetTestUrl(FilePath(FilePath::kCurrentDirectory), - FilePath(FILE_PATH_LITERAL("title1.html")))); + browser(), ui_test_utils::GetTestUrl( + base::FilePath(base::FilePath::kCurrentDirectory), + base::FilePath(FILE_PATH_LITERAL("title1.html")))); QuitBrowserAndRestore(browser(), 1); @@ -733,14 +733,14 @@ IN_PROC_BROWSER_TEST_F(PerformanceMonitorBrowserTest, PageLoadTime) { const base::TimeDelta kMaxLoadTime = base::TimeDelta::FromSeconds(30); ui_test_utils::NavigateToURL( - browser(), - ui_test_utils::GetTestUrl(FilePath(FilePath::kCurrentDirectory), - FilePath(FILE_PATH_LITERAL("title1.html")))); + browser(), ui_test_utils::GetTestUrl( + base::FilePath(base::FilePath::kCurrentDirectory), + base::FilePath(FILE_PATH_LITERAL("title1.html")))); ui_test_utils::NavigateToURL( - browser(), - ui_test_utils::GetTestUrl(FilePath(FilePath::kCurrentDirectory), - FilePath(FILE_PATH_LITERAL("title1.html")))); + browser(), ui_test_utils::GetTestUrl( + base::FilePath(base::FilePath::kCurrentDirectory), + base::FilePath(FILE_PATH_LITERAL("title1.html")))); Database::MetricVector metrics = GetStats(METRIC_PAGE_LOAD_TIME); @@ -750,7 +750,7 @@ IN_PROC_BROWSER_TEST_F(PerformanceMonitorBrowserTest, PageLoadTime) { } IN_PROC_BROWSER_TEST_F(PerformanceMonitorBrowserTest, NetworkBytesRead) { - FilePath test_dir; + base::FilePath test_dir; PathService::Get(chrome::DIR_TEST_DATA, &test_dir); int64 page1_size = 0; diff --git a/chrome/browser/platform_util_chromeos.cc b/chrome/browser/platform_util_chromeos.cc index 2821510..6f0974a 100644 --- a/chrome/browser/platform_util_chromeos.cc +++ b/chrome/browser/platform_util_chromeos.cc @@ -36,12 +36,12 @@ void OpenURL(const std::string& url) { namespace platform_util { -void ShowItemInFolder(const FilePath& full_path) { +void ShowItemInFolder(const base::FilePath& full_path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); file_manager_util::ShowFileInFolder(full_path); } -void OpenItem(const FilePath& full_path) { +void OpenItem(const base::FilePath& full_path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); file_manager_util::ViewItem(full_path); } diff --git a/chrome/browser/platform_util_linux.cc b/chrome/browser/platform_util_linux.cc index 2bc84cb..4afe8fd 100644 --- a/chrome/browser/platform_util_linux.cc +++ b/chrome/browser/platform_util_linux.cc @@ -54,8 +54,8 @@ void XDGEmail(const std::string& email) { // TODO(estade): It would be nice to be able to select the file in the file // manager, but that probably requires extending xdg-open. For now just // show the folder. -void ShowItemInFolderOnFileThread(const FilePath& full_path) { - FilePath dir = full_path.DirName(); +void ShowItemInFolderOnFileThread(const base::FilePath& full_path) { + base::FilePath dir = full_path.DirName(); if (!file_util::DirectoryExists(dir)) return; @@ -66,13 +66,13 @@ void ShowItemInFolderOnFileThread(const FilePath& full_path) { namespace platform_util { -void ShowItemInFolder(const FilePath& full_path) { +void ShowItemInFolder(const base::FilePath& full_path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, base::Bind(&ShowItemInFolderOnFileThread, full_path)); } -void OpenItem(const FilePath& full_path) { +void OpenItem(const base::FilePath& full_path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, base::Bind(&XDGOpen, full_path.value())); diff --git a/chrome/browser/platform_util_mac.mm b/chrome/browser/platform_util_mac.mm index fa582d5..06ad9ac 100644 --- a/chrome/browser/platform_util_mac.mm +++ b/chrome/browser/platform_util_mac.mm @@ -20,7 +20,7 @@ namespace platform_util { -void ShowItemInFolder(const FilePath& full_path) { +void ShowItemInFolder(const base::FilePath& full_path) { DCHECK([NSThread isMainThread]); NSString* path_string = base::SysUTF8ToNSString(full_path.value()); if (!path_string || ![[NSWorkspace sharedWorkspace] selectFile:path_string @@ -35,7 +35,7 @@ void ShowItemInFolder(const FilePath& full_path) { // 2. Silent no-op for unassociated file types: http://crbug.com/50263 // Instead, an AppleEvent is constructed to tell the Finder to open the // document. -void OpenItem(const FilePath& full_path) { +void OpenItem(const base::FilePath& full_path) { DCHECK([NSThread isMainThread]); NSString* path_string = base::SysUTF8ToNSString(full_path.value()); if (!path_string) diff --git a/chrome/browser/platform_util_win.cc b/chrome/browser/platform_util_win.cc index a5cfc50..71b228f 100644 --- a/chrome/browser/platform_util_win.cc +++ b/chrome/browser/platform_util_win.cc @@ -29,9 +29,9 @@ using content::BrowserThread; namespace { -void ShowItemInFolderOnFileThread(const FilePath& full_path) { +void ShowItemInFolderOnFileThread(const base::FilePath& full_path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); - FilePath dir = full_path.DirName(); + base::FilePath dir = full_path.DirName(); // ParseDisplayName will fail if the directory is "C:", it must be "C:\\". if (dir.value() == L"" || !file_util::EnsureEndsWithSeparator(&dir)) return; @@ -134,13 +134,13 @@ bool ValidateShellCommandForScheme(const std::string& scheme) { namespace platform_util { -void ShowItemInFolder(const FilePath& full_path) { +void ShowItemInFolder(const base::FilePath& full_path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, base::Bind(&ShowItemInFolderOnFileThread, full_path)); } -void OpenItem(const FilePath& full_path) { +void OpenItem(const base::FilePath& full_path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); BrowserThread::PostTask( BrowserThread::FILE, FROM_HERE, diff --git a/chrome/browser/plugins/chrome_plugin_service_filter.cc b/chrome/browser/plugins/chrome_plugin_service_filter.cc index 072269f..15b896f 100644 --- a/chrome/browser/plugins/chrome_plugin_service_filter.cc +++ b/chrome/browser/plugins/chrome_plugin_service_filter.cc @@ -54,7 +54,7 @@ void ChromePluginServiceFilter::OverridePluginForTab( } void ChromePluginServiceFilter::RestrictPluginToProfileAndOrigin( - const FilePath& plugin_path, + const base::FilePath& plugin_path, Profile* profile, const GURL& origin) { base::AutoLock auto_lock(lock_); @@ -64,7 +64,7 @@ void ChromePluginServiceFilter::RestrictPluginToProfileAndOrigin( } void ChromePluginServiceFilter::UnrestrictPlugin( - const FilePath& plugin_path) { + const base::FilePath& plugin_path) { base::AutoLock auto_lock(lock_); restricted_plugins_.erase(plugin_path); } @@ -123,7 +123,7 @@ bool ChromePluginServiceFilter::IsPluginAvailable( } bool ChromePluginServiceFilter::CanLoadPlugin(int render_process_id, - const FilePath& path) { + const base::FilePath& path) { // The browser itself sometimes loads plug-ins to e.g. clear plug-in data. // We always grant the browser permission. if (!render_process_id) @@ -136,7 +136,7 @@ bool ChromePluginServiceFilter::CanLoadPlugin(int render_process_id, if (details->authorized_plugins.find(path) == details->authorized_plugins.end() && - details->authorized_plugins.find(FilePath()) == + details->authorized_plugins.find(base::FilePath()) == details->authorized_plugins.end()) { return false; } @@ -144,15 +144,16 @@ bool ChromePluginServiceFilter::CanLoadPlugin(int render_process_id, return true; } -void ChromePluginServiceFilter::AuthorizePlugin(int render_process_id, - const FilePath& plugin_path) { +void ChromePluginServiceFilter::AuthorizePlugin( + int render_process_id, + const base::FilePath& plugin_path) { base::AutoLock auto_lock(lock_); ProcessDetails* details = GetOrRegisterProcess(render_process_id); details->authorized_plugins.insert(plugin_path); } void ChromePluginServiceFilter::AuthorizeAllPlugins(int render_process_id) { - AuthorizePlugin(render_process_id, FilePath()); + AuthorizePlugin(render_process_id, base::FilePath()); } ChromePluginServiceFilter::ChromePluginServiceFilter() { diff --git a/chrome/browser/plugins/chrome_plugin_service_filter.h b/chrome/browser/plugins/chrome_plugin_service_filter.h index 6c69b9b..bd0ffd4 100644 --- a/chrome/browser/plugins/chrome_plugin_service_filter.h +++ b/chrome/browser/plugins/chrome_plugin_service_filter.h @@ -44,15 +44,16 @@ class ChromePluginServiceFilter : public content::PluginServiceFilter, // Restricts the given plugin to the given profile and origin of the given // URL. - void RestrictPluginToProfileAndOrigin(const FilePath& plugin_path, + void RestrictPluginToProfileAndOrigin(const base::FilePath& plugin_path, Profile* profile, const GURL& url); // Lifts a restriction on a plug-in. - void UnrestrictPlugin(const FilePath& plugin_path); + void UnrestrictPlugin(const base::FilePath& plugin_path); // Authorizes a given plug-in for a given process. - void AuthorizePlugin(int render_process_id, const FilePath& plugin_path); + void AuthorizePlugin(int render_process_id, + const base::FilePath& plugin_path); // Authorizes all plug-ins for a given process. void AuthorizeAllPlugins(int render_process_id); @@ -70,7 +71,7 @@ class ChromePluginServiceFilter : public content::PluginServiceFilter, // (render_process_id == 0) virtual bool CanLoadPlugin( int render_process_id, - const FilePath& path) OVERRIDE; + const base::FilePath& path) OVERRIDE; private: friend struct DefaultSingletonTraits<ChromePluginServiceFilter>; @@ -89,7 +90,7 @@ class ChromePluginServiceFilter : public content::PluginServiceFilter, ~ProcessDetails(); std::vector<OverriddenPlugin> overridden_plugins; - std::set<FilePath> authorized_plugins; + std::set<base::FilePath> authorized_plugins; }; ChromePluginServiceFilter(); @@ -108,7 +109,8 @@ class ChromePluginServiceFilter : public content::PluginServiceFilter, base::Lock lock_; // Guards access to member variables. // Map of plugin paths to the origin they are restricted to. typedef std::pair<const void*, GURL> RestrictedPluginPair; - typedef base::hash_map<FilePath, RestrictedPluginPair> RestrictedPluginMap; + typedef base::hash_map<base::FilePath, + RestrictedPluginPair> RestrictedPluginMap; RestrictedPluginMap restricted_plugins_; typedef std::map<const void*, scoped_refptr<PluginPrefs> > ResourceContextMap; ResourceContextMap resource_context_map_; diff --git a/chrome/browser/plugins/plugin_finder.cc b/chrome/browser/plugins/plugin_finder.cc index d128f8d..fcfc6bf 100644 --- a/chrome/browser/plugins/plugin_finder.cc +++ b/chrome/browser/plugins/plugin_finder.cc @@ -49,7 +49,8 @@ static string16 GetGroupName(const webkit::WebPluginInfo& plugin) { if (!plugin.name.empty()) return plugin.name; - FilePath::StringType path = plugin.path.BaseName().RemoveExtension().value(); + base::FilePath::StringType path = + plugin.path.BaseName().RemoveExtension().value(); #if defined(OS_POSIX) return UTF8ToUTF16(path); #elif defined(OS_WIN) diff --git a/chrome/browser/plugins/plugin_info_message_filter.cc b/chrome/browser/plugins/plugin_info_message_filter.cc index 6b77bc2..0c653a7 100644 --- a/chrome/browser/plugins/plugin_info_message_filter.cc +++ b/chrome/browser/plugins/plugin_info_message_filter.cc @@ -295,7 +295,7 @@ void PluginInfoMessageFilter::Context::GetPluginContentSetting( void PluginInfoMessageFilter::Context::MaybeGrantAccess( const ChromeViewHostMsg_GetPluginInfo_Status& status, - const FilePath& path) const { + const base::FilePath& path) const { if (status.value == ChromeViewHostMsg_GetPluginInfo_Status::kAllowed || status.value == ChromeViewHostMsg_GetPluginInfo_Status::kClickToPlay) { ChromePluginServiceFilter::GetInstance()->AuthorizePlugin( diff --git a/chrome/browser/plugins/plugin_info_message_filter.h b/chrome/browser/plugins/plugin_info_message_filter.h index 7e5d866..12c97ac 100644 --- a/chrome/browser/plugins/plugin_info_message_filter.h +++ b/chrome/browser/plugins/plugin_info_message_filter.h @@ -64,7 +64,7 @@ class PluginInfoMessageFilter : public content::BrowserMessageFilter { ContentSetting* setting, bool* is_default) const; void MaybeGrantAccess(const ChromeViewHostMsg_GetPluginInfo_Status& status, - const FilePath& path) const; + const base::FilePath& path) const; private: int render_process_id_; diff --git a/chrome/browser/plugins/plugin_installer_unittest.cc b/chrome/browser/plugins/plugin_installer_unittest.cc index 1831212..cef02cd 100644 --- a/chrome/browser/plugins/plugin_installer_unittest.cc +++ b/chrome/browser/plugins/plugin_installer_unittest.cc @@ -15,7 +15,7 @@ namespace { PluginInstaller::SecurityStatus GetSecurityStatus(PluginInstaller* installer, const char* version) { WebPluginInfo plugin(ASCIIToUTF16("Foo plug-in"), - FilePath(FILE_PATH_LITERAL("/tmp/plugin.so")), + base::FilePath(FILE_PATH_LITERAL("/tmp/plugin.so")), ASCIIToUTF16(version), ASCIIToUTF16("Foo plug-in.")); return installer->GetSecurityStatus(plugin); diff --git a/chrome/browser/plugins/plugin_metadata_unittest.cc b/chrome/browser/plugins/plugin_metadata_unittest.cc index d168567..3e3bf99 100644 --- a/chrome/browser/plugins/plugin_metadata_unittest.cc +++ b/chrome/browser/plugins/plugin_metadata_unittest.cc @@ -16,7 +16,7 @@ PluginMetadata::SecurityStatus GetSecurityStatus( PluginMetadata* plugin_metadata, const char* version) { WebPluginInfo plugin(ASCIIToUTF16("Foo plug-in"), - FilePath(FILE_PATH_LITERAL("/tmp/plugin.so")), + base::FilePath(FILE_PATH_LITERAL("/tmp/plugin.so")), ASCIIToUTF16(version), ASCIIToUTF16("Foo plug-in.")); return plugin_metadata->GetSecurityStatus(plugin); diff --git a/chrome/browser/plugins/plugin_observer.cc b/chrome/browser/plugins/plugin_observer.cc index 18a902b..828d3b8 100644 --- a/chrome/browser/plugins/plugin_observer.cc +++ b/chrome/browser/plugins/plugin_observer.cc @@ -183,7 +183,7 @@ PluginObserver::~PluginObserver() { #endif } -void PluginObserver::PluginCrashed(const FilePath& plugin_path, +void PluginObserver::PluginCrashed(const base::FilePath& plugin_path, base::ProcessId plugin_pid) { DCHECK(!plugin_path.value().empty()); @@ -351,7 +351,7 @@ void PluginObserver::OnOpenAboutPlugins() { NEW_FOREGROUND_TAB, content::PAGE_TRANSITION_AUTO_BOOKMARK, false)); } -void PluginObserver::OnCouldNotLoadPlugin(const FilePath& plugin_path) { +void PluginObserver::OnCouldNotLoadPlugin(const base::FilePath& plugin_path) { g_browser_process->metrics_service()->LogPluginLoadingError(plugin_path); string16 plugin_name = PluginService::GetInstance()->GetPluginDisplayNameByPath(plugin_path); diff --git a/chrome/browser/plugins/plugin_observer.h b/chrome/browser/plugins/plugin_observer.h index 8fde0ad..4264d62 100644 --- a/chrome/browser/plugins/plugin_observer.h +++ b/chrome/browser/plugins/plugin_observer.h @@ -34,7 +34,7 @@ class PluginObserver : public content::WebContentsObserver, virtual ~PluginObserver(); // content::WebContentsObserver implementation. - virtual void PluginCrashed(const FilePath& plugin_path, + virtual void PluginCrashed(const base::FilePath& plugin_path, base::ProcessId plugin_pid) OVERRIDE; virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; @@ -60,7 +60,7 @@ class PluginObserver : public content::WebContentsObserver, void OnRemovePluginPlaceholderHost(int placeholder_id); #endif void OnOpenAboutPlugins(); - void OnCouldNotLoadPlugin(const FilePath& plugin_path); + void OnCouldNotLoadPlugin(const base::FilePath& plugin_path); void OnNPAPINotSupported(const std::string& identifier); base::WeakPtrFactory<PluginObserver> weak_ptr_factory_; diff --git a/chrome/browser/plugins/plugin_prefs.cc b/chrome/browser/plugins/plugin_prefs.cc index c882da9..33f218b 100644 --- a/chrome/browser/plugins/plugin_prefs.cc +++ b/chrome/browser/plugins/plugin_prefs.cc @@ -51,10 +51,10 @@ PluginPrefs::PluginState::PluginState() { PluginPrefs::PluginState::~PluginState() { } -bool PluginPrefs::PluginState::Get(const FilePath& plugin, +bool PluginPrefs::PluginState::Get(const base::FilePath& plugin, bool* enabled) const { - FilePath key = ConvertMapKey(plugin); - std::map<FilePath, bool>::const_iterator iter = state_.find(key); + base::FilePath key = ConvertMapKey(plugin); + std::map<base::FilePath, bool>::const_iterator iter = state_.find(key); if (iter != state_.end()) { *enabled = iter->second; return true; @@ -62,18 +62,19 @@ bool PluginPrefs::PluginState::Get(const FilePath& plugin, return false; } -void PluginPrefs::PluginState::Set(const FilePath& plugin, bool enabled) { +void PluginPrefs::PluginState::Set(const base::FilePath& plugin, bool enabled) { state_[ConvertMapKey(plugin)] = enabled; } -FilePath PluginPrefs::PluginState::ConvertMapKey(const FilePath& plugin) const { +base::FilePath PluginPrefs::PluginState::ConvertMapKey( + const base::FilePath& plugin) const { // Keep the state of component-updated and bundled Pepper Flash in sync. if (plugin.BaseName().value() == chrome::kPepperFlashPluginFilename) { - FilePath component_updated_pepper_flash_dir; + base::FilePath component_updated_pepper_flash_dir; if (PathService::Get(chrome::DIR_COMPONENT_UPDATED_PEPPER_FLASH_PLUGIN, &component_updated_pepper_flash_dir) && component_updated_pepper_flash_dir.IsParent(plugin)) { - FilePath bundled_pepper_flash; + base::FilePath bundled_pepper_flash; if (PathService::Get(chrome::FILE_PEPPER_FLASH_PLUGIN, &bundled_pepper_flash)) { return bundled_pepper_flash; @@ -133,7 +134,7 @@ void PluginPrefs::EnablePluginGroupInternal( } void PluginPrefs::EnablePlugin( - bool enabled, const FilePath& path, + bool enabled, const base::FilePath& path, const base::Callback<void(bool)>& callback) { PluginFinder* finder = PluginFinder::GetInstance(); webkit::WebPluginInfo plugin; @@ -167,7 +168,7 @@ void PluginPrefs::EnablePlugin( void PluginPrefs::EnablePluginInternal( bool enabled, - const FilePath& path, + const base::FilePath& path, PluginFinder* plugin_finder, const base::Callback<void(bool)>& callback, const std::vector<webkit::WebPluginInfo>& plugins) { @@ -307,9 +308,9 @@ void PluginPrefs::ListValueToStringSet(const ListValue* src, void PluginPrefs::SetPrefs(PrefService* prefs) { prefs_ = prefs; bool update_internal_dir = false; - FilePath last_internal_dir = + base::FilePath last_internal_dir = prefs_->GetFilePath(prefs::kPluginsLastInternalDirectory); - FilePath cur_internal_dir; + base::FilePath cur_internal_dir; if (PathService::Get(chrome::DIR_INTERNAL_PLUGINS, &cur_internal_dir) && cur_internal_dir != last_internal_dir) { update_internal_dir = true; @@ -321,9 +322,9 @@ void PluginPrefs::SetPrefs(PrefService* prefs) { bool internal_pdf_enabled = false; string16 pdf_group_name = ASCIIToUTF16(chrome::ChromeContentClient::kPDFPluginName); - FilePath pdf_path; + base::FilePath pdf_path; PathService::Get(chrome::FILE_PDF_PLUGIN, &pdf_path); - FilePath::StringType pdf_path_str = pdf_path.value(); + base::FilePath::StringType pdf_path_str = pdf_path.value(); if (!prefs_->GetBoolean(prefs::kPluginsEnabledInternalPDF)) { // We switched to the internal pdf plugin being on by default, and so we // need to force it to be enabled. We only want to do it this once though, @@ -339,9 +340,9 @@ void PluginPrefs::SetPrefs(PrefService* prefs) { // check for both because either could be stored as the plugin group name. string16 old_nacl_group_name = ASCIIToUTF16(chrome::ChromeContentClient::kNaClOldPluginName); - FilePath nacl_path; + base::FilePath nacl_path; PathService::Get(chrome::FILE_NACL_PLUGIN, &nacl_path); - FilePath::StringType nacl_path_str = nacl_path.value(); + base::FilePath::StringType nacl_path_str = nacl_path.value(); if (!prefs_->GetBoolean(prefs::kPluginsEnabledNaCl)) { // We switched to the nacl plugin being on by default, and so we need to // force it to be enabled. We only want to do it this once though, i.e. @@ -369,8 +370,8 @@ void PluginPrefs::SetPrefs(PrefService* prefs) { if (saved_plugins_list && !saved_plugins_list->empty()) { // The following four variables are only valid when // |migrate_to_pepper_flash| is set to true. - FilePath npapi_flash; - FilePath pepper_flash; + base::FilePath npapi_flash; + base::FilePath pepper_flash; DictionaryValue* pepper_flash_node = NULL; bool npapi_flash_enabled = false; if (migrate_to_pepper_flash) { @@ -392,12 +393,12 @@ void PluginPrefs::SetPrefs(PrefService* prefs) { if (!plugin->GetBoolean("enabled", &enabled)) enabled = true; - FilePath::StringType path; + base::FilePath::StringType path; // The plugin list constains all the plugin files in addition to the // plugin groups. if (plugin->GetString("path", &path)) { // Files have a path attribute, groups don't. - FilePath plugin_path(path); + base::FilePath plugin_path(path); // The path to the intenral plugin directory changes everytime Chrome // is auto-updated, since it contains the current version number. For @@ -408,7 +409,7 @@ void PluginPrefs::SetPrefs(PrefService* prefs) { // that are within the previous internal plugin directory, and update // them in the prefs accordingly. if (update_internal_dir) { - FilePath relative_path; + base::FilePath relative_path; // Extract the part of |plugin_path| that is relative to // |last_internal_dir|. For example, |relative_path| will be @@ -420,7 +421,7 @@ void PluginPrefs::SetPrefs(PrefService* prefs) { while (last_internal_dir.IsParent(plugin_path)) { relative_path = plugin_path.BaseName().Append(relative_path); - FilePath old_path = plugin_path; + base::FilePath old_path = plugin_path; plugin_path = plugin_path.DirName(); // To be extra sure that we won't end up in an infinite loop. if (old_path == plugin_path) { @@ -438,23 +439,26 @@ void PluginPrefs::SetPrefs(PrefService* prefs) { } } - if (FilePath::CompareIgnoreCase(path, pdf_path_str) == 0) { + if (base::FilePath::CompareIgnoreCase(path, pdf_path_str) == 0) { if (!enabled && force_enable_internal_pdf) { enabled = true; plugin->SetBoolean("enabled", true); } internal_pdf_enabled = enabled; - } else if (FilePath::CompareIgnoreCase(path, nacl_path_str) == 0) { + } else if ( + base::FilePath::CompareIgnoreCase(path, nacl_path_str) == 0) { if (!enabled && force_enable_nacl) { enabled = true; plugin->SetBoolean("enabled", true); } } else if (migrate_to_pepper_flash && - FilePath::CompareEqualIgnoreCase(path, npapi_flash.value())) { + base::FilePath::CompareEqualIgnoreCase( + path, npapi_flash.value())) { npapi_flash_enabled = enabled; } else if (migrate_to_pepper_flash && - FilePath::CompareEqualIgnoreCase(path, pepper_flash.value())) { + base::FilePath::CompareEqualIgnoreCase( + path, pepper_flash.value())) { if (!enabled) pepper_flash_node = plugin; } @@ -585,7 +589,7 @@ void PluginPrefs::OnUpdatePreferences( ListValue* plugins_list = update.Get(); plugins_list->Clear(); - FilePath internal_dir; + base::FilePath internal_dir; if (PathService::Get(chrome::DIR_INTERNAL_PLUGINS, &internal_dir)) prefs_->SetFilePath(prefs::kPluginsLastInternalDirectory, internal_dir); diff --git a/chrome/browser/plugins/plugin_prefs.h b/chrome/browser/plugins/plugin_prefs.h index b0e9067..944378c 100644 --- a/chrome/browser/plugins/plugin_prefs.h +++ b/chrome/browser/plugins/plugin_prefs.h @@ -68,7 +68,7 @@ class PluginPrefs : public RefcountedProfileKeyedService { // then enabling/disabling the plug-in is ignored and |callback| is run // with 'false' passed to it. Otherwise the plug-in state is changed // and |callback| is run with 'true' passed to it. - void EnablePlugin(bool enable, const FilePath& file_path, + void EnablePlugin(bool enable, const base::FilePath& file_path, const base::Callback<void(bool)>& callback); // Returns whether there is a policy enabling or disabling plug-ins of the @@ -97,13 +97,13 @@ class PluginPrefs : public RefcountedProfileKeyedService { // Returns whether |plugin| is found. If |plugin| cannot be found, // |*enabled| won't be touched. - bool Get(const FilePath& plugin, bool* enabled) const; - void Set(const FilePath& plugin, bool enabled); + bool Get(const base::FilePath& plugin, bool* enabled) const; + void Set(const base::FilePath& plugin, bool enabled); private: - FilePath ConvertMapKey(const FilePath& plugin) const; + base::FilePath ConvertMapKey(const base::FilePath& plugin) const; - std::map<FilePath, bool> state_; + std::map<base::FilePath, bool> state_; }; virtual ~PluginPrefs(); @@ -129,7 +129,7 @@ class PluginPrefs : public RefcountedProfileKeyedService { const std::vector<webkit::WebPluginInfo>& plugins); void EnablePluginInternal( bool enabled, - const FilePath& path, + const base::FilePath& path, PluginFinder* plugin_finder, const base::Callback<void(bool)>& callback, const std::vector<webkit::WebPluginInfo>& plugins); diff --git a/chrome/browser/plugins/plugin_prefs_factory.cc b/chrome/browser/plugins/plugin_prefs_factory.cc index e1e3ba9..123126f 100644 --- a/chrome/browser/plugins/plugin_prefs_factory.cc +++ b/chrome/browser/plugins/plugin_prefs_factory.cc @@ -48,7 +48,7 @@ PluginPrefsFactory::BuildServiceInstanceFor(Profile* profile) const { } void PluginPrefsFactory::RegisterUserPrefs(PrefServiceSyncable* prefs) { - FilePath internal_dir; + base::FilePath internal_dir; PathService::Get(chrome::DIR_INTERNAL_PLUGINS, &internal_dir); prefs->RegisterFilePathPref(prefs::kPluginsLastInternalDirectory, internal_dir, diff --git a/chrome/browser/plugins/plugin_prefs_unittest.cc b/chrome/browser/plugins/plugin_prefs_unittest.cc index 074b09b..ad1aa8e 100644 --- a/chrome/browser/plugins/plugin_prefs_unittest.cc +++ b/chrome/browser/plugins/plugin_prefs_unittest.cc @@ -30,9 +30,9 @@ void CanEnablePluginCallback(const base::Closure& quit_closure, quit_closure.Run(); } -FilePath GetComponentUpdatedPepperFlashPath( - const FilePath::StringType& version) { - FilePath path; +base::FilePath GetComponentUpdatedPepperFlashPath( + const base::FilePath::StringType& version) { + base::FilePath path; EXPECT_TRUE(PathService::Get( chrome::DIR_COMPONENT_UPDATED_PEPPER_FLASH_PLUGIN, &path)); path = path.Append(version); @@ -40,8 +40,8 @@ FilePath GetComponentUpdatedPepperFlashPath( return path; } -FilePath GetBundledPepperFlashPath() { - FilePath path; +base::FilePath GetBundledPepperFlashPath() { + base::FilePath path; EXPECT_TRUE(PathService::Get(chrome::FILE_PEPPER_FLASH_PLUGIN, &path)); return path; } @@ -64,7 +64,7 @@ class PluginPrefsTest : public ::testing::Test { protected: void EnablePluginSynchronously(bool enabled, - const FilePath& path, + const base::FilePath& path, bool expected_can_change) { base::RunLoop run_loop; plugin_prefs_->EnablePlugin( diff --git a/chrome/browser/policy/app_pack_updater.cc b/chrome/browser/policy/app_pack_updater.cc index a6e16bc..2a0b9de 100644 --- a/chrome/browser/policy/app_pack_updater.cc +++ b/chrome/browser/policy/app_pack_updater.cc @@ -207,7 +207,7 @@ void AppPackUpdater::LoadPolicy() { value = settings->GetPref(chromeos::kScreenSaverExtensionId); if (!value || !value->GetAsString(&screen_saver_id_)) { screen_saver_id_.clear(); - SetScreenSaverPath(FilePath()); + SetScreenSaverPath(base::FilePath()); } CheckCacheNow(); @@ -242,7 +242,7 @@ void AppPackUpdater::BlockingCheckCacheInternal( const std::set<std::string>* valid_ids, CacheEntryMap* entries) { // Start by verifying that the cache dir exists. - FilePath dir(kAppPackCacheDir); + base::FilePath dir(kAppPackCacheDir); if (!file_util::DirectoryExists(dir)) { // Create it now. if (!file_util::CreateDirectory(dir)) @@ -257,7 +257,7 @@ void AppPackUpdater::BlockingCheckCacheInternal( FileEnumerator::SHOW_SYM_LINKS; FileEnumerator enumerator(dir, false /* recursive */, types); - for (FilePath path = enumerator.Next(); + for (base::FilePath path = enumerator.Next(); !path.empty(); path = enumerator.Next()) { FileEnumerator::FindInfo info; enumerator.GetFindInfo(&info); @@ -318,7 +318,7 @@ void AppPackUpdater::BlockingCheckCacheInternal( DCHECK(vEntry.IsValid()); DCHECK(vCurrent.IsValid()); if (vEntry.CompareTo(vCurrent) < 0) { - file_util::Delete(FilePath(entry.path), true /* recursive */); + file_util::Delete(base::FilePath(entry.path), true /* recursive */); entry.path = path.value(); } else { file_util::Delete(path, true /* recursive */); @@ -340,9 +340,9 @@ void AppPackUpdater::OnCacheUpdated(CacheEntryMap* cache_entries) { CacheEntryMap::iterator it = cached_extensions_.find(screen_saver_id_); if (it != cached_extensions_.end()) - SetScreenSaverPath(FilePath(it->second.path)); + SetScreenSaverPath(base::FilePath(it->second.path)); else - SetScreenSaverPath(FilePath()); + SetScreenSaverPath(base::FilePath()); VLOG(1) << "Updated AppPack cache, there are " << cached_extensions_.size() << " extensions cached and " @@ -424,7 +424,7 @@ void AppPackUpdater::OnExtensionDownloadFailed( void AppPackUpdater::OnExtensionDownloadFinished( const std::string& id, - const FilePath& path, + const base::FilePath& path, const GURL& download_url, const std::string& version, const extensions::ExtensionDownloaderDelegate::PingResult& ping_result, @@ -435,7 +435,7 @@ void AppPackUpdater::OnExtensionDownloadFinished( base::Bind(&AppPackUpdater::BlockingInstallCacheEntry, weak_ptr_factory_.GetWeakPtr(), std::string(id), - FilePath(path), + base::FilePath(path), std::string(version))); } @@ -469,7 +469,7 @@ bool AppPackUpdater::GetExtensionExistingVersion(const std::string& id, void AppPackUpdater::BlockingInstallCacheEntry( base::WeakPtr<AppPackUpdater> app_pack_updater, const std::string& id, - const FilePath& path, + const base::FilePath& path, const std::string& version) { Version version_validator(version); if (!version_validator.IsValid()) { @@ -480,8 +480,8 @@ void AppPackUpdater::BlockingInstallCacheEntry( } std::string basename = id + "-" + version + kCRXFileExtension; - FilePath cache_dir(kAppPackCacheDir); - FilePath cached_crx_path = cache_dir.Append(basename); + base::FilePath cache_dir(kAppPackCacheDir); + base::FilePath cached_crx_path = cache_dir.Append(basename); if (file_util::PathExists(cached_crx_path)) { LOG(WARNING) << "AppPack downloaded a crx whose filename will overwrite " @@ -525,13 +525,13 @@ void AppPackUpdater::OnCacheEntryInstalled(const std::string& id, if (id == screen_saver_id_) { VLOG(1) << "AppPack got the screen saver extension at " << path; - SetScreenSaverPath(FilePath(path)); + SetScreenSaverPath(base::FilePath(path)); } else { UpdateExtensionLoader(); } } -void AppPackUpdater::OnDamagedFileDetected(const FilePath& path) { +void AppPackUpdater::OnDamagedFileDetected(const base::FilePath& path) { // Search for |path| in |cached_extensions_|, and delete it if found. for (CacheEntryMap::iterator it = cached_extensions_.begin(); it != cached_extensions_.end(); ++it) { @@ -560,7 +560,7 @@ void AppPackUpdater::PostBlockingTask(const tracked_objects::Location& location, base::SequencedWorkerPool::SKIP_ON_SHUTDOWN); } -void AppPackUpdater::SetScreenSaverPath(const FilePath& path) { +void AppPackUpdater::SetScreenSaverPath(const base::FilePath& path) { // Don't invoke the callback if the path isn't changing. if (path != screen_saver_path_) { screen_saver_path_ = path; diff --git a/chrome/browser/policy/app_pack_updater.h b/chrome/browser/policy/app_pack_updater.h index 142ec9a..ddc3c56 100644 --- a/chrome/browser/policy/app_pack_updater.h +++ b/chrome/browser/policy/app_pack_updater.h @@ -47,7 +47,7 @@ class AppPackUpdater : public content::NotificationObserver, public extensions::ExtensionDownloaderDelegate { public: // Callback to listen for updates to the screensaver extension's path. - typedef base::Callback<void(const FilePath&)> ScreenSaverUpdateCallback; + typedef base::Callback<void(const base::FilePath&)> ScreenSaverUpdateCallback; // Keys for the entries in the AppPack dictionary policy. static const char kExtensionId[]; @@ -72,7 +72,7 @@ class AppPackUpdater : public content::NotificationObserver, // If a user of one of the AppPack's extensions detects that the extension // is damaged then this method can be used to remove it from the cache and // retry to download it after a restart. - void OnDamagedFileDetected(const FilePath& path); + void OnDamagedFileDetected(const base::FilePath& path); private: struct CacheEntry { @@ -133,7 +133,7 @@ class AppPackUpdater : public content::NotificationObserver, virtual void OnExtensionDownloadFinished( const std::string& id, - const FilePath& path, + const base::FilePath& path, const GURL& download_url, const std::string& version, const PingResult& ping_result, @@ -155,7 +155,7 @@ class AppPackUpdater : public content::NotificationObserver, static void BlockingInstallCacheEntry( base::WeakPtr<AppPackUpdater> app_pack_updater, const std::string& id, - const FilePath& path, + const base::FilePath& path, const std::string& version); // Invoked on the UI thread when a new AppPack entry has been installed in @@ -174,7 +174,7 @@ class AppPackUpdater : public content::NotificationObserver, // Sets |screen_saver_path_| and invokes |screen_saver_update_callback_| if // appropriate. - void SetScreenSaverPath(const FilePath& path); + void SetScreenSaverPath(const base::FilePath& path); base::WeakPtrFactory<AppPackUpdater> weak_ptr_factory_; @@ -199,7 +199,7 @@ class AppPackUpdater : public content::NotificationObserver, // The extension ID and path of the CRX file of the screen saver extension, // if it is configured by the policy. Otherwise these fields are empty. std::string screen_saver_id_; - FilePath screen_saver_path_; + base::FilePath screen_saver_path_; // Callback to invoke whenever the screen saver's extension path changes. // Can be null. diff --git a/chrome/browser/policy/browser_policy_connector.cc b/chrome/browser/policy/browser_policy_connector.cc index d45ed87..0dc0abd 100644 --- a/chrome/browser/policy/browser_policy_connector.cc +++ b/chrome/browser/policy/browser_policy_connector.cc @@ -72,11 +72,12 @@ namespace policy { namespace { // Subdirectory in the user's profile for storing user policies. -const FilePath::CharType kPolicyDir[] = FILE_PATH_LITERAL("Device Management"); +const base::FilePath::CharType kPolicyDir[] = + FILE_PATH_LITERAL("Device Management"); // File in the above directory for stroing user policy dmtokens. -const FilePath::CharType kTokenCacheFile[] = FILE_PATH_LITERAL("Token"); +const base::FilePath::CharType kTokenCacheFile[] = FILE_PATH_LITERAL("Token"); // File in the above directory for storing user policy data. -const FilePath::CharType kPolicyCacheFile[] = FILE_PATH_LITERAL("Policy"); +const base::FilePath::CharType kPolicyCacheFile[] = FILE_PATH_LITERAL("Policy"); // The following constants define delays applied before the initial policy fetch // on startup. (So that displaying Chrome's GUI does not get delayed.) @@ -125,7 +126,7 @@ void BrowserPolicyConnector::Init() { chromeos::CrosLibrary::Get()->GetCryptohomeLibrary(); install_attributes_.reset(new EnterpriseInstallAttributes(cryptohome)); install_attributes_->ReadCacheFile( - FilePath(policy::EnterpriseInstallAttributes::kCacheFilePath)); + base::FilePath(policy::EnterpriseInstallAttributes::kCacheFilePath)); scoped_ptr<DeviceCloudPolicyStoreChromeOS> device_cloud_policy_store( new DeviceCloudPolicyStoreChromeOS( @@ -248,13 +249,13 @@ void BrowserPolicyConnector::InitializeUserPolicy( CommandLine* command_line = CommandLine::ForCurrentProcess(); - FilePath profile_dir; + base::FilePath profile_dir; PathService::Get(chrome::DIR_USER_DATA, &profile_dir); profile_dir = profile_dir.Append( command_line->GetSwitchValuePath(switches::kLoginProfile)); - const FilePath policy_dir = profile_dir.Append(kPolicyDir); - const FilePath policy_cache_file = policy_dir.Append(kPolicyCacheFile); - const FilePath token_cache_file = policy_dir.Append(kTokenCacheFile); + const base::FilePath policy_dir = profile_dir.Append(kPolicyDir); + const base::FilePath policy_cache_file = policy_dir.Append(kPolicyCacheFile); + const base::FilePath token_cache_file = policy_dir.Append(kTokenCacheFile); if (wait_for_policy_fetch) device_management_service_->ScheduleInitialization(0); @@ -521,7 +522,7 @@ ConfigurationPolicyProvider* BrowserPolicyConnector::CreatePlatformProvider() { new PolicyLoaderMac(policy_list, new MacPreferences())); return new AsyncPolicyProvider(loader.Pass()); #elif defined(OS_POSIX) - FilePath config_dir_path; + base::FilePath config_dir_path; if (PathService::Get(chrome::DIR_POLICY_FILES, &config_dir_path)) { scoped_ptr<AsyncPolicyLoader> loader( new ConfigDirPolicyLoader(config_dir_path, POLICY_SCOPE_MACHINE)); diff --git a/chrome/browser/policy/cloud_policy_browsertest.cc b/chrome/browser/policy/cloud_policy_browsertest.cc index 0e8f100..632ca1b 100644 --- a/chrome/browser/policy/cloud_policy_browsertest.cc +++ b/chrome/browser/policy/cloud_policy_browsertest.cc @@ -118,7 +118,7 @@ class CloudPolicyTest : public InProcessBrowserTest { virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { // The TestServer wants the docroot as a path relative to the source dir. - FilePath source; + base::FilePath source; ASSERT_TRUE(PathService::Get(base::DIR_SOURCE_ROOT, &source)); ASSERT_TRUE(temp_dir_.CreateUniqueTempDirUnderPath(source)); ASSERT_NO_FATAL_FAILURE(SetServerPolicy(GetEmptyPolicy())); diff --git a/chrome/browser/policy/config_dir_policy_loader.cc b/chrome/browser/policy/config_dir_policy_loader.cc index e6a4be2..81a5838 100644 --- a/chrome/browser/policy/config_dir_policy_loader.cc +++ b/chrome/browser/policy/config_dir_policy_loader.cc @@ -22,13 +22,14 @@ namespace policy { namespace { // Subdirectories that contain the mandatory and recommended policies. -const FilePath::CharType kMandatoryConfigDir[] = FILE_PATH_LITERAL("managed"); -const FilePath::CharType kRecommendedConfigDir[] = +const base::FilePath::CharType kMandatoryConfigDir[] = + FILE_PATH_LITERAL("managed"); +const base::FilePath::CharType kRecommendedConfigDir[] = FILE_PATH_LITERAL("recommended"); } // namespace -ConfigDirPolicyLoader::ConfigDirPolicyLoader(const FilePath& config_dir, +ConfigDirPolicyLoader::ConfigDirPolicyLoader(const base::FilePath& config_dir, PolicyScope scope) : config_dir_(config_dir), scope_(scope) {} @@ -56,7 +57,7 @@ scoped_ptr<PolicyBundle> ConfigDirPolicyLoader::Load() { } base::Time ConfigDirPolicyLoader::LastModificationTime() { - static const FilePath::CharType* kConfigDirSuffixes[] = { + static const base::FilePath::CharType* kConfigDirSuffixes[] = { kMandatoryConfigDir, kRecommendedConfigDir, }; @@ -65,7 +66,7 @@ base::Time ConfigDirPolicyLoader::LastModificationTime() { base::PlatformFileInfo info; for (size_t i = 0; i < arraysize(kConfigDirSuffixes); ++i) { - FilePath path(config_dir_.Append(kConfigDirSuffixes[i])); + base::FilePath path(config_dir_.Append(kConfigDirSuffixes[i])); // Skip if the file doesn't exist, or it isn't a directory. if (!file_util::GetFileInfo(path, &info) || !info.is_directory) @@ -74,7 +75,7 @@ base::Time ConfigDirPolicyLoader::LastModificationTime() { // Enumerate the files and find the most recent modification timestamp. file_util::FileEnumerator file_enumerator(path, false, file_util::FileEnumerator::FILES); - for (FilePath config_file = file_enumerator.Next(); + for (base::FilePath config_file = file_enumerator.Next(); !config_file.empty(); config_file = file_enumerator.Next()) { if (file_util::GetFileInfo(config_file, &info) && !info.is_directory) @@ -85,14 +86,14 @@ base::Time ConfigDirPolicyLoader::LastModificationTime() { return last_modification; } -void ConfigDirPolicyLoader::LoadFromPath(const FilePath& path, +void ConfigDirPolicyLoader::LoadFromPath(const base::FilePath& path, PolicyLevel level, PolicyBundle* bundle) { // Enumerate the files and sort them lexicographically. - std::set<FilePath> files; + std::set<base::FilePath> files; file_util::FileEnumerator file_enumerator(path, false, file_util::FileEnumerator::FILES); - for (FilePath config_file_path = file_enumerator.Next(); + for (base::FilePath config_file_path = file_enumerator.Next(); !config_file_path.empty(); config_file_path = file_enumerator.Next()) files.insert(config_file_path); @@ -100,8 +101,9 @@ void ConfigDirPolicyLoader::LoadFromPath(const FilePath& path, // The files are processed in reverse order because |MergeFrom| gives priority // to existing keys, but the ConfigDirPolicyProvider gives priority to the // last file in lexicographic order. - for (std::set<FilePath>::reverse_iterator config_file_iter = files.rbegin(); - config_file_iter != files.rend(); ++config_file_iter) { + for (std::set<base::FilePath>::reverse_iterator config_file_iter = + files.rbegin(); config_file_iter != files.rend(); + ++config_file_iter) { JSONFileValueSerializer deserializer(*config_file_iter); deserializer.set_allow_trailing_comma(true); int error_code = 0; @@ -186,7 +188,8 @@ void ConfigDirPolicyLoader::Merge3rdPartyPolicy( } } -void ConfigDirPolicyLoader::OnFileUpdated(const FilePath& path, bool error) { +void ConfigDirPolicyLoader::OnFileUpdated(const base::FilePath& path, + bool error) { if (!error) Reload(false); } diff --git a/chrome/browser/policy/config_dir_policy_loader.h b/chrome/browser/policy/config_dir_policy_loader.h index 2d3bd79..a0dcc94 100644 --- a/chrome/browser/policy/config_dir_policy_loader.h +++ b/chrome/browser/policy/config_dir_policy_loader.h @@ -23,7 +23,7 @@ namespace policy { // last value read takes precedence in case of policy key collisions. class ConfigDirPolicyLoader : public AsyncPolicyLoader { public: - ConfigDirPolicyLoader(const FilePath& config_dir, PolicyScope scope); + ConfigDirPolicyLoader(const base::FilePath& config_dir, PolicyScope scope); virtual ~ConfigDirPolicyLoader(); // AsyncPolicyLoader implementation. @@ -33,7 +33,7 @@ class ConfigDirPolicyLoader : public AsyncPolicyLoader { private: // Loads the policy files at |path| into the |bundle|, with the given |level|. - void LoadFromPath(const FilePath& path, + void LoadFromPath(const base::FilePath& path, PolicyLevel level, PolicyBundle* bundle); @@ -43,10 +43,10 @@ class ConfigDirPolicyLoader : public AsyncPolicyLoader { PolicyBundle* bundle); // Callback for the FilePathWatchers. - void OnFileUpdated(const FilePath& path, bool error); + void OnFileUpdated(const base::FilePath& path, bool error); // The directory containing the policy files. - FilePath config_dir_; + base::FilePath config_dir_; // Policies loaded by this provider will have this scope. PolicyScope scope_; diff --git a/chrome/browser/policy/config_dir_policy_loader_unittest.cc b/chrome/browser/policy/config_dir_policy_loader_unittest.cc index 80d518e..f1fa524 100644 --- a/chrome/browser/policy/config_dir_policy_loader_unittest.cc +++ b/chrome/browser/policy/config_dir_policy_loader_unittest.cc @@ -20,7 +20,7 @@ namespace policy { namespace { // Subdirectory of the config dir that contains mandatory policies. -const FilePath::CharType kMandatoryPath[] = FILE_PATH_LITERAL("managed"); +const base::FilePath::CharType kMandatoryPath[] = FILE_PATH_LITERAL("managed"); class TestHarness : public PolicyProviderTestHarness { public: @@ -48,7 +48,7 @@ class TestHarness : public PolicyProviderTestHarness { virtual void Install3rdPartyPolicy( const base::DictionaryValue* policies) OVERRIDE; - const FilePath& test_dir() { return test_dir_.path(); } + const base::FilePath& test_dir() { return test_dir_.path(); } // JSON-encode a dictionary and write it to a file. void WriteConfigFile(const base::DictionaryValue& dict, @@ -136,9 +136,9 @@ void TestHarness::WriteConfigFile(const base::DictionaryValue& dict, std::string data; JSONStringValueSerializer serializer(&data); serializer.Serialize(dict); - const FilePath mandatory_dir(test_dir().Append(kMandatoryPath)); + const base::FilePath mandatory_dir(test_dir().Append(kMandatoryPath)); ASSERT_TRUE(file_util::CreateDirectory(mandatory_dir)); - const FilePath file_path(mandatory_dir.AppendASCII(file_name)); + const base::FilePath file_path(mandatory_dir.AppendASCII(file_name)); ASSERT_EQ((int) data.size(), file_util::WriteFile(file_path, data.c_str(), data.size())); } @@ -191,7 +191,7 @@ TEST_F(ConfigDirPolicyLoaderTest, ReadPrefsEmpty) { // Reading from a non-existent directory should result in an empty preferences // dictionary. TEST_F(ConfigDirPolicyLoaderTest, ReadPrefsNonExistentDirectory) { - FilePath non_existent_dir( + base::FilePath non_existent_dir( harness_.test_dir().Append(FILE_PATH_LITERAL("not_there"))); ConfigDirPolicyLoader loader(non_existent_dir, POLICY_SCOPE_MACHINE); scoped_ptr<PolicyBundle> bundle(loader.Load()); diff --git a/chrome/browser/policy/configuration_policy_handler.cc b/chrome/browser/policy/configuration_policy_handler.cc index 661f481..aa088c3 100644 --- a/chrome/browser/policy/configuration_policy_handler.cc +++ b/chrome/browser/policy/configuration_policy_handler.cc @@ -692,11 +692,11 @@ DownloadDirPolicyHandler::~DownloadDirPolicyHandler() { void DownloadDirPolicyHandler::ApplyPolicySettings(const PolicyMap& policies, PrefValueMap* prefs) { const Value* value = policies.GetValue(policy_name()); - FilePath::StringType string_value; + base::FilePath::StringType string_value; if (!value || !value->GetAsString(&string_value)) return; - FilePath::StringType expanded_value = + base::FilePath::StringType expanded_value = policy::path_parser::ExpandPathVariables(string_value); // Make sure the path isn't empty, since that will point to an undefined // location; the default location is used instead in that case. @@ -724,9 +724,9 @@ DiskCacheDirPolicyHandler::~DiskCacheDirPolicyHandler() { void DiskCacheDirPolicyHandler::ApplyPolicySettings(const PolicyMap& policies, PrefValueMap* prefs) { const Value* value = policies.GetValue(policy_name()); - FilePath::StringType string_value; + base::FilePath::StringType string_value; if (value && value->GetAsString(&string_value)) { - FilePath::StringType expanded_value = + base::FilePath::StringType expanded_value = policy::path_parser::ExpandPathVariables(string_value); prefs->SetValue(prefs::kDiskCacheDir, Value::CreateStringValue(expanded_value)); diff --git a/chrome/browser/policy/device_management_service_browsertest.cc b/chrome/browser/policy/device_management_service_browsertest.cc index 50b54cb..1782319 100644 --- a/chrome/browser/policy/device_management_service_browsertest.cc +++ b/chrome/browser/policy/device_management_service_browsertest.cc @@ -177,7 +177,7 @@ class DeviceManagementServiceIntegrationTest new net::TestServer( net::TestServer::TYPE_HTTP, net::TestServer::kLocalhost, - FilePath(FILE_PATH_LITERAL("chrome/test/data/policy")))); + base::FilePath(FILE_PATH_LITERAL("chrome/test/data/policy")))); ASSERT_TRUE(test_server_->Start()); } diff --git a/chrome/browser/policy/enterprise_install_attributes.cc b/chrome/browser/policy/enterprise_install_attributes.cc index 248f625..29596ed 100644 --- a/chrome/browser/policy/enterprise_install_attributes.cc +++ b/chrome/browser/policy/enterprise_install_attributes.cc @@ -72,7 +72,7 @@ bool ReadMapKey(const std::map<std::string, std::string>& map, } // namespace // Cache file name. -const FilePath::CharType EnterpriseInstallAttributes::kCacheFilePath[] = +const base::FilePath::CharType EnterpriseInstallAttributes::kCacheFilePath[] = FILE_PATH_LITERAL("/var/run/lockbox/install_attributes.pb"); EnterpriseInstallAttributes::EnterpriseInstallAttributes( @@ -81,7 +81,8 @@ EnterpriseInstallAttributes::EnterpriseInstallAttributes( device_locked_(false), registration_mode_(DEVICE_MODE_PENDING) {} -void EnterpriseInstallAttributes::ReadCacheFile(const FilePath& cache_file) { +void EnterpriseInstallAttributes::ReadCacheFile( + const base::FilePath& cache_file) { if (device_locked_ || !file_util::PathExists(cache_file)) return; diff --git a/chrome/browser/policy/enterprise_install_attributes.h b/chrome/browser/policy/enterprise_install_attributes.h index 38904da..312bd77 100644 --- a/chrome/browser/policy/enterprise_install_attributes.h +++ b/chrome/browser/policy/enterprise_install_attributes.h @@ -32,14 +32,14 @@ class EnterpriseInstallAttributes { }; // Standard cache file name. - static const FilePath::CharType kCacheFilePath[]; + static const base::FilePath::CharType kCacheFilePath[]; explicit EnterpriseInstallAttributes(chromeos::CryptohomeLibrary* cryptohome); // Reads data from the cache file. The cache file is used to work around slow // cryptohome startup, which takes a while to register its DBus interface. // See http://crosbug.com/37367 for background on this. - void ReadCacheFile(const FilePath& cache_file); + void ReadCacheFile(const base::FilePath& cache_file); // Makes sure the local caches for enterprise-related install attributes are // up-to-date with what cryptohome has. diff --git a/chrome/browser/policy/enterprise_install_attributes_unittest.cc b/chrome/browser/policy/enterprise_install_attributes_unittest.cc index 151029c..1ba6212 100644 --- a/chrome/browser/policy/enterprise_install_attributes_unittest.cc +++ b/chrome/browser/policy/enterprise_install_attributes_unittest.cc @@ -30,7 +30,7 @@ class EnterpriseInstallAttributesTest : public testing::Test { ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); } - FilePath GetTempPath() const { + base::FilePath GetTempPath() const { return temp_dir_.path().Append("install_attrs_test"); } diff --git a/chrome/browser/policy/managed_mode_policy_provider.cc b/chrome/browser/policy/managed_mode_policy_provider.cc index 343446c..c6024db 100644 --- a/chrome/browser/policy/managed_mode_policy_provider.cc +++ b/chrome/browser/policy/managed_mode_policy_provider.cc @@ -23,7 +23,8 @@ scoped_ptr<ManagedModePolicyProvider> ManagedModePolicyProvider::Create( Profile* profile, base::SequencedTaskRunner* sequenced_task_runner, bool force_load) { - FilePath path = profile->GetPath().Append(chrome::kManagedModePolicyFilename); + base::FilePath path = + profile->GetPath().Append(chrome::kManagedModePolicyFilename); JsonPrefStore* pref_store = new JsonPrefStore(path, sequenced_task_runner); // Load the data synchronously if needed (when creating profiles on startup). if (force_load) diff --git a/chrome/browser/policy/mock_user_cloud_policy_store.cc b/chrome/browser/policy/mock_user_cloud_policy_store.cc index e4cdcc2..dfb63f1 100644 --- a/chrome/browser/policy/mock_user_cloud_policy_store.cc +++ b/chrome/browser/policy/mock_user_cloud_policy_store.cc @@ -7,7 +7,7 @@ namespace policy { MockUserCloudPolicyStore::MockUserCloudPolicyStore() - : UserCloudPolicyStore(NULL, FilePath()) {} + : UserCloudPolicyStore(NULL, base::FilePath()) {} MockUserCloudPolicyStore::~MockUserCloudPolicyStore() {} diff --git a/chrome/browser/policy/policy_browsertest.cc b/chrome/browser/policy/policy_browsertest.cc index b455aac..46011f4 100644 --- a/chrome/browser/policy/policy_browsertest.cc +++ b/chrome/browser/policy/policy_browsertest.cc @@ -126,17 +126,19 @@ const char kCookieValue[] = "converted=true"; // Assigned to Philip J. Fry to fix eventually. const char kCookieOptions[] = ";expires=Wed Jan 01 3000 00:00:00 GMT"; -const FilePath::CharType kTestExtensionsDir[] = FILE_PATH_LITERAL("extensions"); -const FilePath::CharType kGoodCrxName[] = FILE_PATH_LITERAL("good.crx"); -const FilePath::CharType kAdBlockCrxName[] = FILE_PATH_LITERAL("adblock.crx"); -const FilePath::CharType kHostedAppCrxName[] = +const base::FilePath::CharType kTestExtensionsDir[] = + FILE_PATH_LITERAL("extensions"); +const base::FilePath::CharType kGoodCrxName[] = FILE_PATH_LITERAL("good.crx"); +const base::FilePath::CharType kAdBlockCrxName[] = + FILE_PATH_LITERAL("adblock.crx"); +const base::FilePath::CharType kHostedAppCrxName[] = FILE_PATH_LITERAL("hosted_app.crx"); const char kGoodCrxId[] = "ldnnhddmnhbkjipkidpdiheffobcpfmf"; const char kAdBlockCrxId[] = "dojnnbeimaimaojcialkkgajdnefpgcn"; const char kHostedAppCrxId[] = "kbmnembihfiondgfjekmnmcbddelicoi"; -const FilePath::CharType kGoodCrxManifestName[] = +const base::FilePath::CharType kGoodCrxManifestName[] = FILE_PATH_LITERAL("good_update_manifest.xml"); // Filters requests to the hosts in |urls| and redirects them to the test data @@ -144,7 +146,7 @@ const FilePath::CharType kGoodCrxManifestName[] = void RedirectHostsToTestData(const char* const urls[], size_t size) { // Map the given hosts to the test data dir. net::URLRequestFilter* filter = net::URLRequestFilter::GetInstance(); - FilePath base_path; + base::FilePath base_path; PathService::Get(chrome::DIR_TEST_DATA, &base_path); for (size_t i = 0; i < size; ++i) { const GURL url(urls[i]); @@ -249,14 +251,14 @@ void CheckURLIsBlocked(Browser* browser, const char* spec) { // Downloads a file named |file| and expects it to be saved to |dir|, which // must be empty. void DownloadAndVerifyFile( - Browser* browser, const FilePath& dir, const FilePath& file) { + Browser* browser, const base::FilePath& dir, const base::FilePath& file) { content::DownloadManager* download_manager = content::BrowserContext::GetDownloadManager(browser->profile()); content::DownloadTestObserverTerminal observer( download_manager, 1, content::DownloadTestObserver::ON_DANGEROUS_DOWNLOAD_FAIL); GURL url(URLRequestMockHTTPJob::GetMockUrl(file)); - FilePath downloaded = dir.Append(file); + base::FilePath downloaded = dir.Append(file); EXPECT_FALSE(file_util::PathExists(downloaded)); ui_test_utils::NavigateToURLWithDisposition( browser, url, CURRENT_TAB, @@ -268,7 +270,7 @@ void DownloadAndVerifyFile( file_util::FileEnumerator enumerator( dir, false, file_util::FileEnumerator::FILES); EXPECT_EQ(file, enumerator.Next().BaseName()); - EXPECT_EQ(FilePath(), enumerator.Next()); + EXPECT_EQ(base::FilePath(), enumerator.Next()); } #if defined(OS_CHROMEOS) @@ -421,7 +423,7 @@ class PolicyTest : public InProcessBrowserTest { // Makes URLRequestMockHTTPJobs serve data from content::DIR_TEST_DATA // instead of chrome::DIR_TEST_DATA. void ServeContentTestData() { - FilePath root_http; + base::FilePath root_http; PathService::Get(content::DIR_TEST_DATA, &root_http); BrowserThread::PostTaskAndReply( BrowserThread::IO, FROM_HERE, @@ -507,9 +509,9 @@ class PolicyTest : public InProcessBrowserTest { } const extensions::Extension* InstallExtension( - const FilePath::StringType& name) { - FilePath extension_path(ui_test_utils::GetTestFilePath( - FilePath(kTestExtensionsDir), FilePath(name))); + const base::FilePath::StringType& name) { + base::FilePath extension_path(ui_test_utils::GetTestFilePath( + base::FilePath(kTestExtensionsDir), base::FilePath(name))); scoped_refptr<extensions::CrxInstaller> installer = extensions::CrxInstaller::Create(extension_service(), NULL); installer->set_allow_silent_install(true); @@ -1038,8 +1040,8 @@ IN_PROC_BROWSER_TEST_F(PolicyTest, AlwaysAuthorizePlugins) { // Verify that the test page exists. It is only present in checkouts with // src-internal. if (!file_util::PathExists(ui_test_utils::GetTestFilePath( - FilePath(FILE_PATH_LITERAL("plugin")), - FilePath(FILE_PATH_LITERAL("quicktime.html"))))) { + base::FilePath(FILE_PATH_LITERAL("plugin")), + base::FilePath(FILE_PATH_LITERAL("quicktime.html"))))) { LOG(INFO) << "Test skipped because plugin/quicktime.html test file wasn't found."; return; @@ -1056,7 +1058,7 @@ IN_PROC_BROWSER_TEST_F(PolicyTest, AlwaysAuthorizePlugins) { ASSERT_TRUE(infobar_service); EXPECT_EQ(0u, infobar_service->GetInfoBarCount()); - FilePath path(FILE_PATH_LITERAL("plugin/quicktime.html")); + base::FilePath path(FILE_PATH_LITERAL("plugin/quicktime.html")); GURL url(URLRequestMockHTTPJob::GetMockUrl(path)); ui_test_utils::NavigateToURL(browser(), url); // This should have triggered the dangerous plugin infobar. @@ -1115,7 +1117,7 @@ IN_PROC_BROWSER_TEST_F(PolicyTest, DownloadDirectory) { prefs::kPromptForDownload, false); // Verify that downloads end up on the default directory. - FilePath file(FILE_PATH_LITERAL("download-test1.lib")); + base::FilePath file(FILE_PATH_LITERAL("download-test1.lib")); DownloadAndVerifyFile(browser(), initial_dir.path(), file); file_util::DieFileDie(initial_dir.path().Append(file), false); @@ -1207,7 +1209,8 @@ IN_PROC_BROWSER_TEST_F(PolicyTest, ExtensionInstallForcelist) { // Extensions that are force-installed come from an update URL, which defaults // to the webstore. Use a mock URL for this test with an update manifest // that includes "good.crx". - FilePath path = FilePath(kTestExtensionsDir).Append(kGoodCrxManifestName); + base::FilePath path = + base::FilePath(kTestExtensionsDir).Append(kGoodCrxManifestName); GURL url(URLRequestMockHTTPJob::GetMockUrl(path)); // Setting the forcelist extension should install "good.crx". @@ -1355,8 +1358,8 @@ IN_PROC_BROWSER_TEST_F(PolicyTest, SavingBrowserHistoryDisabled) { POLICY_SCOPE_USER, base::Value::CreateBooleanValue(true)); UpdateProviderPolicy(policies); GURL url = ui_test_utils::GetTestUrl( - FilePath(FilePath::kCurrentDirectory), - FilePath(FILE_PATH_LITERAL("empty.html"))); + base::FilePath(base::FilePath::kCurrentDirectory), + base::FilePath(FILE_PATH_LITERAL("empty.html"))); ui_test_utils::NavigateToURL(browser(), url); // Verify that the navigation wasn't saved in the history. ui_test_utils::HistoryEnumerator enumerator1(browser()->profile()); @@ -1395,7 +1398,7 @@ IN_PROC_BROWSER_TEST_F(PolicyTest, TranslateEnabled) { // shown below, without polling for infobars for some indeterminate amount // of time. GURL url = ui_test_utils::GetTestUrl( - FilePath(), FilePath(FILE_PATH_LITERAL("french_page.html"))); + base::FilePath(), base::FilePath(FILE_PATH_LITERAL("french_page.html"))); content::WindowedNotificationObserver language_observer1( chrome::NOTIFICATION_TAB_LANGUAGE_DETERMINED, content::NotificationService::AllSources()); diff --git a/chrome/browser/policy/policy_loader_mac.cc b/chrome/browser/policy/policy_loader_mac.cc index c9e1495..12942bb 100644 --- a/chrome/browser/policy/policy_loader_mac.cc +++ b/chrome/browser/policy/policy_loader_mac.cc @@ -28,23 +28,23 @@ namespace policy { namespace { -FilePath GetManagedPolicyPath() { +base::FilePath GetManagedPolicyPath() { // This constructs the path to the plist file in which Mac OS X stores the // managed preference for the application. This is undocumented and therefore // fragile, but if it doesn't work out, AsyncPolicyLoader has a task that // polls periodically in order to reload managed preferences later even if we // missed the change. - FilePath path; + base::FilePath path; if (!PathService::Get(chrome::DIR_MANAGED_PREFS, &path)) - return FilePath(); + return base::FilePath(); CFBundleRef bundle(CFBundleGetMainBundle()); if (!bundle) - return FilePath(); + return base::FilePath(); CFStringRef bundle_id = CFBundleGetIdentifier(bundle); if (!bundle_id) - return FilePath(); + return base::FilePath(); return path.Append(base::SysCFStringRefToUTF8(bundle_id) + ".plist"); } @@ -174,7 +174,7 @@ base::Value* PolicyLoaderMac::CreateValueFromProperty( return NULL; } -void PolicyLoaderMac::OnFileUpdated(const FilePath& path, bool error) { +void PolicyLoaderMac::OnFileUpdated(const base::FilePath& path, bool error) { if (!error) Reload(false); } diff --git a/chrome/browser/policy/policy_loader_mac.h b/chrome/browser/policy/policy_loader_mac.h index 5f8ad6f..61d0c2e 100644 --- a/chrome/browser/policy/policy_loader_mac.h +++ b/chrome/browser/policy/policy_loader_mac.h @@ -42,7 +42,7 @@ class PolicyLoaderMac : public AsyncPolicyLoader { private: // Callback for the FilePathWatcher. - void OnFileUpdated(const FilePath& path, bool error); + void OnFileUpdated(const base::FilePath& path, bool error); // List of recognized policies. const PolicyDefinitionList* policy_list_; @@ -51,7 +51,7 @@ class PolicyLoaderMac : public AsyncPolicyLoader { // Path to the managed preferences file for the current user, if it could // be found. Updates of this file trigger a policy reload. - FilePath managed_policy_path_; + base::FilePath managed_policy_path_; // Watches for events on the |managed_policy_path_|. base::FilePathWatcher watcher_; diff --git a/chrome/browser/policy/policy_path_parser.h b/chrome/browser/policy/policy_path_parser.h index d937355..ce940c3 100644 --- a/chrome/browser/policy/policy_path_parser.h +++ b/chrome/browser/policy/policy_path_parser.h @@ -46,8 +46,8 @@ namespace path_parser { // Any non recognized variable is not being translated at all. Variables are // translated only once in every string because for most of these there is no // sense in concatenating them more than once in a single path. -FilePath::StringType ExpandPathVariables( - const FilePath::StringType& untranslated_string); +base::FilePath::StringType ExpandPathVariables( + const base::FilePath::StringType& untranslated_string); } // namespace path_parser diff --git a/chrome/browser/policy/policy_path_parser_linux.cc b/chrome/browser/policy/policy_path_parser_linux.cc index d641ca1..a110017 100644 --- a/chrome/browser/policy/policy_path_parser_linux.cc +++ b/chrome/browser/policy/policy_path_parser_linux.cc @@ -19,9 +19,9 @@ const char* kUserNamePolicyVarName = "${user_name}"; // Replaces all variable occurrences in the policy string with the respective // system settings values. -FilePath::StringType ExpandPathVariables( - const FilePath::StringType& untranslated_string) { - FilePath::StringType result(untranslated_string); +base::FilePath::StringType ExpandPathVariables( + const base::FilePath::StringType& untranslated_string) { + base::FilePath::StringType result(untranslated_string); if (result.length() == 0) return result; // Sanitize quotes in case of any around the whole string. diff --git a/chrome/browser/policy/policy_path_parser_mac.mm b/chrome/browser/policy/policy_path_parser_mac.mm index 7f1d3da..c9823d4 100644 --- a/chrome/browser/policy/policy_path_parser_mac.mm +++ b/chrome/browser/policy/policy_path_parser_mac.mm @@ -35,9 +35,9 @@ const MacFolderNamesToSPDMaping mac_folder_mapping[] = { // Replaces all variable occurrences in the policy string with the respective // system settings values. -FilePath::StringType ExpandPathVariables( - const FilePath::StringType& untranslated_string) { - FilePath::StringType result(untranslated_string); +base::FilePath::StringType ExpandPathVariables( + const base::FilePath::StringType& untranslated_string) { + base::FilePath::StringType result(untranslated_string); if (result.length() == 0) return result; // Sanitize quotes in case of any around the whole string. diff --git a/chrome/browser/policy/policy_path_parser_unittest.cc b/chrome/browser/policy/policy_path_parser_unittest.cc index aa3d147..916b03a 100644 --- a/chrome/browser/policy/policy_path_parser_unittest.cc +++ b/chrome/browser/policy/policy_path_parser_unittest.cc @@ -11,60 +11,64 @@ namespace policy { class PolicyPathParserTests : public testing::Test { protected: - void CheckForSubstitution(FilePath::StringType test_string, - FilePath::StringType var_name) { - FilePath::StringType var(test_string); - FilePath::StringType var_result = + void CheckForSubstitution(base::FilePath::StringType test_string, + base::FilePath::StringType var_name) { + base::FilePath::StringType var(test_string); + base::FilePath::StringType var_result = path_parser::ExpandPathVariables(var); - ASSERT_EQ(var_result.find(var_name), FilePath::StringType::npos); + ASSERT_EQ(var_result.find(var_name), base::FilePath::StringType::npos); } }; TEST_F(PolicyPathParserTests, AllPlatformVariables) { // No vars whatsoever no substitution should occur. - FilePath::StringType no_vars(FILE_PATH_LITERAL("//$C/shares")); - FilePath::StringType no_vars_result = + base::FilePath::StringType no_vars(FILE_PATH_LITERAL("//$C/shares")); + base::FilePath::StringType no_vars_result = path_parser::ExpandPathVariables(no_vars); ASSERT_EQ(no_vars_result, no_vars); // This is unknown variable and shouldn't be substituted. - FilePath::StringType unknown_vars(FILE_PATH_LITERAL("//$C/${buggy}")); - FilePath::StringType unknown_vars_result = + base::FilePath::StringType unknown_vars(FILE_PATH_LITERAL("//$C/${buggy}")); + base::FilePath::StringType unknown_vars_result = path_parser::ExpandPathVariables(unknown_vars); ASSERT_EQ(unknown_vars_result, unknown_vars); // Trim quotes around, but not inside paths. Test against bug 80211. - FilePath::StringType no_quotes(FILE_PATH_LITERAL("//$C/\"a\"/$path")); - FilePath::StringType single_quotes(FILE_PATH_LITERAL("'//$C/\"a\"/$path'")); - FilePath::StringType double_quotes(FILE_PATH_LITERAL("\"//$C/\"a\"/$path\"")); - FilePath::StringType quotes_result = + base::FilePath::StringType no_quotes(FILE_PATH_LITERAL("//$C/\"a\"/$path")); + base::FilePath::StringType single_quotes( + FILE_PATH_LITERAL("'//$C/\"a\"/$path'")); + base::FilePath::StringType double_quotes( + FILE_PATH_LITERAL("\"//$C/\"a\"/$path\"")); + base::FilePath::StringType quotes_result = path_parser::ExpandPathVariables(single_quotes); ASSERT_EQ(quotes_result, no_quotes); quotes_result = path_parser::ExpandPathVariables(double_quotes); ASSERT_EQ(quotes_result, no_quotes); // Both should have been substituted. - FilePath::StringType vars(FILE_PATH_LITERAL("${user_name}${machine_name}")); - FilePath::StringType vars_result = path_parser::ExpandPathVariables(vars); + base::FilePath::StringType vars( + FILE_PATH_LITERAL("${user_name}${machine_name}")); + base::FilePath::StringType vars_result = + path_parser::ExpandPathVariables(vars); ASSERT_EQ(vars_result.find(FILE_PATH_LITERAL("${user_name}")), - FilePath::StringType::npos); + base::FilePath::StringType::npos); ASSERT_EQ(vars_result.find(FILE_PATH_LITERAL("${machine_name}")), - FilePath::StringType::npos); + base::FilePath::StringType::npos); // Should substitute only one instance. vars = FILE_PATH_LITERAL("${machine_name}${machine_name}"); vars_result = path_parser::ExpandPathVariables(vars); size_t pos = vars_result.find(FILE_PATH_LITERAL("${machine_name}")); - ASSERT_NE(pos, FilePath::StringType::npos); + ASSERT_NE(pos, base::FilePath::StringType::npos); ASSERT_EQ(vars_result.find(FILE_PATH_LITERAL("${machine_name}"), pos+1), - FilePath::StringType::npos); + base::FilePath::StringType::npos); vars =FILE_PATH_LITERAL("${user_name}${machine_name}"); vars_result = path_parser::ExpandPathVariables(vars); ASSERT_EQ(vars_result.find(FILE_PATH_LITERAL("${user_name}")), - FilePath::StringType::npos); + base::FilePath::StringType::npos); ASSERT_EQ(vars_result.find(FILE_PATH_LITERAL("${machine_name}")), - FilePath::StringType::npos); + base::FilePath::StringType::npos); CheckForSubstitution(FILE_PATH_LITERAL("//$C/${user_name}"), FILE_PATH_LITERAL("${user_name}")); diff --git a/chrome/browser/policy/policy_path_parser_win.cc b/chrome/browser/policy/policy_path_parser_win.cc index ce7ca31..3a7f7e2 100644 --- a/chrome/browser/policy/policy_path_parser_win.cc +++ b/chrome/browser/policy/policy_path_parser_win.cc @@ -43,9 +43,9 @@ const WinFolderNamesToCSIDLMapping win_folder_mapping[] = { // Replaces all variable occurances in the policy string with the respective // system settings values. -FilePath::StringType ExpandPathVariables( - const FilePath::StringType& untranslated_string) { - FilePath::StringType result(untranslated_string); +base::FilePath::StringType ExpandPathVariables( + const base::FilePath::StringType& untranslated_string) { + base::FilePath::StringType result(untranslated_string); if (result.length() == 0) return result; // Sanitize quotes in case of any around the whole string. diff --git a/chrome/browser/policy/policy_prefs_browsertest.cc b/chrome/browser/policy/policy_prefs_browsertest.cc index cad470d..14243fe 100644 --- a/chrome/browser/policy/policy_prefs_browsertest.cc +++ b/chrome/browser/policy/policy_prefs_browsertest.cc @@ -193,9 +193,9 @@ class PolicyTestCases { PolicyTestCases() { policy_test_cases_ = new std::map<std::string, PolicyTestCase*>(); - FilePath path = ui_test_utils::GetTestFilePath( - FilePath(FILE_PATH_LITERAL("policy")), - FilePath(FILE_PATH_LITERAL("policy_test_cases.json"))); + base::FilePath path = ui_test_utils::GetTestFilePath( + base::FilePath(FILE_PATH_LITERAL("policy")), + base::FilePath(FILE_PATH_LITERAL("policy_test_cases.json"))); std::string json; if (!file_util::ReadFileToString(path, &json)) { ADD_FAILURE(); diff --git a/chrome/browser/policy/user_cloud_policy_store.cc b/chrome/browser/policy/user_cloud_policy_store.cc index 9a44dc3..f41f7a1 100644 --- a/chrome/browser/policy/user_cloud_policy_store.cc +++ b/chrome/browser/policy/user_cloud_policy_store.cc @@ -41,13 +41,14 @@ struct PolicyLoadResult { namespace { // Subdirectory in the user's profile for storing user policies. -const FilePath::CharType kPolicyDir[] = FILE_PATH_LITERAL("Policy"); +const base::FilePath::CharType kPolicyDir[] = FILE_PATH_LITERAL("Policy"); // File in the above directory for storing user policy data. -const FilePath::CharType kPolicyCacheFile[] = FILE_PATH_LITERAL("User Policy"); +const base::FilePath::CharType kPolicyCacheFile[] = + FILE_PATH_LITERAL("User Policy"); // Loads policy from the backing file. Returns a PolicyLoadResult with the // results of the fetch. -policy::PolicyLoadResult LoadPolicyFromDisk(const FilePath& path) { +policy::PolicyLoadResult LoadPolicyFromDisk(const base::FilePath& path) { policy::PolicyLoadResult result; // If the backing file does not exist, just return. if (!file_util::PathExists(path)) { @@ -68,7 +69,7 @@ policy::PolicyLoadResult LoadPolicyFromDisk(const FilePath& path) { // Stores policy to the backing file (must be called via a task on // the FILE thread). -void StorePolicyToDiskOnFileThread(const FilePath& path, +void StorePolicyToDiskOnFileThread(const base::FilePath& path, const em::PolicyFetchResponse& policy) { DVLOG(1) << "Storing policy to " << path.value(); DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::FILE)); @@ -92,7 +93,7 @@ void StorePolicyToDiskOnFileThread(const FilePath& path, } // namespace UserCloudPolicyStore::UserCloudPolicyStore(Profile* profile, - const FilePath& path) + const base::FilePath& path) : ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)), profile_(profile), backing_file_path_(path) { @@ -103,7 +104,7 @@ UserCloudPolicyStore::~UserCloudPolicyStore() {} // static scoped_ptr<UserCloudPolicyStore> UserCloudPolicyStore::Create( Profile* profile) { - FilePath path = + base::FilePath path = profile->GetPath().Append(kPolicyDir).Append(kPolicyCacheFile); return make_scoped_ptr(new UserCloudPolicyStore(profile, path)); } diff --git a/chrome/browser/policy/user_cloud_policy_store.h b/chrome/browser/policy/user_cloud_policy_store.h index 3702a89..79aa1b4 100644 --- a/chrome/browser/policy/user_cloud_policy_store.h +++ b/chrome/browser/policy/user_cloud_policy_store.h @@ -24,7 +24,7 @@ class UserCloudPolicyStore : public UserCloudPolicyStoreBase { public: // Creates a policy store associated with the user signed in to this // |profile|. - UserCloudPolicyStore(Profile* profile, const FilePath& policy_file); + UserCloudPolicyStore(Profile* profile, const base::FilePath& policy_file); virtual ~UserCloudPolicyStore(); // Factory method for creating a UserCloudPolicyStore for |profile|. @@ -72,7 +72,7 @@ class UserCloudPolicyStore : public UserCloudPolicyStoreBase { Profile* profile_; // Path to file where we store persisted policy. - FilePath backing_file_path_; + base::FilePath backing_file_path_; DISALLOW_COPY_AND_ASSIGN(UserCloudPolicyStore); }; diff --git a/chrome/browser/policy/user_cloud_policy_store_chromeos.cc b/chrome/browser/policy/user_cloud_policy_store_chromeos.cc index 419a3f2..07c247a 100644 --- a/chrome/browser/policy/user_cloud_policy_store_chromeos.cc +++ b/chrome/browser/policy/user_cloud_policy_store_chromeos.cc @@ -25,11 +25,12 @@ namespace policy { namespace { // Subdirectory in the user's profile for storing user policies. -const FilePath::CharType kPolicyDir[] = FILE_PATH_LITERAL("Device Management"); +const base::FilePath::CharType kPolicyDir[] = + FILE_PATH_LITERAL("Device Management"); // File in the above directory for stroing user policy dmtokens. -const FilePath::CharType kTokenCacheFile[] = FILE_PATH_LITERAL("Token"); +const base::FilePath::CharType kTokenCacheFile[] = FILE_PATH_LITERAL("Token"); // File in the above directory for storing user policy data. -const FilePath::CharType kPolicyCacheFile[] = FILE_PATH_LITERAL("Policy"); +const base::FilePath::CharType kPolicyCacheFile[] = FILE_PATH_LITERAL("Policy"); } // namespace @@ -42,8 +43,8 @@ class LegacyPolicyCacheLoader : public UserPolicyTokenLoader::Delegate, CloudPolicyStore::Status, scoped_ptr<em::PolicyFetchResponse>)> Callback; - LegacyPolicyCacheLoader(const FilePath& token_cache_file, - const FilePath& policy_cache_file); + LegacyPolicyCacheLoader(const base::FilePath& token_cache_file, + const base::FilePath& policy_cache_file); virtual ~LegacyPolicyCacheLoader(); // Starts loading, and reports the result to |callback| when done. @@ -84,8 +85,8 @@ class LegacyPolicyCacheLoader : public UserPolicyTokenLoader::Delegate, }; LegacyPolicyCacheLoader::LegacyPolicyCacheLoader( - const FilePath& token_cache_file, - const FilePath& policy_cache_file) + const base::FilePath& token_cache_file, + const base::FilePath& policy_cache_file) : ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)), has_policy_(false), status_(CloudPolicyStore::STATUS_OK) { @@ -148,8 +149,8 @@ CloudPolicyStore::Status LegacyPolicyCacheLoader::TranslateLoadResult( UserCloudPolicyStoreChromeOS::UserCloudPolicyStoreChromeOS( chromeos::SessionManagerClient* session_manager_client, const std::string& username, - const FilePath& legacy_token_cache_file, - const FilePath& legacy_policy_cache_file) + const base::FilePath& legacy_token_cache_file, + const base::FilePath& legacy_policy_cache_file) : session_manager_client_(session_manager_client), username_(username), ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)), @@ -341,7 +342,8 @@ void UserCloudPolicyStoreChromeOS::InstallLegacyTokens( } // static -void UserCloudPolicyStoreChromeOS::RemoveLegacyCacheDir(const FilePath& dir) { +void UserCloudPolicyStoreChromeOS::RemoveLegacyCacheDir( + const base::FilePath& dir) { if (file_util::PathExists(dir) && !file_util::Delete(dir, true)) LOG(ERROR) << "Failed to remove cache dir " << dir.value(); } diff --git a/chrome/browser/policy/user_cloud_policy_store_chromeos.h b/chrome/browser/policy/user_cloud_policy_store_chromeos.h index 0473a42..c84b3b5 100644 --- a/chrome/browser/policy/user_cloud_policy_store_chromeos.h +++ b/chrome/browser/policy/user_cloud_policy_store_chromeos.h @@ -35,8 +35,8 @@ class UserCloudPolicyStoreChromeOS : public UserCloudPolicyStoreBase { UserCloudPolicyStoreChromeOS( chromeos::SessionManagerClient* session_manager_client, const std::string& username, - const FilePath& legacy_token_cache_file, - const FilePath& legacy_policy_cache_file); + const base::FilePath& legacy_token_cache_file, + const base::FilePath& legacy_policy_cache_file); virtual ~UserCloudPolicyStoreChromeOS(); // CloudPolicyStore: @@ -81,7 +81,7 @@ class UserCloudPolicyStoreChromeOS : public UserCloudPolicyStoreBase { const std::string& device_id); // Removes the passed-in legacy cache directory. - static void RemoveLegacyCacheDir(const FilePath& dir); + static void RemoveLegacyCacheDir(const base::FilePath& dir); chromeos::SessionManagerClient* session_manager_client_; const std::string username_; @@ -90,7 +90,7 @@ class UserCloudPolicyStoreChromeOS : public UserCloudPolicyStoreBase { // TODO(mnissler): Remove all the legacy policy support members below after // the number of pre-M20 clients drops back to zero. - FilePath legacy_cache_dir_; + base::FilePath legacy_cache_dir_; scoped_ptr<LegacyPolicyCacheLoader> legacy_loader_; bool legacy_caches_loaded_; diff --git a/chrome/browser/policy/user_cloud_policy_store_chromeos_unittest.cc b/chrome/browser/policy/user_cloud_policy_store_chromeos_unittest.cc index 3a3aebd..b42c934 100644 --- a/chrome/browser/policy/user_cloud_policy_store_chromeos_unittest.cc +++ b/chrome/browser/policy/user_cloud_policy_store_chromeos_unittest.cc @@ -94,11 +94,11 @@ class UserCloudPolicyStoreChromeOSTest : public testing::Test { EXPECT_TRUE(base::FundamentalValue(true).Equals(entry->value)); } - FilePath token_file() { + base::FilePath token_file() { return tmp_dir_.path().AppendASCII("token"); } - FilePath policy_file() { + base::FilePath policy_file() { return tmp_dir_.path().AppendASCII("policy"); } diff --git a/chrome/browser/policy/user_cloud_policy_store_unittest.cc b/chrome/browser/policy/user_cloud_policy_store_unittest.cc index ec651e9..6391d71 100644 --- a/chrome/browser/policy/user_cloud_policy_store_unittest.cc +++ b/chrome/browser/policy/user_cloud_policy_store_unittest.cc @@ -60,7 +60,7 @@ class UserCloudPolicyStoreTest : public testing::Test { RunUntilIdle(); } - FilePath policy_file() { + base::FilePath policy_file() { return tmp_dir_.path().AppendASCII("policy"); } diff --git a/chrome/browser/policy/user_policy_disk_cache.cc b/chrome/browser/policy/user_policy_disk_cache.cc index 4b08836..f20d06b 100644 --- a/chrome/browser/policy/user_policy_disk_cache.cc +++ b/chrome/browser/policy/user_policy_disk_cache.cc @@ -40,7 +40,7 @@ UserPolicyDiskCache::Delegate::~Delegate() {} UserPolicyDiskCache::UserPolicyDiskCache( const base::WeakPtr<Delegate>& delegate, - const FilePath& backing_file_path) + const base::FilePath& backing_file_path) : delegate_(delegate), backing_file_path_(backing_file_path) {} diff --git a/chrome/browser/policy/user_policy_disk_cache.h b/chrome/browser/policy/user_policy_disk_cache.h index 42fcdd6..346b7dc 100644 --- a/chrome/browser/policy/user_policy_disk_cache.h +++ b/chrome/browser/policy/user_policy_disk_cache.h @@ -44,7 +44,7 @@ class UserPolicyDiskCache }; UserPolicyDiskCache(const base::WeakPtr<Delegate>& delegate, - const FilePath& backing_file_path); + const base::FilePath& backing_file_path); // Starts reading the policy cache from disk. Passes the read policy // information back to the hosting UserPolicyCache after a successful cache @@ -75,7 +75,7 @@ class UserPolicyDiskCache const enterprise_management::CachedCloudPolicyResponse& policy); base::WeakPtr<Delegate> delegate_; - const FilePath backing_file_path_; + const base::FilePath backing_file_path_; DISALLOW_COPY_AND_ASSIGN(UserPolicyDiskCache); }; diff --git a/chrome/browser/policy/user_policy_token_loader.cc b/chrome/browser/policy/user_policy_token_loader.cc index 0891d00..b4df896 100644 --- a/chrome/browser/policy/user_policy_token_loader.cc +++ b/chrome/browser/policy/user_policy_token_loader.cc @@ -39,7 +39,7 @@ UserPolicyTokenLoader::Delegate::~Delegate() {} UserPolicyTokenLoader::UserPolicyTokenLoader( const base::WeakPtr<Delegate>& delegate, - const FilePath& cache_file) + const base::FilePath& cache_file) : delegate_(delegate), cache_file_(cache_file) {} diff --git a/chrome/browser/policy/user_policy_token_loader.h b/chrome/browser/policy/user_policy_token_loader.h index b73d784..7f32ead 100644 --- a/chrome/browser/policy/user_policy_token_loader.h +++ b/chrome/browser/policy/user_policy_token_loader.h @@ -30,7 +30,7 @@ class UserPolicyTokenLoader }; UserPolicyTokenLoader(const base::WeakPtr<Delegate>& delegate, - const FilePath& cache_file); + const base::FilePath& cache_file); // Starts loading the disk cache. After the load is finished, the result is // reported through the delegate. @@ -45,7 +45,7 @@ class UserPolicyTokenLoader const std::string& device_id); const base::WeakPtr<Delegate> delegate_; - const FilePath cache_file_; + const base::FilePath cache_file_; DISALLOW_COPY_AND_ASSIGN(UserPolicyTokenLoader); }; diff --git a/chrome/browser/popup_blocker_browsertest.cc b/chrome/browser/popup_blocker_browsertest.cc index 4d612b5..d229ee1 100644 --- a/chrome/browser/popup_blocker_browsertest.cc +++ b/chrome/browser/popup_blocker_browsertest.cc @@ -37,7 +37,8 @@ using content::WebContents; namespace { -static const FilePath::CharType* kTestDir = FILE_PATH_LITERAL("popup_blocker"); +static const base::FilePath::CharType* kTestDir = + FILE_PATH_LITERAL("popup_blocker"); class PopupBlockerBrowserTest : public InProcessBrowserTest { public: @@ -46,8 +47,8 @@ class PopupBlockerBrowserTest : public InProcessBrowserTest { // Returns a url that shows one popup. GURL GetTestURL() { return ui_test_utils::GetTestUrl( - FilePath(kTestDir), - FilePath(FILE_PATH_LITERAL("popup-blocked-to-post-blank.html"))); + base::FilePath(kTestDir), + base::FilePath(FILE_PATH_LITERAL("popup-blocked-to-post-blank.html"))); } std::vector<WebContents*> GetBlockedContents(Browser* browser) { @@ -113,8 +114,8 @@ IN_PROC_BROWSER_TEST_F(PopupBlockerBrowserTest, } IN_PROC_BROWSER_TEST_F(PopupBlockerBrowserTest, MultiplePopups) { - GURL url(ui_test_utils::GetTestUrl( - FilePath(kTestDir), FilePath(FILE_PATH_LITERAL("popup-many.html")))); + GURL url(ui_test_utils::GetTestUrl(base::FilePath( + kTestDir), base::FilePath(FILE_PATH_LITERAL("popup-many.html")))); ui_test_utils::NavigateToURL(browser(), url); std::vector<WebContents*> blocked_contents = GetBlockedContents(browser()); ASSERT_EQ(2u, blocked_contents.size()); @@ -138,8 +139,8 @@ IN_PROC_BROWSER_TEST_F(PopupBlockerBrowserTest, PopupsLaunchWhenTabIsClosed) { CommandLine::ForCurrentProcess()->AppendSwitch( switches::kDisablePopupBlocking); GURL url = ui_test_utils::GetTestUrl( - FilePath(kTestDir), - FilePath(FILE_PATH_LITERAL("popup-on-unload.html"))); + base::FilePath(kTestDir), + base::FilePath(FILE_PATH_LITERAL("popup-on-unload.html"))); ui_test_utils::NavigateToURL(browser(), url); NavigateAndCheckPopupShown(browser(), GURL(chrome::kAboutBlankURL)); diff --git a/chrome/browser/predictors/predictor_database.cc b/chrome/browser/predictors/predictor_database.cc index c2fb75b..346a7d1 100644 --- a/chrome/browser/predictors/predictor_database.cc +++ b/chrome/browser/predictors/predictor_database.cc @@ -24,7 +24,7 @@ using content::BrowserThread; namespace { // TODO(shishir): This should move to a more generic name. -const FilePath::CharType kPredictorDatabaseName[] = +const base::FilePath::CharType kPredictorDatabaseName[] = FILE_PATH_LITERAL("Network Action Predictor"); } // namespace @@ -52,7 +52,7 @@ class PredictorDatabaseInternal void SetCancelled(); bool is_resource_prefetch_predictor_enabled_; - FilePath db_path_; + base::FilePath db_path_; scoped_ptr<sql::Connection> db_; // TODO(shishir): These tables may not need to be refcounted. Maybe move them diff --git a/chrome/browser/prefs/chrome_pref_service_factory.cc b/chrome/browser/prefs/chrome_pref_service_factory.cc index 39de2d1..971b36e 100644 --- a/chrome/browser/prefs/chrome_pref_service_factory.cc +++ b/chrome/browser/prefs/chrome_pref_service_factory.cc @@ -54,7 +54,7 @@ void HandleReadError(PersistentPrefStore::PrefReadError error) { void PrepareBuilder( PrefServiceSyncableBuilder* builder, - const FilePath& pref_filename, + const base::FilePath& pref_filename, base::SequencedTaskRunner* pref_io_task_runner, policy::PolicyService* policy_service, const scoped_refptr<PrefStore>& extension_prefs, @@ -100,7 +100,7 @@ PrefServiceBase* PrefServiceBase::FromBrowserContext(BrowserContext* context) { namespace chrome_prefs { PrefService* CreateLocalState( - const FilePath& pref_filename, + const base::FilePath& pref_filename, base::SequencedTaskRunner* pref_io_task_runner, policy::PolicyService* policy_service, const scoped_refptr<PrefStore>& extension_prefs, @@ -117,7 +117,7 @@ PrefService* CreateLocalState( } PrefServiceSyncable* CreateProfilePrefs( - const FilePath& pref_filename, + const base::FilePath& pref_filename, base::SequencedTaskRunner* pref_io_task_runner, policy::PolicyService* policy_service, const scoped_refptr<PrefStore>& extension_prefs, diff --git a/chrome/browser/prefs/pref_service.cc b/chrome/browser/prefs/pref_service.cc index 5b5410a4..bd9c26f 100644 --- a/chrome/browser/prefs/pref_service.cc +++ b/chrome/browser/prefs/pref_service.cc @@ -164,15 +164,15 @@ std::string PrefService::GetString(const char* path) const { return result; } -FilePath PrefService::GetFilePath(const char* path) const { +base::FilePath PrefService::GetFilePath(const char* path) const { DCHECK(CalledOnValidThread()); - FilePath result; + base::FilePath result; const base::Value* value = GetPreferenceValue(path); if (!value) { NOTREACHED() << "Trying to read an unregistered pref: " << path; - return FilePath(result); + return base::FilePath(result); } bool rv = base::GetValueAsFilePath(*value, &result); DCHECK(rv); @@ -395,7 +395,7 @@ void PrefService::SetString(const char* path, const std::string& value) { SetUserPrefValue(path, Value::CreateStringValue(value)); } -void PrefService::SetFilePath(const char* path, const FilePath& value) { +void PrefService::SetFilePath(const char* path, const base::FilePath& value) { SetUserPrefValue(path, base::CreateFilePathValue(value)); } diff --git a/chrome/browser/prefs/pref_service_browsertest.cc b/chrome/browser/prefs/pref_service_browsertest.cc index ca3e1c6..3b6f712e 100644 --- a/chrome/browser/prefs/pref_service_browsertest.cc +++ b/chrome/browser/prefs/pref_service_browsertest.cc @@ -55,25 +55,25 @@ class PreferenceServiceTest : public InProcessBrowserTest { } virtual bool SetUpUserDataDirectory() OVERRIDE { - FilePath user_data_directory; + base::FilePath user_data_directory; PathService::Get(chrome::DIR_USER_DATA, &user_data_directory); - FilePath reference_pref_file; + base::FilePath reference_pref_file; if (new_profile_) { reference_pref_file = ui_test_utils::GetTestFilePath( - FilePath().AppendASCII("profiles"). + base::FilePath().AppendASCII("profiles"). AppendASCII("window_placement"). AppendASCII("Default"), - FilePath().Append(chrome::kPreferencesFilename)); + base::FilePath().Append(chrome::kPreferencesFilename)); tmp_pref_file_ = user_data_directory.AppendASCII(TestingProfile::kTestUserProfileDir); CHECK(file_util::CreateDirectory(tmp_pref_file_)); tmp_pref_file_ = tmp_pref_file_.Append(chrome::kPreferencesFilename); } else { reference_pref_file = ui_test_utils::GetTestFilePath( - FilePath().AppendASCII("profiles"). + base::FilePath().AppendASCII("profiles"). AppendASCII("window_placement"), - FilePath().Append(chrome::kLocalStateFilename)); + base::FilePath().Append(chrome::kLocalStateFilename)); tmp_pref_file_ = user_data_directory.Append(chrome::kLocalStateFilename); } @@ -92,7 +92,7 @@ class PreferenceServiceTest : public InProcessBrowserTest { } protected: - FilePath tmp_pref_file_; + base::FilePath tmp_pref_file_; private: bool new_profile_; diff --git a/chrome/browser/prefs/pref_service_builder.cc b/chrome/browser/prefs/pref_service_builder.cc index ff84b59..ada9f0f 100644 --- a/chrome/browser/prefs/pref_service_builder.cc +++ b/chrome/browser/prefs/pref_service_builder.cc @@ -61,7 +61,7 @@ PrefServiceBuilder& PrefServiceBuilder::WithReadErrorCallback( } PrefServiceBuilder& PrefServiceBuilder::WithUserFilePrefs( - const FilePath& prefs_file, + const base::FilePath& prefs_file, base::SequencedTaskRunner* task_runner) { user_prefs_ = new JsonPrefStore(prefs_file, task_runner); return *this; diff --git a/chrome/browser/prefs/pref_service_syncable.cc b/chrome/browser/prefs/pref_service_syncable.cc index bbb7f0e..cfa66b7 100644 --- a/chrome/browser/prefs/pref_service_syncable.cc +++ b/chrome/browser/prefs/pref_service_syncable.cc @@ -179,9 +179,10 @@ void PrefServiceSyncable::RegisterStringPref(const char* path, sync_status); } -void PrefServiceSyncable::RegisterFilePathPref(const char* path, - const FilePath& default_value, - PrefSyncStatus sync_status) { +void PrefServiceSyncable::RegisterFilePathPref( + const char* path, + const base::FilePath& default_value, + PrefSyncStatus sync_status) { RegisterSyncablePreference(path, Value::CreateStringValue(default_value.value()), sync_status); diff --git a/chrome/browser/prefs/pref_service_unittest.cc b/chrome/browser/prefs/pref_service_unittest.cc index f62cb6b..82e3fe0 100644 --- a/chrome/browser/prefs/pref_service_unittest.cc +++ b/chrome/browser/prefs/pref_service_unittest.cc @@ -306,7 +306,7 @@ class PrefServiceUserFilePrefsTest : public testing::Test { // The path to temporary directory used to contain the test operations. base::ScopedTempDir temp_dir_; // The path to the directory where the test data is stored. - FilePath data_dir_; + base::FilePath data_dir_; // A message loop that we can use as the file thread message loop. MessageLoop message_loop_; }; @@ -314,7 +314,7 @@ class PrefServiceUserFilePrefsTest : public testing::Test { // Verifies that ListValue and DictionaryValue pref with non emtpy default // preserves its empty value. TEST_F(PrefServiceUserFilePrefsTest, PreserveEmptyValue) { - FilePath pref_file = temp_dir_.path().AppendASCII("write.json"); + base::FilePath pref_file = temp_dir_.path().AppendASCII("write.json"); ASSERT_TRUE(file_util::CopyFile( data_dir_.AppendASCII("read.need_empty_value.json"), @@ -353,7 +353,7 @@ TEST_F(PrefServiceUserFilePrefsTest, PreserveEmptyValue) { message_loop_.RunUntilIdle(); // Compare to expected output. - FilePath golden_output_file = + base::FilePath golden_output_file = data_dir_.AppendASCII("write.golden.need_empty_value.json"); ASSERT_TRUE(file_util::PathExists(golden_output_file)); EXPECT_TRUE(file_util::TextContentsEqual(golden_output_file, pref_file)); diff --git a/chrome/browser/prerender/prerender_browsertest.cc b/chrome/browser/prerender/prerender_browsertest.cc index 418b465..5589d12 100644 --- a/chrome/browser/prerender/prerender_browsertest.cc +++ b/chrome/browser/prerender/prerender_browsertest.cc @@ -616,7 +616,7 @@ class PrerenderBrowserTest : virtual public InProcessBrowserTest { #if defined(OS_MACOSX) // The plugins directory isn't read by default on the Mac, so it needs to be // explicitly registered. - FilePath app_dir; + base::FilePath app_dir; PathService::Get(chrome::DIR_APP, &app_dir); command_line->AppendSwitchPath( switches::kExtraPluginDir, @@ -1008,9 +1008,9 @@ class PrerenderBrowserTest : virtual public InProcessBrowserTest { scoped_ptr<net::TestServer> https_src_server; if (use_https_src_server_) { https_src_server.reset( - new net::TestServer(net::TestServer::TYPE_HTTPS, - net::TestServer::kLocalhost, - FilePath(FILE_PATH_LITERAL("chrome/test/data")))); + new net::TestServer( + net::TestServer::TYPE_HTTPS, net::TestServer::kLocalhost, + base::FilePath(FILE_PATH_LITERAL("chrome/test/data")))); ASSERT_TRUE(https_src_server->Start()); src_server = https_src_server.get(); } @@ -1513,9 +1513,9 @@ IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, // Checks that a prerender for an https will prevent a prerender from happening. IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderHttps) { - net::TestServer https_server(net::TestServer::TYPE_HTTPS, - net::TestServer::kLocalhost, - FilePath(FILE_PATH_LITERAL("chrome/test/data"))); + net::TestServer https_server( + net::TestServer::TYPE_HTTPS, net::TestServer::kLocalhost, + base::FilePath(FILE_PATH_LITERAL("chrome/test/data"))); ASSERT_TRUE(https_server.Start()); GURL https_url = https_server.GetURL("files/prerender/prerender_page.html"); PrerenderTestURL(https_url, @@ -1526,9 +1526,9 @@ IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderHttps) { // Checks that client-issued redirects to an https page will cancel prerenders. IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderClientRedirectToHttps) { - net::TestServer https_server(net::TestServer::TYPE_HTTPS, - net::TestServer::kLocalhost, - FilePath(FILE_PATH_LITERAL("chrome/test/data"))); + net::TestServer https_server( + net::TestServer::TYPE_HTTPS, net::TestServer::kLocalhost, + base::FilePath(FILE_PATH_LITERAL("chrome/test/data"))); ASSERT_TRUE(https_server.Start()); GURL https_url = https_server.GetURL("files/prerender/prerender_page.html"); PrerenderTestURL(CreateClientRedirect(https_url.spec()), @@ -1561,9 +1561,9 @@ IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderClientRedirectInIframe) { // count as an "alias" for the prerendered page. IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderClientRedirectToHttpsInIframe) { - net::TestServer https_server(net::TestServer::TYPE_HTTPS, - net::TestServer::kLocalhost, - FilePath(FILE_PATH_LITERAL("chrome/test/data"))); + net::TestServer https_server( + net::TestServer::TYPE_HTTPS, net::TestServer::kLocalhost, + base::FilePath(FILE_PATH_LITERAL("chrome/test/data"))); ASSERT_TRUE(https_server.Start()); GURL https_url = https_server.GetURL("files/prerender/prerender_page.html"); std::string redirect_path = CreateClientRedirect(https_url.spec()); @@ -1619,9 +1619,9 @@ IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, // location will cancel prerendering. IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderServerRedirectToHttps) { - net::TestServer https_server(net::TestServer::TYPE_HTTPS, - net::TestServer::kLocalhost, - FilePath(FILE_PATH_LITERAL("chrome/test/data"))); + net::TestServer https_server( + net::TestServer::TYPE_HTTPS, net::TestServer::kLocalhost, + base::FilePath(FILE_PATH_LITERAL("chrome/test/data"))); ASSERT_TRUE(https_server.Start()); GURL https_url = https_server.GetURL("files/prerender/prerender_page.html"); PrerenderTestURL(CreateServerRedirect(https_url.spec()), @@ -1654,9 +1654,9 @@ IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderServerRedirectInIframe) { // count as an "alias" for the prerendered page. IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderServerRedirectToHttpsInIframe) { - net::TestServer https_server(net::TestServer::TYPE_HTTPS, - net::TestServer::kLocalhost, - FilePath(FILE_PATH_LITERAL("chrome/test/data"))); + net::TestServer https_server( + net::TestServer::TYPE_HTTPS, net::TestServer::kLocalhost, + base::FilePath(FILE_PATH_LITERAL("chrome/test/data"))); ASSERT_TRUE(https_server.Start()); GURL https_url = https_server.GetURL("files/prerender/prerender_page.html"); std::string redirect_path = CreateServerRedirect(https_url.spec()); @@ -2133,9 +2133,9 @@ IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderSSLErrorTopLevel) { net::TestServer::SSLOptions ssl_options; ssl_options.server_certificate = net::TestServer::SSLOptions::CERT_MISMATCHED_NAME; - net::TestServer https_server(net::TestServer::TYPE_HTTPS, - ssl_options, - FilePath(FILE_PATH_LITERAL("chrome/test/data"))); + net::TestServer https_server( + net::TestServer::TYPE_HTTPS, ssl_options, + base::FilePath(FILE_PATH_LITERAL("chrome/test/data"))); ASSERT_TRUE(https_server.Start()); GURL https_url = https_server.GetURL("files/prerender/prerender_page.html"); PrerenderTestURL(https_url, @@ -2150,9 +2150,9 @@ IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderSSLErrorSubresource) { net::TestServer::SSLOptions ssl_options; ssl_options.server_certificate = net::TestServer::SSLOptions::CERT_MISMATCHED_NAME; - net::TestServer https_server(net::TestServer::TYPE_HTTPS, - ssl_options, - FilePath(FILE_PATH_LITERAL("chrome/test/data"))); + net::TestServer https_server( + net::TestServer::TYPE_HTTPS, ssl_options, + base::FilePath(FILE_PATH_LITERAL("chrome/test/data"))); ASSERT_TRUE(https_server.Start()); GURL https_url = https_server.GetURL("files/prerender/image.jpeg"); std::vector<net::TestServer::StringPair> replacement_text; @@ -2174,9 +2174,9 @@ IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderSSLErrorIframe) { net::TestServer::SSLOptions ssl_options; ssl_options.server_certificate = net::TestServer::SSLOptions::CERT_MISMATCHED_NAME; - net::TestServer https_server(net::TestServer::TYPE_HTTPS, - ssl_options, - FilePath(FILE_PATH_LITERAL("chrome/test/data"))); + net::TestServer https_server( + net::TestServer::TYPE_HTTPS, ssl_options, + base::FilePath(FILE_PATH_LITERAL("chrome/test/data"))); ASSERT_TRUE(https_server.Start()); GURL https_url = https_server.GetURL( "files/prerender/prerender_embedded_content.html"); @@ -2224,9 +2224,9 @@ IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderSSLClientCertTopLevel) { net::TestServer::SSLOptions ssl_options; ssl_options.request_client_certificate = true; - net::TestServer https_server(net::TestServer::TYPE_HTTPS, - ssl_options, - FilePath(FILE_PATH_LITERAL("chrome/test/data"))); + net::TestServer https_server( + net::TestServer::TYPE_HTTPS, ssl_options, + base::FilePath(FILE_PATH_LITERAL("chrome/test/data"))); ASSERT_TRUE(https_server.Start()); GURL https_url = https_server.GetURL("files/prerender/prerender_page.html"); PrerenderTestURL(https_url, FINAL_STATUS_SSL_CLIENT_CERTIFICATE_REQUESTED, 1); @@ -2238,9 +2238,9 @@ IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderSSLClientCertSubresource) { net::TestServer::SSLOptions ssl_options; ssl_options.request_client_certificate = true; - net::TestServer https_server(net::TestServer::TYPE_HTTPS, - ssl_options, - FilePath(FILE_PATH_LITERAL("chrome/test/data"))); + net::TestServer https_server( + net::TestServer::TYPE_HTTPS, ssl_options, + base::FilePath(FILE_PATH_LITERAL("chrome/test/data"))); ASSERT_TRUE(https_server.Start()); GURL https_url = https_server.GetURL("files/prerender/image.jpeg"); std::vector<net::TestServer::StringPair> replacement_text; @@ -2261,9 +2261,9 @@ IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderSSLClientCertIframe) { net::TestServer::SSLOptions ssl_options; ssl_options.request_client_certificate = true; - net::TestServer https_server(net::TestServer::TYPE_HTTPS, - ssl_options, - FilePath(FILE_PATH_LITERAL("chrome/test/data"))); + net::TestServer https_server( + net::TestServer::TYPE_HTTPS, ssl_options, + base::FilePath(FILE_PATH_LITERAL("chrome/test/data"))); ASSERT_TRUE(https_server.Start()); GURL https_url = https_server.GetURL( "files/prerender/prerender_embedded_content.html"); diff --git a/chrome/browser/printing/cloud_print/cloud_print_proxy_service_unittest.cc b/chrome/browser/printing/cloud_print/cloud_print_proxy_service_unittest.cc index 58bda54..71e5abc 100644 --- a/chrome/browser/printing/cloud_print/cloud_print_proxy_service_unittest.cc +++ b/chrome/browser/printing/cloud_print/cloud_print_proxy_service_unittest.cc @@ -190,7 +190,7 @@ class CloudPrintProxyPolicyTest : public ::testing::Test { int return_code = 0; StartupBrowserCreator browser_creator; return StartupBrowserCreator::ProcessCmdLineImpl( - command_line, FilePath(), false, profile, + command_line, base::FilePath(), false, profile, StartupBrowserCreator::Profiles(), &return_code, &browser_creator); } diff --git a/chrome/browser/printing/cloud_print/test/cloud_print_policy_browsertest.cc b/chrome/browser/printing/cloud_print/test/cloud_print_policy_browsertest.cc index f7b63b6..5b09fbe 100644 --- a/chrome/browser/printing/cloud_print/test/cloud_print_policy_browsertest.cc +++ b/chrome/browser/printing/cloud_print/test/cloud_print_policy_browsertest.cc @@ -29,8 +29,8 @@ class CloudPrintPolicyTest : public InProcessBrowserTest { }; IN_PROC_BROWSER_TEST_F(CloudPrintPolicyTest, NormalPassedFlag) { - FilePath test_file_path = ui_test_utils::GetTestFilePath( - FilePath(), FilePath().AppendASCII("empty.html")); + base::FilePath test_file_path = ui_test_utils::GetTestFilePath( + base::FilePath(), base::FilePath().AppendASCII("empty.html")); CommandLine new_command_line(GetCommandLineForRelaunch()); new_command_line.AppendArgPath(test_file_path); diff --git a/chrome/browser/printing/cloud_print/test/cloud_print_proxy_process_browsertest.cc b/chrome/browser/printing/cloud_print/test/cloud_print_proxy_process_browsertest.cc index fc488bb..d0a390c 100644 --- a/chrome/browser/printing/cloud_print/test/cloud_print_proxy_process_browsertest.cc +++ b/chrome/browser/printing/cloud_print/test/cloud_print_proxy_process_browsertest.cc @@ -209,7 +209,7 @@ int CloudPrintMockService_Main(SetExpectationsCallback set_expectations) { CommandLine* cl = CommandLine::ForCurrentProcess(); if (!cl->HasSwitch(kTestExecutablePath)) return kMissingSwitch; - FilePath executable_path = cl->GetSwitchValuePath(kTestExecutablePath); + base::FilePath executable_path = cl->GetSwitchValuePath(kTestExecutablePath); EXPECT_FALSE(executable_path.empty()); MockLaunchd mock_launchd(executable_path, &main_message_loop, true, true); Launchd::ScopedInstance use_mock(&mock_launchd); @@ -310,7 +310,7 @@ class CloudPrintProxyPolicyStartupTest : public base::MultiProcessTest, int return_code = 0; StartupBrowserCreator browser_creator; return StartupBrowserCreator::ProcessCmdLineImpl( - command_line, FilePath(), false, profile, + command_line, base::FilePath(), false, profile, StartupBrowserCreator::Profiles(), &return_code, &browser_creator); } @@ -324,7 +324,7 @@ class CloudPrintProxyPolicyStartupTest : public base::MultiProcessTest, #if defined(OS_MACOSX) base::ScopedTempDir temp_dir_; - FilePath executable_path_, bundle_path_; + base::FilePath executable_path_, bundle_path_; scoped_ptr<MockLaunchd> mock_launchd_; scoped_ptr<Launchd::ScopedInstance> scoped_launchd_instance_; #endif diff --git a/chrome/browser/printing/print_dialog_cloud.cc b/chrome/browser/printing/print_dialog_cloud.cc index 831cb1f..7e1a9ae 100644 --- a/chrome/browser/printing/print_dialog_cloud.cc +++ b/chrome/browser/printing/print_dialog_cloud.cc @@ -206,7 +206,8 @@ CloudPrintDataSender::~CloudPrintDataSender() {} // by encoding it and prefixing it with the appropriate mime type. // Once that is done, kick off the next part of the task on the IO // thread. -void CloudPrintDataSender::ReadPrintDataFile(const FilePath& path_to_file) { +void CloudPrintDataSender::ReadPrintDataFile( + const base::FilePath& path_to_file) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); int64 file_size = 0; if (file_util::GetFileSize(path_to_file, &file_size) && file_size != 0) { @@ -258,7 +259,7 @@ void CloudPrintDataSender::SendPrintDataFile() { } -CloudPrintFlowHandler::CloudPrintFlowHandler(const FilePath& path_to_file, +CloudPrintFlowHandler::CloudPrintFlowHandler(const base::FilePath& path_to_file, const string16& print_job_title, const string16& print_ticket, const std::string& file_type, @@ -482,7 +483,7 @@ bool CloudPrintFlowHandler::NavigationToURLDidCloseDialog(const GURL& url) { CloudPrintWebDialogDelegate::CloudPrintWebDialogDelegate( content::BrowserContext* browser_context, gfx::NativeWindow modal_parent, - const FilePath& path_to_file, + const base::FilePath& path_to_file, const std::string& json_arguments, const string16& print_job_title, const string16& print_ticket, @@ -506,7 +507,7 @@ CloudPrintWebDialogDelegate::CloudPrintWebDialogDelegate( // For unit testing. CloudPrintWebDialogDelegate::CloudPrintWebDialogDelegate( - const FilePath& path_to_file, + const base::FilePath& path_to_file, CloudPrintFlowHandler* flow_handler, const std::string& json_arguments, bool delete_on_close) @@ -656,7 +657,7 @@ void CreatePrintDialogForBytesImpl(content::BrowserContext* browser_context, // TODO(abodenha@chromium.org) Writing the PDF to a file before printing // is wasteful. Modify the dialog flow to pull PDF data from memory. // See http://code.google.com/p/chromium/issues/detail?id=44093 - FilePath path; + base::FilePath path; if (file_util::CreateTemporaryFile(&path)) { file_util::WriteFile(path, reinterpret_cast<const char*>(data->front()), @@ -674,7 +675,7 @@ void CreatePrintDialogForBytesImpl(content::BrowserContext* browser_context, // Called from the UI thread, starts up the dialog. void CreateDialogImpl(content::BrowserContext* browser_context, gfx::NativeWindow modal_parent, - const FilePath& path_to_file, + const base::FilePath& path_to_file, const string16& print_job_title, const string16& print_ticket, const std::string& file_type, @@ -718,13 +719,13 @@ void CreateDialogImpl(content::BrowserContext* browser_context, void CreateDialogSigninImpl(content::BrowserContext* browser_context, gfx::NativeWindow modal_parent, const base::Closure& callback) { - CreateDialogImpl(browser_context, modal_parent, FilePath(), string16(), + CreateDialogImpl(browser_context, modal_parent, base::FilePath(), string16(), string16(), std::string(), false, true, callback); } void CreateDialogFullImpl(content::BrowserContext* browser_context, gfx::NativeWindow modal_parent, - const FilePath& path_to_file, + const base::FilePath& path_to_file, const string16& print_job_title, const string16& print_ticket, const std::string& file_type, @@ -737,7 +738,7 @@ void CreateDialogFullImpl(content::BrowserContext* browser_context, // Provides a runnable function to delete a file. -void Delete(const FilePath& file_path) { +void Delete(const base::FilePath& file_path) { file_util::Delete(file_path, false); } @@ -753,7 +754,7 @@ namespace print_dialog_cloud { // changing page setup parameters while the dialog is active. void CreatePrintDialogForFile(content::BrowserContext* browser_context, gfx::NativeWindow modal_parent, - const FilePath& path_to_file, + const base::FilePath& path_to_file, const string16& print_job_title, const string16& print_ticket, const std::string& file_type, @@ -801,7 +802,7 @@ void CreatePrintDialogForBytes(content::BrowserContext* browser_context, bool CreatePrintDialogFromCommandLine(const CommandLine& command_line) { DCHECK(command_line.HasSwitch(switches::kCloudPrintFile)); if (!command_line.GetSwitchValuePath(switches::kCloudPrintFile).empty()) { - FilePath cloud_print_file; + base::FilePath cloud_print_file; cloud_print_file = command_line.GetSwitchValuePath(switches::kCloudPrintFile); if (!cloud_print_file.empty()) { diff --git a/chrome/browser/printing/print_dialog_cloud_interative_uitest.cc b/chrome/browser/printing/print_dialog_cloud_interative_uitest.cc index a4d1c56..c2dfee7 100644 --- a/chrome/browser/printing/print_dialog_cloud_interative_uitest.cc +++ b/chrome/browser/printing/print_dialog_cloud_interative_uitest.cc @@ -50,9 +50,9 @@ class TestData { base::ThreadRestrictions::ScopedAllowIO allow_io; if (test_data_.empty()) { - FilePath test_data_directory; + base::FilePath test_data_directory; PathService::Get(chrome::DIR_TEST_DATA, &test_data_directory); - FilePath test_file = + base::FilePath test_file = test_data_directory.AppendASCII("printing/cloud_print_uitest.html"); file_util::ReadFileToString(test_file, &test_data_); } @@ -208,7 +208,7 @@ class PrintDialogCloudTest : public InProcessBrowserTest { } void CreateDialogForTest() { - FilePath path_to_pdf = + base::FilePath path_to_pdf = test_data_directory_.AppendASCII("printing/cloud_print_uitest.pdf"); BrowserThread::PostTask( BrowserThread::UI, FROM_HERE, @@ -233,7 +233,7 @@ class PrintDialogCloudTest : public InProcessBrowserTest { bool handler_added_; std::string scheme_; std::string host_name_; - FilePath test_data_directory_; + base::FilePath test_data_directory_; AutoQuitDelegate delegate_; }; diff --git a/chrome/browser/printing/print_dialog_cloud_internal.h b/chrome/browser/printing/print_dialog_cloud_internal.h index dbfc77b..3c4ec0d 100644 --- a/chrome/browser/printing/print_dialog_cloud_internal.h +++ b/chrome/browser/printing/print_dialog_cloud_internal.h @@ -72,7 +72,7 @@ class CloudPrintDataSender // information to the dialog renderer (on the IO thread). We know // that the WebUI pointer lifetime will outlast us, so we should be // good. - void ReadPrintDataFile(const FilePath& path_to_file); + void ReadPrintDataFile(const base::FilePath& path_to_file); void SendPrintDataFile(); // Cancels any ramining part of the task by clearing out the WebUI @@ -105,7 +105,7 @@ class CloudPrintWebDialogDelegate; class CloudPrintFlowHandler : public content::WebUIMessageHandler, public content::NotificationObserver { public: - CloudPrintFlowHandler(const FilePath& path_to_file, + CloudPrintFlowHandler(const base::FilePath& path_to_file, const string16& print_job_title, const string16& print_ticket, const std::string& file_type, @@ -143,7 +143,7 @@ class CloudPrintFlowHandler : public content::WebUIMessageHandler, CloudPrintWebDialogDelegate* dialog_delegate_; content::NotificationRegistrar registrar_; - FilePath path_to_file_; + base::FilePath path_to_file_; string16 print_job_title_; string16 print_ticket_; std::string file_type_; @@ -162,7 +162,7 @@ class CloudPrintWebDialogDelegate : public ui::WebDialogDelegate { public: CloudPrintWebDialogDelegate(content::BrowserContext* browser_context, gfx::NativeWindow modal_parent, - const FilePath& path_to_file, + const base::FilePath& path_to_file, const std::string& json_arguments, const string16& print_job_title, const string16& print_ticket, @@ -195,7 +195,7 @@ class CloudPrintWebDialogDelegate : public ui::WebDialogDelegate { friend class ::CloudPrintWebDialogDelegateTest; // For unit testing. - CloudPrintWebDialogDelegate(const FilePath& path_to_file, + CloudPrintWebDialogDelegate(const base::FilePath& path_to_file, CloudPrintFlowHandler* flow_handler, const std::string& json_arguments, bool delete_on_close); @@ -206,7 +206,7 @@ class CloudPrintWebDialogDelegate : public ui::WebDialogDelegate { CloudPrintFlowHandler* flow_handler_; gfx::NativeWindow modal_parent_; mutable bool owns_flow_handler_; - FilePath path_to_file_; + base::FilePath path_to_file_; bool keep_alive_when_non_modal_; // The parameters needed to display a modal web dialog. @@ -217,7 +217,7 @@ class CloudPrintWebDialogDelegate : public ui::WebDialogDelegate { void CreateDialogFullImpl(content::BrowserContext* browser_context, gfx::NativeWindow modal_parent, - const FilePath& path_to_file, + const base::FilePath& path_to_file, const string16& print_job_title, const string16& print_ticket, const std::string& file_type, @@ -226,7 +226,7 @@ void CreateDialogSigninImpl(content::BrowserContext* browser_context, gfx::NativeWindow modal_parent, const base::Closure& callback); -void Delete(const FilePath& path_to_file); +void Delete(const base::FilePath& path_to_file); } // namespace internal_cloud_print_helpers diff --git a/chrome/browser/printing/print_dialog_cloud_unittest.cc b/chrome/browser/printing/print_dialog_cloud_unittest.cc index 9e976c9..23d702d 100644 --- a/chrome/browser/printing/print_dialog_cloud_unittest.cc +++ b/chrome/browser/printing/print_dialog_cloud_unittest.cc @@ -50,24 +50,24 @@ static const char* const kMockJobTitle = "Mock Job Title"; static const char* const kMockPrintTicket = "Resolution=300"; -FilePath GetTestDataFileName() { - FilePath test_data_directory; +base::FilePath GetTestDataFileName() { + base::FilePath test_data_directory; PathService::Get(chrome::DIR_TEST_DATA, &test_data_directory); - FilePath test_file = test_data_directory.AppendASCII(kPDFTestFile); + base::FilePath test_file = test_data_directory.AppendASCII(kPDFTestFile); return test_file; } -FilePath GetEmptyDataFileName() { - FilePath test_data_directory; +base::FilePath GetEmptyDataFileName() { + base::FilePath test_data_directory; PathService::Get(chrome::DIR_TEST_DATA, &test_data_directory); - FilePath test_file = test_data_directory.AppendASCII(kEmptyPDFTestFile); + base::FilePath test_file = test_data_directory.AppendASCII(kEmptyPDFTestFile); return test_file; } char* GetTestData() { static std::string sTestFileData; if (sTestFileData.empty()) { - FilePath test_file = GetTestDataFileName(); + base::FilePath test_file = GetTestDataFileName(); file_util::ReadFileToString(test_file, &sTestFileData); } return &sTestFileData[0]; @@ -90,7 +90,7 @@ class MockCloudPrintFlowHandler : public CloudPrintFlowHandler, public base::SupportsWeakPtr<MockCloudPrintFlowHandler> { public: - MockCloudPrintFlowHandler(const FilePath& path, + MockCloudPrintFlowHandler(const base::FilePath& path, const string16& title, const string16& print_ticket, const std::string& file_type, @@ -255,7 +255,7 @@ TEST_F(CloudPrintDataSenderTest, CanSend) { CallJavascriptFunction(_, _, StringValueEq(&mock_job_title))). WillOnce(Return()); - FilePath test_data_file_name = GetTestDataFileName(); + base::FilePath test_data_file_name = GetTestDataFileName(); BrowserThread::PostTask( BrowserThread::FILE, FROM_HERE, base::Bind(&CloudPrintDataSender::ReadPrintDataFile, @@ -267,9 +267,9 @@ TEST_F(CloudPrintDataSenderTest, BadFile) { EXPECT_CALL(*mock_helper_, CallJavascriptFunction(_, _, _)).Times(0); #if defined(OS_WIN) - FilePath bad_data_file_name(L"/some/file/that/isnot/there"); + base::FilePath bad_data_file_name(L"/some/file/that/isnot/there"); #else - FilePath bad_data_file_name("/some/file/that/isnot/there"); + base::FilePath bad_data_file_name("/some/file/that/isnot/there"); #endif BrowserThread::PostTask( BrowserThread::FILE, FROM_HERE, @@ -281,7 +281,7 @@ TEST_F(CloudPrintDataSenderTest, BadFile) { TEST_F(CloudPrintDataSenderTest, EmptyFile) { EXPECT_CALL(*mock_helper_, CallJavascriptFunction(_, _, _)).Times(0); - FilePath empty_data_file_name = GetEmptyDataFileName(); + base::FilePath empty_data_file_name = GetEmptyDataFileName(); BrowserThread::PostTask( BrowserThread::FILE, FROM_HERE, base::Bind(&CloudPrintDataSender::ReadPrintDataFile, @@ -306,7 +306,7 @@ class CloudPrintWebDialogDelegateTest : public testing::Test { protected: virtual void SetUp() { - FilePath mock_path; + base::FilePath mock_path; string16 mock_title; string16 mock_print_ticket; std::string mock_file_type; diff --git a/chrome/browser/printing/print_dialog_gtk.h b/chrome/browser/printing/print_dialog_gtk.h index 2da7e78..587576e 100644 --- a/chrome/browser/printing/print_dialog_gtk.h +++ b/chrome/browser/printing/print_dialog_gtk.h @@ -84,7 +84,7 @@ class PrintDialogGtk GtkPageSetup* page_setup_; GtkPrinter* printer_; - FilePath path_to_pdf_; + base::FilePath path_to_pdf_; DISALLOW_COPY_AND_ASSIGN(PrintDialogGtk); }; diff --git a/chrome/browser/printing/print_preview_dialog_controller.cc b/chrome/browser/printing/print_preview_dialog_controller.cc index 53e4adf..eca9a5e 100644 --- a/chrome/browser/printing/print_preview_dialog_controller.cc +++ b/chrome/browser/printing/print_preview_dialog_controller.cc @@ -55,7 +55,7 @@ namespace { void EnableInternalPDFPluginForTab(WebContents* preview_tab) { // Always enable the internal PDF plugin for the print preview page. - FilePath pdf_plugin_path; + base::FilePath pdf_plugin_path; if (!PathService::Get(chrome::FILE_PDF_PLUGIN, &pdf_plugin_path)) return; diff --git a/chrome/browser/printing/print_system_task_proxy.h b/chrome/browser/printing/print_system_task_proxy.h index 1eab9cb..33c6945 100644 --- a/chrome/browser/printing/print_system_task_proxy.h +++ b/chrome/browser/printing/print_system_task_proxy.h @@ -34,8 +34,9 @@ namespace printing_internal { // |options| will be updated if the custom settings for |printer_name| are // found, otherwise nothing is done. // NOTE: This function is declared here so it can be exposed for unit testing. -void parse_lpoptions(const FilePath& filepath, const std::string& printer_name, - int* num_options, cups_option_t** options); +void parse_lpoptions(const base::FilePath& filepath, + const std::string& printer_name, int* num_options, + cups_option_t** options); } // namespace printing_internal #endif diff --git a/chrome/browser/printing/printer_manager_dialog_win.cc b/chrome/browser/printing/printer_manager_dialog_win.cc index 1a1121c..a1c0442 100644 --- a/chrome/browser/printing/printer_manager_dialog_win.cc +++ b/chrome/browser/printing/printer_manager_dialog_win.cc @@ -20,10 +20,10 @@ namespace printing { // A helper callback that opens the printer management dialog. void OpenPrintersDialogCallback() { - FilePath sys_dir; + base::FilePath sys_dir; PathService::Get(base::DIR_SYSTEM, &sys_dir); - FilePath rundll32 = sys_dir.AppendASCII("rundll32.exe"); - FilePath shell32dll = sys_dir.AppendASCII("shell32.dll"); + base::FilePath rundll32 = sys_dir.AppendASCII("rundll32.exe"); + base::FilePath shell32dll = sys_dir.AppendASCII("shell32.dll"); std::wstring args(shell32dll.value()); args.append(L",SHHelpShortcuts_RunDLL PrintersFolder"); diff --git a/chrome/browser/printing/printing_layout_browsertest.cc b/chrome/browser/printing/printing_layout_browsertest.cc index df54494..278a7f6 100644 --- a/chrome/browser/printing/printing_layout_browsertest.cc +++ b/chrome/browser/printing/printing_layout_browsertest.cc @@ -39,7 +39,7 @@ class PrintingLayoutTest : public PrintingTest<InProcessBrowserTest>, public content::NotificationObserver { public: PrintingLayoutTest() { - FilePath browser_directory; + base::FilePath browser_directory; PathService::Get(chrome::DIR_APP, &browser_directory); emf_path_ = browser_directory.AppendASCII("metafile_dumps"); } @@ -110,18 +110,19 @@ class PrintingLayoutTest : public PrintingTest<InProcessBrowserTest>, // data pixels and returns the percentage of different pixels; 0 for success, // [0, 100] for failure. double CompareWithResult(const std::wstring& verification_name) { - FilePath test_result(ScanFiles(verification_name)); + base::FilePath test_result(ScanFiles(verification_name)); if (test_result.value().empty()) { // 100% different, the print job buffer is not there. return 100.; } - FilePath base_path(ui_test_utils::GetTestFilePath( - FilePath().AppendASCII("printing"), FilePath())); - FilePath emf(base_path.Append(verification_name + L".emf")); - FilePath png(base_path.Append(verification_name + L".png")); + base::FilePath base_path(ui_test_utils::GetTestFilePath( + base::FilePath().AppendASCII("printing"), base::FilePath())); + base::FilePath emf(base_path.Append(verification_name + L".emf")); + base::FilePath png(base_path.Append(verification_name + L".png")); - FilePath cleartype(base_path.Append(verification_name + L"_cleartype.png")); + base::FilePath cleartype( + base_path.Append(verification_name + L"_cleartype.png")); // Looks for Cleartype override. if (file_util::PathExists(cleartype) && IsClearTypeEnabled()) png = cleartype; @@ -145,7 +146,8 @@ class PrintingLayoutTest : public PrintingTest<InProcessBrowserTest>, " result size:" << test_content.size().ToString(); if (diff_emf) { // Backup the result emf file. - FilePath failed(base_path.Append(verification_name + L"_failed.emf")); + base::FilePath failed( + base_path.Append(verification_name + L"_failed.emf")); file_util::CopyFile(test_result, failed); } @@ -157,7 +159,7 @@ class PrintingLayoutTest : public PrintingTest<InProcessBrowserTest>, " result size:" << test_content.size().ToString(); if (diff_png) { // Backup the rendered emf file to detect the rendering difference. - FilePath rendering( + base::FilePath rendering( base_path.Append(verification_name + L"_rendering.png")); emf_content.SaveToPng(rendering); } @@ -199,7 +201,7 @@ class PrintingLayoutTest : public PrintingTest<InProcessBrowserTest>, prn_file.clear(); found_emf = false; found_prn = false; - FilePath file; + base::FilePath file; while (!(file = enumerator.Next()).empty()) { std::wstring ext = file.Extension(); if (base::strcasecmp(WideToUTF8(ext).c_str(), ".emf") == 0) { @@ -234,7 +236,7 @@ class PrintingLayoutTest : public PrintingTest<InProcessBrowserTest>, return CommandLine::ForCurrentProcess()->HasSwitch(kGenerateSwitch); } - FilePath emf_path_; + base::FilePath emf_path_; content::NotificationRegistrar registrar_; DISALLOW_COPY_AND_ASSIGN(PrintingLayoutTest); diff --git a/chrome/browser/printing/printing_message_filter.cc b/chrome/browser/printing/printing_message_filter.cc index 6dac5a9..11234121 100644 --- a/chrome/browser/printing/printing_message_filter.cc +++ b/chrome/browser/printing/printing_message_filter.cc @@ -35,7 +35,7 @@ using content::BrowserThread; namespace { #if defined(OS_CHROMEOS) -typedef std::map<int, FilePath> SequenceToPathMap; +typedef std::map<int, base::FilePath> SequenceToPathMap; struct PrintingSequencePathMap { SequenceToPathMap map; @@ -146,7 +146,7 @@ void PrintingMessageFilter::OnAllocateTempFileForPrinting( SequenceToPathMap* map = &g_printing_file_descriptor_map.Get().map; *sequence_number = g_printing_file_descriptor_map.Get().sequence++; - FilePath path; + base::FilePath path; if (file_util::CreateTemporaryFile(&path)) { int fd = open(path.value().c_str(), O_WRONLY); if (fd >= 0) { @@ -182,8 +182,9 @@ void PrintingMessageFilter::OnTempFileForPrintingWritten(int render_view_id, map->erase(it); } -void PrintingMessageFilter::CreatePrintDialogForFile(int render_view_id, - const FilePath& path) { +void PrintingMessageFilter::CreatePrintDialogForFile( + int render_view_id, + const base::FilePath& path) { content::WebContents* wc = GetWebContentsForRenderView(render_view_id); print_dialog_cloud::CreatePrintDialogForFile( wc->GetBrowserContext(), diff --git a/chrome/browser/process_info_snapshot_mac.cc b/chrome/browser/process_info_snapshot_mac.cc index 99a21ab..3978415 100644 --- a/chrome/browser/process_info_snapshot_mac.cc +++ b/chrome/browser/process_info_snapshot_mac.cc @@ -126,7 +126,7 @@ static bool ConvertByteUnitToScale(char unit, uint64_t* out_scale) { static bool GetProcessMemoryInfoUsingPS( const std::vector<base::ProcessId>& pid_list, std::map<int,ProcessInfoSnapshot::ProcInfoEntry>& proc_info_entries) { - const FilePath kProgram("/bin/ps"); + const base::FilePath kProgram("/bin/ps"); CommandLine command_line(kProgram); // Get resident set size, virtual memory size. @@ -187,7 +187,7 @@ static bool GetProcessMemoryInfoUsingPS( static bool GetProcessMemoryInfoUsingTop( std::map<int,ProcessInfoSnapshot::ProcInfoEntry>& proc_info_entries) { - const FilePath kProgram("/usr/bin/top"); + const base::FilePath kProgram("/usr/bin/top"); CommandLine command_line(kProgram); // -stats tells top to print just the given fields as ordered. diff --git a/chrome/browser/process_singleton.h b/chrome/browser/process_singleton.h index be19e04..12ed1ab 100644 --- a/chrome/browser/process_singleton.h +++ b/chrome/browser/process_singleton.h @@ -56,11 +56,11 @@ class ProcessSingleton : public base::NonThreadSafe { // Chrome process was launched. Return true if the command line will be // handled within the current browser instance or false if the remote process // should handle it (i.e., because the current process is shutting down). - typedef base::Callback< - bool(const CommandLine& command_line, const FilePath& current_directory)> - NotificationCallback; + typedef base::Callback<bool( + const CommandLine& command_line, + const base::FilePath& current_directory)> NotificationCallback; - explicit ProcessSingleton(const FilePath& user_data_dir); + explicit ProcessSingleton(const base::FilePath& user_data_dir); ~ProcessSingleton(); // Notify another process, if available. Otherwise sets ourselves as the @@ -130,7 +130,7 @@ class ProcessSingleton : public base::NonThreadSafe { // this timeout to be short. NotifyResult NotifyOtherProcessWithTimeout(const CommandLine& command_line, int timeout_seconds, - bool kill_unresponsive); + bool kill_unresponsive); NotifyResult NotifyOtherProcessWithTimeoutOrCreate( const CommandLine& command_line, const NotificationCallback& notification_callback, @@ -141,7 +141,8 @@ class ProcessSingleton : public base::NonThreadSafe { #endif // defined(OS_LINUX) || defined(OS_OPENBSD) private: - typedef std::pair<CommandLine::StringVector, FilePath> DelayedStartupMessage; + typedef std::pair<CommandLine::StringVector, + base::FilePath> DelayedStartupMessage; #if !defined(OS_MACOSX) // Timeout for the current browser process to respond. 20 seconds should be @@ -157,13 +158,13 @@ class ProcessSingleton : public base::NonThreadSafe { // This ugly behemoth handles startup commands sent from another process. LRESULT OnCopyData(HWND hwnd, const COPYDATASTRUCT* cds); - bool EscapeVirtualization(const FilePath& user_data_dir); + bool EscapeVirtualization(const base::FilePath& user_data_dir); HWND remote_window_; // The HWND_MESSAGE of another browser. HWND window_; // The HWND_MESSAGE window. bool is_virtualized_; // Stuck inside Microsoft Softricity VM environment. HANDLE lock_file_; - FilePath user_data_dir_; + base::FilePath user_data_dir_; #elif defined(OS_LINUX) || defined(OS_OPENBSD) // Return true if the given pid is one of our child processes. // Assumes that the current pid is the root of all pids of the current @@ -188,13 +189,13 @@ class ProcessSingleton : public base::NonThreadSafe { base::Callback<void(int)> kill_callback_; // Path in file system to the socket. - FilePath socket_path_; + base::FilePath socket_path_; // Path in file system to the lock. - FilePath lock_path_; + base::FilePath lock_path_; // Path in file system to the cookie file. - FilePath cookie_path_; + base::FilePath cookie_path_; // Temporary directory to hold the socket. base::ScopedTempDir socket_dir_; @@ -205,7 +206,7 @@ class ProcessSingleton : public base::NonThreadSafe { scoped_refptr<LinuxWatcher> watcher_; #elif defined(OS_MACOSX) // Path in file system to the lock. - FilePath lock_path_; + base::FilePath lock_path_; // File descriptor associated with the lockfile, valid between // |Create()| and |Cleanup()|. Two instances cannot have a lock on diff --git a/chrome/browser/process_singleton_browsertest.cc b/chrome/browser/process_singleton_browsertest.cc index 9ba9c03..9cb284c 100644 --- a/chrome/browser/process_singleton_browsertest.cc +++ b/chrome/browser/process_singleton_browsertest.cc @@ -35,7 +35,7 @@ namespace { // base::Bind to run the StartChrome methods in many threads. class ChromeStarter : public base::RefCountedThreadSafe<ChromeStarter> { public: - ChromeStarter(base::TimeDelta timeout, const FilePath& user_data_dir) + ChromeStarter(base::TimeDelta timeout, const base::FilePath& user_data_dir) : ready_event_(false /* manual */, false /* signaled */), done_event_(false /* manual */, false /* signaled */), process_handle_(base::kNullProcessHandle), @@ -58,7 +58,7 @@ class ChromeStarter : public base::RefCountedThreadSafe<ChromeStarter> { void StartChrome(base::WaitableEvent* start_event, bool first_run) { // TODO(mattm): maybe stuff should be refactored to use // UITest::LaunchBrowserHelper somehow? - FilePath program; + base::FilePath program; ASSERT_TRUE(PathService::Get(base::FILE_EXE, &program)); CommandLine command_line(program); command_line.AppendSwitchPath(switches::kUserDataDir, user_data_dir_); @@ -121,7 +121,7 @@ class ChromeStarter : public base::RefCountedThreadSafe<ChromeStarter> { } base::TimeDelta timeout_; - FilePath user_data_dir_; + base::FilePath user_data_dir_; DISALLOW_COPY_AND_ASSIGN(ChromeStarter); }; @@ -188,9 +188,9 @@ class ProcessSingletonTest : public InProcessBrowserTest { // But don't try more than kNbTries times... static const int kNbTries = 10; int num_tries = 0; - FilePath program; + base::FilePath program; ASSERT_TRUE(PathService::Get(base::FILE_EXE, &program)); - FilePath::StringType exe_name = program.BaseName().value(); + base::FilePath::StringType exe_name = program.BaseName().value(); while (base::GetProcessCount(exe_name, &process_tree_filter) > 0 && num_tries++ < kNbTries) { base::KillProcesses(exe_name, kExitCode, &process_tree_filter); diff --git a/chrome/browser/process_singleton_linux.cc b/chrome/browser/process_singleton_linux.cc index 253aaf0..a077861 100644 --- a/chrome/browser/process_singleton_linux.cc +++ b/chrome/browser/process_singleton_linux.cc @@ -231,8 +231,8 @@ void SetupSocket(const std::string& path, int* sock, struct sockaddr_un* addr) { } // Read a symbolic link, return empty string if given path is not a symbol link. -FilePath ReadLink(const FilePath& path) { - FilePath target; +base::FilePath ReadLink(const base::FilePath& path) { + base::FilePath target; if (!file_util::ReadSymbolicLink(path, &target)) { // The only errno that should occur is ENOENT. if (errno != 0 && errno != ENOENT) @@ -242,7 +242,7 @@ FilePath ReadLink(const FilePath& path) { } // Unlink a path. Return true on success. -bool UnlinkPath(const FilePath& path) { +bool UnlinkPath(const base::FilePath& path) { int rv = unlink(path.value().c_str()); if (rv < 0 && errno != ENOENT) PLOG(ERROR) << "Failed to unlink " << path.value(); @@ -251,7 +251,7 @@ bool UnlinkPath(const FilePath& path) { } // Create a symlink. Returns true on success. -bool SymlinkPath(const FilePath& target, const FilePath& path) { +bool SymlinkPath(const base::FilePath& target, const base::FilePath& path) { if (!file_util::CreateSymbolicLink(target, path)) { // Double check the value in case symlink suceeded but we got an incorrect // failure due to NFS packet loss & retry. @@ -269,7 +269,7 @@ bool SymlinkPath(const FilePath& target, const FilePath& path) { // Extract the hostname and pid from the lock symlink. // Returns true if the lock existed. -bool ParseLockPath(const FilePath& path, +bool ParseLockPath(const base::FilePath& path, std::string* hostname, int* pid) { std::string real_path = ReadLink(path).value(); @@ -315,10 +315,10 @@ void DisplayProfileInUseError(const std::string& lock_path, } bool IsChromeProcess(pid_t pid) { - FilePath other_chrome_path(base::GetProcessExecutablePath(pid)); + base::FilePath other_chrome_path(base::GetProcessExecutablePath(pid)); return (!other_chrome_path.empty() && other_chrome_path.BaseName() == - FilePath(chrome::kBrowserProcessExecutableName)); + base::FilePath(chrome::kBrowserProcessExecutableName)); } // A helper class to hold onto a socket. @@ -345,20 +345,20 @@ std::string GenerateCookie() { return base::Uint64ToString(base::RandUint64()); } -bool CheckCookie(const FilePath& path, const FilePath& cookie) { +bool CheckCookie(const base::FilePath& path, const base::FilePath& cookie) { return (cookie == ReadLink(path)); } bool ConnectSocket(ScopedSocket* socket, - const FilePath& socket_path, - const FilePath& cookie_path) { - FilePath socket_target; + const base::FilePath& socket_path, + const base::FilePath& cookie_path) { + base::FilePath socket_target; if (file_util::ReadSymbolicLink(socket_path, &socket_target)) { // It's a symlink. Read the cookie. - FilePath cookie = ReadLink(cookie_path); + base::FilePath cookie = ReadLink(cookie_path); if (cookie.empty()) return false; - FilePath remote_cookie = socket_target.DirName(). + base::FilePath remote_cookie = socket_target.DirName(). Append(chrome::kSingletonCookieFilename); // Verify the cookie before connecting. if (!CheckCookie(remote_cookie, cookie)) @@ -572,14 +572,14 @@ void ProcessSingleton::LinuxWatcher::HandleMessage( if (parent_->locked()) { DLOG(WARNING) << "Browser is locked"; parent_->saved_startup_messages_.push_back( - std::make_pair(argv, FilePath(current_dir))); + std::make_pair(argv, base::FilePath(current_dir))); // Send back "ACK" message to prevent the client process from starting up. reader->FinishWithACK(kACKToken, arraysize(kACKToken) - 1); return; } if (parent_->notification_callback_.Run(CommandLine(argv), - FilePath(current_dir))) { + base::FilePath(current_dir))) { // Send back "ACK" message to prevent the client process from starting up. reader->FinishWithACK(kACKToken, arraysize(kACKToken) - 1); } else { @@ -692,7 +692,7 @@ void ProcessSingleton::LinuxWatcher::SocketReader::FinishWithACK( /////////////////////////////////////////////////////////////////////////////// // ProcessSingleton // -ProcessSingleton::ProcessSingleton(const FilePath& user_data_dir) +ProcessSingleton::ProcessSingleton(const base::FilePath& user_data_dir) : locked_(false), foreground_window_(NULL), current_pid_(base::GetCurrentProcId()), @@ -781,7 +781,7 @@ ProcessSingleton::NotifyResult ProcessSingleton::NotifyOtherProcessWithTimeout( std::string to_send(kStartToken); to_send.push_back(kTokenDelimiter); - FilePath current_dir; + base::FilePath current_dir; if (!PathService::Get(base::DIR_CURRENT, ¤t_dir)) return PROCESS_NONE; to_send.append(current_dir.value()); @@ -886,7 +886,7 @@ bool ProcessSingleton::Create( // The symlink lock is pointed to the hostname and process id, so other // processes can find it out. - FilePath symlink_content(base::StringPrintf( + base::FilePath symlink_content(base::StringPrintf( "%s%c%u", net::GetHostName().c_str(), kLockDelimiter, @@ -908,10 +908,10 @@ bool ProcessSingleton::Create( return false; } // Setup the socket symlink and the two cookies. - FilePath socket_target_path = + base::FilePath socket_target_path = socket_dir_.path().Append(chrome::kSingletonSocketFilename); - FilePath cookie(GenerateCookie()); - FilePath remote_cookie_path = + base::FilePath cookie(GenerateCookie()); + base::FilePath remote_cookie_path = socket_dir_.path().Append(chrome::kSingletonCookieFilename); UnlinkPath(socket_path_); UnlinkPath(cookie_path_); diff --git a/chrome/browser/process_singleton_linux_unittest.cc b/chrome/browser/process_singleton_linux_unittest.cc index 06b96154..a922e6e 100644 --- a/chrome/browser/process_singleton_linux_unittest.cc +++ b/chrome/browser/process_singleton_linux_unittest.cc @@ -33,7 +33,7 @@ using content::BrowserThread; namespace { bool NotificationCallback(const CommandLine& command_line, - const FilePath& current_directory) { + const base::FilePath& current_directory) { return true; } @@ -42,7 +42,7 @@ class ProcessSingletonLinuxTest : public testing::Test { // A ProcessSingleton exposing some protected methods for testing. class TestableProcessSingleton : public ProcessSingleton { public: - explicit TestableProcessSingleton(const FilePath& user_data_dir) + explicit TestableProcessSingleton(const base::FilePath& user_data_dir) : ProcessSingleton(user_data_dir) {} using ProcessSingleton::NotifyOtherProcessWithTimeout; using ProcessSingleton::NotifyOtherProcessWithTimeoutOrCreate; @@ -174,9 +174,9 @@ class ProcessSingletonLinuxTest : public testing::Test { signal_event_.Signal(); } - FilePath lock_path_; - FilePath socket_path_; - FilePath cookie_path_; + base::FilePath lock_path_; + base::FilePath socket_path_; + base::FilePath cookie_path_; int kill_callbacks_; private: @@ -195,7 +195,7 @@ class ProcessSingletonLinuxTest : public testing::Test { } bool InternalCallback(const CommandLine& command_line, - const FilePath& current_directory) { + const base::FilePath& current_directory) { callback_command_lines_.push_back(command_line.argv()); return true; } @@ -234,7 +234,7 @@ TEST_F(ProcessSingletonLinuxTest, CheckSocketFile) { len = readlink(socket_path_.value().c_str(), buf, PATH_MAX); ASSERT_GT(len, 0); - FilePath socket_target_path = FilePath(std::string(buf, len)); + base::FilePath socket_target_path = base::FilePath(std::string(buf, len)); ASSERT_EQ(0, lstat(socket_target_path.value().c_str(), &statbuf)); ASSERT_TRUE(S_ISSOCK(statbuf.st_mode)); @@ -243,7 +243,7 @@ TEST_F(ProcessSingletonLinuxTest, CheckSocketFile) { ASSERT_GT(len, 0); std::string cookie(buf, len); - FilePath remote_cookie_path = socket_target_path.DirName(). + base::FilePath remote_cookie_path = socket_target_path.DirName(). Append(chrome::kSingletonCookieFilename); len = readlink(remote_cookie_path.value().c_str(), buf, PATH_MAX); ASSERT_GT(len, 0); @@ -364,7 +364,7 @@ TEST_F(ProcessSingletonLinuxTest, CreateChecksCompatibilitySocket) { char buf[PATH_MAX]; ssize_t len = readlink(socket_path_.value().c_str(), buf, sizeof(buf)); ASSERT_GT(len, 0); - FilePath socket_target_path = FilePath(std::string(buf, len)); + base::FilePath socket_target_path = base::FilePath(std::string(buf, len)); ASSERT_EQ(0, unlink(socket_path_.value().c_str())); ASSERT_EQ(0, rename(socket_target_path.value().c_str(), socket_path_.value().c_str())); diff --git a/chrome/browser/process_singleton_mac.cc b/chrome/browser/process_singleton_mac.cc index 253f369..6f26a32 100644 --- a/chrome/browser/process_singleton_mac.cc +++ b/chrome/browser/process_singleton_mac.cc @@ -38,7 +38,7 @@ const int kMaxErrno = 102; // ourselves. An exclusive lock is used to flush out anyone making incorrect // assumptions. -ProcessSingleton::ProcessSingleton(const FilePath& user_data_dir) +ProcessSingleton::ProcessSingleton(const base::FilePath& user_data_dir) : locked_(false), foreground_window_(NULL), lock_path_(user_data_dir.Append(chrome::kSingletonLockFilename)), diff --git a/chrome/browser/process_singleton_mac_unittest.cc b/chrome/browser/process_singleton_mac_unittest.cc index 639a3af..e35c7f1 100644 --- a/chrome/browser/process_singleton_mac_unittest.cc +++ b/chrome/browser/process_singleton_mac_unittest.cc @@ -62,7 +62,7 @@ class ProcessSingletonMacTest : public PlatformTest { } base::ScopedTempDir temp_dir_; - FilePath lock_path_; + base::FilePath lock_path_; }; // Test that the base case doesn't blow up. diff --git a/chrome/browser/process_singleton_win.cc b/chrome/browser/process_singleton_win.cc index d8073c1..62d3814 100644 --- a/chrome/browser/process_singleton_win.cc +++ b/chrome/browser/process_singleton_win.cc @@ -116,7 +116,7 @@ LRESULT CALLBACK ThunkWndProc(HWND hwnd, UINT message, bool ParseCommandLine(const COPYDATASTRUCT* cds, CommandLine* parsed_command_line, - FilePath* current_directory) { + base::FilePath* current_directory) { // We should have enough room for the shortest command (min_message_size) // and also be a multiple of wchar_t bytes. The shortest command // possible is L"START\0\0" (empty current directory and command line). @@ -154,7 +154,7 @@ bool ParseCommandLine(const COPYDATASTRUCT* cds, } // Get current directory. - *current_directory = FilePath(msg.substr(first_null + 1, + *current_directory = base::FilePath(msg.substr(first_null + 1, second_null - first_null)); const std::wstring::size_type third_null = @@ -175,7 +175,7 @@ bool ParseCommandLine(const COPYDATASTRUCT* cds, } bool ActivateMetroChrome() { - FilePath chrome_exe; + base::FilePath chrome_exe; if (!PathService::Get(base::FILE_EXE, &chrome_exe)) { NOTREACHED() << "Failed to get chrome exe path"; return false; @@ -219,7 +219,7 @@ bool ActivateMetroChrome() { // TODO(ananta) // Move this function to a common place as the Windows 8 delegate_execute // handler can possibly use this. -bool ShouldLaunchInWindows8ImmersiveMode(const FilePath& user_data_dir) { +bool ShouldLaunchInWindows8ImmersiveMode(const base::FilePath& user_data_dir) { #if defined(USE_AURA) return false; #endif @@ -239,7 +239,7 @@ bool ShouldLaunchInWindows8ImmersiveMode(const FilePath& user_data_dir) { if (integrity_level == base::HIGH_INTEGRITY) return false; - FilePath default_user_data_dir; + base::FilePath default_user_data_dir; if (!chrome::GetDefaultUserDataDirectory(&default_user_data_dir)) return false; @@ -263,7 +263,8 @@ bool ShouldLaunchInWindows8ImmersiveMode(const FilePath& user_data_dir) { // So, if we detect the Softricity DLL we use WMI Win32_Process.Create to // break out of the virtualization environment. // http://code.google.com/p/chromium/issues/detail?id=43650 -bool ProcessSingleton::EscapeVirtualization(const FilePath& user_data_dir) { +bool ProcessSingleton::EscapeVirtualization( + const base::FilePath& user_data_dir) { if (::GetModuleHandle(L"sftldr_wow64.dll") || ::GetModuleHandle(L"sftldr.dll")) { int process_id; @@ -290,7 +291,7 @@ bool ProcessSingleton::EscapeVirtualization(const FilePath& user_data_dir) { return false; } -ProcessSingleton::ProcessSingleton(const FilePath& user_data_dir) +ProcessSingleton::ProcessSingleton(const base::FilePath& user_data_dir) : window_(NULL), locked_(false), foreground_window_(NULL), is_virtualized_(false), lock_file_(INVALID_HANDLE_VALUE), user_data_dir_(user_data_dir) { @@ -354,7 +355,7 @@ ProcessSingleton::NotifyResult ProcessSingleton::NotifyOtherProcess() { // Non-metro mode, send our command line to the other chrome message window. // format is "START\0<<<current directory>>>\0<<<commandline>>>". std::wstring to_send(L"START\0", 6); // want the NULL in the string. - FilePath cur_dir; + base::FilePath cur_dir; if (!PathService::Get(base::DIR_CURRENT, &cur_dir)) return PROCESS_NONE; to_send.append(cur_dir.value()); @@ -525,7 +526,7 @@ bool ProcessSingleton::Create( if (!remote_window_) { // We have to make sure there is no Chrome instance running on another // machine that uses the same profile. - FilePath lock_file_path = user_data_dir_.AppendASCII(kLockfile); + base::FilePath lock_file_path = user_data_dir_.AppendASCII(kLockfile); lock_file_ = CreateFile(lock_file_path.value().c_str(), GENERIC_WRITE, FILE_SHARE_READ, @@ -592,7 +593,7 @@ LRESULT ProcessSingleton::OnCopyData(HWND hwnd, const COPYDATASTRUCT* cds) { // Read the command line and store it. It will be replayed when the // ProcessSingleton becomes unlocked. CommandLine parsed_command_line(CommandLine::NO_PROGRAM); - FilePath current_directory; + base::FilePath current_directory; if (ParseCommandLine(cds, &parsed_command_line, ¤t_directory)) saved_startup_messages_.push_back( std::make_pair(parsed_command_line.argv(), current_directory)); @@ -602,7 +603,7 @@ LRESULT ProcessSingleton::OnCopyData(HWND hwnd, const COPYDATASTRUCT* cds) { } CommandLine parsed_command_line(CommandLine::NO_PROGRAM); - FilePath current_directory; + base::FilePath current_directory; if (!ParseCommandLine(cds, &parsed_command_line, ¤t_directory)) return TRUE; return notification_callback_.Run(parsed_command_line, current_directory) ? diff --git a/chrome/browser/profiles/avatar_menu_model.cc b/chrome/browser/profiles/avatar_menu_model.cc index 831b872..b44f7ba 100644 --- a/chrome/browser/profiles/avatar_menu_model.cc +++ b/chrome/browser/profiles/avatar_menu_model.cc @@ -90,7 +90,8 @@ void AvatarMenuModel::SwitchToProfile(size_t index, bool always_create) { DCHECK(ProfileManager::IsMultipleProfilesEnabled() || index == GetActiveProfileIndex()); const Item& item = GetItemAt(index); - FilePath path = profile_info_->GetPathOfProfileAtIndex(item.model_index); + base::FilePath path = + profile_info_->GetPathOfProfileAtIndex(item.model_index); chrome::HostDesktopType desktop_type = chrome::GetActiveDesktop(); if (browser_) @@ -202,7 +203,7 @@ void AvatarMenuModel::RebuildMenu() { IDS_PROFILES_LOCAL_PROFILE_STATE); } if (browser_) { - FilePath path = profile_info_->GetPathOfProfileAtIndex(i); + base::FilePath path = profile_info_->GetPathOfProfileAtIndex(i); item->active = browser_->profile()->GetPath() == path; } items_.push_back(item); diff --git a/chrome/browser/profiles/off_the_record_profile_impl.cc b/chrome/browser/profiles/off_the_record_profile_impl.cc index 8ab27fb..e275baf 100644 --- a/chrome/browser/profiles/off_the_record_profile_impl.cc +++ b/chrome/browser/profiles/off_the_record_profile_impl.cc @@ -192,7 +192,7 @@ std::string OffTheRecordProfileImpl::GetProfileName() { return std::string(); } -FilePath OffTheRecordProfileImpl::GetPath() { +base::FilePath OffTheRecordProfileImpl::GetPath() { return profile_->GetPath(); } @@ -296,7 +296,7 @@ net::URLRequestContextGetter* net::URLRequestContextGetter* OffTheRecordProfileImpl::GetMediaRequestContextForStoragePartition( - const FilePath& partition_path, + const base::FilePath& partition_path, bool in_memory) { return io_data_.GetIsolatedAppRequestContextGetter(partition_path, in_memory); } @@ -308,7 +308,7 @@ net::URLRequestContextGetter* net::URLRequestContextGetter* OffTheRecordProfileImpl::CreateRequestContextForStoragePartition( - const FilePath& partition_path, + const base::FilePath& partition_path, bool in_memory, scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> blob_protocol_handler, @@ -387,8 +387,8 @@ history::TopSites* OffTheRecordProfileImpl::GetTopSites() { void OffTheRecordProfileImpl::SetExitType(ExitType exit_type) { } -FilePath OffTheRecordProfileImpl::last_selected_directory() { - const FilePath& directory = last_selected_directory_; +base::FilePath OffTheRecordProfileImpl::last_selected_directory() { + const base::FilePath& directory = last_selected_directory_; if (directory.empty()) { return profile_->last_selected_directory(); } @@ -396,7 +396,7 @@ FilePath OffTheRecordProfileImpl::last_selected_directory() { } void OffTheRecordProfileImpl::set_last_selected_directory( - const FilePath& path) { + const base::FilePath& path) { last_selected_directory_ = path; } diff --git a/chrome/browser/profiles/off_the_record_profile_impl.h b/chrome/browser/profiles/off_the_record_profile_impl.h index 78d85fe..0bc937e 100644 --- a/chrome/browser/profiles/off_the_record_profile_impl.h +++ b/chrome/browser/profiles/off_the_record_profile_impl.h @@ -59,7 +59,7 @@ class OffTheRecordProfileImpl : public Profile { scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> chrome_devtools_protocol_handler) OVERRIDE; virtual net::URLRequestContextGetter* CreateRequestContextForStoragePartition( - const FilePath& partition_path, + const base::FilePath& partition_path, bool in_memory, scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> blob_protocol_handler, @@ -78,8 +78,8 @@ class OffTheRecordProfileImpl : public Profile { virtual Time GetStartTime() const OVERRIDE; virtual history::TopSites* GetTopSitesWithoutCreating() OVERRIDE; virtual history::TopSites* GetTopSites() OVERRIDE; - virtual FilePath last_selected_directory() OVERRIDE; - virtual void set_last_selected_directory(const FilePath& path) OVERRIDE; + virtual base::FilePath last_selected_directory() OVERRIDE; + virtual void set_last_selected_directory(const base::FilePath& path) OVERRIDE; virtual bool WasCreatedByVersionOrLater(const std::string& version) OVERRIDE; virtual void SetExitType(ExitType exit_type) OVERRIDE; virtual ExitType GetLastSessionExitType() OVERRIDE; @@ -102,7 +102,7 @@ class OffTheRecordProfileImpl : public Profile { virtual GURL GetHomePage() OVERRIDE; // content::BrowserContext implementation: - virtual FilePath GetPath() OVERRIDE; + virtual base::FilePath GetPath() OVERRIDE; virtual scoped_refptr<base::SequencedTaskRunner> GetIOTaskRunner() OVERRIDE; virtual bool IsOffTheRecord() const OVERRIDE; virtual content::DownloadManagerDelegate* @@ -115,7 +115,7 @@ class OffTheRecordProfileImpl : public Profile { int renderer_child_id) OVERRIDE; virtual net::URLRequestContextGetter* GetMediaRequestContextForStoragePartition( - const FilePath& partition_path, + const base::FilePath& partition_path, bool in_memory) OVERRIDE; virtual content::ResourceContext* GetResourceContext() OVERRIDE; virtual content::GeolocationPermissionContext* @@ -148,7 +148,7 @@ class OffTheRecordProfileImpl : public Profile { // Time we were started. Time start_time_; - FilePath last_selected_directory_; + base::FilePath last_selected_directory_; scoped_ptr<PrefProxyConfigTracker> pref_proxy_config_tracker_; diff --git a/chrome/browser/profiles/off_the_record_profile_io_data.cc b/chrome/browser/profiles/off_the_record_profile_io_data.cc index 6e2e857..4c6542f 100644 --- a/chrome/browser/profiles/off_the_record_profile_io_data.cc +++ b/chrome/browser/profiles/off_the_record_profile_io_data.cc @@ -110,7 +110,7 @@ OffTheRecordProfileIOData::Handle::GetExtensionsRequestContextGetter() const { scoped_refptr<ChromeURLRequestContextGetter> OffTheRecordProfileIOData::Handle::GetIsolatedAppRequestContextGetter( - const FilePath& partition_path, + const base::FilePath& partition_path, bool in_memory) const { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!partition_path.empty()); diff --git a/chrome/browser/profiles/off_the_record_profile_io_data.h b/chrome/browser/profiles/off_the_record_profile_io_data.h index bc282c0..7f8bc1b 100644 --- a/chrome/browser/profiles/off_the_record_profile_io_data.h +++ b/chrome/browser/profiles/off_the_record_profile_io_data.h @@ -58,7 +58,7 @@ class OffTheRecordProfileIOData : public ProfileIOData { GetExtensionsRequestContextGetter() const; scoped_refptr<ChromeURLRequestContextGetter> GetIsolatedAppRequestContextGetter( - const FilePath& partition_path, + const base::FilePath& partition_path, bool in_memory) const; scoped_refptr<ChromeURLRequestContextGetter> CreateIsolatedAppRequestContextGetter( diff --git a/chrome/browser/profiles/profile_browsertest.cc b/chrome/browser/profiles/profile_browsertest.cc index d55dda4..7ce8d51 100644 --- a/chrome/browser/profiles/profile_browsertest.cc +++ b/chrome/browser/profiles/profile_browsertest.cc @@ -28,8 +28,8 @@ class MockProfileDelegate : public Profile::Delegate { }; // Creates a prefs file in the given directory. -void CreatePrefsFileInDirectory(const FilePath& directory_path) { - FilePath pref_path(directory_path.Append(chrome::kPreferencesFilename)); +void CreatePrefsFileInDirectory(const base::FilePath& directory_path) { + base::FilePath pref_path(directory_path.Append(chrome::kPreferencesFilename)); base::PlatformFile file = base::CreatePlatformFile(pref_path, base::PLATFORM_FILE_CREATE | base::PLATFORM_FILE_WRITE, NULL, NULL); ASSERT_TRUE(file != base::kInvalidPlatformFileValue); diff --git a/chrome/browser/profiles/profile_dependency_manager.cc b/chrome/browser/profiles/profile_dependency_manager.cc index e20e2fd..1ada8d0 100644 --- a/chrome/browser/profiles/profile_dependency_manager.cc +++ b/chrome/browser/profiles/profile_dependency_manager.cc @@ -366,7 +366,7 @@ void ProfileDependencyManager::BuildDestructionOrder(Profile* profile) { // dependency graph to "/path/to/profile/profile-dependencies.dot". if (CommandLine::ForCurrentProcess()->HasSwitch( switches::kDumpProfileDependencyGraph)) { - FilePath dot_file = + base::FilePath dot_file = profile->GetPath().AppendASCII("profile-dependencies.dot"); std::string contents = DumpGraphvizDependency(); file_util::WriteFile(dot_file, contents.c_str(), contents.size()); diff --git a/chrome/browser/profiles/profile_impl.cc b/chrome/browser/profiles/profile_impl.cc index e3e7b5c..4313202 100644 --- a/chrome/browser/profiles/profile_impl.cc +++ b/chrome/browser/profiles/profile_impl.cc @@ -159,7 +159,7 @@ const char* const kPrefExitTypeSessionEnded = "SessionEnded"; // Helper method needed because PostTask cannot currently take a Callback // function with non-void return type. -void CreateDirectoryAndSignal(const FilePath& path, +void CreateDirectoryAndSignal(const base::FilePath& path, base::WaitableEvent* done_creating) { DVLOG(1) << "Creating directory " << path.value(); file_util::CreateDirectory(path); @@ -175,7 +175,7 @@ void BlockFileThreadOnDirectoryCreate(base::WaitableEvent* done_creating) { // Initiates creation of profile directory on |sequenced_task_runner| and // ensures that FILE thread is blocked until that operation finishes. void CreateProfileDirectory(base::SequencedTaskRunner* sequenced_task_runner, - const FilePath& path) { + const base::FilePath& path) { base::WaitableEvent* done_creating = new base::WaitableEvent(false, false); sequenced_task_runner->PostTask(FROM_HERE, base::Bind(&CreateDirectoryAndSignal, @@ -189,16 +189,16 @@ void CreateProfileDirectory(base::SequencedTaskRunner* sequenced_task_runner, base::Owned(done_creating))); } -FilePath GetCachePath(const FilePath& base) { +base::FilePath GetCachePath(const base::FilePath& base) { return base.Append(chrome::kCacheDirname); } -FilePath GetMediaCachePath(const FilePath& base) { +base::FilePath GetMediaCachePath(const base::FilePath& base) { return base.Append(chrome::kMediaCacheDirname); } -void EnsureReadmeFile(const FilePath& base) { - FilePath readme_path = base.Append(chrome::kReadmeFilename); +void EnsureReadmeFile(const base::FilePath& base) { + base::FilePath readme_path = base.Append(chrome::kReadmeFilename); if (file_util::PathExists(readme_path)) return; std::string product_name = l10n_util::GetStringUTF8(IDS_PRODUCT_NAME); @@ -236,7 +236,7 @@ std::string ExitTypeToSessionTypePrefValue(Profile::ExitType type) { } // namespace // static -Profile* Profile::CreateProfile(const FilePath& path, +Profile* Profile::CreateProfile(const base::FilePath& path, Delegate* delegate, CreateMode create_mode) { // Get sequenced task runner for making sure that file operations of @@ -304,7 +304,7 @@ void ProfileImpl::RegisterUserPrefs(PrefServiceSyncable* prefs) { // Initialize the cache prefs. prefs->RegisterFilePathPref(prefs::kDiskCacheDir, - FilePath(), + base::FilePath(), PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterIntegerPref(prefs::kDiskCacheSize, 0, @@ -320,7 +320,7 @@ void ProfileImpl::RegisterUserPrefs(PrefServiceSyncable* prefs) { } ProfileImpl::ProfileImpl( - const FilePath& path, + const base::FilePath& path, Delegate* delegate, CreateMode create_mode, base::SequencedTaskRunner* sequenced_task_runner) @@ -466,26 +466,26 @@ void ProfileImpl::DoFinalInit(bool is_new_profile) { g_browser_process->background_mode_manager()->RegisterProfile(this); } - FilePath cookie_path = GetPath(); + base::FilePath cookie_path = GetPath(); cookie_path = cookie_path.Append(chrome::kCookieFilename); - FilePath server_bound_cert_path = GetPath(); + base::FilePath server_bound_cert_path = GetPath(); server_bound_cert_path = server_bound_cert_path.Append(chrome::kOBCertFilename); - FilePath cache_path = base_cache_path_; + base::FilePath cache_path = base_cache_path_; int cache_max_size; GetCacheParameters(false, &cache_path, &cache_max_size); cache_path = GetCachePath(cache_path); - FilePath media_cache_path = base_cache_path_; + base::FilePath media_cache_path = base_cache_path_; int media_cache_max_size; GetCacheParameters(true, &media_cache_path, &media_cache_max_size); media_cache_path = GetMediaCachePath(media_cache_path); - FilePath extensions_cookie_path = GetPath(); + base::FilePath extensions_cookie_path = GetPath(); extensions_cookie_path = extensions_cookie_path.Append(chrome::kExtensionsCookieFilename); - FilePath infinite_cache_path = GetPath(); + base::FilePath infinite_cache_path = GetPath(); infinite_cache_path = infinite_cache_path.Append(FILE_PATH_LITERAL("Infinite Cache")); @@ -577,11 +577,11 @@ void ProfileImpl::InitHostZoomMap() { host_zoom_map->AddZoomLevelChangedCallback(zoom_callback_); } -FilePath ProfileImpl::last_selected_directory() { +base::FilePath ProfileImpl::last_selected_directory() { return GetPrefs()->GetFilePath(prefs::kSelectFileLastDirectory); } -void ProfileImpl::set_last_selected_directory(const FilePath& path) { +void ProfileImpl::set_last_selected_directory(const base::FilePath& path) { GetPrefs()->SetFilePath(prefs::kSelectFileLastDirectory, path); } @@ -640,7 +640,7 @@ std::string ProfileImpl::GetProfileName() { return GetPrefs()->GetString(prefs::kGoogleServicesUsername); } -FilePath ProfileImpl::GetPath() { +base::FilePath ProfileImpl::GetPath() { return path_; } @@ -802,8 +802,8 @@ PrefServiceSyncable* ProfileImpl::GetOffTheRecordPrefs() { return otr_prefs_.get(); } -FilePath ProfileImpl::GetPrefFilePath() { - FilePath pref_file_path = path_; +base::FilePath ProfileImpl::GetPrefFilePath() { + base::FilePath pref_file_path = path_; pref_file_path = pref_file_path.Append(chrome::kPreferencesFilename); return pref_file_path; } @@ -858,7 +858,7 @@ ProfileImpl::GetMediaRequestContextForRenderProcess( net::URLRequestContextGetter* ProfileImpl::GetMediaRequestContextForStoragePartition( - const FilePath& partition_path, + const base::FilePath& partition_path, bool in_memory) { return io_data_.GetIsolatedMediaRequestContextGetter(partition_path, in_memory); @@ -874,7 +874,7 @@ net::URLRequestContextGetter* ProfileImpl::GetRequestContextForExtensions() { net::URLRequestContextGetter* ProfileImpl::CreateRequestContextForStoragePartition( - const FilePath& partition_path, + const base::FilePath& partition_path, bool in_memory, scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> blob_protocol_handler, @@ -1114,7 +1114,7 @@ GURL ProfileImpl::GetHomePage() { // For now, allow this code to call getcwd(). base::ThreadRestrictions::ScopedAllowIO allow_io; - FilePath browser_directory; + base::FilePath browser_directory; PathService::Get(base::DIR_CURRENT, &browser_directory); GURL home_page(URLFixerUpper::FixupRelativeFile(browser_directory, command_line.GetSwitchValuePath(switches::kHomePage))); @@ -1171,11 +1171,11 @@ void ProfileImpl::UpdateProfileAvatarCache() { // there is not an argument. |max_size| will be the user provided value or zero // by default. void ProfileImpl::GetCacheParameters(bool is_media_context, - FilePath* cache_path, + base::FilePath* cache_path, int* max_size) { DCHECK(cache_path); DCHECK(max_size); - FilePath path(prefs_->GetFilePath(prefs::kDiskCacheDir)); + base::FilePath path(prefs_->GetFilePath(prefs::kDiskCacheDir)); if (!path.empty()) *cache_path = path; *max_size = is_media_context ? prefs_->GetInteger(prefs::kMediaCacheSize) : diff --git a/chrome/browser/profiles/profile_impl.h b/chrome/browser/profiles/profile_impl.h index 39de398..b1f23f7 100644 --- a/chrome/browser/profiles/profile_impl.h +++ b/chrome/browser/profiles/profile_impl.h @@ -59,7 +59,7 @@ class ProfileImpl : public Profile { static void RegisterUserPrefs(PrefServiceSyncable* prefs); // content::BrowserContext implementation: - virtual FilePath GetPath() OVERRIDE; + virtual base::FilePath GetPath() OVERRIDE; virtual content::DownloadManagerDelegate* GetDownloadManagerDelegate() OVERRIDE; virtual net::URLRequestContextGetter* GetRequestContext() OVERRIDE; @@ -70,7 +70,7 @@ class ProfileImpl : public Profile { int renderer_child_id) OVERRIDE; virtual net::URLRequestContextGetter* GetMediaRequestContextForStoragePartition( - const FilePath& partition_path, + const base::FilePath& partition_path, bool in_memory) OVERRIDE; virtual content::ResourceContext* GetResourceContext() OVERRIDE; virtual content::GeolocationPermissionContext* @@ -116,7 +116,7 @@ class ProfileImpl : public Profile { scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> chrome_devtools_protocol_handler) OVERRIDE; virtual net::URLRequestContextGetter* CreateRequestContextForStoragePartition( - const FilePath& partition_path, + const base::FilePath& partition_path, bool in_memory, scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> blob_protocol_handler, @@ -128,8 +128,8 @@ class ProfileImpl : public Profile { chrome_protocol_handler, scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> chrome_devtools_protocol_handler) OVERRIDE; - virtual FilePath last_selected_directory() OVERRIDE; - virtual void set_last_selected_directory(const FilePath& path) OVERRIDE; + virtual base::FilePath last_selected_directory() OVERRIDE; + virtual void set_last_selected_directory(const base::FilePath& path) OVERRIDE; virtual chrome_browser_net::Predictor* GetNetworkPredictor() OVERRIDE; virtual void ClearNetworkingHistorySince( base::Time time, @@ -162,7 +162,7 @@ class ProfileImpl : public Profile { // This is non-const for testing purposes. static int create_readme_delay_ms; - ProfileImpl(const FilePath& path, + ProfileImpl(const base::FilePath& path, Delegate* delegate, CreateMode create_mode, base::SequencedTaskRunner* sequenced_task_runner); @@ -181,7 +181,7 @@ class ProfileImpl : public Profile { // Does final prefs initialization and calls Init(). void OnPrefsLoaded(bool success); - FilePath GetPrefFilePath(); + base::FilePath GetPrefFilePath(); #if defined(ENABLE_SESSION_SERVICE) void StopCreateSessionServiceTimer(); @@ -201,14 +201,14 @@ class ProfileImpl : public Profile { void UpdateProfileAvatarCache(); void GetCacheParameters(bool is_media_context, - FilePath* cache_path, + base::FilePath* cache_path, int* max_size); content::HostZoomMap::ZoomLevelChangedCallback zoom_callback_; PrefChangeRegistrar pref_change_registrar_; - FilePath path_; - FilePath base_cache_path_; + base::FilePath path_; + base::FilePath base_cache_path_; // !!! BIG HONKING WARNING !!! // The order of the members below is important. Do not change it unless diff --git a/chrome/browser/profiles/profile_impl_io_data.cc b/chrome/browser/profiles/profile_impl_io_data.cc index 50172b0..7f2e77c 100644 --- a/chrome/browser/profiles/profile_impl_io_data.cc +++ b/chrome/browser/profiles/profile_impl_io_data.cc @@ -66,15 +66,15 @@ ProfileImplIOData::Handle::~Handle() { } void ProfileImplIOData::Handle::Init( - const FilePath& cookie_path, - const FilePath& server_bound_cert_path, - const FilePath& cache_path, + const base::FilePath& cookie_path, + const base::FilePath& server_bound_cert_path, + const base::FilePath& cache_path, int cache_max_size, - const FilePath& media_cache_path, + const base::FilePath& media_cache_path, int media_cache_max_size, - const FilePath& extensions_cookie_path, - const FilePath& profile_path, - const FilePath& infinite_cache_path, + const base::FilePath& extensions_cookie_path, + const base::FilePath& profile_path, + const base::FilePath& infinite_cache_path, chrome_browser_net::Predictor* predictor, bool restore_old_session_cookies, quota::SpecialStoragePolicy* special_storage_policy) { @@ -184,7 +184,7 @@ ProfileImplIOData::Handle::GetExtensionsRequestContextGetter() const { scoped_refptr<ChromeURLRequestContextGetter> ProfileImplIOData::Handle::CreateIsolatedAppRequestContextGetter( - const FilePath& partition_path, + const base::FilePath& partition_path, bool in_memory, scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> blob_protocol_handler, @@ -227,7 +227,7 @@ ProfileImplIOData::Handle::CreateIsolatedAppRequestContextGetter( scoped_refptr<ChromeURLRequestContextGetter> ProfileImplIOData::Handle::GetIsolatedMediaRequestContextGetter( - const FilePath& partition_path, + const base::FilePath& partition_path, bool in_memory) const { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); // We must have a non-default path, or this will act like the default media @@ -545,9 +545,10 @@ ProfileImplIOData::InitializeAppRequestContext( AppRequestContext* context = new AppRequestContext(load_time_stats()); context->CopyFrom(main_context); - FilePath cookie_path = partition_descriptor.path.Append( + base::FilePath cookie_path = partition_descriptor.path.Append( chrome::kCookieFilename); - FilePath cache_path = partition_descriptor.path.Append(chrome::kCacheDirname); + base::FilePath cache_path = + partition_descriptor.path.Append(chrome::kCacheDirname); const CommandLine& command_line = *CommandLine::ForCurrentProcess(); // Only allow Record Mode if we are in a Debug build or where we are running @@ -653,7 +654,7 @@ ProfileImplIOData::InitializeMediaRequestContext( context->CopyFrom(original_context); using content::StoragePartition; - FilePath cache_path; + base::FilePath cache_path; int cache_max_size = app_media_cache_max_size_; if (partition_descriptor.path == profile_path_) { // lazy_params_ is only valid for the default media context creation. diff --git a/chrome/browser/profiles/profile_impl_io_data.h b/chrome/browser/profiles/profile_impl_io_data.h index 94acde8..b594649 100644 --- a/chrome/browser/profiles/profile_impl_io_data.h +++ b/chrome/browser/profiles/profile_impl_io_data.h @@ -35,15 +35,15 @@ class ProfileImplIOData : public ProfileIOData { // Init() must be called before ~Handle(). It records most of the // parameters needed to construct a ChromeURLRequestContextGetter. - void Init(const FilePath& cookie_path, - const FilePath& server_bound_cert_path, - const FilePath& cache_path, + void Init(const base::FilePath& cookie_path, + const base::FilePath& server_bound_cert_path, + const base::FilePath& cache_path, int cache_max_size, - const FilePath& media_cache_path, + const base::FilePath& media_cache_path, int media_cache_max_size, - const FilePath& extensions_cookie_path, - const FilePath& profile_path, - const FilePath& infinite_cache_path, + const base::FilePath& extensions_cookie_path, + const base::FilePath& profile_path, + const base::FilePath& infinite_cache_path, chrome_browser_net::Predictor* predictor, bool restore_old_session_cookies, quota::SpecialStoragePolicy* special_storage_policy); @@ -91,7 +91,7 @@ class ProfileImplIOData : public ProfileIOData { GetExtensionsRequestContextGetter() const; scoped_refptr<ChromeURLRequestContextGetter> GetIsolatedMediaRequestContextGetter( - const FilePath& partition_path, + const base::FilePath& partition_path, bool in_memory) const; // Deletes all network related data since |time|. It deletes transport @@ -146,14 +146,14 @@ class ProfileImplIOData : public ProfileIOData { ~LazyParams(); // All of these parameters are intended to be read on the IO thread. - FilePath cookie_path; - FilePath server_bound_cert_path; - FilePath cache_path; + base::FilePath cookie_path; + base::FilePath server_bound_cert_path; + base::FilePath cache_path; int cache_max_size; - FilePath media_cache_path; + base::FilePath media_cache_path; int media_cache_max_size; - FilePath extensions_cookie_path; - FilePath infinite_cache_path; + base::FilePath extensions_cookie_path; + base::FilePath infinite_cache_path; bool restore_old_session_cookies; scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy; }; @@ -248,7 +248,7 @@ class ProfileImplIOData : public ProfileIOData { mutable scoped_ptr<net::URLRequestJobFactory> extensions_job_factory_; // Parameters needed for isolated apps. - FilePath profile_path_; + base::FilePath profile_path_; int app_cache_max_size_; int app_media_cache_max_size_; diff --git a/chrome/browser/profiles/profile_info_cache.cc b/chrome/browser/profiles/profile_info_cache.cc index a5e40be..c97c3ba 100644 --- a/chrome/browser/profiles/profile_info_cache.cc +++ b/chrome/browser/profiles/profile_info_cache.cc @@ -113,14 +113,14 @@ typedef std::vector<unsigned char> ImageData; // Writes |data| to disk and takes ownership of the pointer. On completion // |success| is set to true on success and false on failure. void SaveBitmap(ImageData* data, - const FilePath& image_path, + const base::FilePath& image_path, bool* success) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); scoped_ptr<ImageData> data_owner(data); *success = false; // Make sure the destination directory exists. - FilePath dir = image_path.DirName(); + base::FilePath dir = image_path.DirName(); if (!file_util::DirectoryExists(dir) && !file_util::CreateDirectory(dir)) { LOG(ERROR) << "Failed to create parent directory."; return; @@ -139,7 +139,7 @@ void SaveBitmap(ImageData* data, // Reads a PNG from disk and decodes it. If the bitmap was successfully read // from disk the then |out_image| will contain the bitmap image, otherwise it // will be NULL. -void ReadBitmap(const FilePath& image_path, +void ReadBitmap(const base::FilePath& image_path, gfx::Image** out_image) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); *out_image = NULL; @@ -162,7 +162,7 @@ void ReadBitmap(const FilePath& image_path, *out_image = new gfx::Image(image); } -void DeleteBitmap(const FilePath& image_path) { +void DeleteBitmap(const base::FilePath& image_path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); file_util::Delete(image_path, false); } @@ -170,7 +170,7 @@ void DeleteBitmap(const FilePath& image_path) { } // namespace ProfileInfoCache::ProfileInfoCache(PrefService* prefs, - const FilePath& user_data_dir) + const base::FilePath& user_data_dir) : prefs_(prefs), user_data_dir_(user_data_dir) { // Populate the cache @@ -192,7 +192,7 @@ ProfileInfoCache::~ProfileInfoCache() { gaia_pictures_.begin(), gaia_pictures_.end()); } -void ProfileInfoCache::AddProfileToCache(const FilePath& profile_path, +void ProfileInfoCache::AddProfileToCache(const base::FilePath& profile_path, const string16& name, const string16& username, size_t icon_index, @@ -230,7 +230,8 @@ void ProfileInfoCache::RemoveObserver(ProfileInfoCacheObserver* obs) { observer_list_.RemoveObserver(obs); } -void ProfileInfoCache::DeleteProfileFromCache(const FilePath& profile_path) { +void ProfileInfoCache::DeleteProfileFromCache( + const base::FilePath& profile_path) { size_t profile_index = GetIndexOfProfileWithPath(profile_path); if (profile_index == std::string::npos) { NOTREACHED(); @@ -263,7 +264,7 @@ size_t ProfileInfoCache::GetNumberOfProfiles() const { } size_t ProfileInfoCache::GetIndexOfProfileWithPath( - const FilePath& profile_path) const { + const base::FilePath& profile_path) const { if (profile_path.DirName() != user_data_dir_) return std::string::npos; std::string search_key = CacheKeyFromProfilePath(profile_path); @@ -291,7 +292,7 @@ string16 ProfileInfoCache::GetShortcutNameOfProfileAtIndex(size_t index) return shortcut_name; } -FilePath ProfileInfoCache::GetPathOfProfileAtIndex(size_t index) const { +base::FilePath ProfileInfoCache::GetPathOfProfileAtIndex(size_t index) const { return user_data_dir_.AppendASCII(sorted_keys_[index]); } @@ -338,7 +339,7 @@ bool ProfileInfoCache::IsUsingGAIANameOfProfileAtIndex(size_t index) const { const gfx::Image* ProfileInfoCache::GetGAIAPictureOfProfileAtIndex( size_t index) const { - FilePath path = GetPathOfProfileAtIndex(index); + base::FilePath path = GetPathOfProfileAtIndex(index); std::string key = CacheKeyFromProfilePath(path); // If the picture is already loaded then use it. @@ -358,7 +359,7 @@ const gfx::Image* ProfileInfoCache::GetGAIAPictureOfProfileAtIndex( return NULL; gaia_pictures_loading_[key] = true; - FilePath image_path = path.AppendASCII(file_name); + base::FilePath image_path = path.AppendASCII(file_name); gfx::Image** image = new gfx::Image*; BrowserThread::PostTaskAndReply(BrowserThread::FILE, FROM_HERE, base::Bind(&ReadBitmap, image_path, image), @@ -374,7 +375,7 @@ bool ProfileInfoCache::ProfileIsManagedAtIndex(size_t index) const { return value; } -void ProfileInfoCache::OnGAIAPictureLoaded(const FilePath& path, +void ProfileInfoCache::OnGAIAPictureLoaded(const base::FilePath& path, gfx::Image** image) const { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); @@ -396,7 +397,7 @@ void ProfileInfoCache::OnGAIAPictureLoaded(const FilePath& path, content::NotificationService::NoDetails()); } -void ProfileInfoCache::OnGAIAPictureSaved(const FilePath& path, +void ProfileInfoCache::OnGAIAPictureSaved(const base::FilePath& path, bool* success) const { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); @@ -441,7 +442,7 @@ void ProfileInfoCache::SetNameOfProfileAtIndex(size_t index, // This takes ownership of |info|. SetInfoForProfileAtIndex(index, info.release()); string16 new_display_name = GetNameOfProfileAtIndex(index); - FilePath profile_path = GetPathOfProfileAtIndex(index); + base::FilePath profile_path = GetPathOfProfileAtIndex(index); UpdateSortForProfileIndex(index); if (old_display_name != new_display_name) { @@ -480,7 +481,7 @@ void ProfileInfoCache::SetAvatarIconOfProfileAtIndex(size_t index, // This takes ownership of |info|. SetInfoForProfileAtIndex(index, info.release()); - FilePath profile_path = GetPathOfProfileAtIndex(index); + base::FilePath profile_path = GetPathOfProfileAtIndex(index); FOR_EACH_OBSERVER(ProfileInfoCacheObserver, observer_list_, OnProfileAvatarChanged(profile_path)); @@ -508,7 +509,7 @@ void ProfileInfoCache::SetGAIANameOfProfileAtIndex(size_t index, // This takes ownership of |info|. SetInfoForProfileAtIndex(index, info.release()); string16 new_display_name = GetNameOfProfileAtIndex(index); - FilePath profile_path = GetPathOfProfileAtIndex(index); + base::FilePath profile_path = GetPathOfProfileAtIndex(index); UpdateSortForProfileIndex(index); if (old_display_name != new_display_name) { @@ -529,7 +530,7 @@ void ProfileInfoCache::SetIsUsingGAIANameOfProfileAtIndex(size_t index, // This takes ownership of |info|. SetInfoForProfileAtIndex(index, info.release()); string16 new_display_name = GetNameOfProfileAtIndex(index); - FilePath profile_path = GetPathOfProfileAtIndex(index); + base::FilePath profile_path = GetPathOfProfileAtIndex(index); UpdateSortForProfileIndex(index); if (old_display_name != new_display_name) { @@ -541,7 +542,7 @@ void ProfileInfoCache::SetIsUsingGAIANameOfProfileAtIndex(size_t index, void ProfileInfoCache::SetGAIAPictureOfProfileAtIndex(size_t index, const gfx::Image* image) { - FilePath path = GetPathOfProfileAtIndex(index); + base::FilePath path = GetPathOfProfileAtIndex(index); std::string key = CacheKeyFromProfilePath(path); // Delete the old bitmap from cache. @@ -559,7 +560,7 @@ void ProfileInfoCache::SetGAIAPictureOfProfileAtIndex(size_t index, if (!image) { // Delete the old bitmap from disk. if (!old_file_name.empty()) { - FilePath image_path = path.AppendASCII(old_file_name); + base::FilePath image_path = path.AppendASCII(old_file_name); BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, base::Bind(&DeleteBitmap, image_path)); } @@ -574,7 +575,7 @@ void ProfileInfoCache::SetGAIAPictureOfProfileAtIndex(size_t index, } else { new_file_name = old_file_name.empty() ? kGAIAPictureFileName : old_file_name; - FilePath image_path = path.AppendASCII(new_file_name); + base::FilePath image_path = path.AppendASCII(new_file_name); bool* success = new bool; BrowserThread::PostTaskAndReply(BrowserThread::FILE, FROM_HERE, base::Bind(&SaveBitmap, data.release(), image_path, success), @@ -601,7 +602,7 @@ void ProfileInfoCache::SetIsUsingGAIAPictureOfProfileAtIndex(size_t index, SetInfoForProfileAtIndex(index, info.release()); // Retrieve some info to update observers who care about avatar changes. - FilePath profile_path = GetPathOfProfileAtIndex(index); + base::FilePath profile_path = GetPathOfProfileAtIndex(index); FOR_EACH_OBSERVER(ProfileInfoCacheObserver, observer_list_, OnProfileAvatarChanged(profile_path)); @@ -693,7 +694,7 @@ size_t ProfileInfoCache::ChooseAvatarIconIndexForNewProfile() const { return 0; } -const FilePath& ProfileInfoCache::GetUserDataDir() const { +const base::FilePath& ProfileInfoCache::GetUserDataDir() const { return user_data_dir_; } @@ -764,9 +765,9 @@ void ProfileInfoCache::SetInfoForProfileAtIndex(size_t index, } std::string ProfileInfoCache::CacheKeyFromProfilePath( - const FilePath& profile_path) const { + const base::FilePath& profile_path) const { DCHECK(user_data_dir_ == profile_path.DirName()); - FilePath base_name = profile_path.BaseName(); + base::FilePath base_name = profile_path.BaseName(); return base_name.MaybeAsASCII(); } diff --git a/chrome/browser/profiles/profile_info_cache.h b/chrome/browser/profiles/profile_info_cache.h index eed872d..7a0398c 100644 --- a/chrome/browser/profiles/profile_info_cache.h +++ b/chrome/browser/profiles/profile_info_cache.h @@ -35,28 +35,28 @@ class PrefRegistrySimple; class ProfileInfoCache : public ProfileInfoInterface, public base::SupportsWeakPtr<ProfileInfoCache> { public: - ProfileInfoCache(PrefService* prefs, const FilePath& user_data_dir); + ProfileInfoCache(PrefService* prefs, const base::FilePath& user_data_dir); virtual ~ProfileInfoCache(); // This |is_managed| refers to local management (formerly "managed mode"), // not enterprise management. - void AddProfileToCache(const FilePath& profile_path, + void AddProfileToCache(const base::FilePath& profile_path, const string16& name, const string16& username, size_t icon_index, bool is_managed); - void DeleteProfileFromCache(const FilePath& profile_path); + void DeleteProfileFromCache(const base::FilePath& profile_path); // ProfileInfoInterface: virtual size_t GetNumberOfProfiles() const OVERRIDE; // Don't cache this value and reuse, because resorting the menu could cause // the item being referred to to change out from under you. virtual size_t GetIndexOfProfileWithPath( - const FilePath& profile_path) const OVERRIDE; + const base::FilePath& profile_path) const OVERRIDE; virtual string16 GetNameOfProfileAtIndex(size_t index) const OVERRIDE; virtual string16 GetShortcutNameOfProfileAtIndex(size_t index) const OVERRIDE; - virtual FilePath GetPathOfProfileAtIndex(size_t index) const OVERRIDE; + virtual base::FilePath GetPathOfProfileAtIndex(size_t index) const OVERRIDE; virtual string16 GetUserNameOfProfileAtIndex(size_t index) const OVERRIDE; virtual const gfx::Image& GetAvatarIconOfProfileAtIndex( size_t index) const OVERRIDE; @@ -107,7 +107,7 @@ class ProfileInfoCache : public ProfileInfoInterface, // set of default icons. size_t ChooseAvatarIconIndexForNewProfile() const; - const FilePath& GetUserDataDir() const; + const base::FilePath& GetUserDataDir() const; // Gets the number of default avatar icons that exist. static size_t GetDefaultAvatarIconCount(); @@ -140,7 +140,7 @@ class ProfileInfoCache : public ProfileInfoInterface, // Currently the only information that is cached is the profile's name, // user name, and avatar icon. void SetInfoForProfileAtIndex(size_t index, base::DictionaryValue* info); - std::string CacheKeyFromProfilePath(const FilePath& profile_path) const; + std::string CacheKeyFromProfilePath(const base::FilePath& profile_path) const; std::vector<std::string>::iterator FindPositionForProfile( const std::string& search_key, const string16& search_name); @@ -158,12 +158,13 @@ class ProfileInfoCache : public ProfileInfoInterface, // of profiles is still sorted. void UpdateSortForProfileIndex(size_t index); - void OnGAIAPictureLoaded(const FilePath& path, gfx::Image** image) const; - void OnGAIAPictureSaved(const FilePath& path, bool* success) const; + void OnGAIAPictureLoaded(const base::FilePath& path, + gfx::Image** image) const; + void OnGAIAPictureSaved(const base::FilePath& path, bool* success) const; PrefService* prefs_; std::vector<std::string> sorted_keys_; - FilePath user_data_dir_; + base::FilePath user_data_dir_; ObserverList<ProfileInfoCacheObserver> observer_list_; diff --git a/chrome/browser/profiles/profile_info_cache_unittest.cc b/chrome/browser/profiles/profile_info_cache_unittest.cc index 3fd38f9..d390c67 100644 --- a/chrome/browser/profiles/profile_info_cache_unittest.cc +++ b/chrome/browser/profiles/profile_info_cache_unittest.cc @@ -33,7 +33,7 @@ ProfileNameVerifierObserver::~ProfileNameVerifierObserver() { } void ProfileNameVerifierObserver::OnProfileAdded( - const FilePath& profile_path) { + const base::FilePath& profile_path) { string16 profile_name = GetCache()->GetNameOfProfileAtIndex( GetCache()->GetIndexOfProfileWithPath(profile_path)); EXPECT_TRUE(profile_names_.find(profile_name) == profile_names_.end()); @@ -41,7 +41,7 @@ void ProfileNameVerifierObserver::OnProfileAdded( } void ProfileNameVerifierObserver::OnProfileWillBeRemoved( - const FilePath& profile_path) { + const base::FilePath& profile_path) { string16 profile_name = GetCache()->GetNameOfProfileAtIndex( GetCache()->GetIndexOfProfileWithPath(profile_path)); EXPECT_TRUE(profile_names_.find(profile_name) != profile_names_.end()); @@ -49,13 +49,13 @@ void ProfileNameVerifierObserver::OnProfileWillBeRemoved( } void ProfileNameVerifierObserver::OnProfileWasRemoved( - const FilePath& profile_path, + const base::FilePath& profile_path, const string16& profile_name) { EXPECT_TRUE(profile_names_.find(profile_name) == profile_names_.end()); } void ProfileNameVerifierObserver::OnProfileNameChanged( - const FilePath& profile_path, + const base::FilePath& profile_path, const string16& old_profile_name) { string16 new_profile_name = GetCache()->GetNameOfProfileAtIndex( GetCache()->GetIndexOfProfileWithPath(profile_path)); @@ -66,7 +66,7 @@ void ProfileNameVerifierObserver::OnProfileNameChanged( } void ProfileNameVerifierObserver::OnProfileAvatarChanged( - const FilePath& profile_path) { + const base::FilePath& profile_path) { string16 profile_name = GetCache()->GetNameOfProfileAtIndex( GetCache()->GetIndexOfProfileWithPath(profile_path)); EXPECT_TRUE(profile_names_.find(profile_name) != profile_names_.end()); @@ -102,7 +102,7 @@ ProfileInfoCache* ProfileInfoCacheTest::GetCache() { return testing_profile_manager_.profile_info_cache(); } -FilePath ProfileInfoCacheTest::GetProfilePath( +base::FilePath ProfileInfoCacheTest::GetProfilePath( const std::string& base_name) { return testing_profile_manager_.profile_manager()->user_data_dir(). AppendASCII(base_name); @@ -119,7 +119,7 @@ TEST_F(ProfileInfoCacheTest, AddProfiles) { ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); for (uint32 i = 0; i < 4; ++i) { - FilePath profile_path = GetProfilePath(StringPrintf("path_%ud", i)); + base::FilePath profile_path = GetProfilePath(StringPrintf("path_%ud", i)); string16 profile_name = ASCIIToUTF16(StringPrintf("name_%ud", i)); const SkBitmap* icon = rb.GetImageNamed( ProfileInfoCache::GetDefaultAvatarIconResourceIDAtIndex( @@ -145,7 +145,7 @@ TEST_F(ProfileInfoCacheTest, AddProfiles) { EXPECT_EQ(4u, GetCache()->GetNumberOfProfiles()); for (uint32 i = 0; i < 4; ++i) { - FilePath profile_path = GetProfilePath(StringPrintf("path_%ud", i)); + base::FilePath profile_path = GetProfilePath(StringPrintf("path_%ud", i)); EXPECT_EQ(i, GetCache()->GetIndexOfProfileWithPath(profile_path)); string16 profile_name = ASCIIToUTF16(StringPrintf("name_%ud", i)); EXPECT_EQ(profile_name, GetCache()->GetNameOfProfileAtIndex(i)); @@ -159,12 +159,12 @@ TEST_F(ProfileInfoCacheTest, AddProfiles) { TEST_F(ProfileInfoCacheTest, DeleteProfile) { EXPECT_EQ(0u, GetCache()->GetNumberOfProfiles()); - FilePath path_1 = GetProfilePath("path_1"); + base::FilePath path_1 = GetProfilePath("path_1"); GetCache()->AddProfileToCache(path_1, ASCIIToUTF16("name_1"), string16(), 0, false); EXPECT_EQ(1u, GetCache()->GetNumberOfProfiles()); - FilePath path_2 = GetProfilePath("path_2"); + base::FilePath path_2 = GetProfilePath("path_2"); string16 name_2 = ASCIIToUTF16("name_2"); GetCache()->AddProfileToCache(path_2, name_2, string16(), 0, false); EXPECT_EQ(2u, GetCache()->GetNumberOfProfiles()); diff --git a/chrome/browser/profiles/profile_info_interface.h b/chrome/browser/profiles/profile_info_interface.h index 8aee22e..9eabe05 100644 --- a/chrome/browser/profiles/profile_info_interface.h +++ b/chrome/browser/profiles/profile_info_interface.h @@ -20,13 +20,13 @@ class ProfileInfoInterface { virtual size_t GetNumberOfProfiles() const = 0; virtual size_t GetIndexOfProfileWithPath( - const FilePath& profile_path) const = 0; + const base::FilePath& profile_path) const = 0; virtual string16 GetNameOfProfileAtIndex(size_t index) const = 0; virtual string16 GetShortcutNameOfProfileAtIndex(size_t index) const = 0; - virtual FilePath GetPathOfProfileAtIndex(size_t index) const = 0; + virtual base::FilePath GetPathOfProfileAtIndex(size_t index) const = 0; virtual string16 GetUserNameOfProfileAtIndex(size_t index) const = 0; diff --git a/chrome/browser/profiles/profile_io_data.cc b/chrome/browser/profiles/profile_io_data.cc index 6138ea2..97df542 100644 --- a/chrome/browser/profiles/profile_io_data.cc +++ b/chrome/browser/profiles/profile_io_data.cc @@ -143,7 +143,7 @@ Profile* GetProfileOnUI(ProfileManager* profile_manager, Profile* profile) { } #if defined(DEBUG_DEVTOOLS) -bool IsSupportedDevToolsURL(const GURL& url, FilePath* path) { +bool IsSupportedDevToolsURL(const GURL& url, base::FilePath* path) { if (!url.SchemeIs(chrome::kChromeDevToolsScheme) || url.host() != chrome::kChromeUIDevToolsHost) { return false; @@ -173,11 +173,12 @@ bool IsSupportedDevToolsURL(const GURL& url, FilePath* path) { // Check that |relative_path| is not an absolute path (otherwise // AppendASCII() will DCHECK). The awkward use of StringType is because on // some systems FilePath expects a std::string, but on others a std::wstring. - FilePath p(FilePath::StringType(relative_path.begin(), relative_path.end())); + base::FilePath p( + base::FilePath::StringType(relative_path.begin(), relative_path.end())); if (p.IsAbsolute()) return false; - FilePath inspector_dir; + base::FilePath inspector_dir; if (!PathService::Get(chrome::DIR_INSPECTOR, &inspector_dir)) return false; @@ -196,7 +197,7 @@ class DebugDevToolsInterceptor : public net::URLRequestJobFactory::Interceptor { virtual net::URLRequestJob* MaybeIntercept( net::URLRequest* request, net::NetworkDelegate* network_delegate) const OVERRIDE { - FilePath path; + base::FilePath path; if (IsSupportedDevToolsURL(request->url(), &path)) return new net::URLRequestFileJob(request, network_delegate, path); diff --git a/chrome/browser/profiles/profile_io_data.h b/chrome/browser/profiles/profile_io_data.h index 9c672ed..39c9c3b 100644 --- a/chrome/browser/profiles/profile_io_data.h +++ b/chrome/browser/profiles/profile_io_data.h @@ -246,7 +246,7 @@ class ProfileIOData { ProfileParams(); ~ProfileParams(); - FilePath path; + base::FilePath path; IOThread* io_thread; scoped_refptr<CookieSettings> cookie_settings; scoped_refptr<net::SSLConfigService> ssl_config_service; diff --git a/chrome/browser/profiles/profile_manager.cc b/chrome/browser/profiles/profile_manager.cc index 341436b..d889d15 100644 --- a/chrome/browser/profiles/profile_manager.cc +++ b/chrome/browser/profiles/profile_manager.cc @@ -81,13 +81,13 @@ namespace { static bool did_perform_profile_import = false; // Profiles that should be deleted on shutdown. -std::vector<FilePath>& ProfilesToDelete() { - CR_DEFINE_STATIC_LOCAL(std::vector<FilePath>, profiles_to_delete, ()); +std::vector<base::FilePath>& ProfilesToDelete() { + CR_DEFINE_STATIC_LOCAL(std::vector<base::FilePath>, profiles_to_delete, ()); return profiles_to_delete; } // Simple task to log the size of the current profile. -void ProfileSizeTask(const FilePath& path, int extension_count) { +void ProfileSizeTask(const base::FilePath& path, int extension_count) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); int64 size = file_util::ComputeFilesSize(path, FILE_PATH_LITERAL("*")); @@ -135,7 +135,7 @@ void ProfileSizeTask(const FilePath& path, int extension_count) { UMA_HISTOGRAM_COUNTS_10000("Profile.AppCount", extension_count); } -void QueueProfileDirectoryForDeletion(const FilePath& path) { +void QueueProfileDirectoryForDeletion(const base::FilePath& path) { ProfilesToDelete().push_back(path); } @@ -188,12 +188,12 @@ void ProfileManager::ShutdownSessionServices() { // static void ProfileManager::NukeDeletedProfilesFromDisk() { - for (std::vector<FilePath>::iterator it = + for (std::vector<base::FilePath>::iterator it = ProfilesToDelete().begin(); it != ProfilesToDelete().end(); ++it) { // Delete both the profile directory and its corresponding cache. - FilePath cache_path; + base::FilePath cache_path; chrome::GetUserCacheDirectory(*it, &cache_path); file_util::Delete(*it, true); file_util::Delete(cache_path, true); @@ -232,7 +232,7 @@ std::vector<Profile*> ProfileManager::GetLastOpenedProfiles() { profile_manager->user_data_dir_); } -ProfileManager::ProfileManager(const FilePath& user_data_dir) +ProfileManager::ProfileManager(const base::FilePath& user_data_dir) : user_data_dir_(user_data_dir), logged_in_(false), will_import_(false), @@ -273,34 +273,34 @@ ProfileManager::ProfileManager(const FilePath& user_data_dir) ProfileManager::~ProfileManager() { } -FilePath ProfileManager::GetDefaultProfileDir( - const FilePath& user_data_dir) { - FilePath default_profile_dir(user_data_dir); +base::FilePath ProfileManager::GetDefaultProfileDir( + const base::FilePath& user_data_dir) { + base::FilePath default_profile_dir(user_data_dir); default_profile_dir = default_profile_dir.AppendASCII(chrome::kInitialProfile); return default_profile_dir; } -FilePath ProfileManager::GetProfilePrefsPath( - const FilePath &profile_dir) { - FilePath default_prefs_path(profile_dir); +base::FilePath ProfileManager::GetProfilePrefsPath( + const base::FilePath &profile_dir) { + base::FilePath default_prefs_path(profile_dir); default_prefs_path = default_prefs_path.Append(chrome::kPreferencesFilename); return default_prefs_path; } -FilePath ProfileManager::GetInitialProfileDir() { - FilePath relative_profile_dir; +base::FilePath ProfileManager::GetInitialProfileDir() { + base::FilePath relative_profile_dir; #if defined(OS_CHROMEOS) const CommandLine& command_line = *CommandLine::ForCurrentProcess(); if (logged_in_) { - FilePath profile_dir; + base::FilePath profile_dir; // If the user has logged in, pick up the new profile. if (command_line.HasSwitch(switches::kLoginProfile)) { profile_dir = command_line.GetSwitchValuePath(switches::kLoginProfile); } else { // We should never be logged in with no profile dir. NOTREACHED(); - return FilePath(""); + return base::FilePath(""); } relative_profile_dir = relative_profile_dir.Append(profile_dir); return relative_profile_dir; @@ -312,7 +312,8 @@ FilePath ProfileManager::GetInitialProfileDir() { return relative_profile_dir; } -Profile* ProfileManager::GetLastUsedProfile(const FilePath& user_data_dir) { +Profile* ProfileManager::GetLastUsedProfile( + const base::FilePath& user_data_dir) { #if defined(OS_CHROMEOS) // Use default login profile if user has not logged in yet. if (!logged_in_) @@ -322,8 +323,9 @@ Profile* ProfileManager::GetLastUsedProfile(const FilePath& user_data_dir) { return GetProfile(GetLastUsedProfileDir(user_data_dir)); } -FilePath ProfileManager::GetLastUsedProfileDir(const FilePath& user_data_dir) { - FilePath last_used_profile_dir(user_data_dir); +base::FilePath ProfileManager::GetLastUsedProfileDir( + const base::FilePath& user_data_dir) { + base::FilePath last_used_profile_dir(user_data_dir); std::string last_used_profile; PrefService* local_state = g_browser_process->local_state(); DCHECK(local_state); @@ -337,7 +339,7 @@ FilePath ProfileManager::GetLastUsedProfileDir(const FilePath& user_data_dir) { } std::vector<Profile*> ProfileManager::GetLastOpenedProfiles( - const FilePath& user_data_dir) { + const base::FilePath& user_data_dir) { PrefService* local_state = g_browser_process->local_state(); DCHECK(local_state); @@ -360,8 +362,9 @@ std::vector<Profile*> ProfileManager::GetLastOpenedProfiles( return to_return; } -Profile* ProfileManager::GetDefaultProfile(const FilePath& user_data_dir) { - FilePath default_profile_dir(user_data_dir); +Profile* ProfileManager::GetDefaultProfile( + const base::FilePath& user_data_dir) { + base::FilePath default_profile_dir(user_data_dir); default_profile_dir = default_profile_dir.Append(GetInitialProfileDir()); #if defined(OS_CHROMEOS) if (!logged_in_) { @@ -410,7 +413,7 @@ std::vector<Profile*> ProfileManager::GetLoadedProfiles() const { return profiles; } -Profile* ProfileManager::GetProfile(const FilePath& profile_dir) { +Profile* ProfileManager::GetProfile(const base::FilePath& profile_dir) { // If the profile is already loaded (e.g., chrome.exe launched twice), just // return it. Profile* profile = GetProfileByPath(profile_dir); @@ -427,7 +430,7 @@ Profile* ProfileManager::GetProfile(const FilePath& profile_dir) { } void ProfileManager::CreateProfileAsync( - const FilePath& profile_path, + const base::FilePath& profile_path, const CreateCallback& callback, const string16& name, const string16& icon_url, @@ -473,7 +476,7 @@ void ProfileManager::CreateDefaultProfileAsync(const CreateCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); ProfileManager* profile_manager = g_browser_process->profile_manager(); - FilePath default_profile_dir = profile_manager->user_data_dir_; + base::FilePath default_profile_dir = profile_manager->user_data_dir_; // TODO(mirandac): current directory will not always be default in the future default_profile_dir = default_profile_dir.Append( profile_manager->GetInitialProfileDir()); @@ -509,12 +512,12 @@ ProfileManager::ProfileInfo* ProfileManager::RegisterProfile( } ProfileManager::ProfileInfo* ProfileManager::GetProfileInfoByPath( - const FilePath& path) const { + const base::FilePath& path) const { ProfilesInfoMap::const_iterator iter = profiles_info_.find(path); return (iter == profiles_info_.end()) ? NULL : iter->second.get(); } -Profile* ProfileManager::GetProfileByPath(const FilePath& path) const { +Profile* ProfileManager::GetProfileByPath(const base::FilePath& path) const { ProfileInfo* profile_info = GetProfileInfoByPath(path); return profile_info ? profile_info->profile.get() : NULL; } @@ -543,7 +546,7 @@ void ProfileManager::FindOrCreateNewWindowForProfile( CommandLine command_line(CommandLine::NO_PROGRAM); int return_code; StartupBrowserCreator browser_creator; - browser_creator.LaunchBrowser(command_line, profile, FilePath(), + browser_creator.LaunchBrowser(command_line, profile, base::FilePath(), process_startup, is_first_run, &return_code); #endif // defined(OS_IOS) } @@ -566,7 +569,7 @@ void ProfileManager::Observe( base::Bind(&CheckCryptohomeIsMounted)); // Confirm that we hadn't loaded the new profile previously. - FilePath default_profile_dir = + base::FilePath default_profile_dir = user_data_dir_.Append(GetInitialProfileDir()); CHECK(!GetProfileByPath(default_profile_dir)) << "The default profile was loaded before we mounted the cryptohome."; @@ -766,11 +769,11 @@ void ProfileManager::DoFinalInitLogging(Profile* profile) { base::TimeDelta::FromSeconds(112)); } -Profile* ProfileManager::CreateProfileHelper(const FilePath& path) { +Profile* ProfileManager::CreateProfileHelper(const base::FilePath& path) { return Profile::CreateProfile(path, NULL, Profile::CREATE_MODE_SYNCHRONOUS); } -Profile* ProfileManager::CreateProfileAsyncHelper(const FilePath& path, +Profile* ProfileManager::CreateProfileAsyncHelper(const base::FilePath& path, Delegate* delegate) { return Profile::CreateProfile(path, delegate, @@ -815,7 +818,7 @@ void ProfileManager::OnProfileCreated(Profile* profile, Profile::CREATE_STATUS_FAIL); } -FilePath ProfileManager::GenerateNextProfileDirectoryPath() { +base::FilePath ProfileManager::GenerateNextProfileDirectoryPath() { PrefService* local_state = g_browser_process->local_state(); DCHECK(local_state); @@ -825,7 +828,7 @@ FilePath ProfileManager::GenerateNextProfileDirectoryPath() { int next_directory = local_state->GetInteger(prefs::kProfilesNumCreated); std::string profile_name = chrome::kMultiProfileDirPrefix; profile_name.append(base::IntToString(next_directory)); - FilePath new_path = user_data_dir_; + base::FilePath new_path = user_data_dir_; #if defined(OS_WIN) new_path = new_path.Append(ASCIIToUTF16(profile_name)); #else @@ -848,7 +851,7 @@ void ProfileManager::CreateMultiProfileAsync( ProfileManager* profile_manager = g_browser_process->profile_manager(); - FilePath new_path = profile_manager->GenerateNextProfileDirectoryPath(); + base::FilePath new_path = profile_manager->GenerateNextProfileDirectoryPath(); profile_manager->CreateProfileAsync(new_path, base::Bind(&OnOpenWindowForNewProfile, @@ -982,7 +985,7 @@ bool ProfileManager::ShouldGoOffTheRecord() { // TODO(robertshield): ProfileManager should not be opening windows and should // not have to care about HostDesktopType. See http://crbug.com/153864 void ProfileManager::ScheduleProfileForDeletion( - const FilePath& profile_dir, + const base::FilePath& profile_dir, chrome::HostDesktopType desktop_type) { DCHECK(IsMultipleProfilesEnabled()); @@ -990,7 +993,7 @@ void ProfileManager::ScheduleProfileForDeletion( // place. ProfileInfoCache& cache = GetProfileInfoCache(); if (cache.GetNumberOfProfiles() == 1) { - FilePath new_path = GenerateNextProfileDirectoryPath(); + base::FilePath new_path = GenerateNextProfileDirectoryPath(); // TODO(robertshield): This desktop type needs to come from the invoker, // currently that involves plumbing this through web UI. @@ -1010,7 +1013,7 @@ void ProfileManager::ScheduleProfileForDeletion( std::string last_profile = local_state->GetString(prefs::kProfileLastUsed); if (profile_dir.BaseName().MaybeAsASCII() == last_profile) { for (size_t i = 0; i < cache.GetNumberOfProfiles(); ++i) { - FilePath cur_path = cache.GetPathOfProfileAtIndex(i); + base::FilePath cur_path = cache.GetPathOfProfileAtIndex(i); if (cur_path != profile_dir) { local_state->SetString( prefs::kProfileLastUsed, cur_path.BaseName().MaybeAsASCII()); @@ -1081,7 +1084,7 @@ void ProfileManager::AutoloadProfiles() { } ProfileManagerWithoutInit::ProfileManagerWithoutInit( - const FilePath& user_data_dir) : ProfileManager(user_data_dir) { + const base::FilePath& user_data_dir) : ProfileManager(user_data_dir) { } void ProfileManager::RegisterTestingProfile(Profile* profile, diff --git a/chrome/browser/profiles/profile_manager.h b/chrome/browser/profiles/profile_manager.h index 9780757..8014d58 100644 --- a/chrome/browser/profiles/profile_manager.h +++ b/chrome/browser/profiles/profile_manager.h @@ -36,7 +36,7 @@ class ProfileManager : public base::NonThreadSafe, public: typedef base::Callback<void(Profile*, Profile::CreateStatus)> CreateCallback; - explicit ProfileManager(const FilePath& user_data_dir); + explicit ProfileManager(const base::FilePath& user_data_dir); virtual ~ProfileManager(); #if defined(ENABLE_SESSION_SERVICE) @@ -52,7 +52,7 @@ class ProfileManager : public base::NonThreadSafe, // ProfileManager if it doesn't already exist. This method returns NULL if // the profile doesn't exist and we can't create it. // The profile used can be overridden by using --login-profile on cros. - Profile* GetDefaultProfile(const FilePath& user_data_dir); + Profile* GetDefaultProfile(const base::FilePath& user_data_dir); // DEPRECATED: DO NOT USE unless in ChromeOS. // Same as instance method but provides the default user_data_dir as well. @@ -66,7 +66,7 @@ class ProfileManager : public base::NonThreadSafe, // Returns a profile for a specific profile directory within the user data // dir. This will return an existing profile it had already been created, // otherwise it will create and manage it. - Profile* GetProfile(const FilePath& profile_dir); + Profile* GetProfile(const base::FilePath& profile_dir); // Returns total number of profiles available on this machine. size_t GetNumberOfProfiles(); @@ -74,7 +74,7 @@ class ProfileManager : public base::NonThreadSafe, // Explicit asynchronous creation of a profile located at |profile_path|. // If the profile has already been created then callback is called // immediately. Should be called on the UI thread. - void CreateProfileAsync(const FilePath& profile_path, + void CreateProfileAsync(const base::FilePath& profile_path, const CreateCallback& callback, const string16& name, const string16& icon_url, @@ -91,26 +91,27 @@ class ProfileManager : public base::NonThreadSafe, // Returns the directory where the first created profile is stored, // relative to the user data directory currently in use.. - FilePath GetInitialProfileDir(); + base::FilePath GetInitialProfileDir(); // Get the Profile last used (the Profile to which owns the most recently // focused window) with this Chrome build. If no signed profile has been // stored in Local State, hand back the Default profile. - Profile* GetLastUsedProfile(const FilePath& user_data_dir); + Profile* GetLastUsedProfile(const base::FilePath& user_data_dir); // Same as instance method but provides the default user_data_dir as well. static Profile* GetLastUsedProfile(); // Get the path of the last used profile, or if that's undefined, the default // profile. - FilePath GetLastUsedProfileDir(const FilePath& user_data_dir); + base::FilePath GetLastUsedProfileDir(const base::FilePath& user_data_dir); // Get the Profiles which are currently open, i.e., have open browsers, or // were open the last time Chrome was running. The Profiles appear in the // order they were opened. The last used profile will be on the list, but its // index on the list will depend on when it was opened (it is not necessarily // the last one). - std::vector<Profile*> GetLastOpenedProfiles(const FilePath& user_data_dir); + std::vector<Profile*> GetLastOpenedProfiles( + const base::FilePath& user_data_dir); // Same as instance method but provides the default user_data_dir as well. static std::vector<Profile*> GetLastOpenedProfiles(); @@ -144,15 +145,16 @@ class ProfileManager : public base::NonThreadSafe, // Returns the path to the default profile directory, based on the given // user data directory. - static FilePath GetDefaultProfileDir(const FilePath& user_data_dir); + static base::FilePath GetDefaultProfileDir( + const base::FilePath& user_data_dir); // Returns the path to the preferences file given the user profile directory. - static FilePath GetProfilePrefsPath(const FilePath& profile_dir); + static base::FilePath GetProfilePrefsPath(const base::FilePath& profile_dir); // If a profile with the given path is currently managed by this object, // return a pointer to the corresponding Profile object; // otherwise return NULL. - Profile* GetProfileByPath(const FilePath& path) const; + Profile* GetProfileByPath(const base::FilePath& path) const; // Activates a window for |profile| on the desktop specified by // |desktop_type|. If no such window yet exists, or if |always_create| is @@ -203,7 +205,7 @@ class ProfileManager : public base::NonThreadSafe, ProfileShortcutManager* profile_shortcut_manager(); // Schedules the profile at the given path to be deleted on shutdown. - void ScheduleProfileForDeletion(const FilePath& profile_dir, + void ScheduleProfileForDeletion(const base::FilePath& profile_dir, chrome::HostDesktopType desktop_type); // Checks if multiple profiles is enabled. @@ -217,7 +219,7 @@ class ProfileManager : public base::NonThreadSafe, // for testing. If |addToCache|, add to ProfileInfoCache as well. void RegisterTestingProfile(Profile* profile, bool addToCache); - const FilePath& user_data_dir() const { return user_data_dir_; } + const base::FilePath& user_data_dir() const { return user_data_dir_; } protected: // Does final initial actions. @@ -228,12 +230,12 @@ class ProfileManager : public base::NonThreadSafe, // Creates a new profile by calling into the profile's profile creation // method. Virtual so that unittests can return a TestingProfile instead // of the Profile's result. - virtual Profile* CreateProfileHelper(const FilePath& path); + virtual Profile* CreateProfileHelper(const base::FilePath& path); // Creates a new profile asynchronously by calling into the profile's // asynchronous profile creation method. Virtual so that unittests can return // a TestingProfile instead of the Profile's result. - virtual Profile* CreateProfileAsyncHelper(const FilePath& path, + virtual Profile* CreateProfileAsyncHelper(const base::FilePath& path, Delegate* delegate); private: @@ -272,9 +274,9 @@ class ProfileManager : public base::NonThreadSafe, // Returns ProfileInfo associated with given |path|, registred earlier with // RegisterProfile. - ProfileInfo* GetProfileInfoByPath(const FilePath& path) const; + ProfileInfo* GetProfileInfoByPath(const base::FilePath& path) const; - typedef std::pair<FilePath, string16> ProfilePathAndName; + typedef std::pair<base::FilePath, string16> ProfilePathAndName; typedef std::vector<ProfilePathAndName> ProfilePathAndNames; ProfilePathAndNames GetSortedProfilesFromDirectoryMap(); @@ -297,7 +299,7 @@ class ProfileManager : public base::NonThreadSafe, // Lack of side effects: // This function doesn't actually create the directory or touch the file // system. - FilePath GenerateNextProfileDirectoryPath(); + base::FilePath GenerateNextProfileDirectoryPath(); void RunCallbacks(const std::vector<CreateCallback>& callbacks, Profile* profile, @@ -306,7 +308,7 @@ class ProfileManager : public base::NonThreadSafe, content::NotificationRegistrar registrar_; // The path to the user data directory (DIR_USER_DATA). - const FilePath user_data_dir_; + const base::FilePath user_data_dir_; // Indicates that a user has logged in and that the profile specified // in the --login-profile command line argument should be used as the @@ -319,7 +321,7 @@ class ProfileManager : public base::NonThreadSafe, // Maps profile path to ProfileInfo (if profile has been created). Use // RegisterProfile() to add into this map. This map owns all loaded profile // objects in a running instance of Chrome. - typedef std::map<FilePath, linked_ptr<ProfileInfo> > ProfilesInfoMap; + typedef std::map<base::FilePath, linked_ptr<ProfileInfo> > ProfilesInfoMap; ProfilesInfoMap profiles_info_; // Object to cache various information about profiles. Contains information @@ -363,7 +365,7 @@ class ProfileManager : public base::NonThreadSafe, // profile. This one is useful in unittests. class ProfileManagerWithoutInit : public ProfileManager { public: - explicit ProfileManagerWithoutInit(const FilePath& user_data_dir); + explicit ProfileManagerWithoutInit(const base::FilePath& user_data_dir); protected: virtual void DoFinalInitForServices(Profile*, bool) OVERRIDE {} diff --git a/chrome/browser/profiles/profile_manager_browsertest.cc b/chrome/browser/profiles/profile_manager_browsertest.cc index ac7c534..de5da1f 100644 --- a/chrome/browser/profiles/profile_manager_browsertest.cc +++ b/chrome/browser/profiles/profile_manager_browsertest.cc @@ -40,7 +40,7 @@ IN_PROC_BROWSER_TEST_F(ProfileManagerBrowserTest, DeleteSingletonProfile) { ASSERT_EQ(cache.GetNumberOfProfiles(), 1U); // Delete singleton profile. - FilePath singleton_profile_path = cache.GetPathOfProfileAtIndex(0); + base::FilePath singleton_profile_path = cache.GetPathOfProfileAtIndex(0); EXPECT_FALSE(singleton_profile_path.empty()); profile_manager->ScheduleProfileForDeletion(singleton_profile_path, chrome::HOST_DESKTOP_TYPE_NATIVE); @@ -50,7 +50,7 @@ IN_PROC_BROWSER_TEST_F(ProfileManagerBrowserTest, DeleteSingletonProfile) { // Make sure a new profile was created automatically. EXPECT_EQ(cache.GetNumberOfProfiles(), 1U); - FilePath new_profile_path = cache.GetPathOfProfileAtIndex(0); + base::FilePath new_profile_path = cache.GetPathOfProfileAtIndex(0); EXPECT_NE(new_profile_path, singleton_profile_path); // Make sure that last used profile preference is set correctly. @@ -73,7 +73,7 @@ IN_PROC_BROWSER_TEST_F(ProfileManagerBrowserTest, MAYBE_DeleteAllProfiles) { ProfileInfoCache& cache = profile_manager->GetProfileInfoCache(); // Create an additional profile. - FilePath new_path = profile_manager->GenerateNextProfileDirectoryPath(); + base::FilePath new_path = profile_manager->GenerateNextProfileDirectoryPath(); profile_manager->CreateProfileAsync(new_path, base::Bind(&OnUnblockOnProfileCreation), string16(), string16(), false); @@ -85,8 +85,8 @@ IN_PROC_BROWSER_TEST_F(ProfileManagerBrowserTest, MAYBE_DeleteAllProfiles) { ASSERT_EQ(cache.GetNumberOfProfiles(), 2U); // Delete all profiles. - FilePath profile_path1 = cache.GetPathOfProfileAtIndex(0); - FilePath profile_path2 = cache.GetPathOfProfileAtIndex(1); + base::FilePath profile_path1 = cache.GetPathOfProfileAtIndex(0); + base::FilePath profile_path2 = cache.GetPathOfProfileAtIndex(1); EXPECT_FALSE(profile_path1.empty()); EXPECT_FALSE(profile_path2.empty()); profile_manager->ScheduleProfileForDeletion(profile_path1, @@ -99,7 +99,7 @@ IN_PROC_BROWSER_TEST_F(ProfileManagerBrowserTest, MAYBE_DeleteAllProfiles) { // Make sure a new profile was created automatically. EXPECT_EQ(cache.GetNumberOfProfiles(), 1U); - FilePath new_profile_path = cache.GetPathOfProfileAtIndex(0); + base::FilePath new_profile_path = cache.GetPathOfProfileAtIndex(0); EXPECT_NE(new_profile_path, profile_path1); EXPECT_NE(new_profile_path, profile_path2); diff --git a/chrome/browser/profiles/profile_manager_unittest.cc b/chrome/browser/profiles/profile_manager_unittest.cc index 67c2102..0677047 100644 --- a/chrome/browser/profiles/profile_manager_unittest.cc +++ b/chrome/browser/profiles/profile_manager_unittest.cc @@ -56,11 +56,12 @@ namespace testing { class ProfileManager : public ::ProfileManagerWithoutInit { public: - explicit ProfileManager(const FilePath& user_data_dir) + explicit ProfileManager(const base::FilePath& user_data_dir) : ::ProfileManagerWithoutInit(user_data_dir) {} protected: - virtual Profile* CreateProfileHelper(const FilePath& file_path) OVERRIDE { + virtual Profile* CreateProfileHelper( + const base::FilePath& file_path) OVERRIDE { if (!file_util::PathExists(file_path)) { if (!file_util::CreateDirectory(file_path)) return NULL; @@ -68,7 +69,7 @@ class ProfileManager : public ::ProfileManagerWithoutInit { return new TestingProfile(file_path, NULL); } - virtual Profile* CreateProfileAsyncHelper(const FilePath& path, + virtual Profile* CreateProfileAsyncHelper(const base::FilePath& path, Delegate* delegate) OVERRIDE { // This is safe while all file operations are done on the FILE thread. BrowserThread::PostTask( @@ -145,7 +146,7 @@ class ProfileManagerTest : public testing::Test { }; TEST_F(ProfileManagerTest, GetProfile) { - FilePath dest_path = temp_dir_.path(); + base::FilePath dest_path = temp_dir_.path(); dest_path = dest_path.Append(FILE_PATH_LITERAL("New Profile")); ProfileManager* profile_manager = g_browser_process->profile_manager(); @@ -159,8 +160,8 @@ TEST_F(ProfileManagerTest, GetProfile) { } TEST_F(ProfileManagerTest, DefaultProfileDir) { - FilePath expected_default = - FilePath().AppendASCII(chrome::kInitialProfile); + base::FilePath expected_default = + base::FilePath().AppendASCII(chrome::kInitialProfile); EXPECT_EQ( expected_default.value(), g_browser_process->profile_manager()->GetInitialProfileDir().value()); @@ -174,8 +175,8 @@ TEST_F(ProfileManagerTest, LoggedInProfileDir) { cl->AppendSwitchASCII(switches::kLoginProfile, profile_dir); - FilePath expected_default = - FilePath().AppendASCII(chrome::kInitialProfile); + base::FilePath expected_default = + base::FilePath().AppendASCII(chrome::kInitialProfile); ProfileManager* profile_manager = g_browser_process->profile_manager(); EXPECT_EQ(expected_default.value(), profile_manager->GetInitialProfileDir().value()); @@ -183,7 +184,7 @@ TEST_F(ProfileManagerTest, LoggedInProfileDir) { profile_manager->Observe(chrome::NOTIFICATION_LOGIN_USER_CHANGED, content::NotificationService::AllSources(), content::NotificationService::NoDetails()); - FilePath expected_logged_in(profile_dir); + base::FilePath expected_logged_in(profile_dir); EXPECT_EQ(expected_logged_in.value(), profile_manager->GetInitialProfileDir().value()); VLOG(1) << temp_dir_.path().Append( @@ -193,10 +194,10 @@ TEST_F(ProfileManagerTest, LoggedInProfileDir) { #endif TEST_F(ProfileManagerTest, CreateAndUseTwoProfiles) { - FilePath dest_path1 = temp_dir_.path(); + base::FilePath dest_path1 = temp_dir_.path(); dest_path1 = dest_path1.Append(FILE_PATH_LITERAL("New Profile 1")); - FilePath dest_path2 = temp_dir_.path(); + base::FilePath dest_path2 = temp_dir_.path(); dest_path2 = dest_path2.Append(FILE_PATH_LITERAL("New Profile 2")); ProfileManager* profile_manager = g_browser_process->profile_manager(); @@ -239,7 +240,7 @@ MATCHER(NotFail, "Profile creation failure status is not reported.") { // Tests asynchronous profile creation mechanism. // Crashes: http://crbug.com/89421 TEST_F(ProfileManagerTest, DISABLED_CreateProfileAsync) { - FilePath dest_path = + base::FilePath dest_path = temp_dir_.path().Append(FILE_PATH_LITERAL("New Profile")); MockObserver mock_observer; @@ -261,7 +262,7 @@ MATCHER(SameNotNull, "The same non-NULL value for all calls.") { } TEST_F(ProfileManagerTest, CreateProfileAsyncMultipleRequests) { - FilePath dest_path = + base::FilePath dest_path = temp_dir_.path().Append(FILE_PATH_LITERAL("New Profile")); g_created_profile = NULL; @@ -295,9 +296,9 @@ TEST_F(ProfileManagerTest, CreateProfileAsyncMultipleRequests) { } TEST_F(ProfileManagerTest, CreateProfilesAsync) { - FilePath dest_path1 = + base::FilePath dest_path1 = temp_dir_.path().Append(FILE_PATH_LITERAL("New Profile 1")); - FilePath dest_path2 = + base::FilePath dest_path2 = temp_dir_.path().Append(FILE_PATH_LITERAL("New Profile 2")); MockObserver mock_observer; @@ -368,7 +369,7 @@ TEST_F(ProfileManagerTest, DoNotAutoloadProfilesIfBackgroundModeOff) { } TEST_F(ProfileManagerTest, InitProfileUserPrefs) { - FilePath dest_path = temp_dir_.path(); + base::FilePath dest_path = temp_dir_.path(); dest_path = dest_path.Append(FILE_PATH_LITERAL("New Profile")); ProfileManager* profile_manager = g_browser_process->profile_manager(); @@ -394,7 +395,7 @@ TEST_F(ProfileManagerTest, InitProfileUserPrefs) { // Tests that a new profile's entry in the profile info cache is setup with the // same values that are in the profile prefs. TEST_F(ProfileManagerTest, InitProfileInfoCacheForAProfile) { - FilePath dest_path = temp_dir_.path(); + base::FilePath dest_path = temp_dir_.path(); dest_path = dest_path.Append(FILE_PATH_LITERAL("New Profile")); ProfileManager* profile_manager = g_browser_process->profile_manager(); @@ -421,10 +422,10 @@ TEST_F(ProfileManagerTest, InitProfileInfoCacheForAProfile) { #if !defined(OS_ANDROID) // There's no Browser object on Android. TEST_F(ProfileManagerTest, LastOpenedProfiles) { - FilePath dest_path1 = temp_dir_.path(); + base::FilePath dest_path1 = temp_dir_.path(); dest_path1 = dest_path1.Append(FILE_PATH_LITERAL("New Profile 1")); - FilePath dest_path2 = temp_dir_.path(); + base::FilePath dest_path2 = temp_dir_.path(); dest_path2 = dest_path2.Append(FILE_PATH_LITERAL("New Profile 2")); ProfileManager* profile_manager = g_browser_process->profile_manager(); @@ -485,10 +486,10 @@ TEST_F(ProfileManagerTest, LastOpenedProfiles) { } TEST_F(ProfileManagerTest, LastOpenedProfilesAtShutdown) { - FilePath dest_path1 = temp_dir_.path(); + base::FilePath dest_path1 = temp_dir_.path(); dest_path1 = dest_path1.Append(FILE_PATH_LITERAL("New Profile 1")); - FilePath dest_path2 = temp_dir_.path(); + base::FilePath dest_path2 = temp_dir_.path(); dest_path2 = dest_path2.Append(FILE_PATH_LITERAL("New Profile 2")); ProfileManager* profile_manager = g_browser_process->profile_manager(); @@ -534,9 +535,9 @@ TEST_F(ProfileManagerTest, LastOpenedProfilesAtShutdown) { } TEST_F(ProfileManagerTest, LastOpenedProfilesDoesNotContainIncognito) { - FilePath dest_path1 = temp_dir_.path(); + base::FilePath dest_path1 = temp_dir_.path(); dest_path1 = dest_path1.Append(FILE_PATH_LITERAL("New Profile 1")); - FilePath dest_path2 = temp_dir_.path(); + base::FilePath dest_path2 = temp_dir_.path(); dest_path2 = dest_path2.Append(FILE_PATH_LITERAL("New Profile 2")); ProfileManager* profile_manager = g_browser_process->profile_manager(); diff --git a/chrome/browser/profiles/profile_metrics.cc b/chrome/browser/profiles/profile_metrics.cc index e030b62..d1fb890 100644 --- a/chrome/browser/profiles/profile_metrics.cc +++ b/chrome/browser/profiles/profile_metrics.cc @@ -16,11 +16,11 @@ namespace { ProfileMetrics::ProfileType GetProfileType( - const FilePath& profile_path) { + const base::FilePath& profile_path) { DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); ProfileMetrics::ProfileType metric = ProfileMetrics::SECONDARY; ProfileManager* manager = g_browser_process->profile_manager(); - FilePath user_data_dir; + base::FilePath user_data_dir; // In unittests, we do not always have a profile_manager so check. if (manager) { user_data_dir = manager->user_data_dir(); @@ -224,19 +224,19 @@ void ProfileMetrics::LogProfileSyncInfo(ProfileSync metric) { NUM_PROFILE_SYNC_METRICS); } -void ProfileMetrics::LogProfileLaunch(const FilePath& profile_path) { +void ProfileMetrics::LogProfileLaunch(const base::FilePath& profile_path) { UMA_HISTOGRAM_ENUMERATION("Profile.LaunchBrowser", GetProfileType(profile_path), NUM_PROFILE_TYPE_METRICS); } -void ProfileMetrics::LogProfileSyncSignIn(const FilePath& profile_path) { +void ProfileMetrics::LogProfileSyncSignIn(const base::FilePath& profile_path) { UMA_HISTOGRAM_ENUMERATION("Profile.SyncSignIn", GetProfileType(profile_path), NUM_PROFILE_TYPE_METRICS); } -void ProfileMetrics::LogProfileUpdate(const FilePath& profile_path) { +void ProfileMetrics::LogProfileUpdate(const base::FilePath& profile_path) { UMA_HISTOGRAM_ENUMERATION("Profile.Update", GetProfileType(profile_path), NUM_PROFILE_TYPE_METRICS); diff --git a/chrome/browser/profiles/profile_shortcut_manager.h b/chrome/browser/profiles/profile_shortcut_manager.h index 55cae75..dc814b1 100644 --- a/chrome/browser/profiles/profile_shortcut_manager.h +++ b/chrome/browser/profiles/profile_shortcut_manager.h @@ -19,17 +19,17 @@ class ProfileShortcutManager { // Create a profile shortcut for the profile with path |profile_path|, plus // update the original profile shortcut if |profile_path| is the second // profile created. - virtual void CreateProfileShortcut(const FilePath& profile_path) = 0; + virtual void CreateProfileShortcut(const base::FilePath& profile_path) = 0; // Removes any desktop profile shortcuts for the profile corresponding to // |profile_path|. - virtual void RemoveProfileShortcuts(const FilePath& profile_path) = 0; + virtual void RemoveProfileShortcuts(const base::FilePath& profile_path) = 0; // Checks if a profile at |profile_path| has any shortcuts and invokes // |callback| with the bool result some time later. Does not consider // non-profile specific shortcuts. virtual void HasProfileShortcuts( - const FilePath& profile_path, + const base::FilePath& profile_path, const base::Callback<void(bool)>& callback) = 0; static bool IsFeatureEnabled(); diff --git a/chrome/browser/profiles/profile_shortcut_manager_unittest_win.cc b/chrome/browser/profiles/profile_shortcut_manager_unittest_win.cc index 44e7351..2025b1f 100644 --- a/chrome/browser/profiles/profile_shortcut_manager_unittest_win.cc +++ b/chrome/browser/profiles/profile_shortcut_manager_unittest_win.cc @@ -65,20 +65,20 @@ class ProfileShortcutManagerTest : public testing::Test { // Delete all profiles and ensure their shortcuts got removed. const int num_profiles = profile_info_cache_->GetNumberOfProfiles(); for (int i = 0; i < num_profiles; ++i) { - const FilePath profile_path = + const base::FilePath profile_path = profile_info_cache_->GetPathOfProfileAtIndex(0); string16 profile_name = profile_info_cache_->GetNameOfProfileAtIndex(0); profile_info_cache_->DeleteProfileFromCache(profile_path); RunPendingTasks(); ASSERT_FALSE(ProfileShortcutExistsAtDefaultPath(profile_name)); - const FilePath icon_path = + const base::FilePath icon_path = profile_path.AppendASCII(profiles::internal::kProfileIconFileName); ASSERT_FALSE(file_util::PathExists(icon_path)); } } - FilePath CreateProfileDirectory(const string16& profile_name) { - const FilePath profile_path = + base::FilePath CreateProfileDirectory(const string16& profile_name) { + const base::FilePath profile_path = profile_info_cache_->GetUserDataDir().Append(profile_name); file_util::CreateDirectoryW(profile_path); return profile_path; @@ -115,7 +115,8 @@ class ProfileShortcutManagerTest : public testing::Test { } // Returns the default shortcut path for this profile. - FilePath GetDefaultShortcutPathForProfile(const string16& profile_name) { + base::FilePath GetDefaultShortcutPathForProfile( + const string16& profile_name) { return GetUserShortcutsDirectory().Append( profiles::internal::GetShortcutFilenameForProfile(profile_name, GetDistribution())); @@ -130,12 +131,12 @@ class ProfileShortcutManagerTest : public testing::Test { // Calls base::win::ValidateShortcut() with expected properties for the // shortcut at |shortcut_path| for the profile at |profile_path|. void ValidateProfileShortcutAtPath(const tracked_objects::Location& location, - const FilePath& shortcut_path, - const FilePath& profile_path) { + const base::FilePath& shortcut_path, + const base::FilePath& profile_path) { EXPECT_TRUE(file_util::PathExists(shortcut_path)) << location.ToString(); // Ensure that the corresponding icon exists. - const FilePath icon_path = + const base::FilePath icon_path = profile_path.AppendASCII(profiles::internal::kProfileIconFileName); EXPECT_TRUE(file_util::PathExists(icon_path)) << location.ToString(); @@ -153,14 +154,14 @@ class ProfileShortcutManagerTest : public testing::Test { // |profile_name|'s shortcut. void ValidateProfileShortcut(const tracked_objects::Location& location, const string16& profile_name, - const FilePath& profile_path) { + const base::FilePath& profile_path) { ValidateProfileShortcutAtPath( location, GetDefaultShortcutPathForProfile(profile_name), profile_path); } void ValidateNonProfileShortcutAtPath( const tracked_objects::Location& location, - const FilePath& shortcut_path) { + const base::FilePath& shortcut_path) { EXPECT_TRUE(file_util::PathExists(shortcut_path)) << location.ToString(); base::win::ShortcutProperties expected_properties; @@ -173,13 +174,14 @@ class ProfileShortcutManagerTest : public testing::Test { } void ValidateNonProfileShortcut(const tracked_objects::Location& location) { - const FilePath shortcut_path = GetDefaultShortcutPathForProfile(string16()); + const base::FilePath shortcut_path = + GetDefaultShortcutPathForProfile(string16()); ValidateNonProfileShortcutAtPath(location, shortcut_path); } void CreateProfileWithShortcut(const tracked_objects::Location& location, const string16& profile_name, - const FilePath& profile_path) { + const base::FilePath& profile_path) { ASSERT_FALSE(ProfileShortcutExistsAtDefaultPath(profile_name)) << location.ToString(); profile_info_cache_->AddProfileToCache(profile_path, profile_name, @@ -191,10 +193,10 @@ class ProfileShortcutManagerTest : public testing::Test { // Creates a regular (non-profile) desktop shortcut with the given name and // returns its path. Fails the test if an error occurs. - FilePath CreateRegularShortcutWithName( + base::FilePath CreateRegularShortcutWithName( const tracked_objects::Location& location, const string16& shortcut_name) { - const FilePath shortcut_path = + const base::FilePath shortcut_path = GetUserShortcutsDirectory().Append(shortcut_name + installer::kLnkExt); EXPECT_FALSE(file_util::PathExists(shortcut_path)) << location.ToString(); @@ -210,7 +212,7 @@ class ProfileShortcutManagerTest : public testing::Test { return shortcut_path; } - FilePath CreateRegularSystemLevelShortcut( + base::FilePath CreateRegularSystemLevelShortcut( const tracked_objects::Location& location) { BrowserDistribution* distribution = GetDistribution(); installer::Product product(distribution); @@ -219,7 +221,7 @@ class ProfileShortcutManagerTest : public testing::Test { EXPECT_TRUE(ShellUtil::CreateOrUpdateShortcut( ShellUtil::SHORTCUT_LOCATION_DESKTOP, distribution, properties, ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS)) << location.ToString(); - const FilePath system_level_shortcut_path = + const base::FilePath system_level_shortcut_path = GetSystemShortcutsDirectory().Append( distribution->GetAppShortCutName() + installer::kLnkExt); EXPECT_TRUE(file_util::PathExists(system_level_shortcut_path)) @@ -228,7 +230,7 @@ class ProfileShortcutManagerTest : public testing::Test { } void RenameProfile(const tracked_objects::Location& location, - const FilePath& profile_path, + const base::FilePath& profile_path, const string16& new_profile_name) { const size_t profile_index = profile_info_cache_->GetIndexOfProfileWithPath(profile_2_path_); @@ -244,14 +246,14 @@ class ProfileShortcutManagerTest : public testing::Test { return BrowserDistribution::GetDistribution(); } - FilePath GetExePath() { - FilePath exe_path; + base::FilePath GetExePath() { + base::FilePath exe_path; EXPECT_TRUE(PathService::Get(base::FILE_EXE, &exe_path)); return exe_path; } - FilePath GetUserShortcutsDirectory() { - FilePath user_shortcuts_directory; + base::FilePath GetUserShortcutsDirectory() { + base::FilePath user_shortcuts_directory; EXPECT_TRUE(ShellUtil::GetShortcutPath(ShellUtil::SHORTCUT_LOCATION_DESKTOP, GetDistribution(), ShellUtil::CURRENT_USER, @@ -259,8 +261,8 @@ class ProfileShortcutManagerTest : public testing::Test { return user_shortcuts_directory; } - FilePath GetSystemShortcutsDirectory() { - FilePath system_shortcuts_directory; + base::FilePath GetSystemShortcutsDirectory() { + base::FilePath system_shortcuts_directory; EXPECT_TRUE(ShellUtil::GetShortcutPath(ShellUtil::SHORTCUT_LOCATION_DESKTOP, GetDistribution(), ShellUtil::SYSTEM_LEVEL, @@ -277,11 +279,11 @@ class ProfileShortcutManagerTest : public testing::Test { base::ScopedPathOverride fake_user_desktop_; base::ScopedPathOverride fake_system_desktop_; string16 profile_1_name_; - FilePath profile_1_path_; + base::FilePath profile_1_path_; string16 profile_2_name_; - FilePath profile_2_path_; + base::FilePath profile_2_path_; string16 profile_3_name_; - FilePath profile_3_path_; + base::FilePath profile_3_path_; }; TEST_F(ProfileShortcutManagerTest, ShortcutFilename) { @@ -324,7 +326,7 @@ TEST_F(ProfileShortcutManagerTest, UnbadgedShortcutFilename) { TEST_F(ProfileShortcutManagerTest, ShortcutFlags) { const string16 kProfileName = L"MyProfileX"; - const FilePath profile_path = + const base::FilePath profile_path = profile_info_cache_->GetUserDataDir().Append(kProfileName); EXPECT_EQ(L"--profile-directory=\"" + kProfileName + L"\"", profiles::internal::CreateProfileShortcutFlags(profile_path)); @@ -384,9 +386,9 @@ TEST_F(ProfileShortcutManagerTest, DesktopShortcutsDeleteSecondToLast) { TEST_F(ProfileShortcutManagerTest, DeleteSecondToLastProfileWithoutShortcut) { SetupAndCreateTwoShortcuts(FROM_HERE); - const FilePath profile_1_shortcut_path = + const base::FilePath profile_1_shortcut_path = GetDefaultShortcutPathForProfile(profile_1_name_); - const FilePath profile_2_shortcut_path = + const base::FilePath profile_2_shortcut_path = GetDefaultShortcutPathForProfile(profile_2_name_); // Delete the shortcut for the first profile, but keep the one for the 2nd. @@ -408,9 +410,9 @@ TEST_F(ProfileShortcutManagerTest, DeleteSecondToLastProfileWithoutShortcut) { TEST_F(ProfileShortcutManagerTest, DeleteSecondToLastProfileWithShortcut) { SetupAndCreateTwoShortcuts(FROM_HERE); - const FilePath profile_1_shortcut_path = + const base::FilePath profile_1_shortcut_path = GetDefaultShortcutPathForProfile(profile_1_name_); - const FilePath profile_2_shortcut_path = + const base::FilePath profile_2_shortcut_path = GetDefaultShortcutPathForProfile(profile_2_name_); // Delete the shortcut for the first profile, but keep the one for the 2nd. @@ -433,13 +435,13 @@ TEST_F(ProfileShortcutManagerTest, DeleteOnlyProfileWithShortcuts) { SetupAndCreateTwoShortcuts(FROM_HERE); CreateProfileWithShortcut(FROM_HERE, profile_3_name_, profile_3_path_); - const FilePath non_profile_shortcut_path = + const base::FilePath non_profile_shortcut_path = GetDefaultShortcutPathForProfile(string16()); - const FilePath profile_1_shortcut_path = + const base::FilePath profile_1_shortcut_path = GetDefaultShortcutPathForProfile(profile_1_name_); - const FilePath profile_2_shortcut_path = + const base::FilePath profile_2_shortcut_path = GetDefaultShortcutPathForProfile(profile_2_name_); - const FilePath profile_3_shortcut_path = + const base::FilePath profile_3_shortcut_path = GetDefaultShortcutPathForProfile(profile_3_name_); // Delete shortcuts for the first two profiles. @@ -487,9 +489,9 @@ TEST_F(ProfileShortcutManagerTest, DesktopShortcutsCreateSecond) { TEST_F(ProfileShortcutManagerTest, RenamedDesktopShortcuts) { SetupAndCreateTwoShortcuts(FROM_HERE); - const FilePath profile_2_shortcut_path_1 = + const base::FilePath profile_2_shortcut_path_1 = GetDefaultShortcutPathForProfile(profile_2_name_); - const FilePath profile_2_shortcut_path_2 = + const base::FilePath profile_2_shortcut_path_2 = GetUserShortcutsDirectory().Append(L"MyChrome.lnk"); ASSERT_TRUE(file_util::Move(profile_2_shortcut_path_1, profile_2_shortcut_path_2)); @@ -512,9 +514,9 @@ TEST_F(ProfileShortcutManagerTest, RenamedDesktopShortcuts) { TEST_F(ProfileShortcutManagerTest, RenamedDesktopShortcutsGetDeleted) { SetupAndCreateTwoShortcuts(FROM_HERE); - const FilePath profile_2_shortcut_path_1 = + const base::FilePath profile_2_shortcut_path_1 = GetDefaultShortcutPathForProfile(profile_2_name_); - const FilePath profile_2_shortcut_path_2 = + const base::FilePath profile_2_shortcut_path_2 = GetUserShortcutsDirectory().Append(L"MyChrome.lnk"); // Make a copy of the shortcut. ASSERT_TRUE(file_util::CopyFile(profile_2_shortcut_path_1, @@ -525,7 +527,7 @@ TEST_F(ProfileShortcutManagerTest, RenamedDesktopShortcutsGetDeleted) { profile_2_path_); // Also, copy the shortcut for the first user and ensure it gets preserved. - const FilePath preserved_profile_1_shortcut_path = + const base::FilePath preserved_profile_1_shortcut_path = GetUserShortcutsDirectory().Append(L"Preserved.lnk"); ASSERT_TRUE(file_util::CopyFile( GetDefaultShortcutPathForProfile(profile_1_name_), @@ -544,9 +546,9 @@ TEST_F(ProfileShortcutManagerTest, RenamedDesktopShortcutsGetDeleted) { TEST_F(ProfileShortcutManagerTest, RenamedDesktopShortcutsAfterProfileRename) { SetupAndCreateTwoShortcuts(FROM_HERE); - const FilePath profile_2_shortcut_path_1 = + const base::FilePath profile_2_shortcut_path_1 = GetDefaultShortcutPathForProfile(profile_2_name_); - const FilePath profile_2_shortcut_path_2 = + const base::FilePath profile_2_shortcut_path_2 = GetUserShortcutsDirectory().Append(L"MyChrome.lnk"); // Make a copy of the shortcut. ASSERT_TRUE(file_util::CopyFile(profile_2_shortcut_path_1, @@ -575,7 +577,7 @@ TEST_F(ProfileShortcutManagerTest, UpdateShortcutWithNoFlags) { // a new one without any command-line flags. ASSERT_TRUE(file_util::Delete(GetDefaultShortcutPathForProfile(string16()), false)); - const FilePath regular_shortcut_path = + const base::FilePath regular_shortcut_path = CreateRegularShortcutWithName(FROM_HERE, GetDistribution()->GetAppShortCutName()); @@ -593,10 +595,10 @@ TEST_F(ProfileShortcutManagerTest, UpdateTwoShortcutsWithNoFlags) { // two new ones without any command-line flags. ASSERT_TRUE(file_util::Delete(GetDefaultShortcutPathForProfile(string16()), false)); - const FilePath regular_shortcut_path = + const base::FilePath regular_shortcut_path = CreateRegularShortcutWithName(FROM_HERE, GetDistribution()->GetAppShortCutName()); - const FilePath customized_regular_shortcut_path = + const base::FilePath customized_regular_shortcut_path = CreateRegularShortcutWithName(FROM_HERE, L"MyChrome"); // Add another profile and check that one shortcut was renamed and that the @@ -612,15 +614,15 @@ TEST_F(ProfileShortcutManagerTest, RemoveProfileShortcuts) { SetupAndCreateTwoShortcuts(FROM_HERE); CreateProfileWithShortcut(FROM_HERE, profile_3_name_, profile_3_path_); - const FilePath profile_1_shortcut_path_1 = + const base::FilePath profile_1_shortcut_path_1 = GetDefaultShortcutPathForProfile(profile_1_name_); - const FilePath profile_2_shortcut_path_1 = + const base::FilePath profile_2_shortcut_path_1 = GetDefaultShortcutPathForProfile(profile_2_name_); // Make copies of the shortcuts for both profiles. - const FilePath profile_1_shortcut_path_2 = + const base::FilePath profile_1_shortcut_path_2 = GetUserShortcutsDirectory().Append(L"Copied1.lnk"); - const FilePath profile_2_shortcut_path_2 = + const base::FilePath profile_2_shortcut_path_2 = GetUserShortcutsDirectory().Append(L"Copied2.lnk"); ASSERT_TRUE(file_util::CopyFile(profile_1_shortcut_path_1, profile_1_shortcut_path_2)); @@ -661,7 +663,7 @@ TEST_F(ProfileShortcutManagerTest, HasProfileShortcuts) { EXPECT_TRUE(result.has_shortcuts); // Delete the shortcut and check that the function returns false. - const FilePath profile_2_shortcut_path = + const base::FilePath profile_2_shortcut_path = GetDefaultShortcutPathForProfile(profile_2_name_); ASSERT_TRUE(file_util::Delete(profile_2_shortcut_path, false)); EXPECT_FALSE(file_util::PathExists(profile_2_shortcut_path)); @@ -671,7 +673,7 @@ TEST_F(ProfileShortcutManagerTest, HasProfileShortcuts) { } TEST_F(ProfileShortcutManagerTest, ProfileShortcutsWithSystemLevelShortcut) { - const FilePath system_level_shortcut_path = + const base::FilePath system_level_shortcut_path = CreateRegularSystemLevelShortcut(FROM_HERE); // Create the initial profile. @@ -697,7 +699,7 @@ TEST_F(ProfileShortcutManagerTest, DeleteSecondToLastProfileWithSystemLevelShortcut) { SetupAndCreateTwoShortcuts(FROM_HERE); - const FilePath system_level_shortcut_path = + const base::FilePath system_level_shortcut_path = CreateRegularSystemLevelShortcut(FROM_HERE); // Delete a profile and verify that only the system-level shortcut still @@ -715,9 +717,9 @@ TEST_F(ProfileShortcutManagerTest, DeleteSecondToLastProfileWithShortcutWhenSystemLevelShortcutExists) { SetupAndCreateTwoShortcuts(FROM_HERE); - const FilePath profile_1_shortcut_path = + const base::FilePath profile_1_shortcut_path = GetDefaultShortcutPathForProfile(profile_1_name_); - const FilePath profile_2_shortcut_path = + const base::FilePath profile_2_shortcut_path = GetDefaultShortcutPathForProfile(profile_2_name_); // Delete the shortcut for the first profile, but keep the one for the 2nd. @@ -725,7 +727,7 @@ TEST_F(ProfileShortcutManagerTest, ASSERT_FALSE(file_util::PathExists(profile_1_shortcut_path)); ASSERT_TRUE(file_util::PathExists(profile_2_shortcut_path)); - const FilePath system_level_shortcut_path = + const base::FilePath system_level_shortcut_path = CreateRegularSystemLevelShortcut(FROM_HERE); // Delete the profile that has a shortcut, which will exercise the non-profile diff --git a/chrome/browser/profiles/profile_shortcut_manager_win.cc b/chrome/browser/profiles/profile_shortcut_manager_win.cc index 222821c..d747643 100644 --- a/chrome/browser/profiles/profile_shortcut_manager_win.cc +++ b/chrome/browser/profiles/profile_shortcut_manager_win.cc @@ -137,14 +137,14 @@ SkBitmap BadgeIcon(const SkBitmap& app_icon_bitmap, // badging the browser distribution icon with the profile avatar. // Returns a path to the shortcut icon file on disk, which is empty if this // fails. Use index 0 when assigning the resulting file as the icon. -FilePath CreateChromeDesktopShortcutIconForProfile( - const FilePath& profile_path, +base::FilePath CreateChromeDesktopShortcutIconForProfile( + const base::FilePath& profile_path, const SkBitmap& avatar_bitmap_1x, const SkBitmap& avatar_bitmap_2x) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); scoped_ptr<SkBitmap> app_icon_bitmap(GetAppIconForSize(kShortcutIconSize)); if (!app_icon_bitmap.get()) - return FilePath(); + return base::FilePath(); const SkBitmap badged_bitmap = BadgeIcon(*app_icon_bitmap, avatar_bitmap_1x, 1); @@ -155,19 +155,20 @@ FilePath CreateChromeDesktopShortcutIconForProfile( large_badged_bitmap = BadgeIcon(*app_icon_bitmap, avatar_bitmap_2x, 2); // Finally, write the .ico file containing this new bitmap. - const FilePath icon_path = + const base::FilePath icon_path = profile_path.AppendASCII(profiles::internal::kProfileIconFileName); if (!IconUtil::CreateIconFileFromSkBitmap(badged_bitmap, large_badged_bitmap, icon_path)) - return FilePath(); + return base::FilePath(); return icon_path; } // Gets the user and system directories for desktop shortcuts. Parameters may // be NULL if a directory type is not needed. Returns true on success. -bool GetDesktopShortcutsDirectories(FilePath* user_shortcuts_directory, - FilePath* system_shortcuts_directory) { +bool GetDesktopShortcutsDirectories( + base::FilePath* user_shortcuts_directory, + base::FilePath* system_shortcuts_directory) { BrowserDistribution* distribution = BrowserDistribution::GetDistribution(); if (user_shortcuts_directory && !ShellUtil::GetShortcutPath(ShellUtil::SHORTCUT_LOCATION_DESKTOP, @@ -188,27 +189,27 @@ bool GetDesktopShortcutsDirectories(FilePath* user_shortcuts_directory, // Returns the long form of |path|, which will expand any shortened components // like "foo~2" to their full names. -FilePath ConvertToLongPath(const FilePath& path) { +base::FilePath ConvertToLongPath(const base::FilePath& path) { const size_t length = GetLongPathName(path.value().c_str(), NULL, 0); if (length != 0 && length != path.value().length()) { std::vector<wchar_t> long_path(length); if (GetLongPathName(path.value().c_str(), &long_path[0], length) != 0) - return FilePath(&long_path[0]); + return base::FilePath(&long_path[0]); } return path; } // Returns true if the file at |path| is a Chrome shortcut and returns its // command line in output parameter |command_line|. -bool IsChromeShortcut(const FilePath& path, - const FilePath& chrome_exe, +bool IsChromeShortcut(const base::FilePath& path, + const base::FilePath& chrome_exe, string16* command_line) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); if (path.Extension() != installer::kLnkExt) return false; - FilePath target_path; + base::FilePath target_path; if (!base::win::ResolveShortcut(path, &target_path, command_line)) return false; // One of the paths may be in short (elided) form. Compare long paths to @@ -219,17 +220,17 @@ bool IsChromeShortcut(const FilePath& path, // Populates |paths| with the file paths of Chrome desktop shortcuts that have // the specified |command_line|. If |include_empty_command_lines| is true, // Chrome desktop shortcuts with empty command lines will also be included. -void ListDesktopShortcutsWithCommandLine(const FilePath& chrome_exe, +void ListDesktopShortcutsWithCommandLine(const base::FilePath& chrome_exe, const string16& command_line, bool include_empty_command_lines, - std::vector<FilePath>* paths) { - FilePath user_shortcuts_directory; + std::vector<base::FilePath>* paths) { + base::FilePath user_shortcuts_directory; if (!GetDesktopShortcutsDirectories(&user_shortcuts_directory, NULL)) return; file_util::FileEnumerator enumerator(user_shortcuts_directory, false, file_util::FileEnumerator::FILES); - for (FilePath path = enumerator.Next(); !path.empty(); + for (base::FilePath path = enumerator.Next(); !path.empty(); path = enumerator.Next()) { string16 shortcut_command_line; if (!IsChromeShortcut(path, chrome_exe, &shortcut_command_line)) @@ -252,22 +253,22 @@ void RenameChromeDesktopShortcutForProfile( const string16& new_shortcut_filename) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); - FilePath user_shortcuts_directory; - FilePath system_shortcuts_directory; + base::FilePath user_shortcuts_directory; + base::FilePath system_shortcuts_directory; if (!GetDesktopShortcutsDirectories(&user_shortcuts_directory, &system_shortcuts_directory)) { return; } - const FilePath old_shortcut_path = + const base::FilePath old_shortcut_path = user_shortcuts_directory.Append(old_shortcut_filename); - const FilePath new_shortcut_path = + const base::FilePath new_shortcut_path = user_shortcuts_directory.Append(new_shortcut_filename); if (file_util::PathExists(old_shortcut_path)) { // Rename the old shortcut unless a system-level shortcut exists at the // destination, in which case the old shortcut is simply deleted. - const FilePath possible_new_system_shortcut = + const base::FilePath possible_new_system_shortcut = system_shortcuts_directory.Append(new_shortcut_filename); if (file_util::PathExists(possible_new_system_shortcut)) file_util::Delete(old_shortcut_path, false); @@ -280,7 +281,7 @@ void RenameChromeDesktopShortcutForProfile( // should only be the case for the original Chrome shortcut from an // installation. If that's the case, copy that one over - it will get its // properties updated by |CreateOrUpdateDesktopShortcutsForProfile()|. - const FilePath possible_old_system_shortcut = + const base::FilePath possible_old_system_shortcut = system_shortcuts_directory.Append(old_shortcut_filename); if (file_util::PathExists(possible_old_system_shortcut)) file_util::CopyFile(possible_old_system_shortcut, new_shortcut_path); @@ -292,7 +293,7 @@ void RenameChromeDesktopShortcutForProfile( // created if no existing ones were found. Whether non-profile shortcuts should // be updated is specified by |action|. Must be called on the FILE thread. void CreateOrUpdateDesktopShortcutsForProfile( - const FilePath& profile_path, + const base::FilePath& profile_path, const string16& old_profile_name, const string16& profile_name, const SkBitmap& avatar_image_1x, @@ -301,7 +302,7 @@ void CreateOrUpdateDesktopShortcutsForProfile( ProfileShortcutManagerWin::NonProfileShortcutAction action) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); - FilePath chrome_exe; + base::FilePath chrome_exe; if (!PathService::Get(base::FILE_EXE, &chrome_exe)) { NOTREACHED(); return; @@ -334,7 +335,7 @@ void CreateOrUpdateDesktopShortcutsForProfile( // If it is empty, it means the shortcut being created should be a regular, // non-profile Chrome shortcut. if (!profile_name.empty()) { - const FilePath shortcut_icon = + const base::FilePath shortcut_icon = CreateChromeDesktopShortcutIconForProfile(profile_path, avatar_image_1x, avatar_image_2x); @@ -350,7 +351,7 @@ void CreateOrUpdateDesktopShortcutsForProfile( ShellUtil::ShortcutOperation operation = ShellUtil::SHELL_SHORTCUT_REPLACE_EXISTING; - std::vector<FilePath> shortcuts; + std::vector<base::FilePath> shortcuts; ListDesktopShortcutsWithCommandLine(chrome_exe, command_line, action == ProfileShortcutManagerWin::UPDATE_NON_PROFILE_SHORTCUTS, &shortcuts); @@ -359,12 +360,13 @@ void CreateOrUpdateDesktopShortcutsForProfile( const string16 shortcut_name = profiles::internal::GetShortcutFilenameForProfile(profile_name, distribution); - shortcuts.push_back(FilePath(shortcut_name)); + shortcuts.push_back(base::FilePath(shortcut_name)); operation = ShellUtil::SHELL_SHORTCUT_CREATE_IF_NO_SYSTEM_LEVEL; } for (size_t i = 0; i < shortcuts.size(); ++i) { - const FilePath shortcut_name = shortcuts[i].BaseName().RemoveExtension(); + const base::FilePath shortcut_name = + shortcuts[i].BaseName().RemoveExtension(); properties.set_shortcut_name(shortcut_name.value()); ShellUtil::CreateOrUpdateShortcut(ShellUtil::SHORTCUT_LOCATION_DESKTOP, distribution, properties, operation); @@ -373,14 +375,14 @@ void CreateOrUpdateDesktopShortcutsForProfile( // Returns true if any desktop shortcuts exist with target |chrome_exe|, // regardless of their command line arguments. -bool ChromeDesktopShortcutsExist(const FilePath& chrome_exe) { - FilePath user_shortcuts_directory; +bool ChromeDesktopShortcutsExist(const base::FilePath& chrome_exe) { + base::FilePath user_shortcuts_directory; if (!GetDesktopShortcutsDirectories(&user_shortcuts_directory, NULL)) return false; file_util::FileEnumerator enumerator(user_shortcuts_directory, false, file_util::FileEnumerator::FILES); - for (FilePath path = enumerator.Next(); !path.empty(); + for (base::FilePath path = enumerator.Next(); !path.empty(); path = enumerator.Next()) { if (IsChromeShortcut(path, chrome_exe, NULL)) return true; @@ -393,11 +395,11 @@ bool ChromeDesktopShortcutsExist(const FilePath& chrome_exe) { // corresponding icon file. If |ensure_shortcuts_remain| is true, then a regular // non-profile shortcut will be created if this function would otherwise delete // the last Chrome desktop shortcut(s). Must be called on the FILE thread. -void DeleteDesktopShortcutsAndIconFile(const FilePath& profile_path, +void DeleteDesktopShortcutsAndIconFile(const base::FilePath& profile_path, bool ensure_shortcuts_remain) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); - FilePath chrome_exe; + base::FilePath chrome_exe; if (!PathService::Get(base::FILE_EXE, &chrome_exe)) { NOTREACHED(); return; @@ -405,7 +407,7 @@ void DeleteDesktopShortcutsAndIconFile(const FilePath& profile_path, const string16 command_line = profiles::internal::CreateProfileShortcutFlags(profile_path); - std::vector<FilePath> shortcuts; + std::vector<base::FilePath> shortcuts; ListDesktopShortcutsWithCommandLine(chrome_exe, command_line, false, &shortcuts); @@ -418,7 +420,7 @@ void DeleteDesktopShortcutsAndIconFile(const FilePath& profile_path, &shortcut_name); } - const FilePath icon_path = + const base::FilePath icon_path = profile_path.AppendASCII(profiles::internal::kProfileIconFileName); file_util::Delete(icon_path, false); @@ -446,10 +448,10 @@ void DeleteDesktopShortcutsAndIconFile(const FilePath& profile_path, // Returns true if profile at |profile_path| has any shortcuts. Does not // consider non-profile shortcuts. Must be called on the FILE thread. -bool HasAnyProfileShortcuts(const FilePath& profile_path) { +bool HasAnyProfileShortcuts(const base::FilePath& profile_path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); - FilePath chrome_exe; + base::FilePath chrome_exe; if (!PathService::Get(base::FILE_EXE, &chrome_exe)) { NOTREACHED(); return false; @@ -457,7 +459,7 @@ bool HasAnyProfileShortcuts(const FilePath& profile_path) { const string16 command_line = profiles::internal::CreateProfileShortcutFlags(profile_path); - std::vector<FilePath> shortcuts; + std::vector<base::FilePath> shortcuts; ListDesktopShortcutsWithCommandLine(chrome_exe, command_line, false, &shortcuts); return !shortcuts.empty(); @@ -518,7 +520,7 @@ string16 GetShortcutFilenameForProfile(const string16& profile_name, return shortcut_name + installer::kLnkExt; } -string16 CreateProfileShortcutFlags(const FilePath& profile_path) { +string16 CreateProfileShortcutFlags(const base::FilePath& profile_path) { return base::StringPrintf(L"--%ls=\"%ls\"", ASCIIToUTF16(switches::kProfileDirectory).c_str(), profile_path.BaseName().value().c_str()); @@ -553,27 +555,28 @@ ProfileShortcutManagerWin::~ProfileShortcutManagerWin() { } void ProfileShortcutManagerWin::CreateProfileShortcut( - const FilePath& profile_path) { + const base::FilePath& profile_path) { CreateOrUpdateShortcutsForProfileAtPath(profile_path, CREATE_WHEN_NONE_FOUND, IGNORE_NON_PROFILE_SHORTCUTS); } void ProfileShortcutManagerWin::RemoveProfileShortcuts( - const FilePath& profile_path) { + const base::FilePath& profile_path) { BrowserThread::PostTask( BrowserThread::FILE, FROM_HERE, base::Bind(&DeleteDesktopShortcutsAndIconFile, profile_path, false)); } void ProfileShortcutManagerWin::HasProfileShortcuts( - const FilePath& profile_path, + const base::FilePath& profile_path, const base::Callback<void(bool)>& callback) { BrowserThread::PostTaskAndReplyWithResult( BrowserThread::FILE, FROM_HERE, base::Bind(&HasAnyProfileShortcuts, profile_path), callback); } -void ProfileShortcutManagerWin::OnProfileAdded(const FilePath& profile_path) { +void ProfileShortcutManagerWin::OnProfileAdded( + const base::FilePath& profile_path) { const size_t profile_count = profile_manager_->GetProfileInfoCache().GetNumberOfProfiles(); if (profile_count == 1) { @@ -588,11 +591,11 @@ void ProfileShortcutManagerWin::OnProfileAdded(const FilePath& profile_path) { } void ProfileShortcutManagerWin::OnProfileWillBeRemoved( - const FilePath& profile_path) { + const base::FilePath& profile_path) { } void ProfileShortcutManagerWin::OnProfileWasRemoved( - const FilePath& profile_path, + const base::FilePath& profile_path, const string16& profile_name) { const ProfileInfoCache& cache = profile_manager_->GetProfileInfoCache(); // If there is only one profile remaining, remove the badging information @@ -611,20 +614,20 @@ void ProfileShortcutManagerWin::OnProfileWasRemoved( } void ProfileShortcutManagerWin::OnProfileNameChanged( - const FilePath& profile_path, + const base::FilePath& profile_path, const string16& old_profile_name) { CreateOrUpdateShortcutsForProfileAtPath(profile_path, UPDATE_EXISTING_ONLY, IGNORE_NON_PROFILE_SHORTCUTS); } void ProfileShortcutManagerWin::OnProfileAvatarChanged( - const FilePath& profile_path) { + const base::FilePath& profile_path) { CreateOrUpdateShortcutsForProfileAtPath(profile_path, UPDATE_EXISTING_ONLY, IGNORE_NON_PROFILE_SHORTCUTS); } -FilePath ProfileShortcutManagerWin::GetOtherProfilePath( - const FilePath& profile_path) { +base::FilePath ProfileShortcutManagerWin::GetOtherProfilePath( + const base::FilePath& profile_path) { const ProfileInfoCache& cache = profile_manager_->GetProfileInfoCache(); DCHECK_EQ(2U, cache.GetNumberOfProfiles()); // Get the index of the current profile, in order to find the index of the @@ -635,7 +638,7 @@ FilePath ProfileShortcutManagerWin::GetOtherProfilePath( } void ProfileShortcutManagerWin::CreateOrUpdateShortcutsForProfileAtPath( - const FilePath& profile_path, + const base::FilePath& profile_path, CreateOrUpdateMode create_mode, NonProfileShortcutAction action) { ProfileInfoCache* cache = &profile_manager_->GetProfileInfoCache(); diff --git a/chrome/browser/profiles/profile_shortcut_manager_win.h b/chrome/browser/profiles/profile_shortcut_manager_win.h index 5d3a91f..631a713 100644 --- a/chrome/browser/profiles/profile_shortcut_manager_win.h +++ b/chrome/browser/profiles/profile_shortcut_manager_win.h @@ -23,7 +23,7 @@ string16 GetShortcutFilenameForProfile(const string16& profile_name, BrowserDistribution* distribution); // Returns the command-line flags to launch Chrome with the given profile. -string16 CreateProfileShortcutFlags(const FilePath& profile_path); +string16 CreateProfileShortcutFlags(const base::FilePath& profile_path); } // namespace internal } // namespace profiles @@ -46,29 +46,34 @@ class ProfileShortcutManagerWin : public ProfileShortcutManager, virtual ~ProfileShortcutManagerWin(); // ProfileShortcutManager implementation: - virtual void CreateProfileShortcut(const FilePath& profile_path) OVERRIDE; - virtual void RemoveProfileShortcuts(const FilePath& profile_path) OVERRIDE; + virtual void CreateProfileShortcut( + const base::FilePath& profile_path) OVERRIDE; + virtual void RemoveProfileShortcuts( + const base::FilePath& profile_path) OVERRIDE; virtual void HasProfileShortcuts( - const FilePath& profile_path, + const base::FilePath& profile_path, const base::Callback<void(bool)>& callback) OVERRIDE; // ProfileInfoCacheObserver implementation: - virtual void OnProfileAdded(const FilePath& profile_path) OVERRIDE; - virtual void OnProfileWillBeRemoved(const FilePath& profile_path) OVERRIDE; - virtual void OnProfileWasRemoved(const FilePath& profile_path, + virtual void OnProfileAdded(const base::FilePath& profile_path) OVERRIDE; + virtual void OnProfileWillBeRemoved( + const base::FilePath& profile_path) OVERRIDE; + virtual void OnProfileWasRemoved(const base::FilePath& profile_path, const string16& profile_name) OVERRIDE; - virtual void OnProfileNameChanged(const FilePath& profile_path, + virtual void OnProfileNameChanged(const base::FilePath& profile_path, const string16& old_profile_name) OVERRIDE; - virtual void OnProfileAvatarChanged(const FilePath& profile_path) OVERRIDE; + virtual void OnProfileAvatarChanged( + const base::FilePath& profile_path) OVERRIDE; private: // Gives the profile path of an alternate profile than |profile_path|. // Must only be called when the number profiles is 2. - FilePath GetOtherProfilePath(const FilePath& profile_path); + base::FilePath GetOtherProfilePath(const base::FilePath& profile_path); - void CreateOrUpdateShortcutsForProfileAtPath(const FilePath& profile_path, - CreateOrUpdateMode create_mode, - NonProfileShortcutAction action); + void CreateOrUpdateShortcutsForProfileAtPath( + const base::FilePath& profile_path, + CreateOrUpdateMode create_mode, + NonProfileShortcutAction action); ProfileManager* profile_manager_; diff --git a/chrome/browser/profiles/storage_partition_descriptor.h b/chrome/browser/profiles/storage_partition_descriptor.h index 999b6d7c..e57e6c7 100644 --- a/chrome/browser/profiles/storage_partition_descriptor.h +++ b/chrome/browser/profiles/storage_partition_descriptor.h @@ -13,12 +13,12 @@ // a unique key to look up RequestContext objects in the ProfileIOData derived // classes. struct StoragePartitionDescriptor { - StoragePartitionDescriptor(const FilePath& partition_path, + StoragePartitionDescriptor(const base::FilePath& partition_path, const bool in_memory_only) : path(partition_path), in_memory(in_memory_only) {} - const FilePath path; + const base::FilePath path; const bool in_memory; }; diff --git a/chrome/browser/referrer_policy_browsertest.cc b/chrome/browser/referrer_policy_browsertest.cc index 364df50..83a32b4 100644 --- a/chrome/browser/referrer_policy_browsertest.cc +++ b/chrome/browser/referrer_policy_browsertest.cc @@ -36,7 +36,7 @@ namespace { -const FilePath::CharType kDocRoot[] = +const base::FilePath::CharType kDocRoot[] = FILE_PATH_LITERAL("chrome/test/data/referrer_policy"); } // namespace @@ -49,11 +49,11 @@ class ReferrerPolicyTest : public InProcessBrowserTest { virtual void SetUp() OVERRIDE { test_server_.reset(new net::TestServer(net::TestServer::TYPE_HTTP, net::TestServer::kLocalhost, - FilePath(kDocRoot))); + base::FilePath(kDocRoot))); ASSERT_TRUE(test_server_->Start()); ssl_test_server_.reset(new net::TestServer(net::TestServer::TYPE_HTTPS, net::TestServer::kLocalhost, - FilePath(kDocRoot))); + base::FilePath(kDocRoot))); ASSERT_TRUE(ssl_test_server_->Start()); InProcessBrowserTest::SetUp(); diff --git a/chrome/browser/renderer_host/chrome_render_message_filter.cc b/chrome/browser/renderer_host/chrome_render_message_filter.cc index da5419f..fc1fadb 100644 --- a/chrome/browser/renderer_host/chrome_render_message_filter.cc +++ b/chrome/browser/renderer_host/chrome_render_message_filter.cc @@ -372,7 +372,7 @@ void ChromeRenderMessageFilter::OnGetExtensionMessageBundle( const std::string& extension_id, IPC::Message* reply_msg) { const extensions::Extension* extension = extension_info_map_->extensions().GetByID(extension_id); - FilePath extension_path; + base::FilePath extension_path; std::string default_locale; if (extension) { extension_path = extension->path(); @@ -387,7 +387,7 @@ void ChromeRenderMessageFilter::OnGetExtensionMessageBundle( } void ChromeRenderMessageFilter::OnGetExtensionMessageBundleOnFileThread( - const FilePath& extension_path, + const base::FilePath& extension_path, const std::string& extension_id, const std::string& default_locale, IPC::Message* reply_msg) { diff --git a/chrome/browser/renderer_host/chrome_render_message_filter.h b/chrome/browser/renderer_host/chrome_render_message_filter.h index 981c1ee..7e36777 100644 --- a/chrome/browser/renderer_host/chrome_render_message_filter.h +++ b/chrome/browser/renderer_host/chrome_render_message_filter.h @@ -122,7 +122,7 @@ class ChromeRenderMessageFilter : public content::BrowserMessageFilter { void OnGetExtensionMessageBundle(const std::string& extension_id, IPC::Message* reply_msg); void OnGetExtensionMessageBundleOnFileThread( - const FilePath& extension_path, + const base::FilePath& extension_path, const std::string& extension_id, const std::string& default_locale, IPC::Message* reply_msg); diff --git a/chrome/browser/renderer_host/pepper/pepper_flash_device_id_host.cc b/chrome/browser/renderer_host/pepper/pepper_flash_device_id_host.cc index 2e23e0d..0eb522b 100644 --- a/chrome/browser/renderer_host/pepper/pepper_flash_device_id_host.cc +++ b/chrome/browser/renderer_host/pepper/pepper_flash_device_id_host.cc @@ -63,7 +63,7 @@ void PepperFlashDeviceIDHost::Fetcher::GetFilePathOnUIThread( int render_view_id) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - FilePath path; + base::FilePath path; content::RenderViewHost* render_view_host = content::RenderViewHost::FromID(render_process_id, render_view_id); if (render_view_host) { @@ -83,7 +83,7 @@ void PepperFlashDeviceIDHost::Fetcher::GetFilePathOnUIThread( } void PepperFlashDeviceIDHost::Fetcher::ReadDRMFileOnFileThread( - const FilePath& path) { + const base::FilePath& path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); std::string contents; diff --git a/chrome/browser/renderer_host/plugin_info_message_filter_unittest.cc b/chrome/browser/renderer_host/plugin_info_message_filter_unittest.cc index 50c0aa8..f7e905f 100644 --- a/chrome/browser/renderer_host/plugin_info_message_filter_unittest.cc +++ b/chrome/browser/renderer_host/plugin_info_message_filter_unittest.cc @@ -35,14 +35,14 @@ class FakePluginServiceFilter : public content::PluginServiceFilter { webkit::WebPluginInfo* plugin) OVERRIDE; virtual bool CanLoadPlugin(int render_process_id, - const FilePath& path) OVERRIDE; + const base::FilePath& path) OVERRIDE; - void set_plugin_enabled(const FilePath& plugin_path, bool enabled) { + void set_plugin_enabled(const base::FilePath& plugin_path, bool enabled) { plugin_state_[plugin_path] = enabled; } private: - std::map<FilePath, bool> plugin_state_; + std::map<base::FilePath, bool> plugin_state_; }; bool FakePluginServiceFilter::IsPluginAvailable(int render_process_id, @@ -51,7 +51,8 @@ bool FakePluginServiceFilter::IsPluginAvailable(int render_process_id, const GURL& url, const GURL& policy_url, webkit::WebPluginInfo* plugin) { - std::map<FilePath, bool>::iterator it = plugin_state_.find(plugin->path); + std::map<base::FilePath, bool>::iterator it = + plugin_state_.find(plugin->path); if (it == plugin_state_.end()) { ADD_FAILURE() << "No plug-in state for '" << plugin->path.value() << "'"; return false; @@ -60,7 +61,7 @@ bool FakePluginServiceFilter::IsPluginAvailable(int render_process_id, } bool FakePluginServiceFilter::CanLoadPlugin(int render_process_id, - const FilePath& path) { + const base::FilePath& path) { return true; } @@ -103,8 +104,8 @@ class PluginInfoMessageFilterTest : public ::testing::Test { } protected: - FilePath foo_plugin_path_; - FilePath bar_plugin_path_; + base::FilePath foo_plugin_path_; + base::FilePath bar_plugin_path_; FakePluginServiceFilter filter_; PluginInfoMessageFilter::Context context_; diff --git a/chrome/browser/renderer_host/web_cache_manager_browsertest.cc b/chrome/browser/renderer_host/web_cache_manager_browsertest.cc index f4a5e4b..500b5b1 100644 --- a/chrome/browser/renderer_host/web_cache_manager_browsertest.cc +++ b/chrome/browser/renderer_host/web_cache_manager_browsertest.cc @@ -25,8 +25,8 @@ class WebCacheManagerBrowserTest : public InProcessBrowserTest { // Regression test for http://crbug.com/12362. If a renderer crashes and the // user navigates to another tab and back, the browser doesn't crash. IN_PROC_BROWSER_TEST_F(WebCacheManagerBrowserTest, CrashOnceOnly) { - const FilePath kTestDir(FILE_PATH_LITERAL("google")); - const FilePath kTestFile(FILE_PATH_LITERAL("google.html")); + const base::FilePath kTestDir(FILE_PATH_LITERAL("google")); + const base::FilePath kTestFile(FILE_PATH_LITERAL("google.html")); GURL url(ui_test_utils::GetTestUrl(kTestDir, kTestFile)); ui_test_utils::NavigateToURL(browser(), url); diff --git a/chrome/browser/rlz/rlz_unittest.cc b/chrome/browser/rlz/rlz_unittest.cc index dc5152b..436dbf8 100644 --- a/chrome/browser/rlz/rlz_unittest.cc +++ b/chrome/browser/rlz/rlz_unittest.cc @@ -246,7 +246,7 @@ void RlzLibTest::SetUp() { void RlzLibTest::TearDown() { #if defined(OS_POSIX) - rlz_lib::testing::SetRlzStoreDirectory(FilePath()); + rlz_lib::testing::SetRlzStoreDirectory(base::FilePath()); #endif testing::Test::TearDown(); } diff --git a/chrome/browser/safe_browsing/download_protection_service.cc b/chrome/browser/safe_browsing/download_protection_service.cc index 4ecbd7b..36a78b5 100644 --- a/chrome/browser/safe_browsing/download_protection_service.cc +++ b/chrome/browser/safe_browsing/download_protection_service.cc @@ -50,11 +50,11 @@ const char DownloadProtectionService::kDownloadRequestUrl[] = "https://sb-ssl.google.com/safebrowsing/clientreport/download"; namespace { -bool IsArchiveFile(const FilePath& file) { +bool IsArchiveFile(const base::FilePath& file) { return file.MatchesExtension(FILE_PATH_LITERAL(".zip")); } -bool IsBinaryFile(const FilePath& file) { +bool IsBinaryFile(const base::FilePath& file) { return ( // Executable extensions for MS Windows. file.MatchesExtension(FILE_PATH_LITERAL(".bas")) || @@ -77,7 +77,8 @@ bool IsBinaryFile(const FilePath& file) { IsArchiveFile(file)); } -ClientDownloadRequest::DownloadType GetDownloadType(const FilePath& file) { +ClientDownloadRequest::DownloadType GetDownloadType( + const base::FilePath& file) { DCHECK(IsBinaryFile(file)); if (file.MatchesExtension(FILE_PATH_LITERAL(".apk"))) return ClientDownloadRequest::ANDROID_APK; @@ -116,7 +117,7 @@ enum MaliciousExtensionType { EXTENSION_MAX, }; -MaliciousExtensionType GetExtensionType(const FilePath& f) { +MaliciousExtensionType GetExtensionType(const base::FilePath& f) { if (f.MatchesExtension(FILE_PATH_LITERAL(".exe"))) return EXTENSION_EXE; if (f.MatchesExtension(FILE_PATH_LITERAL(".msi"))) return EXTENSION_MSI; if (f.MatchesExtension(FILE_PATH_LITERAL(".cab"))) return EXTENSION_CAB; @@ -140,7 +141,7 @@ MaliciousExtensionType GetExtensionType(const FilePath& f) { return EXTENSION_OTHER; } -void RecordFileExtensionType(const FilePath& file) { +void RecordFileExtensionType(const base::FilePath& file) { UMA_HISTOGRAM_ENUMERATION("SBClientDownload.DownloadExtensions", GetExtensionType(file), EXTENSION_MAX); @@ -569,7 +570,7 @@ class DownloadProtectionService::CheckClientDownloadRequest << info_.local_file.value(); continue; } - const FilePath& file = reader.current_entry_info()->file_path(); + const base::FilePath& file = reader.current_entry_info()->file_path(); if (IsBinaryFile(file)) { // Don't consider an archived archive to be executable, but record // a histogram. diff --git a/chrome/browser/safe_browsing/download_protection_service.h b/chrome/browser/safe_browsing/download_protection_service.h index 7caf03f..8bd6696 100644 --- a/chrome/browser/safe_browsing/download_protection_service.h +++ b/chrome/browser/safe_browsing/download_protection_service.h @@ -42,8 +42,8 @@ class DownloadProtectionService { // TODO(noelutz): we're missing some fields here: server IPs, // tab URL redirect chain, ... struct DownloadInfo { - FilePath local_file; // Where the download is currently stored. - FilePath target_file; // Where the download will eventually be stored. + base::FilePath local_file; // Where the download is currently stored. + base::FilePath target_file; // Where it will eventually be stored. std::vector<GURL> download_url_chain; GURL referrer_url; std::string sha256_hash; diff --git a/chrome/browser/safe_browsing/download_protection_service_unittest.cc b/chrome/browser/safe_browsing/download_protection_service_unittest.cc index 4aef699..0304c43 100644 --- a/chrome/browser/safe_browsing/download_protection_service_unittest.cc +++ b/chrome/browser/safe_browsing/download_protection_service_unittest.cc @@ -90,8 +90,8 @@ class FakeSafeBrowsingService : public SafeBrowsingService { class MockSignatureUtil : public SignatureUtil { public: MockSignatureUtil() {} - MOCK_METHOD2(CheckSignature, - void(const FilePath&, ClientDownloadRequest_SignatureInfo*)); + MOCK_METHOD2(CheckSignature, void (const base::FilePath&, + ClientDownloadRequest_SignatureInfo*)); protected: virtual ~MockSignatureUtil() {} @@ -159,7 +159,7 @@ class DownloadProtectionServiceTest : public testing::Test { msg_loop_.RunUntilIdle(); has_result_ = false; - FilePath source_path; + base::FilePath source_path; ASSERT_TRUE(PathService::Get(base::DIR_SOURCE_ROOT, &source_path)); testdata_path_ = source_path .AppendASCII("chrome") @@ -305,7 +305,7 @@ class DownloadProtectionServiceTest : public testing::Test { bool has_result_; scoped_ptr<content::TestBrowserThread> io_thread_; scoped_ptr<content::TestBrowserThread> ui_thread_; - FilePath testdata_path_; + base::FilePath testdata_path_; }; TEST_F(DownloadProtectionServiceTest, CheckClientDownloadInvalidUrl) { @@ -317,8 +317,8 @@ TEST_F(DownloadProtectionServiceTest, CheckClientDownloadInvalidUrl) { msg_loop_.Run(); EXPECT_TRUE(IsResult(DownloadProtectionService::SAFE)); - info.local_file = FilePath(FILE_PATH_LITERAL("a.tmp")); - info.target_file = FilePath(FILE_PATH_LITERAL("a.exe")); + info.local_file = base::FilePath(FILE_PATH_LITERAL("a.tmp")); + info.target_file = base::FilePath(FILE_PATH_LITERAL("a.exe")); info.download_url_chain.push_back(GURL("file://www.google.com/")); download_service_->CheckClientDownload( info, @@ -330,8 +330,8 @@ TEST_F(DownloadProtectionServiceTest, CheckClientDownloadInvalidUrl) { TEST_F(DownloadProtectionServiceTest, CheckClientDownloadWhitelistedUrl) { DownloadProtectionService::DownloadInfo info; - info.local_file = FilePath(FILE_PATH_LITERAL("a.tmp")); - info.target_file = FilePath(FILE_PATH_LITERAL("a.exe")); + info.local_file = base::FilePath(FILE_PATH_LITERAL("a.tmp")); + info.target_file = base::FilePath(FILE_PATH_LITERAL("a.exe")); info.download_url_chain.push_back(GURL("http://www.evil.com/bla.exe")); info.download_url_chain.push_back(GURL("http://www.google.com/a.exe")); info.referrer_url = GURL("http://www.google.com/"); @@ -369,8 +369,8 @@ TEST_F(DownloadProtectionServiceTest, CheckClientDownloadFetchFailed) { DownloadProtectionService::GetDownloadRequestUrl(), "", false); DownloadProtectionService::DownloadInfo info; - info.local_file = FilePath(FILE_PATH_LITERAL("a.tmp")); - info.target_file = FilePath(FILE_PATH_LITERAL("a.exe")); + info.local_file = base::FilePath(FILE_PATH_LITERAL("a.tmp")); + info.target_file = base::FilePath(FILE_PATH_LITERAL("a.exe")); info.download_url_chain.push_back(GURL("http://www.evil.com/a.exe")); info.referrer_url = GURL("http://www.google.com/"); @@ -398,8 +398,8 @@ TEST_F(DownloadProtectionServiceTest, CheckClientDownloadSuccess) { true); DownloadProtectionService::DownloadInfo info; - info.local_file = FilePath(FILE_PATH_LITERAL("a.tmp")); - info.target_file = FilePath(FILE_PATH_LITERAL("a.exe")); + info.local_file = base::FilePath(FILE_PATH_LITERAL("a.tmp")); + info.target_file = base::FilePath(FILE_PATH_LITERAL("a.exe")); info.download_url_chain.push_back(GURL("http://www.evil.com/a.exe")); info.referrer_url = GURL("http://www.google.com/"); @@ -495,8 +495,8 @@ TEST_F(DownloadProtectionServiceTest, CheckClientDownloadHTTPS) { true); DownloadProtectionService::DownloadInfo info; - info.local_file = FilePath(FILE_PATH_LITERAL("a.tmp")); - info.target_file = FilePath(FILE_PATH_LITERAL("a.exe")); + info.local_file = base::FilePath(FILE_PATH_LITERAL("a.tmp")); + info.target_file = base::FilePath(FILE_PATH_LITERAL("a.exe")); info.download_url_chain.push_back(GURL("https://www.evil.com/a.exe")); info.referrer_url = GURL("http://www.google.com/"); @@ -532,7 +532,7 @@ TEST_F(DownloadProtectionServiceTest, CheckClientDownloadZip) { DownloadProtectionService::DownloadInfo info; info.local_file = download_dir.path().Append(FILE_PATH_LITERAL("a.tmp")); - info.target_file = FilePath(FILE_PATH_LITERAL("a.zip")); + info.target_file = base::FilePath(FILE_PATH_LITERAL("a.zip")); info.download_url_chain.push_back(GURL("http://www.evil.com/a.zip")); info.referrer_url = GURL("http://www.google.com/"); @@ -600,7 +600,7 @@ TEST_F(DownloadProtectionServiceTest, CheckClientDownloadCorruptZip) { DownloadProtectionService::DownloadInfo info; info.local_file = download_dir.path().Append(FILE_PATH_LITERAL("a.tmp")); - info.target_file = FilePath(FILE_PATH_LITERAL("a.zip")); + info.target_file = base::FilePath(FILE_PATH_LITERAL("a.zip")); info.download_url_chain.push_back(GURL("http://www.evil.com/a.zip")); info.referrer_url = GURL("http://www.google.com/"); @@ -633,8 +633,8 @@ TEST_F(DownloadProtectionServiceTest, CheckClientCrxDownloadSuccess) { true); DownloadProtectionService::DownloadInfo info; - info.local_file = FilePath(FILE_PATH_LITERAL("a.tmp")); - info.target_file = FilePath(FILE_PATH_LITERAL("a.crx")); + info.local_file = base::FilePath(FILE_PATH_LITERAL("a.tmp")); + info.target_file = base::FilePath(FILE_PATH_LITERAL("a.crx")); info.download_url_chain.push_back(GURL("http://www.evil.com/a.crx")); info.referrer_url = GURL("http://www.google.com/"); @@ -656,8 +656,8 @@ TEST_F(DownloadProtectionServiceTest, CheckClientDownloadValidateRequest) { net::TestURLFetcherFactory factory; DownloadProtectionService::DownloadInfo info; - info.local_file = FilePath(FILE_PATH_LITERAL("bla.tmp")); - info.target_file = FilePath(FILE_PATH_LITERAL("bla.exe")); + info.local_file = base::FilePath(FILE_PATH_LITERAL("bla.tmp")); + info.target_file = base::FilePath(FILE_PATH_LITERAL("bla.exe")); info.download_url_chain.push_back(GURL("http://www.google.com/")); info.download_url_chain.push_back(GURL("http://www.google.com/bla.exe")); info.referrer_url = GURL("http://www.google.com/"); @@ -723,8 +723,8 @@ TEST_F(DownloadProtectionServiceTest, net::TestURLFetcherFactory factory; DownloadProtectionService::DownloadInfo info; - info.local_file = FilePath(FILE_PATH_LITERAL("bla.tmp")); - info.target_file = FilePath(FILE_PATH_LITERAL("bla.exe")); + info.local_file = base::FilePath(FILE_PATH_LITERAL("bla.tmp")); + info.target_file = base::FilePath(FILE_PATH_LITERAL("bla.exe")); info.download_url_chain.push_back(GURL("http://www.google.com/")); info.download_url_chain.push_back(GURL("ftp://www.google.com/bla.exe")); info.referrer_url = GURL("http://www.google.com/"); @@ -845,8 +845,8 @@ TEST_F(DownloadProtectionServiceTest, TestDownloadRequestTimeout) { DownloadProtectionService::DownloadInfo info; info.download_url_chain.push_back(GURL("http://www.evil.com/bla.exe")); info.referrer_url = GURL("http://www.google.com/"); - info.local_file = FilePath(FILE_PATH_LITERAL("a.tmp")); - info.target_file = FilePath(FILE_PATH_LITERAL("a.exe")); + info.local_file = base::FilePath(FILE_PATH_LITERAL("a.tmp")); + info.target_file = base::FilePath(FILE_PATH_LITERAL("a.exe")); EXPECT_CALL(*sb_service_->mock_database_manager(), MatchDownloadWhitelistUrl(_)) diff --git a/chrome/browser/safe_browsing/local_safebrowsing_test_server.cc b/chrome/browser/safe_browsing/local_safebrowsing_test_server.cc index 48e5cb9..8140105 100644 --- a/chrome/browser/safe_browsing/local_safebrowsing_test_server.cc +++ b/chrome/browser/safe_browsing/local_safebrowsing_test_server.cc @@ -12,18 +12,18 @@ #include "net/test/test_server.h" LocalSafeBrowsingTestServer::LocalSafeBrowsingTestServer( - const FilePath& data_file) + const base::FilePath& data_file) : net::LocalTestServer(net::TestServer::TYPE_HTTP, net::TestServer::kLocalhost, - FilePath()), + base::FilePath()), data_file_(data_file) { } LocalSafeBrowsingTestServer::~LocalSafeBrowsingTestServer() {} bool LocalSafeBrowsingTestServer::GetTestServerPath( - FilePath* testserver_path) const { - FilePath testserver_dir; + base::FilePath* testserver_path) const { + base::FilePath testserver_dir; if (!PathService::Get(base::DIR_SOURCE_ROOT, &testserver_dir)) { LOG(ERROR) << "Failed to get DIR_SOURCE_ROOT"; return false; @@ -44,7 +44,7 @@ bool LocalSafeBrowsingTestServer::SetPythonPath() const { return false; // Locate the Python code generated by the protocol buffers compiler. - FilePath pyproto_dir; + base::FilePath pyproto_dir; if (!GetPyProtoPath(&pyproto_dir)) { LOG(ERROR) << "Cannot find pyproto dir for generated code."; return false; diff --git a/chrome/browser/safe_browsing/local_safebrowsing_test_server.h b/chrome/browser/safe_browsing/local_safebrowsing_test_server.h index 13d8baf..719344e 100644 --- a/chrome/browser/safe_browsing/local_safebrowsing_test_server.h +++ b/chrome/browser/safe_browsing/local_safebrowsing_test_server.h @@ -15,14 +15,15 @@ class LocalSafeBrowsingTestServer : public net::LocalTestServer { public: // Initialize a safebrowsing server using the given |data_file|. - explicit LocalSafeBrowsingTestServer(const FilePath& data_file); + explicit LocalSafeBrowsingTestServer(const base::FilePath& data_file); virtual ~LocalSafeBrowsingTestServer(); virtual bool SetPythonPath() const OVERRIDE; // Returns the path to safe_browsing_testserver.py. - virtual bool GetTestServerPath(FilePath* testserver_path) const OVERRIDE; + virtual bool GetTestServerPath( + base::FilePath* testserver_path) const OVERRIDE; protected: // Adds the --data-file switch. Returns true on success. @@ -30,7 +31,7 @@ class LocalSafeBrowsingTestServer : public net::LocalTestServer { base::DictionaryValue* arguments) const OVERRIDE; private: - FilePath data_file_; + base::FilePath data_file_; DISALLOW_COPY_AND_ASSIGN(LocalSafeBrowsingTestServer); }; diff --git a/chrome/browser/safe_browsing/prefix_set.cc b/chrome/browser/safe_browsing/prefix_set.cc index c55c9ab..4216c51 100644 --- a/chrome/browser/safe_browsing/prefix_set.cc +++ b/chrome/browser/safe_browsing/prefix_set.cc @@ -152,7 +152,7 @@ void PrefixSet::GetPrefixes(std::vector<SBPrefix>* prefixes) const { } // static -PrefixSet* PrefixSet::LoadFile(const FilePath& filter_name) { +PrefixSet* PrefixSet::LoadFile(const base::FilePath& filter_name) { int64 size_64; if (!file_util::GetFileSize(filter_name, &size_64)) return NULL; @@ -229,7 +229,7 @@ PrefixSet* PrefixSet::LoadFile(const FilePath& filter_name) { return new PrefixSet(&index, &deltas); } -bool PrefixSet::WriteFile(const FilePath& filter_name) const { +bool PrefixSet::WriteFile(const base::FilePath& filter_name) const { FileHeader header; header.magic = kMagic; header.version = kVersion; diff --git a/chrome/browser/safe_browsing/prefix_set_unittest.cc b/chrome/browser/safe_browsing/prefix_set_unittest.cc index d98909a..7f78a6a 100644 --- a/chrome/browser/safe_browsing/prefix_set_unittest.cc +++ b/chrome/browser/safe_browsing/prefix_set_unittest.cc @@ -68,11 +68,11 @@ class PrefixSetTest : public PlatformTest { // Generate a |PrefixSet| file from |shared_prefixes_|, store it in // a temporary file, and return the filename in |filenamep|. // Returns |true| on success. - bool GetPrefixSetFile(FilePath* filenamep) { + bool GetPrefixSetFile(base::FilePath* filenamep) { if (!temp_dir_.IsValid() && !temp_dir_.CreateUniqueTempDir()) return false; - FilePath filename = temp_dir_.path().AppendASCII("PrefixSetTest"); + base::FilePath filename = temp_dir_.path().AppendASCII("PrefixSetTest"); safe_browsing::PrefixSet prefix_set(shared_prefixes_); if (!prefix_set.WriteFile(filename)) @@ -129,7 +129,8 @@ class PrefixSetTest : public PlatformTest { // Open |filename| and increment the int32 at |offset| by |inc|. // Then re-generate the checksum to account for the new contents. - void ModifyAndCleanChecksum(const FilePath& filename, long offset, int inc) { + void ModifyAndCleanChecksum(const base::FilePath& filename, long offset, + int inc) { int64 size_64; ASSERT_TRUE(file_util::GetFileSize(filename, &size_64)); @@ -308,7 +309,7 @@ TEST_F(PrefixSetTest, EdgeCases) { // Test writing a prefix set to disk and reading it back in. TEST_F(PrefixSetTest, ReadWrite) { - FilePath filename; + base::FilePath filename; // Write the sample prefix set out, read it back in, and check all // the prefixes. Leaves the path in |filename|. @@ -351,7 +352,7 @@ TEST_F(PrefixSetTest, ReadWrite) { // Check that |CleanChecksum()| makes an acceptable checksum. TEST_F(PrefixSetTest, CorruptionHelpers) { - FilePath filename; + base::FilePath filename; ASSERT_TRUE(GetPrefixSetFile(&filename)); // This will modify data in |index_|, which will fail the digest check. @@ -373,7 +374,7 @@ TEST_F(PrefixSetTest, CorruptionHelpers) { // Bad |index_| size is caught by the sanity check. TEST_F(PrefixSetTest, CorruptionMagic) { - FilePath filename; + base::FilePath filename; ASSERT_TRUE(GetPrefixSetFile(&filename)); ASSERT_NO_FATAL_FAILURE( @@ -385,7 +386,7 @@ TEST_F(PrefixSetTest, CorruptionMagic) { // Bad |index_| size is caught by the sanity check. TEST_F(PrefixSetTest, CorruptionVersion) { - FilePath filename; + base::FilePath filename; ASSERT_TRUE(GetPrefixSetFile(&filename)); ASSERT_NO_FATAL_FAILURE( @@ -397,7 +398,7 @@ TEST_F(PrefixSetTest, CorruptionVersion) { // Bad |index_| size is caught by the sanity check. TEST_F(PrefixSetTest, CorruptionIndexSize) { - FilePath filename; + base::FilePath filename; ASSERT_TRUE(GetPrefixSetFile(&filename)); ASSERT_NO_FATAL_FAILURE( @@ -409,7 +410,7 @@ TEST_F(PrefixSetTest, CorruptionIndexSize) { // Bad |deltas_| size is caught by the sanity check. TEST_F(PrefixSetTest, CorruptionDeltasSize) { - FilePath filename; + base::FilePath filename; ASSERT_TRUE(GetPrefixSetFile(&filename)); ASSERT_NO_FATAL_FAILURE( @@ -422,7 +423,7 @@ TEST_F(PrefixSetTest, CorruptionDeltasSize) { // Test that the digest catches corruption in the middle of the file // (in the payload between the header and the digest). TEST_F(PrefixSetTest, CorruptionPayload) { - FilePath filename; + base::FilePath filename; ASSERT_TRUE(GetPrefixSetFile(&filename)); file_util::ScopedFILE file(file_util::OpenFile(filename, "r+b")); @@ -435,7 +436,7 @@ TEST_F(PrefixSetTest, CorruptionPayload) { // Test corruption in the digest itself. TEST_F(PrefixSetTest, CorruptionDigest) { - FilePath filename; + base::FilePath filename; ASSERT_TRUE(GetPrefixSetFile(&filename)); int64 size_64; @@ -451,7 +452,7 @@ TEST_F(PrefixSetTest, CorruptionDigest) { // Test excess data after the digest (fails the size test). TEST_F(PrefixSetTest, CorruptionExcess) { - FilePath filename; + base::FilePath filename; ASSERT_TRUE(GetPrefixSetFile(&filename)); // Add some junk to the trunk. diff --git a/chrome/browser/safe_browsing/safe_browsing_blocking_page_test.cc b/chrome/browser/safe_browsing/safe_browsing_blocking_page_test.cc index 940ae06..2957fa3e 100644 --- a/chrome/browser/safe_browsing/safe_browsing_blocking_page_test.cc +++ b/chrome/browser/safe_browsing/safe_browsing_blocking_page_test.cc @@ -711,9 +711,9 @@ IN_PROC_BROWSER_TEST_F(SafeBrowsingBlockingPageTest, ReportingDisabled) { browser()->profile()->GetPrefs()->SetBoolean( prefs::kSafeBrowsingReportingEnabled, true); - net::TestServer https_server(net::TestServer::TYPE_HTTPS, - net::TestServer::kLocalhost, - FilePath(FILE_PATH_LITERAL("chrome/test/data"))); + net::TestServer https_server( + net::TestServer::TYPE_HTTPS, net::TestServer::kLocalhost, + base::FilePath(FILE_PATH_LITERAL("chrome/test/data"))); ASSERT_TRUE(https_server.Start()); GURL url = https_server.GetURL(kEmptyPage); SetURLThreatType(url, SB_THREAT_TYPE_URL_MALWARE); diff --git a/chrome/browser/safe_browsing/safe_browsing_database.cc b/chrome/browser/safe_browsing/safe_browsing_database.cc index 8dd2f55..6304a39 100644 --- a/chrome/browser/safe_browsing/safe_browsing_database.cc +++ b/chrome/browser/safe_browsing/safe_browsing_database.cc @@ -29,19 +29,22 @@ using content::BrowserThread; namespace { // Filename suffix for the bloom filter. -const FilePath::CharType kBloomFilterFile[] = FILE_PATH_LITERAL(" Filter 2"); +const base::FilePath::CharType kBloomFilterFile[] = + FILE_PATH_LITERAL(" Filter 2"); // Filename suffix for the prefix set. -const FilePath::CharType kPrefixSetFile[] = FILE_PATH_LITERAL(" Prefix Set"); +const base::FilePath::CharType kPrefixSetFile[] = + FILE_PATH_LITERAL(" Prefix Set"); // Filename suffix for download store. -const FilePath::CharType kDownloadDBFile[] = FILE_PATH_LITERAL(" Download"); +const base::FilePath::CharType kDownloadDBFile[] = + FILE_PATH_LITERAL(" Download"); // Filename suffix for client-side phishing detection whitelist store. -const FilePath::CharType kCsdWhitelistDBFile[] = +const base::FilePath::CharType kCsdWhitelistDBFile[] = FILE_PATH_LITERAL(" Csd Whitelist"); // Filename suffix for the download whitelist store. -const FilePath::CharType kDownloadWhitelistDBFile[] = +const base::FilePath::CharType kDownloadWhitelistDBFile[] = FILE_PATH_LITERAL(" Download Whitelist"); // Filename suffix for the extension blacklist store. -const FilePath::CharType kExtensionBlacklistDBFile[] = +const base::FilePath::CharType kExtensionBlacklistDBFile[] = FILE_PATH_LITERAL(" Extension Blacklist"); // Filename suffix for browse store. // TODO(shess): "Safe Browsing Bloom Prefix Set" is full of win. @@ -49,7 +52,7 @@ const FilePath::CharType kExtensionBlacklistDBFile[] = // for little benefit. If/when file formats change (say to put all // the data in one file), that would be a convenient point to rectify // this. -const FilePath::CharType kBrowseDBFile[] = FILE_PATH_LITERAL(" Bloom"); +const base::FilePath::CharType kBrowseDBFile[] = FILE_PATH_LITERAL(" Bloom"); // The maximum staleness for a cached entry. const int kMaxStalenessMinutes = 45; @@ -298,7 +301,7 @@ bool SBAddFullHashPrefixLess(const SBAddFullHash& a, const SBAddFullHash& b) { // This code always checks for non-zero file size. This helper makes // that less verbose. -int64 GetFileSizeOrZero(const FilePath& file_path) { +int64 GetFileSizeOrZero(const base::FilePath& file_path) { int64 size_64; if (!file_util::GetFileSize(file_path, &size_64)) return 0; @@ -354,45 +357,45 @@ SafeBrowsingDatabase::~SafeBrowsingDatabase() { } // static -FilePath SafeBrowsingDatabase::BrowseDBFilename( - const FilePath& db_base_filename) { - return FilePath(db_base_filename.value() + kBrowseDBFile); +base::FilePath SafeBrowsingDatabase::BrowseDBFilename( + const base::FilePath& db_base_filename) { + return base::FilePath(db_base_filename.value() + kBrowseDBFile); } // static -FilePath SafeBrowsingDatabase::DownloadDBFilename( - const FilePath& db_base_filename) { - return FilePath(db_base_filename.value() + kDownloadDBFile); +base::FilePath SafeBrowsingDatabase::DownloadDBFilename( + const base::FilePath& db_base_filename) { + return base::FilePath(db_base_filename.value() + kDownloadDBFile); } // static -FilePath SafeBrowsingDatabase::BloomFilterForFilename( - const FilePath& db_filename) { - return FilePath(db_filename.value() + kBloomFilterFile); +base::FilePath SafeBrowsingDatabase::BloomFilterForFilename( + const base::FilePath& db_filename) { + return base::FilePath(db_filename.value() + kBloomFilterFile); } // static -FilePath SafeBrowsingDatabase::PrefixSetForFilename( - const FilePath& db_filename) { - return FilePath(db_filename.value() + kPrefixSetFile); +base::FilePath SafeBrowsingDatabase::PrefixSetForFilename( + const base::FilePath& db_filename) { + return base::FilePath(db_filename.value() + kPrefixSetFile); } // static -FilePath SafeBrowsingDatabase::CsdWhitelistDBFilename( - const FilePath& db_filename) { - return FilePath(db_filename.value() + kCsdWhitelistDBFile); +base::FilePath SafeBrowsingDatabase::CsdWhitelistDBFilename( + const base::FilePath& db_filename) { + return base::FilePath(db_filename.value() + kCsdWhitelistDBFile); } // static -FilePath SafeBrowsingDatabase::DownloadWhitelistDBFilename( - const FilePath& db_filename) { - return FilePath(db_filename.value() + kDownloadWhitelistDBFile); +base::FilePath SafeBrowsingDatabase::DownloadWhitelistDBFilename( + const base::FilePath& db_filename) { + return base::FilePath(db_filename.value() + kDownloadWhitelistDBFile); } // static -FilePath SafeBrowsingDatabase::ExtensionBlacklistDBFilename( - const FilePath& db_filename) { - return FilePath(db_filename.value() + kExtensionBlacklistDBFile); +base::FilePath SafeBrowsingDatabase::ExtensionBlacklistDBFilename( + const base::FilePath& db_filename) { + return base::FilePath(db_filename.value() + kExtensionBlacklistDBFile); } SafeBrowsingStore* SafeBrowsingDatabaseNew::GetStore(const int list_id) { @@ -455,7 +458,7 @@ SafeBrowsingDatabaseNew::~SafeBrowsingDatabaseNew() { DCHECK_EQ(creation_loop_, MessageLoop::current()); } -void SafeBrowsingDatabaseNew::Init(const FilePath& filename_base) { +void SafeBrowsingDatabaseNew::Init(const base::FilePath& filename_base) { DCHECK_EQ(creation_loop_, MessageLoop::current()); // Ensure we haven't been run before. DCHECK(browse_filename_.empty()); @@ -1114,7 +1117,7 @@ void SafeBrowsingDatabaseNew::UpdateFinished(bool update_succeeded) { } void SafeBrowsingDatabaseNew::UpdateWhitelistStore( - const FilePath& store_filename, + const base::FilePath& store_filename, SafeBrowsingStore* store, SBWhitelist* whitelist) { if (!store) @@ -1146,7 +1149,7 @@ void SafeBrowsingDatabaseNew::UpdateWhitelistStore( } int64 SafeBrowsingDatabaseNew::UpdateHashPrefixStore( - const FilePath& store_filename, + const base::FilePath& store_filename, SafeBrowsingStore* store, FailureType failure_type) { // We don't cache and save full hashes. @@ -1314,7 +1317,8 @@ void SafeBrowsingDatabaseNew::LoadPrefixSet() { // Cleanup any stale bloom filter (no longer used). // TODO(shess): Track failure to delete? - FilePath bloom_filter_filename = BloomFilterForFilename(browse_filename_); + base::FilePath bloom_filter_filename = + BloomFilterForFilename(browse_filename_); file_util::Delete(bloom_filter_filename, false); const base::TimeTicks before = base::TimeTicks::Now(); @@ -1348,7 +1352,8 @@ bool SafeBrowsingDatabaseNew::Delete() { if (!r4) RecordFailure(FAILURE_DATABASE_STORE_DELETE); - FilePath bloom_filter_filename = BloomFilterForFilename(browse_filename_); + base::FilePath bloom_filter_filename = + BloomFilterForFilename(browse_filename_); const bool r5 = file_util::Delete(bloom_filter_filename, false); if (!r5) RecordFailure(FAILURE_DATABASE_FILTER_DELETE); diff --git a/chrome/browser/safe_browsing/safe_browsing_database.h b/chrome/browser/safe_browsing/safe_browsing_database.h index f24f37f..576361c 100644 --- a/chrome/browser/safe_browsing/safe_browsing_database.h +++ b/chrome/browser/safe_browsing/safe_browsing_database.h @@ -79,7 +79,7 @@ class SafeBrowsingDatabase { virtual ~SafeBrowsingDatabase(); // Initializes the database with the given filename. - virtual void Init(const FilePath& filename) = 0; + virtual void Init(const base::FilePath& filename) = 0; // Deletes the current database and creates a new one. virtual bool ResetDatabase() = 0; @@ -166,28 +166,31 @@ class SafeBrowsingDatabase { // The name of the bloom-filter file for the given database file. // NOTE(shess): OBSOLETE. Present for deleting stale files. - static FilePath BloomFilterForFilename(const FilePath& db_filename); + static base::FilePath BloomFilterForFilename( + const base::FilePath& db_filename); // The name of the prefix set file for the given database file. - static FilePath PrefixSetForFilename(const FilePath& db_filename); + static base::FilePath PrefixSetForFilename(const base::FilePath& db_filename); // Filename for malware and phishing URL database. - static FilePath BrowseDBFilename(const FilePath& db_base_filename); + static base::FilePath BrowseDBFilename( + const base::FilePath& db_base_filename); // Filename for download URL and download binary hash database. - static FilePath DownloadDBFilename(const FilePath& db_base_filename); + static base::FilePath DownloadDBFilename( + const base::FilePath& db_base_filename); // Filename for client-side phishing detection whitelist databsae. - static FilePath CsdWhitelistDBFilename( - const FilePath& csd_whitelist_base_filename); + static base::FilePath CsdWhitelistDBFilename( + const base::FilePath& csd_whitelist_base_filename); // Filename for download whitelist databsae. - static FilePath DownloadWhitelistDBFilename( - const FilePath& download_whitelist_base_filename); + static base::FilePath DownloadWhitelistDBFilename( + const base::FilePath& download_whitelist_base_filename); // Filename for extension blacklist database. - static FilePath ExtensionBlacklistDBFilename( - const FilePath& extension_blacklist_base_filename); + static base::FilePath ExtensionBlacklistDBFilename( + const base::FilePath& extension_blacklist_base_filename); // Enumerate failures for histogramming purposes. DO NOT CHANGE THE // ORDERING OF THESE VALUES. @@ -248,7 +251,7 @@ class SafeBrowsingDatabaseNew : public SafeBrowsingDatabase { virtual ~SafeBrowsingDatabaseNew(); // Implement SafeBrowsingDatabase interface. - virtual void Init(const FilePath& filename) OVERRIDE; + virtual void Init(const base::FilePath& filename) OVERRIDE; virtual bool ResetDatabase() OVERRIDE; virtual bool ContainsBrowseUrl(const GURL& url, std::string* matching_list, @@ -331,11 +334,11 @@ class SafeBrowsingDatabaseNew : public SafeBrowsingDatabase { const SBChunkList& chunks); // Returns the size in bytes of the store after the update. - int64 UpdateHashPrefixStore(const FilePath& store_filename, + int64 UpdateHashPrefixStore(const base::FilePath& store_filename, SafeBrowsingStore* store, FailureType failure_type); void UpdateBrowseStore(); - void UpdateWhitelistStore(const FilePath& store_filename, + void UpdateWhitelistStore(const base::FilePath& store_filename, SafeBrowsingStore* store, SBWhitelist* whitelist); @@ -351,25 +354,25 @@ class SafeBrowsingDatabaseNew : public SafeBrowsingDatabase { // Underlying persistent store for chunk data. // For browsing related (phishing and malware URLs) chunks and prefixes. - FilePath browse_filename_; + base::FilePath browse_filename_; scoped_ptr<SafeBrowsingStore> browse_store_; // For download related (download URL and binary hash) chunks and prefixes. - FilePath download_filename_; + base::FilePath download_filename_; scoped_ptr<SafeBrowsingStore> download_store_; // For the client-side phishing detection whitelist chunks and full-length // hashes. This list only contains 256 bit hashes. - FilePath csd_whitelist_filename_; + base::FilePath csd_whitelist_filename_; scoped_ptr<SafeBrowsingStore> csd_whitelist_store_; // For the download whitelist chunks and full-length hashes. This list only // contains 256 bit hashes. - FilePath download_whitelist_filename_; + base::FilePath download_whitelist_filename_; scoped_ptr<SafeBrowsingStore> download_whitelist_store_; // For extension IDs. - FilePath extension_blacklist_filename_; + base::FilePath extension_blacklist_filename_; scoped_ptr<SafeBrowsingStore> extension_blacklist_store_; SBWhitelist csd_whitelist_; @@ -402,7 +405,7 @@ class SafeBrowsingDatabaseNew : public SafeBrowsingDatabase { bool change_detected_; // Used to check if a prefix was in the database. - FilePath prefix_set_filename_; + base::FilePath prefix_set_filename_; scoped_ptr<safe_browsing::PrefixSet> prefix_set_; }; diff --git a/chrome/browser/safe_browsing/safe_browsing_database_unittest.cc b/chrome/browser/safe_browsing/safe_browsing_database_unittest.cc index d973ffb..cc685d4 100644 --- a/chrome/browser/safe_browsing/safe_browsing_database_unittest.cc +++ b/chrome/browser/safe_browsing/safe_browsing_database_unittest.cc @@ -266,7 +266,7 @@ class SafeBrowsingDatabaseTest : public PlatformTest { void PopulateDatabaseForCacheTest(); scoped_ptr<SafeBrowsingDatabaseNew> database_; - FilePath database_filename_; + base::FilePath database_filename_; base::ScopedTempDir temp_dir_; }; @@ -1551,7 +1551,7 @@ TEST_F(SafeBrowsingDatabaseTest, EmptyUpdate) { SBChunkList chunks; SBChunk chunk; - FilePath filename = database_->BrowseDBFilename(database_filename_); + base::FilePath filename = database_->BrowseDBFilename(database_filename_); // Prime the database. std::vector<SBListChunkRanges> lists; @@ -1638,7 +1638,7 @@ TEST_F(SafeBrowsingDatabaseTest, FilterFile) { GURL("http://www.good.com/goodware.html"), &matching_list, &prefix_hits, &full_hashes, now)); - FilePath filter_file = database_->PrefixSetForFilename( + base::FilePath filter_file = database_->PrefixSetForFilename( database_->BrowseDBFilename(database_filename_)); // After re-creating the database, it should have a filter read from diff --git a/chrome/browser/safe_browsing/safe_browsing_service.cc b/chrome/browser/safe_browsing/safe_browsing_service.cc index ad0bfd3..a4998d0 100644 --- a/chrome/browser/safe_browsing/safe_browsing_service.cc +++ b/chrome/browser/safe_browsing/safe_browsing_service.cc @@ -52,7 +52,7 @@ using content::BrowserThread; namespace { // Filename suffix for the cookie database. -const FilePath::CharType kCookiesFile[] = FILE_PATH_LITERAL(" Cookies"); +const base::FilePath::CharType kCookiesFile[] = FILE_PATH_LITERAL(" Cookies"); // The default URL prefix where browser fetches chunk updates, hashes, // and reports safe browsing hits and malware details. @@ -73,8 +73,8 @@ const char* const kSbBackupHttpErrorURLPrefix = const char* const kSbBackupNetworkErrorURLPrefix = "https://alt3-safebrowsing.google.com/safebrowsing"; -FilePath CookieFilePath() { - return FilePath( +base::FilePath CookieFilePath() { + return base::FilePath( SafeBrowsingService::GetBaseFilename().value() + kCookiesFile); } @@ -146,13 +146,13 @@ static base::LazyInstance<SafeBrowsingServiceFactoryImpl> g_safe_browsing_service_factory_impl = LAZY_INSTANCE_INITIALIZER; // static -FilePath SafeBrowsingService::GetCookieFilePathForTesting() { +base::FilePath SafeBrowsingService::GetCookieFilePathForTesting() { return CookieFilePath(); } // static -FilePath SafeBrowsingService::GetBaseFilename() { - FilePath path; +base::FilePath SafeBrowsingService::GetBaseFilename() { + base::FilePath path; bool result = PathService::Get(chrome::DIR_USER_DATA, &path); DCHECK(result); return path.Append(chrome::kSafeBrowsingBaseFilename); diff --git a/chrome/browser/safe_browsing/safe_browsing_service.h b/chrome/browser/safe_browsing/safe_browsing_service.h index 6d58d7e..9d09b33 100644 --- a/chrome/browser/safe_browsing/safe_browsing_service.h +++ b/chrome/browser/safe_browsing/safe_browsing_service.h @@ -62,9 +62,9 @@ class SafeBrowsingService factory_ = factory; } - static FilePath GetCookieFilePathForTesting(); + static base::FilePath GetCookieFilePathForTesting(); - static FilePath GetBaseFilename(); + static base::FilePath GetBaseFilename(); // Create an instance of the safe browsing service. static SafeBrowsingService* CreateSafeBrowsingService(); diff --git a/chrome/browser/safe_browsing/safe_browsing_service_browsertest.cc b/chrome/browser/safe_browsing/safe_browsing_service_browsertest.cc index 8c1edca..bf371aa 100644 --- a/chrome/browser/safe_browsing/safe_browsing_service_browsertest.cc +++ b/chrome/browser/safe_browsing/safe_browsing_service_browsertest.cc @@ -70,7 +70,7 @@ class TestSafeBrowsingDatabase : public SafeBrowsingDatabase { virtual ~TestSafeBrowsingDatabase() {} // Initializes the database with the given filename. - virtual void Init(const FilePath& filename) OVERRIDE {} + virtual void Init(const base::FilePath& filename) OVERRIDE {} // Deletes the current database and creates a new one. virtual bool ResetDatabase() OVERRIDE { @@ -889,10 +889,11 @@ class SafeBrowsingDatabaseManagerCookieTest : public InProcessBrowserTest { } virtual bool SetUpUserDataDirectory() OVERRIDE { - FilePath cookie_path(SafeBrowsingService::GetCookieFilePathForTesting()); + base::FilePath cookie_path( + SafeBrowsingService::GetCookieFilePathForTesting()); EXPECT_FALSE(file_util::PathExists(cookie_path)); - FilePath test_dir; + base::FilePath test_dir; if (!PathService::Get(chrome::DIR_TEST_DATA, &test_dir)) { EXPECT_TRUE(false); return false; @@ -901,7 +902,7 @@ class SafeBrowsingDatabaseManagerCookieTest : public InProcessBrowserTest { // Initialize the SafeBrowsing cookies with a pre-created cookie store. It // contains a single cookie, for domain 127.0.0.1, with value a=b, and // expires in 2038. - FilePath initial_cookies = test_dir.AppendASCII("safe_browsing") + base::FilePath initial_cookies = test_dir.AppendASCII("safe_browsing") .AppendASCII("Safe Browsing Cookies"); if (!file_util::CopyFile(initial_cookies, cookie_path)) { EXPECT_TRUE(false); @@ -937,7 +938,8 @@ class SafeBrowsingDatabaseManagerCookieTest : public InProcessBrowserTest { InProcessBrowserTest::TearDownInProcessBrowserTestFixture(); sql::Connection db; - FilePath cookie_path(SafeBrowsingService::GetCookieFilePathForTesting()); + base::FilePath cookie_path( + SafeBrowsingService::GetCookieFilePathForTesting()); ASSERT_TRUE(db.Open(cookie_path)); sql::Statement smt(db.GetUniqueStatement( diff --git a/chrome/browser/safe_browsing/safe_browsing_store_file.cc b/chrome/browser/safe_browsing/safe_browsing_store_file.cc index e7f377a..0e3596b 100644 --- a/chrome/browser/safe_browsing/safe_browsing_store_file.cc +++ b/chrome/browser/safe_browsing/safe_browsing_store_file.cc @@ -132,7 +132,7 @@ void DeleteChunksFromSet(const base::hash_set<int32>& deleted, // Sanity-check the header against the file's size to make sure our // vectors aren't gigantic. This doubles as a cheap way to detect // corruption without having to checksum the entire file. -bool FileHeaderSanityCheck(const FilePath& filename, +bool FileHeaderSanityCheck(const base::FilePath& filename, const FileHeader& header) { int64 size = 0; if (!file_util::GetFileSize(filename, &size)) @@ -154,7 +154,7 @@ bool FileHeaderSanityCheck(const FilePath& filename, // This a helper function that reads header to |header|. Returns true if the // magic number is correct and santiy check passes. -bool ReadAndVerifyHeader(const FilePath& filename, +bool ReadAndVerifyHeader(const base::FilePath& filename, FILE* fp, FileHeader* header, base::MD5Context* context) { @@ -176,8 +176,8 @@ void SafeBrowsingStoreFile::RecordFormatEvent(FormatEventType event_type) { // static void SafeBrowsingStoreFile::CheckForOriginalAndDelete( - const FilePath& current_filename) { - const FilePath original_filename( + const base::FilePath& current_filename) { + const base::FilePath original_filename( current_filename.DirName().AppendASCII("Safe Browsing")); if (file_util::PathExists(original_filename)) { int64 size = 0; @@ -194,7 +194,7 @@ void SafeBrowsingStoreFile::CheckForOriginalAndDelete( // Just best-effort on the journal file, don't want to get lost in // the weeds. - const FilePath journal_filename( + const base::FilePath journal_filename( current_filename.DirName().AppendASCII("Safe Browsing-journal")); file_util::Delete(journal_filename, false); } @@ -225,7 +225,7 @@ bool SafeBrowsingStoreFile::Delete() { return false; } - const FilePath new_filename = TemporaryFileForFilename(filename_); + const base::FilePath new_filename = TemporaryFileForFilename(filename_); if (!file_util::Delete(new_filename, false) && file_util::PathExists(new_filename)) { NOTREACHED(); @@ -235,7 +235,7 @@ bool SafeBrowsingStoreFile::Delete() { // With SQLite support gone, one way to get to this code is if the // existing file is a SQLite file. Make sure the journal file is // also removed. - const FilePath journal_filename( + const base::FilePath journal_filename( filename_.value() + FILE_PATH_LITERAL("-journal")); if (file_util::PathExists(journal_filename)) file_util::Delete(journal_filename, false); @@ -298,7 +298,7 @@ bool SafeBrowsingStoreFile::CheckValidity() { } void SafeBrowsingStoreFile::Init( - const FilePath& filename, + const base::FilePath& filename, const base::Closure& corruption_callback ) { filename_ = filename; @@ -421,7 +421,7 @@ bool SafeBrowsingStoreFile::BeginUpdate() { corruption_seen_ = false; - const FilePath new_filename = TemporaryFileForFilename(filename_); + const base::FilePath new_filename = TemporaryFileForFilename(filename_); file_util::ScopedFILE new_file(file_util::OpenFile(new_filename, "wb+")); if (new_file.get() == NULL) return false; @@ -683,7 +683,7 @@ bool SafeBrowsingStoreFile::DoUpdate( file_util::PathExists(filename_)) return false; - const FilePath new_filename = TemporaryFileForFilename(filename_); + const base::FilePath new_filename = TemporaryFileForFilename(filename_); if (!file_util::Move(new_filename, filename_)) return false; diff --git a/chrome/browser/safe_browsing/safe_browsing_store_file.h b/chrome/browser/safe_browsing/safe_browsing_store_file.h index f590655..58436d8 100644 --- a/chrome/browser/safe_browsing/safe_browsing_store_file.h +++ b/chrome/browser/safe_browsing/safe_browsing_store_file.h @@ -108,7 +108,7 @@ class SafeBrowsingStoreFile : public SafeBrowsingStore { SafeBrowsingStoreFile(); virtual ~SafeBrowsingStoreFile(); - virtual void Init(const FilePath& filename, + virtual void Init(const base::FilePath& filename, const base::Closure& corruption_callback) OVERRIDE; // Delete any on-disk files, including the permanent storage. @@ -158,8 +158,9 @@ class SafeBrowsingStoreFile : public SafeBrowsingStore { // Returns the name of the temporary file used to buffer data for // |filename|. Exported for unit tests. - static const FilePath TemporaryFileForFilename(const FilePath& filename) { - return FilePath(filename.value() + FILE_PATH_LITERAL("_new")); + static const base::FilePath TemporaryFileForFilename( + const base::FilePath& filename) { + return base::FilePath(filename.value() + FILE_PATH_LITERAL("_new")); } private: @@ -213,7 +214,7 @@ class SafeBrowsingStoreFile : public SafeBrowsingStore { // result (no histogram for not-found). Logically this // would make more sense at the SafeBrowsingDatabase level, but // practically speaking that code doesn't touch files directly. - static void CheckForOriginalAndDelete(const FilePath& filename); + static void CheckForOriginalAndDelete(const base::FilePath& filename); // Close all files and clear all buffers. bool Close(); @@ -260,7 +261,7 @@ class SafeBrowsingStoreFile : public SafeBrowsingStore { int chunks_written_; // Name of the main database file. - FilePath filename_; + base::FilePath filename_; // Handles to the main and scratch files. |empty_| is true if the // main file didn't exist when the update was started. diff --git a/chrome/browser/safe_browsing/safe_browsing_store_file_unittest.cc b/chrome/browser/safe_browsing/safe_browsing_store_file_unittest.cc index 150ea39..89eec6f 100644 --- a/chrome/browser/safe_browsing/safe_browsing_store_file_unittest.cc +++ b/chrome/browser/safe_browsing/safe_browsing_store_file_unittest.cc @@ -13,7 +13,7 @@ namespace { -const FilePath::CharType kFolderPrefix[] = +const base::FilePath::CharType kFolderPrefix[] = FILE_PATH_LITERAL("SafeBrowsingTestStoreFile"); class SafeBrowsingStoreFileTest : public PlatformTest { @@ -45,7 +45,7 @@ class SafeBrowsingStoreFileTest : public PlatformTest { } base::ScopedTempDir temp_dir_; - FilePath filename_; + base::FilePath filename_; scoped_ptr<SafeBrowsingStoreFile> store_; bool corruption_detected_; }; @@ -54,7 +54,7 @@ TEST_STORE(SafeBrowsingStoreFileTest, store_.get(), filename_); // Test that Delete() deletes the temporary store, if present. TEST_F(SafeBrowsingStoreFileTest, DeleteTemp) { - const FilePath temp_file = + const base::FilePath temp_file = SafeBrowsingStoreFile::TemporaryFileForFilename(filename_); EXPECT_FALSE(file_util::PathExists(filename_)); diff --git a/chrome/browser/safe_browsing/safe_browsing_store_unittest_helper.cc b/chrome/browser/safe_browsing/safe_browsing_store_unittest_helper.cc index 82af040..acb34b2 100644 --- a/chrome/browser/safe_browsing/safe_browsing_store_unittest_helper.cc +++ b/chrome/browser/safe_browsing/safe_browsing_store_unittest_helper.cc @@ -318,7 +318,7 @@ void SafeBrowsingStoreTestDeleteChunks(SafeBrowsingStore* store) { } void SafeBrowsingStoreTestDelete(SafeBrowsingStore* store, - const FilePath& filename) { + const base::FilePath& filename) { // Delete should work if the file wasn't there in the first place. EXPECT_FALSE(file_util::PathExists(filename)); EXPECT_TRUE(store->Delete()); diff --git a/chrome/browser/safe_browsing/safe_browsing_test.cc b/chrome/browser/safe_browsing/safe_browsing_test.cc index 45d71d5..feb2b05 100644 --- a/chrome/browser/safe_browsing/safe_browsing_test.cc +++ b/chrome/browser/safe_browsing/safe_browsing_test.cc @@ -57,7 +57,7 @@ using content::BrowserThread; namespace { -const FilePath::CharType kDataFile[] = +const base::FilePath::CharType kDataFile[] = FILE_PATH_LITERAL("testing_input_nomac.dat"); const char kUrlVerifyPath[] = "safebrowsing/verify_urls"; const char kDBVerifyPath[] = "safebrowsing/verify_database"; @@ -218,7 +218,7 @@ class SafeBrowsingServerTest : public InProcessBrowserTest { } virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { - FilePath datafile_path; + base::FilePath datafile_path; ASSERT_TRUE(PathService::Get(base::DIR_SOURCE_ROOT, &datafile_path)); datafile_path = datafile_path.Append(FILE_PATH_LITERAL("third_party")) diff --git a/chrome/browser/safe_browsing/signature_util_win.cc b/chrome/browser/safe_browsing/signature_util_win.cc index 6f9073d..a4cf6a8 100644 --- a/chrome/browser/safe_browsing/signature_util_win.cc +++ b/chrome/browser/safe_browsing/signature_util_win.cc @@ -21,7 +21,7 @@ SignatureUtil::SignatureUtil() {} SignatureUtil::~SignatureUtil() {} void SignatureUtil::CheckSignature( - const FilePath& file_path, + const base::FilePath& file_path, ClientDownloadRequest_SignatureInfo* signature_info) { VLOG(2) << "Checking signature for " << file_path.value(); diff --git a/chrome/browser/safe_browsing/signature_util_win_unittest.cc b/chrome/browser/safe_browsing/signature_util_win_unittest.cc index 501fefa..8127e54 100644 --- a/chrome/browser/safe_browsing/signature_util_win_unittest.cc +++ b/chrome/browser/safe_browsing/signature_util_win_unittest.cc @@ -21,7 +21,7 @@ namespace safe_browsing { class SignatureUtilWinTest : public testing::Test { protected: virtual void SetUp() { - FilePath source_path; + base::FilePath source_path; ASSERT_TRUE(PathService::Get(base::DIR_SOURCE_ROOT, &source_path)); testdata_path_ = source_path .AppendASCII("chrome") @@ -43,7 +43,7 @@ class SignatureUtilWinTest : public testing::Test { } } - FilePath testdata_path_; + base::FilePath testdata_path_; }; TEST_F(SignatureUtilWinTest, UntrustedSignedBinary) { diff --git a/chrome/browser/search_engines/template_url_fetcher_unittest.cc b/chrome/browser/search_engines/template_url_fetcher_unittest.cc index 6592e30..bdef3dd 100644 --- a/chrome/browser/search_engines/template_url_fetcher_unittest.cc +++ b/chrome/browser/search_engines/template_url_fetcher_unittest.cc @@ -110,7 +110,7 @@ void TemplateURLFetcherTestCallbacks::ConfirmAddSearchProvider( TemplateURLFetcherTest::TemplateURLFetcherTest() : test_server_(net::TestServer::TYPE_HTTP, net::TestServer::kLocalhost, - FilePath(FILE_PATH_LITERAL("chrome/test/data"))), + base::FilePath(FILE_PATH_LITERAL("chrome/test/data"))), callbacks_destroyed_(0), add_provider_called_(0), waiting_for_download_(false) { @@ -137,7 +137,7 @@ void TemplateURLFetcherTest::StartDownload( bool check_that_file_exists) { if (check_that_file_exists) { - FilePath osdd_full_path; + base::FilePath osdd_full_path; ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &osdd_full_path)); osdd_full_path = osdd_full_path.AppendASCII(osdd_file_name); ASSERT_TRUE(file_util::PathExists(osdd_full_path)); diff --git a/chrome/browser/search_engines/template_url_parser_unittest.cc b/chrome/browser/search_engines/template_url_parser_unittest.cc index e792840..8bc91df 100644 --- a/chrome/browser/search_engines/template_url_parser_unittest.cc +++ b/chrome/browser/search_engines/template_url_parser_unittest.cc @@ -65,7 +65,7 @@ class TemplateURLParserTest : public testing::Test { scoped_ptr<TemplateURL> template_url_; private: - FilePath full_path_; + base::FilePath full_path_; }; TemplateURLParserTest::TemplateURLParserTest() { @@ -80,7 +80,7 @@ void TemplateURLParserTest::SetUp() { if (!file_util::PathExists(full_path_)) { LOG(ERROR) << "This test can't be run without some non-redistributable data"; - full_path_ = FilePath(); + full_path_ = base::FilePath(); } } @@ -91,7 +91,7 @@ bool TemplateURLParserTest::is_disabled() const { void TemplateURLParserTest::ParseFile( const std::string& file_name, TemplateURLParser::ParameterFilter* filter) { - FilePath full_path; + base::FilePath full_path; ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &full_path)); full_path = full_path.AppendASCII("osdd"); full_path = full_path.AppendASCII(file_name); diff --git a/chrome/browser/search_engines/template_url_service_test_util.cc b/chrome/browser/search_engines/template_url_service_test_util.cc index 64c519f..79b990e 100644 --- a/chrome/browser/search_engines/template_url_service_test_util.cc +++ b/chrome/browser/search_engines/template_url_service_test_util.cc @@ -119,7 +119,7 @@ void TemplateURLServiceTestingProfile::SetUp() { // Make unique temp directory. ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); - FilePath path = temp_dir_.path().AppendASCII("TestDataService.db"); + base::FilePath path = temp_dir_.path().AppendASCII("TestDataService.db"); service_ = new WebDataService; ASSERT_TRUE(service_->InitWithPath(path)); } diff --git a/chrome/browser/service/service_process_control.cc b/chrome/browser/service/service_process_control.cc index 94a3a89..94666b9 100644 --- a/chrome/browser/service/service_process_control.cc +++ b/chrome/browser/service/service_process_control.cc @@ -117,7 +117,7 @@ void ServiceProcessControl::Launch(const base::Closure& success_task, int flags = ChildProcessHost::CHILD_NORMAL; #endif - FilePath exe_path = ChildProcessHost::GetChildPath(flags); + base::FilePath exe_path = ChildProcessHost::GetChildPath(flags); if (exe_path.empty()) NOTREACHED() << "Unable to get service process binary name."; @@ -126,7 +126,7 @@ void ServiceProcessControl::Launch(const base::Closure& success_task, switches::kServiceProcess); const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess(); - FilePath user_data_dir = + base::FilePath user_data_dir = browser_command_line.GetSwitchValuePath(switches::kUserDataDir); if (!user_data_dir.empty()) cmd_line->AppendSwitchPath(switches::kUserDataDir, user_data_dir); diff --git a/chrome/browser/sessions/base_session_service.cc b/chrome/browser/sessions/base_session_service.cc index a05d30b..c8b3e43 100644 --- a/chrome/browser/sessions/base_session_service.cc +++ b/chrome/browser/sessions/base_session_service.cc @@ -69,7 +69,7 @@ const int BaseSessionService::max_persist_navigation_count = 6; BaseSessionService::BaseSessionService(SessionType type, Profile* profile, - const FilePath& path) + const base::FilePath& path) : profile_(profile), ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)), pending_reset_(false), diff --git a/chrome/browser/sessions/base_session_service.h b/chrome/browser/sessions/base_session_service.h index e3abf84..d0fde8d 100644 --- a/chrome/browser/sessions/base_session_service.h +++ b/chrome/browser/sessions/base_session_service.h @@ -43,7 +43,7 @@ class BaseSessionService : public CancelableRequestProvider { // ignored and instead the path comes from the profile. BaseSessionService(SessionType type, Profile* profile, - const FilePath& path); + const base::FilePath& path); Profile* profile() const { return profile_; } diff --git a/chrome/browser/sessions/better_session_restore_browsertest.cc b/chrome/browser/sessions/better_session_restore_browsertest.cc index 007f543..c3add84 100644 --- a/chrome/browser/sessions/better_session_restore_browsertest.cc +++ b/chrome/browser/sessions/better_session_restore_browsertest.cc @@ -119,14 +119,14 @@ class BetterSessionRestoreTest : public InProcessBrowserTest { test_files.push_back("post_with_password.html"); test_files.push_back("session_cookies.html"); test_files.push_back("session_storage.html"); - FilePath test_file_dir; + base::FilePath test_file_dir; CHECK(PathService::Get(base::DIR_SOURCE_ROOT, &test_file_dir)); test_file_dir = test_file_dir.AppendASCII("chrome/test/data").AppendASCII(test_path_); for (std::vector<std::string>::const_iterator it = test_files.begin(); it != test_files.end(); ++it) { - FilePath path = test_file_dir.AppendASCII(*it); + base::FilePath path = test_file_dir.AppendASCII(*it); std::string contents; CHECK(file_util::ReadFileToString(path, &contents)); g_file_contents.Get()["/" + test_path_ + *it] = contents; diff --git a/chrome/browser/sessions/persistent_tab_restore_service.cc b/chrome/browser/sessions/persistent_tab_restore_service.cc index 1bc05a6..65cd91f 100644 --- a/chrome/browser/sessions/persistent_tab_restore_service.cc +++ b/chrome/browser/sessions/persistent_tab_restore_service.cc @@ -238,7 +238,7 @@ class PersistentTabRestoreService::Delegate PersistentTabRestoreService::Delegate::Delegate(Profile* profile) : BaseSessionService(BaseSessionService::TAB_RESTORE, profile, - FilePath()), + base::FilePath()), tab_restore_service_helper_(NULL), entries_to_write_(0), entries_written_(0), diff --git a/chrome/browser/sessions/session_backend.cc b/chrome/browser/sessions/session_backend.cc index 7829d8b..7b20757 100644 --- a/chrome/browser/sessions/session_backend.cc +++ b/chrome/browser/sessions/session_backend.cc @@ -41,7 +41,7 @@ class SessionFileReader { typedef SessionCommand::id_type id_type; typedef SessionCommand::size_type size_type; - explicit SessionFileReader(const FilePath& path) + explicit SessionFileReader(const base::FilePath& path) : errored_(false), buffer_(SessionBackend::kFileReadBufferSize, 0), buffer_position_(0), @@ -202,7 +202,7 @@ static const char* kLastSessionFileName = "Last Session"; const int SessionBackend::kFileReadBufferSize = 1024; SessionBackend::SessionBackend(BaseSessionService::SessionType type, - const FilePath& path_to_dir) + const base::FilePath& path_to_dir) : type_(type), path_to_dir_(path_to_dir), last_session_valid_(false), @@ -272,8 +272,8 @@ void SessionBackend::MoveCurrentSessionToLastSession() { Init(); current_session_file_.reset(NULL); - const FilePath current_session_path = GetCurrentSessionPath(); - const FilePath last_session_path = GetLastSessionPath(); + const base::FilePath current_session_path = GetCurrentSessionPath(); + const base::FilePath last_session_path = GetLastSessionPath(); if (file_util::PathExists(last_session_path)) file_util::Delete(last_session_path, false); if (file_util::PathExists(current_session_path)) { @@ -367,7 +367,8 @@ void SessionBackend::ResetFile() { empty_file_ = true; } -net::FileStream* SessionBackend::OpenAndWriteHeader(const FilePath& path) { +net::FileStream* SessionBackend::OpenAndWriteHeader( + const base::FilePath& path) { DCHECK(!path.empty()); scoped_ptr<net::FileStream> file(new net::FileStream(NULL)); if (file->OpenSync(path, base::PLATFORM_FILE_CREATE_ALWAYS | @@ -384,8 +385,8 @@ net::FileStream* SessionBackend::OpenAndWriteHeader(const FilePath& path) { return file.release(); } -FilePath SessionBackend::GetLastSessionPath() { - FilePath path = path_to_dir_; +base::FilePath SessionBackend::GetLastSessionPath() { + base::FilePath path = path_to_dir_; if (type_ == BaseSessionService::TAB_RESTORE) path = path.AppendASCII(kLastTabSessionFileName); else @@ -393,8 +394,8 @@ FilePath SessionBackend::GetLastSessionPath() { return path; } -FilePath SessionBackend::GetCurrentSessionPath() { - FilePath path = path_to_dir_; +base::FilePath SessionBackend::GetCurrentSessionPath() { + base::FilePath path = path_to_dir_; if (type_ == BaseSessionService::TAB_RESTORE) path = path.AppendASCII(kCurrentTabSessionFileName); else diff --git a/chrome/browser/sessions/session_backend.h b/chrome/browser/sessions/session_backend.h index c5e79e2..ca1411f 100644 --- a/chrome/browser/sessions/session_backend.h +++ b/chrome/browser/sessions/session_backend.h @@ -47,7 +47,7 @@ class SessionBackend : public base::RefCountedThreadSafe<SessionBackend> { // indicates which service is using this backend. |type| is used to determine // the name of the files to use as well as for logging. SessionBackend(BaseSessionService::SessionType type, - const FilePath& path_to_dir); + const base::FilePath& path_to_dir); // Moves the current file to the last file, and recreates the current file. // @@ -105,7 +105,7 @@ class SessionBackend : public base::RefCountedThreadSafe<SessionBackend> { // Opens the current file and writes the header. On success a handle to // the file is returned. - net::FileStream* OpenAndWriteHeader(const FilePath& path); + net::FileStream* OpenAndWriteHeader(const base::FilePath& path); // Appends the specified commands to the specified file. bool AppendCommandsToFile(net::FileStream* file, @@ -114,13 +114,13 @@ class SessionBackend : public base::RefCountedThreadSafe<SessionBackend> { const BaseSessionService::SessionType type_; // Returns the path to the last file. - FilePath GetLastSessionPath(); + base::FilePath GetLastSessionPath(); // Returns the path to the current file. - FilePath GetCurrentSessionPath(); + base::FilePath GetCurrentSessionPath(); // Directory files are relative to. - const FilePath path_to_dir_; + const base::FilePath path_to_dir_; // Whether the previous target file is valid. bool last_session_valid_; diff --git a/chrome/browser/sessions/session_backend_unittest.cc b/chrome/browser/sessions/session_backend_unittest.cc index 02d9e8b..a24cc33 100644 --- a/chrome/browser/sessions/session_backend_unittest.cc +++ b/chrome/browser/sessions/session_backend_unittest.cc @@ -46,7 +46,7 @@ class SessionBackendTest : public testing::Test { } // Path used in testing. - FilePath path_; + base::FilePath path_; base::ScopedTempDir temp_dir_; }; diff --git a/chrome/browser/sessions/session_restore.cc b/chrome/browser/sessions/session_restore.cc index ba25a03..6a9b6ac 100644 --- a/chrome/browser/sessions/session_restore.cc +++ b/chrome/browser/sessions/session_restore.cc @@ -1011,9 +1011,9 @@ class SessionRestoreImpl : public content::NotificationObserver { base::PLATFORM_FILE_ASYNC; const std::string& state = tab.navigations.at(selected_index).content_state(); - const std::vector<FilePath>& file_paths = + const std::vector<base::FilePath>& file_paths = webkit_glue::FilePathsFromHistoryState(state); - for (std::vector<FilePath>::const_iterator file = file_paths.begin(); + for (std::vector<base::FilePath>::const_iterator file = file_paths.begin(); file != file_paths.end(); ++file) { content::ChildProcessSecurityPolicy::GetInstance()-> GrantPermissionsForFile(id, *file, read_file_permissions); diff --git a/chrome/browser/sessions/session_restore_browsertest.cc b/chrome/browser/sessions/session_restore_browsertest.cc index 5d7feb7..aac37fc 100644 --- a/chrome/browser/sessions/session_restore_browsertest.cc +++ b/chrome/browser/sessions/session_restore_browsertest.cc @@ -79,14 +79,14 @@ class SessionRestoreTest : public InProcessBrowserTest { first_run::CreateSentinel(); url1_ = ui_test_utils::GetTestUrl( - FilePath().AppendASCII("session_history"), - FilePath().AppendASCII("bot1.html")); + base::FilePath().AppendASCII("session_history"), + base::FilePath().AppendASCII("bot1.html")); url2_ = ui_test_utils::GetTestUrl( - FilePath().AppendASCII("session_history"), - FilePath().AppendASCII("bot2.html")); + base::FilePath().AppendASCII("session_history"), + base::FilePath().AppendASCII("bot2.html")); url3_ = ui_test_utils::GetTestUrl( - FilePath().AppendASCII("session_history"), - FilePath().AppendASCII("bot3.html")); + base::FilePath().AppendASCII("session_history"), + base::FilePath().AppendASCII("bot3.html")); return InProcessBrowserTest::SetUpUserDataDirectory(); } @@ -173,8 +173,8 @@ class SessionRestoreTest : public InProcessBrowserTest { // (http://crbug.com/120927) IN_PROC_BROWSER_TEST_F(SessionRestoreTest, NoSessionRestoreNewWindowChromeOS) { GURL url(ui_test_utils::GetTestUrl( - FilePath(FilePath::kCurrentDirectory), - FilePath(FILE_PATH_LITERAL("title1.html")))); + base::FilePath(base::FilePath::kCurrentDirectory), + base::FilePath(FILE_PATH_LITERAL("title1.html")))); // Add a single tab. ui_test_utils::NavigateToURL(browser(), url); @@ -219,9 +219,10 @@ IN_PROC_BROWSER_TEST_F(SessionRestoreTest, if (browser_defaults::kRestorePopups) return; - const FilePath::CharType* kTitle1File = FILE_PATH_LITERAL("title1.html"); - GURL url(ui_test_utils::GetTestUrl(FilePath(FilePath::kCurrentDirectory), - FilePath(kTitle1File))); + const base::FilePath::CharType* kTitle1File = + FILE_PATH_LITERAL("title1.html"); + GURL url(ui_test_utils::GetTestUrl(base::FilePath( + base::FilePath::kCurrentDirectory), base::FilePath(kTitle1File))); ui_test_utils::NavigateToURL(browser(), url); // Turn on session restore. @@ -256,14 +257,14 @@ IN_PROC_BROWSER_TEST_F(SessionRestoreTest, IN_PROC_BROWSER_TEST_F(SessionRestoreTest, RestoreIndividualTabFromWindow) { GURL url1(ui_test_utils::GetTestUrl( - FilePath(FilePath::kCurrentDirectory), - FilePath(FILE_PATH_LITERAL("title1.html")))); + base::FilePath(base::FilePath::kCurrentDirectory), + base::FilePath(FILE_PATH_LITERAL("title1.html")))); GURL url2(ui_test_utils::GetTestUrl( - FilePath(FilePath::kCurrentDirectory), - FilePath(FILE_PATH_LITERAL("title2.html")))); + base::FilePath(base::FilePath::kCurrentDirectory), + base::FilePath(FILE_PATH_LITERAL("title2.html")))); GURL url3(ui_test_utils::GetTestUrl( - FilePath(FilePath::kCurrentDirectory), - FilePath(FILE_PATH_LITERAL("title3.html")))); + base::FilePath(base::FilePath::kCurrentDirectory), + base::FilePath(FILE_PATH_LITERAL("title3.html")))); // Add and navigate three tabs. ui_test_utils::NavigateToURL(browser(), url1); @@ -333,8 +334,8 @@ IN_PROC_BROWSER_TEST_F(SessionRestoreTest, RestoreIndividualTabFromWindow) { IN_PROC_BROWSER_TEST_F(SessionRestoreTest, WindowWithOneTab) { GURL url(ui_test_utils::GetTestUrl( - FilePath(FilePath::kCurrentDirectory), - FilePath(FILE_PATH_LITERAL("title1.html")))); + base::FilePath(base::FilePath::kCurrentDirectory), + base::FilePath(FILE_PATH_LITERAL("title1.html")))); // Add a single tab. ui_test_utils::NavigateToURL(browser(), url); @@ -370,8 +371,8 @@ IN_PROC_BROWSER_TEST_F(SessionRestoreTest, WindowWithOneTab) { // non-incognito window while an incognito window is open. IN_PROC_BROWSER_TEST_F(SessionRestoreTest, IncognitotoNonIncognito) { GURL url(ui_test_utils::GetTestUrl( - FilePath(FilePath::kCurrentDirectory), - FilePath(FILE_PATH_LITERAL("title1.html")))); + base::FilePath(base::FilePath::kCurrentDirectory), + base::FilePath(FILE_PATH_LITERAL("title1.html")))); // Add a single tab. ui_test_utils::NavigateToURL(browser(), url); diff --git a/chrome/browser/sessions/session_service.cc b/chrome/browser/sessions/session_service.cc index 6c7a562..6d1bad3 100644 --- a/chrome/browser/sessions/session_service.cc +++ b/chrome/browser/sessions/session_service.cc @@ -179,7 +179,7 @@ bool MigrateClosedPayload(const SessionCommand& command, // SessionService ------------------------------------------------------------- SessionService::SessionService(Profile* profile) - : BaseSessionService(SESSION_RESTORE, profile, FilePath()), + : BaseSessionService(SESSION_RESTORE, profile, base::FilePath()), has_open_trackable_browsers_(false), move_on_new_browser_(false), save_delay_in_millis_(base::TimeDelta::FromMilliseconds(2500)), @@ -189,7 +189,7 @@ SessionService::SessionService(Profile* profile) Init(); } -SessionService::SessionService(const FilePath& save_path) +SessionService::SessionService(const base::FilePath& save_path) : BaseSessionService(SESSION_RESTORE, NULL, save_path), has_open_trackable_browsers_(false), move_on_new_browser_(false), diff --git a/chrome/browser/sessions/session_service.h b/chrome/browser/sessions/session_service.h index 23b3adc..80841a8 100644 --- a/chrome/browser/sessions/session_service.h +++ b/chrome/browser/sessions/session_service.h @@ -69,7 +69,7 @@ class SessionService : public BaseSessionService, // Creates a SessionService for the specified profile. explicit SessionService(Profile* profile); // For testing. - explicit SessionService(const FilePath& save_path); + explicit SessionService(const base::FilePath& save_path); virtual ~SessionService(); diff --git a/chrome/browser/sessions/session_service_unittest.cc b/chrome/browser/sessions/session_service_unittest.cc index f71319d..cb99479 100644 --- a/chrome/browser/sessions/session_service_unittest.cc +++ b/chrome/browser/sessions/session_service_unittest.cc @@ -166,7 +166,7 @@ class SessionServiceTest : public BrowserWithTestWindowTest, // Path used in testing. base::ScopedTempDir temp_dir_; - FilePath path_; + base::FilePath path_; SessionServiceTestHelper helper_; }; @@ -834,14 +834,14 @@ TEST_F(SessionServiceTest, RemovePostDataWithPasswords) { #if defined(OS_CHROMEOS) // Verifies migration of tab/window closed works. TEST_F(SessionServiceTest, CanOpenV1TabClosed) { - FilePath v1_file_path; + base::FilePath v1_file_path; ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &v1_file_path)); // v1_session_file contains a tab closed command with the original id. The // file was generated from ClosingTabStaysClosed. If we successfully processed // the file we'll have one tab. v1_file_path = v1_file_path.AppendASCII("sessions").AppendASCII("v1_session_file"); - FilePath dest_file_path(path_); + base::FilePath dest_file_path(path_); dest_file_path = dest_file_path.AppendASCII("Current Session"); // Forces closing the file. diff --git a/chrome/browser/sessions/tab_restore_browsertest.cc b/chrome/browser/sessions/tab_restore_browsertest.cc index bf7a495..efce48d 100644 --- a/chrome/browser/sessions/tab_restore_browsertest.cc +++ b/chrome/browser/sessions/tab_restore_browsertest.cc @@ -35,11 +35,11 @@ class TabRestoreTest : public InProcessBrowserTest { public: TabRestoreTest() : InProcessBrowserTest() { url1_ = ui_test_utils::GetTestUrl( - FilePath().AppendASCII("session_history"), - FilePath().AppendASCII("bot1.html")); + base::FilePath().AppendASCII("session_history"), + base::FilePath().AppendASCII("bot1.html")); url2_ = ui_test_utils::GetTestUrl( - FilePath().AppendASCII("session_history"), - FilePath().AppendASCII("bot2.html")); + base::FilePath().AppendASCII("session_history"), + base::FilePath().AppendASCII("bot2.html")); } protected: diff --git a/chrome/browser/shell_integration.cc b/chrome/browser/shell_integration.cc index 9b571d94..08a8917 100644 --- a/chrome/browser/shell_integration.cc +++ b/chrome/browser/shell_integration.cc @@ -55,12 +55,13 @@ bool ShellIntegration::IsRunningInAppMode() { CommandLine ShellIntegration::CommandLineArgsForLauncher( const GURL& url, const std::string& extension_app_id, - const FilePath& profile_path) { + const base::FilePath& profile_path) { const CommandLine& cmd_line = *CommandLine::ForCurrentProcess(); CommandLine new_cmd_line(CommandLine::NO_PROGRAM); // Use the same UserDataDir for new launches that we currently have set. - FilePath user_data_dir = cmd_line.GetSwitchValuePath(switches::kUserDataDir); + base::FilePath user_data_dir = + cmd_line.GetSwitchValuePath(switches::kUserDataDir); if (!user_data_dir.empty()) { // Make sure user_data_dir is an absolute path. if (file_util::AbsolutePath(&user_data_dir) && @@ -70,7 +71,7 @@ CommandLine ShellIntegration::CommandLineArgsForLauncher( } #if defined(OS_CHROMEOS) - FilePath profile = cmd_line.GetSwitchValuePath(switches::kLoginProfile); + base::FilePath profile = cmd_line.GetSwitchValuePath(switches::kLoginProfile); if (!profile.empty()) new_cmd_line.AppendSwitchPath(switches::kLoginProfile, profile); #else diff --git a/chrome/browser/shell_integration.h b/chrome/browser/shell_integration.h index 450e8fd..6374ee2 100644 --- a/chrome/browser/shell_integration.h +++ b/chrome/browser/shell_integration.h @@ -100,9 +100,9 @@ class ShellIntegration { bool is_platform_app; string16 title; string16 description; - FilePath extension_path; + base::FilePath extension_path; gfx::Image favicon; - FilePath profile_path; + base::FilePath profile_path; bool create_on_desktop; bool create_in_applications_menu; @@ -131,7 +131,7 @@ class ShellIntegration { static CommandLine CommandLineArgsForLauncher( const GURL& url, const std::string& extension_app_id, - const FilePath& profile_path); + const base::FilePath& profile_path); #if defined(OS_WIN) // Generates an application user model ID (AppUserModelId) for a given app @@ -142,14 +142,16 @@ class ShellIntegration { // Chrome installs), |app_name| should already be suffixed, this method will // then further suffix it with the profile id as described above. static string16 GetAppModelIdForProfile(const string16& app_name, - const FilePath& profile_path); + const base::FilePath& profile_path); // Generates an application user model ID (AppUserModelId) for Chromium by // calling GetAppModelIdForProfile() with ShellUtil::GetAppId() as app_name. - static string16 GetChromiumModelIdForProfile(const FilePath& profile_path); + static string16 GetChromiumModelIdForProfile( + const base::FilePath& profile_path); // Get the AppUserModelId for the App List, for the profile in |profile_path|. - static string16 GetAppListAppModelIdForProfile(const FilePath& profile_path); + static string16 GetAppListAppModelIdForProfile( + const base::FilePath& profile_path); // Returns the location (path and index) of the Chromium icon, (e.g., // "C:\path\to\chrome.exe,0"). This is used to specify the icon to use @@ -167,12 +169,12 @@ class ShellIntegration { // This method should not be called prior to Windows 7. // This method is only public for the sake of tests and shouldn't be called // externally otherwise. - static int MigrateShortcutsInPathInternal(const FilePath& chrome_exe, - const FilePath& path, + static int MigrateShortcutsInPathInternal(const base::FilePath& chrome_exe, + const base::FilePath& path, bool check_dual_mode); // Returns the path to the Start Menu shortcut for the given Chrome. - static FilePath GetStartMenuShortcut(const FilePath& chrome_exe); + static base::FilePath GetStartMenuShortcut(const base::FilePath& chrome_exe); #endif // defined(OS_WIN) // The current default web client application UI state. This is used when diff --git a/chrome/browser/shell_integration_linux.cc b/chrome/browser/shell_integration_linux.cc index 06426d6..932d4cb 100644 --- a/chrome/browser/shell_integration_linux.cc +++ b/chrome/browser/shell_integration_linux.cc @@ -72,7 +72,7 @@ bool LaunchXdgUtility(const std::vector<std::string>& argv, int* exit_code) { std::string CreateShortcutIcon( const ShellIntegration::ShortcutInfo& shortcut_info, - const FilePath& shortcut_filename) { + const base::FilePath& shortcut_filename) { if (shortcut_info.favicon.IsEmpty()) return std::string(); @@ -81,7 +81,7 @@ std::string CreateShortcutIcon( if (!temp_dir.CreateUniqueTempDir()) return std::string(); - FilePath temp_file_path = temp_dir.path().Append( + base::FilePath temp_file_path = temp_dir.path().Append( shortcut_filename.ReplaceExtension("png")); std::vector<unsigned char> png_data; @@ -113,12 +113,12 @@ std::string CreateShortcutIcon( return icon_name; } -bool CreateShortcutOnDesktop(const FilePath& shortcut_filename, +bool CreateShortcutOnDesktop(const base::FilePath& shortcut_filename, const std::string& contents) { // Make sure that we will later call openat in a secure way. DCHECK_EQ(shortcut_filename.BaseName().value(), shortcut_filename.value()); - FilePath desktop_path; + base::FilePath desktop_path; if (!PathService::Get(base::DIR_USER_DESKTOP, &desktop_path)) return false; @@ -154,19 +154,19 @@ bool CreateShortcutOnDesktop(const FilePath& shortcut_filename, return true; } -void DeleteShortcutOnDesktop(const FilePath& shortcut_filename) { - FilePath desktop_path; +void DeleteShortcutOnDesktop(const base::FilePath& shortcut_filename) { + base::FilePath desktop_path; if (PathService::Get(base::DIR_USER_DESKTOP, &desktop_path)) file_util::Delete(desktop_path.Append(shortcut_filename), false); } -bool CreateShortcutInApplicationsMenu(const FilePath& shortcut_filename, +bool CreateShortcutInApplicationsMenu(const base::FilePath& shortcut_filename, const std::string& contents) { base::ScopedTempDir temp_dir; if (!temp_dir.CreateUniqueTempDir()) return false; - FilePath temp_file_path = temp_dir.path().Append(shortcut_filename); + base::FilePath temp_file_path = temp_dir.path().Append(shortcut_filename); int bytes_written = file_util::WriteFile(temp_file_path, contents.data(), contents.length()); @@ -189,7 +189,7 @@ bool CreateShortcutInApplicationsMenu(const FilePath& shortcut_filename, return exit_code == 0; } -void DeleteShortcutInApplicationsMenu(const FilePath& shortcut_filename) { +void DeleteShortcutInApplicationsMenu(const base::FilePath& shortcut_filename) { std::vector<std::string> argv; argv.push_back("xdg-desktop-menu"); argv.push_back("uninstall"); @@ -267,11 +267,11 @@ namespace { bool GetChromeVersionOfScript(const std::string& script, std::string* chrome_version) { // Get the path to the Chrome version. - FilePath chrome_dir; + base::FilePath chrome_dir; if (!PathService::Get(base::DIR_EXE, &chrome_dir)) return false; - FilePath chrome_version_path = chrome_dir.Append(script); + base::FilePath chrome_version_path = chrome_dir.Append(script); *chrome_version = chrome_version_path.value(); // Check if this is different to the one on path. @@ -282,7 +282,7 @@ bool GetChromeVersionOfScript(const std::string& script, if (base::GetAppOutput(CommandLine(argv), &path_version)) { // Remove trailing newline path_version.erase(path_version.length() - 1, 1); - FilePath path_version_path(path_version); + base::FilePath path_version_path(path_version); return (chrome_version_path != path_version_path); } return false; @@ -446,12 +446,12 @@ bool GetDesktopShortcutTemplate(base::Environment* env, std::string* output) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); - std::vector<FilePath> search_paths; + std::vector<base::FilePath> search_paths; std::string xdg_data_home; if (env->GetVar("XDG_DATA_HOME", &xdg_data_home) && !xdg_data_home.empty()) { - search_paths.push_back(FilePath(xdg_data_home)); + search_paths.push_back(base::FilePath(xdg_data_home)); } std::string xdg_data_dirs; @@ -459,7 +459,7 @@ bool GetDesktopShortcutTemplate(base::Environment* env, !xdg_data_dirs.empty()) { base::StringTokenizer tokenizer(xdg_data_dirs, ":"); while (tokenizer.GetNext()) { - FilePath data_dir(tokenizer.token()); + base::FilePath data_dir(tokenizer.token()); search_paths.push_back(data_dir); search_paths.push_back(data_dir.Append("applications")); } @@ -467,13 +467,13 @@ bool GetDesktopShortcutTemplate(base::Environment* env, // Add some fallback paths for systems which don't have XDG_DATA_DIRS or have // it incomplete. - search_paths.push_back(FilePath("/usr/share/applications")); - search_paths.push_back(FilePath("/usr/local/share/applications")); + search_paths.push_back(base::FilePath("/usr/share/applications")); + search_paths.push_back(base::FilePath("/usr/local/share/applications")); std::string template_filename(GetDesktopName(env)); - for (std::vector<FilePath>::const_iterator i = search_paths.begin(); + for (std::vector<base::FilePath>::const_iterator i = search_paths.begin(); i != search_paths.end(); ++i) { - FilePath path = i->Append(template_filename); + base::FilePath path = i->Append(template_filename); VLOG(1) << "Looking for desktop file template in " << path.value(); if (file_util::PathExists(path)) { VLOG(1) << "Found desktop file template at " << path.value(); @@ -485,32 +485,32 @@ bool GetDesktopShortcutTemplate(base::Environment* env, return false; } -FilePath GetWebShortcutFilename(const GURL& url) { +base::FilePath GetWebShortcutFilename(const GURL& url) { // Use a prefix, because xdg-desktop-menu requires it. std::string filename = std::string(chrome::kBrowserProcessExecutableName) + "-" + url.spec(); file_util::ReplaceIllegalCharactersInPath(&filename, '_'); - FilePath desktop_path; + base::FilePath desktop_path; if (!PathService::Get(base::DIR_USER_DESKTOP, &desktop_path)) - return FilePath(); + return base::FilePath(); - FilePath filepath = desktop_path.Append(filename); - FilePath alternative_filepath(filepath.value() + ".desktop"); + base::FilePath filepath = desktop_path.Append(filename); + base::FilePath alternative_filepath(filepath.value() + ".desktop"); for (size_t i = 1; i < 100; ++i) { - if (file_util::PathExists(FilePath(alternative_filepath))) { - alternative_filepath = FilePath( + if (file_util::PathExists(base::FilePath(alternative_filepath))) { + alternative_filepath = base::FilePath( filepath.value() + "_" + base::IntToString(i) + ".desktop"); } else { - return FilePath(alternative_filepath).BaseName(); + return base::FilePath(alternative_filepath).BaseName(); } } - return FilePath(); + return base::FilePath(); } -FilePath GetExtensionShortcutFilename(const FilePath& profile_path, - const std::string& extension_id) { +base::FilePath GetExtensionShortcutFilename(const base::FilePath& profile_path, + const std::string& extension_id) { DCHECK(!extension_id.empty()); // Use a prefix, because xdg-desktop-menu requires it. @@ -520,7 +520,7 @@ FilePath GetExtensionShortcutFilename(const FilePath& profile_path, .append("-") .append(profile_path.BaseName().value()); file_util::ReplaceIllegalCharactersInPath(&filename, '_'); - return FilePath(filename.append(".desktop")); + return base::FilePath(filename.append(".desktop")); } std::string GetDesktopFileContents( @@ -528,10 +528,10 @@ std::string GetDesktopFileContents( const std::string& app_name, const GURL& url, const std::string& extension_id, - const FilePath& extension_path, + const base::FilePath& extension_path, const string16& title, const std::string& icon_name, - const FilePath& profile_path) { + const base::FilePath& profile_path) { // Although not required by the spec, Nautilus on Ubuntu Karmic creates its // launchers with an xdg-open shebang. Follow that convention. std::string output_buffer = std::string(kXdgOpenShebang) + "\n"; @@ -661,7 +661,7 @@ bool CreateDesktopShortcut( const std::string& shortcut_template) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); - FilePath shortcut_filename; + base::FilePath shortcut_filename; if (!shortcut_info.extension_id.empty()) { shortcut_filename = GetExtensionShortcutFilename( shortcut_info.profile_path, shortcut_info.extension_id); @@ -703,11 +703,11 @@ bool CreateDesktopShortcut( return success; } -void DeleteDesktopShortcuts(const FilePath& profile_path, +void DeleteDesktopShortcuts(const base::FilePath& profile_path, const std::string& extension_id) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); - FilePath shortcut_filename = GetExtensionShortcutFilename( + base::FilePath shortcut_filename = GetExtensionShortcutFilename( profile_path, extension_id); DCHECK(!shortcut_filename.empty()); diff --git a/chrome/browser/shell_integration_linux.h b/chrome/browser/shell_integration_linux.h index e1c9fba..50a4845 100644 --- a/chrome/browser/shell_integration_linux.h +++ b/chrome/browser/shell_integration_linux.h @@ -25,12 +25,12 @@ bool GetDesktopShortcutTemplate(base::Environment* env, std::string* output); // Returns filename for .desktop file based on |url|, sanitized for security. -FilePath GetWebShortcutFilename(const GURL& url); +base::FilePath GetWebShortcutFilename(const GURL& url); // Returns filename for .desktop file based on |profile_path| and // |extension_id|, sanitized for security. -FilePath GetExtensionShortcutFilename(const FilePath& profile_path, - const std::string& extension_id); +base::FilePath GetExtensionShortcutFilename(const base::FilePath& profile_path, + const std::string& extension_id); // Returns contents for .desktop file based on |template_contents|, |url| // and |title|. The |template_contents| should be contents of .desktop file @@ -39,10 +39,10 @@ std::string GetDesktopFileContents(const std::string& template_contents, const std::string& app_name, const GURL& url, const std::string& extension_id, - const FilePath& extension_path, + const base::FilePath& extension_path, const string16& title, const std::string& icon_name, - const FilePath& profile_path); + const base::FilePath& profile_path); // Create shortcuts on the desktop or in the application menu (as specified by @@ -55,7 +55,7 @@ bool CreateDesktopShortcut(const ShellIntegration::ShortcutInfo& shortcut_info, // Delete any desktop shortcuts on desktop or in the application menu that have // been added for the extension with |extension_id| in |profile_path|. -void DeleteDesktopShortcuts(const FilePath& profile_path, +void DeleteDesktopShortcuts(const base::FilePath& profile_path, const std::string& extension_id); } // namespace ShellIntegrationLinux diff --git a/chrome/browser/shell_integration_unittest.cc b/chrome/browser/shell_integration_unittest.cc index 13b28ef..25acceb 100644 --- a/chrome/browser/shell_integration_unittest.cc +++ b/chrome/browser/shell_integration_unittest.cc @@ -177,7 +177,7 @@ TEST(ShellIntegrationTest, GetDesktopShortcutTemplate) { TEST(ShellIntegrationTest, GetWebShortcutFilename) { const struct { - const FilePath::CharType* path; + const base::FilePath::CharType* path; const char* url; } test_cases[] = { { FPL("http___foo_.desktop"), "http://foo" }, @@ -408,10 +408,10 @@ TEST(ShellIntegrationTest, GetDesktopFileContents) { web_app::GenerateApplicationNameFromURL(GURL(test_cases[i].url)), GURL(test_cases[i].url), "", - FilePath(), + base::FilePath(), ASCIIToUTF16(test_cases[i].title), test_cases[i].icon_name, - FilePath())); + base::FilePath())); } } #endif diff --git a/chrome/browser/shell_integration_win.cc b/chrome/browser/shell_integration_win.cc index 378a3dc..f133469 100644 --- a/chrome/browser/shell_integration_win.cc +++ b/chrome/browser/shell_integration_win.cc @@ -50,12 +50,12 @@ const wchar_t kAppListAppName[] = L"ChromiumAppList"; // Helper function for ShellIntegration::GetAppId to generates profile id // from profile path. "profile_id" is composed of sanitized basenames of // user data dir and profile dir joined by a ".". -string16 GetProfileIdFromPath(const FilePath& profile_path) { +string16 GetProfileIdFromPath(const base::FilePath& profile_path) { // Return empty string if profile_path is empty if (profile_path.empty()) return string16(); - FilePath default_user_data_dir; + base::FilePath default_user_data_dir; // Return empty string if profile_path is in default user data // dir and is the default profile. if (chrome::GetDefaultUserDataDirectory(&default_user_data_dir) && @@ -87,7 +87,7 @@ string16 GetProfileIdFromPath(const FilePath& profile_path) { // |is_per_user_install|). string16 GetExpectedAppId(const CommandLine& command_line, bool is_per_user_install) { - FilePath profile_path; + base::FilePath profile_path; if (command_line.HasSwitch(switches::kUserDataDir)) { profile_path = command_line.GetSwitchValuePath(switches::kUserDataDir).AppendASCII( @@ -116,7 +116,7 @@ void MigrateChromiumShortcutsCallback() { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); // Get full path of chrome. - FilePath chrome_exe; + base::FilePath chrome_exe; if (!PathService::Get(base::FILE_EXE, &chrome_exe)) return; @@ -141,7 +141,7 @@ void MigrateChromiumShortcutsCallback() { }; for (int i = 0; i < arraysize(kLocations); ++i) { - FilePath path; + base::FilePath path; if (!PathService::Get(kLocations[i].location_id, &path)) { NOTREACHED(); continue; @@ -184,7 +184,7 @@ ShellIntegration::DefaultWebClientSetPermission } bool ShellIntegration::SetAsDefaultBrowser() { - FilePath chrome_exe; + base::FilePath chrome_exe; if (!PathService::Get(base::FILE_EXE, &chrome_exe)) { LOG(ERROR) << "Error getting app exe path"; return false; @@ -206,7 +206,7 @@ bool ShellIntegration::SetAsDefaultProtocolClient(const std::string& protocol) { if (protocol.empty()) return false; - FilePath chrome_exe; + base::FilePath chrome_exe; if (!PathService::Get(base::FILE_EXE, &chrome_exe)) { LOG(ERROR) << "Error getting app exe path"; return false; @@ -226,7 +226,7 @@ bool ShellIntegration::SetAsDefaultProtocolClient(const std::string& protocol) { } bool ShellIntegration::SetAsDefaultBrowserInteractive() { - FilePath chrome_exe; + base::FilePath chrome_exe; if (!PathService::Get(base::FILE_EXE, &chrome_exe)) { NOTREACHED() << "Error getting app exe path"; return false; @@ -244,7 +244,7 @@ bool ShellIntegration::SetAsDefaultBrowserInteractive() { bool ShellIntegration::SetAsDefaultProtocolClientInteractive( const std::string& protocol) { - FilePath chrome_exe; + base::FilePath chrome_exe; if (!PathService::Get(base::FILE_EXE, &chrome_exe)) { NOTREACHED() << "Error getting app exe path"; return false; @@ -314,7 +314,7 @@ bool ShellIntegration::IsFirefoxDefaultBrowser() { string16 ShellIntegration::GetAppModelIdForProfile( const string16& app_name, - const FilePath& profile_path) { + const base::FilePath& profile_path) { std::vector<string16> components; components.push_back(app_name); const string16 profile_id(GetProfileIdFromPath(profile_path)); @@ -324,9 +324,9 @@ string16 ShellIntegration::GetAppModelIdForProfile( } string16 ShellIntegration::GetChromiumModelIdForProfile( - const FilePath& profile_path) { + const base::FilePath& profile_path) { BrowserDistribution* dist = BrowserDistribution::GetDistribution(); - FilePath chrome_exe; + base::FilePath chrome_exe; if (!PathService::Get(base::FILE_EXE, &chrome_exe)) { NOTREACHED(); return dist->GetBaseAppId(); @@ -338,7 +338,7 @@ string16 ShellIntegration::GetChromiumModelIdForProfile( } string16 ShellIntegration::GetAppListAppModelIdForProfile( - const FilePath& profile_path) { + const base::FilePath& profile_path) { return ShellIntegration::GetAppModelIdForProfile(kAppListAppName, profile_path); } @@ -346,7 +346,7 @@ string16 ShellIntegration::GetAppListAppModelIdForProfile( string16 ShellIntegration::GetChromiumIconLocation() { // Determine the path to chrome.exe. If we can't determine what that is, // we have bigger fish to fry... - FilePath chrome_exe; + base::FilePath chrome_exe; if (!PathService::Get(base::FILE_EXE, &chrome_exe)) { NOTREACHED(); return string16(); @@ -371,9 +371,10 @@ void ShellIntegration::MigrateChromiumShortcuts() { base::TimeDelta::FromSeconds(kMigrateChromiumShortcutsDelaySeconds)); } -int ShellIntegration::MigrateShortcutsInPathInternal(const FilePath& chrome_exe, - const FilePath& path, - bool check_dual_mode) { +int ShellIntegration::MigrateShortcutsInPathInternal( + const base::FilePath& chrome_exe, + const base::FilePath& path, + bool check_dual_mode) { DCHECK(base::win::GetVersion() >= base::win::VERSION_WIN7); // Enumerate all pinned shortcuts in the given path directly. @@ -385,10 +386,10 @@ int ShellIntegration::MigrateShortcutsInPathInternal(const FilePath& chrome_exe, InstallUtil::IsPerUserInstall(chrome_exe.value().c_str()); int shortcuts_migrated = 0; - FilePath target_path; + base::FilePath target_path; string16 arguments; base::win::ScopedPropVariant propvariant; - for (FilePath shortcut = shortcuts_enum.Next(); !shortcut.empty(); + for (base::FilePath shortcut = shortcuts_enum.Next(); !shortcut.empty(); shortcut = shortcuts_enum.Next()) { // TODO(gab): Use ProgramCompare instead of comparing FilePaths below once // it is fixed to work with FilePaths with spaces. @@ -485,14 +486,15 @@ int ShellIntegration::MigrateShortcutsInPathInternal(const FilePath& chrome_exe, return shortcuts_migrated; } -FilePath ShellIntegration::GetStartMenuShortcut(const FilePath& chrome_exe) { +base::FilePath ShellIntegration::GetStartMenuShortcut( + const base::FilePath& chrome_exe) { static const int kFolderIds[] = { base::DIR_COMMON_START_MENU, base::DIR_START_MENU, }; BrowserDistribution* dist = BrowserDistribution::GetDistribution(); string16 shortcut_name(dist->GetAppShortCutName()); - FilePath shortcut; + base::FilePath shortcut; // Check both the common and the per-user Start Menu folders for system-level // installs. @@ -510,5 +512,5 @@ FilePath ShellIntegration::GetStartMenuShortcut(const FilePath& chrome_exe) { return shortcut; } - return FilePath(); + return base::FilePath(); } diff --git a/chrome/browser/shell_integration_win_unittest.cc b/chrome/browser/shell_integration_win_unittest.cc index ba26853..4a17e90 100644 --- a/chrome/browser/shell_integration_win_unittest.cc +++ b/chrome/browser/shell_integration_win_unittest.cc @@ -28,7 +28,7 @@ class ShellIntegrationWinMigrateShortcutTest : public testing::Test { ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); // A path to a random target. - FilePath other_target; + base::FilePath other_target; file_util::CreateTemporaryFileInDir(temp_dir_.path(), &other_target); // This doesn't need to actually have a base name of "chrome.exe". @@ -94,7 +94,7 @@ class ShellIntegrationWinMigrateShortcutTest : public testing::Test { void AddTestShortcut( const base::win::ShortcutProperties& shortcut_properties) { shortcuts_properties_.push_back(shortcut_properties); - FilePath shortcut_path = + base::FilePath shortcut_path = temp_dir_.path().Append(L"Shortcut " + base::IntToString16(shortcuts_.size()) + installer::kLnkExt); @@ -108,10 +108,10 @@ class ShellIntegrationWinMigrateShortcutTest : public testing::Test { base::ScopedTempDir temp_dir_; // The path to a fake chrome.exe. - FilePath chrome_exe_; + base::FilePath chrome_exe_; // Test shortcuts. - std::vector<FilePath> shortcuts_; + std::vector<base::FilePath> shortcuts_; // Initial properties for the test shortcuts. std::vector<base::win::ShortcutProperties> shortcuts_properties_; @@ -173,14 +173,14 @@ TEST(ShellIntegrationWinTest, GetAppModelIdForProfileTest) { BrowserDistribution::GetDistribution()->GetBaseAppId()); // Empty profile path should get chrome::kBrowserAppID - FilePath empty_path; + base::FilePath empty_path; EXPECT_EQ(base_app_id, ShellIntegration::GetAppModelIdForProfile(base_app_id, empty_path)); // Default profile path should get chrome::kBrowserAppID - FilePath default_user_data_dir; + base::FilePath default_user_data_dir; chrome::GetDefaultUserDataDirectory(&default_user_data_dir); - FilePath default_profile_path = + base::FilePath default_profile_path = default_user_data_dir.AppendASCII(chrome::kInitialProfile); EXPECT_EQ(base_app_id, ShellIntegration::GetAppModelIdForProfile(base_app_id, @@ -188,7 +188,7 @@ TEST(ShellIntegrationWinTest, GetAppModelIdForProfileTest) { // Non-default profile path should get chrome::kBrowserAppID joined with // profile info. - FilePath profile_path(FILE_PATH_LITERAL("root")); + base::FilePath profile_path(FILE_PATH_LITERAL("root")); profile_path = profile_path.Append(FILE_PATH_LITERAL("udd")); profile_path = profile_path.Append(FILE_PATH_LITERAL("User Data - Test")); EXPECT_EQ(base_app_id + L".udd.UserDataTest", diff --git a/chrome/browser/signin/signin_names_io_thread_unittest.cc b/chrome/browser/signin/signin_names_io_thread_unittest.cc index db81724..692ec42 100644 --- a/chrome/browser/signin/signin_names_io_thread_unittest.cc +++ b/chrome/browser/signin/signin_names_io_thread_unittest.cc @@ -69,11 +69,11 @@ void SigninNamesOnIOThreadTest::SimulateSignout(const string16& email) { void SigninNamesOnIOThreadTest::AddNewProfile(const string16& name, const string16& email) { ProfileInfoCache* cache = testing_profile_manager_.profile_info_cache(); - const FilePath& user_data_dir = cache->GetUserDataDir(); + const base::FilePath& user_data_dir = cache->GetUserDataDir(); #if defined(OS_POSIX) - const FilePath profile_dir = user_data_dir.Append(UTF16ToUTF8(name)); + const base::FilePath profile_dir = user_data_dir.Append(UTF16ToUTF8(name)); #else - const FilePath profile_dir = user_data_dir.Append(name); + const base::FilePath profile_dir = user_data_dir.Append(name); #endif cache->AddProfileToCache(profile_dir, name, email, 0, false); } diff --git a/chrome/browser/speech/tts_extension_loader_chromeos.cc b/chrome/browser/speech/tts_extension_loader_chromeos.cc index 38b6799..2195a72 100644 --- a/chrome/browser/speech/tts_extension_loader_chromeos.cc +++ b/chrome/browser/speech/tts_extension_loader_chromeos.cc @@ -82,7 +82,8 @@ bool TtsExtensionLoaderChromeOs::LoadTtsExtension() { tts_state_ = TTS_LOADING; ExtensionService* extension_service = profile_->GetExtensionService(); DCHECK(extension_service); - FilePath path = FilePath(extension_misc::kSpeechSynthesisExtensionPath); + base::FilePath path = + base::FilePath(extension_misc::kSpeechSynthesisExtensionPath); extension_service->component_loader()->Add(IDR_SPEECH_SYNTHESIS_MANIFEST, path); return true; diff --git a/chrome/browser/spellchecker/spellcheck_custom_dictionary.cc b/chrome/browser/spellchecker/spellcheck_custom_dictionary.cc index 40c0f09..18e1bae 100644 --- a/chrome/browser/spellchecker/spellcheck_custom_dictionary.cc +++ b/chrome/browser/spellchecker/spellcheck_custom_dictionary.cc @@ -26,7 +26,7 @@ using chrome::spellcheck_common::WordList; namespace { // Filename extension for backup dictionary file. -const FilePath::CharType BACKUP_EXTENSION[] = FILE_PATH_LITERAL("backup"); +const base::FilePath::CharType BACKUP_EXTENSION[] = FILE_PATH_LITERAL("backup"); // Prefix for the checksum in the dictionary file. const char CHECKSUM_PREFIX[] = "checksum_v1 = "; @@ -55,7 +55,7 @@ enum ChangeSanitationResult { // Loads the file at |file_path| into the |words| container. If the file has a // valid checksum, then returns ChecksumStatus::VALID. If the file has an // invalid checksum, then returns ChecksumStatus::INVALID and clears |words|. -ChecksumStatus LoadFile(const FilePath& file_path, WordList& words) { +ChecksumStatus LoadFile(const base::FilePath& file_path, WordList& words) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); words.clear(); std::string contents; @@ -87,13 +87,14 @@ bool IsInvalidWord(const std::string& word) { // restores the backup and loads that into |custom_words| instead. If the backup // is invalid too, then clears |custom_words|. Must be called on the file // thread. -void LoadDictionaryFileReliably(WordList& custom_words, const FilePath& path) { +void LoadDictionaryFileReliably(WordList& custom_words, + const base::FilePath& path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); // Load the contents and verify the checksum. if (LoadFile(path, custom_words) == VALID_CHECKSUM) return; // Checksum is not valid. See if there's a backup. - FilePath backup = path.AddExtension(BACKUP_EXTENSION); + base::FilePath backup = path.AddExtension(BACKUP_EXTENSION); if (!file_util::PathExists(backup)) return; // Load the backup and verify its checksum. @@ -107,7 +108,7 @@ void LoadDictionaryFileReliably(WordList& custom_words, const FilePath& path) { // the custom spellcheck dictionary at |path|. void SaveDictionaryFileReliably( const WordList& custom_words, - const FilePath& path) { + const base::FilePath& path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); std::stringstream content; for (WordList::const_iterator it = custom_words.begin(); @@ -218,7 +219,8 @@ bool SpellcheckCustomDictionary::Change::empty() const { return to_add_.empty() && to_remove_.empty(); } -SpellcheckCustomDictionary::SpellcheckCustomDictionary(const FilePath& path) +SpellcheckCustomDictionary::SpellcheckCustomDictionary( + const base::FilePath& path) : custom_dictionary_path_(), weak_ptr_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)), is_loaded_(false) { @@ -400,7 +402,8 @@ syncer::SyncError SpellcheckCustomDictionary::ProcessSyncChanges( } // static -WordList SpellcheckCustomDictionary::LoadDictionaryFile(const FilePath& path) { +WordList SpellcheckCustomDictionary::LoadDictionaryFile( + const base::FilePath& path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); WordList words; LoadDictionaryFileReliably(words, path); @@ -412,7 +415,7 @@ WordList SpellcheckCustomDictionary::LoadDictionaryFile(const FilePath& path) { // static void SpellcheckCustomDictionary::UpdateDictionaryFile( const SpellcheckCustomDictionary::Change& dictionary_change, - const FilePath& path) { + const base::FilePath& path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); if (dictionary_change.empty()) return; diff --git a/chrome/browser/spellchecker/spellcheck_custom_dictionary.h b/chrome/browser/spellchecker/spellcheck_custom_dictionary.h index 9d55a64..a8c9c83 100644 --- a/chrome/browser/spellchecker/spellcheck_custom_dictionary.h +++ b/chrome/browser/spellchecker/spellcheck_custom_dictionary.h @@ -74,7 +74,7 @@ class SpellcheckCustomDictionary : public SpellcheckDictionary, virtual void OnCustomDictionaryChanged(const Change& dictionary_change) = 0; }; - explicit SpellcheckCustomDictionary(const FilePath& path); + explicit SpellcheckCustomDictionary(const base::FilePath& path); virtual ~SpellcheckCustomDictionary(); // Returns the in-memory cache of words in the custom dictionary. @@ -126,13 +126,13 @@ class SpellcheckCustomDictionary : public SpellcheckDictionary, // Makes sure that the custom dictionary file does not have duplicates and // contains only valid words. static chrome::spellcheck_common::WordList LoadDictionaryFile( - const FilePath& path); + const base::FilePath& path); // Applies the change in |dictionary_change| to the custom spellcheck // dictionary. Assumes that |dictionary_change| has been sanitized. static void UpdateDictionaryFile( const Change& dictionary_change, - const FilePath& path); + const base::FilePath& path); // The reply point for PostTaskAndReplyWithResult, called when // LoadDictionaryFile finishes reading the dictionary file. Does not modify @@ -161,7 +161,7 @@ class SpellcheckCustomDictionary : public SpellcheckDictionary, chrome::spellcheck_common::WordList words_; // A path for custom dictionary. - FilePath custom_dictionary_path_; + base::FilePath custom_dictionary_path_; // Used to create weak pointers for an instance of this class. base::WeakPtrFactory<SpellcheckCustomDictionary> weak_ptr_factory_; diff --git a/chrome/browser/spellchecker/spellcheck_custom_dictionary_unittest.cc b/chrome/browser/spellchecker/spellcheck_custom_dictionary_unittest.cc index 825b1f1..639c20f 100644 --- a/chrome/browser/spellchecker/spellcheck_custom_dictionary_unittest.cc +++ b/chrome/browser/spellchecker/spellcheck_custom_dictionary_unittest.cc @@ -70,7 +70,8 @@ class SpellcheckCustomDictionaryTest : public testing::Test { // A wrapper around SpellcheckCustomDictionary::LoadDictionaryFile private // function to avoid a large number of FRIEND_TEST declarations in // SpellcheckCustomDictionary. - chrome::spellcheck_common::WordList LoadDictionaryFile(const FilePath& path) { + chrome::spellcheck_common::WordList LoadDictionaryFile( + const base::FilePath& path) { return SpellcheckCustomDictionary::LoadDictionaryFile(path); } @@ -79,7 +80,7 @@ class SpellcheckCustomDictionaryTest : public testing::Test { // SpellcheckCustomDictionary. void UpdateDictionaryFile( const SpellcheckCustomDictionary::Change& dictionary_change, - const FilePath& path) { + const base::FilePath& path) { SpellcheckCustomDictionary::UpdateDictionaryFile(dictionary_change, path); } @@ -171,7 +172,8 @@ class DictionaryObserverCounter : public SpellcheckCustomDictionary::Observer { }; TEST_F(SpellcheckCustomDictionaryTest, SaveAndLoad) { - FilePath path = profile_->GetPath().Append(chrome::kCustomDictionaryFileName); + base::FilePath path = + profile_->GetPath().Append(chrome::kCustomDictionaryFileName); WordList loaded_custom_words = LoadDictionaryFile(path); // The custom word list should be empty now. @@ -246,7 +248,8 @@ TEST_F(SpellcheckCustomDictionaryTest, MultiProfile) { // Legacy empty dictionary should be converted to new format empty dictionary. TEST_F(SpellcheckCustomDictionaryTest, LegacyEmptyDictionaryShouldBeConverted) { - FilePath path = profile_->GetPath().Append(chrome::kCustomDictionaryFileName); + base::FilePath path = + profile_->GetPath().Append(chrome::kCustomDictionaryFileName); std::string content; file_util::WriteFile(path, content.c_str(), content.length()); @@ -262,7 +265,8 @@ TEST_F(SpellcheckCustomDictionaryTest, LegacyEmptyDictionaryShouldBeConverted) { // with two words. TEST_F(SpellcheckCustomDictionaryTest, LegacyDictionaryWithTwoWordsShouldBeConverted) { - FilePath path = profile_->GetPath().Append(chrome::kCustomDictionaryFileName); + base::FilePath path = + profile_->GetPath().Append(chrome::kCustomDictionaryFileName); std::string content = "foo\nbar\nfoo\n"; file_util::WriteFile(path, content.c_str(), content.length()); @@ -281,7 +285,8 @@ TEST_F(SpellcheckCustomDictionaryTest, // trimmed. TEST_F(SpellcheckCustomDictionaryTest, IllegalWordsShouldBeRemovedFromDictionary) { - FilePath path = profile_->GetPath().Append(chrome::kCustomDictionaryFileName); + base::FilePath path = + profile_->GetPath().Append(chrome::kCustomDictionaryFileName); std::string content = "foo\n foo bar \n\n \nbar\n" "01234567890123456789012345678901234567890123456789" @@ -303,7 +308,8 @@ TEST_F(SpellcheckCustomDictionaryTest, // end of the dictionary. If the dictionary file is corrupted on disk, the // previous version should be reloaded. TEST_F(SpellcheckCustomDictionaryTest, CorruptedWriteShouldBeRecovered) { - FilePath path = profile_->GetPath().Append(chrome::kCustomDictionaryFileName); + base::FilePath path = + profile_->GetPath().Append(chrome::kCustomDictionaryFileName); std::string content = "foo\nbar"; file_util::WriteFile(path, content.c_str(), content.length()); diff --git a/chrome/browser/spellchecker/spellcheck_hunspell_dictionary.cc b/chrome/browser/spellchecker/spellcheck_hunspell_dictionary.cc index 1bdbe4c5..695843a 100644 --- a/chrome/browser/spellchecker/spellcheck_hunspell_dictionary.cc +++ b/chrome/browser/spellchecker/spellcheck_hunspell_dictionary.cc @@ -91,7 +91,7 @@ void SpellcheckHunspellDictionary::InitializeDictionaryLocation() { // Initialize the BDICT path. Initialization should be in the FILE thread // because it checks if there is a "Dictionaries" directory and create it. if (bdict_file_path_.empty()) { - FilePath dict_dir; + base::FilePath dict_dir; PathService::Get(chrome::DIR_APP_DICTIONARIES, &dict_dir); bdict_file_path_ = chrome::spellcheck_common::GetVersionedFileName(language_, dict_dir); @@ -100,9 +100,9 @@ void SpellcheckHunspellDictionary::InitializeDictionaryLocation() { #if defined(OS_WIN) // Check if the dictionary exists in the fallback location. If so, use it // rather than downloading anew. - FilePath user_dir; + base::FilePath user_dir; PathService::Get(chrome::DIR_USER_DATA, &user_dir); - FilePath fallback = user_dir.Append(bdict_file_path_.BaseName()); + base::FilePath fallback = user_dir.Append(bdict_file_path_.BaseName()); if (!file_util::PathExists(bdict_file_path_) && file_util::PathExists(fallback)) { bdict_file_path_ = fallback; @@ -240,9 +240,10 @@ void SpellcheckHunspellDictionary::SaveDictionaryData(std::string* data) { if (bytes_written != data->length()) { bool success = false; #if defined(OS_WIN) - FilePath dict_dir; + base::FilePath dict_dir; PathService::Get(chrome::DIR_USER_DATA, &dict_dir); - FilePath fallback_file_path = dict_dir.Append(bdict_file_path_.BaseName()); + base::FilePath fallback_file_path = + dict_dir.Append(bdict_file_path_.BaseName()); bytes_written = file_util::WriteFile(fallback_file_path, data->data(), data->length()); if (bytes_written == data->length()) @@ -279,7 +280,8 @@ void SpellcheckHunspellDictionary::SaveDictionaryDataComplete() { } } -bool SpellcheckHunspellDictionary::VerifyBDict(const FilePath& path) const { +bool SpellcheckHunspellDictionary::VerifyBDict( + const base::FilePath& path) const { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); // Read the dictionary file and scan its data. We need to close this file diff --git a/chrome/browser/spellchecker/spellcheck_hunspell_dictionary.h b/chrome/browser/spellchecker/spellcheck_hunspell_dictionary.h index b41b76d..80741ae 100644 --- a/chrome/browser/spellchecker/spellcheck_hunspell_dictionary.h +++ b/chrome/browser/spellchecker/spellcheck_hunspell_dictionary.h @@ -83,7 +83,7 @@ class SpellcheckHunspellDictionary // Verifies the specified BDict file exists and it is sane. This function // should be called before opening the file so we can delete it and download a // new dictionary if it is corrupted. - bool VerifyBDict(const FilePath& path) const; + bool VerifyBDict(const base::FilePath& path) const; // Returns true if the dictionary is ready to use. virtual bool IsReady() const; @@ -119,7 +119,7 @@ class SpellcheckHunspellDictionary void InformListenersOfDownloadFailure(); // The desired location of the dictionary file, whether or not it exists yet. - FilePath bdict_file_path_; + base::FilePath bdict_file_path_; // State whether a dictionary has been partially, or fully saved. If the // former, shortcut Initialize. diff --git a/chrome/browser/spellchecker/spellcheck_service_browsertest.cc b/chrome/browser/spellchecker/spellcheck_service_browsertest.cc index 149ce22..1bfad91 100644 --- a/chrome/browser/spellchecker/spellcheck_service_browsertest.cc +++ b/chrome/browser/spellchecker/spellcheck_service_browsertest.cc @@ -43,9 +43,9 @@ class SpellcheckServiceBrowserTest : public InProcessBrowserTest { // run this test on Mac because Mac does not use hunspell by default. IN_PROC_BROWSER_TEST_F(SpellcheckServiceBrowserTest, DeleteCorruptedBDICT) { // Write the corrupted BDICT data to create a corrupted BDICT file. - FilePath dict_dir; + base::FilePath dict_dir; ASSERT_TRUE(PathService::Get(chrome::DIR_APP_DICTIONARIES, &dict_dir)); - FilePath bdict_path = + base::FilePath bdict_path = chrome::spellcheck_common::GetVersionedFileName("en-US", dict_dir); size_t actual = file_util::WriteFile(bdict_path, diff --git a/chrome/browser/ssl/ssl_browser_tests.cc b/chrome/browser/ssl/ssl_browser_tests.cc index db6a24d..ad82fad 100644 --- a/chrome/browser/ssl/ssl_browser_tests.cc +++ b/chrome/browser/ssl/ssl_browser_tests.cc @@ -54,7 +54,8 @@ using content::NavigationEntry; using content::SSLStatus; using content::WebContents; -const FilePath::CharType kDocRoot[] = FILE_PATH_LITERAL("chrome/test/data"); +const base::FilePath::CharType kDocRoot[] = + FILE_PATH_LITERAL("chrome/test/data"); namespace { @@ -95,13 +96,13 @@ class SSLUITest : public InProcessBrowserTest { SSLUITest() : https_server_(net::TestServer::TYPE_HTTPS, SSLOptions(SSLOptions::CERT_OK), - FilePath(kDocRoot)), + base::FilePath(kDocRoot)), https_server_expired_(net::TestServer::TYPE_HTTPS, SSLOptions(SSLOptions::CERT_EXPIRED), - FilePath(kDocRoot)), + base::FilePath(kDocRoot)), https_server_mismatched_(net::TestServer::TYPE_HTTPS, SSLOptions(SSLOptions::CERT_MISMATCHED_NAME), - FilePath(kDocRoot)), + base::FilePath(kDocRoot)), wss_server_expired_(net::TestServer::TYPE_WSS, SSLOptions(SSLOptions::CERT_EXPIRED), net::GetWebSocketTestDataDirectory()) {} @@ -653,7 +654,7 @@ IN_PROC_BROWSER_TEST_F(SSLUITest, DISABLED_TestWSSClientCert) { net::NSSCertDatabase* cert_db = net::NSSCertDatabase::GetInstance(); scoped_refptr<net::CryptoModule> crypt_module = cert_db->GetPublicModule(); std::string pkcs12_data; - FilePath cert_path = net::GetTestCertsDirectory().Append( + base::FilePath cert_path = net::GetTestCertsDirectory().Append( FILE_PATH_LITERAL("websocket_client_cert.p12")); EXPECT_TRUE(file_util::ReadFileToString(cert_path, &pkcs12_data)); EXPECT_EQ(net::OK, cert_db->ImportFromPKCS12(crypt_module, @@ -665,7 +666,7 @@ IN_PROC_BROWSER_TEST_F(SSLUITest, DISABLED_TestWSSClientCert) { // Start WebSocket test server with TLS and client cert authentication. net::TestServer::SSLOptions options(net::TestServer::SSLOptions::CERT_OK); options.request_client_certificate = true; - FilePath ca_path = net::GetTestCertsDirectory().Append( + base::FilePath ca_path = net::GetTestCertsDirectory().Append( FILE_PATH_LITERAL("websocket_cacert.pem")); options.client_authorities.push_back(ca_path); net::TestServer wss_server(net::TestServer::TYPE_WSS, diff --git a/chrome/browser/ssl/ssl_client_certificate_selector_test.cc b/chrome/browser/ssl/ssl_client_certificate_selector_test.cc index 57c5b69..d24e808 100644 --- a/chrome/browser/ssl/ssl_client_certificate_selector_test.cc +++ b/chrome/browser/ssl/ssl_client_certificate_selector_test.cc @@ -33,7 +33,7 @@ SSLClientCertificateSelectorTestBase::~SSLClientCertificateSelectorTestBase() { } void SSLClientCertificateSelectorTestBase::SetUpInProcessBrowserTestFixture() { - FilePath certs_dir = net::GetTestCertsDirectory(); + base::FilePath certs_dir = net::GetTestCertsDirectory(); mit_davidben_cert_ = net::ImportCertFromFile(certs_dir, "mit.davidben.der"); ASSERT_TRUE(mit_davidben_cert_); diff --git a/chrome/browser/sync/glue/chrome_extensions_activity_monitor_unittest.cc b/chrome/browser/sync/glue/chrome_extensions_activity_monitor_unittest.cc index a4310d9..6fd4dd3 100644 --- a/chrome/browser/sync/glue/chrome_extensions_activity_monitor_unittest.cc +++ b/chrome/browser/sync/glue/chrome_extensions_activity_monitor_unittest.cc @@ -28,7 +28,7 @@ namespace keys = extension_manifest_keys; // Create and return an extension with the given path. scoped_refptr<Extension> MakeExtension(const std::string& name) { - FilePath path; + base::FilePath path; EXPECT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &path)); path = path.AppendASCII(name); diff --git a/chrome/browser/sync/glue/sync_backend_host.cc b/chrome/browser/sync/glue/sync_backend_host.cc index 9ea68f0..e689d6d 100644 --- a/chrome/browser/sync/glue/sync_backend_host.cc +++ b/chrome/browser/sync/glue/sync_backend_host.cc @@ -61,7 +61,7 @@ #include "sync/util/nigori.h" static const int kSaveChangesIntervalSeconds = 10; -static const FilePath::CharType kSyncDataFolderName[] = +static const base::FilePath::CharType kSyncDataFolderName[] = FILE_PATH_LITERAL("Sync Data"); typedef TokenService::TokenAvailableDetails TokenAvailableDetails; @@ -90,7 +90,7 @@ class SyncBackendHost::Core public syncer::InvalidationHandler { public: Core(const std::string& name, - const FilePath& sync_data_folder_path, + const base::FilePath& sync_data_folder_path, const base::WeakPtr<SyncBackendHost>& backend); // SyncManager::Observer implementation. The Core just acts like an air @@ -257,7 +257,7 @@ class SyncBackendHost::Core const std::string name_; // Path of the folder that stores the sync data files. - const FilePath sync_data_folder_path_; + const base::FilePath sync_data_folder_path_; // Our parent SyncBackendHost. syncer::WeakHandle<SyncBackendHost> host_; @@ -923,7 +923,7 @@ SyncBackendHost::DoInitializeOptions::DoInitializeOptions( SyncBackendHost::DoInitializeOptions::~DoInitializeOptions() {} SyncBackendHost::Core::Core(const std::string& name, - const FilePath& sync_data_folder_path, + const base::FilePath& sync_data_folder_path, const base::WeakPtr<SyncBackendHost>& backend) : name_(name), sync_data_folder_path_(sync_data_folder_path), diff --git a/chrome/browser/sync/profile_sync_components_factory_impl_unittest.cc b/chrome/browser/sync/profile_sync_components_factory_impl_unittest.cc index aae278d..311299c 100644 --- a/chrome/browser/sync/profile_sync_components_factory_impl_unittest.cc +++ b/chrome/browser/sync/profile_sync_components_factory_impl_unittest.cc @@ -26,7 +26,7 @@ class ProfileSyncComponentsFactoryImplTest : public testing::Test { virtual void SetUp() { profile_.reset(new TestingProfile()); - FilePath program_path(FILE_PATH_LITERAL("chrome.exe")); + base::FilePath program_path(FILE_PATH_LITERAL("chrome.exe")); command_line_.reset(new CommandLine(program_path)); } diff --git a/chrome/browser/sync/profile_sync_service_typed_url_unittest.cc b/chrome/browser/sync/profile_sync_service_typed_url_unittest.cc index 1642259..34e5ccd 100644 --- a/chrome/browser/sync/profile_sync_service_typed_url_unittest.cc +++ b/chrome/browser/sync/profile_sync_service_typed_url_unittest.cc @@ -70,7 +70,7 @@ static const int EXPIRED_VISIT = -1; class HistoryBackendMock : public HistoryBackend { public: - HistoryBackendMock() : HistoryBackend(FilePath(), 0, NULL, NULL) {} + HistoryBackendMock() : HistoryBackend(base::FilePath(), 0, NULL, NULL) {} virtual bool IsExpiredVisitTime(const base::Time& time) OVERRIDE { return time.ToInternalValue() == EXPIRED_VISIT; } diff --git a/chrome/browser/sync/profile_sync_service_unittest.cc b/chrome/browser/sync/profile_sync_service_unittest.cc index 0cf0478..da4b5f7 100644 --- a/chrome/browser/sync/profile_sync_service_unittest.cc +++ b/chrome/browser/sync/profile_sync_service_unittest.cc @@ -400,12 +400,12 @@ TEST_F(ProfileSyncServiceTest, TestStartupWithOldSyncData) { const char* nonsense1 = "reginald"; const char* nonsense2 = "beartato"; const char* nonsense3 = "harrison"; - FilePath temp_directory = + base::FilePath temp_directory = harness_.profile->GetPath().AppendASCII("Sync Data"); - FilePath sync_file1 = + base::FilePath sync_file1 = temp_directory.AppendASCII("BookmarkSyncSettings.sqlite3"); - FilePath sync_file2 = temp_directory.AppendASCII("SyncData.sqlite3"); - FilePath sync_file3 = temp_directory.AppendASCII("nonsense_file"); + base::FilePath sync_file2 = temp_directory.AppendASCII("SyncData.sqlite3"); + base::FilePath sync_file3 = temp_directory.AppendASCII("nonsense_file"); ASSERT_TRUE(file_util::CreateDirectory(temp_directory)); ASSERT_NE(-1, file_util::WriteFile(sync_file1, nonsense1, strlen(nonsense1))); diff --git a/chrome/browser/sync/test/integration/bookmarks_helper.cc b/chrome/browser/sync/test/integration/bookmarks_helper.cc index 62dd5c9..d1ded3e 100644 --- a/chrome/browser/sync/test/integration/bookmarks_helper.cc +++ b/chrome/browser/sync/test/integration/bookmarks_helper.cc @@ -724,7 +724,7 @@ gfx::Image Create1xFaviconFromPNGFile(const std::string& path) { if (!EndsWith(path, kPNGExtension, false)) return gfx::Image(); - FilePath full_path; + base::FilePath full_path; if (!PathService::Get(chrome::DIR_TEST_DATA, &full_path)) return gfx::Image(); diff --git a/chrome/browser/sync/test/integration/preferences_helper.cc b/chrome/browser/sync/test/integration/preferences_helper.cc index 8607cb2..bf6f89e 100644 --- a/chrome/browser/sync/test/integration/preferences_helper.cc +++ b/chrome/browser/sync/test/integration/preferences_helper.cc @@ -67,7 +67,7 @@ void AppendStringPref(int index, void ChangeFilePathPref(int index, const char* pref_name, - const FilePath& new_value) { + const base::FilePath& new_value) { GetPrefs(index)->SetFilePath(pref_name, new_value); if (test()->use_verifier()) GetVerifierPrefs()->SetFilePath(pref_name, new_value); @@ -183,7 +183,7 @@ bool StringPrefMatches(const char* pref_name) { } bool FilePathPrefMatches(const char* pref_name) { - FilePath reference_value; + base::FilePath reference_value; if (test()->use_verifier()) { reference_value = GetVerifierPrefs()->GetFilePath(pref_name); } else { @@ -191,8 +191,8 @@ bool FilePathPrefMatches(const char* pref_name) { } for (int i = 0; i < test()->num_clients(); ++i) { if (reference_value != GetPrefs(i)->GetFilePath(pref_name)) { - LOG(ERROR) << "FilePath preference " << pref_name << " mismatched in" - << " profile " << i << "."; + LOG(ERROR) << "base::FilePath preference " << pref_name + << " mismatched in" << " profile " << i << "."; return false; } } diff --git a/chrome/browser/sync/test/integration/preferences_helper.h b/chrome/browser/sync/test/integration/preferences_helper.h index c2d4a72..a8144ca 100644 --- a/chrome/browser/sync/test/integration/preferences_helper.h +++ b/chrome/browser/sync/test/integration/preferences_helper.h @@ -60,7 +60,7 @@ void AppendStringPref(int index, // |verifier| if DisableVerifier() hasn't been called. void ChangeFilePathPref(int index, const char* pref_name, - const FilePath& new_value); + const base::FilePath& new_value); // Changes the value of the list preference with name |pref_name| in the // profile with index |index| to |new_value|. Also changes its value in diff --git a/chrome/browser/sync/test/integration/sync_extension_helper.cc b/chrome/browser/sync/test/integration/sync_extension_helper.cc index 69d54fa..fe61af5 100644 --- a/chrome/browser/sync/test/integration/sync_extension_helper.cc +++ b/chrome/browser/sync/test/integration/sync_extension_helper.cc @@ -266,8 +266,9 @@ std::string NameToPublicKey(const std::string& name) { // TODO(akalin): Somehow unify this with MakeExtension() in // extension_util_unittest.cc. -scoped_refptr<Extension> CreateExtension( - const FilePath& base_dir, const std::string& name, Manifest::Type type) { +scoped_refptr<Extension> CreateExtension(const base::FilePath& base_dir, + const std::string& name, + Manifest::Type type) { DictionaryValue source; source.SetString(extension_manifest_keys::kName, name); const std::string& public_key = NameToPublicKey(name); @@ -300,8 +301,8 @@ scoped_refptr<Extension> CreateExtension( ADD_FAILURE(); return NULL; } - const FilePath sub_dir = FilePath().AppendASCII(name); - FilePath extension_dir; + const base::FilePath sub_dir = base::FilePath().AppendASCII(name); + base::FilePath extension_dir; if (!file_util::PathExists(base_dir) && !file_util::CreateDirectory(base_dir)) { ADD_FAILURE(); diff --git a/chrome/browser/sync/test/integration/sync_test.cc b/chrome/browser/sync/test/integration/sync_test.cc index d8d104f..3f68e65 100644 --- a/chrome/browser/sync/test/integration/sync_test.cc +++ b/chrome/browser/sync/test/integration/sync_test.cc @@ -215,8 +215,8 @@ void SyncTest::AddTestSwitches(CommandLine* cl) { void SyncTest::AddOptionalTypesToCommandLine(CommandLine* cl) {} // static -Profile* SyncTest::MakeProfile(const FilePath::StringType name) { - FilePath path; +Profile* SyncTest::MakeProfile(const base::FilePath::StringType name) { + base::FilePath path; PathService::Get(chrome::DIR_USER_DATA, &path); path = path.Append(name); diff --git a/chrome/browser/sync/test/integration/sync_test.h b/chrome/browser/sync/test/integration/sync_test.h index ed138df..1d16691 100644 --- a/chrome/browser/sync/test/integration/sync_test.h +++ b/chrome/browser/sync/test/integration/sync_test.h @@ -246,11 +246,11 @@ class SyncTest : public InProcessBrowserTest { std::string password_; // Locally available plain text file in which GAIA credentials are stored. - FilePath password_file_; + base::FilePath password_file_; private: // Helper to ProfileManager::CreateProfile that handles path creation. - static Profile* MakeProfile(const FilePath::StringType name); + static Profile* MakeProfile(const base::FilePath::StringType name); // Helper method used to read GAIA credentials from a local password file // specified via the "--password-file-for-test" command line switch. diff --git a/chrome/browser/sync_file_system/drive_file_sync_client.cc b/chrome/browser/sync_file_system/drive_file_sync_client.cc index fda10f3..955c8da 100644 --- a/chrome/browser/sync_file_system/drive_file_sync_client.cc +++ b/chrome/browser/sync_file_system/drive_file_sync_client.cc @@ -31,7 +31,7 @@ const char kSyncRootDirectoryName[] = "Chrome Syncable FileSystem"; const char kMimeTypeOctetStream[] = "application/octet-stream"; // This path is not actually used but is required by DriveUploaderInterface. -const FilePath::CharType kDummyDrivePath[] = +const base::FilePath::CharType kDummyDrivePath[] = FILE_PATH_LITERAL("/dummy/drive/path"); bool HasParentLinkTo(const ScopedVector<google_apis::Link>& links, @@ -100,8 +100,8 @@ void EntryAdapter(scoped_ptr<google_apis::ResourceEntry> entry, void UploadResultAdapter( const DriveFileSyncClient::ResourceEntryCallback& callback, google_apis::DriveUploadError error, - const FilePath& drive_path, - const FilePath& file_path, + const base::FilePath& drive_path, + const base::FilePath& file_path, scoped_ptr<google_apis::ResourceEntry> entry) { callback.Run(DriveUploadErrorToGDataErrorCode(error), entry.Pass()); } @@ -379,7 +379,7 @@ void DriveFileSyncClient::ContinueListing( void DriveFileSyncClient::DownloadFile( const std::string& resource_id, const std::string& local_file_md5, - const FilePath& local_file_path, + const base::FilePath& local_file_path, const DownloadFileCallback& callback) { DCHECK(CalledOnValidThread()); DVLOG(2) << "Downloading file [" << resource_id << "]"; @@ -395,7 +395,7 @@ void DriveFileSyncClient::DownloadFile( void DriveFileSyncClient::UploadNewFile( const std::string& directory_resource_id, - const FilePath& local_file_path, + const base::FilePath& local_file_path, const std::string& title, const UploadFileCallback& callback) { DCHECK(CalledOnValidThread()); @@ -414,7 +414,7 @@ void DriveFileSyncClient::UploadNewFile( void DriveFileSyncClient::UploadExistingFile( const std::string& resource_id, const std::string& remote_file_md5, - const FilePath& local_file_path, + const base::FilePath& local_file_path, const UploadFileCallback& callback) { DCHECK(CalledOnValidThread()); DVLOG(2) << "Uploading existing file [" << resource_id << "]"; @@ -534,7 +534,7 @@ std::string DriveFileSyncClient::FormatTitleQuery(const std::string& title) { void DriveFileSyncClient::DownloadFileInternal( const std::string& local_file_md5, - const FilePath& local_file_path, + const base::FilePath& local_file_path, const DownloadFileCallback& callback, google_apis::GDataErrorCode error, scoped_ptr<google_apis::ResourceEntry> entry) { @@ -556,7 +556,7 @@ void DriveFileSyncClient::DownloadFileInternal( DVLOG(2) << "Downloading file: " << entry->resource_id(); drive_service_->DownloadFile( - FilePath(kDummyDrivePath), + base::FilePath(kDummyDrivePath), local_file_path, entry->download_url(), base::Bind(&DriveFileSyncClient::DidDownloadFile, @@ -568,7 +568,7 @@ void DriveFileSyncClient::DidDownloadFile( const std::string& downloaded_file_md5, const DownloadFileCallback& callback, google_apis::GDataErrorCode error, - const FilePath& downloaded_file_path) { + const base::FilePath& downloaded_file_path) { DCHECK(CalledOnValidThread()); if (error == google_apis::HTTP_SUCCESS) DVLOG(2) << "Download completed"; @@ -579,7 +579,7 @@ void DriveFileSyncClient::DidDownloadFile( } void DriveFileSyncClient::UploadNewFileInternal( - const FilePath& local_file_path, + const base::FilePath& local_file_path, const std::string& title, const UploadFileCallback& callback, google_apis::GDataErrorCode error, @@ -605,7 +605,7 @@ void DriveFileSyncClient::UploadNewFileInternal( drive_uploader_->UploadNewFile( parent_directory_entry->GetLinkByType( google_apis::Link::LINK_RESUMABLE_CREATE_MEDIA)->href(), - FilePath(kDummyDrivePath), + base::FilePath(kDummyDrivePath), local_file_path, title, mime_type, @@ -669,7 +669,7 @@ void DriveFileSyncClient::DidEnsureUniquenessForCreateFile( void DriveFileSyncClient::UploadExistingFileInternal( const std::string& remote_file_md5, - const FilePath& local_file_path, + const base::FilePath& local_file_path, const UploadFileCallback& callback, google_apis::GDataErrorCode error, scoped_ptr<google_apis::ResourceEntry> entry) { @@ -701,7 +701,7 @@ void DriveFileSyncClient::UploadExistingFileInternal( drive_uploader_->UploadExistingFile( entry->GetLinkByType( google_apis::Link::LINK_RESUMABLE_EDIT_MEDIA)->href(), - FilePath(kDummyDrivePath), + base::FilePath(kDummyDrivePath), local_file_path, mime_type, entry->etag(), diff --git a/chrome/browser/sync_file_system/drive_file_sync_client.h b/chrome/browser/sync_file_system/drive_file_sync_client.h index 025ba07..a805163 100644 --- a/chrome/browser/sync_file_system/drive_file_sync_client.h +++ b/chrome/browser/sync_file_system/drive_file_sync_client.h @@ -140,7 +140,7 @@ class DriveFileSyncClient // empty. void DownloadFile(const std::string& resource_id, const std::string& local_file_md5, - const FilePath& local_file_path, + const base::FilePath& local_file_path, const DownloadFileCallback& callback); // Uploads the new file |local_file_path| with specified |title| into the @@ -148,7 +148,7 @@ class DriveFileSyncClient // Upon completion, invokes |callback| and returns HTTP_CREATED if the file // is created. void UploadNewFile(const std::string& directory_resource_id, - const FilePath& local_file_path, + const base::FilePath& local_file_path, const std::string& title, const UploadFileCallback& callback); @@ -160,7 +160,7 @@ class DriveFileSyncClient // Returns HTTP_SUCCESS if the file uploaded successfully. void UploadExistingFile(const std::string& resource_id, const std::string& remote_file_md5, - const FilePath& local_file_path, + const base::FilePath& local_file_path, const UploadFileCallback& callback); // Returns true if the user is authenticated. @@ -236,7 +236,7 @@ class DriveFileSyncClient scoped_ptr<google_apis::ResourceEntry> entry); void DownloadFileInternal(const std::string& local_file_md5, - const FilePath& local_file_path, + const base::FilePath& local_file_path, const DownloadFileCallback& callback, google_apis::GDataErrorCode error, scoped_ptr<google_apis::ResourceEntry> entry); @@ -244,10 +244,10 @@ class DriveFileSyncClient void DidDownloadFile(const std::string& downloaded_file_md5, const DownloadFileCallback& callback, google_apis::GDataErrorCode error, - const FilePath& downloaded_file_path); + const base::FilePath& downloaded_file_path); void UploadNewFileInternal( - const FilePath& local_file_path, + const base::FilePath& local_file_path, const std::string& title, const UploadFileCallback& callback, google_apis::GDataErrorCode error, @@ -265,7 +265,7 @@ class DriveFileSyncClient void UploadExistingFileInternal( const std::string& remote_file_md5, - const FilePath& local_file_path, + const base::FilePath& local_file_path, const UploadFileCallback& callback, google_apis::GDataErrorCode error, scoped_ptr<google_apis::ResourceEntry> entry); diff --git a/chrome/browser/sync_file_system/drive_file_sync_client_unittest.cc b/chrome/browser/sync_file_system/drive_file_sync_client_unittest.cc index f409416..9c65b17 100644 --- a/chrome/browser/sync_file_system/drive_file_sync_client_unittest.cc +++ b/chrome/browser/sync_file_system/drive_file_sync_client_unittest.cc @@ -49,8 +49,8 @@ class FakeDriveUploader : public google_apis::DriveUploaderInterface { // contents of "gdata/file_entry.json" to the caller. virtual void UploadNewFile( const GURL& upload_location, - const FilePath& drive_file_path, - const FilePath& local_file_path, + const base::FilePath& drive_file_path, + const base::FilePath& local_file_path, const std::string& title, const std::string& content_type, const google_apis::UploadCompletionCallback& callback) OVERRIDE { @@ -75,8 +75,8 @@ class FakeDriveUploader : public google_apis::DriveUploaderInterface { // caller. virtual void UploadExistingFile( const GURL& upload_location, - const FilePath& drive_file_path, - const FilePath& local_file_path, + const base::FilePath& drive_file_path, + const base::FilePath& local_file_path, const std::string& content_type, const std::string& etag, const google_apis::UploadCompletionCallback& callback) OVERRIDE { @@ -732,7 +732,7 @@ TEST_F(DriveFileSyncClientTest, ListChanges) { TEST_F(DriveFileSyncClientTest, DownloadFile) { const std::string kResourceId = "file:resource_id"; const std::string kLocalFileMD5 = "123456"; - const FilePath kLocalFilePath(FPL("/tmp/dir/file")); + const base::FilePath kLocalFilePath(FPL("/tmp/dir/file")); scoped_ptr<base::Value> file_entry_data( LoadJSONFile("gdata/file_entry.json").Pass()); @@ -780,7 +780,7 @@ TEST_F(DriveFileSyncClientTest, DownloadFile) { TEST_F(DriveFileSyncClientTest, DownloadFileInNotModified) { const std::string kResourceId = "file:resource_id"; - const FilePath kLocalFilePath(FPL("/tmp/dir/file")); + const base::FilePath kLocalFilePath(FPL("/tmp/dir/file")); scoped_ptr<base::Value> file_entry_data( LoadJSONFile("gdata/file_entry.json").Pass()); @@ -821,7 +821,7 @@ TEST_F(DriveFileSyncClientTest, DownloadFileInNotModified) { TEST_F(DriveFileSyncClientTest, UploadNewFile) { const std::string kDirectoryResourceId = "folder:sub_dir_folder_resource_id"; - const FilePath kLocalFilePath(FPL("/tmp/dir/file")); + const base::FilePath kLocalFilePath(FPL("/tmp/dir/file")); const std::string kTitle("testfile"); scoped_ptr<base::Value> dir_entry_data( @@ -871,7 +871,7 @@ TEST_F(DriveFileSyncClientTest, UploadNewFile) { TEST_F(DriveFileSyncClientTest, UploadExistingFile) { const std::string kResourceId = "file:resource_id"; - const FilePath kLocalFilePath(FPL("/tmp/dir/file")); + const base::FilePath kLocalFilePath(FPL("/tmp/dir/file")); scoped_ptr<base::Value> file_entry_data( LoadJSONFile("gdata/file_entry.json").Pass()); @@ -908,7 +908,7 @@ TEST_F(DriveFileSyncClientTest, UploadExistingFile) { TEST_F(DriveFileSyncClientTest, UploadExistingFileInConflict) { const std::string kResourceId = "file:resource_id"; - const FilePath kLocalFilePath(FPL("/tmp/dir/file")); + const base::FilePath kLocalFilePath(FPL("/tmp/dir/file")); // Since remote file's hash value is different from the expected one, it is // expected to cancel upload the file and to return CONFLICT status code. diff --git a/chrome/browser/sync_file_system/drive_file_sync_service.cc b/chrome/browser/sync_file_system/drive_file_sync_service.cc index 171853a..4cc92c3 100644 --- a/chrome/browser/sync_file_system/drive_file_sync_service.cc +++ b/chrome/browser/sync_file_system/drive_file_sync_service.cc @@ -40,8 +40,8 @@ namespace sync_file_system { namespace { -const FilePath::CharType kTempDirName[] = FILE_PATH_LITERAL("tmp"); -const FilePath::CharType kSyncFileSystemDir[] = +const base::FilePath::CharType kTempDirName[] = FILE_PATH_LITERAL("tmp"); +const base::FilePath::CharType kSyncFileSystemDir[] = FILE_PATH_LITERAL("Sync FileSystem"); // The sync invalidation object ID for Google Drive. @@ -55,12 +55,13 @@ const int64 kMaximumPollingDelaySeconds = 10 * 60; // 10 min const int64 kPollingDelaySecondsWithNotification = 4 * 60 * 60; // 4 hr const double kDelayMultiplier = 1.6; -bool CreateTemporaryFile(const FilePath& dir_path, FilePath* temp_file) { +bool CreateTemporaryFile(const base::FilePath& dir_path, + base::FilePath* temp_file) { return file_util::CreateDirectory(dir_path) && file_util::CreateTemporaryFileInDir(dir_path, temp_file); } -void DeleteTemporaryFile(const FilePath& file_path) { +void DeleteTemporaryFile(const base::FilePath& file_path) { if (!content::BrowserThread::CurrentlyOn(content::BrowserThread::FILE)) { content::BrowserThread::PostTask( content::BrowserThread::FILE, FROM_HERE, @@ -197,7 +198,7 @@ struct DriveFileSyncService::ProcessRemoteChangeParam { DriveMetadata drive_metadata; bool metadata_updated; - FilePath temporary_file_path; + base::FilePath temporary_file_path; std::string md5_checksum; fileapi::SyncAction sync_action; bool clear_local_changes; @@ -336,7 +337,7 @@ DriveFileSyncService::~DriveFileSyncService() { // static scoped_ptr<DriveFileSyncService> DriveFileSyncService::CreateForTesting( Profile* profile, - const FilePath& base_dir, + const base::FilePath& base_dir, scoped_ptr<DriveFileSyncClient> sync_client, scoped_ptr<DriveMetadataStore> metadata_store) { return make_scoped_ptr(new DriveFileSyncService( @@ -450,7 +451,7 @@ void DriveFileSyncService::ProcessRemoteChange( const fileapi::FileSystemURL& url = pending_changes_.begin()->url; const GURL& origin = url.origin(); - const FilePath& path = url.path(); + const base::FilePath& path = url.path(); DCHECK(ContainsKey(origin_to_changes_map_, origin)); PathToChangeMap* path_to_change = &origin_to_changes_map_[origin]; DCHECK(ContainsKey(*path_to_change, path)); @@ -532,7 +533,7 @@ void DriveFileSyncService::SetSyncEnabled(bool enabled) { void DriveFileSyncService::ApplyLocalChange( const fileapi::FileChange& local_file_change, - const FilePath& local_file_path, + const base::FilePath& local_file_path, const fileapi::FileSystemURL& url, const fileapi::SyncStatusCallback& callback) { // TODO(nhiroki): support directory operations (http://crbug.com/161442). @@ -696,7 +697,7 @@ void DriveFileSyncService::OnNetworkConnected() { // Called by CreateForTesting. DriveFileSyncService::DriveFileSyncService( Profile* profile, - const FilePath& base_dir, + const base::FilePath& base_dir, scoped_ptr<DriveFileSyncClient> sync_client, scoped_ptr<DriveMetadataStore> metadata_store) : profile_(profile), @@ -1478,7 +1479,7 @@ void DriveFileSyncService::DidPrepareForProcessRemoteChange( const fileapi::FileChange& file_change = remote_file_change; param->processor->ApplyRemoteChange( - file_change, FilePath(), url, + file_change, base::FilePath(), url, base::Bind(&DriveFileSyncService::DidApplyRemoteChange, AsWeakPtr(), base::Passed(¶m))); return; @@ -1518,7 +1519,7 @@ void DriveFileSyncService::DownloadForRemoteSync( scoped_ptr<ProcessRemoteChangeParam> param) { // TODO(tzik): Use ShareableFileReference here after we get thread-safe // version of it. crbug.com/162598 - FilePath* temporary_file_path = ¶m->temporary_file_path; + base::FilePath* temporary_file_path = ¶m->temporary_file_path; content::BrowserThread::PostTaskAndReplyWithResult( content::BrowserThread::FILE, FROM_HERE, base::Bind(&CreateTemporaryFile, @@ -1535,7 +1536,7 @@ void DriveFileSyncService::DidGetTemporaryFileForDownload( return; } - const FilePath& temporary_file_path = param->temporary_file_path; + const base::FilePath& temporary_file_path = param->temporary_file_path; std::string resource_id = param->remote_change.resource_id; // We should not use the md5 in metadata for FETCH type to avoid the download @@ -1569,7 +1570,7 @@ void DriveFileSyncService::DidDownloadFileForRemoteSync( param->drive_metadata.set_md5_checksum(md5_checksum); const fileapi::FileChange& change = param->remote_change.change; - const FilePath& temporary_file_path = param->temporary_file_path; + const base::FilePath& temporary_file_path = param->temporary_file_path; const fileapi::FileSystemURL& url = param->remote_change.url; param->processor->ApplyRemoteChange( change, temporary_file_path, url, @@ -1700,7 +1701,7 @@ bool DriveFileSyncService::AppendRemoteChange( int64 changestamp, RemoteSyncType sync_type) { // TODO(tzik): Normalize the path here. - FilePath path = FilePath::FromUTF8Unsafe(entry.title()); + base::FilePath path = base::FilePath::FromUTF8Unsafe(entry.title()); DCHECK(!entry.is_folder()); return AppendRemoteChangeInternal( origin, path, entry.deleted(), @@ -1711,7 +1712,7 @@ bool DriveFileSyncService::AppendRemoteChange( bool DriveFileSyncService::AppendFetchChange( const GURL& origin, - const FilePath& path, + const base::FilePath& path, const std::string& resource_id) { return AppendRemoteChangeInternal( origin, path, @@ -1724,7 +1725,7 @@ bool DriveFileSyncService::AppendFetchChange( bool DriveFileSyncService::AppendRemoteChangeInternal( const GURL& origin, - const FilePath& path, + const base::FilePath& path, bool is_deleted, const std::string& remote_resource_id, int64 changestamp, diff --git a/chrome/browser/sync_file_system/drive_file_sync_service.h b/chrome/browser/sync_file_system/drive_file_sync_service.h index de30199..abeda9b 100644 --- a/chrome/browser/sync_file_system/drive_file_sync_service.h +++ b/chrome/browser/sync_file_system/drive_file_sync_service.h @@ -55,7 +55,7 @@ class DriveFileSyncService // |metadata_store| must be initialized beforehand. static scoped_ptr<DriveFileSyncService> CreateForTesting( Profile* profile, - const FilePath& base_dir, + const base::FilePath& base_dir, scoped_ptr<DriveFileSyncClient> sync_client, scoped_ptr<DriveMetadataStore> metadata_store); @@ -83,7 +83,7 @@ class DriveFileSyncService // LocalChangeProcessor overrides. virtual void ApplyLocalChange( const fileapi::FileChange& change, - const FilePath& local_file_path, + const base::FilePath& local_file_path, const fileapi::FileSystemURL& url, const fileapi::SyncStatusCallback& callback) OVERRIDE; @@ -150,9 +150,9 @@ class DriveFileSyncService bool operator()(const RemoteChange& left, const RemoteChange& right); }; - // TODO(tzik): Consider using std::pair<FilePath, FileType> as the key below - // to support directories and custom conflict handling. - typedef std::map<FilePath, RemoteChange> PathToChangeMap; + // TODO(tzik): Consider using std::pair<base::FilePath, FileType> as the key + // below to support directories and custom conflict handling. + typedef std::map<base::FilePath, RemoteChange> PathToChangeMap; typedef std::map<GURL, PathToChangeMap> OriginToChangesMap; // Task types; used for task token handling. @@ -178,7 +178,7 @@ class DriveFileSyncService }; DriveFileSyncService(Profile* profile, - const FilePath& base_dir, + const base::FilePath& base_dir, scoped_ptr<DriveFileSyncClient> sync_client, scoped_ptr<DriveMetadataStore> metadata_store); @@ -318,10 +318,10 @@ class DriveFileSyncService int64 changestamp, RemoteSyncType sync_type); bool AppendFetchChange(const GURL& origin, - const FilePath& path, + const base::FilePath& path, const std::string& resource_id); bool AppendRemoteChangeInternal(const GURL& origin, - const FilePath& path, + const base::FilePath& path, bool is_deleted, const std::string& resource_id, int64 changestamp, @@ -339,7 +339,7 @@ class DriveFileSyncService fileapi::SyncStatusCode GDataErrorCodeToSyncStatusCodeWrapper( google_apis::GDataErrorCode error) const; - FilePath temporary_file_dir_; + base::FilePath temporary_file_dir_; void FetchChangesForIncrementalSync(); void DidFetchChangesForIncrementalSync( diff --git a/chrome/browser/sync_file_system/drive_file_sync_service_unittest.cc b/chrome/browser/sync_file_system/drive_file_sync_service_unittest.cc index 58f0d95..289823e 100644 --- a/chrome/browser/sync_file_system/drive_file_sync_service_unittest.cc +++ b/chrome/browser/sync_file_system/drive_file_sync_service_unittest.cc @@ -55,8 +55,8 @@ namespace { const char kSyncRootDirectoryName[] = "Chrome Syncable FileSystem"; const char* kServiceName = DriveFileSyncService::kServiceName; -FilePath::StringType ASCIIToFilePathString(const std::string& path) { - return FilePath().AppendASCII(path).value(); +base::FilePath::StringType ASCIIToFilePathString(const std::string& path) { + return base::FilePath().AppendASCII(path).value(); } void DidInitialize(bool* done, fileapi::SyncStatusCode status, bool created) { @@ -81,8 +81,8 @@ void ExpectEqStatus(bool* done, // Mocks adding an installed extension to ExtensionService. scoped_refptr<const extensions::Extension> AddTestExtension( ExtensionService* extension_service, - const FilePath::StringType& extension_name) { - std::string id = Extension::GenerateIdForPath(FilePath(extension_name)); + const base::FilePath::StringType& extension_name) { + std::string id = Extension::GenerateIdForPath(base::FilePath(extension_name)); scoped_refptr<const Extension> extension = extensions::ExtensionBuilder().SetManifest( @@ -96,8 +96,8 @@ scoped_refptr<const extensions::Extension> AddTestExtension( } // Converts extension_name to GURL version. -GURL ExtensionNameToGURL(const FilePath::StringType& extension_name) { - std::string id = Extension::GenerateIdForPath(FilePath(extension_name)); +GURL ExtensionNameToGURL(const base::FilePath::StringType& extension_name) { + std::string id = Extension::GenerateIdForPath(base::FilePath(extension_name)); return extensions::Extension::GetBaseURLFromExtensionId(id); } @@ -219,7 +219,7 @@ class DriveFileSyncServiceTest : public testing::Test { static_cast<extensions::TestExtensionSystem*>( extensions::ExtensionSystem::Get(profile_.get()))); extension_system->CreateExtensionService( - CommandLine::ForCurrentProcess(), FilePath(), false); + CommandLine::ForCurrentProcess(), base::FilePath(), false); ExtensionService* extension_service = extension_system->Get( profile_.get())->extension_service(); AddTestExtension(extension_service, FPL("example1")); @@ -379,9 +379,9 @@ class DriveFileSyncServiceTest : public testing::Test { } fileapi::FileSystemURL CreateURL(const GURL& origin, - const FilePath::StringType& path) { + const base::FilePath::StringType& path) { return fileapi::CreateSyncableFileSystemURL( - origin, kServiceName, FilePath(path)); + origin, kServiceName, base::FilePath(path)); } void ProcessRemoteChange(fileapi::SyncStatusCode expected_status, @@ -431,7 +431,7 @@ class DriveFileSyncServiceTest : public testing::Test { bool AppendIncrementalRemoteChange( const GURL& origin, - const FilePath& path, + const base::FilePath& path, bool is_deleted, const std::string& resource_id, int64 changestamp, @@ -747,7 +747,7 @@ TEST_F(DriveFileSyncServiceTest, ResolveLocalSyncOperationType) { const fileapi::FileSystemURL url = fileapi::CreateSyncableFileSystemURL( GURL("chrome-extension://example/"), kServiceName, - FilePath().AppendASCII("path/to/file")); + base::FilePath().AppendASCII("path/to/file")); const std::string kResourceId("123456"); const int64 kChangestamp = 654321; @@ -852,7 +852,7 @@ TEST_F(DriveFileSyncServiceTest, RemoteChange_Busy) { const GURL kOrigin("chrome-extension://example"); const std::string kDirectoryResourceId("folder:origin_directory_resource_id"); const std::string kSyncRootResourceId("folder:sync_root_resource_id"); - const FilePath::StringType kFileName(FPL("File 1.mp3")); + const base::FilePath::StringType kFileName(FPL("File 1.mp3")); metadata_store()->SetSyncRootDirectory(kSyncRootResourceId); metadata_store()->AddBatchSyncOrigin(kOrigin, kDirectoryResourceId); @@ -889,7 +889,7 @@ TEST_F(DriveFileSyncServiceTest, RemoteChange_NewFile) { const GURL kOrigin = ExtensionNameToGURL(FPL("example1")); const std::string kDirectoryResourceId("folder:origin_directory_resource_id"); const std::string kSyncRootResourceId("folder:sync_root_resource_id"); - const FilePath::StringType kFileName(FPL("File 1.mp3")); + const base::FilePath::StringType kFileName(FPL("File 1.mp3")); const std::string kFileResourceId("file:2_file_resource_id"); metadata_store()->SetSyncRootDirectory(kSyncRootResourceId); @@ -933,7 +933,7 @@ TEST_F(DriveFileSyncServiceTest, RemoteChange_UpdateFile) { const GURL kOrigin = ExtensionNameToGURL(FPL("example1")); const std::string kDirectoryResourceId("folder:origin_directory_resource_id"); const std::string kSyncRootResourceId("folder:sync_root_resource_id"); - const FilePath::StringType kFileName(FPL("File 1.mp3")); + const base::FilePath::StringType kFileName(FPL("File 1.mp3")); const std::string kFileResourceId("file:2_file_resource_id"); metadata_store()->SetSyncRootDirectory(kSyncRootResourceId); @@ -1014,7 +1014,7 @@ TEST_F(DriveFileSyncServiceTest, RemoteChange_Override) { const GURL kOrigin = ExtensionNameToGURL(FPL("example1")); const std::string kDirectoryResourceId("folder:origin_directory_resource_id"); const std::string kSyncRootResourceId("folder:sync_root_resource_id"); - const FilePath kFilePath(FPL("File 1.mp3")); + const base::FilePath kFilePath(FPL("File 1.mp3")); const std::string kFileResourceId("file:2_file_resource_id"); const std::string kFileResourceId2("file:2_file_resource_id_2"); const fileapi::FileSystemURL kURL(CreateURL(kOrigin, kFilePath.value())); diff --git a/chrome/browser/sync_file_system/drive_metadata_store.cc b/chrome/browser/sync_file_system/drive_metadata_store.cc index bae9920..22706b4 100644 --- a/chrome/browser/sync_file_system/drive_metadata_store.cc +++ b/chrome/browser/sync_file_system/drive_metadata_store.cc @@ -33,7 +33,8 @@ namespace sync_file_system { namespace { const char* const kServiceName = DriveFileSyncService::kServiceName; -const FilePath::CharType kDatabaseName[] = FILE_PATH_LITERAL("DriveMetadata"); +const base::FilePath::CharType kDatabaseName[] = + FILE_PATH_LITERAL("DriveMetadata"); const char kChangeStampKey[] = "CHANGE_STAMP"; const char kSyncRootDirectoryKey[] = "SYNC_ROOT_DIR"; const char kDriveMetadataKeyPrefix[] = "METADATA: "; @@ -47,7 +48,7 @@ class DriveMetadataDB { typedef DriveMetadataStore::MetadataMap MetadataMap; typedef DriveMetadataStore::ResourceIDMap ResourceIDMap; - DriveMetadataDB(const FilePath& base_dir, + DriveMetadataDB(const base::FilePath& base_dir, base::SequencedTaskRunner* task_runner); ~DriveMetadataDB(); @@ -138,7 +139,7 @@ void AddOriginsToVector(std::vector<GURL>* all_origins, } // namespace DriveMetadataStore::DriveMetadataStore( - const FilePath& base_dir, + const base::FilePath& base_dir, base::SequencedTaskRunner* file_task_runner) : file_task_runner_(file_task_runner), db_(new DriveMetadataDB(base_dir, file_task_runner)), @@ -510,7 +511,7 @@ void DriveMetadataStore::GetAllOrigins(std::vector<GURL>* origins) { //////////////////////////////////////////////////////////////////////////////// -DriveMetadataDB::DriveMetadataDB(const FilePath& base_dir, +DriveMetadataDB::DriveMetadataDB(const base::FilePath& base_dir, base::SequencedTaskRunner* task_runner) : task_runner_(task_runner), db_path_(fileapi::FilePathToString(base_dir.Append(kDatabaseName))) { @@ -684,8 +685,8 @@ SyncStatusCode DriveMetadataDB::RemoveOrigin(const GURL& origin) { scoped_ptr<leveldb::Iterator> itr(db_->NewIterator(leveldb::ReadOptions())); std::string serialized_origin; bool success = fileapi::SerializeSyncableFileSystemURL( - fileapi::CreateSyncableFileSystemURL(origin, kServiceName, FilePath()), - &serialized_origin); + fileapi::CreateSyncableFileSystemURL( + origin, kServiceName, base::FilePath()), &serialized_origin); DCHECK(success); for (itr->Seek(kDriveMetadataKeyPrefix + serialized_origin); itr->Valid(); itr->Next()) { diff --git a/chrome/browser/sync_file_system/drive_metadata_store.h b/chrome/browser/sync_file_system/drive_metadata_store.h index 540d214..8b818c9 100644 --- a/chrome/browser/sync_file_system/drive_metadata_store.h +++ b/chrome/browser/sync_file_system/drive_metadata_store.h @@ -37,14 +37,14 @@ class DriveMetadataStore public base::SupportsWeakPtr<DriveMetadataStore> { public: typedef std::map<GURL, std::string> ResourceIDMap; - typedef std::map<FilePath, DriveMetadata> PathToMetadata; + typedef std::map<base::FilePath, DriveMetadata> PathToMetadata; typedef std::map<GURL, PathToMetadata> MetadataMap; typedef std::vector<std::pair<fileapi::FileSystemURL, std::string> > URLAndResourceIdList; typedef base::Callback<void(fileapi::SyncStatusCode status, bool created)> InitializationCallback; - DriveMetadataStore(const FilePath& base_dir, + DriveMetadataStore(const base::FilePath& base_dir, base::SequencedTaskRunner* file_task_runner); ~DriveMetadataStore(); diff --git a/chrome/browser/sync_file_system/drive_metadata_store_unittest.cc b/chrome/browser/sync_file_system/drive_metadata_store_unittest.cc index 073eaea..c28024b 100644 --- a/chrome/browser/sync_file_system/drive_metadata_store_unittest.cc +++ b/chrome/browser/sync_file_system/drive_metadata_store_unittest.cc @@ -31,7 +31,7 @@ const char* const kServiceName = DriveFileSyncService::kServiceName; typedef DriveMetadataStore::ResourceIDMap ResourceIDMap; -fileapi::FileSystemURL URL(const FilePath& path) { +fileapi::FileSystemURL URL(const base::FilePath& path) { return fileapi::CreateSyncableFileSystemURL( GURL(kOrigin), kServiceName, path); } @@ -241,7 +241,7 @@ TEST_F(DriveMetadataStoreTest, InitializationTest) { TEST_F(DriveMetadataStoreTest, ReadWriteTest) { InitializeDatabase(); - const fileapi::FileSystemURL url = URL(FilePath()); + const fileapi::FileSystemURL url = URL(base::FilePath()); DriveMetadata metadata; EXPECT_EQ(fileapi::SYNC_DATABASE_ERROR_NOT_FOUND, metadata_store()->ReadEntry(url, &metadata)); @@ -276,9 +276,9 @@ TEST_F(DriveMetadataStoreTest, GetConflictURLsTest) { metadata_store()->GetConflictURLs(&urls)); EXPECT_EQ(0U, urls.size()); - const FilePath path1(FPL("file1")); - const FilePath path2(FPL("file2")); - const FilePath path3(FPL("file3")); + const base::FilePath path1(FPL("file1")); + const base::FilePath path2(FPL("file2")); + const base::FilePath path3(FPL("file3")); // Populate metadata in DriveMetadataStore. The metadata identified by "file2" // and "file3" are marked as conflicted. @@ -304,9 +304,9 @@ TEST_F(DriveMetadataStoreTest, GetToBeFetchedFilessTest) { metadata_store()->GetToBeFetchedFiles(&list)); EXPECT_TRUE(list.empty()); - const FilePath path1(FPL("file1")); - const FilePath path2(FPL("file2")); - const FilePath path3(FPL("file3")); + const base::FilePath path1(FPL("file1")); + const base::FilePath path2(FPL("file2")); + const base::FilePath path3(FPL("file3")); // Populate metadata in DriveMetadataStore. The metadata identified by "file2" // and "file3" are marked to be fetched. @@ -420,27 +420,27 @@ TEST_F(DriveMetadataStoreTest, RemoveOrigin) { EXPECT_EQ(fileapi::SYNC_STATUS_OK, UpdateEntry( fileapi::CreateSyncableFileSystemURL( - kOrigin1, kServiceName, FilePath(FPL("guf"))), + kOrigin1, kServiceName, base::FilePath(FPL("guf"))), CreateMetadata("foo", "spam", false, false))); EXPECT_EQ(fileapi::SYNC_STATUS_OK, UpdateEntry( fileapi::CreateSyncableFileSystemURL( - kOrigin2, kServiceName, FilePath(FPL("mof"))), + kOrigin2, kServiceName, base::FilePath(FPL("mof"))), CreateMetadata("bar", "ham", false, false))); EXPECT_EQ(fileapi::SYNC_STATUS_OK, UpdateEntry( fileapi::CreateSyncableFileSystemURL( - kOrigin3, kServiceName, FilePath(FPL("waf"))), + kOrigin3, kServiceName, base::FilePath(FPL("waf"))), CreateMetadata("baz", "egg", false, false))); EXPECT_EQ(fileapi::SYNC_STATUS_OK, UpdateEntry( fileapi::CreateSyncableFileSystemURL( - kOrigin4, kServiceName, FilePath(FPL("cue"))), + kOrigin4, kServiceName, base::FilePath(FPL("cue"))), CreateMetadata("lat", "fork", false, false))); EXPECT_EQ(fileapi::SYNC_STATUS_OK, UpdateEntry( fileapi::CreateSyncableFileSystemURL( - kOrigin1, kServiceName, FilePath(FPL("tic"))), + kOrigin1, kServiceName, base::FilePath(FPL("tic"))), CreateMetadata("zav", "sause", false, false))); EXPECT_EQ(fileapi::SYNC_STATUS_OK, RemoveOrigin(kOrigin1)); diff --git a/chrome/browser/sync_file_system/local_change_processor.h b/chrome/browser/sync_file_system/local_change_processor.h index 1c637f1..c22b860 100644 --- a/chrome/browser/sync_file_system/local_change_processor.h +++ b/chrome/browser/sync_file_system/local_change_processor.h @@ -32,7 +32,7 @@ class LocalChangeProcessor { // (as the remote service is supposed to maintain a list of conflict files). virtual void ApplyLocalChange( const fileapi::FileChange& change, - const FilePath& local_file_path, + const base::FilePath& local_file_path, const fileapi::FileSystemURL& url, const fileapi::SyncStatusCallback& callback) = 0; diff --git a/chrome/browser/sync_file_system/local_file_sync_service.cc b/chrome/browser/sync_file_system/local_file_sync_service.cc index 64dfa99..b352152 100644 --- a/chrome/browser/sync_file_system/local_file_sync_service.cc +++ b/chrome/browser/sync_file_system/local_file_sync_service.cc @@ -231,7 +231,7 @@ void LocalFileSyncService::PrepareForProcessRemoteChange( void LocalFileSyncService::ApplyRemoteChange( const FileChange& change, - const FilePath& local_path, + const base::FilePath& local_path, const FileSystemURL& url, const SyncStatusCallback& callback) { DCHECK(ContainsKey(origin_to_contexts_, url.origin())); diff --git a/chrome/browser/sync_file_system/local_file_sync_service_unittest.cc b/chrome/browser/sync_file_system/local_file_sync_service_unittest.cc index cbc57b4..db7eee0 100644 --- a/chrome/browser/sync_file_system/local_file_sync_service_unittest.cc +++ b/chrome/browser/sync_file_system/local_file_sync_service_unittest.cc @@ -169,7 +169,7 @@ class LocalFileSyncServiceTest } SyncStatusCode ApplyRemoteChange(const FileChange& change, - const FilePath& local_path, + const base::FilePath& local_path, const FileSystemURL& url) { base::RunLoop run_loop; SyncStatusCode sync_status = fileapi::SYNC_STATUS_UNKNOWN; @@ -204,7 +204,7 @@ TEST_F(LocalFileSyncServiceTest, RemoteSyncStepsSimple) { const char kTestFileData[] = "0123456789"; const int kTestFileDataSize = static_cast<int>(arraysize(kTestFileData) - 1); - FilePath local_path; + base::FilePath local_path; ASSERT_TRUE(file_util::CreateTemporaryFileInDir(temp_dir_.path(), &local_path)); ASSERT_EQ(kTestFileDataSize, @@ -237,7 +237,7 @@ TEST_F(LocalFileSyncServiceTest, RemoteSyncStepsSimple) { change = FileChange(FileChange::FILE_CHANGE_ADD_OR_UPDATE, fileapi::SYNC_FILE_TYPE_DIRECTORY); EXPECT_EQ(fileapi::SYNC_STATUS_OK, - ApplyRemoteChange(change, FilePath(), kDir)); + ApplyRemoteChange(change, base::FilePath(), kDir)); // Verify the directory. EXPECT_EQ(base::PLATFORM_FILE_OK, @@ -254,7 +254,7 @@ TEST_F(LocalFileSyncServiceTest, RemoteSyncStepsSimple) { change = FileChange(FileChange::FILE_CHANGE_DELETE, fileapi::SYNC_FILE_TYPE_UNKNOWN); EXPECT_EQ(fileapi::SYNC_STATUS_OK, - ApplyRemoteChange(change, FilePath(), kDir)); + ApplyRemoteChange(change, base::FilePath(), kDir)); // Now the directory must have deleted. EXPECT_EQ(base::PLATFORM_FILE_ERROR_NOT_FOUND, @@ -341,7 +341,7 @@ TEST_F(LocalFileSyncServiceTest, ProcessLocalChange_CreateFile) { // Retrieve the expected platform_path. base::PlatformFileInfo info; - FilePath platform_path; + base::FilePath platform_path; EXPECT_EQ(base::PLATFORM_FILE_OK, file_system_->GetMetadata(kFile, &info, &platform_path)); diff --git a/chrome/browser/sync_file_system/mock_local_change_processor.cc b/chrome/browser/sync_file_system/mock_local_change_processor.cc index f92ece8..50632bb 100644 --- a/chrome/browser/sync_file_system/mock_local_change_processor.cc +++ b/chrome/browser/sync_file_system/mock_local_change_processor.cc @@ -27,7 +27,7 @@ MockLocalChangeProcessor::~MockLocalChangeProcessor() { void MockLocalChangeProcessor::ApplyLocalChangeStub( const fileapi::FileChange& change, - const FilePath& local_file_path, + const base::FilePath& local_file_path, const fileapi::FileSystemURL& url, const fileapi::SyncStatusCallback& callback) { base::MessageLoopProxy::current()->PostTask( diff --git a/chrome/browser/sync_file_system/mock_local_change_processor.h b/chrome/browser/sync_file_system/mock_local_change_processor.h index 38a4d1d..58b68cb 100644 --- a/chrome/browser/sync_file_system/mock_local_change_processor.h +++ b/chrome/browser/sync_file_system/mock_local_change_processor.h @@ -19,14 +19,14 @@ class MockLocalChangeProcessor : public LocalChangeProcessor { // LocalChangeProcessor override. MOCK_METHOD4(ApplyLocalChange, void(const fileapi::FileChange& change, - const FilePath& local_file_path, + const base::FilePath& local_file_path, const fileapi::FileSystemURL& url, const fileapi::SyncStatusCallback& callback)); private: void ApplyLocalChangeStub( const fileapi::FileChange& change, - const FilePath& local_file_path, + const base::FilePath& local_file_path, const fileapi::FileSystemURL& url, const fileapi::SyncStatusCallback& callback); diff --git a/chrome/browser/system_monitor/media_device_notifications_utils_unittest.cc b/chrome/browser/system_monitor/media_device_notifications_utils_unittest.cc index 15bfc47..2f12385 100644 --- a/chrome/browser/system_monitor/media_device_notifications_utils_unittest.cc +++ b/chrome/browser/system_monitor/media_device_notifications_utils_unittest.cc @@ -24,7 +24,7 @@ class MediaDeviceNotificationUtilsTest : public testing::Test { virtual ~MediaDeviceNotificationUtilsTest() { } // Verify mounted device type. - void checkDeviceType(const FilePath::StringType& mount_point, + void checkDeviceType(const base::FilePath::StringType& mount_point, bool expected_val) { if (expected_val) EXPECT_TRUE(IsMediaDevice(mount_point)); @@ -34,12 +34,12 @@ class MediaDeviceNotificationUtilsTest : public testing::Test { protected: // Create mount point for the test device. - FilePath CreateMountPoint(bool create_dcim_dir) { - FilePath path(scoped_temp_dir_.path()); + base::FilePath CreateMountPoint(bool create_dcim_dir) { + base::FilePath path(scoped_temp_dir_.path()); if (create_dcim_dir) path = path.Append(kDCIMDirectoryName); if (!file_util::CreateDirectory(path)) - return FilePath(); + return base::FilePath(); return scoped_temp_dir_.path(); } @@ -77,7 +77,7 @@ class MediaDeviceNotificationUtilsTest : public testing::Test { // media device mount point. TEST_F(MediaDeviceNotificationUtilsTest, MediaDeviceAttached) { // Create a dummy mount point with DCIM Directory. - FilePath mount_point(CreateMountPoint(true)); + base::FilePath mount_point(CreateMountPoint(true)); BrowserThread::PostTask( BrowserThread::FILE, FROM_HERE, base::Bind(&MediaDeviceNotificationUtilsTest::checkDeviceType, @@ -89,7 +89,7 @@ TEST_F(MediaDeviceNotificationUtilsTest, MediaDeviceAttached) { // non-media device mount point. TEST_F(MediaDeviceNotificationUtilsTest, NonMediaDeviceAttached) { // Create a dummy mount point without DCIM Directory. - FilePath mount_point(CreateMountPoint(false)); + base::FilePath mount_point(CreateMountPoint(false)); BrowserThread::PostTask( BrowserThread::FILE, FROM_HERE, base::Bind(&MediaDeviceNotificationUtilsTest::checkDeviceType, diff --git a/chrome/browser/system_monitor/media_storage_util.h b/chrome/browser/system_monitor/media_storage_util.h index 416dbef..877b4a29 100644 --- a/chrome/browser/system_monitor/media_storage_util.h +++ b/chrome/browser/system_monitor/media_storage_util.h @@ -76,8 +76,8 @@ class MediaStorageUtil { string16* device_name, base::FilePath* relative_path); - // Get a FilePath for the given |device_id|. If the device isn't a mass - // storage type, the FilePath will be empty. This does not check that + // Get a base::FilePath for the given |device_id|. If the device isn't a mass + // storage type, the base::FilePath will be empty. This does not check that // the device is connected. static base::FilePath FindDevicePathById(const std::string& device_id); diff --git a/chrome/browser/system_monitor/removable_device_notifications_window_win.cc b/chrome/browser/system_monitor/removable_device_notifications_window_win.cc index 372fa4d..e9309e6 100644 --- a/chrome/browser/system_monitor/removable_device_notifications_window_win.cc +++ b/chrome/browser/system_monitor/removable_device_notifications_window_win.cc @@ -79,7 +79,7 @@ void RemovableDeviceNotificationsWindowWin::Init() { } bool RemovableDeviceNotificationsWindowWin::GetDeviceInfoForPath( - const FilePath& path, + const base::FilePath& path, StorageInfo* device_info) const { string16 location; std::string unique_id; @@ -164,7 +164,7 @@ LRESULT CALLBACK RemovableDeviceNotificationsWindowWin::WndProc( } bool RemovableDeviceNotificationsWindowWin::GetDeviceInfo( - const FilePath& device_path, string16* device_location, + const base::FilePath& device_path, string16* device_location, std::string* unique_id, string16* name, bool* removable) const { // TODO(kmadhusu) Implement PortableDeviceWatcherWin::GetDeviceInfo() // function when we have the functionality to add a sub directory of diff --git a/chrome/browser/task_manager/task_manager_browsertest.cc b/chrome/browser/task_manager/task_manager_browsertest.cc index 43e2fd9..d3341f2 100644 --- a/chrome/browser/task_manager/task_manager_browsertest.cc +++ b/chrome/browser/task_manager/task_manager_browsertest.cc @@ -57,7 +57,7 @@ using content::WebContents; namespace { -const FilePath::CharType* kTitle1File = FILE_PATH_LITERAL("title1.html"); +const base::FilePath::CharType* kTitle1File = FILE_PATH_LITERAL("title1.html"); } // namespace @@ -119,8 +119,8 @@ IN_PROC_BROWSER_TEST_F(TaskManagerBrowserTest, MAYBE_ShutdownWhileOpen) { IN_PROC_BROWSER_TEST_F(TaskManagerBrowserTest, NoticeTabContentsChanges) { int resource_count = TaskManager::GetInstance()->model()->ResourceCount(); // Open a new tab and make sure we notice that. - GURL url(ui_test_utils::GetTestUrl(FilePath(FilePath::kCurrentDirectory), - FilePath(kTitle1File))); + GURL url(ui_test_utils::GetTestUrl(base::FilePath( + base::FilePath::kCurrentDirectory), base::FilePath(kTitle1File))); AddTabAtIndex(0, url, content::PAGE_TRANSITION_TYPED); TaskManagerBrowserTestUtil::WaitForWebResourceChange(2); @@ -184,8 +184,8 @@ IN_PROC_BROWSER_TEST_F(TaskManagerBrowserTest, MAYBE_NoticePanelChanges) { IN_PROC_BROWSER_TEST_F(TaskManagerBrowserTest, NoticeBGContentsChanges) { // Open a new background contents and make sure we notice that. - GURL url(ui_test_utils::GetTestUrl(FilePath(FilePath::kCurrentDirectory), - FilePath(kTitle1File))); + GURL url(ui_test_utils::GetTestUrl(base::FilePath( + base::FilePath::kCurrentDirectory), base::FilePath(kTitle1File))); BackgroundContentsService* service = BackgroundContentsServiceFactory::GetForProfile(browser()->profile()); @@ -207,8 +207,8 @@ IN_PROC_BROWSER_TEST_F(TaskManagerBrowserTest, KillBGContents) { int resource_count = TaskManager::GetInstance()->model()->ResourceCount(); // Open a new background contents and make sure we notice that. - GURL url(ui_test_utils::GetTestUrl(FilePath(FilePath::kCurrentDirectory), - FilePath(kTitle1File))); + GURL url(ui_test_utils::GetTestUrl(base::FilePath( + base::FilePath::kCurrentDirectory), base::FilePath(kTitle1File))); content::WindowedNotificationObserver observer( chrome::NOTIFICATION_BACKGROUND_CONTENTS_NAVIGATED, @@ -533,8 +533,8 @@ IN_PROC_BROWSER_TEST_F(TaskManagerBrowserTest, int resource_count = TaskManager::GetInstance()->model()->ResourceCount(); // Open a new tab and make sure we notice that. - GURL url(ui_test_utils::GetTestUrl(FilePath(FilePath::kCurrentDirectory), - FilePath(kTitle1File))); + GURL url(ui_test_utils::GetTestUrl(base::FilePath( + base::FilePath::kCurrentDirectory), base::FilePath(kTitle1File))); AddTabAtIndex(0, url, content::PAGE_TRANSITION_TYPED); TaskManagerBrowserTestUtil::WaitForWebResourceChange(2); diff --git a/chrome/browser/task_profiler/auto_tracking.cc b/chrome/browser/task_profiler/auto_tracking.cc index 2473c45..f934735 100644 --- a/chrome/browser/task_profiler/auto_tracking.cc +++ b/chrome/browser/task_profiler/auto_tracking.cc @@ -14,7 +14,7 @@ AutoTracking::~AutoTracking() { } } -void AutoTracking::set_output_file_path(const FilePath &path) { +void AutoTracking::set_output_file_path(const base::FilePath &path) { output_file_path_ = path; } diff --git a/chrome/browser/task_profiler/auto_tracking.h b/chrome/browser/task_profiler/auto_tracking.h index b443871..343f8f65 100644 --- a/chrome/browser/task_profiler/auto_tracking.h +++ b/chrome/browser/task_profiler/auto_tracking.h @@ -25,10 +25,10 @@ class AutoTracking { ~AutoTracking(); - void set_output_file_path(const FilePath &path); + void set_output_file_path(const base::FilePath &path); private: - FilePath output_file_path_; + base::FilePath output_file_path_; DISALLOW_COPY_AND_ASSIGN(AutoTracking); }; diff --git a/chrome/browser/task_profiler/task_profiler_data_serializer.cc b/chrome/browser/task_profiler/task_profiler_data_serializer.cc index 6a2f90b..ed9440f 100644 --- a/chrome/browser/task_profiler/task_profiler_data_serializer.cc +++ b/chrome/browser/task_profiler/task_profiler_data_serializer.cc @@ -123,7 +123,7 @@ void TaskProfilerDataSerializer::ToValue( } -bool TaskProfilerDataSerializer::WriteToFile(const FilePath& path) { +bool TaskProfilerDataSerializer::WriteToFile(const base::FilePath& path) { std::string output; JSONStringValueSerializer serializer(&output); serializer.set_pretty_print(true); diff --git a/chrome/browser/themes/browser_theme_pack.cc b/chrome/browser/themes/browser_theme_pack.cc index 6e732cd..842a7e6 100644 --- a/chrome/browser/themes/browser_theme_pack.cc +++ b/chrome/browser/themes/browser_theme_pack.cc @@ -325,7 +325,7 @@ const int kPreloadIDs[] = { }; // Returns a piece of memory with the contents of the file |path|. -base::RefCountedMemory* ReadFileData(const FilePath& path) { +base::RefCountedMemory* ReadFileData(const base::FilePath& path) { if (!path.empty()) { net::FileStream file(NULL); int flags = base::PLATFORM_FILE_OPEN | base::PLATFORM_FILE_READ; @@ -488,7 +488,7 @@ scoped_refptr<BrowserThemePack> BrowserThemePack::BuildFromExtension( // static scoped_refptr<BrowserThemePack> BrowserThemePack::BuildFromDataPack( - const FilePath& path, const std::string& expected_id) { + const base::FilePath& path, const std::string& expected_id) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); // Allow IO on UI thread due to deep-seated theme design issues. // (see http://crbug.com/80206) @@ -553,7 +553,7 @@ scoped_refptr<BrowserThemePack> BrowserThemePack::BuildFromDataPack( return pack; } -bool BrowserThemePack::WriteToDisk(const FilePath& path) const { +bool BrowserThemePack::WriteToDisk(const base::FilePath& path) const { // Add resources for each of the property arrays. RawDataForWriting resources; resources[kHeaderID] = base::StringPiece( @@ -950,7 +950,7 @@ void BrowserThemePack::BuildDisplayPropertiesFromJSON( void BrowserThemePack::ParseImageNamesFromJSON( DictionaryValue* images_value, - const FilePath& images_path, + const base::FilePath& images_path, FilePathMap* file_paths) const { if (!images_value) return; diff --git a/chrome/browser/themes/browser_theme_pack_unittest.cc b/chrome/browser/themes/browser_theme_pack_unittest.cc index 97bf82d..e1c6291 100644 --- a/chrome/browser/themes/browser_theme_pack_unittest.cc +++ b/chrome/browser/themes/browser_theme_pack_unittest.cc @@ -109,28 +109,29 @@ class BrowserThemePackTest : public ::testing::Test { } void ParseImageNamesJSON(const std::string& json, - std::map<int, FilePath>* out_file_paths) { + std::map<int, base::FilePath>* out_file_paths) { scoped_ptr<Value> value(base::JSONReader::Read(json)); ASSERT_TRUE(value->IsType(Value::TYPE_DICTIONARY)); ParseImageNamesDictionary(static_cast<DictionaryValue*>(value.get()), out_file_paths); } - void ParseImageNamesDictionary(DictionaryValue* value, - std::map<int, FilePath>* out_file_paths) { - theme_pack_->ParseImageNamesFromJSON(value, FilePath(), out_file_paths); + void ParseImageNamesDictionary( + DictionaryValue* value, + std::map<int, base::FilePath>* out_file_paths) { + theme_pack_->ParseImageNamesFromJSON(value, base::FilePath(), out_file_paths); // Build the source image list for HasCustomImage(). theme_pack_->BuildSourceImagesArray(*out_file_paths); } - bool LoadRawBitmapsTo(const std::map<int, FilePath>& out_file_paths) { + bool LoadRawBitmapsTo(const std::map<int, base::FilePath>& out_file_paths) { return theme_pack_->LoadRawBitmapsTo(out_file_paths, &theme_pack_->images_on_ui_thread_); } - FilePath GetStarGazingPath() { - FilePath test_path; + base::FilePath GetStarGazingPath() { + base::FilePath test_path; if (!PathService::Get(chrome::DIR_TEST_DATA, &test_path)) { NOTREACHED(); return test_path; @@ -142,7 +143,7 @@ class BrowserThemePackTest : public ::testing::Test { test_path = test_path.AppendASCII("Extensions"); test_path = test_path.AppendASCII("mblmlcbknbnfebdfjnolmcapmdofhmme"); test_path = test_path.AppendASCII("1.1"); - return FilePath(test_path); + return base::FilePath(test_path); } // Verifies the data in star gazing. We do this multiple times for different @@ -301,22 +302,22 @@ TEST_F(BrowserThemePackTest, CanReadDisplayProperties) { TEST_F(BrowserThemePackTest, CanParsePaths) { std::string path_json = "{ \"theme_button_background\": \"one\", " " \"theme_toolbar\": \"two\" }"; - std::map<int, FilePath> out_file_paths; + std::map<int, base::FilePath> out_file_paths; ParseImageNamesJSON(path_json, &out_file_paths); EXPECT_EQ(2u, out_file_paths.size()); // "12" and "5" are internal constants to BrowserThemePack and are // PRS_THEME_BUTTON_BACKGROUND and PRS_THEME_TOOLBAR, but they are // implementation details that shouldn't be exported. - EXPECT_TRUE(FilePath(FILE_PATH_LITERAL("one")) == out_file_paths[12]); - EXPECT_TRUE(FilePath(FILE_PATH_LITERAL("two")) == out_file_paths[5]); + EXPECT_TRUE(base::FilePath(FILE_PATH_LITERAL("one")) == out_file_paths[12]); + EXPECT_TRUE(base::FilePath(FILE_PATH_LITERAL("two")) == out_file_paths[5]); } TEST_F(BrowserThemePackTest, InvalidPathNames) { std::string path_json = "{ \"wrong\": [1], " " \"theme_button_background\": \"one\", " " \"not_a_thing\": \"blah\" }"; - std::map<int, FilePath> out_file_paths; + std::map<int, base::FilePath> out_file_paths; ParseImageNamesJSON(path_json, &out_file_paths); // We should have only parsed one valid path out of that mess above. @@ -354,7 +355,7 @@ TEST_F(BrowserThemePackTest, InvalidDisplayProperties) { // These three tests should just not cause a segmentation fault. TEST_F(BrowserThemePackTest, NullPaths) { - std::map<int, FilePath> out_file_paths; + std::map<int, base::FilePath> out_file_paths; ParseImageNamesDictionary(NULL, &out_file_paths); } @@ -374,7 +375,7 @@ TEST_F(BrowserThemePackTest, TestHasCustomImage) { // HasCustomImage should only return true for images that exist in the // extension and not for autogenerated images. std::string images = "{ \"theme_frame\": \"one\" }"; - std::map<int, FilePath> out_file_paths; + std::map<int, base::FilePath> out_file_paths; ParseImageNamesJSON(images, &out_file_paths); EXPECT_TRUE(theme_pack_->HasCustomImage(IDR_THEME_FRAME)); @@ -383,7 +384,7 @@ TEST_F(BrowserThemePackTest, TestHasCustomImage) { TEST_F(BrowserThemePackTest, TestNonExistantImages) { std::string images = "{ \"theme_frame\": \"does_not_exist\" }"; - std::map<int, FilePath> out_file_paths; + std::map<int, base::FilePath> out_file_paths; ParseImageNamesJSON(images, &out_file_paths); EXPECT_FALSE(LoadRawBitmapsTo(out_file_paths)); @@ -395,12 +396,12 @@ TEST_F(BrowserThemePackTest, TestNonExistantImages) { TEST_F(BrowserThemePackTest, CanBuildAndReadPack) { base::ScopedTempDir dir; ASSERT_TRUE(dir.CreateUniqueTempDir()); - FilePath file = dir.path().AppendASCII("data.pak"); + base::FilePath file = dir.path().AppendASCII("data.pak"); // Part 1: Build the pack from an extension. { - FilePath star_gazing_path = GetStarGazingPath(); - FilePath manifest_path = + base::FilePath star_gazing_path = GetStarGazingPath(); + base::FilePath manifest_path = star_gazing_path.AppendASCII("manifest.json"); std::string error; JSONFileValueSerializer serializer(manifest_path); diff --git a/chrome/browser/themes/theme_service.cc b/chrome/browser/themes/theme_service.cc index ae0626c..b4cf76c 100644 --- a/chrome/browser/themes/theme_service.cc +++ b/chrome/browser/themes/theme_service.cc @@ -196,7 +196,7 @@ const int kToolbarButtonIDs[] = { // Writes the theme pack to disk on a separate thread. void WritePackToDiskCallback(BrowserThemePack* pack, - const FilePath& path) { + const base::FilePath& path) { if (!pack->WriteToDisk(path)) NOTREACHED() << "Could not write theme pack to disk"; } @@ -599,8 +599,8 @@ void ThemeService::LoadThemePrefs() { bool loaded_pack = false; // If we don't have a file pack, we're updating from an old version. - FilePath path = prefs->GetFilePath(prefs::kCurrentThemePackFilename); - if (path != FilePath()) { + base::FilePath path = prefs->GetFilePath(prefs::kCurrentThemePackFilename); + if (path != base::FilePath()) { theme_pack_ = BrowserThemePack::BuildFromDataPack(path, current_id); loaded_pack = theme_pack_.get() != NULL; } @@ -653,7 +653,7 @@ void ThemeService::FreePlatformCaches() { } #endif -void ThemeService::SavePackName(const FilePath& pack_path) { +void ThemeService::SavePackName(const base::FilePath& pack_path) { profile_->GetPrefs()->SetFilePath( prefs::kCurrentThemePackFilename, pack_path); } @@ -678,7 +678,8 @@ void ThemeService::BuildFromExtension(const Extension* extension) { return; // Write the packed file to disk. - FilePath pack_path = extension->path().Append(chrome::kThemePackFilename); + base::FilePath pack_path = + extension->path().Append(chrome::kThemePackFilename); service->GetFileTaskRunner()->PostTask( FROM_HERE, base::Bind(&WritePackToDiskCallback, pack, pack_path)); diff --git a/chrome/browser/themes/theme_service_factory.cc b/chrome/browser/themes/theme_service_factory.cc index 86072d6..2f4674a 100644 --- a/chrome/browser/themes/theme_service_factory.cc +++ b/chrome/browser/themes/theme_service_factory.cc @@ -63,7 +63,7 @@ void ThemeServiceFactory::RegisterUserPrefs(PrefServiceSyncable* prefs) { PrefServiceSyncable::UNSYNCABLE_PREF); #endif prefs->RegisterFilePathPref(prefs::kCurrentThemePackFilename, - FilePath(), + base::FilePath(), PrefServiceSyncable::UNSYNCABLE_PREF); prefs->RegisterStringPref(prefs::kCurrentThemeID, ThemeService::kDefaultThemeID, diff --git a/chrome/browser/themes/theme_service_unittest.cc b/chrome/browser/themes/theme_service_unittest.cc index 3799a35..b88e832 100644 --- a/chrome/browser/themes/theme_service_unittest.cc +++ b/chrome/browser/themes/theme_service_unittest.cc @@ -19,7 +19,7 @@ class ThemeServiceTest : public ExtensionServiceTestBase { ThemeServiceTest() {} virtual ~ThemeServiceTest() {} - scoped_refptr<extensions::Extension> MakeThemeExtension(FilePath path) { + scoped_refptr<extensions::Extension> MakeThemeExtension(base::FilePath path) { DictionaryValue source; source.SetString(extension_manifest_keys::kName, "theme"); source.Set(extension_manifest_keys::kTheme, new DictionaryValue()); diff --git a/chrome/browser/themes/theme_syncable_service_unittest.cc b/chrome/browser/themes/theme_syncable_service_unittest.cc index 4465703..2d268cc 100644 --- a/chrome/browser/themes/theme_syncable_service_unittest.cc +++ b/chrome/browser/themes/theme_syncable_service_unittest.cc @@ -32,9 +32,10 @@ static const char kCustomThemeName[] = "name"; static const char kCustomThemeUrl[] = "http://update.url/foo"; #if defined(OS_WIN) -const FilePath::CharType kExtensionFilePath[] = FILE_PATH_LITERAL("c:\\foo"); +const base::FilePath::CharType kExtensionFilePath[] = + FILE_PATH_LITERAL("c:\\foo"); #elif defined(OS_POSIX) -const FilePath::CharType kExtensionFilePath[] = FILE_PATH_LITERAL("/oo"); +const base::FilePath::CharType kExtensionFilePath[] = FILE_PATH_LITERAL("/oo"); #endif class FakeSyncChangeProcessor : public syncer::SyncChangeProcessor { @@ -127,7 +128,7 @@ ProfileKeyedService* BuildMockThemeService(Profile* profile) { } scoped_refptr<extensions::Extension> MakeThemeExtension( - const FilePath& extension_path, + const base::FilePath& extension_path, const string& name, const string& update_url) { DictionaryValue source; @@ -176,17 +177,15 @@ class ThemeSyncableServiceTest : public testing::Test { extensions::TestExtensionSystem* test_ext_system = static_cast<extensions::TestExtensionSystem*>( extensions::ExtensionSystem::Get(profile_.get())); - ExtensionService* service = - test_ext_system->CreateExtensionService(&command_line, - FilePath(kExtensionFilePath), - false); + ExtensionService* service = test_ext_system->CreateExtensionService( + &command_line, base::FilePath(kExtensionFilePath), false); EXPECT_TRUE(service->extensions_enabled()); service->Init(); loop_.RunUntilIdle(); // Create and add custom theme extension so the ThemeSyncableService can // find it. - theme_extension_ = MakeThemeExtension(FilePath(kExtensionFilePath), + theme_extension_ = MakeThemeExtension(base::FilePath(kExtensionFilePath), kCustomThemeName, kCustomThemeUrl); service->AddExtension(theme_extension_); ASSERT_EQ(1u, service->extensions()->size()); diff --git a/chrome/browser/translate/translate_manager_browsertest.cc b/chrome/browser/translate/translate_manager_browsertest.cc index ad65885..462707b 100644 --- a/chrome/browser/translate/translate_manager_browsertest.cc +++ b/chrome/browser/translate/translate_manager_browsertest.cc @@ -1486,7 +1486,7 @@ IN_PROC_BROWSER_TEST_F(InProcessBrowserTest, source); GURL french_url = ui_test_utils::GetTestUrl( - FilePath(), FilePath(FILE_PATH_LITERAL("french_page.html"))); + base::FilePath(), base::FilePath(FILE_PATH_LITERAL("french_page.html"))); ui_test_utils::NavigateToURL(browser(), french_url); fr_language_detected_signal.Wait(); std::string lang; diff --git a/chrome/browser/ui/app_list/app_list_util.cc b/chrome/browser/ui/app_list/app_list_util.cc index 12d1b5b..098718c 100644 --- a/chrome/browser/ui/app_list/app_list_util.cc +++ b/chrome/browser/ui/app_list/app_list_util.cc @@ -21,7 +21,7 @@ void InitAppList(Profile* profile) {} #endif #if defined(ENABLE_APP_LIST) -FilePath GetAppListProfilePath(const FilePath& user_data_dir) { +base::FilePath GetAppListProfilePath(const base::FilePath& user_data_dir) { PrefService* local_state = g_browser_process->local_state(); DCHECK(local_state); diff --git a/chrome/browser/ui/app_list/app_list_util.h b/chrome/browser/ui/app_list/app_list_util.h index bdd17a6..06c2df8 100644 --- a/chrome/browser/ui/app_list/app_list_util.h +++ b/chrome/browser/ui/app_list/app_list_util.h @@ -29,10 +29,10 @@ void ShowAppList(Profile* profile); void RegisterAppListPrefs(PrefRegistrySimple* registry); // Change the profile that the app list is showing. -void SetAppListProfile(const FilePath& profile_file_path); +void SetAppListProfile(const base::FilePath& profile_file_path); // Get the path of the profile to be used with the app list. -FilePath GetAppListProfilePath(const FilePath& user_data_dir); +base::FilePath GetAppListProfilePath(const base::FilePath& user_data_dir); // Dismiss the app list. void DismissAppList(); diff --git a/chrome/browser/ui/app_list/apps_model_builder_unittest.cc b/chrome/browser/ui/app_list/apps_model_builder_unittest.cc index ef65138..01b1daa 100644 --- a/chrome/browser/ui/app_list/apps_model_builder_unittest.cc +++ b/chrome/browser/ui/app_list/apps_model_builder_unittest.cc @@ -43,10 +43,10 @@ class AppsModelBuilderTest : public ExtensionServiceTestBase { // Load "app_list" extensions test profile. // The test profile has 4 extensions: // 1 dummy extension, 2 packaged extension apps and 1 hosted extension app. - FilePath source_install_dir = data_dir_ + base::FilePath source_install_dir = data_dir_ .AppendASCII("app_list") .AppendASCII("Extensions"); - FilePath pref_path = source_install_dir + base::FilePath pref_path = source_install_dir .DirName() .AppendASCII("Preferences"); InitializeInstalledExtensionService(pref_path, source_install_dir); diff --git a/chrome/browser/ui/ash/app_list/app_list_controller_ash.cc b/chrome/browser/ui/ash/app_list/app_list_controller_ash.cc index 55fb595..aada315 100644 --- a/chrome/browser/ui/ash/app_list/app_list_controller_ash.cc +++ b/chrome/browser/ui/ash/app_list/app_list_controller_ash.cc @@ -81,7 +81,7 @@ void DismissAppList() { ash::Shell::GetInstance()->ToggleAppList(NULL); } -void SetAppListProfile(const FilePath& profile_file_path) { +void SetAppListProfile(const base::FilePath& profile_file_path) { } void NotifyAppListOfBeginExtensionInstall( diff --git a/chrome/browser/ui/ash/launcher/chrome_launcher_controller_per_app_unittest.cc b/chrome/browser/ui/ash/launcher/chrome_launcher_controller_per_app_unittest.cc index fbc1992..7153e9c 100644 --- a/chrome/browser/ui/ash/launcher/chrome_launcher_controller_per_app_unittest.cc +++ b/chrome/browser/ui/ash/launcher/chrome_launcher_controller_per_app_unittest.cc @@ -58,25 +58,25 @@ class ChromeLauncherControllerPerAppTest : public BrowserWithTestWindowTest { static_cast<extensions::TestExtensionSystem*>( extensions::ExtensionSystem::Get(profile()))); extension_service_ = extension_system->CreateExtensionService( - CommandLine::ForCurrentProcess(), FilePath(), false); + CommandLine::ForCurrentProcess(), base::FilePath(), false); std::string error; - extension1_ = Extension::Create(FilePath(), Manifest::LOAD, manifest, + extension1_ = Extension::Create(base::FilePath(), Manifest::LOAD, manifest, Extension::NO_FLAGS, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", &error); - extension2_ = Extension::Create(FilePath(), Manifest::LOAD, manifest, + extension2_ = Extension::Create(base::FilePath(), Manifest::LOAD, manifest, Extension::NO_FLAGS, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb", &error); // Fake gmail extension. - extension3_ = Extension::Create(FilePath(), Manifest::LOAD, manifest, + extension3_ = Extension::Create(base::FilePath(), Manifest::LOAD, manifest, Extension::NO_FLAGS, gmail_app_id, &error); // Fake search extension. - extension4_ = Extension::Create(FilePath(), Manifest::LOAD, manifest, + extension4_ = Extension::Create(base::FilePath(), Manifest::LOAD, manifest, Extension::NO_FLAGS, "coobgpohoikkiipiblmjeljniedjpjpf", &error); diff --git a/chrome/browser/ui/ash/launcher/chrome_launcher_controller_per_browser_unittest.cc b/chrome/browser/ui/ash/launcher/chrome_launcher_controller_per_browser_unittest.cc index 13aafbb..2710e27 100644 --- a/chrome/browser/ui/ash/launcher/chrome_launcher_controller_per_browser_unittest.cc +++ b/chrome/browser/ui/ash/launcher/chrome_launcher_controller_per_browser_unittest.cc @@ -49,24 +49,24 @@ class ChromeLauncherControllerPerBrowserTest : public testing::Test { static_cast<extensions::TestExtensionSystem*>( extensions::ExtensionSystem::Get(profile_.get()))); extension_service_ = extension_system->CreateExtensionService( - CommandLine::ForCurrentProcess(), FilePath(), false); + CommandLine::ForCurrentProcess(), base::FilePath(), false); std::string error; - extension1_ = Extension::Create(FilePath(), Manifest::LOAD, manifest, + extension1_ = Extension::Create(base::FilePath(), Manifest::LOAD, manifest, Extension::NO_FLAGS, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", &error); - extension2_ = Extension::Create(FilePath(), Manifest::LOAD, manifest, + extension2_ = Extension::Create(base::FilePath(), Manifest::LOAD, manifest, Extension::NO_FLAGS, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb", &error); // Fake gmail extension. - extension3_ = Extension::Create(FilePath(), Manifest::LOAD, manifest, + extension3_ = Extension::Create(base::FilePath(), Manifest::LOAD, manifest, Extension::NO_FLAGS, "pjkljhegncpnkpknbcohdijeoejaedia", &error); // Fake search extension. - extension4_ = Extension::Create(FilePath(), Manifest::LOAD, manifest, + extension4_ = Extension::Create(base::FilePath(), Manifest::LOAD, manifest, Extension::NO_FLAGS, "coobgpohoikkiipiblmjeljniedjpjpf", &error); diff --git a/chrome/browser/ui/ash/screenshot_taker.cc b/chrome/browser/ui/ash/screenshot_taker.cc index 0b6fe04..6dd76cf 100644 --- a/chrome/browser/ui/ash/screenshot_taker.cc +++ b/chrome/browser/ui/ash/screenshot_taker.cc @@ -45,7 +45,7 @@ const int64 kVisualFeedbackLayerDisplayTimeMs = 100; const int kScreenshotMinimumIntervalInMS = 1000; -void SaveScreenshotInternal(const FilePath& screenshot_path, +void SaveScreenshotInternal(const base::FilePath& screenshot_path, scoped_refptr<base::RefCountedBytes> png_data) { DCHECK(content::BrowserThread::GetBlockingPool()->RunsTasksOnCurrentThread()); DCHECK(!screenshot_path.empty()); @@ -57,7 +57,7 @@ void SaveScreenshotInternal(const FilePath& screenshot_path, } } -void SaveScreenshot(const FilePath& screenshot_path, +void SaveScreenshot(const base::FilePath& screenshot_path, scoped_refptr<base::RefCountedBytes> png_data) { DCHECK(content::BrowserThread::GetBlockingPool()->RunsTasksOnCurrentThread()); DCHECK(!screenshot_path.empty()); @@ -74,7 +74,7 @@ void SaveScreenshot(const FilePath& screenshot_path, #ifdef OS_CHROMEOS void SaveScreenshotToDrive(scoped_refptr<base::RefCountedBytes> png_data, drive::DriveFileError error, - const FilePath& local_path) { + const base::FilePath& local_path) { if (error != drive::DRIVE_FILE_OK) { LOG(ERROR) << "Failed to write screenshot image to Google Drive: " << error; return; @@ -84,7 +84,7 @@ void SaveScreenshotToDrive(scoped_refptr<base::RefCountedBytes> png_data, void EnsureDirectoryExistsCallback( Profile* profile, - const FilePath& screenshot_path, + const base::FilePath& screenshot_path, scoped_refptr<base::RefCountedBytes> png_data, drive::DriveFileError error) { // It is okay to fail with DRIVE_FILE_ERROR_EXISTS since anyway the directory @@ -101,7 +101,7 @@ void EnsureDirectoryExistsCallback( } } -void PostSaveScreenshotTask(const FilePath& screenshot_path, +void PostSaveScreenshotTask(const base::FilePath& screenshot_path, scoped_refptr<base::RefCountedBytes> png_data) { if (drive::util::IsUnderDriveMountPoint(screenshot_path)) { Profile* profile = ProfileManager::GetDefaultProfileOrOffTheRecord(); @@ -120,7 +120,7 @@ void PostSaveScreenshotTask(const FilePath& screenshot_path, } } #else -void PostSaveScreenshotTask(const FilePath& screenshot_path, +void PostSaveScreenshotTask(const base::FilePath& screenshot_path, scoped_refptr<base::RefCountedBytes> png_data) { content::BrowserThread::GetBlockingPool()->PostTask( FROM_HERE, base::Bind(&SaveScreenshot, screenshot_path, png_data)); @@ -155,7 +155,7 @@ ScreenshotTaker::~ScreenshotTaker() { } void ScreenshotTaker::HandleTakeScreenshotForAllRootWindows() { - FilePath screenshot_directory; + base::FilePath screenshot_directory; if (!ScreenshotSource::GetScreenshotDirectory(&screenshot_directory)) return; @@ -184,7 +184,7 @@ void ScreenshotTaker::HandleTakePartialScreenshot( aura::Window* window, const gfx::Rect& rect) { DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); - FilePath screenshot_directory; + base::FilePath screenshot_directory; if (!ScreenshotSource::GetScreenshotDirectory(&screenshot_directory)) return; diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc index 2e76430..a117a38 100644 --- a/chrome/browser/ui/browser.cc +++ b/chrome/browser/ui/browser.cc @@ -422,7 +422,7 @@ Browser::Browser(const CreateParams& params) UpdateBookmarkBarState(BOOKMARK_BAR_STATE_CHANGE_INIT); - FilePath profile_path = profile_->GetPath(); + base::FilePath profile_path = profile_->GetPath(); ProfileMetrics::LogProfileLaunch(profile_path); window_ = params.window ? params.window : CreateBrowserWindow(this); @@ -820,7 +820,7 @@ void Browser::OpenFile() { this, new ChromeSelectFilePolicy( tab_strip_model_->GetActiveWebContents())); - const FilePath directory = profile_->last_selected_directory(); + const base::FilePath directory = profile_->last_selected_directory(); // TODO(beng): figure out how to juggle this. gfx::NativeWindow parent_window = window_->GetNativeWindow(); @@ -1568,7 +1568,7 @@ void Browser::RunFileChooser(WebContents* web_contents, void Browser::EnumerateDirectory(WebContents* web_contents, int request_id, - const FilePath& path) { + const base::FilePath& path) { FileSelectHelper::EnumerateDirectory(web_contents, request_id, path); } @@ -1714,7 +1714,7 @@ void Browser::RequestMediaAccessPermission( bool Browser::RequestPpapiBrokerPermission( WebContents* web_contents, const GURL& url, - const FilePath& plugin_path, + const base::FilePath& plugin_path, const base::Callback<void(bool)>& callback) { PepperBrokerInfoBarDelegate::Create(web_contents, url, plugin_path, callback); return true; @@ -1802,7 +1802,8 @@ void Browser::OnZoomChanged(content::WebContents* source, /////////////////////////////////////////////////////////////////////////////// // Browser, ui::SelectFileDialog::Listener implementation: -void Browser::FileSelected(const FilePath& path, int index, void* params) { +void Browser::FileSelected(const base::FilePath& path, int index, + void* params) { FileSelectedWithExtraInfo(ui::SelectedFileInfo(path, path), index, params); } @@ -1812,7 +1813,7 @@ void Browser::FileSelectedWithExtraInfo( void* params) { profile_->set_last_selected_directory(file_info.file_path.DirName()); - const FilePath& path = file_info.local_path; + const base::FilePath& path = file_info.local_path; GURL file_url = net::FilePathToFileURL(path); #if defined(OS_CHROMEOS) diff --git a/chrome/browser/ui/browser.h b/chrome/browser/ui/browser.h index a382c43..69c602b 100644 --- a/chrome/browser/ui/browser.h +++ b/chrome/browser/ui/browser.h @@ -605,7 +605,7 @@ class Browser : public TabStripModelObserver, const content::FileChooserParams& params) OVERRIDE; virtual void EnumerateDirectory(content::WebContents* web_contents, int request_id, - const FilePath& path) OVERRIDE; + const base::FilePath& path) OVERRIDE; virtual void ToggleFullscreenModeForTab(content::WebContents* web_contents, bool enter_fullscreen) OVERRIDE; virtual bool IsFullscreenForTabOrPending( @@ -646,7 +646,7 @@ class Browser : public TabStripModelObserver, virtual bool RequestPpapiBrokerPermission( content::WebContents* web_contents, const GURL& url, - const FilePath& plugin_path, + const base::FilePath& plugin_path, const base::Callback<void(bool)>& callback) OVERRIDE; // Overridden from CoreTabHelperDelegate: @@ -680,7 +680,7 @@ class Browser : public TabStripModelObserver, bool can_show_bubble) OVERRIDE; // Overridden from SelectFileDialog::Listener: - virtual void FileSelected(const FilePath& path, + virtual void FileSelected(const base::FilePath& path, int index, void* params) OVERRIDE; virtual void FileSelectedWithExtraInfo( diff --git a/chrome/browser/ui/browser_browsertest.cc b/chrome/browser/ui/browser_browsertest.cc index 5ec5439..d75c2b2 100644 --- a/chrome/browser/ui/browser_browsertest.cc +++ b/chrome/browser/ui/browser_browsertest.cc @@ -99,13 +99,14 @@ const char* kBeforeUnloadHTML = const char* kOpenNewBeforeUnloadPage = "w=window.open(); w.onbeforeunload=function(e){return 'foo'};"; -const FilePath::CharType* kBeforeUnloadFile = +const base::FilePath::CharType* kBeforeUnloadFile = FILE_PATH_LITERAL("beforeunload.html"); -const FilePath::CharType* kTitle1File = FILE_PATH_LITERAL("title1.html"); -const FilePath::CharType* kTitle2File = FILE_PATH_LITERAL("title2.html"); +const base::FilePath::CharType* kTitle1File = FILE_PATH_LITERAL("title1.html"); +const base::FilePath::CharType* kTitle2File = FILE_PATH_LITERAL("title2.html"); -const FilePath::CharType kDocRoot[] = FILE_PATH_LITERAL("chrome/test/data"); +const base::FilePath::CharType kDocRoot[] = + FILE_PATH_LITERAL("chrome/test/data"); // Given a page title, returns the expected window caption string. string16 WindowCaptionFromPageTitle(const string16& page_title) { @@ -228,9 +229,10 @@ class BrowserTest : public ExtensionBrowserTest { // Launch the app on a page with no title, check that the app title was set // correctly. IN_PROC_BROWSER_TEST_F(BrowserTest, NoTitle) { - ui_test_utils::NavigateToURL(browser(), - ui_test_utils::GetTestUrl(FilePath(FilePath::kCurrentDirectory), - FilePath(kTitle1File))); + ui_test_utils::NavigateToURL( + browser(), ui_test_utils::GetTestUrl( + base::FilePath(base::FilePath::kCurrentDirectory), + base::FilePath(kTitle1File))); EXPECT_EQ(LocaleWindowCaptionFromPageTitle(ASCIIToUTF16("title1.html")), browser()->GetWindowTitleForCurrentTab()); string16 tab_title; @@ -241,9 +243,10 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, NoTitle) { // Launch the app, navigate to a page with a title, check that the app title // was set correctly. IN_PROC_BROWSER_TEST_F(BrowserTest, Title) { - ui_test_utils::NavigateToURL(browser(), - ui_test_utils::GetTestUrl(FilePath(FilePath::kCurrentDirectory), - FilePath(kTitle2File))); + ui_test_utils::NavigateToURL( + browser(), ui_test_utils::GetTestUrl( + base::FilePath(base::FilePath::kCurrentDirectory), + base::FilePath(kTitle2File))); const string16 test_title(ASCIIToUTF16("Title Of Awesomeness")); EXPECT_EQ(LocaleWindowCaptionFromPageTitle(test_title), browser()->GetWindowTitleForCurrentTab()); @@ -253,8 +256,8 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, Title) { } IN_PROC_BROWSER_TEST_F(BrowserTest, JavascriptAlertActivatesTab) { - GURL url(ui_test_utils::GetTestUrl(FilePath(FilePath::kCurrentDirectory), - FilePath(kTitle1File))); + GURL url(ui_test_utils::GetTestUrl(base::FilePath( + base::FilePath::kCurrentDirectory), base::FilePath(kTitle1File))); ui_test_utils::NavigateToURL(browser(), url); AddTabAtIndex(0, url, content::PAGE_TRANSITION_TYPED); EXPECT_EQ(2, browser()->tab_strip_model()->count()); @@ -285,8 +288,8 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, JavascriptAlertActivatesTab) { // Warning: this test can take >30 seconds when running on a slow (low // memory?) Mac builder. IN_PROC_BROWSER_TEST_F(BrowserTest, MAYBE_ThirtyFourTabs) { - GURL url(ui_test_utils::GetTestUrl(FilePath(FilePath::kCurrentDirectory), - FilePath(kTitle2File))); + GURL url(ui_test_utils::GetTestUrl(base::FilePath( + base::FilePath::kCurrentDirectory), base::FilePath(kTitle2File))); // There is one initial tab. const int kTabCount = 34; @@ -335,8 +338,8 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, ReloadThenCancelBeforeUnload) { // Test for crbug.com/80401. Canceling a before unload dialog should reset // the URL to the previous page's URL. IN_PROC_BROWSER_TEST_F(BrowserTest, CancelBeforeUnloadResetsURL) { - GURL url(ui_test_utils::GetTestUrl(FilePath(FilePath::kCurrentDirectory), - FilePath(kBeforeUnloadFile))); + GURL url(ui_test_utils::GetTestUrl(base::FilePath( + base::FilePath::kCurrentDirectory), base::FilePath(kBeforeUnloadFile))); ui_test_utils::NavigateToURL(browser(), url); // Navigate to a page that triggers a cross-site transition. @@ -524,7 +527,7 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, NullOpenerRedirectForksProcess) { ASSERT_TRUE(test_server()->Start()); net::TestServer https_test_server(net::TestServer::TYPE_HTTPS, net::TestServer::kLocalhost, - FilePath(kDocRoot)); + base::FilePath(kDocRoot)); ASSERT_TRUE(https_test_server.Start()); GURL http_url(test_server()->GetURL("files/title1.html")); GURL https_url(https_test_server.GetURL("")); @@ -613,7 +616,7 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, OtherRedirectsDontForkProcess) { ASSERT_TRUE(test_server()->Start()); net::TestServer https_test_server(net::TestServer::TYPE_HTTPS, net::TestServer::kLocalhost, - FilePath(kDocRoot)); + base::FilePath(kDocRoot)); ASSERT_TRUE(https_test_server.Start()); GURL http_url(test_server()->GetURL("files/title1.html")); GURL https_url(https_test_server.GetURL("")); @@ -679,9 +682,10 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, OtherRedirectsDontForkProcess) { // with time deltas measured locally. IN_PROC_BROWSER_TEST_F(BrowserTest, RenderIdleTime) { base::TimeTicks start = base::TimeTicks::Now(); - ui_test_utils::NavigateToURL(browser(), - ui_test_utils::GetTestUrl(FilePath(FilePath::kCurrentDirectory), - FilePath(kTitle1File))); + ui_test_utils::NavigateToURL( + browser(), ui_test_utils::GetTestUrl( + base::FilePath(base::FilePath::kCurrentDirectory), + base::FilePath(kTitle1File))); content::RenderProcessHost::iterator it( content::RenderProcessHost::AllHostsIterator()); for (; !it.IsAtEnd(); it.Advance()) { @@ -701,9 +705,10 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, CommandCreateAppShortcutFile) { CommandUpdater* command_updater = browser()->command_controller()->command_updater(); - static const FilePath::CharType* kEmptyFile = FILE_PATH_LITERAL("empty.html"); - GURL file_url(ui_test_utils::GetTestUrl(FilePath(FilePath::kCurrentDirectory), - FilePath(kEmptyFile))); + static const base::FilePath::CharType* kEmptyFile = + FILE_PATH_LITERAL("empty.html"); + GURL file_url(ui_test_utils::GetTestUrl(base::FilePath( + base::FilePath::kCurrentDirectory), base::FilePath(kEmptyFile))); ASSERT_TRUE(file_url.SchemeIs(chrome::kFileScheme)); ui_test_utils::NavigateToURL(browser(), file_url); EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_CREATE_SHORTCUTS)); @@ -726,7 +731,7 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, CommandCreateAppShortcutHttps) { net::TestServer test_server(net::TestServer::TYPE_HTTPS, net::TestServer::kLocalhost, - FilePath(kDocRoot)); + base::FilePath(kDocRoot)); ASSERT_TRUE(test_server.Start()); GURL https_url(test_server.GetURL("/")); ASSERT_TRUE(https_url.SchemeIs(chrome::kHttpsScheme)); @@ -740,7 +745,7 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, CommandCreateAppShortcutFtp) { net::TestServer test_server(net::TestServer::TYPE_FTP, net::TestServer::kLocalhost, - FilePath(kDocRoot)); + base::FilePath(kDocRoot)); ASSERT_TRUE(test_server.Start()); GURL ftp_url(test_server.GetURL("")); ASSERT_TRUE(ftp_url.SchemeIs(chrome::kFtpScheme)); @@ -844,20 +849,19 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, #endif // Test that an icon can be changed from JS. IN_PROC_BROWSER_TEST_F(BrowserTest, MAYBE_FaviconChange) { - static const FilePath::CharType* kFile = + static const base::FilePath::CharType* kFile = FILE_PATH_LITERAL("onload_change_favicon.html"); - GURL file_url(ui_test_utils::GetTestUrl(FilePath(FilePath::kCurrentDirectory), - FilePath(kFile))); + GURL file_url(ui_test_utils::GetTestUrl(base::FilePath( + base::FilePath::kCurrentDirectory), base::FilePath(kFile))); ASSERT_TRUE(file_url.SchemeIs(chrome::kFileScheme)); ui_test_utils::NavigateToURL(browser(), file_url); NavigationEntry* entry = browser()->tab_strip_model()-> GetActiveWebContents()->GetController().GetActiveEntry(); - static const FilePath::CharType* kIcon = + static const base::FilePath::CharType* kIcon = FILE_PATH_LITERAL("test1.png"); - GURL expected_favicon_url( - ui_test_utils::GetTestUrl(FilePath(FilePath::kCurrentDirectory), - FilePath(kIcon))); + GURL expected_favicon_url(ui_test_utils::GetTestUrl(base::FilePath( + base::FilePath::kCurrentDirectory), base::FilePath(kIcon))); EXPECT_EQ(expected_favicon_url.spec(), entry->GetFavicon().url.spec()); } @@ -924,7 +928,7 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, AppIdSwitch) { chrome::startup::IsFirstRun first_run = first_run::IsChromeFirstRun() ? chrome::startup::IS_FIRST_RUN : chrome::startup::IS_NOT_FIRST_RUN; - StartupBrowserCreatorImpl launch(FilePath(), command_line, first_run); + StartupBrowserCreatorImpl launch(base::FilePath(), command_line, first_run); ASSERT_TRUE(launch.OpenApplicationWindow(browser()->profile(), NULL)); // Check that the new browser has an app name. @@ -1032,7 +1036,7 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, RestorePinnedTabs) { CommandLine dummy(CommandLine::NO_PROGRAM); chrome::startup::IsFirstRun first_run = first_run::IsChromeFirstRun() ? chrome::startup::IS_FIRST_RUN : chrome::startup::IS_NOT_FIRST_RUN; - StartupBrowserCreatorImpl launch(FilePath(), dummy, first_run); + StartupBrowserCreatorImpl launch(base::FilePath(), dummy, first_run); launch.profile_ = browser()->profile(); launch.ProcessStartupURLs(std::vector<GURL>()); @@ -1165,9 +1169,10 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, ForwardDisabledOnForward) { GURL blank_url(chrome::kAboutBlankURL); ui_test_utils::NavigateToURL(browser(), blank_url); - ui_test_utils::NavigateToURL(browser(), - ui_test_utils::GetTestUrl(FilePath(FilePath::kCurrentDirectory), - FilePath(kTitle1File))); + ui_test_utils::NavigateToURL( + browser(), ui_test_utils::GetTestUrl( + base::FilePath(base::FilePath::kCurrentDirectory), + base::FilePath(kTitle1File))); content::WindowedNotificationObserver back_nav_load_observer( content::NOTIFICATION_LOAD_STOP, @@ -1585,7 +1590,7 @@ IN_PROC_BROWSER_TEST_F(BrowserTest2, NoTabsInPopups) { IN_PROC_BROWSER_TEST_F(BrowserTest, WindowOpenClose) { GURL url = ui_test_utils::GetTestUrl( - FilePath(), FilePath().AppendASCII("window.close.html")); + base::FilePath(), base::FilePath().AppendASCII("window.close.html")); string16 title = ASCIIToUTF16("Title Of Awesomeness"); content::TitleWatcher title_watcher( @@ -1625,7 +1630,7 @@ IN_PROC_BROWSER_TEST_F(ShowModalDialogTest, BasicTest) { // This navigation should show a modal dialog that will be immediately // closed, but the fact that it was shown should be recorded. GURL url = ui_test_utils::GetTestUrl( - FilePath(), FilePath().AppendASCII("showmodaldialog.html")); + base::FilePath(), base::FilePath().AppendASCII("showmodaldialog.html")); string16 expected_title(ASCIIToUTF16("SUCCESS")); content::TitleWatcher title_watcher( @@ -1638,7 +1643,8 @@ IN_PROC_BROWSER_TEST_F(ShowModalDialogTest, BasicTest) { IN_PROC_BROWSER_TEST_F(BrowserTest, DisallowFileUrlUniversalAccessTest) { GURL url = ui_test_utils::GetTestUrl( - FilePath(), FilePath().AppendASCII("fileurl_universalaccess.html")); + base::FilePath(), + base::FilePath().AppendASCII("fileurl_universalaccess.html")); string16 expected_title(ASCIIToUTF16("Disallowed")); content::TitleWatcher title_watcher( @@ -1679,7 +1685,7 @@ class LaunchBrowserWithNonAsciiUserDatadir : public BrowserTest { virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); - FilePath tmp_profile = temp_dir_.path().AppendASCII("tmp_profile"); + base::FilePath tmp_profile = temp_dir_.path().AppendASCII("tmp_profile"); tmp_profile = tmp_profile.Append(L"Test Chrome G\u00E9raldine"); ASSERT_TRUE(file_util::CreateDirectory(tmp_profile)); @@ -1776,7 +1782,7 @@ class AppModeTest : public BrowserTest { virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { GURL url = ui_test_utils::GetTestUrl( - FilePath(), FilePath().AppendASCII("title1.html")); + base::FilePath(), base::FilePath().AppendASCII("title1.html")); command_line->AppendSwitchASCII(switches::kApp, url.spec()); } }; @@ -1803,7 +1809,8 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, AboutVersion) { 0); } -static const FilePath::CharType* kTestDir = FILE_PATH_LITERAL("click_modifier"); +static const base::FilePath::CharType* kTestDir = + FILE_PATH_LITERAL("click_modifier"); static const char kFirstPageTitle[] = "First window"; static const char kSecondPageTitle[] = "New window!"; @@ -1815,16 +1822,16 @@ class ClickModifierTest : public InProcessBrowserTest { // Returns a url that opens a new window or tab when clicked, via javascript. GURL GetWindowOpenURL() { return ui_test_utils::GetTestUrl( - FilePath(kTestDir), - FilePath(FILE_PATH_LITERAL("window_open.html"))); + base::FilePath(kTestDir), + base::FilePath(FILE_PATH_LITERAL("window_open.html"))); } // Returns a url that follows a simple link when clicked, unless affected by // modifiers. GURL GetHrefURL() { return ui_test_utils::GetTestUrl( - FilePath(kTestDir), - FilePath(FILE_PATH_LITERAL("href.html"))); + base::FilePath(kTestDir), + base::FilePath(FILE_PATH_LITERAL("href.html"))); } string16 getFirstPageTitle() { diff --git a/chrome/browser/ui/browser_close_browsertest.cc b/chrome/browser/ui/browser_close_browsertest.cc index 922b730..5d5af9b 100644 --- a/chrome/browser/ui/browser_close_browsertest.cc +++ b/chrome/browser/ui/browser_close_browsertest.cc @@ -84,7 +84,7 @@ class BrowserCloseTest : public InProcessBrowserTest { // Create a second profile to work within multi-profile. Profile* CreateSecondProfile() { - FilePath user_data_dir; + base::FilePath user_data_dir; PathService::Get(chrome::DIR_USER_DATA, &user_data_dir); if (!second_profile_data_dir_.CreateUniqueTempDirUnderPath(user_data_dir)) diff --git a/chrome/browser/ui/browser_command_controller.cc b/chrome/browser/ui/browser_command_controller.cc index f4cd3bb..07a2b65 100644 --- a/chrome/browser/ui/browser_command_controller.cc +++ b/chrome/browser/ui/browser_command_controller.cc @@ -719,27 +719,28 @@ void BrowserCommandController::Observe( //////////////////////////////////////////////////////////////////////////////// // BrowserCommandController, ProfileInfoCacheObserver implementation: -void BrowserCommandController::OnProfileAdded(const FilePath& profile_path) { +void BrowserCommandController::OnProfileAdded( + const base::FilePath& profile_path) { UpdateCommandsForMultipleProfiles(); } void BrowserCommandController::OnProfileWasRemoved( - const FilePath& profile_path, + const base::FilePath& profile_path, const string16& profile_name) { UpdateCommandsForMultipleProfiles(); } void BrowserCommandController::OnProfileWillBeRemoved( - const FilePath& profile_path) { + const base::FilePath& profile_path) { } void BrowserCommandController::OnProfileNameChanged( - const FilePath& profile_path, + const base::FilePath& profile_path, const string16& old_profile_name) { } void BrowserCommandController::OnProfileAvatarChanged( - const FilePath& profile_path) { + const base::FilePath& profile_path) { } //////////////////////////////////////////////////////////////////////////////// diff --git a/chrome/browser/ui/browser_focus_uitest.cc b/chrome/browser/ui/browser_focus_uitest.cc index e75a930..6bf3affd 100644 --- a/chrome/browser/ui/browser_focus_uitest.cc +++ b/chrome/browser/ui/browser_focus_uitest.cc @@ -187,7 +187,7 @@ class BrowserFocusTest : public InProcessBrowserTest { class TestInterstitialPage : public content::InterstitialPageDelegate { public: TestInterstitialPage(WebContents* tab, bool new_navigation, const GURL& url) { - FilePath file_path; + base::FilePath file_path; bool r = PathService::Get(chrome::DIR_TEST_DATA, &file_path); EXPECT_TRUE(r); file_path = file_path.AppendASCII("focus"); diff --git a/chrome/browser/ui/certificate_dialogs.cc b/chrome/browser/ui/certificate_dialogs.cc index 4a9b310..afa0291 100644 --- a/chrome/browser/ui/certificate_dialogs.cc +++ b/chrome/browser/ui/certificate_dialogs.cc @@ -24,7 +24,7 @@ using content::WebContents; namespace { -void WriterCallback(const FilePath& path, const std::string& data) { +void WriterCallback(const base::FilePath& path, const std::string& data) { int bytes_written = file_util::WriteFile(path, data.data(), data.size()); if (bytes_written != static_cast<ssize_t>(data.size())) { LOG(ERROR) << "Writing " << path.value() << " (" @@ -32,7 +32,8 @@ void WriterCallback(const FilePath& path, const std::string& data) { } } -void WriteFileOnFileThread(const FilePath& path, const std::string& data) { +void WriteFileOnFileThread(const base::FilePath& path, + const std::string& data) { BrowserThread::PostTask( BrowserThread::FILE, FROM_HERE, base::Bind(&WriterCallback, path, data)); } @@ -68,7 +69,7 @@ class Exporter : public ui::SelectFileDialog::Listener { virtual ~Exporter(); // SelectFileDialog::Listener implemenation. - virtual void FileSelected(const FilePath& path, + virtual void FileSelected(const base::FilePath& path, int index, void* params) OVERRIDE; virtual void FileSelectionCanceled(void* params) OVERRIDE; private: @@ -87,10 +88,10 @@ Exporter::Exporter(WebContents* web_contents, // TODO(mattm): should this default to some directory? // Maybe SavePackage::GetSaveDirPreference? (Except that it's private.) - FilePath suggested_path("certificate"); + base::FilePath suggested_path("certificate"); std::string cert_title = x509_certificate_model::GetTitle(cert); if (!cert_title.empty()) - suggested_path = FilePath(cert_title); + suggested_path = base::FilePath(cert_title); ShowCertSelectFileDialog(select_file_dialog_.get(), ui::SelectFileDialog::SELECT_SAVEAS_FILE, @@ -108,7 +109,8 @@ Exporter::~Exporter() { x509_certificate_model::DestroyCertChain(&cert_chain_list_); } -void Exporter::FileSelected(const FilePath& path, int index, void* params) { +void Exporter::FileSelected(const base::FilePath& path, int index, + void* params) { std::string data; switch (index) { case 2: @@ -145,7 +147,7 @@ void Exporter::FileSelectionCanceled(void* params) { void ShowCertSelectFileDialog(ui::SelectFileDialog* select_file_dialog, ui::SelectFileDialog::Type type, - const FilePath& suggested_path, + const base::FilePath& suggested_path, gfx::NativeWindow parent, void* params) { ui::SelectFileDialog::FileTypeInfo file_type_info; diff --git a/chrome/browser/ui/certificate_dialogs.h b/chrome/browser/ui/certificate_dialogs.h index ee9f1a9..9726621 100644 --- a/chrome/browser/ui/certificate_dialogs.h +++ b/chrome/browser/ui/certificate_dialogs.h @@ -14,7 +14,7 @@ class WebContents; void ShowCertSelectFileDialog(ui::SelectFileDialog* select_file_dialog, ui::SelectFileDialog::Type type, - const FilePath& suggested_path, + const base::FilePath& suggested_path, gfx::NativeWindow parent, void* params); diff --git a/chrome/browser/ui/chrome_select_file_policy_unittest.cc b/chrome/browser/ui/chrome_select_file_policy_unittest.cc index e6e54a0..49a3ddf 100644 --- a/chrome/browser/ui/chrome_select_file_policy_unittest.cc +++ b/chrome/browser/ui/chrome_select_file_policy_unittest.cc @@ -47,7 +47,7 @@ class FileSelectionUser : public ui::SelectFileDialog::Listener { select_file_dialog_ = ui::SelectFileDialog::Create( this, new ChromeSelectFilePolicy(NULL)); - const FilePath file_path; + const base::FilePath file_path; const string16 title=string16(); file_selection_initialisation_in_progress = true; @@ -63,12 +63,12 @@ class FileSelectionUser : public ui::SelectFileDialog::Listener { } // ui::SelectFileDialog::Listener implementation. - virtual void FileSelected(const FilePath& path, + virtual void FileSelected(const base::FilePath& path, int index, void* params) OVERRIDE{ ASSERT_FALSE(file_selection_initialisation_in_progress); } virtual void MultiFilesSelected( - const std::vector<FilePath>& files, + const std::vector<base::FilePath>& files, void* params) OVERRIDE { ASSERT_FALSE(file_selection_initialisation_in_progress); } diff --git a/chrome/browser/ui/cocoa/applescript/tab_applescript.mm b/chrome/browser/ui/cocoa/applescript/tab_applescript.mm index b128a57..9e16e05 100644 --- a/chrome/browser/ui/cocoa/applescript/tab_applescript.mm +++ b/chrome/browser/ui/cocoa/applescript/tab_applescript.mm @@ -272,11 +272,11 @@ void ResumeAppleEventAndSendReply(NSAppleEventManagerSuspensionID suspension_id, return; } - FilePath mainFile(base::SysNSStringToUTF8([fileURL path])); + base::FilePath mainFile(base::SysNSStringToUTF8([fileURL path])); // We create a directory path at the folder within which the file exists. // Eg. if main_file = '/Users/Foo/Documents/Google.html' // then directory_path = '/Users/Foo/Documents/Google_files/'. - FilePath directoryPath = mainFile.RemoveExtension(); + base::FilePath directoryPath = mainFile.RemoveExtension(); directoryPath = directoryPath.InsertBeforeExtension(std::string("_files/")); NSString* saveType = [dictionary objectForKey:@"FileType"]; diff --git a/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller_unittest.mm b/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller_unittest.mm index baf1705..7ae3661 100644 --- a/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller_unittest.mm +++ b/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller_unittest.mm @@ -292,7 +292,7 @@ class BookmarkBarControllerTestBase : public CocoaProfileTest { CocoaProfileTest::SetUp(); ASSERT_TRUE(profile()); - FilePath extension_dir; + base::FilePath extension_dir; static_cast<extensions::TestExtensionSystem*>( extensions::ExtensionSystem::Get(profile()))-> CreateExtensionService( diff --git a/chrome/browser/ui/cocoa/chrome_to_mobile_bubble_controller.h b/chrome/browser/ui/cocoa/chrome_to_mobile_bubble_controller.h index 61f94530..e8c61ea 100644 --- a/chrome/browser/ui/cocoa/chrome_to_mobile_bubble_controller.h +++ b/chrome/browser/ui/cocoa/chrome_to_mobile_bubble_controller.h @@ -49,7 +49,8 @@ class ChromeToMobileBubbleNotificationBridge const content::NotificationDetails& details) OVERRIDE; // ChromeToMobileService::Observer overrides: - virtual void SnapshotGenerated(const FilePath& path, int64 bytes) OVERRIDE; + virtual void SnapshotGenerated(const base::FilePath& path, + int64 bytes) OVERRIDE; virtual void OnSendComplete(bool success) OVERRIDE; private: @@ -93,7 +94,7 @@ class ChromeToMobileBubbleNotificationBridge ChromeToMobileService* service_; // The file path for the MHTML page snapshot. - FilePath snapshotPath_; + base::FilePath snapshotPath_; // An animation used to cycle through the "Sending..." status messages. scoped_nsobject<NSAnimation> progressAnimation_; @@ -110,7 +111,7 @@ class ChromeToMobileBubbleNotificationBridge - (IBAction)cancel:(id)sender; // Update the bubble to reflect the generated snapshot. -- (void)snapshotGenerated:(const FilePath&)path +- (void)snapshotGenerated:(const base::FilePath&)path bytes:(int64)bytes; // Update the bubble to reflect the completed send. diff --git a/chrome/browser/ui/cocoa/chrome_to_mobile_bubble_controller.mm b/chrome/browser/ui/cocoa/chrome_to_mobile_bubble_controller.mm index 7e7c850..b221e77 100644 --- a/chrome/browser/ui/cocoa/chrome_to_mobile_bubble_controller.mm +++ b/chrome/browser/ui/cocoa/chrome_to_mobile_bubble_controller.mm @@ -52,7 +52,7 @@ void ChromeToMobileBubbleNotificationBridge::Observe( } void ChromeToMobileBubbleNotificationBridge::SnapshotGenerated( - const FilePath& path, + const base::FilePath& path, int64 bytes) { [controller_ snapshotGenerated:path bytes:bytes]; } @@ -201,7 +201,7 @@ void ChromeToMobileBubbleNotificationBridge::OnSendComplete(bool success) { const DictionaryValue* mobile = NULL; if (mobiles->GetDictionary(selected_index, &mobile)) { service_->SendToMobile(mobile, - ([sendCopy_ state] == NSOnState) ? snapshotPath_ : FilePath(), + ([sendCopy_ state] == NSOnState) ? snapshotPath_ : base::FilePath(), browser_, bridge_->AsWeakPtr()); } else { NOTREACHED(); @@ -219,7 +219,7 @@ void ChromeToMobileBubbleNotificationBridge::OnSendComplete(bool success) { [self close]; } -- (void)snapshotGenerated:(const FilePath&)path +- (void)snapshotGenerated:(const base::FilePath&)path bytes:(int64)bytes { snapshotPath_ = path; NSString* text = nil; diff --git a/chrome/browser/ui/cocoa/chrome_to_mobile_bubble_controller_unittest.mm b/chrome/browser/ui/cocoa/chrome_to_mobile_bubble_controller_unittest.mm index 1ed30fb..6a8cb43 100644 --- a/chrome/browser/ui/cocoa/chrome_to_mobile_bubble_controller_unittest.mm +++ b/chrome/browser/ui/cocoa/chrome_to_mobile_bubble_controller_unittest.mm @@ -22,10 +22,10 @@ class MockChromeToMobileService : public ChromeToMobileService { MOCK_METHOD2(GenerateSnapshot, void(Browser* browser, base::WeakPtr<Observer> observer)); MOCK_METHOD4(SendToMobile, void(const base::DictionaryValue* mobile, - const FilePath& snapshot, + const base::FilePath& snapshot, Browser* browser, base::WeakPtr<Observer> observer)); - MOCK_METHOD1(DeleteSnapshot, void(const FilePath& snapshot)); + MOCK_METHOD1(DeleteSnapshot, void(const base::FilePath& snapshot)); // A set of mock mobile devices, kept in lieu of the list in profile prefs. base::ListValue mobiles_; @@ -148,7 +148,7 @@ TEST_F(ChromeToMobileBubbleControllerTest, ThreeDevices) { } TEST_F(ChromeToMobileBubbleControllerTest, SendWithoutSnapshot) { - FilePath path; + base::FilePath path; EXPECT_CALL(service_, GenerateSnapshot(NULL, testing::_)); EXPECT_CALL(service_, SendToMobile(testing::_, path, NULL, testing::_)); EXPECT_CALL(service_, DeleteSnapshot(testing::_)); @@ -159,7 +159,7 @@ TEST_F(ChromeToMobileBubbleControllerTest, SendWithoutSnapshot) { } TEST_F(ChromeToMobileBubbleControllerTest, SendWithSnapshot) { - FilePath path("path.mht"); + base::FilePath path("path.mht"); EXPECT_CALL(service_, GenerateSnapshot(NULL, testing::_)); EXPECT_CALL(service_, SendToMobile(testing::_, path, NULL, testing::_)); EXPECT_CALL(service_, DeleteSnapshot(testing::_)); diff --git a/chrome/browser/ui/cocoa/cocoa_test_helper.mm b/chrome/browser/ui/cocoa/cocoa_test_helper.mm index aeaf1ee..0d6e5ed 100644 --- a/chrome/browser/ui/cocoa/cocoa_test_helper.mm +++ b/chrome/browser/ui/cocoa/cocoa_test_helper.mm @@ -16,7 +16,7 @@ CocoaTest::CocoaTest() { void CocoaTest::BootstrapCocoa() { // Look in the framework bundle for resources. - FilePath path; + base::FilePath path; PathService::Get(base::DIR_EXE, &path); path = path.Append(chrome::kFrameworkName); base::mac::SetOverrideFrameworkBundlePath(path); diff --git a/chrome/browser/ui/cocoa/download/download_item_button.h b/chrome/browser/ui/cocoa/download/download_item_button.h index d9eea3b..a4af812 100644 --- a/chrome/browser/ui/cocoa/download/download_item_button.h +++ b/chrome/browser/ui/cocoa/download/download_item_button.h @@ -13,11 +13,11 @@ // instead of firing an action when clicked in a certain area. @interface DownloadItemButton : DraggableButton<NSMenuDelegate> { @private - FilePath downloadPath_; + base::FilePath downloadPath_; DownloadItemController* controller_; // weak } -@property(assign, nonatomic) FilePath download; +@property(assign, nonatomic) base::FilePath download; @property(assign, nonatomic) DownloadItemController* controller; // Overridden from DraggableButton. diff --git a/chrome/browser/ui/cocoa/download/download_item_button_unittest.mm b/chrome/browser/ui/cocoa/download/download_item_button_unittest.mm index acf0242..6fc6b43 100644 --- a/chrome/browser/ui/cocoa/download/download_item_button_unittest.mm +++ b/chrome/browser/ui/cocoa/download/download_item_button_unittest.mm @@ -15,7 +15,7 @@ TEST(DownloadItemButtonTest, Create) { initWithFrame:NSMakeRect(0,0,500,500)]); // Test setter - FilePath path("foo"); + base::FilePath path("foo"); [button.get() setDownload:path]; EXPECT_EQ(path.value(), [button.get() download].value()); } diff --git a/chrome/browser/ui/cocoa/download/download_item_cell.h b/chrome/browser/ui/cocoa/download/download_item_cell.h index 5f0921a..0284012 100644 --- a/chrome/browser/ui/cocoa/download/download_item_cell.h +++ b/chrome/browser/ui/cocoa/download/download_item_cell.h @@ -33,7 +33,7 @@ enum DownloadItemMousePosition { scoped_nsobject<NSTrackingArea> trackingAreaButton_; scoped_nsobject<NSTrackingArea> trackingAreaDropdown_; - FilePath downloadPath_; // stored unelided + base::FilePath downloadPath_; // stored unelided NSString* secondaryTitle_; NSFont* secondaryFont_; int percentDone_; diff --git a/chrome/browser/ui/cocoa/download/download_item_cell_unittest.mm b/chrome/browser/ui/cocoa/download/download_item_cell_unittest.mm index a9c49b1..7ebf129 100644 --- a/chrome/browser/ui/cocoa/download/download_item_cell_unittest.mm +++ b/chrome/browser/ui/cocoa/download/download_item_cell_unittest.mm @@ -62,7 +62,7 @@ TEST_F(DownloadItemCellTest, IndeterminateProgress) { ON_CALL(item, GetState()) .WillByDefault(Return(content::DownloadItem::IN_PROGRESS)); ON_CALL(item, GetFileNameToReportUser()) - .WillByDefault(Return(FilePath("foo.bar"))); + .WillByDefault(Return(base::FilePath("foo.bar"))); DownloadItemModel model(&item); // Set indeterminate state. diff --git a/chrome/browser/ui/cocoa/download/download_item_mac.h b/chrome/browser/ui/cocoa/download/download_item_mac.h index dbbf90e..363dd33 100644 --- a/chrome/browser/ui/cocoa/download/download_item_mac.h +++ b/chrome/browser/ui/cocoa/download/download_item_mac.h @@ -57,7 +57,7 @@ class DownloadItemMac : content::DownloadItem::Observer { CancelableTaskTracker cancelable_task_tracker_; // Stores the last known path where the file will be saved. - FilePath lastFilePath_; + base::FilePath lastFilePath_; DISALLOW_COPY_AND_ASSIGN(DownloadItemMac); }; diff --git a/chrome/browser/ui/cocoa/download/download_item_mac.mm b/chrome/browser/ui/cocoa/download/download_item_mac.mm index c9f278a..5b39600 100644 --- a/chrome/browser/ui/cocoa/download/download_item_mac.mm +++ b/chrome/browser/ui/cocoa/download/download_item_mac.mm @@ -82,7 +82,7 @@ void DownloadItemMac::LoadIcon() { } // We may already have this particular image cached. - FilePath file = download_model_.download()->GetUserVerifiedFilePath(); + base::FilePath file = download_model_.download()->GetUserVerifiedFilePath(); gfx::Image* icon = icon_manager->LookupIcon(file, IconLoader::ALL); if (icon) { [item_controller_ setIcon:icon->ToNSImage()]; diff --git a/chrome/browser/ui/cocoa/download/download_util_mac.mm b/chrome/browser/ui/cocoa/download/download_util_mac.mm index 1676f26..585e624 100644 --- a/chrome/browser/ui/cocoa/download/download_util_mac.mm +++ b/chrome/browser/ui/cocoa/download/download_util_mac.mm @@ -17,7 +17,7 @@ using content::DownloadItem; namespace download_util { -void AddFileToPasteboard(NSPasteboard* pasteboard, const FilePath& path) { +void AddFileToPasteboard(NSPasteboard* pasteboard, const base::FilePath& path) { // Write information about the file being dragged to the pasteboard. NSString* file = base::SysUTF8ToNSString(path.value()); NSArray* fileList = [NSArray arrayWithObject:file]; diff --git a/chrome/browser/ui/cocoa/download/download_util_mac_unittest.mm b/chrome/browser/ui/cocoa/download/download_util_mac_unittest.mm index e3ca740..f97cddf 100644 --- a/chrome/browser/ui/cocoa/download/download_util_mac_unittest.mm +++ b/chrome/browser/ui/cocoa/download/download_util_mac_unittest.mm @@ -35,9 +35,9 @@ class DownloadUtilMacTest : public CocoaTest { // Ensure adding files to the pasteboard methods works as expected. TEST_F(DownloadUtilMacTest, AddFileToPasteboardTest) { // Get a download test file for addition to the pasteboard. - FilePath testPath; + base::FilePath testPath; ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &testPath)); - FilePath testFile(FILE_PATH_LITERAL("download-test1.lib")); + base::FilePath testFile(FILE_PATH_LITERAL("download-test1.lib")); testPath = testPath.Append(testFile); // Add a test file to the pasteboard via the download_util method. diff --git a/chrome/browser/ui/cocoa/drag_util.mm b/chrome/browser/ui/cocoa/drag_util.mm index a781285..b79db4d 100644 --- a/chrome/browser/ui/cocoa/drag_util.mm +++ b/chrome/browser/ui/cocoa/drag_util.mm @@ -23,7 +23,7 @@ namespace drag_util { namespace { BOOL IsSupportedFileURL(Profile* profile, const GURL& url) { - FilePath full_path; + base::FilePath full_path; net::FileURLToFilePath(url, &full_path); std::string mime_type; diff --git a/chrome/browser/ui/cocoa/extensions/extension_install_prompt_test_utils.mm b/chrome/browser/ui/cocoa/extensions/extension_install_prompt_test_utils.mm index 88be605..71e8e68 100644 --- a/chrome/browser/ui/cocoa/extensions/extension_install_prompt_test_utils.mm +++ b/chrome/browser/ui/cocoa/extensions/extension_install_prompt_test_utils.mm @@ -26,7 +26,7 @@ void MockExtensionInstallPromptDelegate::InstallUIAbort(bool user_initiated) { scoped_refptr<Extension> LoadInstallPromptExtension() { scoped_refptr<Extension> extension; - FilePath path; + base::FilePath path; PathService::Get(chrome::DIR_TEST_DATA, &path); path = path.AppendASCII("extensions") .AppendASCII("install_prompt") @@ -51,7 +51,7 @@ scoped_refptr<Extension> LoadInstallPromptExtension() { } gfx::Image LoadInstallPromptIcon() { - FilePath path; + base::FilePath path; PathService::Get(chrome::DIR_TEST_DATA, &path); path = path.AppendASCII("extensions") .AppendASCII("install_prompt") diff --git a/chrome/browser/ui/cocoa/extensions/extension_installed_bubble_controller_unittest.mm b/chrome/browser/ui/cocoa/extensions/extension_installed_bubble_controller_unittest.mm index dd171ec..14c81fe 100644 --- a/chrome/browser/ui/cocoa/extensions/extension_installed_bubble_controller_unittest.mm +++ b/chrome/browser/ui/cocoa/extensions/extension_installed_bubble_controller_unittest.mm @@ -57,12 +57,12 @@ class ExtensionInstalledBubbleControllerTest : public CocoaProfileTest { CommandLine command_line(CommandLine::NO_PROGRAM); extension_service_ = static_cast<extensions::TestExtensionSystem*>( extensions::ExtensionSystem::Get(profile()))->CreateExtensionService( - &command_line, FilePath(), false); + &command_line, base::FilePath(), false); } // Load test icon from extension test directory. SkBitmap LoadTestIcon() { - FilePath path; + base::FilePath path; PathService::Get(chrome::DIR_TEST_DATA, &path); path = path.AppendASCII("extensions").AppendASCII("icon1.png"); @@ -83,7 +83,7 @@ class ExtensionInstalledBubbleControllerTest : public CocoaProfileTest { // the ExtensionInstalledBubble for unit testing. scoped_refptr<Extension> CreateExtension( extension_installed_bubble::ExtensionType type) { - FilePath path; + base::FilePath path; PathService::Get(chrome::DIR_TEST_DATA, &path); path = path.AppendASCII("extensions").AppendASCII("dummy"); diff --git a/chrome/browser/ui/cocoa/profile_menu_controller_unittest.mm b/chrome/browser/ui/cocoa/profile_menu_controller_unittest.mm index 2f51e96..07f48f7 100644 --- a/chrome/browser/ui/cocoa/profile_menu_controller_unittest.mm +++ b/chrome/browser/ui/cocoa/profile_menu_controller_unittest.mm @@ -223,7 +223,7 @@ TEST_F(ProfileMenuControllerTest, DeleteActiveProfile) { TestingProfile* profile3 = manager->CreateTestingProfile("Profile 3"); ASSERT_EQ(3U, manager->profile_manager()->GetNumberOfProfiles()); - const FilePath profile3_path = profile3->GetPath(); + const base::FilePath profile3_path = profile3->GetPath(); manager->DeleteTestingProfile("Profile 3"); // Simulate an unloaded profile by setting the "last used" local state pref diff --git a/chrome/browser/ui/extensions/application_launch.h b/chrome/browser/ui/extensions/application_launch.h index 93c741b..75ca97d 100644 --- a/chrome/browser/ui/extensions/application_launch.h +++ b/chrome/browser/ui/extensions/application_launch.h @@ -68,7 +68,7 @@ struct AppLaunchParams { // If non-empty, the current directory from which any relative paths on the // command line should be expanded from. - FilePath current_directory; + base::FilePath current_directory; }; // Open the application in a way specified by |params|. diff --git a/chrome/browser/ui/find_bar/find_bar_host_browsertest.cc b/chrome/browser/ui/find_bar/find_bar_host_browsertest.cc index 1724a6e..d45d7d2 100644 --- a/chrome/browser/ui/find_bar/find_bar_host_browsertest.cc +++ b/chrome/browser/ui/find_bar/find_bar_host_browsertest.cc @@ -170,8 +170,8 @@ class FindInPageControllerTest : public InProcessBrowserTest { GURL GetURL(const std::string filename) { return ui_test_utils::GetTestUrl( - FilePath().AppendASCII("find_in_page"), - FilePath().AppendASCII(filename)); + base::FilePath().AppendASCII("find_in_page"), + base::FilePath().AppendASCII(filename)); } void FlushHistoryService() { @@ -285,7 +285,8 @@ IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, SearchWithinSpecialURL) { WebContents* web_contents = browser()->tab_strip_model()->GetActiveWebContents(); - FilePath data_dir = ui_test_utils::GetTestFilePath(FilePath(), FilePath()); + base::FilePath data_dir = + ui_test_utils::GetTestFilePath(base::FilePath(), base::FilePath()); ui_test_utils::NavigateToURL(browser(), net::FilePathToFileURL(data_dir)); EXPECT_EQ(1, FindInPageWchar(web_contents, L"downloads", kFwd, kIgnoreCase, NULL)); @@ -303,8 +304,8 @@ IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, SearchWithinSpecialURL) { kFwd, kIgnoreCase, NULL, NULL)); GURL download_url = ui_test_utils::GetTestUrl( - FilePath().AppendASCII("downloads"), - FilePath().AppendASCII("a_zip_file.zip")); + base::FilePath().AppendASCII("downloads"), + base::FilePath().AppendASCII("a_zip_file.zip")); ui_test_utils::DownloadURL(browser(), download_url); ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUIDownloadsURL)); @@ -390,9 +391,9 @@ IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, FindLongString) { browser()->tab_strip_model()->GetActiveWebContents(); ui_test_utils::NavigateToURL(browser(), GetURL("largepage.html")); - FilePath path = ui_test_utils::GetTestFilePath( - FilePath().AppendASCII("find_in_page"), - FilePath().AppendASCII("LongFind.txt")); + base::FilePath path = ui_test_utils::GetTestFilePath( + base::FilePath().AppendASCII("find_in_page"), + base::FilePath().AppendASCII("LongFind.txt")); std::string query; file_util::ReadFileToString(path, &query); std::wstring search_string = UTF8ToWide(query); @@ -451,9 +452,9 @@ IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, FindWholeFileContent) { WebContents* web_contents = browser()->tab_strip_model()->GetActiveWebContents(); - FilePath path = ui_test_utils::GetTestFilePath( - FilePath().AppendASCII("find_in_page"), - FilePath().AppendASCII("find_test.txt")); + base::FilePath path = ui_test_utils::GetTestFilePath( + base::FilePath().AppendASCII("find_in_page"), + base::FilePath().AppendASCII("find_test.txt")); ui_test_utils::NavigateToURL(browser(), net::FilePathToFileURL(path)); std::string query; diff --git a/chrome/browser/ui/fullscreen/fullscreen_controller_interactive_browsertest.cc b/chrome/browser/ui/fullscreen/fullscreen_controller_interactive_browsertest.cc index d312f82..553e2c2 100644 --- a/chrome/browser/ui/fullscreen/fullscreen_controller_interactive_browsertest.cc +++ b/chrome/browser/ui/fullscreen/fullscreen_controller_interactive_browsertest.cc @@ -27,7 +27,7 @@ using content::PAGE_TRANSITION_TYPED; namespace { -const FilePath::CharType* kSimpleFile = FILE_PATH_LITERAL("simple.html"); +const base::FilePath::CharType* kSimpleFile = FILE_PATH_LITERAL("simple.html"); } // namespace @@ -279,9 +279,10 @@ IN_PROC_BROWSER_TEST_F(FullscreenControllerInteractiveTest, // Test is flaky: http://crbug.com/146006 IN_PROC_BROWSER_TEST_F(FullscreenControllerInteractiveTest, DISABLED_FullscreenFileURL) { - ui_test_utils::NavigateToURL(browser(), - ui_test_utils::GetTestUrl(FilePath(FilePath::kCurrentDirectory), - FilePath(kSimpleFile))); + ui_test_utils::NavigateToURL( + browser(), ui_test_utils::GetTestUrl( + base::FilePath(base::FilePath::kCurrentDirectory), + base::FilePath(kSimpleFile))); // Validate that going fullscreen for a file does not ask permision. ASSERT_FALSE(IsFullscreenPermissionRequested()); @@ -326,8 +327,8 @@ IN_PROC_BROWSER_TEST_F( DISABLED_TestTabDoesntExitFullscreenOnSubFrameNavigation) { ASSERT_TRUE(test_server()->Start()); - GURL url(ui_test_utils::GetTestUrl(FilePath(FilePath::kCurrentDirectory), - FilePath(kSimpleFile))); + GURL url(ui_test_utils::GetTestUrl(base::FilePath( + base::FilePath::kCurrentDirectory), base::FilePath(kSimpleFile))); GURL url_with_fragment(url.spec() + "#fragment"); ui_test_utils::NavigateToURL(browser(), url); diff --git a/chrome/browser/ui/gtk/chrome_to_mobile_bubble_gtk.cc b/chrome/browser/ui/gtk/chrome_to_mobile_bubble_gtk.cc index 6e7b5e4..69e7afc 100644 --- a/chrome/browser/ui/gtk/chrome_to_mobile_bubble_gtk.cc +++ b/chrome/browser/ui/gtk/chrome_to_mobile_bubble_gtk.cc @@ -105,7 +105,7 @@ void ChromeToMobileBubbleGtk::Observe( gtk_widget_modify_fg(*it, GTK_STATE_NORMAL, color); } -void ChromeToMobileBubbleGtk::SnapshotGenerated(const FilePath& path, +void ChromeToMobileBubbleGtk::SnapshotGenerated(const base::FilePath& path, int64 bytes) { snapshot_path_ = path; if (bytes > 0) { @@ -304,7 +304,7 @@ void ChromeToMobileBubbleGtk::OnSendClicked(GtkWidget* widget) { const DictionaryValue* mobile = NULL; if (mobiles->GetDictionary(selected_index, &mobile)) { bool snapshot = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(send_copy_)); - service_->SendToMobile(mobile, snapshot ? snapshot_path_ : FilePath(), + service_->SendToMobile(mobile, snapshot ? snapshot_path_ : base::FilePath(), browser_, weak_ptr_factory_.GetWeakPtr()); } else { NOTREACHED(); diff --git a/chrome/browser/ui/gtk/chrome_to_mobile_bubble_gtk.h b/chrome/browser/ui/gtk/chrome_to_mobile_bubble_gtk.h index c708563..3c5f10f 100644 --- a/chrome/browser/ui/gtk/chrome_to_mobile_bubble_gtk.h +++ b/chrome/browser/ui/gtk/chrome_to_mobile_bubble_gtk.h @@ -59,7 +59,8 @@ class ChromeToMobileBubbleGtk : public BubbleDelegateGtk, const content::NotificationDetails& details) OVERRIDE; // ChromeToMobileService::Observer: - virtual void SnapshotGenerated(const FilePath& path, int64 bytes) OVERRIDE; + virtual void SnapshotGenerated(const base::FilePath& path, + int64 bytes) OVERRIDE; virtual void OnSendComplete(bool success) OVERRIDE; private: @@ -85,7 +86,7 @@ class ChromeToMobileBubbleGtk : public BubbleDelegateGtk, content::NotificationRegistrar registrar_; // The file path for the MHTML page snapshot. - FilePath snapshot_path_; + base::FilePath snapshot_path_; // The list of radio buttons corresponding to the list of mobile devices. std::vector<GtkWidget*> radio_buttons_; diff --git a/chrome/browser/ui/gtk/create_application_shortcuts_dialog_gtk.h b/chrome/browser/ui/gtk/create_application_shortcuts_dialog_gtk.h index 660f3de..4e84306 100644 --- a/chrome/browser/ui/gtk/create_application_shortcuts_dialog_gtk.h +++ b/chrome/browser/ui/gtk/create_application_shortcuts_dialog_gtk.h @@ -130,7 +130,7 @@ class CreateChromeApplicationShortcutsDialogGtk private: const extensions::Extension* app_; - FilePath profile_path_; + base::FilePath profile_path_; DISALLOW_COPY_AND_ASSIGN(CreateChromeApplicationShortcutsDialogGtk); }; diff --git a/chrome/browser/ui/gtk/download/download_item_gtk.h b/chrome/browser/ui/gtk/download/download_item_gtk.h index e659a7d..c71905d 100644 --- a/chrome/browser/ui/gtk/download/download_item_gtk.h +++ b/chrome/browser/ui/gtk/download/download_item_gtk.h @@ -227,7 +227,7 @@ class DownloadItemGtk : public content::DownloadItem::Observer, gfx::Image* icon_large_; // The last download file path for which we requested an icon. - FilePath icon_filepath_; + base::FilePath icon_filepath_; content::NotificationRegistrar registrar_; diff --git a/chrome/browser/ui/hung_plugin_tab_helper.cc b/chrome/browser/ui/hung_plugin_tab_helper.cc index e04f7cf..1362656 100644 --- a/chrome/browser/ui/hung_plugin_tab_helper.cc +++ b/chrome/browser/ui/hung_plugin_tab_helper.cc @@ -206,7 +206,7 @@ bool HungPluginInfoBarDelegate::Accept() { // ----------------------------------------------------------------------------- -HungPluginTabHelper::PluginState::PluginState(const FilePath& p, +HungPluginTabHelper::PluginState::PluginState(const base::FilePath& p, const string16& n) : path(p), name(n), @@ -229,7 +229,7 @@ HungPluginTabHelper::HungPluginTabHelper(content::WebContents* contents) HungPluginTabHelper::~HungPluginTabHelper() { } -void HungPluginTabHelper::PluginCrashed(const FilePath& plugin_path, +void HungPluginTabHelper::PluginCrashed(const base::FilePath& plugin_path, base::ProcessId plugin_pid) { // TODO(brettw) ideally this would take the child process ID. When we do this // for NaCl plugins, we'll want to know exactly which process it was since @@ -252,9 +252,10 @@ void HungPluginTabHelper::PluginCrashed(const FilePath& plugin_path, } } -void HungPluginTabHelper::PluginHungStatusChanged(int plugin_child_id, - const FilePath& plugin_path, - bool is_hung) { +void HungPluginTabHelper::PluginHungStatusChanged( + int plugin_child_id, + const base::FilePath& plugin_path, + bool is_hung) { InfoBarService* infobar_service = InfoBarService::FromWebContents(web_contents()); if (!infobar_service) diff --git a/chrome/browser/ui/intents/native_file_picker_service.cc b/chrome/browser/ui/intents/native_file_picker_service.cc index a61799f..293f3d4 100644 --- a/chrome/browser/ui/intents/native_file_picker_service.cc +++ b/chrome/browser/ui/intents/native_file_picker_service.cc @@ -73,17 +73,17 @@ class NativeFilePickerService // Reads the length of the file on the FILE thread, then returns // the file and the length to the UI thread. - void ReadFileLength(const FilePath& path); + void ReadFileLength(const base::FilePath& path); // Handles sending of data back to dispatcher - void PostDataFileReply(const FilePath& path, int64 length); + void PostDataFileReply(const base::FilePath& path, int64 length); // Implements IntentServiceHost: virtual void HandleIntent(content::WebIntentsDispatcher* dispatcher) OVERRIDE; // Implements SelectFileDialog::Listener virtual void FileSelected( - const FilePath& path, int index, void* params) OVERRIDE; + const base::FilePath& path, int index, void* params) OVERRIDE; virtual void FileSelectionCanceled(void* params) OVERRIDE; private: @@ -121,7 +121,7 @@ void NativeFilePickerService::HandleIntent( dialog_->SelectFile( ui::SelectFileDialog::SELECT_OPEN_FILE, FilePickerFactory::GetServiceTitle(), - FilePath(FILE_PATH_LITERAL(".")), + base::FilePath(FILE_PATH_LITERAL(".")), &type_info, 1, // Index of which file description to show. FILE_PATH_LITERAL(""), @@ -129,7 +129,7 @@ void NativeFilePickerService::HandleIntent( NULL); } -void NativeFilePickerService::ReadFileLength(const FilePath& path) { +void NativeFilePickerService::ReadFileLength(const base::FilePath& path) { DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::FILE)); int64 file_size; @@ -143,7 +143,7 @@ void NativeFilePickerService::ReadFileLength(const FilePath& path) { } void NativeFilePickerService::PostDataFileReply( - const FilePath& path, int64 length) { + const base::FilePath& path, int64 length) { DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); if (length <= kInvalidFileSize) { @@ -163,7 +163,7 @@ void NativeFilePickerService::PostDataFileReply( } void NativeFilePickerService::FileSelected( - const FilePath& path, int index, void* params) { + const base::FilePath& path, int index, void* params) { DCHECK(dispatcher_); content::BrowserThread::PostTask( content::BrowserThread::FILE, diff --git a/chrome/browser/ui/libgtk2ui/select_file_dialog_impl.cc b/chrome/browser/ui/libgtk2ui/select_file_dialog_impl.cc index ea0911e..c3e5e9b 100644 --- a/chrome/browser/ui/libgtk2ui/select_file_dialog_impl.cc +++ b/chrome/browser/ui/libgtk2ui/select_file_dialog_impl.cc @@ -28,8 +28,8 @@ UseKdeFileDialogStatus use_kde_ = UNKNOWN; namespace libgtk2ui { -FilePath* SelectFileDialogImpl::last_saved_path_ = NULL; -FilePath* SelectFileDialogImpl::last_opened_path_ = NULL; +base::FilePath* SelectFileDialogImpl::last_saved_path_ = NULL; +base::FilePath* SelectFileDialogImpl::last_opened_path_ = NULL; // static ui::SelectFileDialog* SelectFileDialogImpl::Create( @@ -72,8 +72,8 @@ SelectFileDialogImpl::SelectFileDialogImpl(Listener* listener, file_type_index_(0), type_(SELECT_NONE) { if (!last_saved_path_) { - last_saved_path_ = new FilePath(); - last_opened_path_ = new FilePath(); + last_saved_path_ = new base::FilePath(); + last_opened_path_ = new base::FilePath(); } } @@ -87,7 +87,8 @@ bool SelectFileDialogImpl::IsRunning(gfx::NativeWindow parent_window) const { return parents_.find(parent_window) != parents_.end(); } -bool SelectFileDialogImpl::CallDirectoryExistsOnUIThread(const FilePath& path) { +bool SelectFileDialogImpl::CallDirectoryExistsOnUIThread( + const base::FilePath& path) { base::ThreadRestrictions::ScopedAllowIO allow_io; return file_util::DirectoryExists(path); } diff --git a/chrome/browser/ui/libgtk2ui/select_file_dialog_impl.h b/chrome/browser/ui/libgtk2ui/select_file_dialog_impl.h index a332972..55f1c30 100644 --- a/chrome/browser/ui/libgtk2ui/select_file_dialog_impl.h +++ b/chrome/browser/ui/libgtk2ui/select_file_dialog_impl.h @@ -49,20 +49,21 @@ class SelectFileDialogImpl : public ui::SelectFileDialog { // SelectFileDialog implementation. // |params| is user data we pass back via the Listener interface. - virtual void SelectFileImpl(Type type, - const string16& title, - const FilePath& default_path, - const FileTypeInfo* file_types, - int file_type_index, - const FilePath::StringType& default_extension, - gfx::NativeWindow owning_window, - void* params) = 0; + virtual void SelectFileImpl( + Type type, + const string16& title, + const base::FilePath& default_path, + const FileTypeInfo* file_types, + int file_type_index, + const base::FilePath::StringType& default_extension, + gfx::NativeWindow owning_window, + void* params) = 0; // Wrapper for file_util::DirectoryExists() that allow access on the UI // thread. Use this only in the file dialog functions, where it's ok // because the file dialog has to do many stats anyway. One more won't // hurt too badly and it's likely already cached. - bool CallDirectoryExistsOnUIThread(const FilePath& path); + bool CallDirectoryExistsOnUIThread(const base::FilePath& path); // The file filters. FileTypeInfo file_types_; @@ -79,8 +80,8 @@ class SelectFileDialogImpl : public ui::SelectFileDialog { // These two variables track where the user last saved a file or opened a // file so that we can display future dialogs with the same starting path. - static FilePath* last_saved_path_; - static FilePath* last_opened_path_; + static base::FilePath* last_saved_path_; + static base::FilePath* last_opened_path_; DISALLOW_COPY_AND_ASSIGN(SelectFileDialogImpl); }; diff --git a/chrome/browser/ui/libgtk2ui/select_file_dialog_impl_gtk2.cc b/chrome/browser/ui/libgtk2ui/select_file_dialog_impl_gtk2.cc index 8eb667e..66557b2 100644 --- a/chrome/browser/ui/libgtk2ui/select_file_dialog_impl_gtk2.cc +++ b/chrome/browser/ui/libgtk2ui/select_file_dialog_impl_gtk2.cc @@ -78,14 +78,15 @@ class SelectFileDialogImplGTK : public SelectFileDialogImpl, // SelectFileDialog implementation. // |params| is user data we pass back via the Listener interface. - virtual void SelectFileImpl(Type type, - const string16& title, - const FilePath& default_path, - const FileTypeInfo* file_types, - int file_type_index, - const FilePath::StringType& default_extension, - gfx::NativeWindow owning_window, - void* params) OVERRIDE; + virtual void SelectFileImpl( + Type type, + const string16& title, + const base::FilePath& default_path, + const FileTypeInfo* file_types, + int file_type_index, + const base::FilePath::StringType& default_extension, + gfx::NativeWindow owning_window, + void* params) OVERRIDE; private: virtual bool HasMultipleFileTypeChoicesImpl() OVERRIDE; @@ -97,11 +98,11 @@ class SelectFileDialogImplGTK : public SelectFileDialogImpl, void AddFilters(GtkFileChooser* chooser); // Notifies the listener that a single file was chosen. - void FileSelected(GtkWidget* dialog, const FilePath& path); + void FileSelected(GtkWidget* dialog, const base::FilePath& path); // Notifies the listener that multiple files were chosen. void MultiFilesSelected(GtkWidget* dialog, - const std::vector<FilePath>& files); + const std::vector<base::FilePath>& files); // Notifies the listener that no file was chosen (the action was canceled). // Dialog is passed so we can find that |params| pointer that was passed to @@ -109,16 +110,16 @@ class SelectFileDialogImplGTK : public SelectFileDialogImpl, void FileNotSelected(GtkWidget* dialog); GtkWidget* CreateSelectFolderDialog(const std::string& title, - const FilePath& default_path, gfx::NativeWindow parent); + const base::FilePath& default_path, gfx::NativeWindow parent); GtkWidget* CreateFileOpenDialog(const std::string& title, - const FilePath& default_path, gfx::NativeWindow parent); + const base::FilePath& default_path, gfx::NativeWindow parent); GtkWidget* CreateMultiFileOpenDialog(const std::string& title, - const FilePath& default_path, gfx::NativeWindow parent); + const base::FilePath& default_path, gfx::NativeWindow parent); GtkWidget* CreateSaveAsDialog(const std::string& title, - const FilePath& default_path, gfx::NativeWindow parent); + const base::FilePath& default_path, gfx::NativeWindow parent); // Removes and returns the |params| associated with |dialog| from // |params_map_|. @@ -139,7 +140,7 @@ class SelectFileDialogImplGTK : public SelectFileDialogImpl, // Common function for CreateFileOpenDialog and CreateMultiFileOpenDialog. GtkWidget* CreateFileOpenHelper(const std::string& title, - const FilePath& default_path, + const base::FilePath& default_path, gfx::NativeWindow parent); // Callback for when the user responds to a Save As or Open File dialog. @@ -213,10 +214,10 @@ void SelectFileDialogImplGTK::OnWindowDestroying(aura::Window* window) { void SelectFileDialogImplGTK::SelectFileImpl( Type type, const string16& title, - const FilePath& default_path, + const base::FilePath& default_path, const FileTypeInfo* file_types, int file_type_index, - const FilePath::StringType& default_extension, + const base::FilePath::StringType& default_extension, gfx::NativeWindow owning_window, void* params) { type_ = type; @@ -330,7 +331,7 @@ void SelectFileDialogImplGTK::AddFilters(GtkFileChooser* chooser) { } void SelectFileDialogImplGTK::FileSelected(GtkWidget* dialog, - const FilePath& path) { + const base::FilePath& path) { if (type_ == SELECT_SAVEAS_FILE) *last_saved_path_ = path.DirName(); else if (type_ == SELECT_OPEN_FILE || type_ == SELECT_FOLDER) @@ -350,7 +351,7 @@ void SelectFileDialogImplGTK::FileSelected(GtkWidget* dialog, } void SelectFileDialogImplGTK::MultiFilesSelected(GtkWidget* dialog, - const std::vector<FilePath>& files) { + const std::vector<base::FilePath>& files) { *last_opened_path_ = files[0].DirName(); if (listener_) @@ -367,7 +368,7 @@ void SelectFileDialogImplGTK::FileNotSelected(GtkWidget* dialog) { GtkWidget* SelectFileDialogImplGTK::CreateFileOpenHelper( const std::string& title, - const FilePath& default_path, + const base::FilePath& default_path, gfx::NativeWindow parent) { GtkWidget* dialog = gtk_file_chooser_dialog_new(title.c_str(), NULL, @@ -397,7 +398,7 @@ GtkWidget* SelectFileDialogImplGTK::CreateFileOpenHelper( GtkWidget* SelectFileDialogImplGTK::CreateSelectFolderDialog( const std::string& title, - const FilePath& default_path, + const base::FilePath& default_path, gfx::NativeWindow parent) { std::string title_string = !title.empty() ? title : l10n_util::GetStringUTF8(IDS_SELECT_FOLDER_DIALOG_TITLE); @@ -425,7 +426,7 @@ GtkWidget* SelectFileDialogImplGTK::CreateSelectFolderDialog( GtkWidget* SelectFileDialogImplGTK::CreateFileOpenDialog( const std::string& title, - const FilePath& default_path, + const base::FilePath& default_path, gfx::NativeWindow parent) { std::string title_string = !title.empty() ? title : l10n_util::GetStringUTF8(IDS_OPEN_FILE_DIALOG_TITLE); @@ -439,7 +440,7 @@ GtkWidget* SelectFileDialogImplGTK::CreateFileOpenDialog( GtkWidget* SelectFileDialogImplGTK::CreateMultiFileOpenDialog( const std::string& title, - const FilePath& default_path, + const base::FilePath& default_path, gfx::NativeWindow parent) { std::string title_string = !title.empty() ? title : l10n_util::GetStringUTF8(IDS_OPEN_FILES_DIALOG_TITLE); @@ -452,7 +453,7 @@ GtkWidget* SelectFileDialogImplGTK::CreateMultiFileOpenDialog( } GtkWidget* SelectFileDialogImplGTK::CreateSaveAsDialog(const std::string& title, - const FilePath& default_path, gfx::NativeWindow parent) { + const base::FilePath& default_path, gfx::NativeWindow parent) { std::string title_string = !title.empty() ? title : l10n_util::GetStringUTF8(IDS_SAVE_AS_DIALOG_TITLE); @@ -538,7 +539,7 @@ void SelectFileDialogImplGTK::SelectSingleFileHelper(GtkWidget* dialog, return; } - FilePath path(filename); + base::FilePath path(filename); g_free(filename); if (allow_folder) { @@ -575,9 +576,9 @@ void SelectFileDialogImplGTK::OnSelectMultiFileDialogResponse(GtkWidget* dialog, return; } - std::vector<FilePath> filenames_fp; + std::vector<base::FilePath> filenames_fp; for (GSList* iter = filenames; iter != NULL; iter = g_slist_next(iter)) { - FilePath path(static_cast<char*>(iter->data)); + base::FilePath path(static_cast<char*>(iter->data)); g_free(iter->data); if (CallDirectoryExistsOnUIThread(path)) continue; diff --git a/chrome/browser/ui/libgtk2ui/select_file_dialog_impl_kde.cc b/chrome/browser/ui/libgtk2ui/select_file_dialog_impl_kde.cc index 123ea9c..78b91717 100644 --- a/chrome/browser/ui/libgtk2ui/select_file_dialog_impl_kde.cc +++ b/chrome/browser/ui/libgtk2ui/select_file_dialog_impl_kde.cc @@ -53,21 +53,22 @@ class SelectFileDialogImplKDE : public SelectFileDialogImpl { // SelectFileDialog implementation. // |params| is user data we pass back via the Listener interface. - virtual void SelectFileImpl(Type type, - const string16& title, - const FilePath& default_path, - const FileTypeInfo* file_types, - int file_type_index, - const FilePath::StringType& default_extension, - gfx::NativeWindow owning_window, - void* params) OVERRIDE; + virtual void SelectFileImpl( + Type type, + const string16& title, + const base::FilePath& default_path, + const FileTypeInfo* file_types, + int file_type_index, + const base::FilePath::StringType& default_extension, + gfx::NativeWindow owning_window, + void* params) OVERRIDE; private: virtual bool HasMultipleFileTypeChoicesImpl() OVERRIDE; struct KDialogParams { KDialogParams(const std::string& type, const std::string& title, - const FilePath& default_path, gfx::NativeWindow parent, + const base::FilePath& default_path, gfx::NativeWindow parent, bool file_operation, bool multiple_selection, void* kdialog_params, void (SelectFileDialogImplKDE::*callback)(const std::string&, @@ -80,7 +81,7 @@ class SelectFileDialogImplKDE : public SelectFileDialogImpl { std::string type; std::string title; - FilePath default_path; + base::FilePath default_path; gfx::NativeWindow parent; bool file_operation; bool multiple_selection; @@ -94,17 +95,18 @@ class SelectFileDialogImplKDE : public SelectFileDialogImpl { // Get KDialog command line representing the Argv array for KDialog. void GetKDialogCommandLine(const std::string& type, const std::string& title, - const FilePath& default_path, gfx::NativeWindow parent, + const base::FilePath& default_path, gfx::NativeWindow parent, bool file_operation, bool multiple_selection, CommandLine* command_line); // Call KDialog on the FILE thread and post results back to the UI thread. void CallKDialogOutput(const KDialogParams& params); // Notifies the listener that a single file was chosen. - void FileSelected(const FilePath& path, void* params); + void FileSelected(const base::FilePath& path, void* params); // Notifies the listener that multiple files were chosen. - void MultiFilesSelected(const std::vector<FilePath>& files, void* params); + void MultiFilesSelected(const std::vector<base::FilePath>& files, + void* params); // Notifies the listener that no file was chosen (the action was canceled). // Dialog is passed so we can find that |params| pointer that was passed to @@ -112,19 +114,19 @@ class SelectFileDialogImplKDE : public SelectFileDialogImpl { void FileNotSelected(void *params); void CreateSelectFolderDialog(const std::string& title, - const FilePath& default_path, + const base::FilePath& default_path, gfx::NativeWindow parent, void* params); void CreateFileOpenDialog(const std::string& title, - const FilePath& default_path, + const base::FilePath& default_path, gfx::NativeWindow parent, void* params); void CreateMultiFileOpenDialog(const std::string& title, - const FilePath& default_path, + const base::FilePath& default_path, gfx::NativeWindow parent, void* params); void CreateSaveAsDialog(const std::string& title, - const FilePath& default_path, + const base::FilePath& default_path, gfx::NativeWindow parent, void* params); // Common function for OnSelectSingleFileDialogResponse and @@ -184,10 +186,10 @@ SelectFileDialogImplKDE::~SelectFileDialogImplKDE() { void SelectFileDialogImplKDE::SelectFileImpl( Type type, const string16& title, - const FilePath& default_path, + const base::FilePath& default_path, const FileTypeInfo* file_types, int file_type_index, - const FilePath::StringType& default_extension, + const base::FilePath::StringType& default_extension, gfx::NativeWindow owning_window, void* params) { type_ = type; @@ -240,8 +242,8 @@ std::string SelectFileDialogImplKDE::GetMimeTypeFilterString() { for (size_t i = 0; i < file_types_.extensions.size(); ++i) { for (size_t j = 0; j < file_types_.extensions[i].size(); ++j) { if (!file_types_.extensions[i][j].empty()) { - std::string mime_type = base::nix::GetFileMimeType( - FilePath("name").ReplaceExtension(file_types_.extensions[i][j])); + std::string mime_type = base::nix::GetFileMimeType(base::FilePath( + "name").ReplaceExtension(file_types_.extensions[i][j])); filter_set.insert(mime_type); } } @@ -288,7 +290,7 @@ void SelectFileDialogImplKDE::CallKDialogOutput(const KDialogParams& params) { } void SelectFileDialogImplKDE::GetKDialogCommandLine(const std::string& type, - const std::string& title, const FilePath& path, + const std::string& title, const base::FilePath& path, gfx::NativeWindow parent, bool file_operation, bool multiple_selection, CommandLine* command_line) { CHECK(command_line); @@ -310,7 +312,7 @@ void SelectFileDialogImplKDE::GetKDialogCommandLine(const std::string& type, command_line->AppendSwitch(type); // The path should never be empty. If it is, set it to PWD. if (path.empty()) - command_line->AppendArgPath(FilePath(".")); + command_line->AppendArgPath(base::FilePath(".")); else command_line->AppendArgPath(path); // Depending on the type of the operation we need, get the path to the @@ -320,7 +322,8 @@ void SelectFileDialogImplKDE::GetKDialogCommandLine(const std::string& type, VLOG(1) << "KDialog command line: " << command_line->GetCommandLineString(); } -void SelectFileDialogImplKDE::FileSelected(const FilePath& path, void* params) { +void SelectFileDialogImplKDE::FileSelected(const base::FilePath& path, + void* params) { if (type_ == SELECT_SAVEAS_FILE) *last_saved_path_ = path.DirName(); else if (type_ == SELECT_OPEN_FILE) @@ -336,7 +339,7 @@ void SelectFileDialogImplKDE::FileSelected(const FilePath& path, void* params) { } void SelectFileDialogImplKDE::MultiFilesSelected( - const std::vector<FilePath>& files, void* params) { + const std::vector<base::FilePath>& files, void* params) { *last_opened_path_ = files[0].DirName(); if (listener_) listener_->MultiFilesSelected(files, params); @@ -348,7 +351,7 @@ void SelectFileDialogImplKDE::FileNotSelected(void* params) { } void SelectFileDialogImplKDE::CreateSelectFolderDialog( - const std::string& title, const FilePath& default_path, + const std::string& title, const base::FilePath& default_path, gfx::NativeWindow parent, void *params) { BrowserThread::PostTask( BrowserThread::FILE, FROM_HERE, @@ -364,7 +367,7 @@ void SelectFileDialogImplKDE::CreateSelectFolderDialog( } void SelectFileDialogImplKDE::CreateFileOpenDialog( - const std::string& title, const FilePath& default_path, + const std::string& title, const base::FilePath& default_path, gfx::NativeWindow parent, void* params) { BrowserThread::PostTask( BrowserThread::FILE, FROM_HERE, @@ -380,7 +383,7 @@ void SelectFileDialogImplKDE::CreateFileOpenDialog( } void SelectFileDialogImplKDE::CreateMultiFileOpenDialog( - const std::string& title, const FilePath& default_path, + const std::string& title, const base::FilePath& default_path, gfx::NativeWindow parent, void* params) { BrowserThread::PostTask( BrowserThread::FILE, FROM_HERE, @@ -396,7 +399,7 @@ void SelectFileDialogImplKDE::CreateMultiFileOpenDialog( } void SelectFileDialogImplKDE::CreateSaveAsDialog( - const std::string& title, const FilePath& default_path, + const std::string& title, const base::FilePath& default_path, gfx::NativeWindow parent, void* params) { BrowserThread::PostTask( BrowserThread::FILE, FROM_HERE, @@ -419,7 +422,7 @@ void SelectFileDialogImplKDE::SelectSingleFileHelper(const std::string& output, return; } - FilePath path(output); + base::FilePath path(output); if (allow_folder) { FileSelected(path, params); return; @@ -455,10 +458,10 @@ void SelectFileDialogImplKDE::OnSelectMultiFileDialogResponse( std::vector<std::string> filenames; Tokenize(output, "\n", &filenames); - std::vector<FilePath> filenames_fp; + std::vector<base::FilePath> filenames_fp; for (std::vector<std::string>::iterator iter = filenames.begin(); iter != filenames.end(); ++iter) { - FilePath path(*iter); + base::FilePath path(*iter); if (CallDirectoryExistsOnUIThread(path)) continue; filenames_fp.push_back(path); diff --git a/chrome/browser/ui/metro_pin_tab_helper_win.cc b/chrome/browser/ui/metro_pin_tab_helper_win.cc index daf6c21..93a5828 100644 --- a/chrome/browser/ui/metro_pin_tab_helper_win.cc +++ b/chrome/browser/ui/metro_pin_tab_helper_win.cc @@ -51,15 +51,15 @@ string16 GenerateTileId(const string16& url_str) { } // Get the path of the directory to store the tile logos in. -FilePath GetTileImagesDir() { - FilePath tile_images_dir; +base::FilePath GetTileImagesDir() { + base::FilePath tile_images_dir; if (!PathService::Get(chrome::DIR_USER_DATA, &tile_images_dir)) - return FilePath(); + return base::FilePath(); tile_images_dir = tile_images_dir.Append(L"TileImages"); if (!file_util::DirectoryExists(tile_images_dir) && !file_util::CreateDirectory(tile_images_dir)) - return FilePath(); + return base::FilePath(); return tile_images_dir; } @@ -69,8 +69,8 @@ FilePath GetTileImagesDir() { // value indicates whether a site specific logo was created. bool CreateSiteSpecificLogo(const SkBitmap& bitmap, const string16& tile_id, - const FilePath& logo_dir, - FilePath* logo_path) { + const base::FilePath& logo_dir, + base::FilePath* logo_path) { const int kLogoWidth = 120; const int kLogoHeight = 120; const int kBoxWidth = 40; @@ -120,14 +120,14 @@ bool CreateSiteSpecificLogo(const SkBitmap& bitmap, // its tile image cache.) // The path to the logo is returned in |logo_path|, with the return value // indicating success. -bool GetPathToBackupLogo(const FilePath& logo_dir, - FilePath* logo_path) { +bool GetPathToBackupLogo(const base::FilePath& logo_dir, + base::FilePath* logo_path) { const wchar_t kDefaultLogoFileName[] = L"SecondaryTile.png"; *logo_path = logo_dir.Append(kDefaultLogoFileName); if (file_util::PathExists(*logo_path)) return true; - FilePath default_logo_path; + base::FilePath default_logo_path; if (!PathService::Get(base::DIR_MODULE, &default_logo_path)) return false; @@ -191,13 +191,13 @@ void PinPageTaskRunner::RunOnFileThread() { DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::FILE)); string16 tile_id = GenerateTileId(url_); - FilePath logo_dir = GetTileImagesDir(); + base::FilePath logo_dir = GetTileImagesDir(); if (logo_dir.empty()) { LOG(ERROR) << "Could not create directory to store tile image."; return; } - FilePath logo_path; + base::FilePath logo_path; if (!CreateSiteSpecificLogo(favicon_, tile_id, logo_dir, &logo_path) && !GetPathToBackupLogo(logo_dir, &logo_path)) { LOG(ERROR) << "Count not get path to logo tile."; diff --git a/chrome/browser/ui/network_profile_bubble.cc b/chrome/browser/ui/network_profile_bubble.cc index c9abc34..bc6ea8b 100644 --- a/chrome/browser/ui/network_profile_bubble.cc +++ b/chrome/browser/ui/network_profile_bubble.cc @@ -88,7 +88,8 @@ bool NetworkProfileBubble::ShouldCheckNetworkProfile(Profile* profile) { } // static -void NetworkProfileBubble::CheckNetworkProfile(const FilePath& profile_folder) { +void NetworkProfileBubble::CheckNetworkProfile( + const base::FilePath& profile_folder) { DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::FILE)); // On Windows notify the users if their profiles are located on a network // share as we don't officially support this setup yet. @@ -122,12 +123,12 @@ void NetworkProfileBubble::CheckNetworkProfile(const FilePath& profile_folder) { if (*type == WTS_PROTOCOL_TYPE_CONSOLE) { bool profile_on_network = false; if (!profile_folder.empty()) { - FilePath temp_file; + base::FilePath temp_file; // Try to create some non-empty temp file in the profile dir and use // it to check if there is a reparse-point free path to it. if (file_util::CreateTemporaryFileInDir(profile_folder, &temp_file) && file_util::WriteFile(temp_file, ".", 1)) { - FilePath normalized_temp_file; + base::FilePath normalized_temp_file; if (!file_util::NormalizeFilePath(temp_file, &normalized_temp_file)) profile_on_network = true; } else { diff --git a/chrome/browser/ui/panels/base_panel_browser_test.cc b/chrome/browser/ui/panels/base_panel_browser_test.cc index 9918dad..0873a4a 100644 --- a/chrome/browser/ui/panels/base_panel_browser_test.cc +++ b/chrome/browser/ui/panels/base_panel_browser_test.cc @@ -183,7 +183,7 @@ void MockDisplaySettingsProviderImpl::SetDesktopBarThickness( } // namespace -const FilePath::CharType* BasePanelBrowserTest::kTestDir = +const base::FilePath::CharType* BasePanelBrowserTest::kTestDir = FILE_PATH_LITERAL("panels"); BasePanelBrowserTest::BasePanelBrowserTest() @@ -410,13 +410,13 @@ NativePanelTesting* BasePanelBrowserTest::CreateNativePanelTesting( } scoped_refptr<Extension> BasePanelBrowserTest::CreateExtension( - const FilePath::StringType& path, + const base::FilePath::StringType& path, extensions::Manifest::Location location, const DictionaryValue& extra_value) { #if defined(OS_WIN) - FilePath full_path(FILE_PATH_LITERAL("c:\\")); + base::FilePath full_path(FILE_PATH_LITERAL("c:\\")); #else - FilePath full_path(FILE_PATH_LITERAL("/")); + base::FilePath full_path(FILE_PATH_LITERAL("/")); #endif full_path = full_path.Append(path); diff --git a/chrome/browser/ui/panels/base_panel_browser_test.h b/chrome/browser/ui/panels/base_panel_browser_test.h index 69db3b1..b5d0495 100644 --- a/chrome/browser/ui/panels/base_panel_browser_test.h +++ b/chrome/browser/ui/panels/base_panel_browser_test.h @@ -90,7 +90,7 @@ class BasePanelBrowserTest : public InProcessBrowserTest { void WaitForBoundsAnimationFinished(Panel* panel); scoped_refptr<extensions::Extension> CreateExtension( - const FilePath::StringType& path, + const base::FilePath::StringType& path, extensions::Manifest::Location location, const DictionaryValue& extra_value); @@ -114,7 +114,7 @@ class BasePanelBrowserTest : public InProcessBrowserTest { mock_display_settings_enabled_ = false; } - static const FilePath::CharType* kTestDir; + static const base::FilePath::CharType* kTestDir; private: // Passed to and owned by PanelManager. diff --git a/chrome/browser/ui/panels/panel_browsertest.cc b/chrome/browser/ui/panels/panel_browsertest.cc index 69a3486..b8a26f1 100644 --- a/chrome/browser/ui/panels/panel_browsertest.cc +++ b/chrome/browser/ui/panels/panel_browsertest.cc @@ -414,8 +414,8 @@ IN_PROC_BROWSER_TEST_F(PanelBrowserTest, DISABLED_AutoResize) { // Create a test panel with web contents loaded. CreatePanelParams params("PanelTest1", gfx::Rect(), SHOW_AS_ACTIVE); GURL url(ui_test_utils::GetTestUrl( - FilePath(kTestDir), - FilePath(FILE_PATH_LITERAL("update-preferred-size.html")))); + base::FilePath(kTestDir), + base::FilePath(FILE_PATH_LITERAL("update-preferred-size.html")))); params.url = url; Panel* panel = CreatePanelWithParams(params); @@ -1505,8 +1505,8 @@ IN_PROC_BROWSER_TEST_F(PanelBrowserTest, OnBeforeUnloadOnClose) { CreatePanelParams params("PanelTest1", gfx::Rect(0, 0, 300, 300), SHOW_AS_ACTIVE); params.url = ui_test_utils::GetTestUrl( - FilePath(kTestDir), - FilePath(FILE_PATH_LITERAL("onbeforeunload.html"))); + base::FilePath(kTestDir), + base::FilePath(FILE_PATH_LITERAL("onbeforeunload.html"))); Panel* panel = CreatePanelWithParams(params); EXPECT_EQ(1, panel_manager->num_panels()); @@ -1644,8 +1644,8 @@ IN_PROC_BROWSER_TEST_F(PanelBrowserTest, DevTools) { // Create a test panel with web contents loaded. CreatePanelParams params("1", gfx::Rect(0, 0, 200, 220), SHOW_AS_ACTIVE); GURL url(ui_test_utils::GetTestUrl( - FilePath(kTestDir), - FilePath(FILE_PATH_LITERAL("update-preferred-size.html")))); + base::FilePath(kTestDir), + base::FilePath(FILE_PATH_LITERAL("update-preferred-size.html")))); params.url = url; Panel* panel = CreatePanelWithParams(params); @@ -1675,8 +1675,8 @@ IN_PROC_BROWSER_TEST_F(PanelBrowserTest, DevToolsConsole) { // Create a test panel with web contents loaded. CreatePanelParams params("1", gfx::Rect(0, 0, 200, 220), SHOW_AS_ACTIVE); GURL url(ui_test_utils::GetTestUrl( - FilePath(kTestDir), - FilePath(FILE_PATH_LITERAL("update-preferred-size.html")))); + base::FilePath(kTestDir), + base::FilePath(FILE_PATH_LITERAL("update-preferred-size.html")))); params.url = url; Panel* panel = CreatePanelWithParams(params); @@ -1713,8 +1713,8 @@ IN_PROC_BROWSER_TEST_F(PanelBrowserTest, MAYBE_Accelerator) { // Create a test panel with web contents loaded. CreatePanelParams params("1", gfx::Rect(), SHOW_AS_ACTIVE); GURL url(ui_test_utils::GetTestUrl( - FilePath(kTestDir), - FilePath(FILE_PATH_LITERAL("update-preferred-size.html")))); + base::FilePath(kTestDir), + base::FilePath(FILE_PATH_LITERAL("update-preferred-size.html")))); params.url = url; Panel* panel = CreatePanelWithParams(params); EXPECT_EQ(1, panel_manager->num_panels()); diff --git a/chrome/browser/ui/pdf/pdf_browsertest.cc b/chrome/browser/ui/pdf/pdf_browsertest.cc index 35d6bab..1ac036e 100644 --- a/chrome/browser/ui/pdf/pdf_browsertest.cc +++ b/chrome/browser/ui/pdf/pdf_browsertest.cc @@ -48,7 +48,7 @@ class PDFBrowserTest : public InProcessBrowserTest, pdf_test_server_.reset(new net::TestServer( net::TestServer::TYPE_HTTP, net::TestServer::kLocalhost, - FilePath(FILE_PATH_LITERAL("pdf/test")))); + base::FilePath(FILE_PATH_LITERAL("pdf/test")))); } protected: @@ -59,8 +59,8 @@ class PDFBrowserTest : public InProcessBrowserTest, return load_stop_notification_count_; } - FilePath GetPDFTestDir() { - return FilePath(FilePath::kCurrentDirectory).AppendASCII(".."). + base::FilePath GetPDFTestDir() { + return base::FilePath(base::FilePath::kCurrentDirectory).AppendASCII(".."). AppendASCII("..").AppendASCII("..").AppendASCII("pdf"). AppendASCII("test"); } @@ -78,7 +78,7 @@ class PDFBrowserTest : public InProcessBrowserTest, GURL url(ui_test_utils::GetTestUrl( GetPDFTestDir(), - FilePath(FILE_PATH_LITERAL("pdf_browsertest.pdf")))); + base::FilePath(FILE_PATH_LITERAL("pdf_browsertest.pdf")))); ui_test_utils::NavigateToURL(browser(), url); } @@ -124,9 +124,9 @@ class PDFBrowserTest : public InProcessBrowserTest, const content::NotificationDetails& details) { if (type == chrome::NOTIFICATION_TAB_SNAPSHOT_TAKEN) { MessageLoopForUI::current()->Quit(); - FilePath reference = ui_test_utils::GetTestFilePath( + base::FilePath reference = ui_test_utils::GetTestFilePath( GetPDFTestDir(), - FilePath().AppendASCII(expected_filename_)); + base::FilePath().AppendASCII(expected_filename_)); base::PlatformFileInfo info; ASSERT_TRUE(file_util::GetFileInfo(reference, &info)); int size = static_cast<size_t>(info.size); @@ -197,7 +197,7 @@ class PDFBrowserTest : public InProcessBrowserTest, // The filename of the bitmap to compare the snapshot to. std::string expected_filename_; // If the snapshot is different, holds the location where it's saved. - FilePath snapshot_filename_; + base::FilePath snapshot_filename_; // How many times we've seen chrome::LOAD_STOP. int load_stop_notification_count_; @@ -308,11 +308,11 @@ IN_PROC_BROWSER_TEST_P(PDFBrowserTest, Loading) { std::string base_url = std::string("files/"); file_util::FileEnumerator file_enumerator( - ui_test_utils::GetTestFilePath(GetPDFTestDir(), FilePath()), + ui_test_utils::GetTestFilePath(GetPDFTestDir(), base::FilePath()), false, file_util::FileEnumerator::FILES, FILE_PATH_LITERAL("*.pdf")); - for (FilePath file_path = file_enumerator.Next(); + for (base::FilePath file_path = file_enumerator.Next(); !file_path.empty(); file_path = file_enumerator.Next()) { std::string filename = file_path.BaseName().MaybeAsASCII(); diff --git a/chrome/browser/ui/prefs/prefs_tab_helper_browsertest.cc b/chrome/browser/ui/prefs/prefs_tab_helper_browsertest.cc index 9a4ba7f..ead3aa8 100644 --- a/chrome/browser/ui/prefs/prefs_tab_helper_browsertest.cc +++ b/chrome/browser/ui/prefs/prefs_tab_helper_browsertest.cc @@ -15,8 +15,8 @@ class PrefsTabHelperBrowserTest : public InProcessBrowserTest { protected: - virtual FilePath GetPreferencesFilePath() { - FilePath test_data_directory; + virtual base::FilePath GetPreferencesFilePath() { + base::FilePath test_data_directory; PathService::Get(chrome::DIR_TEST_DATA, &test_data_directory); return test_data_directory .AppendASCII("profiles") @@ -26,20 +26,20 @@ class PrefsTabHelperBrowserTest : public InProcessBrowserTest { } virtual bool SetUpUserDataDirectory() OVERRIDE { - FilePath user_data_directory; + base::FilePath user_data_directory; PathService::Get(chrome::DIR_USER_DATA, &user_data_directory); - FilePath default_profile = + base::FilePath default_profile = user_data_directory.AppendASCII(TestingProfile::kTestUserProfileDir); if (!file_util::CreateDirectory(default_profile)) { LOG(ERROR) << "Can't create " << default_profile.MaybeAsASCII(); return false; } - FilePath non_global_pref_file = GetPreferencesFilePath(); + base::FilePath non_global_pref_file = GetPreferencesFilePath(); if (!file_util::PathExists(non_global_pref_file)) { LOG(ERROR) << "Doesn't exist " << non_global_pref_file.MaybeAsASCII(); return false; } - FilePath default_pref_file = + base::FilePath default_pref_file = default_profile.Append(chrome::kPreferencesFilename); if (!file_util::CopyFile(non_global_pref_file, default_pref_file)) { LOG(ERROR) << "Copy error from " << non_global_pref_file.MaybeAsASCII() @@ -107,8 +107,8 @@ IN_PROC_BROWSER_TEST_F(PrefsTabHelperBrowserTest, PrefsAreMigratedToFontMap) { class PrefsTabHelperBrowserTest2 : public PrefsTabHelperBrowserTest { protected: - virtual FilePath GetPreferencesFilePath() OVERRIDE { - FilePath test_data_directory; + virtual base::FilePath GetPreferencesFilePath() OVERRIDE { + base::FilePath test_data_directory; PathService::Get(chrome::DIR_TEST_DATA, &test_data_directory); return test_data_directory .AppendASCII("profiles") diff --git a/chrome/browser/ui/startup/autolaunch_prompt_win.cc b/chrome/browser/ui/startup/autolaunch_prompt_win.cc index 654aa5a..73afb60 100644 --- a/chrome/browser/ui/startup/autolaunch_prompt_win.cc +++ b/chrome/browser/ui/startup/autolaunch_prompt_win.cc @@ -170,7 +170,7 @@ bool ShowAutolaunchPrompt(Browser* browser) { // Only supported on the main profile for now. Profile* profile = browser->profile(); if (profile->GetPath().BaseName() != - FilePath(ASCIIToUTF16(chrome::kInitialProfile))) { + base::FilePath(ASCIIToUTF16(chrome::kInitialProfile))) { return false; } diff --git a/chrome/browser/ui/startup/startup_browser_creator.cc b/chrome/browser/ui/startup/startup_browser_creator.cc index f89ae71..9342df8 100644 --- a/chrome/browser/ui/startup/startup_browser_creator.cc +++ b/chrome/browser/ui/startup/startup_browser_creator.cc @@ -245,7 +245,7 @@ bool StartupBrowserCreator::InSynchronousProfileLaunch() { bool StartupBrowserCreator::LaunchBrowser( const CommandLine& command_line, Profile* profile, - const FilePath& cur_dir, + const base::FilePath& cur_dir, chrome::startup::IsProcessStartup process_startup, chrome::startup::IsFirstRun is_first_run, int* return_code) { @@ -357,13 +357,13 @@ void StartupBrowserCreator::ClearLaunchedProfilesForTesting() { // static std::vector<GURL> StartupBrowserCreator::GetURLsFromCommandLine( const CommandLine& command_line, - const FilePath& cur_dir, + const base::FilePath& cur_dir, Profile* profile) { std::vector<GURL> urls; const CommandLine::StringVector& params = command_line.GetArgs(); for (size_t i = 0; i < params.size(); ++i) { - FilePath param = FilePath(params[i]); + base::FilePath param = base::FilePath(params[i]); // Handle Vista way of searching - "? <search-term>" if (param.value().size() > 2 && param.value()[0] == '?' && param.value()[1] == ' ') { @@ -423,7 +423,7 @@ std::vector<GURL> StartupBrowserCreator::GetURLsFromCommandLine( // static bool StartupBrowserCreator::ProcessCmdLineImpl( const CommandLine& command_line, - const FilePath& cur_dir, + const base::FilePath& cur_dir, bool process_startup, Profile* last_used_profile, const Profiles& last_opened_profiles, @@ -654,7 +654,7 @@ bool StartupBrowserCreator::CreateAutomationProvider( // static void StartupBrowserCreator::ProcessCommandLineOnProfileCreated( const CommandLine& command_line, - const FilePath& cur_dir, + const base::FilePath& cur_dir, Profile* profile, Profile::CreateStatus status) { if (status == Profile::CREATE_STATUS_INITIALIZED) @@ -665,8 +665,8 @@ void StartupBrowserCreator::ProcessCommandLineOnProfileCreated( // static void StartupBrowserCreator::ProcessCommandLineAlreadyRunning( const CommandLine& command_line, - const FilePath& cur_dir, - const FilePath& profile_path) { + const base::FilePath& cur_dir, + const base::FilePath& profile_path) { ProfileManager* profile_manager = g_browser_process->profile_manager(); Profile* profile = profile_manager->GetProfileByPath(profile_path); diff --git a/chrome/browser/ui/startup/startup_browser_creator.h b/chrome/browser/ui/startup/startup_browser_creator.h index 179e7e5..91da5e4 100644 --- a/chrome/browser/ui/startup/startup_browser_creator.h +++ b/chrome/browser/ui/startup/startup_browser_creator.h @@ -38,7 +38,7 @@ class StartupBrowserCreator { // This function is equivalent to ProcessCommandLine but should only be // called during actual process startup. bool Start(const CommandLine& cmd_line, - const FilePath& cur_dir, + const base::FilePath& cur_dir, Profile* last_used_profile, const Profiles& last_opened_profiles, int* return_code) { @@ -55,8 +55,8 @@ class StartupBrowserCreator { // command line arguments will be executed under. static void ProcessCommandLineAlreadyRunning( const CommandLine& command_line, - const FilePath& cur_dir, - const FilePath& startup_profile_dir); + const base::FilePath& cur_dir, + const base::FilePath& startup_profile_dir); template <class AutomationProviderClass> static bool CreateAutomationProvider(const std::string& channel_id, @@ -74,7 +74,7 @@ class StartupBrowserCreator { // |is_first_run| indicates that this is a new profile. bool LaunchBrowser(const CommandLine& command_line, Profile* profile, - const FilePath& cur_dir, + const base::FilePath& cur_dir, chrome::startup::IsProcessStartup is_process_startup, chrome::startup::IsFirstRun is_first_run, int* return_code); @@ -126,11 +126,11 @@ class StartupBrowserCreator { // vector is empty if the user didn't specify any URLs on the command line. static std::vector<GURL> GetURLsFromCommandLine( const CommandLine& command_line, - const FilePath& cur_dir, + const base::FilePath& cur_dir, Profile* profile); static bool ProcessCmdLineImpl(const CommandLine& command_line, - const FilePath& cur_dir, + const base::FilePath& cur_dir, bool process_startup, Profile* last_used_profile, const Profiles& last_opened_profiles, @@ -140,7 +140,7 @@ class StartupBrowserCreator { // Callback after a profile has been created. static void ProcessCommandLineOnProfileCreated( const CommandLine& command_line, - const FilePath& cur_dir, + const base::FilePath& cur_dir, Profile* profile, Profile::CreateStatus status); diff --git a/chrome/browser/ui/startup/startup_browser_creator_browsertest.cc b/chrome/browser/ui/startup/startup_browser_creator_browsertest.cc index 894775d..77e9056 100644 --- a/chrome/browser/ui/startup/startup_browser_creator_browsertest.cc +++ b/chrome/browser/ui/startup/startup_browser_creator_browsertest.cc @@ -145,7 +145,7 @@ IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, OpenURLsPopup) { CommandLine dummy(CommandLine::NO_PROGRAM); chrome::startup::IsFirstRun first_run = first_run::IsChromeFirstRun() ? chrome::startup::IS_FIRST_RUN : chrome::startup::IS_NOT_FIRST_RUN; - StartupBrowserCreatorImpl launch(FilePath(), dummy, first_run); + StartupBrowserCreatorImpl launch(base::FilePath(), dummy, first_run); // This should create a new window, but re-use the profile from |popup|. If // it used a NULL or invalid profile, it would crash. launch.OpenURLsInBrowser(popup, false, urls); @@ -180,7 +180,7 @@ IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, CommandLine dummy(CommandLine::NO_PROGRAM); chrome::startup::IsFirstRun first_run = first_run::IsChromeFirstRun() ? chrome::startup::IS_FIRST_RUN : chrome::startup::IS_NOT_FIRST_RUN; - StartupBrowserCreatorImpl launch(FilePath(), dummy, first_run); + StartupBrowserCreatorImpl launch(base::FilePath(), dummy, first_run); ASSERT_TRUE(launch.Launch(browser()->profile(), std::vector<GURL>(), false)); // This should have created a new browser window. |browser()| is still @@ -209,11 +209,11 @@ IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, // Use a couple arbitrary URLs. std::vector<GURL> urls; urls.push_back(ui_test_utils::GetTestUrl( - FilePath(FilePath::kCurrentDirectory), - FilePath(FILE_PATH_LITERAL("title1.html")))); + base::FilePath(base::FilePath::kCurrentDirectory), + base::FilePath(FILE_PATH_LITERAL("title1.html")))); urls.push_back(ui_test_utils::GetTestUrl( - FilePath(FilePath::kCurrentDirectory), - FilePath(FILE_PATH_LITERAL("title2.html")))); + base::FilePath(base::FilePath::kCurrentDirectory), + base::FilePath(FILE_PATH_LITERAL("title2.html")))); // Set the startup preference to open these URLs. SessionStartupPref pref(SessionStartupPref::URLS); @@ -224,7 +224,7 @@ IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, CommandLine dummy(CommandLine::NO_PROGRAM); chrome::startup::IsFirstRun first_run = first_run::IsChromeFirstRun() ? chrome::startup::IS_FIRST_RUN : chrome::startup::IS_NOT_FIRST_RUN; - StartupBrowserCreatorImpl launch(FilePath(), dummy, first_run); + StartupBrowserCreatorImpl launch(base::FilePath(), dummy, first_run); ASSERT_TRUE(launch.Launch(browser()->profile(), std::vector<GURL>(), false)); // This should have created a new browser window. @@ -248,7 +248,7 @@ IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, OpenAppShortcutNoPref) { chrome::startup::IsFirstRun first_run = first_run::IsChromeFirstRun() ? chrome::startup::IS_FIRST_RUN : chrome::startup::IS_NOT_FIRST_RUN; - StartupBrowserCreatorImpl launch(FilePath(), command_line, first_run); + StartupBrowserCreatorImpl launch(base::FilePath(), command_line, first_run); ASSERT_TRUE(launch.Launch(browser()->profile(), std::vector<GURL>(), false)); // No pref was set, so the app should have opened in a window. @@ -277,7 +277,7 @@ IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, OpenAppShortcutWindowPref) { command_line.AppendSwitchASCII(switches::kAppId, extension_app->id()); chrome::startup::IsFirstRun first_run = first_run::IsChromeFirstRun() ? chrome::startup::IS_FIRST_RUN : chrome::startup::IS_NOT_FIRST_RUN; - StartupBrowserCreatorImpl launch(FilePath(), command_line, first_run); + StartupBrowserCreatorImpl launch(base::FilePath(), command_line, first_run); ASSERT_TRUE(launch.Launch(browser()->profile(), std::vector<GURL>(), false)); // Pref was set to open in a window, so the app should have opened in a @@ -308,7 +308,7 @@ IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, OpenAppShortcutTabPref) { command_line.AppendSwitchASCII(switches::kAppId, extension_app->id()); chrome::startup::IsFirstRun first_run = first_run::IsChromeFirstRun() ? chrome::startup::IS_FIRST_RUN : chrome::startup::IS_NOT_FIRST_RUN; - StartupBrowserCreatorImpl launch(FilePath(), command_line, first_run); + StartupBrowserCreatorImpl launch(base::FilePath(), command_line, first_run); ASSERT_TRUE(launch.Launch(browser()->profile(), std::vector<GURL>(), false)); // When an app shortcut is open and the pref indicates a tab should @@ -363,7 +363,7 @@ IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, AddFirstRunTab) { // Do a simple non-process-startup browser launch. CommandLine dummy(CommandLine::NO_PROGRAM); - StartupBrowserCreatorImpl launch(FilePath(), dummy, &browser_creator, + StartupBrowserCreatorImpl launch(base::FilePath(), dummy, &browser_creator, chrome::startup::IS_FIRST_RUN); ASSERT_TRUE(launch.Launch(browser()->profile(), std::vector<GURL>(), false)); @@ -391,7 +391,7 @@ IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, AddCustomFirstRunTab) { // Do a simple non-process-startup browser launch. CommandLine dummy(CommandLine::NO_PROGRAM); - StartupBrowserCreatorImpl launch(FilePath(), dummy, &browser_creator, + StartupBrowserCreatorImpl launch(base::FilePath(), dummy, &browser_creator, chrome::startup::IS_FIRST_RUN); ASSERT_TRUE(launch.Launch(browser()->profile(), std::vector<GURL>(), false)); @@ -420,7 +420,7 @@ IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, SyncPromoNoWelcomePage) { // Do a simple non-process-startup browser launch. CommandLine dummy(CommandLine::NO_PROGRAM); - StartupBrowserCreatorImpl launch(FilePath(), dummy, + StartupBrowserCreatorImpl launch(base::FilePath(), dummy, chrome::startup::IS_FIRST_RUN); ASSERT_TRUE(launch.Launch(browser()->profile(), std::vector<GURL>(), false)); @@ -448,7 +448,7 @@ IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, SyncPromoWithWelcomePage) { // Do a simple non-process-startup browser launch. CommandLine dummy(CommandLine::NO_PROGRAM); - StartupBrowserCreatorImpl launch(FilePath(), dummy, + StartupBrowserCreatorImpl launch(base::FilePath(), dummy, chrome::startup::IS_FIRST_RUN); ASSERT_TRUE(launch.Launch(browser()->profile(), std::vector<GURL>(), false)); @@ -486,7 +486,7 @@ IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, SyncPromoWithFirstRunTabs) { // Do a simple non-process-startup browser launch. CommandLine dummy(CommandLine::NO_PROGRAM); - StartupBrowserCreatorImpl launch(FilePath(), dummy, &browser_creator, + StartupBrowserCreatorImpl launch(base::FilePath(), dummy, &browser_creator, chrome::startup::IS_FIRST_RUN); ASSERT_TRUE(launch.Launch(browser()->profile(), std::vector<GURL>(), false)); @@ -522,7 +522,7 @@ IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, // Do a simple non-process-startup browser launch. CommandLine dummy(CommandLine::NO_PROGRAM); - StartupBrowserCreatorImpl launch(FilePath(), dummy, &browser_creator, + StartupBrowserCreatorImpl launch(base::FilePath(), dummy, &browser_creator, chrome::startup::IS_FIRST_RUN); ASSERT_TRUE(launch.Launch(browser()->profile(), std::vector<GURL>(), false)); @@ -553,7 +553,7 @@ IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, StartupURLsForTwoProfiles) { ProfileManager* profile_manager = g_browser_process->profile_manager(); // Create another profile. - FilePath dest_path = profile_manager->user_data_dir(); + base::FilePath dest_path = profile_manager->user_data_dir(); dest_path = dest_path.Append(FILE_PATH_LITERAL("New Profile 1")); Profile* other_profile = profile_manager->GetProfile(dest_path); @@ -562,12 +562,12 @@ IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, StartupURLsForTwoProfiles) { // Use a couple arbitrary URLs. std::vector<GURL> urls1; urls1.push_back(ui_test_utils::GetTestUrl( - FilePath(FilePath::kCurrentDirectory), - FilePath(FILE_PATH_LITERAL("title1.html")))); + base::FilePath(base::FilePath::kCurrentDirectory), + base::FilePath(FILE_PATH_LITERAL("title1.html")))); std::vector<GURL> urls2; urls2.push_back(ui_test_utils::GetTestUrl( - FilePath(FilePath::kCurrentDirectory), - FilePath(FILE_PATH_LITERAL("title2.html")))); + base::FilePath(base::FilePath::kCurrentDirectory), + base::FilePath(FILE_PATH_LITERAL("title2.html")))); // Set different startup preferences for the 2 profiles. SessionStartupPref pref1(SessionStartupPref::URLS); @@ -620,7 +620,7 @@ IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, UpdateWithTwoProfiles) { ProfileManager* profile_manager = g_browser_process->profile_manager(); // Create two profiles. - FilePath dest_path = profile_manager->user_data_dir(); + base::FilePath dest_path = profile_manager->user_data_dir(); Profile* profile1 = profile_manager->GetProfile( dest_path.Append(FILE_PATH_LITERAL("New Profile 1"))); @@ -633,12 +633,12 @@ IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, UpdateWithTwoProfiles) { // Use a couple arbitrary URLs. std::vector<GURL> urls1; urls1.push_back(ui_test_utils::GetTestUrl( - FilePath(FilePath::kCurrentDirectory), - FilePath(FILE_PATH_LITERAL("title1.html")))); + base::FilePath(base::FilePath::kCurrentDirectory), + base::FilePath(FILE_PATH_LITERAL("title1.html")))); std::vector<GURL> urls2; urls2.push_back(ui_test_utils::GetTestUrl( - FilePath(FilePath::kCurrentDirectory), - FilePath(FILE_PATH_LITERAL("title2.html")))); + base::FilePath(base::FilePath::kCurrentDirectory), + base::FilePath(FILE_PATH_LITERAL("title2.html")))); // Set different startup preferences for the 2 profiles. SessionStartupPref pref1(SessionStartupPref::URLS); @@ -692,13 +692,13 @@ IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, ProfileManager* profile_manager = g_browser_process->profile_manager(); // Create 4 more profiles. - FilePath dest_path1 = profile_manager->user_data_dir().Append( + base::FilePath dest_path1 = profile_manager->user_data_dir().Append( FILE_PATH_LITERAL("New Profile 1")); - FilePath dest_path2 = profile_manager->user_data_dir().Append( + base::FilePath dest_path2 = profile_manager->user_data_dir().Append( FILE_PATH_LITERAL("New Profile 2")); - FilePath dest_path3 = profile_manager->user_data_dir().Append( + base::FilePath dest_path3 = profile_manager->user_data_dir().Append( FILE_PATH_LITERAL("New Profile 3")); - FilePath dest_path4 = profile_manager->user_data_dir().Append( + base::FilePath dest_path4 = profile_manager->user_data_dir().Append( FILE_PATH_LITERAL("New Profile 4")); Profile* profile_home1 = profile_manager->GetProfile(dest_path1); @@ -721,8 +721,8 @@ IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, std::vector<GURL> urls; urls.push_back(ui_test_utils::GetTestUrl( - FilePath(FilePath::kCurrentDirectory), - FilePath(FILE_PATH_LITERAL("title1.html")))); + base::FilePath(base::FilePath::kCurrentDirectory), + base::FilePath(FILE_PATH_LITERAL("title1.html")))); SessionStartupPref pref_urls(SessionStartupPref::URLS); pref_urls.urls = urls; @@ -790,11 +790,11 @@ IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, ProfilesLaunchedAfterCrash) { ProfileManager* profile_manager = g_browser_process->profile_manager(); // Create 3 profiles. - FilePath dest_path1 = profile_manager->user_data_dir().Append( + base::FilePath dest_path1 = profile_manager->user_data_dir().Append( FILE_PATH_LITERAL("New Profile 1")); - FilePath dest_path2 = profile_manager->user_data_dir().Append( + base::FilePath dest_path2 = profile_manager->user_data_dir().Append( FILE_PATH_LITERAL("New Profile 2")); - FilePath dest_path3 = profile_manager->user_data_dir().Append( + base::FilePath dest_path3 = profile_manager->user_data_dir().Append( FILE_PATH_LITERAL("New Profile 3")); Profile* profile_home = profile_manager->GetProfile(dest_path1); @@ -813,8 +813,8 @@ IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, ProfilesLaunchedAfterCrash) { std::vector<GURL> urls; urls.push_back(ui_test_utils::GetTestUrl( - FilePath(FilePath::kCurrentDirectory), - FilePath(FILE_PATH_LITERAL("title1.html")))); + base::FilePath(base::FilePath::kCurrentDirectory), + base::FilePath(FILE_PATH_LITERAL("title1.html")))); SessionStartupPref pref_urls(SessionStartupPref::URLS); pref_urls.urls = urls; diff --git a/chrome/browser/ui/startup/startup_browser_creator_impl.cc b/chrome/browser/ui/startup/startup_browser_creator_impl.cc index 0c087d0..89e2a0c 100644 --- a/chrome/browser/ui/startup/startup_browser_creator_impl.cc +++ b/chrome/browser/ui/startup/startup_browser_creator_impl.cc @@ -293,7 +293,7 @@ GURL GetWelcomePageURL() { } // namespace internals StartupBrowserCreatorImpl::StartupBrowserCreatorImpl( - const FilePath& cur_dir, + const base::FilePath& cur_dir, const CommandLine& command_line, chrome::startup::IsFirstRun is_first_run) : cur_dir_(cur_dir), @@ -304,7 +304,7 @@ StartupBrowserCreatorImpl::StartupBrowserCreatorImpl( } StartupBrowserCreatorImpl::StartupBrowserCreatorImpl( - const FilePath& cur_dir, + const base::FilePath& cur_dir, const CommandLine& command_line, StartupBrowserCreator* browser_creator, chrome::startup::IsFirstRun is_first_run) diff --git a/chrome/browser/ui/startup/startup_browser_creator_interactive_uitest.cc b/chrome/browser/ui/startup/startup_browser_creator_interactive_uitest.cc index 3871955..9b906ae 100644 --- a/chrome/browser/ui/startup/startup_browser_creator_interactive_uitest.cc +++ b/chrome/browser/ui/startup/startup_browser_creator_interactive_uitest.cc @@ -50,8 +50,8 @@ IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, LastUsedProfileActivated) { SessionStartupPref pref_urls(SessionStartupPref::URLS); pref_urls.urls.push_back(ui_test_utils::GetTestUrl( - FilePath(FilePath::kCurrentDirectory), - FilePath(FILE_PATH_LITERAL("title1.html")))); + base::FilePath(base::FilePath::kCurrentDirectory), + base::FilePath(FILE_PATH_LITERAL("title1.html")))); SessionStartupPref::SetStartupPref(profile_1, pref_urls); SessionStartupPref::SetStartupPref(profile_2, pref_urls); SessionStartupPref::SetStartupPref(profile_3, pref_urls); diff --git a/chrome/browser/ui/sync/one_click_signin_helper_unittest.cc b/chrome/browser/ui/sync/one_click_signin_helper_unittest.cc index 398ba58..2c0f777 100644 --- a/chrome/browser/ui/sync/one_click_signin_helper_unittest.cc +++ b/chrome/browser/ui/sync/one_click_signin_helper_unittest.cc @@ -755,7 +755,7 @@ TEST_F(OneClickSigninHelperIOTest, CanOfferOnIOThreadEmailNotAllowed) { TEST_F(OneClickSigninHelperIOTest, CanOfferOnIOThreadEmailAlreadyUsed) { ProfileInfoCache* cache = testing_profile_manager_.profile_info_cache(); - const FilePath& user_data_dir = cache->GetUserDataDir(); + const base::FilePath& user_data_dir = cache->GetUserDataDir(); cache->AddProfileToCache(user_data_dir.Append(FILE_PATH_LITERAL("user")), UTF8ToUTF16("user"), UTF8ToUTF16("user@gmail.com"), 0, false); diff --git a/chrome/browser/ui/tab_contents/tab_contents_iterator_unittest.cc b/chrome/browser/ui/tab_contents/tab_contents_iterator_unittest.cc index c92f12d..b6307b7 100644 --- a/chrome/browser/ui/tab_contents/tab_contents_iterator_unittest.cc +++ b/chrome/browser/ui/tab_contents/tab_contents_iterator_unittest.cc @@ -192,7 +192,7 @@ TEST_F(BrowserListTest, MAYBE_AttemptRestart) { TestingBrowserProcess::GetGlobal(); testing_browser_process->SetLocalState(&testing_pref_service); ASSERT_TRUE(g_browser_process->local_state()); - ProfileManager* profile_manager = new ProfileManager(FilePath()); + ProfileManager* profile_manager = new ProfileManager(base::FilePath()); testing_browser_process->SetProfileManager(profile_manager); browser::AttemptRestart(); diff --git a/chrome/browser/ui/tabs/tab_strip_model_unittest.cc b/chrome/browser/ui/tabs/tab_strip_model_unittest.cc index 22441a5..0a0b962 100644 --- a/chrome/browser/ui/tabs/tab_strip_model_unittest.cc +++ b/chrome/browser/ui/tabs/tab_strip_model_unittest.cc @@ -1707,9 +1707,9 @@ TEST_F(TabStripModelTest, Apps) { typedef MockTabStripModelObserver::State State; #if defined(OS_WIN) - FilePath path(FILE_PATH_LITERAL("c:\\foo")); + base::FilePath path(FILE_PATH_LITERAL("c:\\foo")); #elif defined(OS_POSIX) - FilePath path(FILE_PATH_LITERAL("/foo")); + base::FilePath path(FILE_PATH_LITERAL("/foo")); #endif DictionaryValue manifest; diff --git a/chrome/browser/ui/views/app_list/app_list_controller_win.cc b/chrome/browser/ui/views/app_list/app_list_controller_win.cc index 710bfe2..26e373b 100644 --- a/chrome/browser/ui/views/app_list/app_list_controller_win.cc +++ b/chrome/browser/ui/views/app_list/app_list_controller_win.cc @@ -84,7 +84,7 @@ string16 GetAppModelId() { // The AppModelId should be the same for all profiles in a user data directory // but different for different user data directories, so base it on the // initial profile in the current user data directory. - FilePath initial_profile_path; + base::FilePath initial_profile_path; CommandLine* command_line = CommandLine::ForCurrentProcess(); if (command_line->HasSwitch(switches::kUserDataDir)) { initial_profile_path = @@ -172,7 +172,7 @@ class AppListController : public ProfileInfoCacheObserver { // Update the profile path stored in local prefs, load it (if not already // loaded), and show the app list. - void SetProfilePath(const FilePath& profile_file_path); + void SetProfilePath(const base::FilePath& profile_file_path); void DismissAppList(); void AppListClosing(); @@ -182,14 +182,14 @@ class AppListController : public ProfileInfoCacheObserver { // TODO(koz): Split the responsibility for tracking profiles into a // platform-independent class. // Overidden from ProfileInfoCacheObserver. - void OnProfileAdded(const FilePath& profilePath) OVERRIDE {} + void OnProfileAdded(const base::FilePath& profilePath) OVERRIDE {} // We need to watch for profile removal to keep kAppListProfile updated. - void OnProfileWillBeRemoved(const FilePath& profile_path) OVERRIDE; - void OnProfileWasRemoved(const FilePath& profile_path, + void OnProfileWillBeRemoved(const base::FilePath& profile_path) OVERRIDE; + void OnProfileWasRemoved(const base::FilePath& profile_path, const string16& profile_name) OVERRIDE {} - void OnProfileNameChanged(const FilePath& profile_path, + void OnProfileNameChanged(const base::FilePath& profile_path, const string16& profile_name) OVERRIDE {} - void OnProfileAvatarChanged(const FilePath& profile_path) OVERRIDE {} + void OnProfileAvatarChanged(const base::FilePath& profile_path) OVERRIDE {} void OnBeginExtensionInstall(Profile* profile, const std::string& extension_id, @@ -201,7 +201,7 @@ class AppListController : public ProfileInfoCacheObserver { private: // Loads a profile asynchronously and calls OnProfileLoaded() when done. - void LoadProfileAsync(const FilePath& profile_file_path); + void LoadProfileAsync(const base::FilePath& profile_file_path); // Callback for asynchronous profile load. void OnProfileLoaded(int profile_load_sequence_id, @@ -380,7 +380,8 @@ AppListController::AppListController() profile_manager->GetProfileInfoCache().AddObserver(this); } -void AppListController::OnProfileWillBeRemoved(const FilePath& profile_path) { +void AppListController::OnProfileWillBeRemoved( + const base::FilePath& profile_path) { // If the profile the app list uses just got deleted, reset it to the last // used profile. PrefService* local_state = g_browser_process->local_state(); @@ -392,7 +393,8 @@ void AppListController::OnProfileWillBeRemoved(const FilePath& profile_path) { } } -void AppListController::SetProfilePath(const FilePath& profile_file_path) { +void AppListController::SetProfilePath( + const base::FilePath& profile_file_path) { g_browser_process->local_state()->SetString( prefs::kAppListProfile, profile_file_path.BaseName().MaybeAsASCII()); @@ -407,7 +409,8 @@ void AppListController::SetProfilePath(const FilePath& profile_file_path) { ShowAppList(profile); } -void AppListController::LoadProfileAsync(const FilePath& profile_file_path) { +void AppListController::LoadProfileAsync( + const base::FilePath& profile_file_path) { DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); // Invalidate any pending profile path loads. @@ -720,7 +723,7 @@ void AppListController::UpdateArrowPositionAndAnchorPoint( } string16 AppListController::GetAppListIconPath() { - FilePath icon_path; + base::FilePath icon_path; if (!PathService::Get(base::FILE_EXE, &icon_path)) { NOTREACHED(); return string16(); @@ -774,13 +777,14 @@ void AppListController::CheckTaskbarOrViewHasFocus() { // are other tasks running (also on the FILE thread) which fiddle with shortcut // icons (ShellIntegration::MigrateWin7ShortcutsOnPath). Having different // threads fiddle with the same shortcuts could cause race issues. -void CheckAppListTaskbarShortcutOnFileThread(const FilePath& user_data_dir, - const string16& app_model_id) { +void CheckAppListTaskbarShortcutOnFileThread( + const base::FilePath& user_data_dir, + const string16& app_model_id) { DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::FILE)); const string16 shortcut_name = l10n_util::GetStringUTF16( IDS_APP_LIST_SHORTCUT_NAME); - const FilePath shortcut_path(user_data_dir.Append(shortcut_name) + const base::FilePath shortcut_path(user_data_dir.Append(shortcut_name) .AddExtension(installer::kLnkExt)); const bool should_show = CommandLine::ForCurrentProcess()->HasSwitch( @@ -789,7 +793,7 @@ void CheckAppListTaskbarShortcutOnFileThread(const FilePath& user_data_dir, // This will not reshow a shortcut if it has been unpinned manually by the // user, as that will not delete the shortcut file. if (should_show && !file_util::PathExists(shortcut_path)) { - FilePath chrome_exe; + base::FilePath chrome_exe; if (!PathService::Get(base::FILE_EXE, &chrome_exe)) { NOTREACHED(); return; @@ -835,7 +839,7 @@ void InitAppList(Profile* profile) { static bool checked_shortcut = false; if (!checked_shortcut) { checked_shortcut = true; - FilePath user_data_dir( + base::FilePath user_data_dir( g_browser_process->profile_manager()->user_data_dir()); content::BrowserThread::PostTask( content::BrowserThread::FILE, FROM_HERE, @@ -860,7 +864,7 @@ void ShowAppList(Profile* profile) { g_app_list_controller.Get().ShowAppList(profile); } -void SetAppListProfile(const FilePath& profile_file_path) { +void SetAppListProfile(const base::FilePath& profile_file_path) { g_app_list_controller.Get().SetProfilePath(profile_file_path); } diff --git a/chrome/browser/ui/views/avatar_menu_button_browsertest.cc b/chrome/browser/ui/views/avatar_menu_button_browsertest.cc index 4ec9e01..ca14d6e 100644 --- a/chrome/browser/ui/views/avatar_menu_button_browsertest.cc +++ b/chrome/browser/ui/views/avatar_menu_button_browsertest.cc @@ -18,7 +18,7 @@ void CreateTestingProfile() { ProfileManager* profile_manager = g_browser_process->profile_manager(); EXPECT_EQ(1u, profile_manager->GetNumberOfProfiles()); - FilePath path; + base::FilePath path; PathService::Get(chrome::DIR_USER_DATA, &path); path = path.AppendASCII("test_profile"); if (!file_util::PathExists(path)) diff --git a/chrome/browser/ui/views/chrome_to_mobile_bubble_view.cc b/chrome/browser/ui/views/chrome_to_mobile_bubble_view.cc index bff870e..111cef9 100644 --- a/chrome/browser/ui/views/chrome_to_mobile_bubble_view.cc +++ b/chrome/browser/ui/views/chrome_to_mobile_bubble_view.cc @@ -152,7 +152,7 @@ void ChromeToMobileBubbleView::ButtonPressed(views::Button* sender, HandleButtonPressed(sender); } -void ChromeToMobileBubbleView::SnapshotGenerated(const FilePath& path, +void ChromeToMobileBubbleView::SnapshotGenerated(const base::FilePath& path, int64 bytes) { snapshot_path_ = path; if (bytes > 0) { @@ -337,7 +337,8 @@ void ChromeToMobileBubbleView::Send() { const DictionaryValue* mobile = NULL; if (mobiles->GetDictionary(selected_index, &mobile)) { - FilePath snapshot = send_copy_->checked() ? snapshot_path_ : FilePath(); + base::FilePath snapshot = + send_copy_->checked() ? snapshot_path_ : base::FilePath(); service_->SendToMobile(mobile, snapshot, browser_, weak_ptr_factory_.GetWeakPtr()); } else { diff --git a/chrome/browser/ui/views/chrome_to_mobile_bubble_view.h b/chrome/browser/ui/views/chrome_to_mobile_bubble_view.h index 2dae2fe..787cde4 100644 --- a/chrome/browser/ui/views/chrome_to_mobile_bubble_view.h +++ b/chrome/browser/ui/views/chrome_to_mobile_bubble_view.h @@ -58,7 +58,8 @@ class ChromeToMobileBubbleView : public views::BubbleDelegateView, virtual void LinkClicked(views::Link* source, int event_flags) OVERRIDE; // ChromeToMobileService::Observer methods. - virtual void SnapshotGenerated(const FilePath& path, int64 bytes) OVERRIDE; + virtual void SnapshotGenerated( + const base::FilePath& path, int64 bytes) OVERRIDE; virtual void OnSendComplete(bool success) OVERRIDE; protected: @@ -89,7 +90,7 @@ class ChromeToMobileBubbleView : public views::BubbleDelegateView, std::vector<views::RadioButton*> radio_buttons_; // The file path for the MHTML page snapshot. - FilePath snapshot_path_; + base::FilePath snapshot_path_; views::Checkbox* send_copy_; views::TextButton* send_; diff --git a/chrome/browser/ui/views/download/download_item_view.cc b/chrome/browser/ui/views/download/download_item_view.cc index 41950f8..a99c7cb 100644 --- a/chrome/browser/ui/views/download/download_item_view.cc +++ b/chrome/browser/ui/views/download/download_item_view.cc @@ -852,7 +852,7 @@ void DownloadItemView::LoadIcon() { } void DownloadItemView::LoadIconIfItemPathChanged() { - FilePath current_download_path = download()->GetUserVerifiedFilePath(); + base::FilePath current_download_path = download()->GetUserVerifiedFilePath(); if (last_download_item_path_ == current_download_path) return; diff --git a/chrome/browser/ui/views/download/download_item_view.h b/chrome/browser/ui/views/download/download_item_view.h index 5086d58..545988b 100644 --- a/chrome/browser/ui/views/download/download_item_view.h +++ b/chrome/browser/ui/views/download/download_item_view.h @@ -324,7 +324,7 @@ class DownloadItemView : public views::ButtonListener, // The icon loaded in the download shelf is based on the file path of the // item. Store the path used, so that we can detect a change in the path // and reload the icon. - FilePath last_download_item_path_; + base::FilePath last_download_item_path_; DISALLOW_COPY_AND_ASSIGN(DownloadItemView); }; diff --git a/chrome/browser/ui/views/external_tab_container_win.cc b/chrome/browser/ui/views/external_tab_container_win.cc index c47941f..be5510a 100644 --- a/chrome/browser/ui/views/external_tab_container_win.cc +++ b/chrome/browser/ui/views/external_tab_container_win.cc @@ -793,7 +793,7 @@ void ExternalTabContainerWin::RunFileChooser( void ExternalTabContainerWin::EnumerateDirectory(WebContents* tab, int request_id, - const FilePath& path) { + const base::FilePath& path) { FileSelectHelper::EnumerateDirectory(tab, request_id, path); } @@ -848,7 +848,7 @@ void ExternalTabContainerWin::RequestMediaAccessPermission( bool ExternalTabContainerWin::RequestPpapiBrokerPermission( WebContents* web_contents, const GURL& url, - const FilePath& plugin_path, + const base::FilePath& plugin_path, const base::Callback<void(bool)>& callback) { PepperBrokerInfoBarDelegate::Create(web_contents, url, plugin_path, callback); return true; diff --git a/chrome/browser/ui/views/external_tab_container_win.h b/chrome/browser/ui/views/external_tab_container_win.h index 9d93c26..babc1ae 100644 --- a/chrome/browser/ui/views/external_tab_container_win.h +++ b/chrome/browser/ui/views/external_tab_container_win.h @@ -154,7 +154,7 @@ class ExternalTabContainerWin : public ExternalTabContainer, const content::FileChooserParams& params) OVERRIDE; virtual void EnumerateDirectory(content::WebContents* tab, int request_id, - const FilePath& path) OVERRIDE; + const base::FilePath& path) OVERRIDE; virtual void JSOutOfMemory(content::WebContents* tab); virtual void RegisterProtocolHandler(content::WebContents* tab, const std::string& protocol, @@ -183,7 +183,7 @@ class ExternalTabContainerWin : public ExternalTabContainer, virtual bool RequestPpapiBrokerPermission( content::WebContents* web_contents, const GURL& url, - const FilePath& plugin_path, + const base::FilePath& plugin_path, const base::Callback<void(bool)>& callback) OVERRIDE; void RegisterRenderViewHost(content::RenderViewHost* render_view_host); diff --git a/chrome/browser/ui/views/find_bar_controller_browsertest.cc b/chrome/browser/ui/views/find_bar_controller_browsertest.cc index ba15272..9d65b95 100644 --- a/chrome/browser/ui/views/find_bar_controller_browsertest.cc +++ b/chrome/browser/ui/views/find_bar_controller_browsertest.cc @@ -21,8 +21,8 @@ namespace { const char kSimple[] = "simple.html"; GURL GetURL(const std::string& filename) { - return ui_test_utils::GetTestUrl(FilePath().AppendASCII("find_in_page"), - FilePath().AppendASCII(filename)); + return ui_test_utils::GetTestUrl(base::FilePath().AppendASCII("find_in_page"), + base::FilePath().AppendASCII(filename)); } class FindBarControllerTest : public InProcessBrowserTest { diff --git a/chrome/browser/ui/views/select_file_dialog_extension.cc b/chrome/browser/ui/views/select_file_dialog_extension.cc index f106b45..894dee3 100644 --- a/chrome/browser/ui/views/select_file_dialog_extension.cc +++ b/chrome/browser/ui/views/select_file_dialog_extension.cc @@ -243,10 +243,10 @@ bool SelectFileDialogExtension::HasMultipleFileTypeChoicesImpl() { void SelectFileDialogExtension::SelectFileImpl( Type type, const string16& title, - const FilePath& default_path, + const base::FilePath& default_path, const FileTypeInfo* file_types, int file_type_index, - const FilePath::StringType& default_extension, + const base::FilePath::StringType& default_extension, gfx::NativeWindow owner_window, void* params) { if (owner_window_) { @@ -310,7 +310,7 @@ void SelectFileDialogExtension::SelectFileImpl( return; } - FilePath default_dialog_path; + base::FilePath default_dialog_path; const PrefService* pref_service = profile_->GetPrefs(); @@ -321,10 +321,10 @@ void SelectFileDialogExtension::SelectFileImpl( default_dialog_path = default_path; } - FilePath virtual_path; + base::FilePath virtual_path; if (file_manager_util::ConvertFileToRelativeFileSystemPath( profile_, kFileBrowserDomain, default_dialog_path, &virtual_path)) { - virtual_path = FilePath("/").Append(virtual_path); + virtual_path = base::FilePath("/").Append(virtual_path); } else { virtual_path = default_dialog_path.BaseName(); } diff --git a/chrome/browser/ui/views/select_file_dialog_extension.h b/chrome/browser/ui/views/select_file_dialog_extension.h index b7db17e..7503f1b 100644 --- a/chrome/browser/ui/views/select_file_dialog_extension.h +++ b/chrome/browser/ui/views/select_file_dialog_extension.h @@ -58,14 +58,15 @@ class SelectFileDialogExtension protected: // SelectFileDialog implementation. - virtual void SelectFileImpl(Type type, - const string16& title, - const FilePath& default_path, - const FileTypeInfo* file_types, - int file_type_index, - const FilePath::StringType& default_extension, - gfx::NativeWindow owning_window, - void* params) OVERRIDE; + virtual void SelectFileImpl( + Type type, + const string16& title, + const base::FilePath& default_path, + const FileTypeInfo* file_types, + int file_type_index, + const base::FilePath::StringType& default_extension, + gfx::NativeWindow owning_window, + void* params) OVERRIDE; private: friend class SelectFileDialogExtensionBrowserTest; diff --git a/chrome/browser/ui/views/select_file_dialog_extension_browsertest.cc b/chrome/browser/ui/views/select_file_dialog_extension_browsertest.cc index 5c82d8d..8cda2ca 100644 --- a/chrome/browser/ui/views/select_file_dialog_extension_browsertest.cc +++ b/chrome/browser/ui/views/select_file_dialog_extension_browsertest.cc @@ -43,11 +43,11 @@ class MockSelectFileDialogListener : public ui::SelectFileDialog::Listener { bool file_selected() const { return file_selected_; } bool canceled() const { return canceled_; } - FilePath path() const { return path_; } + base::FilePath path() const { return path_; } void* params() const { return params_; } // ui::SelectFileDialog::Listener implementation. - virtual void FileSelected(const FilePath& path, + virtual void FileSelected(const base::FilePath& path, int index, void* params) OVERRIDE { file_selected_ = true; @@ -61,7 +61,7 @@ class MockSelectFileDialogListener : public ui::SelectFileDialog::Listener { FileSelected(selected_file_info.local_path, index, params); } virtual void MultiFilesSelected( - const std::vector<FilePath>& files, void* params) OVERRIDE {} + const std::vector<base::FilePath>& files, void* params) OVERRIDE {} virtual void FileSelectionCanceled(void* params) OVERRIDE { canceled_ = true; params_ = params; @@ -70,7 +70,7 @@ class MockSelectFileDialogListener : public ui::SelectFileDialog::Listener { private: bool file_selected_; bool canceled_; - FilePath path_; + base::FilePath path_; void* params_; DISALLOW_COPY_AND_ASSIGN(MockSelectFileDialogListener); @@ -92,7 +92,7 @@ class SelectFileDialogExtensionBrowserTest : public ExtensionBrowserTest { // We have to provide at least one mount point. // File manager looks for "Downloads" mount point, so use this name. - FilePath tmp_path; + base::FilePath tmp_path; PathService::Get(base::DIR_TEMP, &tmp_path); ASSERT_TRUE(tmp_dir_.CreateUniqueTempDirUnderPath(tmp_path)); downloads_dir_ = tmp_dir_.path().Append("Downloads"); @@ -114,7 +114,7 @@ class SelectFileDialogExtensionBrowserTest : public ExtensionBrowserTest { } // Creates a file system mount point for a directory. - void AddMountPoint(const FilePath& path) { + void AddMountPoint(const base::FilePath& path) { std::string mount_point_name = path.BaseName().AsUTF8Unsafe(); fileapi::ExternalMountPoints* mount_points = BrowserContext::GetMountPoints(browser()->profile()); @@ -135,7 +135,7 @@ class SelectFileDialogExtensionBrowserTest : public ExtensionBrowserTest { } void OpenDialog(ui::SelectFileDialog::Type dialog_type, - const FilePath& file_path, + const base::FilePath& file_path, const gfx::NativeWindow& owning_window, const std::string& additional_message) { // Spawn a dialog to open a file. The dialog will signal that it is ready @@ -182,7 +182,7 @@ class SelectFileDialogExtensionBrowserTest : public ExtensionBrowserTest { // some dialog type. second_dialog_->SelectFile(ui::SelectFileDialog::SELECT_OPEN_FILE, string16() /* title */, - FilePath() /* default_path */, + base::FilePath() /* default_path */, NULL /* file_types */, 0 /* file_type_index */, FILE_PATH_LITERAL("") /* default_extension */, @@ -221,7 +221,7 @@ class SelectFileDialogExtensionBrowserTest : public ExtensionBrowserTest { scoped_refptr<SelectFileDialogExtension> second_dialog_; base::ScopedTempDir tmp_dir_; - FilePath downloads_dir_; + base::FilePath downloads_dir_; }; IN_PROC_BROWSER_TEST_F(SelectFileDialogExtensionBrowserTest, CreateAndDestroy) { @@ -250,9 +250,9 @@ IN_PROC_BROWSER_TEST_F(SelectFileDialogExtensionBrowserTest, gfx::NativeWindow owning_window = browser()->window()->GetNativeWindow(); - // FilePath() for default path. + // base::FilePath() for default path. ASSERT_NO_FATAL_FAILURE(OpenDialog(ui::SelectFileDialog::SELECT_OPEN_FILE, - FilePath(), owning_window, "")); + base::FilePath(), owning_window, "")); // Press cancel button. CloseDialog(DIALOG_BTN_CANCEL, owning_window); @@ -267,7 +267,8 @@ IN_PROC_BROWSER_TEST_F(SelectFileDialogExtensionBrowserTest, SelectFileAndOpen) { AddMountPoint(downloads_dir_); - FilePath test_file = downloads_dir_.AppendASCII("file_manager_test.html"); + base::FilePath test_file = + downloads_dir_.AppendASCII("file_manager_test.html"); // Create an empty file to give us something to select. FILE* fp = file_util::OpenFile(test_file, "w"); @@ -299,7 +300,8 @@ IN_PROC_BROWSER_TEST_F(SelectFileDialogExtensionBrowserTest, SelectFileAndSave) { AddMountPoint(downloads_dir_); - FilePath test_file = downloads_dir_.AppendASCII("file_manager_test.html"); + base::FilePath test_file = + downloads_dir_.AppendASCII("file_manager_test.html"); gfx::NativeWindow owning_window = browser()->window()->GetNativeWindow(); @@ -329,7 +331,7 @@ IN_PROC_BROWSER_TEST_F(SelectFileDialogExtensionBrowserTest, gfx::NativeWindow owning_window = browser()->window()->GetNativeWindow(); ASSERT_NO_FATAL_FAILURE(OpenDialog(ui::SelectFileDialog::SELECT_OPEN_FILE, - FilePath(), owning_window, "")); + base::FilePath(), owning_window, "")); // Open a singleton tab in background. chrome::NavigateParams p(browser(), GURL("www.google.com"), @@ -354,7 +356,7 @@ IN_PROC_BROWSER_TEST_F(SelectFileDialogExtensionBrowserTest, gfx::NativeWindow owning_window = browser()->window()->GetNativeWindow(); ASSERT_NO_FATAL_FAILURE(OpenDialog(ui::SelectFileDialog::SELECT_OPEN_FILE, - FilePath(), owning_window, "")); + base::FilePath(), owning_window, "")); TryOpeningSecondDialog(owning_window); diff --git a/chrome/browser/ui/views/select_file_dialog_extension_unittest.cc b/chrome/browser/ui/views/select_file_dialog_extension_unittest.cc index c6b672c..4b589d9 100644 --- a/chrome/browser/ui/views/select_file_dialog_extension_unittest.cc +++ b/chrome/browser/ui/views/select_file_dialog_extension_unittest.cc @@ -39,7 +39,7 @@ class SelfDeletingClient : public ui::SelectFileDialog::Listener { SelectFileDialogExtension* dialog() const { return dialog_.get(); } // ui::SelectFileDialog::Listener implementation - virtual void FileSelected(const FilePath& path, + virtual void FileSelected(const base::FilePath& path, int index, void* params) OVERRIDE { delete this; } diff --git a/chrome/browser/ui/views/ssl_client_certificate_selector_browsertest.cc b/chrome/browser/ui/views/ssl_client_certificate_selector_browsertest.cc index b826912..8bb9c44 100644 --- a/chrome/browser/ui/views/ssl_client_certificate_selector_browsertest.cc +++ b/chrome/browser/ui/views/ssl_client_certificate_selector_browsertest.cc @@ -39,7 +39,7 @@ class SSLClientCertificateSelectorTest : public InProcessBrowserTest { } virtual void SetUpInProcessBrowserTestFixture() { - FilePath certs_dir = net::GetTestCertsDirectory(); + base::FilePath certs_dir = net::GetTestCertsDirectory(); mit_davidben_cert_ = net::ImportCertFromFile(certs_dir, "mit.davidben.der"); ASSERT_NE(static_cast<net::X509Certificate*>(NULL), mit_davidben_cert_); diff --git a/chrome/browser/ui/views/user_data_dir_dialog_view.cc b/chrome/browser/ui/views/user_data_dir_dialog_view.cc index 8689f42..138db16 100644 --- a/chrome/browser/ui/views/user_data_dir_dialog_view.cc +++ b/chrome/browser/ui/views/user_data_dir_dialog_view.cc @@ -14,10 +14,11 @@ #include "ui/views/controls/message_box_view.h" #include "ui/views/widget/widget.h" -UserDataDirDialogView::UserDataDirDialogView(const FilePath& user_data_dir) - : ALLOW_THIS_IN_INITIALIZER_LIST( - select_file_dialog_(ui::SelectFileDialog::Create( - this, new ChromeSelectFilePolicy(NULL)))), +UserDataDirDialogView::UserDataDirDialogView( + const base::FilePath& user_data_dir) + : ALLOW_THIS_IN_INITIALIZER_LIST(select_file_dialog_( + ui::SelectFileDialog::Create(this, + new ChromeSelectFilePolicy(NULL)))), is_blocking_(true) { const int kDialogWidth = 400; views::MessageBoxView::InitParams params( @@ -58,10 +59,12 @@ bool UserDataDirDialogView::Accept() { // Directory picker. HWND owning_hwnd = GetAncestor(message_box_view_->GetWidget()->GetNativeView(), GA_ROOT); - select_file_dialog_->SelectFile(ui::SelectFileDialog::SELECT_FOLDER, + select_file_dialog_->SelectFile( + ui::SelectFileDialog::SELECT_FOLDER, l10n_util::GetStringUTF16( - IDS_CANT_WRITE_USER_DIRECTORY_CHOOSE_DIRECTORY_BUTTON), FilePath(), - NULL, 0, FilePath::StringType(), owning_hwnd, NULL); + IDS_CANT_WRITE_USER_DIRECTORY_CHOOSE_DIRECTORY_BUTTON), + base::FilePath(), NULL, 0, base::FilePath::StringType(), owning_hwnd, + NULL); return false; } @@ -88,7 +91,7 @@ bool UserDataDirDialogView::Dispatch(const base::NativeEvent& msg) { return is_blocking_; } -void UserDataDirDialogView::FileSelected(const FilePath& path, +void UserDataDirDialogView::FileSelected(const base::FilePath& path, int index, void* params) { user_data_dir_ = path; @@ -100,7 +103,7 @@ void UserDataDirDialogView::FileSelectionCanceled(void* params) { namespace chrome { -FilePath ShowUserDataDirDialog(const FilePath& user_data_dir) { +base::FilePath ShowUserDataDirDialog(const base::FilePath& user_data_dir) { DCHECK_EQ(MessageLoop::TYPE_UI, MessageLoop::current()->type()); // When the window closes, it will delete itself. UserDataDirDialogView* dialog = new UserDataDirDialogView(user_data_dir); diff --git a/chrome/browser/ui/views/user_data_dir_dialog_view.h b/chrome/browser/ui/views/user_data_dir_dialog_view.h index 46f3454..2902c6e8 100644 --- a/chrome/browser/ui/views/user_data_dir_dialog_view.h +++ b/chrome/browser/ui/views/user_data_dir_dialog_view.h @@ -22,10 +22,10 @@ class UserDataDirDialogView : public views::DialogDelegate, public MessageLoopForUI::Dispatcher, public ui::SelectFileDialog::Listener { public: - explicit UserDataDirDialogView(const FilePath& user_data_dir); + explicit UserDataDirDialogView(const base::FilePath& user_data_dir); virtual ~UserDataDirDialogView(); - FilePath user_data_dir() const { return user_data_dir_; } + base::FilePath user_data_dir() const { return user_data_dir_; } // Overridden from views::DialogDelegate: virtual string16 GetDialogButtonLabel(ui::DialogButton button) const OVERRIDE; @@ -43,14 +43,14 @@ class UserDataDirDialogView : public views::DialogDelegate, virtual bool Dispatch(const base::NativeEvent& msg) OVERRIDE; // Overridden from SelectFileDialog::Listener: - virtual void FileSelected(const FilePath& path, + virtual void FileSelected(const base::FilePath& path, int index, void* params) OVERRIDE; virtual void FileSelectionCanceled(void* params) OVERRIDE; private: // Empty until the user picks a directory. - FilePath user_data_dir_; + base::FilePath user_data_dir_; views::MessageBoxView* message_box_view_; scoped_refptr<ui::SelectFileDialog> select_file_dialog_; diff --git a/chrome/browser/ui/web_applications/web_app_ui.cc b/chrome/browser/ui/web_applications/web_app_ui.cc index a41fbfb..783b49b 100644 --- a/chrome/browser/ui/web_applications/web_app_ui.cc +++ b/chrome/browser/ui/web_applications/web_app_ui.cc @@ -104,13 +104,13 @@ class UpdateShortcutWorker : public content::NotificationObserver { ShellIntegration::ShortcutInfo shortcut_info_; // Our copy of profile path. - FilePath profile_path_; + base::FilePath profile_path_; // File name of shortcut/ico file based on app title. - FilePath file_name_; + base::FilePath file_name_; // Existing shortcuts. - std::vector<FilePath> shortcut_files_; + std::vector<base::FilePath> shortcut_files_; DISALLOW_COPY_AND_ASSIGN(UpdateShortcutWorker); }; @@ -231,7 +231,7 @@ void UpdateShortcutWorker::CheckExistingShortcuts() { for (int i = 0; i < arraysize(locations); ++i) { locations[i].use_this_location = false; - FilePath path; + base::FilePath path; if (!PathService::Get(locations[i].location_id, &path)) { NOTREACHED(); continue; @@ -240,7 +240,7 @@ void UpdateShortcutWorker::CheckExistingShortcuts() { if (locations[i].sub_dir != NULL) path = path.Append(locations[i].sub_dir); - FilePath shortcut_file = path.Append(file_name_). + base::FilePath shortcut_file = path.Append(file_name_). ReplaceExtension(FILE_PATH_LITERAL(".lnk")); if (file_util::PathExists(shortcut_file)) { locations[i].use_this_location = true; @@ -258,7 +258,7 @@ void UpdateShortcutWorker::UpdateShortcuts() { void UpdateShortcutWorker::UpdateShortcutsOnFileThread() { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); - FilePath web_app_path = web_app::GetWebAppDataDirectory( + base::FilePath web_app_path = web_app::GetWebAppDataDirectory( profile_path_, shortcut_info_.extension_id, shortcut_info_.url); // Ensure web_app_path exists. web_app_path could be missing for a legacy @@ -269,7 +269,7 @@ void UpdateShortcutWorker::UpdateShortcutsOnFileThread() { return; } - FilePath icon_file = web_app_path.Append(file_name_).ReplaceExtension( + base::FilePath icon_file = web_app_path.Append(file_name_).ReplaceExtension( FILE_PATH_LITERAL(".ico")); web_app::internals::CheckAndSaveIcon(icon_file, *shortcut_info_.favicon.ToSkBitmap()); diff --git a/chrome/browser/ui/webui/about_ui.cc b/chrome/browser/ui/webui/about_ui.cc index 46806d6..0d133b8 100644 --- a/chrome/browser/ui/webui/about_ui.cc +++ b/chrome/browser/ui/webui/about_ui.cc @@ -173,7 +173,7 @@ class ChromeOSTermsHandler const chromeos::StartupCustomizationDocument* customization = chromeos::StartupCustomizationDocument::GetInstance(); if (customization->IsReady()) { - FilePath oem_eula_file_path; + base::FilePath oem_eula_file_path; if (net::FileURLToFilePath(GURL(customization->GetEULAPage(locale_)), &oem_eula_file_path)) { if (!file_util::ReadFileToString(oem_eula_file_path, &contents_)) { @@ -184,10 +184,11 @@ class ChromeOSTermsHandler } else { std::string file_path = StringPrintf(chrome::kEULAPathFormat, locale_.c_str()); - if (!file_util::ReadFileToString(FilePath(file_path), &contents_)) { + if (!file_util::ReadFileToString(base::FilePath(file_path), &contents_)) { // No EULA for given language - try en-US as default. file_path = StringPrintf(chrome::kEULAPathFormat, "en-US"); - if (!file_util::ReadFileToString(FilePath(file_path), &contents_)) { + if (!file_util::ReadFileToString(base::FilePath(file_path), + &contents_)) { // File with EULA not found, ResponseOnUIThread will load EULA from // resources if contents_ is empty. contents_.clear(); @@ -746,7 +747,7 @@ std::string AboutLinuxProxyConfig() { l10n_util::GetStringUTF8(IDS_ABOUT_LINUX_PROXY_CONFIG_TITLE)); data.append("<style>body { max-width: 70ex; padding: 2ex 5ex; }</style>"); AppendBody(&data); - FilePath binary = CommandLine::ForCurrentProcess()->GetProgram(); + base::FilePath binary = CommandLine::ForCurrentProcess()->GetProgram(); data.append(l10n_util::GetStringFUTF8( IDS_ABOUT_LINUX_PROXY_CONFIG_BODY, l10n_util::GetStringUTF16(IDS_PRODUCT_NAME), diff --git a/chrome/browser/ui/webui/bidi_checker_web_ui_test.cc b/chrome/browser/ui/webui/bidi_checker_web_ui_test.cc index 237ac26..86995cf 100644 --- a/chrome/browser/ui/webui/bidi_checker_web_ui_test.cc +++ b/chrome/browser/ui/webui/bidi_checker_web_ui_test.cc @@ -33,12 +33,12 @@ #include <gtk/gtk.h> #endif -static const FilePath::CharType* kWebUIBidiCheckerLibraryJS = +static const base::FilePath::CharType* kWebUIBidiCheckerLibraryJS = FILE_PATH_LITERAL("third_party/bidichecker/bidichecker_packaged.js"); namespace { -FilePath WebUIBidiCheckerLibraryJSPath() { - FilePath src_root; +base::FilePath WebUIBidiCheckerLibraryJSPath() { + base::FilePath src_root; if (!PathService::Get(base::DIR_SOURCE_ROOT, &src_root)) LOG(ERROR) << "Couldn't find source root"; return src_root.Append(kWebUIBidiCheckerLibraryJS); @@ -77,7 +77,7 @@ void ReloadLocaleResources(const std::string& new_locale) { } // namespace -static const FilePath::CharType* kBidiCheckerTestsJS = +static const base::FilePath::CharType* kBidiCheckerTestsJS = FILE_PATH_LITERAL("bidichecker_tests.js"); void WebUIBidiCheckerBrowserTest::SetUp() { @@ -104,7 +104,7 @@ WebUIBidiCheckerBrowserTest::WebUIBidiCheckerBrowserTest() {} void WebUIBidiCheckerBrowserTest::SetUpInProcessBrowserTestFixture() { WebUIBrowserTest::SetUpInProcessBrowserTestFixture(); WebUIBrowserTest::AddLibrary(WebUIBidiCheckerLibraryJSPath()); - WebUIBrowserTest::AddLibrary(FilePath(kBidiCheckerTestsJS)); + WebUIBrowserTest::AddLibrary(base::FilePath(kBidiCheckerTestsJS)); } void WebUIBidiCheckerBrowserTest::RunBidiCheckerOnPage( @@ -127,7 +127,7 @@ void WebUIBidiCheckerBrowserTestRTL::RunBidiCheckerOnPage( void WebUIBidiCheckerBrowserTestRTL::SetUpOnMainThread() { WebUIBidiCheckerBrowserTest::SetUpOnMainThread(); - FilePath pak_path; + base::FilePath pak_path; app_locale_ = base::i18n::GetConfiguredLocale(); ASSERT_TRUE(PathService::Get(base::FILE_MODULE, &pak_path)); pak_path = pak_path.DirName(); @@ -149,7 +149,8 @@ void WebUIBidiCheckerBrowserTestRTL::CleanUpOnMainThread() { #endif base::i18n::SetICUDefaultLocale(app_locale_); - ResourceBundle::GetSharedInstance().OverrideLocalePakForTest(FilePath()); + ResourceBundle::GetSharedInstance().OverrideLocalePakForTest( + base::FilePath()); ReloadLocaleResources(app_locale_); } diff --git a/chrome/browser/ui/webui/bookmarks_ui_browsertest.cc b/chrome/browser/ui/webui/bookmarks_ui_browsertest.cc index 69c8f7a..3ac942d 100644 --- a/chrome/browser/ui/webui/bookmarks_ui_browsertest.cc +++ b/chrome/browser/ui/webui/bookmarks_ui_browsertest.cc @@ -63,8 +63,8 @@ IN_PROC_BROWSER_TEST_F(BookmarksTest, CommandOpensBookmarksTab) { IN_PROC_BROWSER_TEST_F(BookmarksTest, CommandAgainGoesBackToBookmarksTab) { ui_test_utils::NavigateToURL( browser(), - ui_test_utils::GetTestUrl(FilePath(), - FilePath().AppendASCII("simple.html"))); + ui_test_utils::GetTestUrl(base::FilePath(), + base::FilePath().AppendASCII("simple.html"))); ASSERT_EQ(1, browser()->tab_strip_model()->count()); // Bring up the bookmarks manager tab. diff --git a/chrome/browser/ui/webui/chromeos/drive_internals_ui.cc b/chrome/browser/ui/webui/chromeos/drive_internals_ui.cc index a92f26a..1c5fe67 100644 --- a/chrome/browser/ui/webui/chromeos/drive_internals_ui.cc +++ b/chrome/browser/ui/webui/chromeos/drive_internals_ui.cc @@ -54,12 +54,12 @@ namespace { // },...] // // The list is sorted by the path. -void GetGCacheContents(const FilePath& root_path, +void GetGCacheContents(const base::FilePath& root_path, base::ListValue* gcache_contents, base::DictionaryValue* gcache_summary) { using file_util::FileEnumerator; // Use this map to sort the result list by the path. - std::map<FilePath, DictionaryValue*> files; + std::map<base::FilePath, DictionaryValue*> files; const int options = (file_util::FileEnumerator::FILES | file_util::FileEnumerator::DIRECTORIES | @@ -67,7 +67,7 @@ void GetGCacheContents(const FilePath& root_path, FileEnumerator enumerator(root_path, true /* recursive */, options); int64 total_size = 0; - for (FilePath current = enumerator.Next(); !current.empty(); + for (base::FilePath current = enumerator.Next(); !current.empty(); current = enumerator.Next()) { FileEnumerator::FindInfo find_info; enumerator.GetFindInfo(&find_info); @@ -93,7 +93,7 @@ void GetGCacheContents(const FilePath& root_path, } // Convert |files| into |gcache_contents|. - for (std::map<FilePath, DictionaryValue*>::const_iterator + for (std::map<base::FilePath, DictionaryValue*>::const_iterator iter = files.begin(); iter != files.end(); ++iter) { gcache_contents->Append(iter->second); } @@ -102,7 +102,7 @@ void GetGCacheContents(const FilePath& root_path, } // Gets the available disk space for the path |home_path|. -void GetFreeDiskSpace(const FilePath& home_path, +void GetFreeDiskSpace(const base::FilePath& home_path, base::DictionaryValue* local_storage_summary) { DCHECK(!BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(local_storage_summary); @@ -112,7 +112,7 @@ void GetFreeDiskSpace(const FilePath& home_path, } // Formats |entry| into text. -std::string FormatEntry(const FilePath& path, +std::string FormatEntry(const base::FilePath& path, const drive::DriveEntryProto& entry) { using base::StringAppendF; using google_apis::util::FormatTimeAsString; @@ -213,12 +213,12 @@ class DriveInternalsWebUIHandler : public content::WebUIMessageHandler { base::DictionaryValue* cache_summary); // Called when GetEntryInfoByPath() is complete. - void OnGetEntryInfoByPath(const FilePath& path, + void OnGetEntryInfoByPath(const base::FilePath& path, drive::DriveFileError error, scoped_ptr<drive::DriveEntryProto> entry); // Called when ReadDirectoryByPath() is complete. - void OnReadDirectoryByPath(const FilePath& parent_path, + void OnReadDirectoryByPath(const base::FilePath& parent_path, drive::DriveFileError error, bool hide_hosted_documents, scoped_ptr<drive::DriveEntryProtoVector> entries); @@ -514,7 +514,7 @@ void DriveInternalsWebUIHandler::UpdateInFlightOperationsSection( void DriveInternalsWebUIHandler::UpdateGCacheContentsSection() { // Start updating the GCache contents section. Profile* profile = Profile::FromWebUI(web_ui()); - const FilePath root_path = + const base::FilePath root_path = drive::DriveCache::GetCacheRootPath(profile); base::ListValue* gcache_contents = new ListValue; base::DictionaryValue* gcache_summary = new DictionaryValue; @@ -541,7 +541,7 @@ void DriveInternalsWebUIHandler::UpdateFileSystemContentsSection( return; // Start rendering the file system tree as text. - const FilePath root_path = FilePath(drive::kDriveRootDirectory); + const base::FilePath root_path = base::FilePath(drive::kDriveRootDirectory); ++num_pending_reads_; system_service->file_system()->GetEntryInfoByPath( root_path, @@ -559,7 +559,7 @@ void DriveInternalsWebUIHandler::UpdateFileSystemContentsSection( void DriveInternalsWebUIHandler::UpdateLocalStorageUsageSection() { // Propagate the amount of local free space in bytes. - FilePath home_path; + base::FilePath home_path; if (PathService::Get(base::DIR_HOME, &home_path)) { base::DictionaryValue* local_storage_summary = new DictionaryValue; BrowserThread::PostBlockingPoolTaskAndReply( @@ -613,7 +613,7 @@ void DriveInternalsWebUIHandler::OnGetGCacheContents( } void DriveInternalsWebUIHandler::OnGetEntryInfoByPath( - const FilePath& path, + const base::FilePath& path, drive::DriveFileError error, scoped_ptr<drive::DriveEntryProto> entry) { --num_pending_reads_; @@ -625,7 +625,7 @@ void DriveInternalsWebUIHandler::OnGetEntryInfoByPath( } void DriveInternalsWebUIHandler::OnReadDirectoryByPath( - const FilePath& parent_path, + const base::FilePath& parent_path, drive::DriveFileError error, bool hide_hosted_documents, scoped_ptr<drive::DriveEntryProtoVector> entries) { @@ -636,8 +636,8 @@ void DriveInternalsWebUIHandler::OnReadDirectoryByPath( std::string file_system_as_text; for (size_t i = 0; i < entries->size(); ++i) { const drive::DriveEntryProto& entry = (*entries)[i]; - const FilePath current_path = parent_path.Append( - FilePath::FromUTF8Unsafe(entry.base_name())); + const base::FilePath current_path = parent_path.Append( + base::FilePath::FromUTF8Unsafe(entry.base_name())); file_system_as_text.append(FormatEntry(current_path, entry) + "\n"); diff --git a/chrome/browser/ui/webui/chromeos/imageburner/imageburner_ui.cc b/chrome/browser/ui/webui/chromeos/imageburner/imageburner_ui.cc index 62e9d84..9bbd3b4 100644 --- a/chrome/browser/ui/webui/chromeos/imageburner/imageburner_ui.cc +++ b/chrome/browser/ui/webui/chromeos/imageburner/imageburner_ui.cc @@ -223,10 +223,10 @@ class WebUIHandler // It may be called with NULL if there is a handler that has started burning, // and thus set the target paths. void HandleBurnImage(const ListValue* args) { - FilePath target_device_path; + base::FilePath target_device_path; ExtractTargetedDevicePath(*args, 0, &target_device_path); - FilePath target_file_path; + base::FilePath target_file_path; ExtractTargetedDevicePath(*args, 1, &target_file_path); burn_controller_->StartBurnImage(target_device_path, target_file_path); @@ -291,13 +291,13 @@ class WebUIHandler // device_path has to be previously created. void ExtractTargetedDevicePath(const ListValue& list_value, int index, - FilePath* device_path) { + base::FilePath* device_path) { const Value* list_member; std::string image_dest; if (list_value.Get(index, &list_member) && list_member->GetType() == Value::TYPE_STRING && list_member->GetAsString(&image_dest)) { - *device_path = FilePath(image_dest); + *device_path = base::FilePath(image_dest); } else { LOG(ERROR) << "Unable to get path string"; device_path->clear(); diff --git a/chrome/browser/ui/webui/downloads_dom_handler.cc b/chrome/browser/ui/webui/downloads_dom_handler.cc index a9e3ee5..209a9ab 100644 --- a/chrome/browser/ui/webui/downloads_dom_handler.cc +++ b/chrome/browser/ui/webui/downloads_dom_handler.cc @@ -125,7 +125,7 @@ DictionaryValue* CreateDownloadItemValue( "date_string", base::TimeFormatShortDate(download_item->GetStartTime())); file_value->SetInteger("id", download_item->GetId()); - FilePath download_path(download_item->GetTargetFilePath()); + base::FilePath download_path(download_item->GetTargetFilePath()); file_value->Set("file_path", base::CreateFilePathValue(download_path)); file_value->SetString("file_url", net::FilePathToFileURL(download_path).spec()); diff --git a/chrome/browser/ui/webui/downloads_dom_handler_browsertest.cc b/chrome/browser/ui/webui/downloads_dom_handler_browsertest.cc index b0edd52..e6c981e 100644 --- a/chrome/browser/ui/webui/downloads_dom_handler_browsertest.cc +++ b/chrome/browser/ui/webui/downloads_dom_handler_browsertest.cc @@ -144,8 +144,8 @@ IN_PROC_BROWSER_TEST_F(DownloadsDOMHandlerTest, url_chain.push_back(url); base::Time current(base::Time::Now()); download_manager()->CreateDownloadItem( - FilePath(FILE_PATH_LITERAL("/path/to/file")), - FilePath(FILE_PATH_LITERAL("/path/to/file")), + base::FilePath(FILE_PATH_LITERAL("/path/to/file")), + base::FilePath(FILE_PATH_LITERAL("/path/to/file")), url_chain, GURL(""), current, diff --git a/chrome/browser/ui/webui/extensions/extension_settings_handler.cc b/chrome/browser/ui/webui/extensions/extension_settings_handler.cc index f688818..b15ec70 100644 --- a/chrome/browser/ui/webui/extensions/extension_settings_handler.cc +++ b/chrome/browser/ui/webui/extensions/extension_settings_handler.cc @@ -411,14 +411,15 @@ void ExtensionSettingsHandler::RegisterMessages() { base::Unretained(this))); } -void ExtensionSettingsHandler::FileSelected(const FilePath& path, int index, +void ExtensionSettingsHandler::FileSelected(const base::FilePath& path, + int index, void* params) { - last_unpacked_directory_ = FilePath(path); + last_unpacked_directory_ = base::FilePath(path); extensions::UnpackedInstaller::Create(extension_service_)->Load(path); } void ExtensionSettingsHandler::MultiFilesSelected( - const std::vector<FilePath>& files, void* params) { + const std::vector<base::FilePath>& files, void* params) { NOTREACHED(); } diff --git a/chrome/browser/ui/webui/extensions/install_extension_handler.cc b/chrome/browser/ui/webui/extensions/install_extension_handler.cc index 14c5c8c..c01b800 100644 --- a/chrome/browser/ui/webui/extensions/install_extension_handler.cc +++ b/chrome/browser/ui/webui/extensions/install_extension_handler.cc @@ -65,7 +65,7 @@ void InstallExtensionHandler::HandleStartDragMessage(const ListValue* args) { return; } - file_to_install_ = FilePath::FromWStringHack( + file_to_install_ = base::FilePath::FromWStringHack( UTF16ToWide(drop_data->filenames.front().path)); } diff --git a/chrome/browser/ui/webui/extensions/install_extension_handler.h b/chrome/browser/ui/webui/extensions/install_extension_handler.h index 5c32e7a..c029d9a 100644 --- a/chrome/browser/ui/webui/extensions/install_extension_handler.h +++ b/chrome/browser/ui/webui/extensions/install_extension_handler.h @@ -43,7 +43,7 @@ class InstallExtensionHandler : public content::WebUIMessageHandler { void HandleInstallMessage(const ListValue* args); // The extension that will be installed when HandleInstallMessage() is called. - FilePath file_to_install_; + base::FilePath file_to_install_; DISALLOW_COPY_AND_ASSIGN(InstallExtensionHandler); }; diff --git a/chrome/browser/ui/webui/extensions/pack_extension_handler.cc b/chrome/browser/ui/webui/extensions/pack_extension_handler.cc index 13d81c7..a69cd4d 100644 --- a/chrome/browser/ui/webui/extensions/pack_extension_handler.cc +++ b/chrome/browser/ui/webui/extensions/pack_extension_handler.cc @@ -64,8 +64,8 @@ void PackExtensionHandler::RegisterMessages() { base::Unretained(this))); } -void PackExtensionHandler::OnPackSuccess(const FilePath& crx_file, - const FilePath& pem_file) { +void PackExtensionHandler::OnPackSuccess(const base::FilePath& crx_file, + const base::FilePath& pem_file) { ListValue arguments; arguments.Append(Value::CreateStringValue( UTF16ToUTF8(extensions::PackExtensionJob::StandardSuccessMessage( @@ -92,7 +92,7 @@ void PackExtensionHandler::OnPackFailure( } } -void PackExtensionHandler::FileSelected(const FilePath& path, int index, +void PackExtensionHandler::FileSelected(const base::FilePath& path, int index, void* params) { ListValue results; results.Append(Value::CreateStringValue(path.value())); @@ -100,7 +100,7 @@ void PackExtensionHandler::FileSelected(const FilePath& path, int index, } void PackExtensionHandler::MultiFilesSelected( - const std::vector<FilePath>& files, void* params) { + const std::vector<base::FilePath>& files, void* params) { NOTREACHED(); } @@ -118,9 +118,10 @@ void PackExtensionHandler::HandlePackMessage(const ListValue* args) { int run_flags = static_cast<int>(flags_double); - FilePath root_directory = - FilePath::FromWStringHack(UTF8ToWide(extension_path_)); - FilePath key_file = FilePath::FromWStringHack(UTF8ToWide(private_key_path_)); + base::FilePath root_directory = + base::FilePath::FromWStringHack(UTF8ToWide(extension_path_)); + base::FilePath key_file = + base::FilePath::FromWStringHack(UTF8ToWide(private_key_path_)); if (root_directory.empty()) { if (extension_path_.empty()) { @@ -169,7 +170,7 @@ void PackExtensionHandler::HandleSelectFilePathMessage( } else if (operation == "pem") { select_title = l10n_util::GetStringUTF16( IDS_EXTENSION_PACK_DIALOG_SELECT_KEY); - info.extensions.push_back(std::vector<FilePath::StringType>()); + info.extensions.push_back(std::vector<base::FilePath::StringType>()); info.extensions.front().push_back(FILE_PATH_LITERAL("pem")); info.extension_description_overrides.push_back( l10n_util::GetStringUTF16( @@ -183,7 +184,7 @@ void PackExtensionHandler::HandleSelectFilePathMessage( load_extension_dialog_ = ui::SelectFileDialog::Create( this, new ChromeSelectFilePolicy(web_ui()->GetWebContents())); load_extension_dialog_->SelectFile( - type, select_title, FilePath(), &info, file_type_index, + type, select_title, base::FilePath(), &info, file_type_index, FILE_PATH_LITERAL(""), web_ui()->GetWebContents()->GetView()->GetTopLevelNativeWindow(), NULL); diff --git a/chrome/browser/ui/webui/extensions/pack_extension_handler.h b/chrome/browser/ui/webui/extensions/pack_extension_handler.h index 986ec21..183a766 100644 --- a/chrome/browser/ui/webui/extensions/pack_extension_handler.h +++ b/chrome/browser/ui/webui/extensions/pack_extension_handler.h @@ -31,18 +31,18 @@ class PackExtensionHandler : public content::WebUIMessageHandler, virtual void RegisterMessages() OVERRIDE; // ExtensionPackJob::Client implementation. - virtual void OnPackSuccess(const FilePath& crx_file, - const FilePath& key_file) OVERRIDE; + virtual void OnPackSuccess(const base::FilePath& crx_file, + const base::FilePath& key_file) OVERRIDE; virtual void OnPackFailure(const std::string& error, extensions::ExtensionCreator::ErrorType) OVERRIDE; private: // SelectFileDialog::Listener implementation. - virtual void FileSelected(const FilePath& path, + virtual void FileSelected(const base::FilePath& path, int index, void* params) OVERRIDE; virtual void MultiFilesSelected( - const std::vector<FilePath>& files, void* params) OVERRIDE; + const std::vector<base::FilePath>& files, void* params) OVERRIDE; virtual void FileSelectionCanceled(void* params) OVERRIDE {} // JavaScript callback to start packing an extension. diff --git a/chrome/browser/ui/webui/feedback_ui.cc b/chrome/browser/ui/webui/feedback_ui.cc index e3c7c77..9199d8e 100644 --- a/chrome/browser/ui/webui/feedback_ui.cc +++ b/chrome/browser/ui/webui/feedback_ui.cc @@ -263,7 +263,8 @@ class FeedbackHandler : public WebUIMessageHandler, void RefreshSavedScreenshotsCallback( std::vector<std::string>* saved_screenshots); void GetMostRecentScreenshotsDrive( - const FilePath& filepath, std::vector<std::string>* saved_screenshots, + const base::FilePath& filepath, + std::vector<std::string>* saved_screenshots, size_t max_saved, base::Closure callback); #endif void HandleSendReport(const ListValue* args); @@ -556,7 +557,7 @@ void FeedbackHandler::HandleRefreshCurrentScreenshot(const ListValue*) { #if defined(OS_CHROMEOS) void FeedbackHandler::HandleRefreshSavedScreenshots(const ListValue*) { std::vector<std::string>* saved_screenshots = new std::vector<std::string>; - FilePath filepath = DownloadPrefs::FromBrowserContext( + base::FilePath filepath = DownloadPrefs::FromBrowserContext( tab_->GetBrowserContext())->DownloadPath(); base::Closure refresh_callback = base::Bind( &FeedbackHandler::RefreshSavedScreenshotsCallback, @@ -582,7 +583,7 @@ void FeedbackHandler::RefreshSavedScreenshotsCallback( } void FeedbackHandler::GetMostRecentScreenshotsDrive( - const FilePath& filepath, std::vector<std::string>* saved_screenshots, + const base::FilePath& filepath, std::vector<std::string>* saved_screenshots, size_t max_saved, base::Closure callback) { drive::DriveFileSystemInterface* file_system = drive::DriveSystemServiceFactory::GetForProfile( @@ -633,7 +634,7 @@ void FeedbackHandler::HandleSendReport(const ListValue* list_value) { // If we have an attached file, we'll still have more data in the list. if (i != list_value->end()) { (*i++)->GetAsString(&attached_filename); - if (FilePath::IsSeparator(attached_filename[0])) { + if (base::FilePath::IsSeparator(attached_filename[0])) { // We have an attached filepath, not filename, hence we need read this // this file in chrome. We won't have any file data, skip over it. i++; @@ -738,7 +739,7 @@ FeedbackUI::FeedbackUI(content::WebUI* web_ui) #if defined(OS_CHROMEOS) // static void FeedbackUI::GetMostRecentScreenshots( - const FilePath& filepath, + const base::FilePath& filepath, std::vector<std::string>* saved_screenshots, size_t max_saved) { std::string pattern = @@ -747,7 +748,7 @@ void FeedbackUI::GetMostRecentScreenshots( file_util::FileEnumerator screenshots(filepath, false, file_util::FileEnumerator::FILES, pattern); - FilePath screenshot = screenshots.Next(); + base::FilePath screenshot = screenshots.Next(); std::vector<std::string> screenshot_filepaths; while (!screenshot.empty()) { diff --git a/chrome/browser/ui/webui/feedback_ui_unittest.cc b/chrome/browser/ui/webui/feedback_ui_unittest.cc index ee185a8..6bcf7d3 100644 --- a/chrome/browser/ui/webui/feedback_ui_unittest.cc +++ b/chrome/browser/ui/webui/feedback_ui_unittest.cc @@ -16,7 +16,7 @@ namespace { // Simple function to create a file with |filename|. -void CreateFile(const FilePath& filename) { +void CreateFile(const base::FilePath& filename) { FILE* fp = file_util::OpenFile(filename, "w"); ASSERT_TRUE(fp != NULL); file_util::CloseFile(fp); @@ -40,7 +40,7 @@ class FeedbackUITest : public testing::Test { } protected: void CreateScreenshotFile(const std::string& timestamp) { - FilePath filepath = temp_dir_.path().Append( + base::FilePath filepath = temp_dir_.path().Append( FILE_PATH_LITERAL(GetScreenshotFilename(timestamp))); ASSERT_NO_FATAL_FAILURE(CreateFile(filepath)); } @@ -54,7 +54,8 @@ class FeedbackUITest : public testing::Test { TEST_F(FeedbackUITest, GetMostRecentScreenshotsNoScreenShot) { // Create a random file. - FilePath filepath = temp_dir_.path().Append(FILE_PATH_LITERAL("garbage.png")); + base::FilePath filepath = + temp_dir_.path().Append(FILE_PATH_LITERAL("garbage.png")); ASSERT_NO_FATAL_FAILURE(CreateFile(filepath)); // Expect getting no screenshot. FeedbackUI::GetMostRecentScreenshots( diff --git a/chrome/browser/ui/webui/fileicon_source.cc b/chrome/browser/ui/webui/fileicon_source.cc index 07a68a4..af8135a 100644 --- a/chrome/browser/ui/webui/fileicon_source.cc +++ b/chrome/browser/ui/webui/fileicon_source.cc @@ -40,7 +40,7 @@ const char kScaleFactor[] = "scale"; // a FilePath and return the resulting |file_path| and |query|. The path // portion may have been encoded using encodeURIComponent(). void GetFilePathAndQuery(const std::string& url, - FilePath* file_path, + base::FilePath* file_path, std::string* query) { // We receive the url with chrome://fileicon/ stripped but GURL expects it. const GURL gurl("chrome://fileicon/" + url); @@ -52,10 +52,10 @@ void GetFilePathAndQuery(const std::string& url, // The path we receive has the wrong slashes and escaping for what we need; // this only appears to matter for getting icons from .exe files. std::replace(path.begin(), path.end(), '/', '\\'); - *file_path = FilePath(UTF8ToWide(path)); + *file_path = base::FilePath(UTF8ToWide(path)); #elif defined(OS_POSIX) // The correct encoding on Linux may not actually be UTF8. - *file_path = FilePath(path); + *file_path = base::FilePath(path); #endif query->assign(gurl.query()); } @@ -101,7 +101,7 @@ FileIconSource::FileIconSource() {} FileIconSource::~FileIconSource() {} void FileIconSource::FetchFileIcon( - const FilePath& path, + const base::FilePath& path, ui::ScaleFactor scale_factor, IconLoader::IconSize icon_size, const content::URLDataSource::GotDataCallback& callback) { @@ -139,7 +139,7 @@ void FileIconSource::StartDataRequest( bool is_incognito, const content::URLDataSource::GotDataCallback& callback) { std::string query; - FilePath file_path; + base::FilePath file_path; ui::ScaleFactor scale_factor; IconLoader::IconSize icon_size; GetFilePathAndQuery(url_path, &file_path, &query); diff --git a/chrome/browser/ui/webui/fileicon_source.h b/chrome/browser/ui/webui/fileicon_source.h index 679b3f3..ce8e54c 100644 --- a/chrome/browser/ui/webui/fileicon_source.h +++ b/chrome/browser/ui/webui/fileicon_source.h @@ -38,7 +38,7 @@ class FileIconSource : public content::URLDataSource { // function is called to perform the actual fetch. Declared as virtual for // testing. virtual void FetchFileIcon( - const FilePath& path, + const base::FilePath& path, ui::ScaleFactor scale_factor, IconLoader::IconSize icon_size, const content::URLDataSource::GotDataCallback& callback); diff --git a/chrome/browser/ui/webui/fileicon_source_unittest.cc b/chrome/browser/ui/webui/fileicon_source_unittest.cc index 6c0e644..de99aed 100644 --- a/chrome/browser/ui/webui/fileicon_source_unittest.cc +++ b/chrome/browser/ui/webui/fileicon_source_unittest.cc @@ -21,7 +21,7 @@ class TestFileIconSource : public FileIconSource { explicit TestFileIconSource() {} MOCK_METHOD4(FetchFileIcon, - void(const FilePath& path, + void(const base::FilePath& path, ui::ScaleFactor scale_factor, IconLoader::IconSize icon_size, const content::URLDataSource::GotDataCallback& callback)); @@ -48,7 +48,7 @@ class FileIconSourceTest : public testing::Test { const struct FetchFileIconExpectation { const char* request_path; - const FilePath::CharType* unescaped_path; + const base::FilePath::CharType* unescaped_path; ui::ScaleFactor scale_factor; IconLoader::IconSize size; } kBasicExpectations[] = { @@ -128,9 +128,10 @@ TEST_F(FileIconSourceTest, FileIconSource_Parse) { scoped_ptr<TestFileIconSource> source(CreateFileIconSource()); content::URLDataSource::GotDataCallback callback; EXPECT_CALL(*source.get(), - FetchFileIcon(FilePath(kBasicExpectations[i].unescaped_path), - kBasicExpectations[i].scale_factor, - kBasicExpectations[i].size, CallbackIsNull())); + FetchFileIcon( + base::FilePath(kBasicExpectations[i].unescaped_path), + kBasicExpectations[i].scale_factor, + kBasicExpectations[i].size, CallbackIsNull())); source->StartDataRequest(kBasicExpectations[i].request_path, false, callback); } diff --git a/chrome/browser/ui/webui/nacl_ui.cc b/chrome/browser/ui/webui/nacl_ui.cc index f59c029..6afc235 100644 --- a/chrome/browser/ui/webui/nacl_ui.cc +++ b/chrome/browser/ui/webui/nacl_ui.cc @@ -231,7 +231,7 @@ void NaClDOMHandler::PopulatePageInformation(DictionaryValue* naclInfo) { AddLineBreak(list.get()); // Obtain the version of the PNaCl translator. - FilePath pnacl_path; + base::FilePath pnacl_path; bool got_path = PathService::Get(chrome::DIR_PNACL_COMPONENT, &pnacl_path); // The PathService may return an empty string if PNaCl is not yet installed. // However, do not trust that the path returned by the PathService exists. diff --git a/chrome/browser/ui/webui/net_export_ui.cc b/chrome/browser/ui/webui/net_export_ui.cc index 9dfc785..01e9a22 100644 --- a/chrome/browser/ui/webui/net_export_ui.cc +++ b/chrome/browser/ui/webui/net_export_ui.cc @@ -72,7 +72,7 @@ class NetExportMessageHandler NetLogTempFile::Command command); // Returns the path to the file which has NetLog data. - static FilePath GetNetLogFileName(NetLogTempFile* net_log_temp_file); + static base::FilePath GetNetLogFileName(NetLogTempFile* net_log_temp_file); // Send state/file information from NetLogTempFile. static void SendExportNetLogInfo( @@ -80,7 +80,7 @@ class NetExportMessageHandler NetLogTempFile* net_log_temp_file); // Send NetLog data via email. This runs on UI thread. - static void SendEmail(const FilePath& file_to_send); + static void SendEmail(const base::FilePath& file_to_send); // Call NetExportView.onExportNetLogInfoChanged JavsScript function in the // renderer, passing in |arg|. Takes ownership of |arg|. @@ -182,10 +182,10 @@ void NetExportMessageHandler::ProcessNetLogCommand( } // static -FilePath NetExportMessageHandler::GetNetLogFileName( +base::FilePath NetExportMessageHandler::GetNetLogFileName( NetLogTempFile* net_log_temp_file) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE_USER_BLOCKING)); - FilePath net_export_file_path; + base::FilePath net_export_file_path; net_log_temp_file->GetFilePath(&net_export_file_path); return net_export_file_path; } @@ -207,7 +207,7 @@ void NetExportMessageHandler::SendExportNetLogInfo( } // static -void NetExportMessageHandler::SendEmail(const FilePath& file_to_send) { +void NetExportMessageHandler::SendEmail(const base::FilePath& file_to_send) { if (file_to_send.empty()) return; DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); @@ -218,7 +218,7 @@ void NetExportMessageHandler::SendEmail(const FilePath& file_to_send) { std::string title = "Issue number: "; std::string body = "Please add some informative text about the network issues."; - FilePath::StringType file_to_attach(file_to_send.value()); + base::FilePath::StringType file_to_attach(file_to_send.value()); chrome::android::SendEmail( UTF8ToUTF16(email), UTF8ToUTF16(subject), UTF8ToUTF16(body), UTF8ToUTF16(title), UTF8ToUTF16(file_to_attach)); diff --git a/chrome/browser/ui/webui/net_internals/net_internals_ui.cc b/chrome/browser/ui/webui/net_internals/net_internals_ui.cc index a002b7c..16bc518 100644 --- a/chrome/browser/ui/webui/net_internals/net_internals_ui.cc +++ b/chrome/browser/ui/webui/net_internals/net_internals_ui.cc @@ -243,7 +243,8 @@ class DebugLogFileHelper { typedef base::Callback<void(PassPlatformFile pass_platform_file, bool created, PlatformFileError error, - const FilePath& file_path)> DebugLogFileCallback; + const base::FilePath& file_path)> + DebugLogFileCallback; DebugLogFileHelper() : file_handle_(base::kInvalidPlatformFileValue), @@ -254,8 +255,8 @@ class DebugLogFileHelper { ~DebugLogFileHelper() { } - void DoWork(const FilePath& fileshelf) { - const FilePath::CharType kLogFileName[] = + void DoWork(const base::FilePath& fileshelf) { + const base::FilePath::CharType kLogFileName[] = FILE_PATH_LITERAL("debug-log.tgz"); file_path_ = fileshelf.Append(kLogFileName); @@ -278,7 +279,7 @@ class DebugLogFileHelper { PlatformFile file_handle_; bool created_; PlatformFileError error_; - FilePath file_path_; + base::FilePath file_path_; DISALLOW_COPY_AND_ASSIGN(DebugLogFileHelper); }; @@ -289,7 +290,7 @@ class DebugLogFileHelper { // Called once StoreDebugLogs is complete. Takes two parameters: // - log_path: where the log file was saved in the case of success; // - succeeded: was the log file saved successfully. -typedef base::Callback<void(const FilePath& log_path, +typedef base::Callback<void(const base::FilePath& log_path, bool succeded)> StoreDebugLogsCallback; // Closes file handle, so, should be called on the WorkerPool thread. @@ -300,7 +301,7 @@ void CloseDebugLogFile(PassPlatformFile pass_platform_file) { // Closes file handle and deletes debug log file, so, should be called // on the WorkerPool thread. void CloseAndDeleteDebugLogFile(PassPlatformFile pass_platform_file, - const FilePath& file_path) { + const base::FilePath& file_path) { CloseDebugLogFile(pass_platform_file); file_util::Delete(file_path, false); } @@ -310,7 +311,7 @@ void CloseAndDeleteDebugLogFile(PassPlatformFile pass_platform_file, // |callback|. void WriteDebugLogToFileCompleted(const StoreDebugLogsCallback& callback, PassPlatformFile pass_platform_file, - const FilePath& file_path, + const base::FilePath& file_path, bool succeeded) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); if (!succeeded) { @@ -332,7 +333,7 @@ void WriteDebugLogToFile(const StoreDebugLogsCallback& callback, PassPlatformFile pass_platform_file, bool created, PlatformFileError error, - const FilePath& file_path) { + const base::FilePath& file_path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); if (!created) { LOG(ERROR) << @@ -358,7 +359,7 @@ void WriteDebugLogToFile(const StoreDebugLogsCallback& callback, void StoreDebugLogs(const StoreDebugLogsCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!callback.is_null()); - const FilePath fileshelf = download_util::GetDefaultDownloadDirectory(); + const base::FilePath fileshelf = download_util::GetDefaultDownloadDirectory(); DebugLogFileHelper* helper = new DebugLogFileHelper(); bool posted = base::WorkerPool::PostTaskAndReply(FROM_HERE, base::Bind(&DebugLogFileHelper::DoWork, @@ -403,7 +404,8 @@ class NetInternalsMessageHandler void OnGetSystemLog(const ListValue* list); void OnImportONCFile(const ListValue* list); void OnStoreDebugLogs(const ListValue* list); - void OnStoreDebugLogsCompleted(const FilePath& log_path, bool succeeded); + void OnStoreDebugLogsCompleted(const base::FilePath& log_path, + bool succeeded); void OnSetNetworkDebugMode(const ListValue* list); void OnSetNetworkDebugModeCompleted(const std::string& subsystem, bool succeeded); @@ -1536,7 +1538,7 @@ void NetInternalsMessageHandler::OnStoreDebugLogs(const ListValue* list) { } void NetInternalsMessageHandler::OnStoreDebugLogsCompleted( - const FilePath& log_path, bool succeeded) { + const base::FilePath& log_path, bool succeeded) { std::string status; if (succeeded) status = "Created log file: " + log_path.BaseName().AsUTF8Unsafe(); diff --git a/chrome/browser/ui/webui/ntp/most_visited_browsertest.cc b/chrome/browser/ui/webui/ntp/most_visited_browsertest.cc index 846d82c..522acaf 100644 --- a/chrome/browser/ui/webui/ntp/most_visited_browsertest.cc +++ b/chrome/browser/ui/webui/ntp/most_visited_browsertest.cc @@ -14,7 +14,7 @@ class MostVisitedWebUITest : public WebUIBrowserTest { virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { WebUIBrowserTest::SetUpInProcessBrowserTestFixture(); - AddLibrary(FilePath(FILE_PATH_LITERAL("most_visited_page_test.js"))); + AddLibrary(base::FilePath(FILE_PATH_LITERAL("most_visited_page_test.js"))); } virtual void SetUpOnMainThread() OVERRIDE { diff --git a/chrome/browser/ui/webui/options/advanced_options_utils_win.cc b/chrome/browser/ui/webui/options/advanced_options_utils_win.cc index 032469f..607dc32 100644 --- a/chrome/browser/ui/webui/options/advanced_options_utils_win.cc +++ b/chrome/browser/ui/webui/options/advanced_options_utils_win.cc @@ -29,15 +29,15 @@ void OpenConnectionDialogCallback() { // Using rundll32 seems better than LaunchConnectionDialog which causes a // new dialog to be made for each call. rundll32 uses the same global // dialog and it seems to share with the shortcut in control panel. - FilePath rundll32; + base::FilePath rundll32; PathService::Get(base::DIR_SYSTEM, &rundll32); rundll32 = rundll32.AppendASCII("rundll32.exe"); - FilePath shell32dll; + base::FilePath shell32dll; PathService::Get(base::DIR_SYSTEM, &shell32dll); shell32dll = shell32dll.AppendASCII("shell32.dll"); - FilePath inetcpl; + base::FilePath inetcpl; PathService::Get(base::DIR_SYSTEM, &inetcpl); inetcpl = inetcpl.AppendASCII("inetcpl.cpl,,4"); diff --git a/chrome/browser/ui/webui/options/advanced_options_utils_x11.cc b/chrome/browser/ui/webui/options/advanced_options_utils_x11.cc index dc9a632..48dd6c9 100644 --- a/chrome/browser/ui/webui/options/advanced_options_utils_x11.cc +++ b/chrome/browser/ui/webui/options/advanced_options_utils_x11.cc @@ -81,7 +81,7 @@ bool StartProxyConfigUtil(const char* command[]) { Tokenize(path, ":", &paths); bool found = false; for (size_t i = 0; i < paths.size(); ++i) { - FilePath file(paths[i]); + base::FilePath file(paths[i]); if (file_util::PathExists(file.Append(command[0]))) { found = true; break; diff --git a/chrome/browser/ui/webui/options/browser_options_handler.cc b/chrome/browser/ui/webui/options/browser_options_handler.cc index 538a92d..ed4503e 100644 --- a/chrome/browser/ui/webui/options/browser_options_handler.cc +++ b/chrome/browser/ui/webui/options/browser_options_handler.cc @@ -695,7 +695,7 @@ void BrowserOptionsHandler::InitializePage() { // static void BrowserOptionsHandler::CheckAutoLaunch( base::WeakPtr<BrowserOptionsHandler> weak_this, - const FilePath& profile_path) { + const base::FilePath& profile_path) { #if defined(OS_WIN) DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); @@ -712,7 +712,7 @@ void BrowserOptionsHandler::CheckAutoLaunch( auto_launch_util::AutoStartRequested( profile_path.BaseName().value(), true, // Window requested. - FilePath()))); + base::FilePath()))); #endif } @@ -946,10 +946,11 @@ void BrowserOptionsHandler::ToggleAutoLaunch(const ListValue* args) { Profile* profile = Profile::FromWebUI(web_ui()); content::BrowserThread::PostTask( content::BrowserThread::FILE, FROM_HERE, - enable ? base::Bind(&auto_launch_util::EnableForegroundStartAtLogin, - profile->GetPath().BaseName().value(), FilePath()) : - base::Bind(&auto_launch_util::DisableForegroundStartAtLogin, - profile->GetPath().BaseName().value())); + enable ? + base::Bind(&auto_launch_util::EnableForegroundStartAtLogin, + profile->GetPath().BaseName().value(), base::FilePath()) : + base::Bind(&auto_launch_util::DisableForegroundStartAtLogin, + profile->GetPath().BaseName().value())); #endif // OS_WIN } @@ -957,13 +958,13 @@ scoped_ptr<ListValue> BrowserOptionsHandler::GetProfilesInfoList() { ProfileInfoCache& cache = g_browser_process->profile_manager()->GetProfileInfoCache(); scoped_ptr<ListValue> profile_info_list(new ListValue); - FilePath current_profile_path = + base::FilePath current_profile_path = web_ui()->GetWebContents()->GetBrowserContext()->GetPath(); for (size_t i = 0, e = cache.GetNumberOfProfiles(); i < e; ++i) { DictionaryValue* profile_value = new DictionaryValue(); profile_value->SetString("name", cache.GetNameOfProfileAtIndex(i)); - FilePath profile_path = cache.GetPathOfProfileAtIndex(i); + base::FilePath profile_path = cache.GetPathOfProfileAtIndex(i); profile_value->Set("filePath", base::CreateFilePathValue(profile_path)); profile_value->SetBoolean("isCurrentProfile", profile_path == current_profile_path); @@ -1138,7 +1139,7 @@ void BrowserOptionsHandler::HandleSelectDownloadLocation( web_ui()->GetWebContents()->GetView()->GetTopLevelNativeWindow(), NULL); } -void BrowserOptionsHandler::FileSelected(const FilePath& path, int index, +void BrowserOptionsHandler::FileSelected(const base::FilePath& path, int index, void* params) { content::RecordAction(UserMetricsAction("Options_SetDownloadDirectory")); PrefService* pref_service = Profile::FromWebUI(web_ui())->GetPrefs(); diff --git a/chrome/browser/ui/webui/options/browser_options_handler.h b/chrome/browser/ui/webui/options/browser_options_handler.h index 3824c99..b7a285f 100644 --- a/chrome/browser/ui/webui/options/browser_options_handler.h +++ b/chrome/browser/ui/webui/options/browser_options_handler.h @@ -77,7 +77,7 @@ class BrowserOptionsHandler void OnCloudPrintPrefsChanged(); // SelectFileDialog::Listener implementation - virtual void FileSelected(const FilePath& path, + virtual void FileSelected(const base::FilePath& path, int index, void* params) OVERRIDE; @@ -105,7 +105,7 @@ class BrowserOptionsHandler // as a parameter to avoid the need to lock between this function and the // destructor. |profile_path| is the full path to the current profile. static void CheckAutoLaunch(base::WeakPtr<BrowserOptionsHandler> weak_this, - const FilePath& profile_path); + const base::FilePath& profile_path); // Sets up (on the UI thread) the necessary bindings for toggling auto-launch // (if the user is part of the auto-launch and makes sure the HTML UI knows diff --git a/chrome/browser/ui/webui/options/certificate_manager_handler.cc b/chrome/browser/ui/webui/options/certificate_manager_handler.cc index 50a578b..f7acf5a 100644 --- a/chrome/browser/ui/webui/options/certificate_manager_handler.cc +++ b/chrome/browser/ui/webui/options/certificate_manager_handler.cc @@ -183,10 +183,10 @@ class FileAccessProvider // parameter is the number of bytes written on success. typedef base::Callback<void(const int*, const int*)> WriteCallback; - CancelableTaskTracker::TaskId StartRead(const FilePath& path, + CancelableTaskTracker::TaskId StartRead(const base::FilePath& path, const ReadCallback& callback, CancelableTaskTracker* tracker); - CancelableTaskTracker::TaskId StartWrite(const FilePath& path, + CancelableTaskTracker::TaskId StartWrite(const base::FilePath& path, const std::string& data, const WriteCallback& callback, CancelableTaskTracker* tracker); @@ -197,19 +197,19 @@ class FileAccessProvider // Reads file at |path|. |saved_errno| is 0 on success or errno on failure. // When success, |data| has file content. - void DoRead(const FilePath& path, + void DoRead(const base::FilePath& path, int* saved_errno, std::string* data); // Writes data to file at |path|. |saved_errno| is 0 on success or errno on // failure. When success, |bytes_written| has number of bytes written. - void DoWrite(const FilePath& path, + void DoWrite(const base::FilePath& path, const std::string& data, int* saved_errno, int* bytes_written); }; CancelableTaskTracker::TaskId FileAccessProvider::StartRead( - const FilePath& path, + const base::FilePath& path, const ReadCallback& callback, CancelableTaskTracker* tracker) { // Owned by reply callback posted below. @@ -225,7 +225,7 @@ CancelableTaskTracker::TaskId FileAccessProvider::StartRead( } CancelableTaskTracker::TaskId FileAccessProvider::StartWrite( - const FilePath& path, + const base::FilePath& path, const std::string& data, const WriteCallback& callback, CancelableTaskTracker* tracker) { @@ -243,14 +243,14 @@ CancelableTaskTracker::TaskId FileAccessProvider::StartWrite( base::Owned(saved_errno), base::Owned(bytes_written))); } -void FileAccessProvider::DoRead(const FilePath& path, +void FileAccessProvider::DoRead(const base::FilePath& path, int* saved_errno, std::string* data) { bool success = file_util::ReadFileToString(path, data); *saved_errno = success ? 0 : errno; } -void FileAccessProvider::DoWrite(const FilePath& path, +void FileAccessProvider::DoWrite(const base::FilePath& path, const std::string& data, int* saved_errno, int* bytes_written) { @@ -467,7 +467,8 @@ void CertificateManagerHandler::CertificatesRefreshed() { VLOG(1) << "populating finished"; } -void CertificateManagerHandler::FileSelected(const FilePath& path, int index, +void CertificateManagerHandler::FileSelected(const base::FilePath& path, + int index, void* params) { switch (reinterpret_cast<intptr_t>(params)) { case EXPORT_PERSONAL_FILE_SELECTED: @@ -580,7 +581,7 @@ void CertificateManagerHandler::ExportPersonal(const ListValue* args) { this, new ChromeSelectFilePolicy(web_ui()->GetWebContents())); select_file_dialog_->SelectFile( ui::SelectFileDialog::SELECT_SAVEAS_FILE, string16(), - FilePath(), &file_type_info, 1, FILE_PATH_LITERAL("p12"), + base::FilePath(), &file_type_info, 1, FILE_PATH_LITERAL("p12"), GetParentWindow(), reinterpret_cast<void*>(EXPORT_PERSONAL_FILE_SELECTED)); } @@ -590,7 +591,7 @@ void CertificateManagerHandler::ExportAllPersonal(const ListValue* args) { } void CertificateManagerHandler::ExportPersonalFileSelected( - const FilePath& path) { + const base::FilePath& path) { file_path_ = path; web_ui()->CallJavascriptFunction( "CertificateManager.exportPersonalAskPassword"); @@ -671,13 +672,13 @@ void CertificateManagerHandler::StartImportPersonal(const ListValue* args) { this, new ChromeSelectFilePolicy(web_ui()->GetWebContents())); select_file_dialog_->SelectFile( ui::SelectFileDialog::SELECT_OPEN_FILE, string16(), - FilePath(), &file_type_info, 1, FILE_PATH_LITERAL("p12"), + base::FilePath(), &file_type_info, 1, FILE_PATH_LITERAL("p12"), GetParentWindow(), reinterpret_cast<void*>(IMPORT_PERSONAL_FILE_SELECTED)); } void CertificateManagerHandler::ImportPersonalFileSelected( - const FilePath& path) { + const base::FilePath& path) { file_path_ = path; web_ui()->CallJavascriptFunction( "CertificateManager.importPersonalAskPassword"); @@ -790,12 +791,13 @@ void CertificateManagerHandler::ImportServer(const ListValue* args) { ShowCertSelectFileDialog( select_file_dialog_.get(), ui::SelectFileDialog::SELECT_OPEN_FILE, - FilePath(), + base::FilePath(), GetParentWindow(), reinterpret_cast<void*>(IMPORT_SERVER_FILE_SELECTED)); } -void CertificateManagerHandler::ImportServerFileSelected(const FilePath& path) { +void CertificateManagerHandler::ImportServerFileSelected( + const base::FilePath& path) { file_path_ = path; file_access_provider_->StartRead( file_path_, @@ -848,12 +850,13 @@ void CertificateManagerHandler::ImportCA(const ListValue* args) { this, new ChromeSelectFilePolicy(web_ui()->GetWebContents())); ShowCertSelectFileDialog(select_file_dialog_.get(), ui::SelectFileDialog::SELECT_OPEN_FILE, - FilePath(), + base::FilePath(), GetParentWindow(), reinterpret_cast<void*>(IMPORT_CA_FILE_SELECTED)); } -void CertificateManagerHandler::ImportCAFileSelected(const FilePath& path) { +void CertificateManagerHandler::ImportCAFileSelected( + const base::FilePath& path) { file_path_ = path; file_access_provider_->StartRead( file_path_, diff --git a/chrome/browser/ui/webui/options/certificate_manager_handler.h b/chrome/browser/ui/webui/options/certificate_manager_handler.h index 83cce70..47de402 100644 --- a/chrome/browser/ui/webui/options/certificate_manager_handler.h +++ b/chrome/browser/ui/webui/options/certificate_manager_handler.h @@ -43,7 +43,7 @@ class CertificateManagerHandler virtual void CertificatesRefreshed() OVERRIDE; // SelectFileDialog::Listener implementation. - virtual void FileSelected(const FilePath& path, + virtual void FileSelected(const base::FilePath& path, int index, void* params) OVERRIDE; virtual void FileSelectionCanceled(void* params) OVERRIDE; @@ -79,7 +79,7 @@ class CertificateManagerHandler // 5. write finishes (or fails) -> ExportPersonalFileWritten void ExportPersonal(const base::ListValue* args); void ExportAllPersonal(const base::ListValue* args); - void ExportPersonalFileSelected(const FilePath& path); + void ExportPersonalFileSelected(const base::FilePath& path); void ExportPersonalPasswordSelected(const base::ListValue* args); void ExportPersonalSlotsUnlocked(); void ExportPersonalFileWritten(const int* write_errno, @@ -99,7 +99,7 @@ class CertificateManagerHandler // 6b. if import fails -> show error, ImportExportCleanup // TODO(mattm): allow retrying with different password void StartImportPersonal(const base::ListValue* args); - void ImportPersonalFileSelected(const FilePath& path); + void ImportPersonalFileSelected(const base::FilePath& path); void ImportPersonalPasswordSelected(const base::ListValue* args); void ImportPersonalFileRead(const int* read_errno, const std::string* data); void ImportPersonalSlotUnlocked(); @@ -111,7 +111,7 @@ class CertificateManagerHandler // 4a. if import succeeds -> ImportExportCleanup // 4b. if import fails -> show error, ImportExportCleanup void ImportServer(const base::ListValue* args); - void ImportServerFileSelected(const FilePath& path); + void ImportServerFileSelected(const base::FilePath& path); void ImportServerFileRead(const int* read_errno, const std::string* data); // Import Certificate Authorities from file. Sequence goes like: @@ -123,7 +123,7 @@ class CertificateManagerHandler // 5a. if import succeeds -> ImportExportCleanup // 5b. if import fails -> show error, ImportExportCleanup void ImportCA(const base::ListValue* args); - void ImportCAFileSelected(const FilePath& path); + void ImportCAFileSelected(const base::FilePath& path); void ImportCAFileRead(const int* read_errno, const std::string* data); void ImportCATrustSelected(const base::ListValue* args); @@ -165,7 +165,7 @@ class CertificateManagerHandler // For multi-step import or export processes, we need to store the path, // password, etc the user chose while we wait for them to enter a password, // wait for file to be read, etc. - FilePath file_path_; + base::FilePath file_path_; string16 password_; bool use_hardware_backed_; std::string file_data_; diff --git a/chrome/browser/ui/webui/options/chromeos/change_picture_options_handler.cc b/chrome/browser/ui/webui/options/chromeos/change_picture_options_handler.cc index b576282..e719b5058 100644 --- a/chrome/browser/ui/webui/options/chromeos/change_picture_options_handler.cc +++ b/chrome/browser/ui/webui/options/chromeos/change_picture_options_handler.cc @@ -158,7 +158,7 @@ void ChangePictureOptionsHandler::HandleChooseFile(const ListValue* args) { select_file_dialog_ = ui::SelectFileDialog::Create( this, new ChromeSelectFilePolicy(web_ui()->GetWebContents())); - FilePath downloads_path; + base::FilePath downloads_path; if (!PathService::Get(chrome::DIR_DEFAULT_DOWNLOADS, &downloads_path)) { NOTREACHED(); return; @@ -362,7 +362,7 @@ void ChangePictureOptionsHandler::HandleSelectImage(const ListValue* args) { image_decoder_->set_delegate(NULL); } -void ChangePictureOptionsHandler::FileSelected(const FilePath& path, +void ChangePictureOptionsHandler::FileSelected(const base::FilePath& path, int index, void* params) { UserManager* user_manager = UserManager::Get(); diff --git a/chrome/browser/ui/webui/options/chromeos/change_picture_options_handler.h b/chrome/browser/ui/webui/options/chromeos/change_picture_options_handler.h index 2a8f54e..09f53d2 100644 --- a/chrome/browser/ui/webui/options/chromeos/change_picture_options_handler.h +++ b/chrome/browser/ui/webui/options/chromeos/change_picture_options_handler.h @@ -83,7 +83,7 @@ class ChangePictureOptionsHandler : public ::options::OptionsPageUIHandler, // SelectFileDialog::Delegate implementation. virtual void FileSelected( - const FilePath& path, + const base::FilePath& path, int index, void* params) OVERRIDE; // content::NotificationObserver implementation. diff --git a/chrome/browser/ui/webui/options/manage_profile_handler.cc b/chrome/browser/ui/webui/options/manage_profile_handler.cc index 8005629..623ae96 100644 --- a/chrome/browser/ui/webui/options/manage_profile_handler.cc +++ b/chrome/browser/ui/webui/options/manage_profile_handler.cc @@ -43,7 +43,7 @@ const char kManageProfileIconGridName[] = "manage-profile-icon-grid"; // Given |args| from the WebUI, parses value 0 as a FilePath |profile_file_path| // and returns true on success. bool GetProfilePathFromArgs(const ListValue* args, - FilePath* profile_file_path) { + base::FilePath* profile_file_path) { const Value* file_path_value; if (!args->Get(0, &file_path_value)) return false; @@ -210,7 +210,7 @@ void ManageProfileHandler::SendProfileNames() { void ManageProfileHandler::SetProfileNameAndIcon(const ListValue* args) { DCHECK(args); - FilePath profile_file_path; + base::FilePath profile_file_path; if (!GetProfilePathFromArgs(args, &profile_file_path)) return; @@ -293,7 +293,7 @@ void ManageProfileHandler::DeleteProfile(const ListValue* args) { ProfileMetrics::LogProfileDeleteUser(ProfileMetrics::PROFILE_DELETED); - FilePath profile_file_path; + base::FilePath profile_file_path; if (!GetProfilePathFromArgs(args, &profile_file_path)) return; @@ -313,7 +313,7 @@ void ManageProfileHandler::SwitchAppListProfile(const ListValue* args) { DCHECK(ProfileManager::IsMultipleProfilesEnabled()); const Value* file_path_value; - FilePath profile_file_path; + base::FilePath profile_file_path; if (!args->Get(0, &file_path_value) || !base::GetValueAsFilePath(*file_path_value, &profile_file_path)) return; @@ -328,7 +328,7 @@ void ManageProfileHandler::ProfileIconSelectionChanged( const base::ListValue* args) { DCHECK(args); - FilePath profile_file_path; + base::FilePath profile_file_path; if (!GetProfilePathFromArgs(args, &profile_file_path)) return; @@ -363,7 +363,7 @@ void ManageProfileHandler::RequestHasProfileShortcuts(const ListValue* args) { DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); DCHECK(ProfileShortcutManager::IsFeatureEnabled()); - FilePath profile_file_path; + base::FilePath profile_file_path; if (!GetProfilePathFromArgs(args, &profile_file_path)) return; @@ -373,7 +373,8 @@ void ManageProfileHandler::RequestHasProfileShortcuts(const ListValue* args) { if (profile_index == std::string::npos) return; - const FilePath profile_path = cache.GetPathOfProfileAtIndex(profile_index); + const base::FilePath profile_path = + cache.GetPathOfProfileAtIndex(profile_index); ProfileShortcutManager* shortcut_manager = g_browser_process->profile_manager()->profile_shortcut_manager(); shortcut_manager->HasProfileShortcuts( @@ -390,7 +391,7 @@ void ManageProfileHandler::OnHasProfileShortcuts(bool has_shortcuts) { } void ManageProfileHandler::AddProfileShortcut(const base::ListValue* args) { - FilePath profile_file_path; + base::FilePath profile_file_path; if (!GetProfilePathFromArgs(args, &profile_file_path)) return; @@ -406,7 +407,7 @@ void ManageProfileHandler::AddProfileShortcut(const base::ListValue* args) { } void ManageProfileHandler::RemoveProfileShortcut(const base::ListValue* args) { - FilePath profile_file_path; + base::FilePath profile_file_path; if (!GetProfilePathFromArgs(args, &profile_file_path)) return; diff --git a/chrome/browser/ui/webui/options/media_galleries_handler.cc b/chrome/browser/ui/webui/options/media_galleries_handler.cc index 3628be1..2ad7c46 100644 --- a/chrome/browser/ui/webui/options/media_galleries_handler.cc +++ b/chrome/browser/ui/webui/options/media_galleries_handler.cc @@ -106,9 +106,9 @@ void MediaGalleriesHandler::HandleAddNewGallery(const base::ListValue* args) { select_file_dialog_->SelectFile( ui::SelectFileDialog::SELECT_FOLDER, string16(), // TODO(estade): a name for the dialog? - FilePath(), + base::FilePath(), NULL, 0, - FilePath::StringType(), + base::FilePath::StringType(), web_ui()->GetWebContents()->GetView()-> GetTopLevelNativeWindow(), NULL); @@ -129,7 +129,7 @@ void MediaGalleriesHandler::HandleForgetGallery(const base::ListValue* args) { prefs->ForgetGalleryById(id); } -void MediaGalleriesHandler::FileSelected(const FilePath& path, +void MediaGalleriesHandler::FileSelected(const base::FilePath& path, int index, void* params) { chrome::MediaGalleriesPreferences* prefs = diff --git a/chrome/browser/ui/webui/options/media_galleries_handler.h b/chrome/browser/ui/webui/options/media_galleries_handler.h index 16ca5eb..451adc0 100644 --- a/chrome/browser/ui/webui/options/media_galleries_handler.h +++ b/chrome/browser/ui/webui/options/media_galleries_handler.h @@ -26,7 +26,7 @@ class MediaGalleriesHandler : public OptionsPageUIHandler, virtual void RegisterMessages() OVERRIDE; // SelectFileDialog::Listener implementation. - virtual void FileSelected(const FilePath& path, + virtual void FileSelected(const base::FilePath& path, int index, void* params) OVERRIDE; diff --git a/chrome/browser/ui/webui/plugins_ui.cc b/chrome/browser/ui/webui/plugins_ui.cc index dbbf747..3960c92 100644 --- a/chrome/browser/ui/webui/plugins_ui.cc +++ b/chrome/browser/ui/webui/plugins_ui.cc @@ -258,13 +258,13 @@ void PluginsDOMHandler::HandleEnablePluginMessage(const ListValue* args) { plugin_prefs->EnablePluginGroup(false, adobereader); } } else { - FilePath::StringType file_path; + base::FilePath::StringType file_path; if (!args->GetString(0, &file_path)) { NOTREACHED(); return; } - plugin_prefs->EnablePlugin(enable, FilePath(file_path), + plugin_prefs->EnablePlugin(enable, base::FilePath(file_path), base::Bind(&AssertPluginEnabled)); } } diff --git a/chrome/browser/ui/webui/print_preview/print_preview_handler.cc b/chrome/browser/ui/webui/print_preview/print_preview_handler.cc index 8b3ab70..2102114 100644 --- a/chrome/browser/ui/webui/print_preview/print_preview_handler.cc +++ b/chrome/browser/ui/webui/print_preview/print_preview_handler.cc @@ -231,7 +231,7 @@ void ReportPrintSettingsStats(const DictionaryValue& settings) { } // Callback that stores a PDF file on disk. -void PrintToPdfCallback(Metafile* metafile, const FilePath& path) { +void PrintToPdfCallback(Metafile* metafile, const base::FilePath& path) { metafile->SaveTo(path); // |metafile| must be deleted on the UI thread. BrowserThread::PostTask( @@ -242,7 +242,7 @@ void PrintToPdfCallback(Metafile* metafile, const FilePath& path) { #ifdef OS_CHROMEOS void PrintToPdfCallbackWithCheck(Metafile* metafile, drive::DriveFileError error, - const FilePath& path) { + const base::FilePath& path) { if (error != drive::DRIVE_FILE_OK) { LOG(ERROR) << "Save to pdf failed to write: " << error; } else { @@ -522,13 +522,14 @@ void PrintPreviewHandler::PrintToPdf() { string16 print_job_title_utf16 = print_preview_ui->initiator_tab_title(); #if defined(OS_WIN) - FilePath::StringType print_job_title(print_job_title_utf16); + base::FilePath::StringType print_job_title(print_job_title_utf16); #elif defined(OS_POSIX) - FilePath::StringType print_job_title = UTF16ToUTF8(print_job_title_utf16); + base::FilePath::StringType print_job_title = + UTF16ToUTF8(print_job_title_utf16); #endif file_util::ReplaceIllegalCharactersInPath(&print_job_title, '_'); - FilePath default_filename(print_job_title); + base::FilePath default_filename(print_job_title); default_filename = default_filename.ReplaceExtension(FILE_PATH_LITERAL("pdf")); @@ -857,7 +858,7 @@ void PrintPreviewHandler::OnPrintDialogShown() { ClosePreviewDialogAndActivateInitiatorTab(); } -void PrintPreviewHandler::SelectFile(const FilePath& default_filename) { +void PrintPreviewHandler::SelectFile(const base::FilePath& default_filename) { ui::SelectFileDialog::FileTypeInfo file_type_info; file_type_info.extensions.resize(1); file_type_info.extensions[0].push_back(FILE_PATH_LITERAL("pdf")); @@ -870,7 +871,7 @@ void PrintPreviewHandler::SelectFile(const FilePath& default_filename) { // the select file dialog performs IO anyway in order to display the // folders and also it is modal. base::ThreadRestrictions::ScopedAllowIO allow_io; - FilePath file_path; + base::FilePath file_path; PathService::Get(chrome::DIR_USER_DOCUMENTS, &file_path); sticky_settings->StoreSavePath(file_path); sticky_settings->SaveInPrefs(Profile::FromBrowserContext( @@ -911,7 +912,7 @@ void PrintPreviewHandler::ShowSystemDialog() { HandleShowSystemDialog(NULL); } -void PrintPreviewHandler::FileSelected(const FilePath& path, +void PrintPreviewHandler::FileSelected(const base::FilePath& path, int index, void* params) { // Updating |save_path_| to the newly selected folder. printing::StickySettings* sticky_settings = GetStickySettings(); @@ -919,7 +920,7 @@ void PrintPreviewHandler::FileSelected(const FilePath& path, sticky_settings->SaveInPrefs(Profile::FromBrowserContext( preview_web_contents()->GetBrowserContext())->GetPrefs()); web_ui()->CallJavascriptFunction("fileSelectionCompleted"); - print_to_pdf_path_.reset(new FilePath(path)); + print_to_pdf_path_.reset(new base::FilePath(path)); PostPrintToPdfTask(); } diff --git a/chrome/browser/ui/webui/print_preview/sticky_settings.cc b/chrome/browser/ui/webui/print_preview/sticky_settings.cc index ac30dfd..ef097f2 100644 --- a/chrome/browser/ui/webui/print_preview/sticky_settings.cc +++ b/chrome/browser/ui/webui/print_preview/sticky_settings.cc @@ -26,8 +26,8 @@ void StickySettings::StoreAppState(const std::string& data) { printer_app_state_.reset(new std::string(data)); } -void StickySettings::StoreSavePath(const FilePath& path) { - save_path_.reset(new FilePath(path)); +void StickySettings::StoreSavePath(const base::FilePath& path) { + save_path_.reset(new base::FilePath(path)); } void StickySettings::SaveInPrefs(PrefService* prefs) { @@ -49,9 +49,9 @@ void StickySettings::RestoreFromPrefs(PrefService* prefs) { const DictionaryValue* value = prefs->GetDictionary(prefs::kPrintPreviewStickySettings); - FilePath::StringType save_path; + base::FilePath::StringType save_path; if (value->GetString(printing::kSettingSavePath, &save_path)) - save_path_.reset(new FilePath(save_path)); + save_path_.reset(new base::FilePath(save_path)); std::string buffer; if (value->GetString(printing::kSettingAppState, &buffer)) printer_app_state_.reset(new std::string(buffer)); @@ -67,7 +67,7 @@ std::string* StickySettings::printer_app_state() { return printer_app_state_.get(); } -FilePath* StickySettings::save_path() { +base::FilePath* StickySettings::save_path() { return save_path_.get(); } diff --git a/chrome/browser/ui/webui/profiler_ui.cc b/chrome/browser/ui/webui/profiler_ui.cc index 32ec1285..17d43a5 100644 --- a/chrome/browser/ui/webui/profiler_ui.cc +++ b/chrome/browser/ui/webui/profiler_ui.cc @@ -68,7 +68,7 @@ class ProfilerWebUIDataSource : public content::URLDataSource { const std::string& path, bool is_incognito, const content::URLDataSource::GotDataCallback& callback) OVERRIDE { - FilePath base_path; + base::FilePath base_path; PathService::Get(base::DIR_SOURCE_ROOT, &base_path); base_path = base_path.AppendASCII("chrome"); base_path = base_path.AppendASCII("browser"); @@ -78,7 +78,7 @@ class ProfilerWebUIDataSource : public content::URLDataSource { // If no resource was specified, default to profiler.html. std::string filename = path.empty() ? "profiler.html" : path; - FilePath file_path; + base::FilePath file_path; file_path = base_path.AppendASCII(filename); // Read the file synchronously and send it as the response. diff --git a/chrome/browser/ui/webui/screenshot_source.cc b/chrome/browser/ui/webui/screenshot_source.cc index afb73cb..d72ead5 100644 --- a/chrome/browser/ui/webui/screenshot_source.cc +++ b/chrome/browser/ui/webui/screenshot_source.cc @@ -114,7 +114,7 @@ bool ScreenshotSource::AreScreenshotsDisabled() { } // static -bool ScreenshotSource::GetScreenshotDirectory(FilePath* directory) { +bool ScreenshotSource::GetScreenshotDirectory(base::FilePath* directory) { if (ScreenshotSource::AreScreenshotsDisabled()) return false; @@ -192,7 +192,7 @@ void ScreenshotSource::SendScreenshot( std::string decoded_filename = UTF16ToASCII(string16( decoded.data(), decoded.length())); - FilePath download_path; + base::FilePath download_path; GetScreenshotDirectory(&download_path); if (drive::util::IsUnderDriveMountPoint(download_path)) { drive::DriveFileSystemInterface* file_system = @@ -222,7 +222,7 @@ void ScreenshotSource::SendScreenshot( void ScreenshotSource::SendSavedScreenshot( const std::string& screenshot_path, const content::URLDataSource::GotDataCallback& callback, - const FilePath& file) { + const base::FilePath& file) { ScreenshotDataPtr read_bytes(new ScreenshotData); int64 file_size = 0; @@ -243,7 +243,7 @@ void ScreenshotSource::GetSavedScreenshotCallback( const std::string& screenshot_path, const content::URLDataSource::GotDataCallback& callback, drive::DriveFileError error, - const FilePath& file, + const base::FilePath& file, const std::string& unused_mime_type, drive::DriveFileType file_type) { if (error != drive::DRIVE_FILE_OK || file_type != drive::REGULAR_FILE) { diff --git a/chrome/browser/ui/webui/sync_setup_handler.cc b/chrome/browser/ui/webui/sync_setup_handler.cc index df34626..2d8b3fe 100644 --- a/chrome/browser/ui/webui/sync_setup_handler.cc +++ b/chrome/browser/ui/webui/sync_setup_handler.cc @@ -524,7 +524,7 @@ void SyncSetupHandler::ConfigureSyncDone() { DCHECK(service); if (!service->HasSyncSetupCompleted()) { // This is the first time configuring sync, so log it. - FilePath profile_file_path = GetProfile()->GetPath(); + base::FilePath profile_file_path = GetProfile()->GetPath(); ProfileMetrics::LogProfileSyncSignIn(profile_file_path); // We're done configuring, so notify ProfileSyncService that it is OK to diff --git a/chrome/browser/ui/webui/version_handler.cc b/chrome/browser/ui/webui/version_handler.cc index 160e677..6dc3bdb 100644 --- a/chrome/browser/ui/webui/version_handler.cc +++ b/chrome/browser/ui/webui/version_handler.cc @@ -22,12 +22,13 @@ namespace { // Retrieves the executable and profile paths on the FILE thread. -void GetFilePaths(const FilePath& profile_path, +void GetFilePaths(const base::FilePath& profile_path, string16* exec_path_out, string16* profile_path_out) { DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::FILE)); - FilePath executable_path = CommandLine::ForCurrentProcess()->GetProgram(); + base::FilePath executable_path = + CommandLine::ForCurrentProcess()->GetProgram(); if (file_util::AbsolutePath(&executable_path)) { *exec_path_out = executable_path.LossyDisplayName(); } else { @@ -35,7 +36,7 @@ void GetFilePaths(const FilePath& profile_path, l10n_util::GetStringUTF16(IDS_ABOUT_VERSION_PATH_NOTFOUND); } - FilePath profile_path_copy(profile_path); + base::FilePath profile_path_copy(profile_path); if (!profile_path.empty() && file_util::AbsolutePath(&profile_path_copy)) { *profile_path_out = profile_path.LossyDisplayName(); } else { diff --git a/chrome/browser/unload_browsertest.cc b/chrome/browser/unload_browsertest.cc index 75c2a68..0be5f1f 100644 --- a/chrome/browser/unload_browsertest.cc +++ b/chrome/browser/unload_browsertest.cc @@ -143,7 +143,7 @@ class UnloadTest : public InProcessBrowserTest { void NavigateToNolistenersFileTwice() { GURL url(content::URLRequestMockHTTPJob::GetMockUrl( - FilePath(FILE_PATH_LITERAL("title2.html")))); + base::FilePath(FILE_PATH_LITERAL("title2.html")))); ui_test_utils::NavigateToURL(browser(), url); CheckTitle("Title Of Awesomeness"); ui_test_utils::NavigateToURL(browser(), url); @@ -155,7 +155,7 @@ class UnloadTest : public InProcessBrowserTest { // page without waiting for the first load to complete. void NavigateToNolistenersFileTwiceAsync() { GURL url(content::URLRequestMockHTTPJob::GetMockUrl( - FilePath(FILE_PATH_LITERAL("title2.html")))); + base::FilePath(FILE_PATH_LITERAL("title2.html")))); ui_test_utils::NavigateToURLWithDisposition(browser(), url, CURRENT_TAB, 0); ui_test_utils::NavigateToURL(browser(), url); CheckTitle("Title Of Awesomeness"); diff --git a/chrome/browser/upgrade_detector_impl.cc b/chrome/browser/upgrade_detector_impl.cc index b5f058e..91d4986 100644 --- a/chrome/browser/upgrade_detector_impl.cc +++ b/chrome/browser/upgrade_detector_impl.cc @@ -83,7 +83,7 @@ void DetectUpgradeTask(const base::Closure& upgrade_detected_task, // Get the version of the currently *installed* instance of Chrome, // which might be newer than the *running* instance if we have been // upgraded in the background. - FilePath exe_path; + base::FilePath exe_path; if (!PathService::Get(base::DIR_EXE, &exe_path)) { NOTREACHED() << "Failed to find executable path"; return; diff --git a/chrome/browser/user_style_sheet_watcher.cc b/chrome/browser/user_style_sheet_watcher.cc index d699724..7f06e9e 100644 --- a/chrome/browser/user_style_sheet_watcher.cc +++ b/chrome/browser/user_style_sheet_watcher.cc @@ -55,13 +55,13 @@ class UserStyleSheetLoader // Load the user style sheet on the file thread and convert it to a // base64 URL. Posts the base64 URL back to the UI thread. - void LoadStyleSheet(const FilePath& style_sheet_file); + void LoadStyleSheet(const base::FilePath& style_sheet_file); // Send out a notification if the stylesheet has already been loaded. void NotifyLoaded(); // FilePathWatcher::Callback method: - void NotifyPathChanged(const FilePath& path, bool error); + void NotifyPathChanged(const base::FilePath& path, bool error); private: friend class base::RefCountedThreadSafe<UserStyleSheetLoader>; @@ -92,16 +92,18 @@ void UserStyleSheetLoader::NotifyLoaded() { } } -void UserStyleSheetLoader::NotifyPathChanged(const FilePath& path, bool error) { +void UserStyleSheetLoader::NotifyPathChanged(const base::FilePath& path, + bool error) { if (!error) LoadStyleSheet(path); } -void UserStyleSheetLoader::LoadStyleSheet(const FilePath& style_sheet_file) { +void UserStyleSheetLoader::LoadStyleSheet( + const base::FilePath& style_sheet_file) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); // We keep the user style sheet in a subdir so we can watch for changes // to the file. - FilePath style_sheet_dir = style_sheet_file.DirName(); + base::FilePath style_sheet_dir = style_sheet_file.DirName(); if (!file_util::DirectoryExists(style_sheet_dir)) { if (!file_util::CreateDirectory(style_sheet_dir)) return; @@ -136,7 +138,7 @@ void UserStyleSheetLoader::SetStyleSheet(const GURL& url) { } UserStyleSheetWatcher::UserStyleSheetWatcher(Profile* profile, - const FilePath& profile_path) + const base::FilePath& profile_path) : RefcountedProfileKeyedService(content::BrowserThread::UI), profile_(profile), profile_path_(profile_path), @@ -162,7 +164,7 @@ void UserStyleSheetWatcher::Init() { if (!file_watcher_.get()) { file_watcher_.reset(new FilePathWatcher); - FilePath style_sheet_file = profile_path_.AppendASCII(kStyleSheetDir) + base::FilePath style_sheet_file = profile_path_.AppendASCII(kStyleSheetDir) .AppendASCII(kUserStyleSheetFile); if (!file_watcher_->Watch( style_sheet_file, diff --git a/chrome/browser/user_style_sheet_watcher.h b/chrome/browser/user_style_sheet_watcher.h index c8006c1..4fae4b1 100644 --- a/chrome/browser/user_style_sheet_watcher.h +++ b/chrome/browser/user_style_sheet_watcher.h @@ -24,7 +24,7 @@ class UserStyleSheetWatcher : public content::NotificationObserver, public RefcountedProfileKeyedService { public: - UserStyleSheetWatcher(Profile* profile, const FilePath& profile_path); + UserStyleSheetWatcher(Profile* profile, const base::FilePath& profile_path); void Init(); @@ -47,7 +47,7 @@ class UserStyleSheetWatcher Profile* profile_; // The directory containing User StyleSheets/Custom.css. - FilePath profile_path_; + base::FilePath profile_path_; // The loader object. scoped_refptr<UserStyleSheetLoader> loader_; diff --git a/chrome/browser/user_style_sheet_watcher_unittest.cc b/chrome/browser/user_style_sheet_watcher_unittest.cc index f1e0740..004e271 100644 --- a/chrome/browser/user_style_sheet_watcher_unittest.cc +++ b/chrome/browser/user_style_sheet_watcher_unittest.cc @@ -22,7 +22,7 @@ TEST(UserStyleSheetWatcherTest, StyleLoad) { ASSERT_TRUE(dir.CreateUniqueTempDir()); std::string css_file_contents = "a { color: green; }"; - FilePath style_sheet_file = dir.path().AppendASCII("User StyleSheets") + base::FilePath style_sheet_file = dir.path().AppendASCII("User StyleSheets") .AppendASCII("Custom.css"); file_util::CreateDirectory(style_sheet_file.DirName()); ASSERT_TRUE(file_util::WriteFile(style_sheet_file, diff --git a/chrome/browser/value_store/leveldb_value_store.cc b/chrome/browser/value_store/leveldb_value_store.cc index 564d616..f9458d5 100644 --- a/chrome/browser/value_store/leveldb_value_store.cc +++ b/chrome/browser/value_store/leveldb_value_store.cc @@ -76,7 +76,7 @@ class ScopedSnapshot { } // namespace -LeveldbValueStore::LeveldbValueStore(const FilePath& db_path) +LeveldbValueStore::LeveldbValueStore(const base::FilePath& db_path) : db_path_(db_path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); diff --git a/chrome/browser/value_store/leveldb_value_store.h b/chrome/browser/value_store/leveldb_value_store.h index 3a60262..95ae6dc 100644 --- a/chrome/browser/value_store/leveldb_value_store.h +++ b/chrome/browser/value_store/leveldb_value_store.h @@ -24,7 +24,7 @@ class LeveldbValueStore : public ValueStore { // need to be notified of that, but we don't want to permanently give up. // // Must be created on the FILE thread. - explicit LeveldbValueStore(const FilePath& path); + explicit LeveldbValueStore(const base::FilePath& path); // Must be deleted on the FILE thread. virtual ~LeveldbValueStore(); @@ -78,7 +78,7 @@ class LeveldbValueStore : public ValueStore { bool IsEmpty(); // The location of the leveldb backend. - const FilePath db_path_; + const base::FilePath db_path_; // leveldb backend. scoped_ptr<leveldb::DB> db_; diff --git a/chrome/browser/value_store/leveldb_value_store_unittest.cc b/chrome/browser/value_store/leveldb_value_store_unittest.cc index 531f5b8..7a7e82f 100644 --- a/chrome/browser/value_store/leveldb_value_store_unittest.cc +++ b/chrome/browser/value_store/leveldb_value_store_unittest.cc @@ -9,7 +9,7 @@ namespace { -ValueStore* Param(const FilePath& file_path) { +ValueStore* Param(const base::FilePath& file_path) { return new LeveldbValueStore(file_path); } diff --git a/chrome/browser/value_store/testing_value_store_unittest.cc b/chrome/browser/value_store/testing_value_store_unittest.cc index eaaca40..6a47a3a 100644 --- a/chrome/browser/value_store/testing_value_store_unittest.cc +++ b/chrome/browser/value_store/testing_value_store_unittest.cc @@ -10,7 +10,7 @@ namespace extensions { namespace { -ValueStore* Param(const FilePath& file_path) { +ValueStore* Param(const base::FilePath& file_path) { return new TestingValueStore(); } diff --git a/chrome/browser/value_store/value_store_frontend.cc b/chrome/browser/value_store/value_store_frontend.cc index 6da95e6..aca3fff 100644 --- a/chrome/browser/value_store/value_store_frontend.cc +++ b/chrome/browser/value_store/value_store_frontend.cc @@ -17,7 +17,7 @@ class ValueStoreFrontend::Backend : public base::RefCountedThreadSafe<Backend> { public: Backend() : storage_(NULL) {} - void Init(const FilePath& db_path) { + void Init(const base::FilePath& db_path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); DCHECK(!storage_); TRACE_EVENT0("ValueStoreFrontend::Backend", "Init"); @@ -85,7 +85,7 @@ class ValueStoreFrontend::Backend : public base::RefCountedThreadSafe<Backend> { // exclusively on the FILE thread. ValueStore* storage_; - FilePath db_path_; + base::FilePath db_path_; DISALLOW_COPY_AND_ASSIGN(Backend); }; @@ -94,7 +94,7 @@ ValueStoreFrontend::ValueStoreFrontend() : backend_(new Backend()) { } -ValueStoreFrontend::ValueStoreFrontend(const FilePath& db_path) +ValueStoreFrontend::ValueStoreFrontend(const base::FilePath& db_path) : backend_(new Backend()) { Init(db_path); } @@ -110,7 +110,7 @@ ValueStoreFrontend::~ValueStoreFrontend() { DCHECK(CalledOnValidThread()); } -void ValueStoreFrontend::Init(const FilePath& db_path) { +void ValueStoreFrontend::Init(const base::FilePath& db_path) { BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, base::Bind(&ValueStoreFrontend::Backend::Init, backend_, db_path)); diff --git a/chrome/browser/value_store/value_store_frontend_unittest.cc b/chrome/browser/value_store/value_store_frontend_unittest.cc index c5e6339..6cd7b4b 100644 --- a/chrome/browser/value_store/value_store_frontend_unittest.cc +++ b/chrome/browser/value_store/value_store_frontend_unittest.cc @@ -26,9 +26,9 @@ class ValueStoreFrontendTest : public testing::Test { virtual void SetUp() { ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); - FilePath test_data_dir; + base::FilePath test_data_dir; ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &test_data_dir)); - FilePath src_db(test_data_dir.AppendASCII("value_store_db")); + base::FilePath src_db(test_data_dir.AppendASCII("value_store_db")); db_path_ = temp_dir_.path().AppendASCII("temp_db"); file_util::CopyDirectory(src_db, db_path_, true); @@ -61,7 +61,7 @@ class ValueStoreFrontendTest : public testing::Test { scoped_ptr<ValueStoreFrontend> storage_; base::ScopedTempDir temp_dir_; - FilePath db_path_; + base::FilePath db_path_; MessageLoop message_loop_; content::TestBrowserThread ui_thread_; content::TestBrowserThread file_thread_; diff --git a/chrome/browser/value_store/value_store_unittest.h b/chrome/browser/value_store/value_store_unittest.h index 74b76eb..513963a 100644 --- a/chrome/browser/value_store/value_store_unittest.h +++ b/chrome/browser/value_store/value_store_unittest.h @@ -16,7 +16,7 @@ #include "content/public/test/test_browser_thread.h" // Parameter type for the value-parameterized tests. -typedef ValueStore* (*ValueStoreTestParam)(const FilePath& file_path); +typedef ValueStore* (*ValueStoreTestParam)(const base::FilePath& file_path); // Test fixture for ValueStore tests. Tests are defined in // settings_storage_unittest.cc with configurations for both cached diff --git a/chrome/browser/web_applications/web_app.cc b/chrome/browser/web_applications/web_app.cc index aa89513..4af6705 100644 --- a/chrome/browser/web_applications/web_app.cc +++ b/chrome/browser/web_applications/web_app.cc @@ -33,7 +33,7 @@ void DeleteShortcutsOnFileThread( const ShellIntegration::ShortcutInfo& shortcut_info) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); - FilePath shortcut_data_dir = web_app::GetWebAppDataDirectory( + base::FilePath shortcut_data_dir = web_app::GetWebAppDataDirectory( shortcut_info.profile_path, shortcut_info.extension_id, GURL()); return web_app::internals::DeletePlatformShortcuts( shortcut_data_dir, shortcut_info); @@ -43,7 +43,7 @@ void UpdateShortcutsOnFileThread( const ShellIntegration::ShortcutInfo& shortcut_info) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); - FilePath shortcut_data_dir = web_app::GetWebAppDataDirectory( + base::FilePath shortcut_data_dir = web_app::GetWebAppDataDirectory( shortcut_info.profile_path, shortcut_info.extension_id, GURL()); return web_app::internals::UpdatePlatformShortcuts( shortcut_data_dir, shortcut_info); @@ -63,23 +63,23 @@ static const char* kCrxAppPrefix = "_crx_"; namespace internals { -FilePath GetSanitizedFileName(const string16& name) { +base::FilePath GetSanitizedFileName(const string16& name) { #if defined(OS_WIN) string16 file_name = name; #else std::string file_name = UTF16ToUTF8(name); #endif file_util::ReplaceIllegalCharactersInPath(&file_name, '_'); - return FilePath(file_name); + return base::FilePath(file_name); } } // namespace internals -FilePath GetWebAppDataDirectory(const FilePath& profile_path, - const std::string& extension_id, - const GURL& url) { +base::FilePath GetWebAppDataDirectory(const base::FilePath& profile_path, + const std::string& extension_id, + const GURL& url) { DCHECK(!profile_path.empty()); - FilePath app_data_dir(profile_path.Append(chrome::kWebAppDirname)); + base::FilePath app_data_dir(profile_path.Append(chrome::kWebAppDirname)); if (!extension_id.empty()) { return app_data_dir.AppendASCII( @@ -92,18 +92,18 @@ FilePath GetWebAppDataDirectory(const FilePath& profile_path, std::string scheme_port(scheme + "_" + port); #if defined(OS_WIN) - FilePath::StringType host_path(UTF8ToUTF16(host)); - FilePath::StringType scheme_port_path(UTF8ToUTF16(scheme_port)); + base::FilePath::StringType host_path(UTF8ToUTF16(host)); + base::FilePath::StringType scheme_port_path(UTF8ToUTF16(scheme_port)); #elif defined(OS_POSIX) - FilePath::StringType host_path(host); - FilePath::StringType scheme_port_path(scheme_port); + base::FilePath::StringType host_path(host); + base::FilePath::StringType scheme_port_path(scheme_port); #endif return app_data_dir.Append(host_path).Append(scheme_port_path); } -FilePath GetWebAppDataDirectory(const FilePath& profile_path, - const extensions::Extension& extension) { +base::FilePath GetWebAppDataDirectory(const base::FilePath& profile_path, + const extensions::Extension& extension) { return GetWebAppDataDirectory( profile_path, extension.id(), GURL(extension.launch_web_url())); } @@ -172,7 +172,7 @@ bool CreateShortcutsOnFileThread( const ShellIntegration::ShortcutInfo& shortcut_info) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); - FilePath shortcut_data_dir = GetWebAppDataDirectory( + base::FilePath shortcut_data_dir = GetWebAppDataDirectory( shortcut_info.profile_path, shortcut_info.extension_id, shortcut_info.url); return internals::CreatePlatformShortcuts(shortcut_data_dir, shortcut_info); diff --git a/chrome/browser/web_applications/web_app.h b/chrome/browser/web_applications/web_app.h index 56b6612..deab896 100644 --- a/chrome/browser/web_applications/web_app.h +++ b/chrome/browser/web_applications/web_app.h @@ -22,14 +22,14 @@ namespace web_app { // Gets the user data directory for given web app. The path for the directory is // based on |extension_id|. If |extension_id| is empty then |url| is used // to construct a unique ID. -FilePath GetWebAppDataDirectory(const FilePath& profile_path, - const std::string& extension_id, - const GURL& url); +base::FilePath GetWebAppDataDirectory(const base::FilePath& profile_path, + const std::string& extension_id, + const GURL& url); // Gets the user data directory to use for |extension| located inside // |profile_path|. -FilePath GetWebAppDataDirectory(const FilePath& profile_path, - const extensions::Extension& extension); +base::FilePath GetWebAppDataDirectory(const base::FilePath& profile_path, + const extensions::Extension& extension); // Compute a deterministic name based on data in the shortcut_info. std::string GenerateApplicationNameFromInfo( @@ -85,7 +85,7 @@ std::string GetWMClassFromAppName(std::string app_name); namespace internals { #if defined(OS_WIN) -bool CheckAndSaveIcon(const FilePath& icon_file, const SkBitmap& image); +bool CheckAndSaveIcon(const base::FilePath& icon_file, const SkBitmap& image); #endif // Implemented for each platform, does the platform specific parts of creating @@ -94,26 +94,26 @@ bool CheckAndSaveIcon(const FilePath& icon_file, const SkBitmap& image); // shortcut, and is also used as the UserDataDir for platform app shortcuts. // |shortcut_info| contains info about the shortcut to create. bool CreatePlatformShortcuts( - const FilePath& shortcut_data_path, + const base::FilePath& shortcut_data_path, const ShellIntegration::ShortcutInfo& shortcut_info); // Delete all the shortcuts we have added for this extension. This is the // platform specific implementation of the DeleteAllShortcuts function, and // is executed on the FILE thread. void DeletePlatformShortcuts( - const FilePath& shortcut_data_path, + const base::FilePath& shortcut_data_path, const ShellIntegration::ShortcutInfo& shortcut_info); // Updates all the shortcuts we have added for this extension. This is the // platform specific implementation of the UpdateAllShortcuts function, and // is executed on the FILE thread. void UpdatePlatformShortcuts( - const FilePath& shortcut_data_path, + const base::FilePath& shortcut_data_path, const ShellIntegration::ShortcutInfo& shortcut_info); // Sanitizes |name| and returns a version of it that is safe to use as an // on-disk file name . -FilePath GetSanitizedFileName(const string16& name); +base::FilePath GetSanitizedFileName(const string16& name); } // namespace internals diff --git a/chrome/browser/web_applications/web_app_android.cc b/chrome/browser/web_applications/web_app_android.cc index 2008ece..b6ff730 100644 --- a/chrome/browser/web_applications/web_app_android.cc +++ b/chrome/browser/web_applications/web_app_android.cc @@ -8,17 +8,17 @@ namespace web_app { namespace internals { bool CreatePlatformShortcuts( - const FilePath& web_app_path, + const base::FilePath& web_app_path, const ShellIntegration::ShortcutInfo& shortcut_info) { return true; } void DeletePlatformShortcuts( - const FilePath& web_app_path, + const base::FilePath& web_app_path, const ShellIntegration::ShortcutInfo& shortcut_info) {} void UpdatePlatformShortcuts( - const FilePath& web_app_path, + const base::FilePath& web_app_path, const ShellIntegration::ShortcutInfo& shortcut_info) {} } // namespace internals diff --git a/chrome/browser/web_applications/web_app_linux.cc b/chrome/browser/web_applications/web_app_linux.cc index 18ac835..325911f 100644 --- a/chrome/browser/web_applications/web_app_linux.cc +++ b/chrome/browser/web_applications/web_app_linux.cc @@ -14,7 +14,7 @@ namespace web_app { namespace internals { bool CreatePlatformShortcuts( - const FilePath& web_app_path, + const base::FilePath& web_app_path, const ShellIntegration::ShortcutInfo& shortcut_info) { DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::FILE)); @@ -30,14 +30,14 @@ bool CreatePlatformShortcuts( } void DeletePlatformShortcuts( - const FilePath& web_app_path, + const base::FilePath& web_app_path, const ShellIntegration::ShortcutInfo& shortcut_info) { ShellIntegrationLinux::DeleteDesktopShortcuts(shortcut_info.profile_path, shortcut_info.extension_id); } void UpdatePlatformShortcuts( - const FilePath& web_app_path, + const base::FilePath& web_app_path, const ShellIntegration::ShortcutInfo& shortcut_info) { // TODO(benwells): Implement this. } diff --git a/chrome/browser/web_applications/web_app_mac.h b/chrome/browser/web_applications/web_app_mac.h index 94331c4..5e06cdc 100644 --- a/chrome/browser/web_applications/web_app_mac.h +++ b/chrome/browser/web_applications/web_app_mac.h @@ -28,7 +28,7 @@ class WebAppShortcutCreator { // The shortcut stores its user data directory in |user_data_dir|. // |chrome_bundle_id| is the CFBundleIdentifier of the Chrome browser bundle. WebAppShortcutCreator( - const FilePath& user_data_dir, + const base::FilePath& user_data_dir, const ShellIntegration::ShortcutInfo& shortcut_info, const string16& chrome_bundle_id); @@ -40,16 +40,17 @@ class WebAppShortcutCreator { protected: // Returns a path to the app loader. - FilePath GetAppLoaderPath() const; + base::FilePath GetAppLoaderPath() const; // Returns a path to the destination where the app should be written to. - virtual FilePath GetDestinationPath(const FilePath& app_file_name) const; + virtual base::FilePath GetDestinationPath( + const base::FilePath& app_file_name) const; // Updates the plist inside |app_path| with information about the app. - bool UpdatePlist(const FilePath& app_path) const; + bool UpdatePlist(const base::FilePath& app_path) const; // Updates the icon for the shortcut. - bool UpdateIcon(const FilePath& app_path) const; + bool UpdateIcon(const base::FilePath& app_path) const; private: FRIEND_TEST_ALL_PREFIXES(WebAppShortcutCreatorTest, UpdateIcon); @@ -57,7 +58,7 @@ class WebAppShortcutCreator { // Path to the app's user data directory. For example: // ~/Library/Application Support/Chromium/Default/Web Applications/_crx_abc/ // Note, the user data directory is the parent of the profile directory. - FilePath user_data_dir_; + base::FilePath user_data_dir_; // Returns the bundle identifier to use for this app bundle. // |plist| is a dictionary containg a copy of the template plist file to @@ -66,7 +67,7 @@ class WebAppShortcutCreator { // Show the bundle we just generated in the Finder. virtual void RevealGeneratedBundleInFinder( - const FilePath& generated_bundle) const; + const base::FilePath& generated_bundle) const; // Information about the app. ShellIntegration::ShortcutInfo info_; diff --git a/chrome/browser/web_applications/web_app_mac.mm b/chrome/browser/web_applications/web_app_mac.mm index be02bc5..3e0e41e 100644 --- a/chrome/browser/web_applications/web_app_mac.mm +++ b/chrome/browser/web_applications/web_app_mac.mm @@ -84,7 +84,7 @@ bool AddBitmapImageRepToIconFamily(IconFamily* icon_family, namespace web_app { WebAppShortcutCreator::WebAppShortcutCreator( - const FilePath& user_data_dir, + const base::FilePath& user_data_dir, const ShellIntegration::ShortcutInfo& shortcut_info, const string16& chrome_bundle_id) : user_data_dir_(user_data_dir), @@ -96,12 +96,12 @@ WebAppShortcutCreator::~WebAppShortcutCreator() { } bool WebAppShortcutCreator::CreateShortcut() { - FilePath app_name = internals::GetSanitizedFileName(info_.title); - FilePath app_file_name = app_name.ReplaceExtension("app"); + base::FilePath app_name = internals::GetSanitizedFileName(info_.title); + base::FilePath app_file_name = app_name.ReplaceExtension("app"); base::ScopedTempDir scoped_temp_dir; if (!scoped_temp_dir.CreateUniqueTempDir()) return false; - FilePath staging_path = scoped_temp_dir.path().Append(app_file_name); + base::FilePath staging_path = scoped_temp_dir.path().Append(app_file_name); // Update the app's plist and icon in a temp directory. This works around // a Finder bug where the app's icon doesn't properly update. @@ -117,7 +117,7 @@ bool WebAppShortcutCreator::CreateShortcut() { if (!UpdateIcon(staging_path)) return false; - FilePath dst_path = GetDestinationPath(app_file_name); + base::FilePath dst_path = GetDestinationPath(app_file_name); if (!file_util::CopyDirectory(staging_path, dst_path, true)) { LOG(ERROR) << "Copying app to dst path: " << dst_path.value() << " failed"; return false; @@ -130,14 +130,14 @@ bool WebAppShortcutCreator::CreateShortcut() { return true; } -FilePath WebAppShortcutCreator::GetAppLoaderPath() const { +base::FilePath WebAppShortcutCreator::GetAppLoaderPath() const { return base::mac::PathForFrameworkBundleResource( base::mac::NSToCFCast(@"app_mode_loader.app")); } -FilePath WebAppShortcutCreator::GetDestinationPath( - const FilePath& app_file_name) const { - FilePath path; +base::FilePath WebAppShortcutCreator::GetDestinationPath( + const base::FilePath& app_file_name) const { + base::FilePath path; if (base::mac::GetLocalDirectory(NSApplicationDirectory, &path) && file_util::PathIsWritable(path)) { return path; @@ -146,10 +146,10 @@ FilePath WebAppShortcutCreator::GetDestinationPath( if (base::mac::GetUserDirectory(NSApplicationDirectory, &path)) return path; - return FilePath(); + return base::FilePath(); } -bool WebAppShortcutCreator::UpdatePlist(const FilePath& app_path) const { +bool WebAppShortcutCreator::UpdatePlist(const base::FilePath& app_path) const { NSString* plist_path = base::mac::FilePathToNSString( app_path.Append("Contents").Append("Info.plist")); @@ -194,7 +194,7 @@ bool WebAppShortcutCreator::UpdatePlist(const FilePath& app_path) const { return [plist writeToFile:plist_path atomically:YES]; } -bool WebAppShortcutCreator::UpdateIcon(const FilePath& app_path) const { +bool WebAppShortcutCreator::UpdateIcon(const base::FilePath& app_path) const { if (info_.favicon.IsEmpty()) return true; @@ -220,10 +220,11 @@ bool WebAppShortcutCreator::UpdateIcon(const FilePath& app_path) const { if (!image_added) return false; - FilePath resources_path = app_path.Append("Contents").Append("Resources"); + base::FilePath resources_path = + app_path.Append("Contents").Append("Resources"); if (!file_util::CreateDirectory(resources_path)) return false; - FilePath icon_path = resources_path.Append("app.icns"); + base::FilePath icon_path = resources_path.Append("app.icns"); return [icon_family writeToFile:base::mac::FilePathToNSString(icon_path)]; } @@ -243,7 +244,7 @@ NSString* WebAppShortcutCreator::GetBundleIdentifier(NSDictionary* plist) const } void WebAppShortcutCreator::RevealGeneratedBundleInFinder( - const FilePath& generated_bundle) const { + const base::FilePath& generated_bundle) const { [[NSWorkspace sharedWorkspace] selectFile:base::mac::FilePathToNSString(generated_bundle) inFileViewerRootedAtPath:nil]; @@ -256,7 +257,7 @@ namespace web_app { namespace internals { bool CreatePlatformShortcuts( - const FilePath& web_app_path, + const base::FilePath& web_app_path, const ShellIntegration::ShortcutInfo& shortcut_info) { DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::FILE)); string16 bundle_id = UTF8ToUTF16(base::mac::BaseBundleID()); @@ -266,14 +267,14 @@ bool CreatePlatformShortcuts( } void DeletePlatformShortcuts( - const FilePath& web_app_path, + const base::FilePath& web_app_path, const ShellIntegration::ShortcutInfo& shortcut_info) { // TODO(benwells): Implement this when shortcuts / weblings are enabled on // mac. } void UpdatePlatformShortcuts( - const FilePath& web_app_path, + const base::FilePath& web_app_path, const ShellIntegration::ShortcutInfo& shortcut_info) { // TODO(benwells): Implement this when shortcuts / weblings are enabled on // mac. diff --git a/chrome/browser/web_applications/web_app_mac_unittest.mm b/chrome/browser/web_applications/web_app_mac_unittest.mm index 575eafc..ee6b647 100644 --- a/chrome/browser/web_applications/web_app_mac_unittest.mm +++ b/chrome/browser/web_applications/web_app_mac_unittest.mm @@ -34,21 +34,22 @@ class WebAppShortcutCreatorMock : public web_app::WebAppShortcutCreator { public: explicit WebAppShortcutCreatorMock( const ShellIntegration::ShortcutInfo& shortcut_info) - : WebAppShortcutCreator(FilePath("/fake/path"), shortcut_info, + : WebAppShortcutCreator(base::FilePath("/fake/path"), shortcut_info, UTF8ToUTF16("fake.cfbundleidentifier")) { } - MOCK_CONST_METHOD1(GetDestinationPath, FilePath(const FilePath&)); - MOCK_CONST_METHOD1(RevealGeneratedBundleInFinder, void(const FilePath&)); + MOCK_CONST_METHOD1(GetDestinationPath, base::FilePath(const base::FilePath&)); + MOCK_CONST_METHOD1(RevealGeneratedBundleInFinder, + void (const base::FilePath&)); }; ShellIntegration::ShortcutInfo GetShortcutInfo() { ShellIntegration::ShortcutInfo info; info.extension_id = "extension_id"; - info.extension_path = FilePath("/fake/extension/path"); + info.extension_path = base::FilePath("/fake/extension/path"); info.title = ASCIIToUTF16("Shortcut Title"); info.url = GURL("http://example.com/"); - info.profile_path = FilePath("Default"); + info.profile_path = base::FilePath("Default"); return info; } @@ -62,8 +63,8 @@ TEST(WebAppShortcutCreatorTest, CreateShortcut) { ShellIntegration::ShortcutInfo info = GetShortcutInfo(); - FilePath dst_folder = scoped_temp_dir.path(); - FilePath dst_path = dst_folder.Append(UTF16ToUTF8(info.title) + ".app"); + base::FilePath dst_folder = scoped_temp_dir.path(); + base::FilePath dst_path = dst_folder.Append(UTF16ToUTF8(info.title) + ".app"); NiceMock<WebAppShortcutCreatorMock> shortcut_creator(info); EXPECT_CALL(shortcut_creator, GetDestinationPath(_)) @@ -73,7 +74,7 @@ TEST(WebAppShortcutCreatorTest, CreateShortcut) { EXPECT_TRUE(shortcut_creator.CreateShortcut()); EXPECT_TRUE(file_util::PathExists(dst_path)); - FilePath plist_path = dst_path.Append("Contents").Append("Info.plist"); + base::FilePath plist_path = dst_path.Append("Contents").Append("Info.plist"); NSDictionary* plist = [NSDictionary dictionaryWithContentsOfFile: base::mac::FilePathToNSString(plist_path)]; EXPECT_NSEQ(base::SysUTF8ToNSString(info.extension_id), @@ -100,9 +101,9 @@ TEST(WebAppShortcutCreatorTest, RunShortcut) { ShellIntegration::ShortcutInfo info = GetShortcutInfo(); - FilePath dst_folder = scoped_temp_dir.path(); - dst_folder = FilePath("/Applications"); - FilePath dst_path = dst_folder.Append(UTF16ToUTF8(info.title) + ".app"); + base::FilePath dst_folder = scoped_temp_dir.path(); + dst_folder = base::FilePath("/Applications"); + base::FilePath dst_path = dst_folder.Append(UTF16ToUTF8(info.title) + ".app"); NiceMock<WebAppShortcutCreatorMock> shortcut_creator(info); EXPECT_CALL(shortcut_creator, GetDestinationPath(_)) @@ -121,14 +122,14 @@ TEST(WebAppShortcutCreatorTest, RunShortcut) { TEST(WebAppShortcutCreatorTest, CreateFailure) { NiceMock<WebAppShortcutCreatorMock> shortcut_creator(GetShortcutInfo()); EXPECT_CALL(shortcut_creator, GetDestinationPath(_)) - .WillRepeatedly(Return(FilePath("/non-existant/path/"))); + .WillRepeatedly(Return(base::FilePath("/non-existant/path/"))); EXPECT_FALSE(shortcut_creator.CreateShortcut()); } TEST(WebAppShortcutCreatorTest, UpdateIcon) { base::ScopedTempDir scoped_temp_dir; ASSERT_TRUE(scoped_temp_dir.CreateUniqueTempDir()); - FilePath dst_path = scoped_temp_dir.path(); + base::FilePath dst_path = scoped_temp_dir.path(); ShellIntegration::ShortcutInfo info = GetShortcutInfo(); info.favicon = ui::ResourceBundle::GetSharedInstance().GetImageNamed( @@ -136,7 +137,7 @@ TEST(WebAppShortcutCreatorTest, UpdateIcon) { WebAppShortcutCreatorMock shortcut_creator(info); shortcut_creator.UpdateIcon(dst_path); - FilePath icon_path = + base::FilePath icon_path = dst_path.Append("Contents").Append("Resources").Append("app.icns"); scoped_nsobject<NSImage> image([[NSImage alloc] initWithContentsOfFile: diff --git a/chrome/browser/web_applications/web_app_unittest.cc b/chrome/browser/web_applications/web_app_unittest.cc index 7a3961d..2a8c082 100644 --- a/chrome/browser/web_applications/web_app_unittest.cc +++ b/chrome/browser/web_applications/web_app_unittest.cc @@ -60,18 +60,19 @@ TEST_F(WebApplicationTest, MAYBE_GetShortcutInfoForTab) { } TEST_F(WebApplicationTest, AppDirWithId) { - FilePath profile_path(FILE_PATH_LITERAL("profile")); - FilePath result(web_app::GetWebAppDataDirectory(profile_path, "123", GURL())); - FilePath expected = profile_path.AppendASCII("Web Applications") + base::FilePath profile_path(FILE_PATH_LITERAL("profile")); + base::FilePath result( + web_app::GetWebAppDataDirectory(profile_path, "123", GURL())); + base::FilePath expected = profile_path.AppendASCII("Web Applications") .AppendASCII("_crx_123"); EXPECT_EQ(expected, result); } TEST_F(WebApplicationTest, AppDirWithUrl) { - FilePath profile_path(FILE_PATH_LITERAL("profile")); - FilePath result(web_app::GetWebAppDataDirectory( + base::FilePath profile_path(FILE_PATH_LITERAL("profile")); + base::FilePath result(web_app::GetWebAppDataDirectory( profile_path, "", GURL("http://example.com"))); - FilePath expected = profile_path.AppendASCII("Web Applications") + base::FilePath expected = profile_path.AppendASCII("Web Applications") .AppendASCII("example.com") .AppendASCII("http_80"); EXPECT_EQ(expected, result); diff --git a/chrome/browser/web_applications/web_app_win.cc b/chrome/browser/web_applications/web_app_win.cc index 8a6419d..0fa8a04 100644 --- a/chrome/browser/web_applications/web_app_win.cc +++ b/chrome/browser/web_applications/web_app_win.cc @@ -23,7 +23,8 @@ namespace { -const FilePath::CharType kIconChecksumFileExt[] = FILE_PATH_LITERAL(".ico.md5"); +const base::FilePath::CharType kIconChecksumFileExt[] = + FILE_PATH_LITERAL(".ico.md5"); // Calculates image checksum using MD5. void GetImageCheckSum(const SkBitmap& image, base::MD5Digest* digest) { @@ -34,22 +35,24 @@ void GetImageCheckSum(const SkBitmap& image, base::MD5Digest* digest) { } // Saves |image| as an |icon_file| with the checksum. -bool SaveIconWithCheckSum(const FilePath& icon_file, const SkBitmap& image) { +bool SaveIconWithCheckSum(const base::FilePath& icon_file, + const SkBitmap& image) { if (!IconUtil::CreateIconFileFromSkBitmap(image, SkBitmap(), icon_file)) return false; base::MD5Digest digest; GetImageCheckSum(image, &digest); - FilePath cheksum_file(icon_file.ReplaceExtension(kIconChecksumFileExt)); + base::FilePath cheksum_file(icon_file.ReplaceExtension(kIconChecksumFileExt)); return file_util::WriteFile(cheksum_file, reinterpret_cast<const char*>(&digest), sizeof(digest)) == sizeof(digest); } // Returns true if |icon_file| is missing or different from |image|. -bool ShouldUpdateIcon(const FilePath& icon_file, const SkBitmap& image) { - FilePath checksum_file(icon_file.ReplaceExtension(kIconChecksumFileExt)); +bool ShouldUpdateIcon(const base::FilePath& icon_file, const SkBitmap& image) { + base::FilePath checksum_file( + icon_file.ReplaceExtension(kIconChecksumFileExt)); // Returns true if icon_file or checksum file is missing. if (!file_util::PathExists(icon_file) || @@ -70,10 +73,10 @@ bool ShouldUpdateIcon(const FilePath& icon_file, const SkBitmap& image) { sizeof(base::MD5Digest)) != 0; } -std::vector<FilePath> GetShortcutPaths( +std::vector<base::FilePath> GetShortcutPaths( ShellIntegration::ShortcutInfo shortcut_info) { // Shortcut paths under which to create shortcuts. - std::vector<FilePath> shortcut_paths; + std::vector<base::FilePath> shortcut_paths; // Locations to add to shortcut_paths. struct { @@ -103,7 +106,7 @@ std::vector<FilePath> GetShortcutPaths( // Populate shortcut_paths. for (int i = 0; i < arraysize(locations); ++i) { if (locations[i].use_this_location) { - FilePath path; + base::FilePath path; // Skip the Win7 case. if (locations[i].location_id == base::PATH_START) @@ -123,8 +126,8 @@ std::vector<FilePath> GetShortcutPaths( return shortcut_paths; } -bool ShortcutIsForProfile(const FilePath& shortcut_file_name, - const FilePath& profile_path) { +bool ShortcutIsForProfile(const base::FilePath& shortcut_file_name, + const base::FilePath& profile_path) { string16 cmd_line_string; if (base::win::ResolveShortcut(shortcut_file_name, NULL, &cmd_line_string)) { cmd_line_string = L"program " + cmd_line_string; @@ -137,18 +140,18 @@ bool ShortcutIsForProfile(const FilePath& shortcut_file_name, return false; } -std::vector<FilePath> MatchingShortcutsForProfileAndExtension( - const FilePath& shortcut_path, - const FilePath& profile_path, +std::vector<base::FilePath> MatchingShortcutsForProfileAndExtension( + const base::FilePath& shortcut_path, + const base::FilePath& profile_path, const string16& shortcut_name) { - std::vector<FilePath> shortcut_paths; - FilePath base_path = shortcut_path. + std::vector<base::FilePath> shortcut_paths; + base::FilePath base_path = shortcut_path. Append(web_app::internals::GetSanitizedFileName(shortcut_name)). ReplaceExtension(FILE_PATH_LITERAL(".lnk")); const int fileNamesToCheck = 10; for (int i = 0; i < fileNamesToCheck; ++i) { - FilePath shortcut_file = base_path; + base::FilePath shortcut_file = base_path; if (i) { shortcut_file = shortcut_file.InsertBeforeExtensionASCII( StringPrintf(" (%d)", i)); @@ -170,7 +173,7 @@ namespace internals { // Saves |image| to |icon_file| if the file is outdated and refresh shell's // icon cache to ensure correct icon is displayed. Returns true if icon_file // is up to date or successfully updated. -bool CheckAndSaveIcon(const FilePath& icon_file, const SkBitmap& image) { +bool CheckAndSaveIcon(const base::FilePath& icon_file, const SkBitmap& image) { if (ShouldUpdateIcon(icon_file, image)) { if (SaveIconWithCheckSum(icon_file, image)) { // Refresh shell's icon cache. This call is quite disruptive as user would @@ -186,7 +189,7 @@ bool CheckAndSaveIcon(const FilePath& icon_file, const SkBitmap& image) { return true; } -FilePath GetShortcutExecutablePath( +base::FilePath GetShortcutExecutablePath( const ShellIntegration::ShortcutInfo& shortcut_info) { if (shortcut_info.is_platform_app && BrowserDistribution::GetDistribution()->AppHostIsSupported() && @@ -198,12 +201,12 @@ FilePath GetShortcutExecutablePath( } bool CreatePlatformShortcuts( - const FilePath& web_app_path, + const base::FilePath& web_app_path, const ShellIntegration::ShortcutInfo& shortcut_info) { DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::FILE)); // Shortcut paths under which to create shortcuts. - std::vector<FilePath> shortcut_paths = GetShortcutPaths(shortcut_info); + std::vector<base::FilePath> shortcut_paths = GetShortcutPaths(shortcut_info); bool pin_to_taskbar = shortcut_info.create_in_quick_launch_bar && (base::win::GetVersion() >= base::win::VERSION_WIN7); @@ -226,22 +229,22 @@ bool CreatePlatformShortcuts( } // Generates file name to use with persisted ico and shortcut file. - FilePath file_name = + base::FilePath file_name = web_app::internals::GetSanitizedFileName(shortcut_info.title); // Creates an ico file to use with shortcut. - FilePath icon_file = web_app_path.Append(file_name).ReplaceExtension( + base::FilePath icon_file = web_app_path.Append(file_name).ReplaceExtension( FILE_PATH_LITERAL(".ico")); if (!web_app::internals::CheckAndSaveIcon(icon_file, *shortcut_info.favicon.ToSkBitmap())) { return false; } - FilePath target_exe = GetShortcutExecutablePath(shortcut_info); + base::FilePath target_exe = GetShortcutExecutablePath(shortcut_info); DCHECK(!target_exe.empty()); // Working directory. - FilePath working_dir(target_exe.DirName()); + base::FilePath working_dir(target_exe.DirName()); CommandLine cmd_line(CommandLine::NO_PROGRAM); cmd_line = ShellIntegration::CommandLineArgsForLauncher(shortcut_info.url, @@ -263,10 +266,10 @@ bool CreatePlatformShortcuts( string16 app_id(ShellIntegration::GetAppModelIdForProfile( UTF8ToUTF16(app_name), shortcut_info.profile_path)); - FilePath shortcut_to_pin; + base::FilePath shortcut_to_pin; bool success = true; for (size_t i = 0; i < shortcut_paths.size(); ++i) { - FilePath shortcut_file = shortcut_paths[i].Append(file_name). + base::FilePath shortcut_file = shortcut_paths[i].Append(file_name). ReplaceExtension(FILE_PATH_LITERAL(".lnk")); int unique_number = @@ -309,15 +312,15 @@ bool CreatePlatformShortcuts( } void UpdatePlatformShortcuts( - const FilePath& web_app_path, + const base::FilePath& web_app_path, const ShellIntegration::ShortcutInfo& shortcut_info) { // Generates file name to use with persisted ico and shortcut file. - FilePath file_name = + base::FilePath file_name = web_app::internals::GetSanitizedFileName(shortcut_info.title); // If an icon file exists, and is out of date, replace it with the new icon // and let the shell know the icon has been modified. - FilePath icon_file = web_app_path.Append(file_name).ReplaceExtension( + base::FilePath icon_file = web_app_path.Append(file_name).ReplaceExtension( FILE_PATH_LITERAL(".ico")); if (file_util::PathExists(icon_file)) { web_app::internals::CheckAndSaveIcon(icon_file, @@ -326,7 +329,7 @@ void UpdatePlatformShortcuts( } void DeletePlatformShortcuts( - const FilePath& web_app_path, + const base::FilePath& web_app_path, const ShellIntegration::ShortcutInfo& shortcut_info) { DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::FILE)); @@ -335,17 +338,18 @@ void DeletePlatformShortcuts( all_shortcuts_info.create_in_applications_menu = true; all_shortcuts_info.create_in_quick_launch_bar = true; all_shortcuts_info.create_on_desktop = true; - std::vector<FilePath> shortcut_locations = GetShortcutPaths( + std::vector<base::FilePath> shortcut_locations = GetShortcutPaths( all_shortcuts_info); if (base::win::GetVersion() >= base::win::VERSION_WIN7) shortcut_locations.push_back(web_app_path); - for (std::vector<FilePath>::const_iterator i = shortcut_locations.begin(); + for (std::vector<base::FilePath>::const_iterator i = + shortcut_locations.begin(); i != shortcut_locations.end(); ++i) { - std::vector<FilePath> shortcut_files = + std::vector<base::FilePath> shortcut_files = MatchingShortcutsForProfileAndExtension(*i, shortcut_info.profile_path, shortcut_info.title); - for (std::vector<FilePath>::const_iterator j = shortcut_files.begin(); + for (std::vector<base::FilePath>::const_iterator j = shortcut_files.begin(); j != shortcut_files.end(); ++j) { // Any shortcut could have been pinned, either by chrome or the user, so // they are all unpinned. diff --git a/chrome/browser/webdata/autofill_table_unittest.cc b/chrome/browser/webdata/autofill_table_unittest.cc index e693d14..6488f6d 100644 --- a/chrome/browser/webdata/autofill_table_unittest.cc +++ b/chrome/browser/webdata/autofill_table_unittest.cc @@ -114,7 +114,7 @@ class AutofillTableTest : public testing::Test { AutofillKey(ASCIIToUTF16(name), ASCIIToUTF16(value)), timestamps); } - FilePath file_; + base::FilePath file_; base::ScopedTempDir temp_dir_; private: diff --git a/chrome/browser/webdata/keyword_table_unittest.cc b/chrome/browser/webdata/keyword_table_unittest.cc index 4ddeda4..b848302 100644 --- a/chrome/browser/webdata/keyword_table_unittest.cc +++ b/chrome/browser/webdata/keyword_table_unittest.cc @@ -33,7 +33,7 @@ class KeywordTableTest : public testing::Test { file_ = temp_dir_.path().AppendASCII("TestWebDatabase"); } - FilePath file_; + base::FilePath file_; base::ScopedTempDir temp_dir_; private: diff --git a/chrome/browser/webdata/token_service_table_unittest.cc b/chrome/browser/webdata/token_service_table_unittest.cc index feb09d0..d7fec29 100644 --- a/chrome/browser/webdata/token_service_table_unittest.cc +++ b/chrome/browser/webdata/token_service_table_unittest.cc @@ -25,7 +25,7 @@ class TokenServiceTableTest : public testing::Test { file_ = temp_dir_.path().AppendASCII("TestWebDatabase"); } - FilePath file_; + base::FilePath file_; base::ScopedTempDir temp_dir_; private: diff --git a/chrome/browser/webdata/web_apps_table_unittest.cc b/chrome/browser/webdata/web_apps_table_unittest.cc index 0682b6c..8d288bc 100644 --- a/chrome/browser/webdata/web_apps_table_unittest.cc +++ b/chrome/browser/webdata/web_apps_table_unittest.cc @@ -27,7 +27,7 @@ class WebAppsTableTest : public testing::Test { file_ = temp_dir_.path().AppendASCII("TestWebDatabase"); } - FilePath file_; + base::FilePath file_; base::ScopedTempDir temp_dir_; private: diff --git a/chrome/browser/webdata/web_data_service.cc b/chrome/browser/webdata/web_data_service.cc index 08770d1..9ce374d 100644 --- a/chrome/browser/webdata/web_data_service.cc +++ b/chrome/browser/webdata/web_data_service.cc @@ -113,8 +113,8 @@ void WebDataService::ShutdownOnUIThread() { UnloadDatabase(); } -bool WebDataService::Init(const FilePath& profile_path) { - FilePath path = profile_path; +bool WebDataService::Init(const base::FilePath& profile_path) { + base::FilePath path = profile_path; path = path.Append(chrome::kWebDataFilename); return InitWithPath(path); } @@ -414,7 +414,7 @@ WebDataService::~WebDataService() { } } -bool WebDataService::InitWithPath(const FilePath& path) { +bool WebDataService::InitWithPath(const base::FilePath& path) { path_ = path; is_running_ = true; diff --git a/chrome/browser/webdata/web_data_service.h b/chrome/browser/webdata/web_data_service.h index 834725c..ed80d76 100644 --- a/chrome/browser/webdata/web_data_service.h +++ b/chrome/browser/webdata/web_data_service.h @@ -123,7 +123,7 @@ class WebDataService // Initializes the web data service. Returns false on failure // Takes the path of the profile directory as its argument. - bool Init(const FilePath& profile_path); + bool Init(const base::FilePath& profile_path); // Returns false if Shutdown() has been called. bool IsRunning() const; @@ -327,7 +327,7 @@ class WebDataService virtual ~WebDataService(); // This is invoked by the unit test; path is the path of the Web Data file. - bool InitWithPath(const FilePath& path); + bool InitWithPath(const base::FilePath& path); ////////////////////////////////////////////////////////////////////////////// // @@ -483,7 +483,7 @@ class WebDataService bool is_running_; // The path with which to initialize the database. - FilePath path_; + base::FilePath path_; // Our database. We own the |db_|, but don't use a |scoped_ptr| because the // |db_| lifetime must be managed on the database thread. diff --git a/chrome/browser/webdata/web_data_service_factory.cc b/chrome/browser/webdata/web_data_service_factory.cc index 6b7bd15..5d641d7 100644 --- a/chrome/browser/webdata/web_data_service_factory.cc +++ b/chrome/browser/webdata/web_data_service_factory.cc @@ -68,7 +68,7 @@ scoped_refptr<RefcountedProfileKeyedService> WebDataServiceFactory::BuildServiceInstanceFor(Profile* profile) const { DCHECK(profile); - FilePath path = profile->GetPath(); + base::FilePath path = profile->GetPath(); path = path.Append(chrome::kWebDataFilename); scoped_refptr<WebDataService> wds(new WebDataService()); diff --git a/chrome/browser/webdata/web_data_service_unittest.cc b/chrome/browser/webdata/web_data_service_unittest.cc index 87d0813..e1e1fec 100644 --- a/chrome/browser/webdata/web_data_service_unittest.cc +++ b/chrome/browser/webdata/web_data_service_unittest.cc @@ -102,7 +102,7 @@ class WebDataServiceTest : public testing::Test { MessageLoopForUI message_loop_; content::TestBrowserThread ui_thread_; content::TestBrowserThread db_thread_; - FilePath profile_dir_; + base::FilePath profile_dir_; scoped_refptr<WebDataService> wds_; base::ScopedTempDir temp_dir_; }; diff --git a/chrome/browser/webdata/web_database_migration_unittest.cc b/chrome/browser/webdata/web_database_migration_unittest.cc index b834a65..0fd411d 100644 --- a/chrome/browser/webdata/web_database_migration_unittest.cc +++ b/chrome/browser/webdata/web_database_migration_unittest.cc @@ -171,18 +171,18 @@ class WebDatabaseMigrationTest : public testing::Test { // number and a new migration test added below. static const int kCurrentTestedVersionNumber; - FilePath GetDatabasePath() { - const FilePath::CharType kWebDatabaseFilename[] = + base::FilePath GetDatabasePath() { + const base::FilePath::CharType kWebDatabaseFilename[] = FILE_PATH_LITERAL("TestWebDatabase.sqlite3"); - return temp_dir_.path().Append(FilePath(kWebDatabaseFilename)); + return temp_dir_.path().Append(base::FilePath(kWebDatabaseFilename)); } // The textual contents of |file| are read from // "chrome/test/data/web_database" and returned in the string |contents|. // Returns true if the file exists and is read successfully, false otherwise. - bool GetWebDatabaseData(const FilePath& file, std::string* contents) { - FilePath path = ui_test_utils::GetTestFilePath( - FilePath(FILE_PATH_LITERAL("web_database")), file); + bool GetWebDatabaseData(const base::FilePath& file, std::string* contents) { + base::FilePath path = ui_test_utils::GetTestFilePath( + base::FilePath(FILE_PATH_LITERAL("web_database")), file); return file_util::PathExists(path) && file_util::ReadFileToString(path, contents); } @@ -203,7 +203,7 @@ class WebDatabaseMigrationTest : public testing::Test { // Like this: // > .output version_nn.sql // > .dump - void LoadDatabase(const FilePath::StringType& file); + void LoadDatabase(const base::FilePath::StringType& file); private: MessageLoopForUI message_loop_for_ui_; @@ -215,9 +215,10 @@ class WebDatabaseMigrationTest : public testing::Test { const int WebDatabaseMigrationTest::kCurrentTestedVersionNumber = 49; -void WebDatabaseMigrationTest::LoadDatabase(const FilePath::StringType& file) { +void WebDatabaseMigrationTest::LoadDatabase( + const base::FilePath::StringType& file) { std::string contents; - ASSERT_TRUE(GetWebDatabaseData(FilePath(file), &contents)); + ASSERT_TRUE(GetWebDatabaseData(base::FilePath(file), &contents)); sql::Connection connection; ASSERT_TRUE(connection.Open(GetDatabasePath())); |