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

Unified Diff: chrome/browser/file_select_helper.h

Issue 6680002: Pull the file picker code out of TabContents. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixes for jam@ Created 9 years, 9 months 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
« no previous file with comments | « no previous file | chrome/browser/file_select_helper.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/file_select_helper.h
diff --git a/chrome/browser/file_select_helper.h b/chrome/browser/file_select_helper.h
index 5a2b4d640ae98b726e76e0132b1695fd5f9fe131..0aa29af292582402b3a21c61770f0fe1603fa681 100644
--- a/chrome/browser/file_select_helper.h
+++ b/chrome/browser/file_select_helper.h
@@ -8,7 +8,9 @@
#include <vector>
+#include "base/compiler_specific.h"
#include "chrome/browser/ui/shell_dialogs.h"
+#include "content/browser/tab_contents/tab_contents_observer.h"
#include "content/common/notification_observer.h"
#include "content/common/notification_registrar.h"
#include "net/base/directory_lister.h"
@@ -25,26 +27,27 @@ class FileSelectHelper
explicit FileSelectHelper(Profile* profile);
~FileSelectHelper();
- // SelectFileDialog::Listener
- virtual void FileSelected(const FilePath& path, int index, void* params);
- virtual void MultiFilesSelected(const std::vector<FilePath>& files,
- void* params);
- virtual void FileSelectionCanceled(void* params);
-
- // net::DirectoryLister::DirectoryListerDelegate
- virtual void OnListFile(
- const net::DirectoryLister::DirectoryListerData& data);
- virtual void OnListDone(int error);
-
// Show the file chooser dialog.
void RunFileChooser(RenderViewHost* render_view_host,
const ViewHostMsg_RunFileChooser_Params& params);
private:
- // NotificationObserver implementation.
+ // SelectFileDialog::Listener overrides.
+ virtual void FileSelected(
+ const FilePath& path, int index, void* params) OVERRIDE;
+ virtual void MultiFilesSelected(const std::vector<FilePath>& files,
+ void* params) OVERRIDE;
+ virtual void FileSelectionCanceled(void* params) OVERRIDE;
+
+ // net::DirectoryLister::DirectoryListerDelegate overrides.
+ virtual void OnListFile(
+ const net::DirectoryLister::DirectoryListerData& data) OVERRIDE;
+ virtual void OnListDone(int error) OVERRIDE;
+
+ // NotificationObserver overrides.
virtual void Observe(NotificationType type,
const NotificationSource& source,
- const NotificationDetails& details);
+ const NotificationDetails& details) OVERRIDE;
// Helper method for handling the SelectFileDialog::Listener callbacks.
void DirectorySelected(const FilePath& path);
@@ -80,4 +83,22 @@ class FileSelectHelper
DISALLOW_COPY_AND_ASSIGN(FileSelectHelper);
};
+class FileSelectObserver : public TabContentsObserver {
+ public:
+ explicit FileSelectObserver(TabContents* tab_contents);
+ ~FileSelectObserver();
+
+ private:
+ // TabContentsObserver overrides.
+ virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
+
+ // Called when a file selection is to be done.
+ void OnRunFileChooser(const ViewHostMsg_RunFileChooser_Params& params);
+
+ // FileSelectHelper, lazily created.
+ scoped_ptr<FileSelectHelper> file_select_helper_;
+
+ DISALLOW_COPY_AND_ASSIGN(FileSelectObserver);
+};
+
#endif // CHROME_BROWSER_FILE_SELECT_HELPER_H_
« no previous file with comments | « no previous file | chrome/browser/file_select_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698