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

Unified Diff: chrome/browser/tab_contents/tab_contents_file_select_helper.h

Issue 2825051: Add support for a directory file chooser command, which creates a file list b... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 4 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
Index: chrome/browser/tab_contents/tab_contents_file_select_helper.h
===================================================================
--- chrome/browser/tab_contents/tab_contents_file_select_helper.h (revision 0)
+++ chrome/browser/tab_contents/tab_contents_file_select_helper.h (revision 0)
@@ -0,0 +1,69 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_TAB_CONTENTS_TAB_CONTENTS_FILE_SELECT_HELPER_H_
+#define CHROME_BROWSER_TAB_CONTENTS_TAB_CONTENTS_FILE_SELECT_HELPER_H_
+#pragma once
+
+#include <vector>
+
+#include "chrome/browser/shell_dialogs.h"
+#include "chrome/browser/renderer_host/render_view_host_delegate.h"
+#include "net/base/directory_lister.h"
+
+class RenderViewHost;
+class TabContents;
+struct ViewHostMsg_RunFileChooser_Params;
+
+class TabContentsFileSelectHelper
+ : public SelectFileDialog::Listener,
+ public net::DirectoryLister::DirectoryListerDelegate,
+ public RenderViewHostDelegate::FileSelect {
+ public:
+ explicit TabContentsFileSelectHelper(TabContents* tab_contents);
+
+ ~TabContentsFileSelectHelper();
+
+ // 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);
+
+ // RenderViewHostDelegate::FileSelect
+ virtual void RunFileChooser(const ViewHostMsg_RunFileChooser_Params& params);
+
+ private:
+ // Returns the RenderViewHost of tab_contents_.
+ RenderViewHost* GetRenderViewHost();
+
+ // Helper method for handling the SelectFileDialog::Listener callbacks.
+ void DirectorySelected(const FilePath& path);
+
+ // The tab contents this class is helping. |tab_contents_| owns this object,
+ // so this pointer is guaranteed to be valid.
+ TabContents* tab_contents_;
+
+ // Dialog box used for choosing files to upload from file form fields.
+ scoped_refptr<SelectFileDialog> select_file_dialog_;
+
+ // The type of file dialog last shown.
+ SelectFileDialog::Type dialog_type_;
+
+ // The current directory lister (runs on a separate thread).
+ scoped_refptr<net::DirectoryLister> directory_lister_;
+
+ // The current directory lister results, which may update incrementally
+ // as the listing proceeds.
+ std::vector<FilePath> directory_lister_results_;
+
+ DISALLOW_COPY_AND_ASSIGN(TabContentsFileSelectHelper);
+};
+
+#endif // CHROME_BROWSER_TAB_CONTENTS_TAB_CONTENTS_FILE_SELECT_HELPER_H_
« no previous file with comments | « chrome/browser/tab_contents/tab_contents.cc ('k') | chrome/browser/tab_contents/tab_contents_file_select_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698