diff options
author | avi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-06 18:08:34 +0000 |
---|---|---|
committer | avi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-06 18:08:34 +0000 |
commit | 561abe688fc5ebcec902ea6cc2ccb4122441595e (patch) | |
tree | 5d5b001676b82c824d22619f0cc3a92b22648ab2 /chrome/browser/download | |
parent | 5ce729688e2b16ebc97decb032175ba230855c1d (diff) | |
download | chromium_src-561abe688fc5ebcec902ea6cc2ccb4122441595e.zip chromium_src-561abe688fc5ebcec902ea6cc2ccb4122441595e.tar.gz chromium_src-561abe688fc5ebcec902ea6cc2ccb4122441595e.tar.bz2 |
First pass of refactoring dialogs.
Review URL: http://codereview.chromium.org/60110
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@13168 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/download')
-rw-r--r-- | chrome/browser/download/download_manager.cc | 9 | ||||
-rw-r--r-- | chrome/browser/download/download_manager.h | 2 | ||||
-rw-r--r-- | chrome/browser/download/save_package.cc | 19 | ||||
-rw-r--r-- | chrome/browser/download/save_package.h | 4 |
4 files changed, 16 insertions, 18 deletions
diff --git a/chrome/browser/download/download_manager.cc b/chrome/browser/download/download_manager.cc index db76181..34fe0cf 100644 --- a/chrome/browser/download/download_manager.cc +++ b/chrome/browser/download/download_manager.cc @@ -645,9 +645,9 @@ void DownloadManager::OnPathExistenceAvailable(DownloadCreateInfo* info) { gfx::NativeWindow owning_window = contents ? platform_util::GetTopLevel(contents->GetNativeView()) : NULL; select_file_dialog_->SelectFile(SelectFileDialog::SELECT_SAVEAS_FILE, - std::wstring(), - info->suggested_path.ToWStringHack(), - filter, 0, std::wstring(), + string16(), + info->suggested_path, + filter, 0, FILE_PATH_LITERAL(""), owning_window, info); } else { // No prompting for download, just continue with the suggested name. @@ -1357,9 +1357,8 @@ void DownloadManager::SaveAutoOpens() { } } -void DownloadManager::FileSelected(const std::wstring& path_string, +void DownloadManager::FileSelected(const FilePath& path, int index, void* params) { - FilePath path = FilePath::FromWStringHack(path_string); DownloadCreateInfo* info = reinterpret_cast<DownloadCreateInfo*>(params); if (info->save_as) last_download_path_ = path.DirName(); diff --git a/chrome/browser/download/download_manager.h b/chrome/browser/download/download_manager.h index 5712d95..37906d3 100644 --- a/chrome/browser/download/download_manager.h +++ b/chrome/browser/download/download_manager.h @@ -411,7 +411,7 @@ class DownloadManager : public base::RefCountedThreadSafe<DownloadManager>, // Overridden from SelectFileDialog::Listener: // TODO(port): convert this to FilePath when SelectFileDialog gets converted. - virtual void FileSelected(const std::wstring& path, int index, void* params); + virtual void FileSelected(const FilePath& path, int index, void* params); virtual void FileSelectionCanceled(void* params); // Deletes the specified path on the file thread. diff --git a/chrome/browser/download/save_package.cc b/chrome/browser/download/save_package.cc index 1504ae8..b54f060 100644 --- a/chrome/browser/download/save_package.cc +++ b/chrome/browser/download/save_package.cc @@ -997,12 +997,11 @@ void SavePackage::GetSaveInfo() { // Use "Web Page, Complete" option as default choice of saving page. int filter_index = 2; std::wstring filter; - std::wstring default_extension; + FilePath::StringType default_extension; FilePath title = FilePath::FromWStringHack(UTF16ToWideHack(web_contents_->GetTitle())); FilePath suggested_path = GetSuggestNameForSaveAs(web_contents_->profile()->GetPrefs(), title); - std::wstring suggested_name = suggested_path.ToWStringHack(); SavePackageParam* save_params = new SavePackageParam(web_contents_->contents_mime_type()); @@ -1014,10 +1013,10 @@ void SavePackage::GetSaveInfo() { filter.resize(filter.size() + 2); filter[filter.size() - 1] = L'\0'; filter[filter.size() - 2] = L'\0'; - default_extension = L"htm"; + default_extension = FILE_PATH_LITERAL("htm"); } else { #if defined(OS_WIN) - filter = win_util::GetFileFilterFromPath(suggested_name); + filter = win_util::GetFileFilterFromPath(suggested_path.ToWStringHack()); #else // TODO(port): implement this. NOTIMPLEMENTED(); @@ -1031,8 +1030,8 @@ void SavePackage::GetSaveInfo() { if (!select_file_dialog_.get()) select_file_dialog_ = SelectFileDialog::Create(this); select_file_dialog_->SelectFile(SelectFileDialog::SELECT_SAVEAS_FILE, - std::wstring(), - suggested_name, + string16(), + suggested_path, filter, filter_index, default_extension, @@ -1043,17 +1042,17 @@ void SavePackage::GetSaveInfo() { #endif // defined(OS_LINUX) || defined(OS_WIN) { // Just use 'suggested_name' instead of opening the dialog prompt. - ContinueSave(save_params, suggested_name, filter_index); + ContinueSave(save_params, suggested_path, filter_index); delete save_params; } } // Called after the save file dialog box returns. void SavePackage::ContinueSave(SavePackageParam* param, - const std::wstring& final_name, + const FilePath& final_name, int index) { // Ensure the filename is safe. - param->saved_main_file_path = FilePath::FromWStringHack(final_name); + param->saved_main_file_path = final_name; DownloadManager* dlm = web_contents_->profile()->GetDownloadManager(); DCHECK(dlm); dlm->GenerateSafeFilename(param->current_tab_mime_type, @@ -1142,7 +1141,7 @@ bool SavePackage::GetSafePureFileName(const FilePath& dir_path, } // SelectFileDialog::Listener interface. -void SavePackage::FileSelected(const std::wstring& path, +void SavePackage::FileSelected(const FilePath& path, int index, void* params) { SavePackageParam* save_params = reinterpret_cast<SavePackageParam*>(params); ContinueSave(save_params, path, index); diff --git a/chrome/browser/download/save_package.h b/chrome/browser/download/save_package.h index 5f86a98..5a42fe3 100644 --- a/chrome/browser/download/save_package.h +++ b/chrome/browser/download/save_package.h @@ -137,7 +137,7 @@ class SavePackage : public base::RefCountedThreadSafe<SavePackage>, void GetSaveInfo(); void ContinueSave(SavePackageParam* param, - const std::wstring& final_name, + const FilePath& final_name, int index); // RenderViewHostDelegate::Save ---------------------------------------------- @@ -203,7 +203,7 @@ class SavePackage : public base::RefCountedThreadSafe<SavePackage>, FilePath::StringType* pure_file_name); // SelectFileDialog::Listener interface. - virtual void FileSelected(const std::wstring& path, int index, void* params); + virtual void FileSelected(const FilePath& path, int index, void* params); virtual void FileSelectionCanceled(void* params); private: |