| Index: ui/shell_dialogs/select_file_dialog_win.cc
|
| diff --git a/ui/shell_dialogs/select_file_dialog_win.cc b/ui/shell_dialogs/select_file_dialog_win.cc
|
| index 2ee4c0efc7d3701aa995ad325adf123e185fc229..35f03b9e4733e24fc544ba751e9a3a99e814c35d 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() &&
|
|
|