diff options
Diffstat (limited to 'chrome/browser')
-rw-r--r-- | chrome/browser/browser.cc | 2 | ||||
-rw-r--r-- | chrome/browser/download/download_manager.cc | 12 | ||||
-rw-r--r-- | chrome/browser/download/save_package.cc | 34 | ||||
-rw-r--r-- | chrome/browser/gtk/dialogs_gtk.cc | 29 | ||||
-rw-r--r-- | chrome/browser/renderer_host/render_view_host.cc | 9 | ||||
-rw-r--r-- | chrome/browser/renderer_host/render_view_host.h | 5 | ||||
-rw-r--r-- | chrome/browser/renderer_host/render_view_host_delegate.h | 5 | ||||
-rw-r--r-- | chrome/browser/shell_dialogs.h | 49 | ||||
-rw-r--r-- | chrome/browser/tab_contents/web_contents.cc | 5 | ||||
-rw-r--r-- | chrome/browser/tab_contents/web_contents.h | 3 | ||||
-rw-r--r-- | chrome/browser/views/bookmark_manager_view.cc | 21 | ||||
-rw-r--r-- | chrome/browser/views/options/content_page_view.cc | 2 | ||||
-rw-r--r-- | chrome/browser/views/shell_dialogs_win.cc | 77 | ||||
-rw-r--r-- | chrome/browser/views/user_data_dir_dialog.cc | 2 |
14 files changed, 148 insertions, 107 deletions
diff --git a/chrome/browser/browser.cc b/chrome/browser/browser.cc index 5c5c581..1963361 100644 --- a/chrome/browser/browser.cc +++ b/chrome/browser/browser.cc @@ -993,7 +993,7 @@ void Browser::OpenFile() { gfx::NativeWindow parent_window = window_->GetNativeHandle(); select_file_dialog_->SelectFile(SelectFileDialog::SELECT_OPEN_FILE, string16(), FilePath(), - std::wstring(), 0, FILE_PATH_LITERAL(""), + NULL, 0, FILE_PATH_LITERAL(""), parent_window, NULL); } #endif diff --git a/chrome/browser/download/download_manager.cc b/chrome/browser/download/download_manager.cc index 3b68cfa..43954a7 100644 --- a/chrome/browser/download/download_manager.cc +++ b/chrome/browser/download/download_manager.cc @@ -640,18 +640,16 @@ void DownloadManager::OnPathExistenceAvailable(DownloadCreateInfo* info) { WebContents* contents = tab_util::GetWebContentsByID( info->render_process_id, info->render_view_id); -#if defined(OS_WIN) - std::wstring filter = - win_util::GetFileFilterFromPath(info->suggested_path.value()); -#elif defined(OS_LINUX) - std::wstring filter; -#endif + SelectFileDialog::FileTypeInfo file_type_info; + file_type_info.extensions.resize(1); + file_type_info.extensions[0].push_back(info->suggested_path.Extension()); + file_type_info.include_all_files = true; gfx::NativeWindow owning_window = contents ? platform_util::GetTopLevel(contents->GetNativeView()) : NULL; select_file_dialog_->SelectFile(SelectFileDialog::SELECT_SAVEAS_FILE, string16(), info->suggested_path, - filter, 0, FILE_PATH_LITERAL(""), + &file_type_info, 0, FILE_PATH_LITERAL(""), owning_window, info); } else { // No prompting for download, just continue with the suggested name. diff --git a/chrome/browser/download/save_package.cc b/chrome/browser/download/save_package.cc index 23bb704..01a1b26 100644 --- a/chrome/browser/download/save_package.cc +++ b/chrome/browser/download/save_package.cc @@ -995,8 +995,8 @@ FilePath SavePackage::GetSuggestNameForSaveAs(PrefService* prefs, void SavePackage::GetSaveInfo() { // Use "Web Page, Complete" option as default choice of saving page. - int filter_index = 2; - std::wstring filter; + int file_type_index = 2; + SelectFileDialog::FileTypeInfo file_type_info; FilePath::StringType default_extension; FilePath title = FilePath::FromWStringHack(UTF16ToWideHack(web_contents_->GetTitle())); @@ -1009,22 +1009,22 @@ void SavePackage::GetSaveInfo() { // If the contents can not be saved as complete-HTML, do not show the // file filters. if (CanSaveAsComplete(save_params->current_tab_mime_type)) { - filter = l10n_util::GetString(IDS_SAVE_PAGE_FILTER); - filter.resize(filter.size() + 2); - filter[filter.size() - 1] = L'\0'; - filter[filter.size() - 2] = L'\0'; + file_type_info.extensions.resize(2); + file_type_info.extensions[0].push_back(FILE_PATH_LITERAL("htm")); + file_type_info.extension_description_overrides.push_back( + WideToUTF16(l10n_util::GetString(IDS_SAVE_PAGE_DESC_HTML_ONLY))); + file_type_info.extensions[1].push_back(FILE_PATH_LITERAL("htm")); + file_type_info.extension_description_overrides.push_back( + WideToUTF16(l10n_util::GetString(IDS_SAVE_PAGE_DESC_COMPLETE))); + file_type_info.include_all_files = false; default_extension = FILE_PATH_LITERAL("htm"); } else { -#if defined(OS_WIN) - filter = win_util::GetFileFilterFromPath(suggested_path.ToWStringHack()); -#else - // TODO(port): implement this. - NOTIMPLEMENTED(); -#endif - filter_index = 1; + file_type_info.extensions.resize(1); + file_type_info.extensions[0].push_back(suggested_path.Extension()); + file_type_info.include_all_files = true; + file_type_index = 1; } - #if defined(OS_LINUX) || defined(OS_WIN) if (g_should_prompt_for_filename) { if (!select_file_dialog_.get()) @@ -1032,8 +1032,8 @@ void SavePackage::GetSaveInfo() { select_file_dialog_->SelectFile(SelectFileDialog::SELECT_SAVEAS_FILE, string16(), suggested_path, - filter, - filter_index, + &file_type_info, + file_type_index, default_extension, platform_util::GetTopLevel( web_contents_->GetNativeView()), @@ -1042,7 +1042,7 @@ void SavePackage::GetSaveInfo() { #endif // defined(OS_LINUX) || defined(OS_WIN) { // Just use 'suggested_path' instead of opening the dialog prompt. - ContinueSave(save_params, suggested_path, filter_index); + ContinueSave(save_params, suggested_path, file_type_index); delete save_params; } } diff --git a/chrome/browser/gtk/dialogs_gtk.cc b/chrome/browser/gtk/dialogs_gtk.cc index d7b6350..113edb2 100644 --- a/chrome/browser/gtk/dialogs_gtk.cc +++ b/chrome/browser/gtk/dialogs_gtk.cc @@ -30,12 +30,13 @@ class SelectFileDialogImpl : public SelectFileDialog { // SelectFileDialog implementation. // |params| is user data we pass back via the Listener interface. - virtual void SelectFile(Type type, const string16& title, + virtual void SelectFile(Type type, + const string16& title, const FilePath& default_path, - const std::wstring& filter, - int filter_index, + const FileTypeInfo* file_types, + int file_type_index, const FilePath::StringType& default_extension, - gfx::NativeWindow parent_window, + gfx::NativeWindow owning_window, void* params); private: @@ -114,21 +115,21 @@ void SelectFileDialogImpl::ListenerDestroyed() { listener_ = NULL; } -// We ignore |filter| and |default_extension|. -// TODO(estade): use |filter|. +// We ignore |file_types| and |default_extension|. +// TODO(estade): use |file_types|. void SelectFileDialogImpl::SelectFile( Type type, const string16& title, const FilePath& default_path, - const std::wstring& filter, - int filter_index, + const FileTypeInfo* file_types, + int file_type_index, const FilePath::StringType& default_extension, - gfx::NativeWindow parent_window, + gfx::NativeWindow owning_window, void* params) { // TODO(estade): on windows, parent_window may be null. But I'm not sure when // that's used and how to deal with it here. For now, don't allow it. - DCHECK(parent_window); - parents_.insert(parent_window); + DCHECK(owning_window); + parents_.insert(owning_window); std::string title_string = UTF16ToUTF8(title); @@ -136,14 +137,14 @@ void SelectFileDialogImpl::SelectFile( switch (type) { case SELECT_OPEN_FILE: DCHECK(default_path.empty()); - dialog = CreateFileOpenDialog(title_string, parent_window); + dialog = CreateFileOpenDialog(title_string, owning_window); break; case SELECT_OPEN_MULTI_FILE: DCHECK(default_path.empty()); - dialog = CreateMultiFileOpenDialog(title_string, parent_window); + dialog = CreateMultiFileOpenDialog(title_string, owning_window); break; case SELECT_SAVEAS_FILE: - dialog = CreateSaveAsDialog(title_string, default_path, parent_window); + dialog = CreateSaveAsDialog(title_string, default_path, owning_window); break; default: NOTIMPLEMENTED() << "Dialog type " << type << " not implemented."; diff --git a/chrome/browser/renderer_host/render_view_host.cc b/chrome/browser/renderer_host/render_view_host.cc index ef6ea8d..e50c032 100644 --- a/chrome/browser/renderer_host/render_view_host.cc +++ b/chrome/browser/renderer_host/render_view_host.cc @@ -1126,12 +1126,9 @@ void RenderViewHost::OnMsgPasteFromSelectionClipboard() { } void RenderViewHost::OnMsgRunFileChooser(bool multiple_files, - const std::wstring& title, - const std::wstring& default_file, - const std::wstring& filter) { - std::wstring real_filter = filter; - std::replace(real_filter.begin(), real_filter.end(), '|', '\0'); - delegate_->RunFileChooser(multiple_files, title, default_file, real_filter); + const string16& title, + const FilePath& default_file) { + delegate_->RunFileChooser(multiple_files, title, default_file); } void RenderViewHost::OnMsgRunJavaScriptMessage( diff --git a/chrome/browser/renderer_host/render_view_host.h b/chrome/browser/renderer_host/render_view_host.h index 8d82ba3..e6e7ad11 100644 --- a/chrome/browser/renderer_host/render_view_host.h +++ b/chrome/browser/renderer_host/render_view_host.h @@ -511,9 +511,8 @@ class RenderViewHost : public RenderWidgetHost { void OnMsgSelectionChanged(const std::string& text); void OnMsgPasteFromSelectionClipboard(); void OnMsgRunFileChooser(bool multiple_files, - const std::wstring& title, - const std::wstring& default_file, - const std::wstring& filter); + const string16& title, + const FilePath& default_file); void OnMsgRunJavaScriptMessage(const std::wstring& message, const std::wstring& default_prompt, const GURL& frame_url, diff --git a/chrome/browser/renderer_host/render_view_host_delegate.h b/chrome/browser/renderer_host/render_view_host_delegate.h index 7a9a94b..ebe8df1 100644 --- a/chrome/browser/renderer_host/render_view_host_delegate.h +++ b/chrome/browser/renderer_host/render_view_host_delegate.h @@ -283,9 +283,8 @@ class RenderViewHostDelegate { // A file chooser should be shown. virtual void RunFileChooser(bool multiple_files, - const std::wstring& title, - const std::wstring& default_file, - const std::wstring& filter) { } + const string16& title, + const FilePath& default_file) { } // A javascript message, confirmation or prompt should be shown. virtual void RunJavaScriptMessage(const std::wstring& message, diff --git a/chrome/browser/shell_dialogs.h b/chrome/browser/shell_dialogs.h index 4975395..4285364 100644 --- a/chrome/browser/shell_dialogs.h +++ b/chrome/browser/shell_dialogs.h @@ -15,9 +15,6 @@ class ChromeFont; -// Helpers to show certain types of Windows shell dialogs in a way that doesn't -// block the UI of the entire app. - // A base class for shell dialogs. class BaseShellDialog { public: @@ -71,36 +68,50 @@ class SelectFileDialog // object will have no reference (refcount is 0). static SelectFileDialog* Create(Listener* listener); + // Holds information about allowed extensions on a file save dialog. + // |extensions| is a list of allowed extensions. For example, it might be + // { { "htm", "html" }, { "txt" } }. Only pass more than one extension + // in the inner vector if the extensions are equivalent. Do NOT include + // leading periods. + // |extension_description_overrides| overrides the system descriptions of the + // specified extensions. Entries correspond to |extensions|; if left blank + // the system descriptions will be used. + // |include_all_files| specifies whether all files (e.g. *.*) will be allowed + // in the file filtering. + struct FileTypeInfo { + std::vector<std::vector<FilePath::StringType> > extensions; + std::vector<string16> extension_description_overrides; + bool include_all_files; + }; + // Selects a file. This will start displaying the dialog box. This will also // block the calling window until the dialog box is complete. The listener // associated with this object will be notified when the selection is // complete. // |type| is the type of file dialog to be shown, see Type enumeration above. // |title| is the title to be displayed in the dialog. If this string is - // empty, the default title is used. + // empty, the default title is used. // |default_path| is the default path and suggested file name to be shown in - // the dialog. This only works for SELECT_SAVEAS_FILE and SELECT_OPEN_FILE. - // Can be an empty string to indicate Windows should choose the default to - // show. - // |filter| is a null (\0) separated list of alternating filter description - // and filters and terminated with two nulls. - // |filter_index| is the 1-based index into the filter list in |filter|. - // Specify 0 if you don't need filters, or if you only need the default - // (first filter) behavior. - // |owning_window| is the window the dialog is modal to, or NULL for a - // modeless dialog. + // the dialog. This only works for SELECT_SAVEAS_FILE and SELECT_OPEN_FILE. + // Can be an empty string to indicate the platform default. + // |file_types| holds the infomation about the file types allowed. Pass NULL + // to get no special behavior + // |file_type_index| is the 1-based index into the file type list in + // |file_types|. Specify 0 if you don't need to specify extension behavior. // |default_extension| is the default extension to add to the file if the - // user doesn't type one. This should NOT include the '.'. If you specify - // this you must also specify a filter. + // user doesn't type one. This should NOT include the '.'. On Windows, if + // you specify this you must also specify |file_types|. + // |owning_window| is the window the dialog is modal to, or NULL for a + // modeless dialog. // |params| is data from the calling context which will be passed through to - // the listener. Can be NULL. + // the listener. Can be NULL. // NOTE: only one instance of any shell dialog can be shown per owning_window // at a time (for obvious reasons). virtual void SelectFile(Type type, const string16& title, const FilePath& default_path, - const std::wstring& filter, - int filter_index, + const FileTypeInfo* file_types, + int file_type_index, const FilePath::StringType& default_extension, gfx::NativeWindow owning_window, void* params) = 0; diff --git a/chrome/browser/tab_contents/web_contents.cc b/chrome/browser/tab_contents/web_contents.cc index eaf181e..b58d7b3 100644 --- a/chrome/browser/tab_contents/web_contents.cc +++ b/chrome/browser/tab_contents/web_contents.cc @@ -1145,15 +1145,14 @@ void WebContents::GetHistoryListCount(int* back_list_count, void WebContents::RunFileChooser(bool multiple_files, const string16& title, - const FilePath& default_file, - const std::wstring& filter) { + const FilePath& default_file) { if (!select_file_dialog_.get()) select_file_dialog_ = SelectFileDialog::Create(this); SelectFileDialog::Type dialog_type = multiple_files ? SelectFileDialog::SELECT_OPEN_MULTI_FILE : SelectFileDialog::SELECT_OPEN_FILE; select_file_dialog_->SelectFile(dialog_type, title, default_file, - filter, 0, FILE_PATH_LITERAL(""), + NULL, 0, FILE_PATH_LITERAL(""), view_->GetTopLevelNativeWindow(), NULL); } diff --git a/chrome/browser/tab_contents/web_contents.h b/chrome/browser/tab_contents/web_contents.h index be0fe27..6164ddb 100644 --- a/chrome/browser/tab_contents/web_contents.h +++ b/chrome/browser/tab_contents/web_contents.h @@ -370,8 +370,7 @@ class WebContents : public TabContents, int* forward_list_count); virtual void RunFileChooser(bool multiple_files, const string16& title, - const FilePath& default_file, - const std::wstring& filter); + const FilePath& default_file); virtual void RunJavaScriptMessage(const std::wstring& message, const std::wstring& default_prompt, const GURL& frame_url, diff --git a/chrome/browser/views/bookmark_manager_view.cc b/chrome/browser/views/bookmark_manager_view.cc index 12150c6..585f6a4 100644 --- a/chrome/browser/views/bookmark_manager_view.cc +++ b/chrome/browser/views/bookmark_manager_view.cc @@ -716,14 +716,16 @@ void BookmarkManagerView::ShowImportBookmarksFileChooser() { if (select_file_dialog_.get()) select_file_dialog_->ListenerDestroyed(); - std::wstring filter_string = - win_util::GetFileFilterFromExtensions(L"*.html;*.htm", true); + SelectFileDialog::FileTypeInfo file_type_info; + file_type_info.extensions.resize(1); + file_type_info.extensions[0].push_back(FILE_PATH_LITERAL("html")); + file_type_info.extensions[0].push_back(FILE_PATH_LITERAL("htm")); + file_type_info.include_all_files = true; select_file_dialog_ = SelectFileDialog::Create(this); select_file_dialog_->SelectFile( SelectFileDialog::SELECT_OPEN_FILE, std::wstring(), - FilePath(FILE_PATH_LITERAL("bookmarks.html")), filter_string, 0, - std::wstring(), - GetWidget()->GetNativeView(), + FilePath(FILE_PATH_LITERAL("bookmarks.html")), &file_type_info, 0, + std::wstring(), GetWidget()->GetNativeView(), reinterpret_cast<void*>(IDS_BOOKMARK_MANAGER_IMPORT_MENU)); } @@ -731,11 +733,14 @@ void BookmarkManagerView::ShowExportBookmarksFileChooser() { if (select_file_dialog_.get()) select_file_dialog_->ListenerDestroyed(); + SelectFileDialog::FileTypeInfo file_type_info; + file_type_info.extensions.resize(1); + file_type_info.extensions[0].push_back(FILE_PATH_LITERAL("html")); + file_type_info.include_all_files = true; select_file_dialog_ = SelectFileDialog::Create(this); select_file_dialog_->SelectFile( SelectFileDialog::SELECT_SAVEAS_FILE, std::wstring(), - FilePath(FILE_PATH_LITERAL("bookmarks.html")), - win_util::GetFileFilterFromPath(L"bookmarks.html"), 0, L"html", - GetWidget()->GetNativeView(), + FilePath(FILE_PATH_LITERAL("bookmarks.html")), &file_type_info, 0, + L"html", GetWidget()->GetNativeView(), reinterpret_cast<void*>(IDS_BOOKMARK_MANAGER_EXPORT_MENU)); } diff --git a/chrome/browser/views/options/content_page_view.cc b/chrome/browser/views/options/content_page_view.cc index e6966e0..10feabc9 100644 --- a/chrome/browser/views/options/content_page_view.cc +++ b/chrome/browser/views/options/content_page_view.cc @@ -217,7 +217,7 @@ void ContentPageView::ButtonPressed(views::Button* sender) { FilePath::FromWStringHack( profile()->GetPrefs()->GetString( prefs::kDownloadDefaultDirectory)), - std::wstring(), 0, std::wstring(), + NULL, 0, std::wstring(), GetRootWindow(), NULL); } else if (sender == download_ask_for_save_location_checkbox_) { diff --git a/chrome/browser/views/shell_dialogs_win.cc b/chrome/browser/views/shell_dialogs_win.cc index 0c3abcf..69ee892 100644 --- a/chrome/browser/views/shell_dialogs_win.cc +++ b/chrome/browser/views/shell_dialogs_win.cc @@ -22,6 +22,9 @@ #include "chrome/common/win_util.h" #include "grit/generated_resources.h" +// Helpers to show certain types of Windows shell dialogs in a way that doesn't +// block the UI of the entire app. + class ShellDialogThread : public base::Thread { public: ShellDialogThread() : base::Thread("Chrome_ShellDialogThread") { } @@ -192,12 +195,13 @@ class SelectFileDialogImpl : public SelectFileDialog, virtual ~SelectFileDialogImpl(); // SelectFileDialog implementation: - virtual void SelectFile(Type type, const string16& title, + virtual void SelectFile(Type type, + const string16& title, const FilePath& default_path, - const std::wstring& filter, - int filter_index, + const FileTypeInfo* file_types, + int file_type_index, const FilePath::StringType& default_extension, - HWND owning_hwnd, + gfx::NativeWindow owning_window, void* params); virtual bool IsRunning(HWND owning_hwnd) const; virtual void ListenerDestroyed(); @@ -208,21 +212,31 @@ class SelectFileDialogImpl : public SelectFileDialog, ExecuteSelectParams(Type type, const std::wstring& title, const FilePath& default_path, - const std::wstring& filter, - int filter_index, + const FileTypeInfo* file_types, + int file_type_index, const std::wstring& default_extension, RunState run_state, HWND owner, void* params) - : type(type), title(title), default_path(default_path), filter(filter), - filter_index(filter_index), default_extension(default_extension), - run_state(run_state), owner(owner), params(params) { + : type(type), + title(title), + default_path(default_path), + file_type_index(file_type_index), + default_extension(default_extension), + run_state(run_state), + owner(owner), + params(params) { + if (file_types) { + this->file_types = *file_types; + } else { + this->file_types.include_all_files = true; + } } SelectFileDialog::Type type; std::wstring title; FilePath default_path; - std::wstring filter; - int filter_index; + FileTypeInfo file_types; + int file_type_index; std::wstring default_extension; RunState run_state; HWND owner; @@ -291,14 +305,15 @@ void SelectFileDialogImpl::SelectFile( Type type, const string16& title, const FilePath& default_path, - const std::wstring& filter, - int filter_index, + const FileTypeInfo* file_types, + int file_type_index, const FilePath::StringType& default_extension, - HWND owner, + gfx::NativeWindow owning_window, void* params) { ExecuteSelectParams execute_params(type, UTF16ToWide(title), default_path, - filter, filter_index, default_extension, - BeginRun(owner), owner, params); + file_types, file_type_index, + default_extension, BeginRun(owning_window), + owning_window, params); execute_params.run_state.dialog_thread->message_loop()->PostTask(FROM_HERE, NewRunnableMethod(this, &SelectFileDialogImpl::ExecuteSelectFile, execute_params)); @@ -316,9 +331,27 @@ void SelectFileDialogImpl::ListenerDestroyed() { void SelectFileDialogImpl::ExecuteSelectFile( const ExecuteSelectParams& params) { + std::vector<std::wstring> exts; + for (size_t i=0; i<params.file_types.extensions.size(); ++i) { + const std::vector<std::wstring>& inner_exts = + params.file_types.extensions[i]; + std::wstring ext_string; + for (size_t j=0; j<inner_exts.size(); ++j) { + if (!ext_string.empty()) + ext_string.push_back(L';'); + ext_string.push_back(L'.'); + ext_string.append(inner_exts[j]); + } + exts.push_back(ext_string); + } + std::wstring filter = win_util::FormatFilterForExtensions( + exts, + params.file_types.extension_description_overrides, + params.file_types.include_all_files); + FilePath path = params.default_path; bool success = false; - unsigned filter_index = params.filter_index; + unsigned filter_index = params.file_type_index; if (params.type == SELECT_FOLDER) { success = RunSelectFolderDialog(params.title, params.run_state.owner, @@ -326,18 +359,18 @@ void SelectFileDialogImpl::ExecuteSelectFile( } else if (params.type == SELECT_SAVEAS_FILE) { std::wstring path_as_wstring = path.ToWStringHack(); success = win_util::SaveFileAsWithFilter(params.run_state.owner, - params.default_path.ToWStringHack(), params.filter, + params.default_path.ToWStringHack(), filter, params.default_extension, false, &filter_index, &path_as_wstring); if(success) { path = FilePath::FromWStringHack(path_as_wstring); } DisableOwner(params.run_state.owner); } else if (params.type == SELECT_OPEN_FILE) { - success = RunOpenFileDialog(params.title, params.filter, + success = RunOpenFileDialog(params.title, filter, params.run_state.owner, &path); } else if (params.type == SELECT_OPEN_MULTI_FILE) { std::vector<FilePath> paths; - if (RunOpenMultiFileDialog(params.title, params.filter, + if (RunOpenMultiFileDialog(params.title, filter, params.run_state.owner, &paths)) { ui_loop_->PostTask(FROM_HERE, NewRunnableMethod(this, &SelectFileDialogImpl::MultiFilesSelected, @@ -425,7 +458,7 @@ 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::FromWStringHack(out_dir_buffer.pOleStr); + *path = FilePath(out_dir_buffer.pOleStr); CoTaskMemFree(out_dir_buffer.pOleStr); result = true; } @@ -433,7 +466,7 @@ bool SelectFileDialogImpl::RunSelectFolderDialog(const std::wstring& title, // 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::FromWStringHack(old_out_dir_buffer); + *path = FilePath(old_out_dir_buffer); result = true; } } diff --git a/chrome/browser/views/user_data_dir_dialog.cc b/chrome/browser/views/user_data_dir_dialog.cc index 958e4ce..3598950 100644 --- a/chrome/browser/views/user_data_dir_dialog.cc +++ b/chrome/browser/views/user_data_dir_dialog.cc @@ -73,7 +73,7 @@ bool UserDataDirDialog::Accept() { HWND owning_hwnd = GetAncestor(message_box_view_->GetWidget()->GetNativeView(), GA_ROOT); select_file_dialog_->SelectFile(SelectFileDialog::SELECT_FOLDER, - dialog_title, FilePath(), std::wstring(), + dialog_title, FilePath(), NULL, 0, std::wstring(), owning_hwnd, NULL); return false; } |