Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2208)

Unified Diff: chrome/browser/ui/views/select_file_dialog_extension.h

Issue 8770028: cros: Defer file selection callback until the window closes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/views/select_file_dialog_extension.h
diff --git a/chrome/browser/ui/views/select_file_dialog_extension.h b/chrome/browser/ui/views/select_file_dialog_extension.h
index 9cdeab3002343a26ae00865d43a57dbee31b7d34..59f0ba294d79d881c151db088464721f193458a7 100644
--- a/chrome/browser/ui/views/select_file_dialog_extension.h
+++ b/chrome/browser/ui/views/select_file_dialog_extension.h
@@ -6,7 +6,7 @@
#define CHROME_BROWSER_UI_VIEWS_SELECT_FILE_DIALOG_EXTENSION_H_
#pragma once
-#include <map>
+#include <vector>
#include "base/compiler_specific.h"
#include "base/memory/ref_counted.h"
@@ -31,10 +31,10 @@ class SelectFileDialogExtension
virtual void ListenerDestroyed() OVERRIDE;
// ExtensionDialog::Observer implementation.
- virtual void ExtensionDialogIsClosing(ExtensionDialog* dialog) OVERRIDE;
+ virtual void ExtensionDialogClosing(ExtensionDialog* dialog) OVERRIDE;
// Routes callback to appropriate SelectFileDialog::Listener based on
- // the owning |tab_id|, then closes the dialog.
+ // the owning |tab_id|.
static void OnFileSelected(int32 tab_id, const FilePath& path, int index);
static void OnMultiFilesSelected(int32 tab_id,
const std::vector<FilePath>& files);
@@ -63,11 +63,8 @@ class SelectFileDialogExtension
explicit SelectFileDialogExtension(SelectFileDialog::Listener* listener);
virtual ~SelectFileDialogExtension();
- // Closes the dialog and cleans up callbacks and listeners.
- void Close();
-
- // Posts a task to close the dialog.
- void PostTaskToClose();
+ // Invokes the appropriate file selection callback on our listener.
+ void NotifyListener();
// Adds this to the list of pending dialogs, used for testing.
void AddPending(int32 tab_id);
@@ -79,7 +76,6 @@ class SelectFileDialogExtension
virtual bool HasMultipleFileTypeChoicesImpl() OVERRIDE;
bool has_multiple_file_type_choices_;
- void* params_;
// Host for the extension that implements this dialog.
scoped_refptr<ExtensionDialog> extension_dialog_;
@@ -89,6 +85,19 @@ class SelectFileDialogExtension
gfx::NativeWindow owner_window_;
+ // We defer the callback into SelectFileDialog::Listener until the window
+ // closes, to match the semantics of file selection on Windows and Mac.
+ // These are the data passed to the listener.
+ enum SelectionType {
+ CANCEL = 0,
+ SINGLE_FILE,
+ MULTIPLE_FILES
+ };
+ SelectionType selection_type_;
+ std::vector<FilePath> selection_files_;
+ int selection_index_;
+ void* params_;
+
DISALLOW_COPY_AND_ASSIGN(SelectFileDialogExtension);
};

Powered by Google App Engine
This is Rietveld 408576698