| Index: chrome/browser/chromeos/extensions/file_browser_handler_api.cc
|
| diff --git a/chrome/browser/chromeos/extensions/file_browser_handler_api.cc b/chrome/browser/chromeos/extensions/file_browser_handler_api.cc
|
| index 940a04f26a6260ac5298ae2cff3c3b69be8e11a6..45e81614d2f98a3902c5266aeb44d0602c6f136b 100644
|
| --- a/chrome/browser/chromeos/extensions/file_browser_handler_api.cc
|
| +++ b/chrome/browser/chromeos/extensions/file_browser_handler_api.cc
|
| @@ -10,10 +10,10 @@
|
| // - Display 'save as' dialog using FileSelectorImpl which waits for the user
|
| // feedback.
|
| // - Once the user selects the file path (or cancels the selection),
|
| -// FileSelectorImpl notifies FileHandlerSelectFileFunction of the selection
|
| -// result by calling FileHandlerSelectFile::OnFilePathSelected.
|
| -// - If the selection was canceled, FileHandlerSelectFileFunction returns
|
| -// reporting failure.
|
| +// FileSelectorImpl notifies FileBrowserHandlerInternalSelectFileFunction of
|
| +// the selection result by calling FileHandlerSelectFile::OnFilePathSelected.
|
| +// - If the selection was canceled,
|
| +// FileBrowserHandlerInternalSelectFileFunction returns reporting failure.
|
| // - If the file path was selected, the function opens external file system
|
| // needed to create FileEntry object for the selected path
|
| // (opening file system will create file system name and root url for the
|
| @@ -119,10 +119,11 @@ class FileSelectorImpl : public FileSelector,
|
| // After this method is called, the selector implementation should not be
|
| // deleted by the caller. It will delete itself after it receives response
|
| // from SelectFielDialog.
|
| - virtual void SelectFile(const FilePath& suggested_name,
|
| - const std::vector<std::string>& allowed_extensions,
|
| - Browser* browser,
|
| - FileHandlerSelectFileFunction* function) OVERRIDE;
|
| + virtual void SelectFile(
|
| + const FilePath& suggested_name,
|
| + const std::vector<std::string>& allowed_extensions,
|
| + Browser* browser,
|
| + FileBrowserHandlerInternalSelectFileFunction* function) OVERRIDE;
|
|
|
| // ui::SelectFileDialog::Listener overrides.
|
| virtual void FileSelected(const FilePath& path,
|
| @@ -158,7 +159,7 @@ class FileSelectorImpl : public FileSelector,
|
| scoped_refptr<ui::SelectFileDialog> dialog_;
|
|
|
| // Extension function that uses the selector.
|
| - scoped_refptr<FileHandlerSelectFileFunction> function_;
|
| + scoped_refptr<FileBrowserHandlerInternalSelectFileFunction> function_;
|
|
|
| DISALLOW_COPY_AND_ASSIGN(FileSelectorImpl);
|
| };
|
| @@ -177,7 +178,7 @@ void FileSelectorImpl::SelectFile(
|
| const FilePath& suggested_name,
|
| const std::vector<std::string>& allowed_extensions,
|
| Browser* browser,
|
| - FileHandlerSelectFileFunction* function) {
|
| + FileBrowserHandlerInternalSelectFileFunction* function) {
|
| // We will hold reference to the function until it is notified of selection
|
| // result.
|
| function_ = function;
|
| @@ -289,22 +290,25 @@ void RunOpenFileSystemCallback(
|
|
|
| } // namespace
|
|
|
| -FileHandlerSelectFileFunction::FileHandlerSelectFileFunction()
|
| - : file_selector_factory_(new FileSelectorFactoryImpl()),
|
| - user_gesture_check_enabled_(true) {
|
| +FileBrowserHandlerInternalSelectFileFunction::
|
| + FileBrowserHandlerInternalSelectFileFunction()
|
| + : file_selector_factory_(new FileSelectorFactoryImpl()),
|
| + user_gesture_check_enabled_(true) {
|
| }
|
|
|
| -FileHandlerSelectFileFunction::FileHandlerSelectFileFunction(
|
| - FileSelectorFactory* file_selector_factory,
|
| - bool enable_user_gesture_check)
|
| - : file_selector_factory_(file_selector_factory),
|
| - user_gesture_check_enabled_(enable_user_gesture_check) {
|
| +FileBrowserHandlerInternalSelectFileFunction::
|
| + FileBrowserHandlerInternalSelectFileFunction(
|
| + FileSelectorFactory* file_selector_factory,
|
| + bool enable_user_gesture_check)
|
| + : file_selector_factory_(file_selector_factory),
|
| + user_gesture_check_enabled_(enable_user_gesture_check) {
|
| DCHECK(file_selector_factory);
|
| }
|
|
|
| -FileHandlerSelectFileFunction::~FileHandlerSelectFileFunction() {}
|
| +FileBrowserHandlerInternalSelectFileFunction::
|
| + ~FileBrowserHandlerInternalSelectFileFunction() {}
|
|
|
| -bool FileHandlerSelectFileFunction::RunImpl() {
|
| +bool FileBrowserHandlerInternalSelectFileFunction::RunImpl() {
|
| scoped_ptr<SelectFile::Params> params(SelectFile::Params::Create(*args_));
|
|
|
| FilePath suggested_name(params->selection_params.suggested_name);
|
| @@ -325,7 +329,7 @@ bool FileHandlerSelectFileFunction::RunImpl() {
|
| return true;
|
| }
|
|
|
| -void FileHandlerSelectFileFunction::OnFilePathSelected(
|
| +void FileBrowserHandlerInternalSelectFileFunction::OnFilePathSelected(
|
| bool success,
|
| const FilePath& full_path) {
|
| if (!success) {
|
| @@ -342,11 +346,12 @@ void FileHandlerSelectFileFunction::OnFilePathSelected(
|
| source_url_.GetOrigin(), fileapi::kFileSystemTypeExternal, false,
|
| base::Bind(
|
| &RunOpenFileSystemCallback,
|
| - base::Bind(&FileHandlerSelectFileFunction::OnFileSystemOpened,
|
| + base::Bind(&FileBrowserHandlerInternalSelectFileFunction::
|
| + OnFileSystemOpened,
|
| this)));
|
| };
|
|
|
| -void FileHandlerSelectFileFunction::OnFileSystemOpened(
|
| +void FileBrowserHandlerInternalSelectFileFunction::OnFileSystemOpened(
|
| bool success,
|
| const std::string& file_system_name,
|
| const GURL& file_system_root) {
|
| @@ -364,7 +369,7 @@ void FileHandlerSelectFileFunction::OnFileSystemOpened(
|
| GrantPermissions();
|
| }
|
|
|
| -void FileHandlerSelectFileFunction::GrantPermissions() {
|
| +void FileBrowserHandlerInternalSelectFileFunction::GrantPermissions() {
|
| fileapi::ExternalFileSystemMountPointProvider* external_provider =
|
| BrowserContext::GetDefaultStoragePartition(profile_)->
|
| GetFileSystemContext()->external_provider();
|
| @@ -400,11 +405,12 @@ void FileHandlerSelectFileFunction::GrantPermissions() {
|
| profile(),
|
| gdata_paths.Pass(),
|
| &permissions_to_grant_,
|
| - base::Bind(&FileHandlerSelectFileFunction::OnGotPermissionsToGrant,
|
| + base::Bind(&FileBrowserHandlerInternalSelectFileFunction::
|
| + OnGotPermissionsToGrant,
|
| this));
|
| }
|
|
|
| -void FileHandlerSelectFileFunction::OnGotPermissionsToGrant() {
|
| +void FileBrowserHandlerInternalSelectFileFunction::OnGotPermissionsToGrant() {
|
| // At this point all needed permissions should be collected, so let's grant
|
| // them.
|
| for (size_t i = 0; i < permissions_to_grant_.size(); i++) {
|
| @@ -417,7 +423,7 @@ void FileHandlerSelectFileFunction::OnGotPermissionsToGrant() {
|
| Respond(true);
|
| }
|
|
|
| -void FileHandlerSelectFileFunction::Respond(bool success) {
|
| +void FileBrowserHandlerInternalSelectFileFunction::Respond(bool success) {
|
| scoped_ptr<SelectFile::Results::Result> result(
|
| new SelectFile::Results::Result());
|
| result->success = success;
|
|
|