diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-02-10 03:41:45 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-02-10 03:41:45 +0000 |
commit | 650b2d5cdcab7d2c473c00d15b9f343f3a3405bb (patch) | |
tree | 1343ea25d7d6086ac1279e1e0e32562b3b9b3477 /chrome/browser/extensions | |
parent | 6f3638708ff440a2e80662ce49acc41cdad51ecd (diff) | |
download | chromium_src-650b2d5cdcab7d2c473c00d15b9f343f3a3405bb.zip chromium_src-650b2d5cdcab7d2c473c00d15b9f343f3a3405bb.tar.gz chromium_src-650b2d5cdcab7d2c473c00d15b9f343f3a3405bb.tar.bz2 |
Merge branch 'master' into file_path_browser
version control markers
Merge branch 'master' into file_path_browser
remove version control
Fix typo
Merge branch 'master' into file_path_browser
Conflicts:
chrome/browser/intents/native_services_browsertest.cc
chrome/browser/ui/intents/native_file_picker_service.cc
Merge branch 'master' into file_path_browser
Conflicts:
chrome/browser/chromeos/drive/drive_file_system.cc
chrome/browser/chromeos/drive/drive_file_system.h
chrome/browser/chromeos/drive/drive_file_system_interface.h
chrome/browser/chromeos/drive/drive_file_system_unittest.cc
chrome/browser/chromeos/drive/file_system/drive_operations.cc
chrome/browser/chromeos/login/wallpaper_manager.cc
chrome/browser/chromeos/login/wallpaper_manager.h
chrome/browser/chromeos/login/wallpaper_manager_browsertest.cc
chrome/browser/extensions/api/sync_file_system/extension_sync_event_observer.cc
chrome/browser/google_apis/gdata_wapi_operations.cc
chrome/browser/google_apis/gdata_wapi_operations.h
chrome/browser/google_apis/gdata_wapi_operations_unittest.cc
chrome/browser/profiles/off_the_record_profile_impl.cc
chrome/browser/profiles/off_the_record_profile_impl.h
chrome/browser/profiles/profile_impl.cc
chrome/browser/profiles/profile_impl.h
chrome/browser/profiles/profile_impl_io_data.cc
chrome/browser/profiles/profile_impl_io_data.h
chrome/browser/sync_file_system/drive_file_sync_client_unittest.cc
chrome/browser/ui/webui/options/manage_profile_handler.cc
Long lines
long lines
some long lines.
long lines
long lines
Beginning of lines.
Rename FilePath -> base::FilePath in chrome/browser
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@181638 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/extensions')
172 files changed, 1113 insertions, 1040 deletions
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 = |