diff options
author | ananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-07-10 00:19:57 +0000 |
---|---|---|
committer | ananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-07-10 00:19:57 +0000 |
commit | 87940dd2cf5b5d1c91a84a050f3244067fd7d279 (patch) | |
tree | 1830509ba7979bf6a1a8fd345c05f2653a343adc /win8/metro_driver | |
parent | 333ec26facb1a2d1a6400f313d50ad5b63597c37 (diff) | |
download | chromium_src-87940dd2cf5b5d1c91a84a050f3244067fd7d279.zip chromium_src-87940dd2cf5b5d1c91a84a050f3244067fd7d279.tar.gz chromium_src-87940dd2cf5b5d1c91a84a050f3244067fd7d279.tar.bz2 |
Ensure that the suggested file name is passed to Windows 8 Chrome ASH when the save as operation is invoked.
The suggested file name is actually the path of the file. We need to get the name from there and display it in
the file save picker. This is done in the metro driver in the SaveFilePickerSession::StartFilePicker function.
cpu, please review everything.
sky, for owners review in ui\aura.
BUG=256424
R=cpu@chromium.org, sky@chromium.org
Review URL: https://codereview.chromium.org/18943003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@210684 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'win8/metro_driver')
-rw-r--r-- | win8/metro_driver/chrome_app_view_ash.cc | 2 | ||||
-rw-r--r-- | win8/metro_driver/file_picker_ash.cc | 25 | ||||
-rw-r--r-- | win8/metro_driver/file_picker_ash.h | 7 |
3 files changed, 20 insertions, 14 deletions
diff --git a/win8/metro_driver/chrome_app_view_ash.cc b/win8/metro_driver/chrome_app_view_ash.cc index db5a224..12b77fe 100644 --- a/win8/metro_driver/chrome_app_view_ash.cc +++ b/win8/metro_driver/chrome_app_view_ash.cc @@ -521,7 +521,7 @@ void ChromeAppViewAsh::OnDisplayFileOpenDialog( new OpenFilePickerSession(this, title, filter, - default_path.value(), + default_path, allow_multiple_files); file_picker_->Run(); } diff --git a/win8/metro_driver/file_picker_ash.cc b/win8/metro_driver/file_picker_ash.cc index 0193e39..a4b1622 100644 --- a/win8/metro_driver/file_picker_ash.cc +++ b/win8/metro_driver/file_picker_ash.cc @@ -6,7 +6,6 @@ #include "win8/metro_driver/file_picker_ash.h" #include "base/bind.h" -#include "base/files/file_path.h" #include "base/logging.h" #include "base/message_loop.h" #include "base/strings/string_util.h" @@ -85,7 +84,7 @@ class StringVectorImpl : public mswr::RuntimeClass<StringVectorItf> { FilePickerSessionBase::FilePickerSessionBase(ChromeAppViewAsh* app_view, const string16& title, const string16& filter, - const string16& default_path) + const base::FilePath& default_path) : app_view_(app_view), title_(title), filter_(filter), @@ -116,11 +115,12 @@ bool FilePickerSessionBase::DoFilePicker() { return true; } -OpenFilePickerSession::OpenFilePickerSession(ChromeAppViewAsh* app_view, - const string16& title, - const string16& filter, - const string16& default_path, - bool allow_multi_select) +OpenFilePickerSession::OpenFilePickerSession( + ChromeAppViewAsh* app_view, + const string16& title, + const string16& filter, + const base::FilePath& default_path, + bool allow_multi_select) : FilePickerSessionBase(app_view, title, filter, default_path), allow_multi_select_(allow_multi_select) { } @@ -377,7 +377,7 @@ SaveFilePickerSession::SaveFilePickerSession( : FilePickerSessionBase(app_view, params.title, params.filter, - params.suggested_name.value()), + params.suggested_name), filter_index_(params.filter_index) { } @@ -492,8 +492,13 @@ HRESULT SaveFilePickerSession::StartFilePicker() { } if (!default_path_.empty()) { + string16 file_part = default_path_.BaseName().value(); + // If the suggested_name is a root directory, then don't set it as the + // suggested name. + if (file_part.size() == 1 && file_part[0] == L'\\') + file_part.clear(); hr = picker->put_SuggestedFileName( - mswrw::HStringReference(default_path_.c_str()).Get()); + mswrw::HStringReference(file_part.c_str()).Get()); if (FAILED(hr)) return hr; } @@ -546,7 +551,7 @@ HRESULT SaveFilePickerSession::FilePickerDone(SaveFileAsyncOp* async, FolderPickerSession::FolderPickerSession(ChromeAppViewAsh* app_view, const string16& title) - : FilePickerSessionBase(app_view, title, L"", L"") {} + : FilePickerSessionBase(app_view, title, L"", base::FilePath()) {} HRESULT FolderPickerSession::StartFilePicker() { mswrw::HStringReference class_name( diff --git a/win8/metro_driver/file_picker_ash.h b/win8/metro_driver/file_picker_ash.h index c6d1c49..b081156 100644 --- a/win8/metro_driver/file_picker_ash.h +++ b/win8/metro_driver/file_picker_ash.h @@ -8,6 +8,7 @@ #include "base/basictypes.h" #include "base/compiler_specific.h" +#include "base/files/file_path.h" #include "base/strings/string16.h" class ChromeAppViewAsh; @@ -24,7 +25,7 @@ class FilePickerSessionBase { explicit FilePickerSessionBase(ChromeAppViewAsh* app_view, const string16& title, const string16& filter, - const string16& default_path); + const base::FilePath& default_path); virtual ~FilePickerSessionBase() { } @@ -56,7 +57,7 @@ class FilePickerSessionBase { string16 filter_; // The starting directory/file name. - string16 default_path_; + base::FilePath default_path_; // Pointer to the ChromeAppViewAsh instance. We notify the ChromeAppViewAsh // instance when the file open/save operations complete. @@ -79,7 +80,7 @@ class OpenFilePickerSession : public FilePickerSessionBase { explicit OpenFilePickerSession(ChromeAppViewAsh* app_view, const string16& title, const string16& filter, - const string16& default_path, + const base::FilePath& default_path, bool allow_multi_select); const std::vector<base::FilePath>& filenames() const { |