diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-02-10 05:15:45 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-02-10 05:15:45 +0000 |
commit | 79f6388902881a0aab426e9606c544b68ab3b9bc (patch) | |
tree | df8da7e82fded47bccf4fe32922a8451a475bf97 /ui | |
parent | 6d4b67a4b50d73d5001aec99014ac40bc504871a (diff) | |
download | chromium_src-79f6388902881a0aab426e9606c544b68ab3b9bc.zip chromium_src-79f6388902881a0aab426e9606c544b68ab3b9bc.tar.gz chromium_src-79f6388902881a0aab426e9606c544b68ab3b9bc.tar.bz2 |
Replace FilePath with base::FilePath in some more top level directories.
Review URL: https://codereview.chromium.org/12217101
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@181640 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui')
57 files changed, 404 insertions, 368 deletions
diff --git a/ui/aura/remote_root_window_host_win.cc b/ui/aura/remote_root_window_host_win.cc index 9d1782d..962f19d 100644 --- a/ui/aura/remote_root_window_host_win.cc +++ b/ui/aura/remote_root_window_host_win.cc @@ -33,7 +33,7 @@ const int kRemoteWindowTouchId = 10; void HandleOpenFile( const string16& title, - const FilePath& default_path, + const base::FilePath& default_path, const string16& filter, const OpenFileCompletion& callback) { DCHECK(aura::RemoteRootWindowHostWin::Instance()); @@ -45,7 +45,7 @@ void HandleOpenFile( void HandleOpenMultipleFiles( const string16& title, - const FilePath& default_path, + const base::FilePath& default_path, const string16& filter, const OpenMultipleFilesCompletion& callback) { DCHECK(aura::RemoteRootWindowHostWin::Instance()); @@ -58,7 +58,7 @@ void HandleOpenMultipleFiles( void HandleSaveFile( const string16& title, - const FilePath& default_path, + const base::FilePath& default_path, const string16& filter, int filter_index, const string16& default_extension, @@ -131,7 +131,7 @@ bool RemoteRootWindowHostWin::OnMessageReceived(const IPC::Message& message) { void RemoteRootWindowHostWin::HandleOpenFile( const string16& title, - const FilePath& default_path, + const base::FilePath& default_path, const string16& filter, const OpenFileCompletion& callback) { if (!host_) @@ -149,7 +149,7 @@ void RemoteRootWindowHostWin::HandleOpenFile( void RemoteRootWindowHostWin::HandleOpenMultipleFiles( const string16& title, - const FilePath& default_path, + const base::FilePath& default_path, const string16& filter, const OpenMultipleFilesCompletion& callback) { if (!host_) @@ -167,7 +167,7 @@ void RemoteRootWindowHostWin::HandleOpenMultipleFiles( void RemoteRootWindowHostWin::HandleSaveFile( const string16& title, - const FilePath& default_path, + const base::FilePath& default_path, const string16& filter, int filter_index, const string16& default_extension, @@ -382,7 +382,7 @@ void RemoteRootWindowHostWin::OnFileSaveAsDone(bool success, int filter_index) { if (success) { file_saveas_completion_callback_.Run( - FilePath(filename), filter_index, NULL); + base::FilePath(filename), filter_index, NULL); } file_saveas_completion_callback_.Reset(); } @@ -391,14 +391,14 @@ void RemoteRootWindowHostWin::OnFileSaveAsDone(bool success, void RemoteRootWindowHostWin::OnFileOpenDone(bool success, string16 filename) { if (success) { file_open_completion_callback_.Run( - FilePath(filename), 0, NULL); + base::FilePath(filename), 0, NULL); } file_open_completion_callback_.Reset(); } void RemoteRootWindowHostWin::OnMultiFileOpenDone( bool success, - const std::vector<FilePath>& files) { + const std::vector<base::FilePath>& files) { if (success) { multi_file_open_completion_callback_.Run(files, NULL); } diff --git a/ui/aura/test/test_aura_initializer.cc b/ui/aura/test/test_aura_initializer.cc index c2d131f..ebd8485 100644 --- a/ui/aura/test/test_aura_initializer.cc +++ b/ui/aura/test/test_aura_initializer.cc @@ -13,7 +13,7 @@ namespace test { TestAuraInitializer::TestAuraInitializer() { #if defined(OS_LINUX) - FilePath pak_file; + base::FilePath pak_file; PathService::Get(base::DIR_MODULE, &pak_file); pak_file = pak_file.Append(FILE_PATH_LITERAL( "aura_test_support_resources.pak")); diff --git a/ui/base/dragdrop/download_file_interface.h b/ui/base/dragdrop/download_file_interface.h index a3bed25..c157950 100644 --- a/ui/base/dragdrop/download_file_interface.h +++ b/ui/base/dragdrop/download_file_interface.h @@ -28,7 +28,7 @@ namespace ui { class UI_EXPORT DownloadFileObserver : public base::RefCountedThreadSafe<DownloadFileObserver> { public: - virtual void OnDownloadCompleted(const FilePath& file_path) = 0; + virtual void OnDownloadCompleted(const base::FilePath& file_path) = 0; virtual void OnDownloadAborted() = 0; protected: diff --git a/ui/base/dragdrop/drag_utils.cc b/ui/base/dragdrop/drag_utils.cc index 9c58491..6431f7d 100644 --- a/ui/base/dragdrop/drag_utils.cc +++ b/ui/base/dragdrop/drag_utils.cc @@ -29,7 +29,8 @@ static const SkColor kFileDragImageTextColor = SK_ColorBLACK; class FileDragImageSource : public gfx::CanvasImageSource { public: - FileDragImageSource(const FilePath& file_name, const gfx::ImageSkia& icon) + FileDragImageSource(const base::FilePath& file_name, + const gfx::ImageSkia& icon) : CanvasImageSource(CalculateSize(icon), false), file_name_(file_name), icon_(icon) { @@ -75,7 +76,7 @@ class FileDragImageSource : public gfx::CanvasImageSource { return gfx::Size(width, height); } - const FilePath file_name_; + const base::FilePath file_name_; const gfx::ImageSkia icon_; DISALLOW_COPY_AND_ASSIGN(FileDragImageSource); @@ -83,7 +84,7 @@ class FileDragImageSource : public gfx::CanvasImageSource { } // namespace -void CreateDragImageForFile(const FilePath& file_name, +void CreateDragImageForFile(const base::FilePath& file_name, const gfx::ImageSkia* icon, ui::OSExchangeData* data_object) { DCHECK(icon); diff --git a/ui/base/dragdrop/drag_utils.h b/ui/base/dragdrop/drag_utils.h index 1f84d90..418dc7a 100644 --- a/ui/base/dragdrop/drag_utils.h +++ b/ui/base/dragdrop/drag_utils.h @@ -30,7 +30,7 @@ namespace drag_utils { // Chrome (via the download manager, for example). The drag image is set into // the supplied data_object. 'file_name' can be a full path, but the directory // portion will be truncated in the drag image. -UI_EXPORT void CreateDragImageForFile(const FilePath& file_name, +UI_EXPORT void CreateDragImageForFile(const base::FilePath& file_name, const gfx::ImageSkia* icon, ui::OSExchangeData* data_object); diff --git a/ui/base/dragdrop/os_exchange_data.cc b/ui/base/dragdrop/os_exchange_data.cc index 12eddeb..c19a695 100644 --- a/ui/base/dragdrop/os_exchange_data.cc +++ b/ui/base/dragdrop/os_exchange_data.cc @@ -10,7 +10,7 @@ namespace ui { OSExchangeData::DownloadFileInfo::DownloadFileInfo( - const FilePath& filename, + const base::FilePath& filename, DownloadFileProvider* downloader) : filename(filename), downloader(downloader) { @@ -19,8 +19,8 @@ OSExchangeData::DownloadFileInfo::DownloadFileInfo( OSExchangeData::DownloadFileInfo::~DownloadFileInfo() {} OSExchangeData::FileInfo::FileInfo( - const FilePath& path, - const FilePath& display_name) + const base::FilePath& path, + const base::FilePath& display_name) : path(path), display_name(display_name) { } @@ -44,7 +44,7 @@ void OSExchangeData::SetURL(const GURL& url, const string16& title) { provider_->SetURL(url, title); } -void OSExchangeData::SetFilename(const FilePath& path) { +void OSExchangeData::SetFilename(const base::FilePath& path) { provider_->SetFilename(path); } @@ -65,7 +65,7 @@ bool OSExchangeData::GetURLAndTitle(GURL* url, string16* title) const { return provider_->GetURLAndTitle(url, title); } -bool OSExchangeData::GetFilename(FilePath* path) const { +bool OSExchangeData::GetFilename(base::FilePath* path) const { return provider_->GetFilename(path); } @@ -145,12 +145,12 @@ bool OSExchangeData::HasAnyFormat( } #if defined(OS_WIN) -void OSExchangeData::SetFileContents(const FilePath& filename, +void OSExchangeData::SetFileContents(const base::FilePath& filename, const std::string& file_contents) { provider_->SetFileContents(filename, file_contents); } -bool OSExchangeData::GetFileContents(FilePath* filename, +bool OSExchangeData::GetFileContents(base::FilePath* filename, std::string* file_contents) const { return provider_->GetFileContents(filename, file_contents); } diff --git a/ui/base/dragdrop/os_exchange_data.h b/ui/base/dragdrop/os_exchange_data.h index 5d89ebe..110d127 100644 --- a/ui/base/dragdrop/os_exchange_data.h +++ b/ui/base/dragdrop/os_exchange_data.h @@ -82,23 +82,23 @@ class UI_EXPORT OSExchangeData { // Encapsulates the info about a file to be downloaded. struct UI_EXPORT DownloadFileInfo { - DownloadFileInfo(const FilePath& filename, + DownloadFileInfo(const base::FilePath& filename, DownloadFileProvider* downloader); ~DownloadFileInfo(); - FilePath filename; + base::FilePath filename; scoped_refptr<DownloadFileProvider> downloader; }; // Encapsulates the info about a file. struct UI_EXPORT FileInfo { - FileInfo(const FilePath& path, const FilePath& display_name); + FileInfo(const base::FilePath& path, const base::FilePath& display_name); ~FileInfo(); // The path of the file. - FilePath path; + base::FilePath path; // The display name of the file. This field is optional. - FilePath display_name; + base::FilePath display_name; }; // Provider defines the platform specific part of OSExchangeData that @@ -110,14 +110,14 @@ class UI_EXPORT OSExchangeData { virtual void SetString(const string16& data) = 0; virtual void SetURL(const GURL& url, const string16& title) = 0; - virtual void SetFilename(const FilePath& path) = 0; + virtual void SetFilename(const base::FilePath& path) = 0; virtual void SetFilenames( const std::vector<FileInfo>& file_names) = 0; virtual void SetPickledData(CustomFormat format, const Pickle& data) = 0; virtual bool GetString(string16* data) const = 0; virtual bool GetURLAndTitle(GURL* url, string16* title) const = 0; - virtual bool GetFilename(FilePath* path) const = 0; + virtual bool GetFilename(base::FilePath* path) const = 0; virtual bool GetFilenames( std::vector<FileInfo>* file_names) const = 0; virtual bool GetPickledData(CustomFormat format, Pickle* data) const = 0; @@ -129,9 +129,9 @@ class UI_EXPORT OSExchangeData { OSExchangeData::CustomFormat format) const = 0; #if defined(OS_WIN) - virtual void SetFileContents(const FilePath& filename, + virtual void SetFileContents(const base::FilePath& filename, const std::string& file_contents) = 0; - virtual bool GetFileContents(FilePath* filename, + virtual bool GetFileContents(base::FilePath* filename, std::string* file_contents) const = 0; virtual bool HasFileContents() const = 0; virtual void SetDownloadFileInfo(const DownloadFileInfo& download) = 0; @@ -182,7 +182,7 @@ class UI_EXPORT OSExchangeData { // A URL can have an optional title in some exchange formats. void SetURL(const GURL& url, const string16& title); // A full path to a file. - void SetFilename(const FilePath& path); + void SetFilename(const base::FilePath& path); // Full path to one or more files. See also SetFilenames() in Provider. void SetFilenames( const std::vector<FileInfo>& file_names); @@ -196,7 +196,7 @@ class UI_EXPORT OSExchangeData { bool GetString(string16* data) const; bool GetURLAndTitle(GURL* url, string16* title) const; // Return the path of a file, if available. - bool GetFilename(FilePath* path) const; + bool GetFilename(base::FilePath* path) const; bool GetFilenames( std::vector<FileInfo>* file_names) const; bool GetPickledData(CustomFormat format, Pickle* data) const; @@ -220,9 +220,9 @@ class UI_EXPORT OSExchangeData { #if defined(OS_WIN) // Adds the bytes of a file (CFSTR_FILECONTENTS and CFSTR_FILEDESCRIPTOR). - void SetFileContents(const FilePath& filename, + void SetFileContents(const base::FilePath& filename, const std::string& file_contents); - bool GetFileContents(FilePath* filename, + bool GetFileContents(base::FilePath* filename, std::string* file_contents) const; // Adds a download file with full path (CF_HDROP). diff --git a/ui/base/dragdrop/os_exchange_data_provider_aura.cc b/ui/base/dragdrop/os_exchange_data_provider_aura.cc index 34af849..6ce7e23 100644 --- a/ui/base/dragdrop/os_exchange_data_provider_aura.cc +++ b/ui/base/dragdrop/os_exchange_data_provider_aura.cc @@ -28,9 +28,9 @@ void OSExchangeDataProviderAura::SetURL(const GURL& url, formats_ |= OSExchangeData::URL; } -void OSExchangeDataProviderAura::SetFilename(const FilePath& path) { +void OSExchangeDataProviderAura::SetFilename(const base::FilePath& path) { filenames_.clear(); - filenames_.push_back(OSExchangeData::FileInfo(path, FilePath())); + filenames_.push_back(OSExchangeData::FileInfo(path, base::FilePath())); formats_ |= OSExchangeData::FILE_NAME; } @@ -69,7 +69,7 @@ bool OSExchangeDataProviderAura::GetURLAndTitle(GURL* url, return true; } -bool OSExchangeDataProviderAura::GetFilename(FilePath* path) const { +bool OSExchangeDataProviderAura::GetFilename(base::FilePath* path) const { if ((formats_ & OSExchangeData::FILE_NAME) == 0) return false; DCHECK(!filenames_.empty()); @@ -119,13 +119,13 @@ bool OSExchangeDataProviderAura::HasCustomFormat( #if defined(OS_WIN) void OSExchangeDataProviderAura::SetFileContents( - const FilePath& filename, + const base::FilePath& filename, const std::string& file_contents) { NOTIMPLEMENTED(); } bool OSExchangeDataProviderAura::GetFileContents( - FilePath* filename, + base::FilePath* filename, std::string* file_contents) const { NOTIMPLEMENTED(); return false; diff --git a/ui/base/dragdrop/os_exchange_data_provider_aura.h b/ui/base/dragdrop/os_exchange_data_provider_aura.h index 4b431d2..f577653 100644 --- a/ui/base/dragdrop/os_exchange_data_provider_aura.h +++ b/ui/base/dragdrop/os_exchange_data_provider_aura.h @@ -27,14 +27,14 @@ class UI_EXPORT OSExchangeDataProviderAura : public OSExchangeData::Provider { // Overridden from OSExchangeData::Provider: virtual void SetString(const string16& data) OVERRIDE; virtual void SetURL(const GURL& url, const string16& title) OVERRIDE; - virtual void SetFilename(const FilePath& path) OVERRIDE; + virtual void SetFilename(const base::FilePath& path) OVERRIDE; virtual void SetFilenames( const std::vector<OSExchangeData::FileInfo>& filenames) OVERRIDE; virtual void SetPickledData(OSExchangeData::CustomFormat format, const Pickle& data) OVERRIDE; virtual bool GetString(string16* data) const OVERRIDE; virtual bool GetURLAndTitle(GURL* url, string16* title) const OVERRIDE; - virtual bool GetFilename(FilePath* path) const OVERRIDE; + virtual bool GetFilename(base::FilePath* path) const OVERRIDE; virtual bool GetFilenames( std::vector<OSExchangeData::FileInfo>* filenames) const OVERRIDE; virtual bool GetPickledData(OSExchangeData::CustomFormat format, @@ -45,9 +45,9 @@ class UI_EXPORT OSExchangeDataProviderAura : public OSExchangeData::Provider { virtual bool HasCustomFormat( OSExchangeData::CustomFormat format) const OVERRIDE; #if defined(OS_WIN) - virtual void SetFileContents(const FilePath& filename, + virtual void SetFileContents(const base::FilePath& filename, const std::string& file_contents) OVERRIDE; - virtual bool GetFileContents(FilePath* filename, + virtual bool GetFileContents(base::FilePath* filename, std::string* file_contents) const OVERRIDE; virtual bool HasFileContents() const OVERRIDE; virtual void SetDownloadFileInfo( diff --git a/ui/base/dragdrop/os_exchange_data_provider_gtk.cc b/ui/base/dragdrop/os_exchange_data_provider_gtk.cc index 8211563..5abbed2 100644 --- a/ui/base/dragdrop/os_exchange_data_provider_gtk.cc +++ b/ui/base/dragdrop/os_exchange_data_provider_gtk.cc @@ -102,8 +102,8 @@ void OSExchangeDataProviderGtk::WriteFormatToSelection( if ((format & OSExchangeData::FILE_NAME) != 0) { gchar* uri_array[2]; - uri_array[0] = - strdup(net::FilePathToFileURL(FilePath(filename_)).spec().c_str()); + uri_array[0] = strdup(net::FilePathToFileURL( + base::FilePath(filename_)).spec().c_str()); uri_array[1] = NULL; gtk_selection_data_set_uris(selection, uri_array); free(uri_array[0]); @@ -134,7 +134,7 @@ void OSExchangeDataProviderGtk::SetURL(const GURL& url, const string16& title) { formats_ |= OSExchangeData::URL; } -void OSExchangeDataProviderGtk::SetFilename(const FilePath& path) { +void OSExchangeDataProviderGtk::SetFilename(const base::FilePath& path) { filename_ = path; formats_ |= OSExchangeData::FILE_NAME; } @@ -167,7 +167,7 @@ bool OSExchangeDataProviderGtk::GetURLAndTitle(GURL* url, return true; } -bool OSExchangeDataProviderGtk::GetFilename(FilePath* path) const { +bool OSExchangeDataProviderGtk::GetFilename(base::FilePath* path) const { if ((formats_ & OSExchangeData::FILE_NAME) == 0) return false; *path = filename_; diff --git a/ui/base/dragdrop/os_exchange_data_provider_gtk.h b/ui/base/dragdrop/os_exchange_data_provider_gtk.h index 8a72edd..0e316fa 100644 --- a/ui/base/dragdrop/os_exchange_data_provider_gtk.h +++ b/ui/base/dragdrop/os_exchange_data_provider_gtk.h @@ -60,7 +60,7 @@ class UI_EXPORT OSExchangeDataProviderGtk : public OSExchangeData::Provider { // Provider methods. virtual void SetString(const string16& data) OVERRIDE; virtual void SetURL(const GURL& url, const string16& title) OVERRIDE; - virtual void SetFilename(const FilePath& path) OVERRIDE; + virtual void SetFilename(const base::FilePath& path) OVERRIDE; virtual void SetFilenames( const std::vector<OSExchangeData::FileInfo>& filenames) OVERRIDE { NOTREACHED(); @@ -69,7 +69,7 @@ class UI_EXPORT OSExchangeDataProviderGtk : public OSExchangeData::Provider { const Pickle& data) OVERRIDE; virtual bool GetString(string16* data) const OVERRIDE; virtual bool GetURLAndTitle(GURL* url, string16* title) const OVERRIDE; - virtual bool GetFilename(FilePath* path) const OVERRIDE; + virtual bool GetFilename(base::FilePath* path) const OVERRIDE; virtual bool GetFilenames( std::vector<OSExchangeData::FileInfo>* filenames) const OVERRIDE { NOTREACHED(); @@ -114,7 +114,7 @@ class UI_EXPORT OSExchangeDataProviderGtk : public OSExchangeData::Provider { string16 title_; // File name. - FilePath filename_; + base::FilePath filename_; // PICKLED_DATA contents. PickleData pickle_data_; diff --git a/ui/base/dragdrop/os_exchange_data_provider_win.cc b/ui/base/dragdrop/os_exchange_data_provider_win.cc index d1a88ab..02f87d3 100644 --- a/ui/base/dragdrop/os_exchange_data_provider_win.cc +++ b/ui/base/dragdrop/os_exchange_data_provider_win.cc @@ -36,10 +36,10 @@ static void CreateValidFileNameFromTitle(const GURL& url, const string16& title, string16* validated); // Creates a new STGMEDIUM object to hold a file. -static STGMEDIUM* GetStorageForFileName(const FilePath& path); +static STGMEDIUM* GetStorageForFileName(const base::FilePath& path); // Creates a File Descriptor for the creation of a file to the given URL and // returns a handle to it. -static STGMEDIUM* GetStorageForFileDescriptor(const FilePath& path); +static STGMEDIUM* GetStorageForFileDescriptor(const base::FilePath& path); /////////////////////////////////////////////////////////////////////////////// // FormatEtcEnumerator @@ -297,7 +297,7 @@ void OSExchangeDataProviderWin::SetURL(const GURL& url, CreateValidFileNameFromTitle(url, title, &valid_file_name); std::string shortcut_url_file_contents; GetInternetShortcutFileContents(url, &shortcut_url_file_contents); - SetFileContents(FilePath(valid_file_name), shortcut_url_file_contents); + SetFileContents(base::FilePath(valid_file_name), shortcut_url_file_contents); // Add a UniformResourceLocator link for apps like IE and Word. storage = GetStorageForString16(UTF8ToUTF16(url.spec())); @@ -320,7 +320,7 @@ void OSExchangeDataProviderWin::SetURL(const GURL& url, new DataObjectImpl::StoredDataInfo(CF_TEXT, storage)); } -void OSExchangeDataProviderWin::SetFilename(const FilePath& path) { +void OSExchangeDataProviderWin::SetFilename(const base::FilePath& path) { STGMEDIUM* storage = GetStorageForFileName(path); DataObjectImpl::StoredDataInfo* info = new DataObjectImpl::StoredDataInfo(CF_HDROP, storage); @@ -346,7 +346,7 @@ void OSExchangeDataProviderWin::SetPickledData(CLIPFORMAT format, } void OSExchangeDataProviderWin::SetFileContents( - const FilePath& filename, + const base::FilePath& filename, const std::string& file_contents) { // Add CFSTR_FILEDESCRIPTOR STGMEDIUM* storage = GetStorageForFileDescriptor(filename); @@ -400,11 +400,11 @@ bool OSExchangeDataProviderWin::GetURLAndTitle(GURL* url, return false; } -bool OSExchangeDataProviderWin::GetFilename(FilePath* path) const { +bool OSExchangeDataProviderWin::GetFilename(base::FilePath* path) const { std::vector<string16> filenames; bool success = ClipboardUtil::GetFilenames(source_object_, &filenames); if (success) - *path = FilePath(filenames[0]); + *path = base::FilePath(filenames[0]); return success; } @@ -415,7 +415,8 @@ bool OSExchangeDataProviderWin::GetFilenames( if (success) { for (size_t i = 0; i < filenames_local.size(); ++i) filenames->push_back( - OSExchangeData::FileInfo(FilePath(filenames_local[i]), FilePath())); + OSExchangeData::FileInfo(base::FilePath(filenames_local[i]), + base::FilePath())); } return success; } @@ -440,14 +441,14 @@ bool OSExchangeDataProviderWin::GetPickledData(CLIPFORMAT format, } bool OSExchangeDataProviderWin::GetFileContents( - FilePath* filename, + base::FilePath* filename, std::string* file_contents) const { string16 filename_str; if (!ClipboardUtil::GetFileContents(source_object_, &filename_str, file_contents)) { return false; } - *filename = FilePath(filename_str); + *filename = base::FilePath(filename_str); return true; } @@ -636,7 +637,7 @@ void DataObjectImpl::RemoveData(const FORMATETC& format) { } } -void DataObjectImpl::OnDownloadCompleted(const FilePath& file_path) { +void DataObjectImpl::OnDownloadCompleted(const base::FilePath& file_path) { CLIPFORMAT hdrop_format = ClipboardUtil::GetCFHDropFormat()->cfFormat; DataObjectImpl::StoredData::iterator iter = contents_.begin(); for (; iter != contents_.end(); ++iter) { @@ -934,7 +935,7 @@ static void CreateValidFileNameFromTitle(const GURL& url, *validated += extension; } -static STGMEDIUM* GetStorageForFileName(const FilePath& path) { +static STGMEDIUM* GetStorageForFileName(const base::FilePath& path) { const size_t kDropSize = sizeof(DROPFILES); const size_t kTotalBytes = kDropSize + (path.value().length() + 2) * sizeof(wchar_t); @@ -958,7 +959,7 @@ static STGMEDIUM* GetStorageForFileName(const FilePath& path) { } static STGMEDIUM* GetStorageForFileDescriptor( - const FilePath& path) { + const base::FilePath& path) { string16 file_name = path.value(); DCHECK(!file_name.empty()); HANDLE hdata = GlobalAlloc(GPTR, sizeof(FILEGROUPDESCRIPTOR)); diff --git a/ui/base/dragdrop/os_exchange_data_provider_win.h b/ui/base/dragdrop/os_exchange_data_provider_win.h index 3381439..be7090b 100644 --- a/ui/base/dragdrop/os_exchange_data_provider_win.h +++ b/ui/base/dragdrop/os_exchange_data_provider_win.h @@ -46,7 +46,7 @@ class DataObjectImpl : public DownloadFileObserver, size_t size() const { return contents_.size(); } // DownloadFileObserver implementation: - virtual void OnDownloadCompleted(const FilePath& file_path); + virtual void OnDownloadCompleted(const base::FilePath& file_path); virtual void OnDownloadAborted(); // IDataObject implementation: @@ -161,23 +161,23 @@ class UI_EXPORT OSExchangeDataProviderWin : public OSExchangeData::Provider { // OSExchangeData::Provider methods. virtual void SetString(const string16& data); virtual void SetURL(const GURL& url, const string16& title); - virtual void SetFilename(const FilePath& path); + virtual void SetFilename(const base::FilePath& path); virtual void SetFilenames( const std::vector<OSExchangeData::FileInfo>& filenames); virtual void SetPickledData(OSExchangeData::CustomFormat format, const Pickle& data); - virtual void SetFileContents(const FilePath& filename, + virtual void SetFileContents(const base::FilePath& filename, const std::string& file_contents); virtual void SetHtml(const string16& html, const GURL& base_url); virtual bool GetString(string16* data) const; virtual bool GetURLAndTitle(GURL* url, string16* title) const; - virtual bool GetFilename(FilePath* path) const; + virtual bool GetFilename(base::FilePath* path) const; virtual bool GetFilenames( std::vector<OSExchangeData::FileInfo>* filenames) const; virtual bool GetPickledData(OSExchangeData::CustomFormat format, Pickle* data) const; - virtual bool GetFileContents(FilePath* filename, + virtual bool GetFileContents(base::FilePath* filename, std::string* file_contents) const; virtual bool GetHtml(string16* html, GURL* base_url) const; virtual bool HasString() const; diff --git a/ui/base/dragdrop/os_exchange_data_win_unittest.cc b/ui/base/dragdrop/os_exchange_data_win_unittest.cc index c5b0ed5..476eba9 100644 --- a/ui/base/dragdrop/os_exchange_data_win_unittest.cc +++ b/ui/base/dragdrop/os_exchange_data_win_unittest.cc @@ -361,10 +361,10 @@ TEST(OSExchangeDataTest, TestPickledData) { TEST(OSExchangeDataTest, FileContents) { OSExchangeData data; std::string file_contents("data\0with\0nulls", 15); - data.SetFileContents(FilePath(L"filename.txt"), file_contents); + data.SetFileContents(base::FilePath(L"filename.txt"), file_contents); OSExchangeData copy(CloneProvider(data)); - FilePath filename; + base::FilePath filename; std::string read_contents; EXPECT_TRUE(copy.GetFileContents(&filename, &read_contents)); EXPECT_EQ(L"filename.txt", filename.value()); diff --git a/ui/base/l10n/l10n_util_unittest.cc b/ui/base/l10n/l10n_util_unittest.cc index 86dcf23..5002c68 100644 --- a/ui/base/l10n/l10n_util_unittest.cc +++ b/ui/base/l10n/l10n_util_unittest.cc @@ -90,7 +90,7 @@ TEST_F(L10nUtilTest, GetAppLocale) { // Use a temporary locale dir so we don't have to actually build the locale // pak files for this test. base::ScopedPathOverride locale_dir_override(ui::DIR_LOCALES); - FilePath new_locale_dir; + base::FilePath new_locale_dir; ASSERT_TRUE(PathService::Get(ui::DIR_LOCALES, &new_locale_dir)); // Make fake locale files. std::string filenames[] = { @@ -110,7 +110,7 @@ TEST_F(L10nUtilTest, GetAppLocale) { }; for (size_t i = 0; i < arraysize(filenames); ++i) { - FilePath filename = new_locale_dir.AppendASCII( + base::FilePath filename = new_locale_dir.AppendASCII( filenames[i] + ".pak"); file_util::WriteFile(filename, "", 0); } diff --git a/ui/base/resource/data_pack.cc b/ui/base/resource/data_pack.cc index 87c8735..793e963 100644 --- a/ui/base/resource/data_pack.cc +++ b/ui/base/resource/data_pack.cc @@ -71,7 +71,7 @@ DataPack::DataPack(ui::ScaleFactor scale_factor) DataPack::~DataPack() { } -bool DataPack::LoadFromPath(const FilePath& path) { +bool DataPack::LoadFromPath(const base::FilePath& path) { mmap_.reset(new file_util::MemoryMappedFile); if (!mmap_->Initialize(path)) { DLOG(ERROR) << "Failed to mmap datapack"; @@ -212,7 +212,7 @@ ui::ScaleFactor DataPack::GetScaleFactor() const { } // static -bool DataPack::WritePack(const FilePath& path, +bool DataPack::WritePack(const base::FilePath& path, const std::map<uint16, base::StringPiece>& resources, TextEncodingType textEncodingType) { FILE* file = file_util::OpenFile(path, "wb"); diff --git a/ui/base/resource/data_pack_unittest.cc b/ui/base/resource/data_pack_unittest.cc index ed3d6d7..3258170 100644 --- a/ui/base/resource/data_pack_unittest.cc +++ b/ui/base/resource/data_pack_unittest.cc @@ -24,7 +24,7 @@ extern const size_t kSamplePakSize; TEST(DataPackTest, LoadFromPath) { base::ScopedTempDir dir; ASSERT_TRUE(dir.CreateUniqueTempDir()); - FilePath data_path = dir.path().Append(FILE_PATH_LITERAL("sample.pak")); + base::FilePath data_path = dir.path().Append(FILE_PATH_LITERAL("sample.pak")); // Dump contents into the pak file. ASSERT_EQ(file_util::WriteFile(data_path, kSamplePakContents, kSamplePakSize), @@ -56,7 +56,7 @@ TEST(DataPackTest, LoadFromPath) { TEST(DataPackTest, LoadFromFile) { base::ScopedTempDir dir; ASSERT_TRUE(dir.CreateUniqueTempDir()); - FilePath data_path = dir.path().Append(FILE_PATH_LITERAL("sample.pak")); + base::FilePath data_path = dir.path().Append(FILE_PATH_LITERAL("sample.pak")); // Dump contents into the pak file. ASSERT_EQ(file_util::WriteFile(data_path, kSamplePakContents, kSamplePakSize), @@ -101,7 +101,7 @@ INSTANTIATE_TEST_CASE_P(WriteUTF16, DataPackTest, ::testing::Values( DataPack::UTF16)); TEST(DataPackTest, LoadFileWithTruncatedHeader) { - FilePath data_path; + base::FilePath data_path; PathService::Get(base::DIR_SOURCE_ROOT, &data_path); data_path = data_path.Append(FILE_PATH_LITERAL( "ui/base/test/data/data_pack_unittest/truncated-header.pak")); @@ -113,7 +113,7 @@ TEST(DataPackTest, LoadFileWithTruncatedHeader) { TEST_P(DataPackTest, Write) { base::ScopedTempDir dir; ASSERT_TRUE(dir.CreateUniqueTempDir()); - FilePath file = dir.path().Append(FILE_PATH_LITERAL("data.pak")); + base::FilePath file = dir.path().Append(FILE_PATH_LITERAL("data.pak")); std::string one("one"); std::string two("two"); diff --git a/ui/base/resource/resource_bundle.cc b/ui/base/resource/resource_bundle.cc index 6ced085..2325507 100644 --- a/ui/base/resource/resource_bundle.cc +++ b/ui/base/resource/resource_bundle.cc @@ -153,7 +153,7 @@ void ResourceBundle::InitSharedInstanceWithPakFile( } // static -void ResourceBundle::InitSharedInstanceWithPakPath(const FilePath& path) { +void ResourceBundle::InitSharedInstanceWithPakPath(const base::FilePath& path) { DCHECK(g_shared_instance_ == NULL) << "ResourceBundle initialized twice"; g_shared_instance_ = new ResourceBundle(NULL); @@ -184,12 +184,12 @@ bool ResourceBundle::LocaleDataPakExists(const std::string& locale) { return !GetLocaleFilePath(locale, true).empty(); } -void ResourceBundle::AddDataPackFromPath(const FilePath& path, +void ResourceBundle::AddDataPackFromPath(const base::FilePath& path, ScaleFactor scale_factor) { AddDataPackFromPathInternal(path, scale_factor, false); } -void ResourceBundle::AddOptionalDataPackFromPath(const FilePath& path, +void ResourceBundle::AddOptionalDataPackFromPath(const base::FilePath& path, ScaleFactor scale_factor) { AddDataPackFromPathInternal(path, scale_factor, true); } @@ -210,9 +210,9 @@ void ResourceBundle::AddDataPackFromFile(base::PlatformFile file, FilePath ResourceBundle::GetLocaleFilePath(const std::string& app_locale, bool test_file_exists) { if (app_locale.empty()) - return FilePath(); + return base::FilePath(); - FilePath locale_file_path; + base::FilePath locale_file_path; PathService::Get(ui::DIR_LOCALES, &locale_file_path); @@ -226,10 +226,10 @@ FilePath ResourceBundle::GetLocaleFilePath(const std::string& app_locale, // Don't try to load empty values or values that are not absolute paths. if (locale_file_path.empty() || !locale_file_path.IsAbsolute()) - return FilePath(); + return base::FilePath(); if (test_file_exists && !file_util::PathExists(locale_file_path)) - return FilePath(); + return base::FilePath(); return locale_file_path; } @@ -239,7 +239,7 @@ std::string ResourceBundle::LoadLocaleResources( const std::string& pref_locale) { DCHECK(!locale_resources_data_.get()) << "locale.pak already loaded"; std::string app_locale = l10n_util::GetApplicationLocale(pref_locale); - FilePath locale_file_path = GetOverriddenPakPath(); + base::FilePath locale_file_path = GetOverriddenPakPath(); if (locale_file_path.empty()) { CommandLine* command_line = CommandLine::ForCurrentProcess(); if (command_line->HasSwitch(switches::kLocalePak)) { @@ -270,8 +270,8 @@ std::string ResourceBundle::LoadLocaleResources( return app_locale; } -void ResourceBundle::LoadTestResources(const FilePath& path, - const FilePath& locale_path) { +void ResourceBundle::LoadTestResources(const base::FilePath& path, + const base::FilePath& locale_path) { // Use the given resource pak for both common and localized resources. scoped_ptr<DataPack> data_pack( new DataPack(SCALE_FACTOR_100P)); @@ -291,11 +291,11 @@ void ResourceBundle::UnloadLocaleResources() { locale_resources_data_.reset(); } -void ResourceBundle::OverrideLocalePakForTest(const FilePath& pak_path) { +void ResourceBundle::OverrideLocalePakForTest(const base::FilePath& pak_path) { overridden_pak_path_ = pak_path; } -const FilePath& ResourceBundle::GetOverriddenPakPath() { +const base::FilePath& ResourceBundle::GetOverriddenPakPath() { return overridden_pak_path_; } @@ -508,14 +508,14 @@ void ResourceBundle::FreeImages() { images_.clear(); } -void ResourceBundle::AddDataPackFromPathInternal(const FilePath& path, +void ResourceBundle::AddDataPackFromPathInternal(const base::FilePath& path, ScaleFactor scale_factor, bool optional) { // Do not pass an empty |path| value to this method. If the absolute path is // unknown pass just the pack file name. DCHECK(!path.empty()); - FilePath pack_path = path; + base::FilePath pack_path = path; if (delegate_) pack_path = delegate_->GetPathForResourcePack(pack_path, scale_factor); diff --git a/ui/base/resource/resource_bundle.h b/ui/base/resource/resource_bundle.h index 8d42189..7b83628 100644 --- a/ui/base/resource/resource_bundle.h +++ b/ui/base/resource/resource_bundle.h @@ -71,15 +71,17 @@ class UI_EXPORT ResourceBundle { // the pack file to continue loading or an empty value to cancel loading. // |pack_path| will contain the complete default path for the pack file if // known or just the pack file name otherwise. - virtual FilePath GetPathForResourcePack(const FilePath& pack_path, - ScaleFactor scale_factor) = 0; + virtual base::FilePath GetPathForResourcePack( + const base::FilePath& pack_path, + ScaleFactor scale_factor) = 0; // Called before a locale pack file is loaded. Return the full path for // the pack file to continue loading or an empty value to cancel loading. // |pack_path| will contain the complete default path for the pack file if // known or just the pack file name otherwise. - virtual FilePath GetPathForLocalePack(const FilePath& pack_path, - const std::string& locale) = 0; + virtual base::FilePath GetPathForLocalePack( + const base::FilePath& pack_path, + const std::string& locale) = 0; // Return an image resource or an empty value to attempt retrieval of the // default resource. @@ -138,7 +140,7 @@ class UI_EXPORT ResourceBundle { base::PlatformFile file, bool should_load_common_resources); // Initialize the ResourceBundle using given data pack path for testing. - static void InitSharedInstanceWithPakPath(const FilePath& path); + static void InitSharedInstanceWithPakPath(const base::FilePath& path); // Delete the ResourceBundle for this process if it exists. static void CleanupSharedInstance(); @@ -159,14 +161,15 @@ class UI_EXPORT ResourceBundle { // this value). |scale_factor| is the scale of images in this resource pak // relative to the images in the 1x resource pak. This method is not thread // safe! You should call it immediately after calling InitSharedInstance. - void AddDataPackFromPath(const FilePath& path, ScaleFactor scale_factor); + void AddDataPackFromPath(const base::FilePath& path, + ScaleFactor scale_factor); // Same as above but using an already open file. void AddDataPackFromFile(base::PlatformFile file, ScaleFactor scale_factor); // Same as AddDataPackFromPath but does not log an error if the pack fails to // load. - void AddOptionalDataPackFromPath(const FilePath& path, + void AddOptionalDataPackFromPath(const base::FilePath& path, ScaleFactor scale_factor); // Changes the locale for an already-initialized ResourceBundle, returning the @@ -239,13 +242,13 @@ class UI_EXPORT ResourceBundle { // Overrides the path to the pak file from which the locale resources will be // loaded. Pass an empty path to undo. - void OverrideLocalePakForTest(const FilePath& pak_path); + void OverrideLocalePakForTest(const base::FilePath& pak_path); // Returns the full pathname of the locale file to load. May return an empty // string if no locale data files are found and |test_file_exists| is true. // Used on Android to load the local file in the browser process and pass it // to the sandboxed renderer process. - FilePath GetLocaleFilePath(const std::string& app_locale, + base::FilePath GetLocaleFilePath(const std::string& app_locale, bool test_file_exists); // Returns the maximum scale factor currently loaded. @@ -277,7 +280,7 @@ class UI_EXPORT ResourceBundle { // Implementation for AddDataPackFromPath and AddOptionalDataPackFromPath, if // the pack is not |optional| logs an error on failure to load. - void AddDataPackFromPathInternal(const FilePath& path, + void AddDataPackFromPathInternal(const base::FilePath& path, ScaleFactor scale_factor, bool optional); @@ -291,7 +294,8 @@ class UI_EXPORT ResourceBundle { // Load test resources in given paths. If either path is empty an empty // resource pack is loaded. - void LoadTestResources(const FilePath& path, const FilePath& locale_path); + void LoadTestResources(const base::FilePath& path, + const base::FilePath& locale_path); // Unload the locale specific strings and prepares to load new ones. See // comments for ReloadLocaleResources(). @@ -340,7 +344,7 @@ class UI_EXPORT ResourceBundle { // bright red bitmap. gfx::Image& GetEmptyImage(); - const FilePath& GetOverriddenPakPath(); + const base::FilePath& GetOverriddenPakPath(); // This pointer is guaranteed to outlive the ResourceBundle instance and may // be NULL. @@ -377,7 +381,7 @@ class UI_EXPORT ResourceBundle { scoped_ptr<gfx::Font> large_bold_font_; scoped_ptr<gfx::Font> web_font_; - FilePath overridden_pak_path_; + base::FilePath overridden_pak_path_; DISALLOW_COPY_AND_ASSIGN(ResourceBundle); }; diff --git a/ui/base/resource/resource_bundle_android.cc b/ui/base/resource/resource_bundle_android.cc index bb1c9d7..3e1e8aa 100644 --- a/ui/base/resource/resource_bundle_android.cc +++ b/ui/base/resource/resource_bundle_android.cc @@ -17,7 +17,7 @@ namespace ui { void ResourceBundle::LoadCommonResources() { - FilePath path; + base::FilePath path; PathService::Get(ui::DIR_RESOURCE_PAKS_ANDROID, &path); AddDataPackFromPath(path.AppendASCII("chrome.pak"), SCALE_FACTOR_NONE); diff --git a/ui/base/resource/resource_bundle_aurax11.cc b/ui/base/resource/resource_bundle_aurax11.cc index 810e011..389c87e6 100644 --- a/ui/base/resource/resource_bundle_aurax11.cc +++ b/ui/base/resource/resource_bundle_aurax11.cc @@ -17,12 +17,12 @@ namespace { FilePath GetResourcesPakFilePath(const std::string& pak_name) { - FilePath path; + base::FilePath path; if (PathService::Get(base::DIR_MODULE, &path)) return path.AppendASCII(pak_name.c_str()); // Return just the name of the pack file. - return FilePath(pak_name.c_str()); + return base::FilePath(pak_name.c_str()); } } // namespace diff --git a/ui/base/resource/resource_bundle_gtk.cc b/ui/base/resource/resource_bundle_gtk.cc index 4bf1bde..44c3ebc 100644 --- a/ui/base/resource/resource_bundle_gtk.cc +++ b/ui/base/resource/resource_bundle_gtk.cc @@ -54,12 +54,12 @@ GdkPixbuf* LoadPixbuf(base::RefCountedStaticMemory* data, bool rtl_enabled) { } FilePath GetResourcesPakFilePath(const std::string& pak_name) { - FilePath path; + base::FilePath path; if (PathService::Get(base::DIR_MODULE, &path)) return path.AppendASCII(pak_name.c_str()); // Return just the name of the pack file. - return FilePath(pak_name.c_str()); + return base::FilePath(pak_name.c_str()); } } // namespace diff --git a/ui/base/resource/resource_bundle_ios.mm b/ui/base/resource/resource_bundle_ios.mm index 7140d69a..0717161 100644 --- a/ui/base/resource/resource_bundle_ios.mm +++ b/ui/base/resource/resource_bundle_ios.mm @@ -36,9 +36,9 @@ FilePath GetResourcesPakFilePath(NSString* name, NSString* mac_locale) { } if (!resource_path) { // Return just the name of the pak file. - return FilePath(base::SysNSStringToUTF8(name) + ".pak"); + return base::FilePath(base::SysNSStringToUTF8(name) + ".pak"); } - return FilePath([resource_path fileSystemRepresentation]); + return base::FilePath([resource_path fileSystemRepresentation]); } } // namespace @@ -70,7 +70,8 @@ FilePath ResourceBundle::GetLocaleFilePath(const std::string& app_locale, if ([mac_locale isEqual:@"en_US"]) mac_locale = @"en"; - FilePath locale_file_path = GetResourcesPakFilePath(@"locale", mac_locale); + base::FilePath locale_file_path = + GetResourcesPakFilePath(@"locale", mac_locale); if (delegate_) { locale_file_path = @@ -79,10 +80,10 @@ FilePath ResourceBundle::GetLocaleFilePath(const std::string& app_locale, // Don't try to load empty values or values that are not absolute paths. if (locale_file_path.empty() || !locale_file_path.IsAbsolute()) - return FilePath(); + return base::FilePath(); if (test_file_exists && !file_util::PathExists(locale_file_path)) - return FilePath(); + return base::FilePath(); return locale_file_path; } diff --git a/ui/base/resource/resource_bundle_mac.mm b/ui/base/resource/resource_bundle_mac.mm index 2ddd057..fd9a2cb 100644 --- a/ui/base/resource/resource_bundle_mac.mm +++ b/ui/base/resource/resource_bundle_mac.mm @@ -40,10 +40,10 @@ FilePath GetResourcesPakFilePath(NSString* name, NSString* mac_locale) { if (!resource_path) { // Return just the name of the pack file. - return FilePath(base::SysNSStringToUTF8(name) + ".pak"); + return base::FilePath(base::SysNSStringToUTF8(name) + ".pak"); } - return FilePath([resource_path fileSystemRepresentation]); + return base::FilePath([resource_path fileSystemRepresentation]); } } // namespace @@ -78,7 +78,8 @@ FilePath ResourceBundle::GetLocaleFilePath(const std::string& app_locale, if ([mac_locale isEqual:@"en_US"]) mac_locale = @"en"; - FilePath locale_file_path = GetResourcesPakFilePath(@"locale", mac_locale); + base::FilePath locale_file_path = + GetResourcesPakFilePath(@"locale", mac_locale); if (delegate_) { locale_file_path = @@ -87,10 +88,10 @@ FilePath ResourceBundle::GetLocaleFilePath(const std::string& app_locale, // Don't try to load empty values or values that are not absolute paths. if (locale_file_path.empty() || !locale_file_path.IsAbsolute()) - return FilePath(); + return base::FilePath(); if (test_file_exists && !file_util::PathExists(locale_file_path)) - return FilePath(); + return base::FilePath(); return locale_file_path; } diff --git a/ui/base/resource/resource_bundle_unittest.cc b/ui/base/resource/resource_bundle_unittest.cc index 67f444d..70dd8c1 100644 --- a/ui/base/resource/resource_bundle_unittest.cc +++ b/ui/base/resource/resource_bundle_unittest.cc @@ -58,10 +58,10 @@ class MockResourceBundleDelegate : public ui::ResourceBundle::Delegate { virtual ~MockResourceBundleDelegate() { } - MOCK_METHOD2(GetPathForResourcePack, FilePath(const FilePath& pack_path, - ui::ScaleFactor scale_factor)); - MOCK_METHOD2(GetPathForLocalePack, FilePath(const FilePath& pack_path, - const std::string& locale)); + MOCK_METHOD2(GetPathForResourcePack, base::FilePath( + const base::FilePath& pack_path, ui::ScaleFactor scale_factor)); + MOCK_METHOD2(GetPathForLocalePack, base::FilePath( + const base::FilePath& pack_path, const std::string& locale)); MOCK_METHOD1(GetImageNamed, gfx::Image(int resource_id)); MOCK_METHOD2(GetNativeImageNamed, gfx::Image(int resource_id, @@ -119,7 +119,7 @@ void AddCustomChunk(const base::StringPiece& custom_chunk, // which is |edge_size|x|edge_size| pixels. // If |custom_chunk| is non empty, adds it after the IHDR chunk // in the encoded bitmap data. -void CreateDataPackWithSingleBitmap(const FilePath& path, +void CreateDataPackWithSingleBitmap(const base::FilePath& path, int edge_size, const base::StringPiece& custom_chunk) { SkBitmap bitmap; @@ -174,12 +174,12 @@ TEST_F(ResourceBundleTest, DelegateGetPathForResourcePack) { MockResourceBundleDelegate delegate; ResourceBundle* resource_bundle = CreateResourceBundle(&delegate); - FilePath pack_path(FILE_PATH_LITERAL("/path/to/test_path.pak")); + base::FilePath pack_path(FILE_PATH_LITERAL("/path/to/test_path.pak")); ui::ScaleFactor pack_scale_factor = ui::SCALE_FACTOR_200P; EXPECT_CALL(delegate, GetPathForResourcePack( - Property(&FilePath::value, pack_path.value()), + Property(&base::FilePath::value, pack_path.value()), pack_scale_factor)) .Times(1) .WillOnce(Return(pack_path)); @@ -202,7 +202,7 @@ TEST_F(ResourceBundleTest, MAYBE_DelegateGetPathForLocalePack) { // Cancel the load. EXPECT_CALL(delegate, GetPathForLocalePack(_, locale)) .Times(2) - .WillRepeatedly(Return(FilePath())) + .WillRepeatedly(Return(base::FilePath())) .RetiresOnSaturation(); EXPECT_FALSE(resource_bundle->LocaleDataPakExists(locale)); @@ -348,7 +348,7 @@ class ResourceBundleImageTest : public ResourceBundleTest { // Returns resource bundle which uses an empty data pak for locale data. ui::ResourceBundle* CreateResourceBundleWithEmptyLocalePak() { // Write an empty data pak for locale data. - const FilePath& locale_path = dir_path().Append( + const base::FilePath& locale_path = dir_path().Append( FILE_PATH_LITERAL("locale.pak")); EXPECT_EQ(file_util::WriteFile(locale_path, kEmptyPakContents, kEmptyPakSize), @@ -357,12 +357,12 @@ class ResourceBundleImageTest : public ResourceBundleTest { ui::ResourceBundle* resource_bundle = CreateResourceBundle(NULL); // Load the empty locale data pak. - resource_bundle->LoadTestResources(FilePath(), locale_path); + resource_bundle->LoadTestResources(base::FilePath(), locale_path); return resource_bundle; } // Returns the path of temporary directory to write test data packs into. - const FilePath& dir_path() { return dir_.path(); } + const base::FilePath& dir_path() { return dir_.path(); } private: scoped_ptr<DataPack> locale_pack_; @@ -374,7 +374,7 @@ class ResourceBundleImageTest : public ResourceBundleTest { // Verify that we don't crash when trying to load a resource that is not found. // In some cases, we fail to mmap resources.pak, but try to keep going anyway. TEST_F(ResourceBundleImageTest, LoadDataResourceBytes) { - FilePath data_path = dir_path().Append(FILE_PATH_LITERAL("sample.pak")); + base::FilePath data_path = dir_path().Append(FILE_PATH_LITERAL("sample.pak")); // Dump contents into the pak files. ASSERT_EQ(file_util::WriteFile(data_path, kEmptyPakContents, @@ -390,15 +390,16 @@ TEST_F(ResourceBundleImageTest, LoadDataResourceBytes) { // Give a .pak file that doesn't exist so we will fail to load it. resource_bundle->AddDataPackFromPath( - FilePath(FILE_PATH_LITERAL("non-existant-file.pak")), + base::FilePath(FILE_PATH_LITERAL("non-existant-file.pak")), ui::SCALE_FACTOR_NONE); EXPECT_EQ(NULL, resource_bundle->LoadDataResourceBytes( kUnfoundResourceId)); } TEST_F(ResourceBundleImageTest, GetRawDataResource) { - FilePath data_path = dir_path().Append(FILE_PATH_LITERAL("sample.pak")); - FilePath data_2x_path = dir_path().Append(FILE_PATH_LITERAL("sample_2x.pak")); + base::FilePath data_path = dir_path().Append(FILE_PATH_LITERAL("sample.pak")); + base::FilePath data_2x_path = + dir_path().Append(FILE_PATH_LITERAL("sample_2x.pak")); // Dump contents into the pak files. ASSERT_EQ(file_util::WriteFile(data_path, kSamplePakContents, @@ -429,8 +430,8 @@ TEST_F(ResourceBundleImageTest, GetRawDataResource) { // Test requesting image reps at various scale factors from the image returned // via ResourceBundle::GetImageNamed(). TEST_F(ResourceBundleImageTest, GetImageNamed) { - FilePath data_1x_path = dir_path().AppendASCII("sample_1x.pak"); - FilePath data_2x_path = dir_path().AppendASCII("sample_2x.pak"); + base::FilePath data_1x_path = dir_path().AppendASCII("sample_1x.pak"); + base::FilePath data_2x_path = dir_path().AppendASCII("sample_2x.pak"); // Create the pak files. CreateDataPackWithSingleBitmap(data_1x_path, 10, base::StringPiece()); @@ -470,8 +471,8 @@ TEST_F(ResourceBundleImageTest, GetImageNamed) { // Test that GetImageNamed() behaves properly for images which GRIT has // annotated as having fallen back to 1x. TEST_F(ResourceBundleImageTest, GetImageNamedFallback1x) { - FilePath data_path = dir_path().AppendASCII("sample.pak"); - FilePath data_2x_path = dir_path().AppendASCII("sample_2x.pak"); + base::FilePath data_path = dir_path().AppendASCII("sample.pak"); + base::FilePath data_2x_path = dir_path().AppendASCII("sample_2x.pak"); // Create the pak files. CreateDataPackWithSingleBitmap(data_path, 10, base::StringPiece()); @@ -498,7 +499,7 @@ TEST_F(ResourceBundleImageTest, GetImageNamedFallback1x) { } TEST_F(ResourceBundleImageTest, FallbackToNone) { - FilePath data_default_path = dir_path().AppendASCII("sample.pak"); + base::FilePath data_default_path = dir_path().AppendASCII("sample.pak"); // Create the pak files. CreateDataPackWithSingleBitmap(data_default_path, 10, base::StringPiece()); diff --git a/ui/base/resource/resource_bundle_win.cc b/ui/base/resource/resource_bundle_win.cc index 0f6092d..aad1ef1 100644 --- a/ui/base/resource/resource_bundle_win.cc +++ b/ui/base/resource/resource_bundle_win.cc @@ -25,12 +25,12 @@ HINSTANCE GetCurrentResourceDLL() { } FilePath GetResourcesPakFilePath(const std::string& pak_name) { - FilePath path; + base::FilePath path; if (PathService::Get(base::DIR_MODULE, &path)) return path.AppendASCII(pak_name.c_str()); // Return just the name of the pack file. - return FilePath(ASCIIToUTF16(pak_name)); + return base::FilePath(ASCIIToUTF16(pak_name)); } } // namespace diff --git a/ui/base/text/text_elider.cc b/ui/base/text/text_elider.cc index defdec8..fa466da 100644 --- a/ui/base/text/text_elider.cc +++ b/ui/base/text/text_elider.cc @@ -398,7 +398,7 @@ string16 ElideUrl(const GURL& url, ELIDE_AT_END); } -string16 ElideFilename(const FilePath& filename, +string16 ElideFilename(const base::FilePath& filename, const gfx::Font& font, int available_pixel_width) { #if defined(OS_WIN) diff --git a/ui/base/text/text_elider_unittest.cc b/ui/base/text/text_elider_unittest.cc index 8f9aa9c..cbf895f 100644 --- a/ui/base/text/text_elider_unittest.cc +++ b/ui/base/text/text_elider_unittest.cc @@ -25,7 +25,7 @@ struct Testcase { }; struct FileTestcase { - const FilePath::StringType input; + const base::FilePath::StringType input; const std::string output; }; @@ -263,8 +263,8 @@ TEST(TextEliderTest, TestFileURLEliding) { #endif TEST(TextEliderTest, MAYBE_TestFilenameEliding) { const std::string kEllipsisStr(kEllipsis); - const FilePath::StringType kPathSeparator = - FilePath::StringType().append(1, FilePath::kSeparators[0]); + const base::FilePath::StringType kPathSeparator = + base::FilePath::StringType().append(1, base::FilePath::kSeparators[0]); FileTestcase testcases[] = { {FILE_PATH_LITERAL(""), ""}, @@ -302,7 +302,7 @@ TEST(TextEliderTest, MAYBE_TestFilenameEliding) { static const gfx::Font font; for (size_t i = 0; i < arraysize(testcases); ++i) { - FilePath filepath(testcases[i].input); + base::FilePath filepath(testcases[i].input); string16 expected = UTF8ToUTF16(testcases[i].output); expected = base::i18n::GetDisplayStringInLTRDirectionality(expected); EXPECT_EQ(expected, ElideFilename(filepath, diff --git a/ui/base/ui_base_paths.cc b/ui/base/ui_base_paths.cc index 229e717..6384c97 100644 --- a/ui/base/ui_base_paths.cc +++ b/ui/base/ui_base_paths.cc @@ -16,12 +16,12 @@ namespace ui { -bool PathProvider(int key, FilePath* result) { +bool PathProvider(int key, base::FilePath* result) { // Assume that we will not need to create the directory if it does not exist. // This flag can be set to true for the cases where we want to create it. bool create_dir = false; - FilePath cur; + base::FilePath cur; switch (key) { case ui::DIR_LOCALES: if (!PathService::Get(base::DIR_MODULE, &cur)) diff --git a/ui/base/win/shell.cc b/ui/base/win/shell.cc index c82daf0..7409fad 100644 --- a/ui/base/win/shell.cc +++ b/ui/base/win/shell.cc @@ -86,12 +86,12 @@ bool OpenAnyViaShell(const string16& full_path, return false; } -bool OpenItemViaShell(const FilePath& full_path) { +bool OpenItemViaShell(const base::FilePath& full_path) { return OpenAnyViaShell(full_path.value(), full_path.DirName().value(), string16(), 0); } -bool OpenItemViaShellNoZoneCheck(const FilePath& full_path) { +bool OpenItemViaShellNoZoneCheck(const base::FilePath& full_path) { return OpenAnyViaShell(full_path.value(), string16(), string16(), SEE_MASK_NOZONECHECKS | SEE_MASK_FLAG_DDEWAIT); } diff --git a/ui/compositor/layer_unittest.cc b/ui/compositor/layer_unittest.cc index c87e07b..c641e8f 100644 --- a/ui/compositor/layer_unittest.cc +++ b/ui/compositor/layer_unittest.cc @@ -140,13 +140,15 @@ class LayerWithRealCompositorTest : public testing::Test { gfx::Rect(0, 0, layer->bounds().width(), layer->bounds().height())); } - const FilePath& test_data_directory() const { return test_data_directory_; } + const base::FilePath& test_data_directory() const { + return test_data_directory_; + } private: scoped_ptr<TestCompositorHost> window_; // The root directory for test files. - FilePath test_data_directory_; + base::FilePath test_data_directory_; DISALLOW_COPY_AND_ASSIGN(LayerWithRealCompositorTest); }; @@ -892,8 +894,10 @@ TEST_F(LayerWithRealCompositorTest, MAYBE_ModifyHierarchy) { scoped_ptr<Layer> l12(CreateColorLayer(SK_ColorBLUE, gfx::Rect(10, 10, 25, 25))); - FilePath ref_img1 = test_data_directory().AppendASCII("ModifyHierarchy1.png"); - FilePath ref_img2 = test_data_directory().AppendASCII("ModifyHierarchy2.png"); + base::FilePath ref_img1 = + test_data_directory().AppendASCII("ModifyHierarchy1.png"); + base::FilePath ref_img2 = + test_data_directory().AppendASCII("ModifyHierarchy2.png"); SkBitmap bitmap; l0->Add(l11.get()); @@ -946,7 +950,7 @@ TEST_F(LayerWithRealCompositorTest, MAYBE_Opacity) { scoped_ptr<Layer> l11(CreateColorLayer(SK_ColorGREEN, gfx::Rect(0, 0, 25, 25))); - FilePath ref_img = test_data_directory().AppendASCII("Opacity.png"); + base::FilePath ref_img = test_data_directory().AppendASCII("Opacity.png"); l11->SetOpacity(0.75); l0->Add(l11.get()); diff --git a/ui/gfx/color_profile_win.cc b/ui/gfx/color_profile_win.cc index 5c81271..51b1b31 100644 --- a/ui/gfx/color_profile_win.cc +++ b/ui/gfx/color_profile_win.cc @@ -21,7 +21,7 @@ void ReadColorProfile(std::vector<char>* profile) { if (!res) return; std::string profileData; - if (!file_util::ReadFileToString(FilePath(path), &profileData)) + if (!file_util::ReadFileToString(base::FilePath(path), &profileData)) return; size_t length = profileData.size(); if (length > gfx::kMaxProfileLength) diff --git a/ui/gfx/gfx_paths.cc b/ui/gfx/gfx_paths.cc index 6fe4789..5c65674 100644 --- a/ui/gfx/gfx_paths.cc +++ b/ui/gfx/gfx_paths.cc @@ -11,8 +11,8 @@ namespace gfx { -bool PathProvider(int key, FilePath* result) { - FilePath cur; +bool PathProvider(int key, base::FilePath* result) { + base::FilePath cur; switch (key) { // The following are only valid in the development environment, and // will fail if executed from an installed executable (because the diff --git a/ui/gfx/icon_util.cc b/ui/gfx/icon_util.cc index d071a2f..4ce9779 100644 --- a/ui/gfx/icon_util.cc +++ b/ui/gfx/icon_util.cc @@ -344,7 +344,7 @@ SkBitmap IconUtil::CreateSkBitmapFromHICONHelper(HICON icon, bool IconUtil::CreateIconFileFromSkBitmap(const SkBitmap& bitmap, const SkBitmap& large_bitmap, - const FilePath& icon_path) { + const base::FilePath& icon_path) { // Only 32 bit ARGB bitmaps are supported. We also make sure the bitmap has // been properly initialized. SkAutoLockPixels bitmap_lock(bitmap); diff --git a/ui/gfx/icon_util_unittest.cc b/ui/gfx/icon_util_unittest.cc index 502c0eb..e462c2d 100644 --- a/ui/gfx/icon_util_unittest.cc +++ b/ui/gfx/icon_util_unittest.cc @@ -34,7 +34,8 @@ class IconUtilTest : public testing::Test { // Given a file name for an .ico file and an image dimentions, this // function loads the icon and returns an HICON handle. - HICON LoadIconFromFile(const FilePath& filename, int width, int height) { + HICON LoadIconFromFile(const base::FilePath& filename, + int width, int height) { HICON icon = static_cast<HICON>(LoadImage(NULL, filename.value().c_str(), IMAGE_ICON, @@ -55,7 +56,7 @@ class IconUtilTest : public testing::Test { protected: // The root directory for test files. - FilePath test_data_directory_; + base::FilePath test_data_directory_; // Directory for creating files by this test. base::ScopedTempDir temp_directory_; @@ -69,7 +70,8 @@ class IconUtilTest : public testing::Test { // The following test case makes sure IconUtil::SkBitmapFromHICON fails // gracefully when called with invalid input parameters. TEST_F(IconUtilTest, TestIconToBitmapInvalidParameters) { - FilePath icon_filename = test_data_directory_.AppendASCII(kSmallIconName); + base::FilePath icon_filename = + test_data_directory_.AppendASCII(kSmallIconName); gfx::Size icon_size(kSmallIconWidth, kSmallIconHeight); HICON icon = LoadIconFromFile(icon_filename, icon_size.width(), @@ -126,9 +128,9 @@ TEST_F(IconUtilTest, TestBitmapToIconInvalidParameters) { // fails gracefully when called with invalid input parameters. TEST_F(IconUtilTest, TestCreateIconFileInvalidParameters) { scoped_ptr<SkBitmap> bitmap; - FilePath valid_icon_filename = test_data_directory_.AppendASCII( + base::FilePath valid_icon_filename = test_data_directory_.AppendASCII( kSmallIconName); - FilePath invalid_icon_filename(FILE_PATH_LITERAL("C:\\<>?.ico")); + base::FilePath invalid_icon_filename(FILE_PATH_LITERAL("C:\\<>?.ico")); // Wrong bitmap format. bitmap.reset(new SkBitmap); @@ -165,7 +167,7 @@ TEST_F(IconUtilTest, TestCreateIconFileInvalidParameters) { // the HICON into a bitmap, the bitmap has the expected format and dimentions. TEST_F(IconUtilTest, TestCreateSkBitmapFromHICON) { scoped_ptr<SkBitmap> bitmap; - FilePath small_icon_filename = test_data_directory_.AppendASCII( + base::FilePath small_icon_filename = test_data_directory_.AppendASCII( kSmallIconName); gfx::Size small_icon_size(kSmallIconWidth, kSmallIconHeight); HICON small_icon = LoadIconFromFile(small_icon_filename, @@ -179,7 +181,7 @@ TEST_F(IconUtilTest, TestCreateSkBitmapFromHICON) { EXPECT_EQ(bitmap->config(), SkBitmap::kARGB_8888_Config); ::DestroyIcon(small_icon); - FilePath large_icon_filename = test_data_directory_.AppendASCII( + base::FilePath large_icon_filename = test_data_directory_.AppendASCII( kLargeIconName); gfx::Size large_icon_size(kLargeIconWidth, kLargeIconHeight); HICON large_icon = LoadIconFromFile(large_icon_filename, @@ -235,7 +237,8 @@ TEST_F(IconUtilTest, TestBasicCreateHICONFromSkBitmap) { // The following test case makes sure IconUtil::CreateIconFileFromSkBitmap // creates a valid .ico file given an SkBitmap. TEST_F(IconUtilTest, TestCreateIconFile) { - FilePath icon_filename = test_data_directory_.AppendASCII(kTempIconFilename); + base::FilePath icon_filename = + test_data_directory_.AppendASCII(kTempIconFilename); SkBitmap bitmap = CreateBlackSkBitmap(kSmallIconWidth, kSmallIconHeight); EXPECT_TRUE(IconUtil::CreateIconFileFromSkBitmap(bitmap, SkBitmap(), @@ -254,7 +257,8 @@ TEST_F(IconUtilTest, TestCreateIconFile) { } TEST_F(IconUtilTest, TestCreateIconFileWithLargeBitmap) { - const FilePath icon_path(temp_directory_.path().AppendASCII("test.ico")); + const base::FilePath icon_path( + temp_directory_.path().AppendASCII("test.ico")); const SkBitmap bitmap_48 = CreateBlackSkBitmap(48, 48); const SkBitmap bitmap_256 = CreateBlackSkBitmap(256, 256); diff --git a/ui/gfx/video_decode_acceleration_support_mac.mm b/ui/gfx/video_decode_acceleration_support_mac.mm index c02f975..d4d19ff 100644 --- a/ui/gfx/video_decode_acceleration_support_mac.mm +++ b/ui/gfx/video_decode_acceleration_support_mac.mm @@ -57,7 +57,7 @@ bool InitializeVdaApis() { static bool should_initialize = true; if (should_initialize) { should_initialize = false; - FilePath path; + base::FilePath path; if (!base::mac::GetSearchPathDirectory( NSLibraryDirectory, NSSystemDomainMask, &path)) { return false; diff --git a/ui/gl/gl_implementation_android.cc b/ui/gl/gl_implementation_android.cc index 4dab47c..2b562a8 100644 --- a/ui/gl/gl_implementation_android.cc +++ b/ui/gl/gl_implementation_android.cc @@ -27,7 +27,7 @@ void GL_BINDING_CALL MarshalDepthRangeToDepthRangef(GLclampd z_near, glDepthRangef(static_cast<GLclampf>(z_near), static_cast<GLclampf>(z_far)); } -base::NativeLibrary LoadLibrary(const FilePath& filename) { +base::NativeLibrary LoadLibrary(const base::FilePath& filename) { std::string error; base::NativeLibrary library = base::LoadNativeLibrary(filename, &error); if (!library) { @@ -38,7 +38,7 @@ base::NativeLibrary LoadLibrary(const FilePath& filename) { } base::NativeLibrary LoadLibrary(const char* filename) { - return LoadLibrary(FilePath(filename)); + return LoadLibrary(base::FilePath(filename)); } } // namespace diff --git a/ui/gl/gl_implementation_linux.cc b/ui/gl/gl_implementation_linux.cc index dc81fbc..42f2d5c 100644 --- a/ui/gl/gl_implementation_linux.cc +++ b/ui/gl/gl_implementation_linux.cc @@ -34,7 +34,7 @@ void GL_BINDING_CALL MarshalDepthRangeToDepthRangef(GLclampd z_near, } // Load a library, printing an error message on failure. -base::NativeLibrary LoadLibrary(const FilePath& filename) { +base::NativeLibrary LoadLibrary(const base::FilePath& filename) { std::string error; base::NativeLibrary library = base::LoadNativeLibrary(filename, &error); @@ -46,7 +46,7 @@ base::NativeLibrary LoadLibrary(const FilePath& filename) { } base::NativeLibrary LoadLibrary(const char* filename) { - return LoadLibrary(FilePath(filename)); + return LoadLibrary(base::FilePath(filename)); } } // namespace @@ -72,7 +72,7 @@ bool InitializeGLBindings(GLImplementation implementation) { switch (implementation) { case kGLImplementationOSMesaGL: { - FilePath module_path; + base::FilePath module_path; if (!PathService::Get(base::DIR_MODULE, &module_path)) { LOG(ERROR) << "PathService::Get failed."; return false; diff --git a/ui/gl/gl_implementation_mac.cc b/ui/gl/gl_implementation_mac.cc index 0b22e43..590a14b 100644 --- a/ui/gl/gl_implementation_mac.cc +++ b/ui/gl/gl_implementation_mac.cc @@ -43,18 +43,18 @@ bool InitializeGLBindings(GLImplementation implementation) { case kGLImplementationOSMesaGL: { // osmesa.so is located in the build directory. This code path is only // valid in a developer build environment. - FilePath exe_path; + base::FilePath exe_path; if (!PathService::Get(base::FILE_EXE, &exe_path)) { LOG(ERROR) << "PathService::Get failed."; return false; } - FilePath bundle_path = base::mac::GetAppBundlePath(exe_path); + base::FilePath bundle_path = base::mac::GetAppBundlePath(exe_path); // Some unit test targets depend on osmesa but aren't built as app // bundles. In that case, the .so is next to the executable. if (bundle_path.empty()) bundle_path = exe_path; - FilePath build_dir_path = bundle_path.DirName(); - FilePath osmesa_path = build_dir_path.Append("osmesa.so"); + base::FilePath build_dir_path = bundle_path.DirName(); + base::FilePath osmesa_path = build_dir_path.Append("osmesa.so"); // When using OSMesa, just use OSMesaGetProcAddress to find entry points. base::NativeLibrary library = base::LoadNativeLibrary(osmesa_path, NULL); @@ -84,7 +84,7 @@ bool InitializeGLBindings(GLImplementation implementation) { case kGLImplementationDesktopGL: case kGLImplementationAppleGL: { base::NativeLibrary library = base::LoadNativeLibrary( - FilePath(kOpenGLFrameworkPath), NULL); + base::FilePath(kOpenGLFrameworkPath), NULL); if (!library) { LOG(ERROR) << "OpenGL framework not found"; return false; diff --git a/ui/gl/gl_implementation_win.cc b/ui/gl/gl_implementation_win.cc index fa442b7..22fcd77 100644 --- a/ui/gl/gl_implementation_win.cc +++ b/ui/gl/gl_implementation_win.cc @@ -44,9 +44,10 @@ void GL_BINDING_CALL MarshalDepthRangeToDepthRangef(GLclampd z_near, glDepthRangef(static_cast<GLclampf>(z_near), static_cast<GLclampf>(z_far)); } -bool LoadD3DXLibrary(const FilePath& module_path, - const FilePath::StringType& name) { - base::NativeLibrary library = base::LoadNativeLibrary(FilePath(name), NULL); +bool LoadD3DXLibrary(const base::FilePath& module_path, + const base::FilePath::StringType& name) { + base::NativeLibrary library = + base::LoadNativeLibrary(base::FilePath(name), NULL); if (!library) { library = base::LoadNativeLibrary(module_path.Append(name), NULL); if (!library) { @@ -80,7 +81,7 @@ bool InitializeGLBindings(GLImplementation implementation) { switch (implementation) { case kGLImplementationOSMesaGL: { - FilePath module_path; + base::FilePath module_path; if (!PathService::Get(base::DIR_MODULE, &module_path)) { LOG(ERROR) << "PathService::Get failed."; return false; @@ -112,7 +113,7 @@ bool InitializeGLBindings(GLImplementation implementation) { break; } case kGLImplementationEGLGLES2: { - FilePath module_path; + base::FilePath module_path; if (!PathService::Get(base::DIR_MODULE, &module_path)) return false; @@ -125,7 +126,7 @@ bool InitializeGLBindings(GLImplementation implementation) { LoadD3DXLibrary(module_path, kPreVistaD3DCompiler); } - FilePath gles_path; + base::FilePath gles_path; const CommandLine* command_line = CommandLine::ForCurrentProcess(); bool using_swift_shader = command_line->GetSwitchValueASCII(switches::kUseGL) == "swiftshader"; @@ -195,7 +196,7 @@ bool InitializeGLBindings(GLImplementation implementation) { // When using Windows OpenGL, first try wglGetProcAddress and then // Windows GetProcAddress. base::NativeLibrary library = base::LoadNativeLibrary( - FilePath(L"opengl32.dll"), NULL); + base::FilePath(L"opengl32.dll"), NULL); if (!library) { DVLOG(1) << "opengl32.dll not found"; return false; diff --git a/ui/metro_viewer/metro_viewer_messages.h b/ui/metro_viewer/metro_viewer_messages.h index ec625f0..fd2c5a6 100644 --- a/ui/metro_viewer/metro_viewer_messages.h +++ b/ui/metro_viewer/metro_viewer_messages.h @@ -80,7 +80,7 @@ IPC_MESSAGE_CONTROL2(MetroViewerHostMsg_FileOpenDone, IPC_MESSAGE_CONTROL2(MetroViewerHostMsg_MultiFileOpenDone, bool, /* success */ - std::vector<FilePath>) /* filenames */ + std::vector<base::FilePath>) /* filenames */ // Messages sent from the browser to the viewer: diff --git a/ui/shell_dialogs/gtk/select_file_dialog_impl.cc b/ui/shell_dialogs/gtk/select_file_dialog_impl.cc index d560af9..05f5113 100644 --- a/ui/shell_dialogs/gtk/select_file_dialog_impl.cc +++ b/ui/shell_dialogs/gtk/select_file_dialog_impl.cc @@ -68,8 +68,8 @@ SelectFileDialogImpl::SelectFileDialogImpl(Listener* listener, file_type_index_(0), type_(SELECT_NONE) { if (!last_saved_path_) { - last_saved_path_ = new FilePath(); - last_opened_path_ = new FilePath(); + last_saved_path_ = new base::FilePath(); + last_opened_path_ = new base::FilePath(); } } @@ -83,7 +83,8 @@ bool SelectFileDialogImpl::IsRunning(gfx::NativeWindow parent_window) const { return parents_.find(parent_window) != parents_.end(); } -bool SelectFileDialogImpl::CallDirectoryExistsOnUIThread(const FilePath& path) { +bool SelectFileDialogImpl::CallDirectoryExistsOnUIThread( + const base::FilePath& path) { base::ThreadRestrictions::ScopedAllowIO allow_io; return file_util::DirectoryExists(path); } diff --git a/ui/shell_dialogs/gtk/select_file_dialog_impl.h b/ui/shell_dialogs/gtk/select_file_dialog_impl.h index c575e33..b0206e0 100644 --- a/ui/shell_dialogs/gtk/select_file_dialog_impl.h +++ b/ui/shell_dialogs/gtk/select_file_dialog_impl.h @@ -43,20 +43,21 @@ class SelectFileDialogImpl : public SelectFileDialog { // SelectFileDialog implementation. // |params| is user data we pass back via the Listener interface. - virtual void SelectFileImpl(Type type, - const string16& title, - const FilePath& default_path, - const FileTypeInfo* file_types, - int file_type_index, - const FilePath::StringType& default_extension, - gfx::NativeWindow owning_window, - void* params) = 0; + virtual void SelectFileImpl( + Type type, + const string16& title, + const base::FilePath& default_path, + const FileTypeInfo* file_types, + int file_type_index, + const base::FilePath::StringType& default_extension, + gfx::NativeWindow owning_window, + void* params) = 0; // Wrapper for file_util::DirectoryExists() that allow access on the UI // thread. Use this only in the file dialog functions, where it's ok // because the file dialog has to do many stats anyway. One more won't // hurt too badly and it's likely already cached. - bool CallDirectoryExistsOnUIThread(const FilePath& path); + bool CallDirectoryExistsOnUIThread(const base::FilePath& path); // The file filters. FileTypeInfo file_types_; @@ -73,8 +74,8 @@ class SelectFileDialogImpl : public SelectFileDialog { // These two variables track where the user last saved a file or opened a // file so that we can display future dialogs with the same starting path. - static FilePath* last_saved_path_; - static FilePath* last_opened_path_; + static base::FilePath* last_saved_path_; + static base::FilePath* last_opened_path_; DISALLOW_COPY_AND_ASSIGN(SelectFileDialogImpl); }; diff --git a/ui/shell_dialogs/gtk/select_file_dialog_impl_gtk.cc b/ui/shell_dialogs/gtk/select_file_dialog_impl_gtk.cc index 7175a50..f22c06b 100644 --- a/ui/shell_dialogs/gtk/select_file_dialog_impl_gtk.cc +++ b/ui/shell_dialogs/gtk/select_file_dialog_impl_gtk.cc @@ -47,14 +47,15 @@ class SelectFileDialogImplGTK : public ui::SelectFileDialogImpl { // SelectFileDialog implementation. // |params| is user data we pass back via the Listener interface. - virtual void SelectFileImpl(Type type, - const string16& title, - const FilePath& default_path, - const FileTypeInfo* file_types, - int file_type_index, - const FilePath::StringType& default_extension, - gfx::NativeWindow owning_window, - void* params) OVERRIDE; + virtual void SelectFileImpl( + Type type, + const string16& title, + const base::FilePath& default_path, + const FileTypeInfo* file_types, + int file_type_index, + const base::FilePath::StringType& default_extension, + gfx::NativeWindow owning_window, + void* params) OVERRIDE; private: virtual bool HasMultipleFileTypeChoicesImpl() OVERRIDE; @@ -63,11 +64,11 @@ class SelectFileDialogImplGTK : public ui::SelectFileDialogImpl { void AddFilters(GtkFileChooser* chooser); // Notifies the listener that a single file was chosen. - void FileSelected(GtkWidget* dialog, const FilePath& path); + void FileSelected(GtkWidget* dialog, const base::FilePath& path); // Notifies the listener that multiple files were chosen. void MultiFilesSelected(GtkWidget* dialog, - const std::vector<FilePath>& files); + const std::vector<base::FilePath>& files); // Notifies the listener that no file was chosen (the action was canceled). // Dialog is passed so we can find that |params| pointer that was passed to @@ -75,16 +76,16 @@ class SelectFileDialogImplGTK : public ui::SelectFileDialogImpl { void FileNotSelected(GtkWidget* dialog); GtkWidget* CreateSelectFolderDialog(const std::string& title, - const FilePath& default_path, gfx::NativeWindow parent); + const base::FilePath& default_path, gfx::NativeWindow parent); GtkWidget* CreateFileOpenDialog(const std::string& title, - const FilePath& default_path, gfx::NativeWindow parent); + const base::FilePath& default_path, gfx::NativeWindow parent); GtkWidget* CreateMultiFileOpenDialog(const std::string& title, - const FilePath& default_path, gfx::NativeWindow parent); + const base::FilePath& default_path, gfx::NativeWindow parent); GtkWidget* CreateSaveAsDialog(const std::string& title, - const FilePath& default_path, gfx::NativeWindow parent); + const base::FilePath& default_path, gfx::NativeWindow parent); // Removes and returns the |params| associated with |dialog| from // |params_map_|. @@ -105,7 +106,7 @@ class SelectFileDialogImplGTK : public ui::SelectFileDialogImpl { // Common function for CreateFileOpenDialog and CreateMultiFileOpenDialog. GtkWidget* CreateFileOpenHelper(const std::string& title, - const FilePath& default_path, + const base::FilePath& default_path, gfx::NativeWindow parent); // Callback for when the user responds to a Save As or Open File dialog. @@ -166,10 +167,10 @@ bool SelectFileDialogImplGTK::HasMultipleFileTypeChoicesImpl() { void SelectFileDialogImplGTK::SelectFileImpl( Type type, const string16& title, - const FilePath& default_path, + const base::FilePath& default_path, const FileTypeInfo* file_types, int file_type_index, - const FilePath::StringType& default_extension, + const base::FilePath::StringType& default_extension, gfx::NativeWindow owning_window, void* params) { type_ = type; @@ -285,7 +286,7 @@ void SelectFileDialogImplGTK::AddFilters(GtkFileChooser* chooser) { } void SelectFileDialogImplGTK::FileSelected(GtkWidget* dialog, - const FilePath& path) { + const base::FilePath& path) { if (type_ == SELECT_SAVEAS_FILE) *last_saved_path_ = path.DirName(); else if (type_ == SELECT_OPEN_FILE || type_ == SELECT_FOLDER) @@ -305,7 +306,7 @@ void SelectFileDialogImplGTK::FileSelected(GtkWidget* dialog, } void SelectFileDialogImplGTK::MultiFilesSelected(GtkWidget* dialog, - const std::vector<FilePath>& files) { + const std::vector<base::FilePath>& files) { *last_opened_path_ = files[0].DirName(); if (listener_) @@ -322,7 +323,7 @@ void SelectFileDialogImplGTK::FileNotSelected(GtkWidget* dialog) { GtkWidget* SelectFileDialogImplGTK::CreateFileOpenHelper( const std::string& title, - const FilePath& default_path, + const base::FilePath& default_path, gfx::NativeWindow parent) { GtkWidget* dialog = gtk_file_chooser_dialog_new(title.c_str(), parent, @@ -351,7 +352,7 @@ GtkWidget* SelectFileDialogImplGTK::CreateFileOpenHelper( GtkWidget* SelectFileDialogImplGTK::CreateSelectFolderDialog( const std::string& title, - const FilePath& default_path, + const base::FilePath& default_path, gfx::NativeWindow parent) { std::string title_string = !title.empty() ? title : l10n_util::GetStringUTF8(IDS_SELECT_FOLDER_DIALOG_TITLE); @@ -378,7 +379,7 @@ GtkWidget* SelectFileDialogImplGTK::CreateSelectFolderDialog( GtkWidget* SelectFileDialogImplGTK::CreateFileOpenDialog( const std::string& title, - const FilePath& default_path, + const base::FilePath& default_path, gfx::NativeWindow parent) { std::string title_string = !title.empty() ? title : l10n_util::GetStringUTF8(IDS_OPEN_FILE_DIALOG_TITLE); @@ -392,7 +393,7 @@ GtkWidget* SelectFileDialogImplGTK::CreateFileOpenDialog( GtkWidget* SelectFileDialogImplGTK::CreateMultiFileOpenDialog( const std::string& title, - const FilePath& default_path, + const base::FilePath& default_path, gfx::NativeWindow parent) { std::string title_string = !title.empty() ? title : l10n_util::GetStringUTF8(IDS_OPEN_FILES_DIALOG_TITLE); @@ -405,7 +406,7 @@ GtkWidget* SelectFileDialogImplGTK::CreateMultiFileOpenDialog( } GtkWidget* SelectFileDialogImplGTK::CreateSaveAsDialog(const std::string& title, - const FilePath& default_path, gfx::NativeWindow parent) { + const base::FilePath& default_path, gfx::NativeWindow parent) { std::string title_string = !title.empty() ? title : l10n_util::GetStringUTF8(IDS_SAVE_AS_DIALOG_TITLE); @@ -493,7 +494,7 @@ void SelectFileDialogImplGTK::SelectSingleFileHelper(GtkWidget* dialog, return; } - FilePath path(filename); + base::FilePath path(filename); g_free(filename); if (allow_folder) { @@ -530,9 +531,9 @@ void SelectFileDialogImplGTK::OnSelectMultiFileDialogResponse(GtkWidget* dialog, return; } - std::vector<FilePath> filenames_fp; + std::vector<base::FilePath> filenames_fp; for (GSList* iter = filenames; iter != NULL; iter = g_slist_next(iter)) { - FilePath path(static_cast<char*>(iter->data)); + base::FilePath path(static_cast<char*>(iter->data)); g_free(iter->data); if (CallDirectoryExistsOnUIThread(path)) continue; diff --git a/ui/shell_dialogs/gtk/select_file_dialog_impl_kde.cc b/ui/shell_dialogs/gtk/select_file_dialog_impl_kde.cc index 6e8d24f..b5d4fe0 100644 --- a/ui/shell_dialogs/gtk/select_file_dialog_impl_kde.cc +++ b/ui/shell_dialogs/gtk/select_file_dialog_impl_kde.cc @@ -47,14 +47,15 @@ class SelectFileDialogImplKDE : public ui::SelectFileDialogImpl { // SelectFileDialog implementation. // |params| is user data we pass back via the Listener interface. - virtual void SelectFileImpl(Type type, - const string16& title, - const FilePath& default_path, - const FileTypeInfo* file_types, - int file_type_index, - const FilePath::StringType& default_extension, - gfx::NativeWindow owning_window, - void* params) OVERRIDE; + virtual void SelectFileImpl( + Type type, + const string16& title, + const base::FilePath& default_path, + const FileTypeInfo* file_types, + int file_type_index, + const base::FilePath::StringType& default_extension, + gfx::NativeWindow owning_window, + void* params) OVERRIDE; private: virtual bool HasMultipleFileTypeChoicesImpl() OVERRIDE; @@ -62,7 +63,7 @@ class SelectFileDialogImplKDE : public ui::SelectFileDialogImpl { struct KDialogParams { // This constructor can only be run from the UI thread. KDialogParams(const std::string& type, const std::string& title, - const FilePath& default_path, gfx::NativeWindow parent, + const base::FilePath& default_path, gfx::NativeWindow parent, bool file_operation, bool multiple_selection, void* kdialog_params, void (SelectFileDialogImplKDE::*callback)(const std::string&, @@ -77,7 +78,7 @@ class SelectFileDialogImplKDE : public ui::SelectFileDialogImpl { std::string type; std::string title; - FilePath default_path; + base::FilePath default_path; gfx::NativeWindow parent; bool file_operation; bool multiple_selection; @@ -93,7 +94,7 @@ class SelectFileDialogImplKDE : public ui::SelectFileDialogImpl { // Get KDialog command line representing the Argv array for KDialog. void GetKDialogCommandLine(const std::string& type, const std::string& title, - const FilePath& default_path, gfx::NativeWindow parent, + const base::FilePath& default_path, gfx::NativeWindow parent, bool file_operation, bool multiple_selection, CommandLine* command_line); // Call KDialog on a worker thread and post results back to the caller @@ -101,10 +102,11 @@ class SelectFileDialogImplKDE : public ui::SelectFileDialogImpl { void CallKDialogOutput(const KDialogParams& params); // Notifies the listener that a single file was chosen. - void FileSelected(const FilePath& path, void* params); + void FileSelected(const base::FilePath& path, void* params); // Notifies the listener that multiple files were chosen. - void MultiFilesSelected(const std::vector<FilePath>& files, void* params); + void MultiFilesSelected(const std::vector<base::FilePath>& files, + void* params); // Notifies the listener that no file was chosen (the action was canceled). // Dialog is passed so we can find that |params| pointer that was passed to @@ -112,19 +114,19 @@ class SelectFileDialogImplKDE : public ui::SelectFileDialogImpl { void FileNotSelected(void *params); void CreateSelectFolderDialog(const std::string& title, - const FilePath& default_path, + const base::FilePath& default_path, gfx::NativeWindow parent, void* params); void CreateFileOpenDialog(const std::string& title, - const FilePath& default_path, + const base::FilePath& default_path, gfx::NativeWindow parent, void* params); void CreateMultiFileOpenDialog(const std::string& title, - const FilePath& default_path, + const base::FilePath& default_path, gfx::NativeWindow parent, void* params); void CreateSaveAsDialog(const std::string& title, - const FilePath& default_path, + const base::FilePath& default_path, gfx::NativeWindow parent, void* params); // Common function for OnSelectSingleFileDialogResponse and @@ -162,10 +164,10 @@ SelectFileDialogImplKDE::~SelectFileDialogImplKDE() { void SelectFileDialogImplKDE::SelectFileImpl( Type type, const string16& title, - const FilePath& default_path, + const base::FilePath& default_path, const FileTypeInfo* file_types, int file_type_index, - const FilePath::StringType& default_extension, + const base::FilePath::StringType& default_extension, gfx::NativeWindow owning_window, void* params) { type_ = type; @@ -218,7 +220,8 @@ std::string SelectFileDialogImplKDE::GetMimeTypeFilterString() { for (size_t j = 0; j < file_types_.extensions[i].size(); ++j) { if (!file_types_.extensions[i][j].empty()) { std::string mime_type = base::nix::GetFileMimeType( - FilePath("name").ReplaceExtension(file_types_.extensions[i][j])); + base::FilePath("name").ReplaceExtension( + file_types_.extensions[i][j])); filter_set.insert(mime_type); } } @@ -260,7 +263,7 @@ void SelectFileDialogImplKDE::CallKDialogOutput(const KDialogParams& params) { } void SelectFileDialogImplKDE::GetKDialogCommandLine(const std::string& type, - const std::string& title, const FilePath& path, + const std::string& title, const base::FilePath& path, gfx::NativeWindow parent, bool file_operation, bool multiple_selection, CommandLine* command_line) { CHECK(command_line); @@ -282,7 +285,7 @@ void SelectFileDialogImplKDE::GetKDialogCommandLine(const std::string& type, command_line->AppendSwitch(type); // The path should never be empty. If it is, set it to PWD. if (path.empty()) - command_line->AppendArgPath(FilePath(".")); + command_line->AppendArgPath(base::FilePath(".")); else command_line->AppendArgPath(path); // Depending on the type of the operation we need, get the path to the @@ -292,7 +295,8 @@ void SelectFileDialogImplKDE::GetKDialogCommandLine(const std::string& type, VLOG(1) << "KDialog command line: " << command_line->GetCommandLineString(); } -void SelectFileDialogImplKDE::FileSelected(const FilePath& path, void* params) { +void SelectFileDialogImplKDE::FileSelected(const base::FilePath& path, + void* params) { if (type_ == SELECT_SAVEAS_FILE) *last_saved_path_ = path.DirName(); else if (type_ == SELECT_OPEN_FILE) @@ -308,7 +312,7 @@ void SelectFileDialogImplKDE::FileSelected(const FilePath& path, void* params) { } void SelectFileDialogImplKDE::MultiFilesSelected( - const std::vector<FilePath>& files, void* params) { + const std::vector<base::FilePath>& files, void* params) { *last_opened_path_ = files[0].DirName(); if (listener_) listener_->MultiFilesSelected(files, params); @@ -320,7 +324,7 @@ void SelectFileDialogImplKDE::FileNotSelected(void* params) { } void SelectFileDialogImplKDE::CreateSelectFolderDialog( - const std::string& title, const FilePath& default_path, + const std::string& title, const base::FilePath& default_path, gfx::NativeWindow parent, void *params) { base::WorkerPool::PostTask(FROM_HERE, base::Bind( @@ -336,7 +340,7 @@ void SelectFileDialogImplKDE::CreateSelectFolderDialog( } void SelectFileDialogImplKDE::CreateFileOpenDialog( - const std::string& title, const FilePath& default_path, + const std::string& title, const base::FilePath& default_path, gfx::NativeWindow parent, void* params) { base::WorkerPool::PostTask(FROM_HERE, base::Bind( @@ -352,7 +356,7 @@ void SelectFileDialogImplKDE::CreateFileOpenDialog( } void SelectFileDialogImplKDE::CreateMultiFileOpenDialog( - const std::string& title, const FilePath& default_path, + const std::string& title, const base::FilePath& default_path, gfx::NativeWindow parent, void* params) { base::WorkerPool::PostTask(FROM_HERE, base::Bind( @@ -368,7 +372,7 @@ void SelectFileDialogImplKDE::CreateMultiFileOpenDialog( } void SelectFileDialogImplKDE::CreateSaveAsDialog( - const std::string& title, const FilePath& default_path, + const std::string& title, const base::FilePath& default_path, gfx::NativeWindow parent, void* params) { base::WorkerPool::PostTask(FROM_HERE, base::Bind( @@ -391,7 +395,7 @@ void SelectFileDialogImplKDE::SelectSingleFileHelper(const std::string& output, return; } - FilePath path(output); + base::FilePath path(output); if (allow_folder) { FileSelected(path, params); return; @@ -424,10 +428,10 @@ void SelectFileDialogImplKDE::OnSelectMultiFileDialogResponse( std::vector<std::string> filenames; Tokenize(output, "\n", &filenames); - std::vector<FilePath> filenames_fp; + std::vector<base::FilePath> filenames_fp; for (std::vector<std::string>::iterator iter = filenames.begin(); iter != filenames.end(); ++iter) { - FilePath path(*iter); + base::FilePath path(*iter); if (CallDirectoryExistsOnUIThread(path)) continue; filenames_fp.push_back(path); diff --git a/ui/shell_dialogs/select_file_dialog.cc b/ui/shell_dialogs/select_file_dialog.cc index 5423329..9f440f9 100644 --- a/ui/shell_dialogs/select_file_dialog.cc +++ b/ui/shell_dialogs/select_file_dialog.cc @@ -55,7 +55,7 @@ void SelectFileDialog::Listener::FileSelectedWithExtraInfo( void SelectFileDialog::Listener::MultiFilesSelectedWithExtraInfo( const std::vector<ui::SelectedFileInfo>& files, void* params) { - std::vector<FilePath> file_paths; + std::vector<base::FilePath> file_paths; for (size_t i = 0; i < files.size(); ++i) file_paths.push_back(files[i].local_path); @@ -99,14 +99,15 @@ SelectFileDialog* SelectFileDialog::Create(Listener* listener, return NULL; } -void SelectFileDialog::SelectFile(Type type, - const string16& title, - const FilePath& default_path, - const FileTypeInfo* file_types, - int file_type_index, - const FilePath::StringType& default_extension, - gfx::NativeWindow owning_window, - void* params) { +void SelectFileDialog::SelectFile( + Type type, + const string16& title, + const base::FilePath& default_path, + const FileTypeInfo* file_types, + int file_type_index, + const base::FilePath::StringType& default_extension, + gfx::NativeWindow owning_window, + void* params) { DCHECK(listener_); if (select_file_policy_.get() && diff --git a/ui/shell_dialogs/select_file_dialog.h b/ui/shell_dialogs/select_file_dialog.h index 8500150..986b097 100644 --- a/ui/shell_dialogs/select_file_dialog.h +++ b/ui/shell_dialogs/select_file_dialog.h @@ -47,11 +47,11 @@ class SHELL_DIALOGS_EXPORT SelectFileDialog // file/folder path is in |path|. |params| is contextual passed to // SelectFile. |index| specifies the index of the filter passed to the // the initial call to SelectFile. - virtual void FileSelected(const FilePath& path, + virtual void FileSelected(const base::FilePath& path, int index, void* params) = 0; // Similar to FileSelected() but takes SelectedFileInfo instead of - // FilePath. Used for passing extra information (ex. display name). + // base::FilePath. Used for passing extra information (ex. display name). // // If not overridden, calls FileSelected() with path from |file|. virtual void FileSelectedWithExtraInfo( @@ -62,10 +62,10 @@ class SHELL_DIALOGS_EXPORT SelectFileDialog // Notifies the Listener that many files have been selected. The // files are in |files|. |params| is contextual passed to SelectFile. virtual void MultiFilesSelected( - const std::vector<FilePath>& files, void* params) {} + const std::vector<base::FilePath>& files, void* params) {} // Similar to MultiFilesSelected() but takes SelectedFileInfo instead of - // FilePath. Used for passing extra information (ex. display name). + // base::FilePath. Used for passing extra information (ex. display name). // // If not overridden, calls MultiFilesSelected() with paths from |files|. virtual void MultiFilesSelectedWithExtraInfo( @@ -106,7 +106,7 @@ class SHELL_DIALOGS_EXPORT SelectFileDialog // // Only pass more than one extension in the inner vector if the extensions // are equivalent. Do NOT include leading periods. - std::vector<std::vector<FilePath::StringType> > extensions; + std::vector<std::vector<base::FilePath::StringType> > extensions; // Overrides the system descriptions of the specified extensions. Entries // correspond to |extensions|; if left blank the system descriptions will @@ -149,10 +149,10 @@ class SHELL_DIALOGS_EXPORT SelectFileDialog // at a time (for obvious reasons). void SelectFile(Type type, const string16& title, - const FilePath& default_path, + const base::FilePath& default_path, const FileTypeInfo* file_types, int file_type_index, - const FilePath::StringType& default_extension, + const base::FilePath::StringType& default_extension, gfx::NativeWindow owning_window, void* params); bool HasMultipleFileTypeChoices(); @@ -170,14 +170,15 @@ class SHELL_DIALOGS_EXPORT SelectFileDialog // This is overridden in the platform-specific descendants of FileSelectDialog // and gets called from SelectFile after testing the // AllowFileSelectionDialogs-Policy. - virtual void SelectFileImpl(Type type, - const string16& title, - const FilePath& default_path, - const FileTypeInfo* file_types, - int file_type_index, - const FilePath::StringType& default_extension, - gfx::NativeWindow owning_window, - void* params) = 0; + virtual void SelectFileImpl( + Type type, + const string16& title, + const base::FilePath& default_path, + const FileTypeInfo* file_types, + int file_type_index, + const base::FilePath::StringType& default_extension, + gfx::NativeWindow owning_window, + void* params) = 0; // Returns the global ShellDialogsDelegate instance if any. ShellDialogsDelegate* GetShellDialogsDelegate(); diff --git a/ui/shell_dialogs/select_file_dialog_android.cc b/ui/shell_dialogs/select_file_dialog_android.cc index 993eb58..d46e37e 100644 --- a/ui/shell_dialogs/select_file_dialog_android.cc +++ b/ui/shell_dialogs/select_file_dialog_android.cc @@ -28,7 +28,7 @@ void SelectFileDialogImpl::OnFileSelected(JNIEnv* env, jstring filepath) { if (listener_) { std::string path = base::android::ConvertJavaStringToUTF8(env, filepath); - listener_->FileSelected(FilePath(path), 0, NULL); + listener_->FileSelected(base::FilePath(path), 0, NULL); } is_running_ = false; @@ -54,7 +54,7 @@ void SelectFileDialogImpl::ListenerDestroyed() { void SelectFileDialogImpl::SelectFileImpl( ui::SelectFileDialog::Type type, const string16& title, - const FilePath& default_path, + const base::FilePath& default_path, const SelectFileDialog::FileTypeInfo* file_types, int file_type_index, const std::string& default_extension, diff --git a/ui/shell_dialogs/select_file_dialog_android.h b/ui/shell_dialogs/select_file_dialog_android.h index b900cdc..1fb89af 100644 --- a/ui/shell_dialogs/select_file_dialog_android.h +++ b/ui/shell_dialogs/select_file_dialog_android.h @@ -32,7 +32,7 @@ class SelectFileDialogImpl : public ui::SelectFileDialog { virtual void SelectFileImpl( ui::SelectFileDialog::Type type, const string16& title, - const FilePath& default_path, + const base::FilePath& default_path, const ui::SelectFileDialog::FileTypeInfo* file_types, int file_type_index, const std::string& default_extension, diff --git a/ui/shell_dialogs/select_file_dialog_mac.mm b/ui/shell_dialogs/select_file_dialog_mac.mm index 14062c4..6a0e838 100644 --- a/ui/shell_dialogs/select_file_dialog_mac.mm +++ b/ui/shell_dialogs/select_file_dialog_mac.mm @@ -28,7 +28,7 @@ namespace { const int kFileTypePopupTag = 1234; -CFStringRef CreateUTIFromExtension(const FilePath::StringType& ext) { +CFStringRef CreateUTIFromExtension(const base::FilePath::StringType& ext) { base::mac::ScopedCFTypeRef<CFStringRef> ext_cf( base::SysUTF8ToCFStringRef(ext)); return UTTypeCreatePreferredIdentifierForTag( @@ -73,7 +73,7 @@ class SelectFileDialogImpl : public ui::SelectFileDialog { NSWindow* parent_window, bool was_cancelled, bool is_multi, - const std::vector<FilePath>& files, + const std::vector<base::FilePath>& files, int index); bool ShouldEnableFilename(NSSavePanel* dialog, NSString* filename); @@ -81,14 +81,15 @@ class SelectFileDialogImpl : public ui::SelectFileDialog { protected: // SelectFileDialog implementation. // |params| is user data we pass back via the Listener interface. - virtual void SelectFileImpl(Type type, - const string16& title, - const FilePath& default_path, - const FileTypeInfo* file_types, - int file_type_index, - const FilePath::StringType& default_extension, - gfx::NativeWindow owning_window, - void* params) OVERRIDE; + virtual void SelectFileImpl( + Type type, + const string16& title, + const base::FilePath& default_path, + const FileTypeInfo* file_types, + int file_type_index, + const base::FilePath::StringType& default_extension, + gfx::NativeWindow owning_window, + void* params) OVERRIDE; private: virtual ~SelectFileDialogImpl(); @@ -131,12 +132,13 @@ void SelectFileDialogImpl::ListenerDestroyed() { listener_ = NULL; } -void SelectFileDialogImpl::FileWasSelected(NSSavePanel* dialog, - NSWindow* parent_window, - bool was_cancelled, - bool is_multi, - const std::vector<FilePath>& files, - int index) { +void SelectFileDialogImpl::FileWasSelected( + NSSavePanel* dialog, + NSWindow* parent_window, + bool was_cancelled, + bool is_multi, + const std::vector<base::FilePath>& files, + int index) { void* params = params_map_[dialog]; params_map_.erase(dialog); parents_.erase(parent_window); @@ -170,10 +172,10 @@ bool SelectFileDialogImpl::ShouldEnableFilename(NSSavePanel* dialog, void SelectFileDialogImpl::SelectFileImpl( Type type, const string16& title, - const FilePath& default_path, + const base::FilePath& default_path, const FileTypeInfo* file_types, int file_type_index, - const FilePath::StringType& default_extension, + const base::FilePath::StringType& default_extension, gfx::NativeWindow owning_window, void* params) { DCHECK(type == SELECT_FOLDER || @@ -221,7 +223,7 @@ void SelectFileDialogImpl::SelectFileImpl( // specified extensions. NSMutableSet* file_type_set = [NSMutableSet set]; for (size_t i = 0; i < file_types->extensions.size(); ++i) { - const std::vector<FilePath::StringType>& ext_list = + const std::vector<base::FilePath::StringType>& ext_list = file_types->extensions[i]; for (size_t j = 0; j < ext_list.size(); ++j) { base::mac::ScopedCFTypeRef<CFStringRef> uti( @@ -335,7 +337,7 @@ NSView* SelectFileDialogImpl::GetAccessoryView(const FileTypeInfo* file_types, } else { // No description given for a list of extensions; pick the first one from // the list (arbitrarily) and use its description. - const std::vector<FilePath::StringType>& ext_list = + const std::vector<base::FilePath::StringType>& ext_list = file_types->extensions[type]; DCHECK(!ext_list.empty()); base::mac::ScopedCFTypeRef<CFStringRef> uti( @@ -372,11 +374,13 @@ bool SelectFileDialogImpl::HasMultipleFileTypeChoicesImpl() { type:(ui::SelectFileDialog::Type)type parentWindow:(NSWindow*)parentWindow { int index = 0; - std::vector<FilePath> paths; + std::vector<base::FilePath> paths; if (!did_cancel) { if (type == ui::SelectFileDialog::SELECT_SAVEAS_FILE) { - if ([[panel URL] isFileURL]) - paths.push_back(FilePath(base::SysNSStringToUTF8([[panel URL] path]))); + if ([[panel URL] isFileURL]) { + paths.push_back(base::FilePath( + base::SysNSStringToUTF8([[panel URL] path]))); + } NSView* accessoryView = [panel accessoryView]; if (accessoryView) { @@ -393,7 +397,7 @@ bool SelectFileDialogImpl::HasMultipleFileTypeChoicesImpl() { NSArray* urls = [static_cast<NSOpenPanel*>(panel) URLs]; for (NSURL* url in urls) if ([url isFileURL]) - paths.push_back(FilePath(base::SysNSStringToUTF8([url path]))); + paths.push_back(base::FilePath(base::SysNSStringToUTF8([url path]))); } } diff --git a/ui/shell_dialogs/select_file_dialog_win.cc b/ui/shell_dialogs/select_file_dialog_win.cc index 2ee4c0e..35f03b9 100644 --- a/ui/shell_dialogs/select_file_dialog_win.cc +++ b/ui/shell_dialogs/select_file_dialog_win.cc @@ -83,7 +83,7 @@ bool CallGetSaveFileName(OPENFILENAME* ofn) { } // Distinguish directories from regular files. -bool IsDirectory(const FilePath& path) { +bool IsDirectory(const base::FilePath& path) { base::PlatformFileInfo file_info; return file_util::GetFileInfo(path, &file_info) ? file_info.is_directory : file_util::EndsWithSeparator(path); @@ -266,7 +266,7 @@ bool SaveFileAsWithFilter(HWND owner, // Having an empty filter makes for a bad user experience. We should always // specify a filter when saving. DCHECK(!filter.empty()); - const FilePath suggested_path(suggested_name); + const base::FilePath suggested_path(suggested_name); std::wstring file_part = suggested_path.BaseName().value(); // If the suggested_name is a root directory, file_part will be '\', and the // call to GetSaveFileName below will fail. @@ -389,7 +389,8 @@ bool SaveFileAsWithFilter(HWND owner, bool SaveFileAs(HWND owner, const std::wstring& suggested_name, std::wstring* final_name) { - std::wstring file_ext = FilePath(suggested_name).Extension().insert(0, L"*"); + std::wstring file_ext = + base::FilePath(suggested_name).Extension().insert(0, L"*"); std::wstring filter = FormatFilterForExtensions( std::vector<std::wstring>(1, file_ext), std::vector<std::wstring>(), @@ -418,14 +419,15 @@ class SelectFileDialogImpl : public ui::SelectFileDialog, protected: // SelectFileDialog implementation: - virtual void SelectFileImpl(Type type, - const string16& title, - const FilePath& default_path, - const FileTypeInfo* file_types, - int file_type_index, - const FilePath::StringType& default_extension, - gfx::NativeWindow owning_window, - void* params) OVERRIDE; + virtual void SelectFileImpl( + Type type, + const string16& title, + const base::FilePath& default_path, + const FileTypeInfo* file_types, + int file_type_index, + const base::FilePath::StringType& default_extension, + gfx::NativeWindow owning_window, + void* params) OVERRIDE; private: virtual ~SelectFileDialogImpl(); @@ -434,7 +436,7 @@ class SelectFileDialogImpl : public ui::SelectFileDialog, struct ExecuteSelectParams { ExecuteSelectParams(Type type, const std::wstring& title, - const FilePath& default_path, + const base::FilePath& default_path, const FileTypeInfo* file_types, int file_type_index, const std::wstring& default_extension, @@ -455,7 +457,7 @@ class SelectFileDialogImpl : public ui::SelectFileDialog, } SelectFileDialog::Type type; std::wstring title; - FilePath default_path; + base::FilePath default_path; FileTypeInfo file_types; int file_type_index; std::wstring default_extension; @@ -470,11 +472,12 @@ class SelectFileDialogImpl : public ui::SelectFileDialog, void ExecuteSelectFile(const ExecuteSelectParams& params); // Notifies the listener that a folder was chosen. Run on the ui thread. - void FileSelected(const FilePath& path, int index, + void FileSelected(const base::FilePath& path, int index, void* params, RunState run_state); // Notifies listener that multiple files were chosen. Run on the ui thread. - void MultiFilesSelected(const std::vector<FilePath>& paths, void* params, + void MultiFilesSelected(const std::vector<base::FilePath>& paths, + void* params, RunState run_state); // Notifies the listener that no file was chosen (the action was canceled). @@ -488,21 +491,21 @@ class SelectFileDialogImpl : public ui::SelectFileDialog, // dialog thread. bool RunSelectFolderDialog(const std::wstring& title, HWND owner, - FilePath* path); + base::FilePath* path); // Runs an Open file dialog box, with similar semantics for input paramaters // as RunSelectFolderDialog. bool RunOpenFileDialog(const std::wstring& title, const std::wstring& filters, HWND owner, - FilePath* path); + base::FilePath* path); // Runs an Open file dialog box that supports multi-select, with similar // semantics for input paramaters as RunOpenFileDialog. bool RunOpenMultiFileDialog(const std::wstring& title, const std::wstring& filter, HWND owner, - std::vector<FilePath>* paths); + std::vector<base::FilePath>* paths); // The callback function for when the select folder dialog is opened. static int CALLBACK BrowseCallbackProc(HWND window, UINT message, @@ -533,10 +536,10 @@ SelectFileDialogImpl::~SelectFileDialogImpl() { void SelectFileDialogImpl::SelectFileImpl( Type type, const string16& title, - const FilePath& default_path, + const base::FilePath& default_path, const FileTypeInfo* file_types, int file_type_index, - const FilePath::StringType& default_extension, + const base::FilePath::StringType& default_extension, gfx::NativeWindow owning_window, void* params) { has_multiple_file_type_choices_ = @@ -611,7 +614,7 @@ void SelectFileDialogImpl::ExecuteSelectFile( const ExecuteSelectParams& params) { string16 filter = GetFilterForFileTypes(params.file_types); - FilePath path = params.default_path; + base::FilePath path = params.default_path; bool success = false; unsigned filter_index = params.file_type_index; if (params.type == SELECT_FOLDER) { @@ -624,13 +627,13 @@ void SelectFileDialogImpl::ExecuteSelectFile( params.default_path.value(), filter, params.default_extension, false, &filter_index, &path_as_wstring); if (success) - path = FilePath(path_as_wstring); + path = base::FilePath(path_as_wstring); DisableOwner(params.run_state.owner); } else if (params.type == SELECT_OPEN_FILE) { success = RunOpenFileDialog(params.title, filter, params.run_state.owner, &path); } else if (params.type == SELECT_OPEN_MULTI_FILE) { - std::vector<FilePath> paths; + std::vector<base::FilePath> paths; if (RunOpenMultiFileDialog(params.title, filter, params.run_state.owner, &paths)) { params.ui_proxy->PostTask( @@ -654,7 +657,7 @@ void SelectFileDialogImpl::ExecuteSelectFile( } } -void SelectFileDialogImpl::FileSelected(const FilePath& selected_folder, +void SelectFileDialogImpl::FileSelected(const base::FilePath& selected_folder, int index, void* params, RunState run_state) { @@ -664,7 +667,7 @@ void SelectFileDialogImpl::FileSelected(const FilePath& selected_folder, } void SelectFileDialogImpl::MultiFilesSelected( - const std::vector<FilePath>& selected_files, + const std::vector<base::FilePath>& selected_files, void* params, RunState run_state) { if (listener_) @@ -692,7 +695,7 @@ int CALLBACK SelectFileDialogImpl::BrowseCallbackProc(HWND window, bool SelectFileDialogImpl::RunSelectFolderDialog(const std::wstring& title, HWND owner, - FilePath* path) { + base::FilePath* path) { DCHECK(path); wchar_t dir_buffer[MAX_PATH + 1]; @@ -721,14 +724,14 @@ bool SelectFileDialogImpl::RunSelectFolderDialog(const std::wstring& title, HRESULT hr = shell_folder->GetDisplayNameOf(list, SHGDN_FORPARSING, &out_dir_buffer); if (SUCCEEDED(hr) && out_dir_buffer.uType == STRRET_WSTR) { - *path = FilePath(out_dir_buffer.pOleStr); + *path = base::FilePath(out_dir_buffer.pOleStr); CoTaskMemFree(out_dir_buffer.pOleStr); result = true; } else { // Use old way if we don't get what we want. wchar_t old_out_dir_buffer[MAX_PATH + 1]; if (SHGetPathFromIDList(list, old_out_dir_buffer)) { - *path = FilePath(old_out_dir_buffer); + *path = base::FilePath(old_out_dir_buffer); result = true; } } @@ -746,7 +749,7 @@ bool SelectFileDialogImpl::RunOpenFileDialog( const std::wstring& title, const std::wstring& filter, HWND owner, - FilePath* path) { + base::FilePath* path) { OPENFILENAME ofn; // We must do this otherwise the ofn's FlagsEx may be initialized to random // junk in release builds which can cause the Places Bar not to show up! @@ -761,7 +764,7 @@ bool SelectFileDialogImpl::RunOpenFileDialog( // Define the dir in here to keep the string buffer pointer pointed to // ofn.lpstrInitialDir available during the period of running the // GetOpenFileName. - FilePath dir; + base::FilePath dir; // Use lpstrInitialDir to specify the initial directory if (!path->empty()) { if (IsDirectory(*path)) { @@ -787,7 +790,7 @@ bool SelectFileDialogImpl::RunOpenFileDialog( bool success = CallGetOpenFileName(&ofn); DisableOwner(owner); if (success) - *path = FilePath(filename); + *path = base::FilePath(filename); return success; } @@ -795,7 +798,7 @@ bool SelectFileDialogImpl::RunOpenMultiFileDialog( const std::wstring& title, const std::wstring& filter, HWND owner, - std::vector<FilePath>* paths) { + std::vector<base::FilePath>* paths) { OPENFILENAME ofn; // We must do this otherwise the ofn's FlagsEx may be initialized to random // junk in release builds which can cause the Places Bar not to show up! @@ -820,10 +823,10 @@ bool SelectFileDialogImpl::RunOpenMultiFileDialog( bool success = CallGetOpenFileName(&ofn); DisableOwner(owner); if (success) { - std::vector<FilePath> files; + std::vector<base::FilePath> files; const wchar_t* selection = ofn.lpstrFile; while (*selection) { // Empty string indicates end of list. - files.push_back(FilePath(selection)); + files.push_back(base::FilePath(selection)); // Skip over filename and null-terminator. selection += files.back().value().length() + 1; } @@ -835,8 +838,8 @@ bool SelectFileDialogImpl::RunOpenMultiFileDialog( } else { // Otherwise, the first string is the path, and the remainder are // filenames. - std::vector<FilePath>::iterator path = files.begin(); - for (std::vector<FilePath>::iterator file = path + 1; + std::vector<base::FilePath>::iterator path = files.begin(); + for (std::vector<base::FilePath>::iterator file = path + 1; file != files.end(); ++file) { paths->push_back(path->Append(*file)); } @@ -892,7 +895,7 @@ std::wstring AppendExtensionIfNeeded( // extensions with a known MIME type, which many "known" extensions on Windows // don't have. So we check directly for the "known extension" registry key. std::wstring file_extension( - GetExtensionWithoutLeadingDot(FilePath(filename).Extension())); + GetExtensionWithoutLeadingDot(base::FilePath(filename).Extension())); std::wstring key(L"." + file_extension); if (!(filter_selected.empty() || filter_selected == L"*.*") && !base::win::RegKey(HKEY_CLASSES_ROOT, key.c_str(), KEY_READ).Valid() && diff --git a/ui/shell_dialogs/selected_file_info.cc b/ui/shell_dialogs/selected_file_info.cc index 86e8397..8bc68ab 100644 --- a/ui/shell_dialogs/selected_file_info.cc +++ b/ui/shell_dialogs/selected_file_info.cc @@ -8,8 +8,8 @@ namespace ui { SelectedFileInfo::SelectedFileInfo() {} -SelectedFileInfo::SelectedFileInfo(const FilePath& in_file_path, - const FilePath& in_local_path) +SelectedFileInfo::SelectedFileInfo(const base::FilePath& in_file_path, + const base::FilePath& in_local_path) : file_path(in_file_path), local_path(in_local_path) { if (local_path.empty()) diff --git a/ui/shell_dialogs/selected_file_info.h b/ui/shell_dialogs/selected_file_info.h index 3ace821..57228ed 100644 --- a/ui/shell_dialogs/selected_file_info.h +++ b/ui/shell_dialogs/selected_file_info.h @@ -16,7 +16,7 @@ namespace ui { // Struct used for passing selected file info to WebKit. struct SHELL_DIALOGS_EXPORT SelectedFileInfo { // Selected file's user friendly path as seen in the UI. - FilePath file_path; + base::FilePath file_path; // The actual local path to the selected file. This can be a snapshot file // with a human unreadable name like /blah/.d41d8cd98f00b204e9800998ecf8427e. @@ -24,17 +24,17 @@ struct SHELL_DIALOGS_EXPORT SelectedFileInfo { // /drive_cache/temporary/d41d8cd98f00b204e9800998ecf8427e vs. // /special/drive/foo.txt). // If not set, defaults to |file_path|. - FilePath local_path; + base::FilePath local_path; // This field is optional. The display name contains only the base name // portion of a file name (ex. no path separators), and used for displaying // selected file names. If this field is empty, the base name portion of // |path| is used for displaying. - FilePath::StringType display_name; + base::FilePath::StringType display_name; SelectedFileInfo(); - SelectedFileInfo(const FilePath& in_file_path, - const FilePath& in_local_path); + SelectedFileInfo(const base::FilePath& in_file_path, + const base::FilePath& in_local_path); ~SelectedFileInfo(); }; diff --git a/ui/surface/accelerated_surface_transformer_win_unittest.cc b/ui/surface/accelerated_surface_transformer_win_unittest.cc index ed5b606..b8b1eb6 100644 --- a/ui/surface/accelerated_surface_transformer_win_unittest.cc +++ b/ui/surface/accelerated_surface_transformer_win_unittest.cc @@ -69,7 +69,7 @@ SkBitmap ToSkBitmap(IDirect3DSurface9* surface, bool is_single_channel) { return result; } -bool WritePNGFile(const SkBitmap& bitmap, const FilePath& file_path) { +bool WritePNGFile(const SkBitmap& bitmap, const base::FilePath& file_path) { std::vector<unsigned char> png_data; const bool discard_transparency = true; if (gfx::PNGCodec::EncodeBGRASkBitmap(bitmap, @@ -552,15 +552,16 @@ bool AssertSameColor(uint8 color_a, uint8 color_b) { // extra columns added due to packing. That means up to 7 extra // columns for uv, and up to 3 extra columns for y. WritePNGFile(reference_rgb, - FilePath(FILE_PATH_LITERAL("test_fail_src.png"))); + base::FilePath(FILE_PATH_LITERAL("test_fail_src.png"))); WritePNGFile(reference_rgb_scaled, - FilePath(FILE_PATH_LITERAL("test_fail_src_scaled.png"))); + base::FilePath( + FILE_PATH_LITERAL("test_fail_src_scaled.png"))); WritePNGFile(ToSkBitmap(dst_y, true), - FilePath(FILE_PATH_LITERAL("test_fail_y.png"))); + base::FilePath(FILE_PATH_LITERAL("test_fail_y.png"))); WritePNGFile(ToSkBitmap(dst_u, true), - FilePath(FILE_PATH_LITERAL("test_fail_u.png"))); + base::FilePath(FILE_PATH_LITERAL("test_fail_u.png"))); WritePNGFile(ToSkBitmap(dst_v, true), - FilePath(FILE_PATH_LITERAL("test_fail_v.png"))); + base::FilePath(FILE_PATH_LITERAL("test_fail_v.png"))); } } diff --git a/ui/surface/d3d9_utils_win.cc b/ui/surface/d3d9_utils_win.cc index aa18032..4377362 100644 --- a/ui/surface/d3d9_utils_win.cc +++ b/ui/surface/d3d9_utils_win.cc @@ -20,7 +20,8 @@ typedef HRESULT (WINAPI *Direct3DCreate9ExFunc)(UINT sdk_version, namespace ui_surface_d3d9_utils { bool LoadD3D9(base::ScopedNativeLibrary* storage) { - storage->Reset(base::LoadNativeLibrary(FilePath(kD3D9ModuleName), NULL)); + storage->Reset( + base::LoadNativeLibrary(base::FilePath(kD3D9ModuleName), NULL)); return storage->is_valid(); } diff --git a/ui/test/test_suite.cc b/ui/test/test_suite.cc index 4d37214..47fc790 100644 --- a/ui/test/test_suite.cc +++ b/ui/test/test_suite.cc @@ -42,7 +42,7 @@ void UITestSuite::Initialize() { // TODO(port): make a resource bundle for non-app exes. What's done here // isn't really right because this code needs to depend on chrome_dll // being built. This is inappropriate in app. - FilePath path; + base::FilePath path; PathService::Get(base::DIR_EXE, &path); #if defined(GOOGLE_CHROME_BUILD) path = path.AppendASCII("Google Chrome Framework.framework"); @@ -53,7 +53,7 @@ void UITestSuite::Initialize() { #endif base::mac::SetOverrideFrameworkBundlePath(path); #elif defined(OS_POSIX) - FilePath pak_dir; + base::FilePath pak_dir; #if defined(OS_ANDROID) PathService::Get(ui::DIR_RESOURCE_PAKS_ANDROID, &pak_dir); #else diff --git a/ui/views/controls/textfield/native_textfield_views_unittest.cc b/ui/views/controls/textfield/native_textfield_views_unittest.cc index 92c34aa..3cc184a 100644 --- a/ui/views/controls/textfield/native_textfield_views_unittest.cc +++ b/ui/views/controls/textfield/native_textfield_views_unittest.cc @@ -871,13 +871,13 @@ TEST_F(NativeTextfieldViewsTest, DragAndDrop_AcceptDrop) { // Ensure that textfields do not accept non-OSExchangeData::STRING types. ui::OSExchangeData bad_data; - bad_data.SetFilename(FilePath(FILE_PATH_LITERAL("x"))); + bad_data.SetFilename(base::FilePath(FILE_PATH_LITERAL("x"))); #if defined(OS_WIN) ui::OSExchangeData::CustomFormat fmt = CF_BITMAP; bad_data.SetPickledData(fmt, Pickle()); - bad_data.SetFileContents(FilePath(L"x"), "x"); + bad_data.SetFileContents(base::FilePath(L"x"), "x"); bad_data.SetHtml(string16(ASCIIToUTF16("x")), GURL("x.org")); - ui::OSExchangeData::DownloadFileInfo download(FilePath(), NULL); + ui::OSExchangeData::DownloadFileInfo download(base::FilePath(), NULL); bad_data.SetDownloadFileInfo(download); #endif EXPECT_FALSE(textfield_view_->CanDrop(bad_data)); |