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

Side by Side Diff: chrome/browser/file_select_helper.h

Issue 7064033: Virtual destructors should have virtual keyword. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Created 9 years, 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/favicon/favicon_service.h ('k') | chrome/browser/history/history.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_FILE_SELECT_HELPER_H_ 5 #ifndef CHROME_BROWSER_FILE_SELECT_HELPER_H_
6 #define CHROME_BROWSER_FILE_SELECT_HELPER_H_ 6 #define CHROME_BROWSER_FILE_SELECT_HELPER_H_
7 #pragma once 7 #pragma once
8 8
9 #include <map> 9 #include <map>
10 #include <vector> 10 #include <vector>
(...skipping 11 matching lines...) Expand all
22 22
23 23
24 // This class handles file-selection requests coming from WebUI elements 24 // This class handles file-selection requests coming from WebUI elements
25 // (via the ExtensionHost class). It implements both the initialisation 25 // (via the ExtensionHost class). It implements both the initialisation
26 // and listener functions for file-selection dialogs. 26 // and listener functions for file-selection dialogs.
27 class FileSelectHelper 27 class FileSelectHelper
28 : public SelectFileDialog::Listener, 28 : public SelectFileDialog::Listener,
29 public NotificationObserver { 29 public NotificationObserver {
30 public: 30 public:
31 explicit FileSelectHelper(Profile* profile); 31 explicit FileSelectHelper(Profile* profile);
32 ~FileSelectHelper(); 32 virtual ~FileSelectHelper();
33 33
34 // Show the file chooser dialog. 34 // Show the file chooser dialog.
35 void RunFileChooser(RenderViewHost* render_view_host, 35 void RunFileChooser(RenderViewHost* render_view_host,
36 TabContents* tab_contents, 36 TabContents* tab_contents,
37 const ViewHostMsg_RunFileChooser_Params& params); 37 const ViewHostMsg_RunFileChooser_Params& params);
38 38
39 // Enumerates all the files in directory. 39 // Enumerates all the files in directory.
40 void EnumerateDirectory(int request_id, 40 void EnumerateDirectory(int request_id,
41 RenderViewHost* render_view_host, 41 RenderViewHost* render_view_host,
42 const FilePath& path); 42 const FilePath& path);
43 43
44 private: 44 private:
45 // Utility class which can listen for directory lister events and relay 45 // Utility class which can listen for directory lister events and relay
46 // them to the main object with the correct tracking id. 46 // them to the main object with the correct tracking id.
47 class DirectoryListerDispatchDelegate 47 class DirectoryListerDispatchDelegate
48 : public net::DirectoryLister::DirectoryListerDelegate { 48 : public net::DirectoryLister::DirectoryListerDelegate {
49 public: 49 public:
50 DirectoryListerDispatchDelegate(FileSelectHelper* parent, int id) 50 DirectoryListerDispatchDelegate(FileSelectHelper* parent, int id)
51 : parent_(parent), 51 : parent_(parent),
52 id_(id) {} 52 id_(id) {}
53 ~DirectoryListerDispatchDelegate() {} 53 virtual ~DirectoryListerDispatchDelegate() {}
54 virtual void OnListFile( 54 virtual void OnListFile(
55 const net::DirectoryLister::DirectoryListerData& data) { 55 const net::DirectoryLister::DirectoryListerData& data) {
56 parent_->OnListFile(id_, data); 56 parent_->OnListFile(id_, data);
57 } 57 }
58 virtual void OnListDone(int error) { 58 virtual void OnListDone(int error) {
59 parent_->OnListDone(id_, error); 59 parent_->OnListDone(id_, error);
60 } 60 }
61 private: 61 private:
62 // This FileSelectHelper owns this object. 62 // This FileSelectHelper owns this object.
63 FileSelectHelper* parent_; 63 FileSelectHelper* parent_;
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 116
117 // Registrar for notifications regarding our RenderViewHost. 117 // Registrar for notifications regarding our RenderViewHost.
118 NotificationRegistrar notification_registrar_; 118 NotificationRegistrar notification_registrar_;
119 119
120 DISALLOW_COPY_AND_ASSIGN(FileSelectHelper); 120 DISALLOW_COPY_AND_ASSIGN(FileSelectHelper);
121 }; 121 };
122 122
123 class FileSelectObserver : public TabContentsObserver { 123 class FileSelectObserver : public TabContentsObserver {
124 public: 124 public:
125 explicit FileSelectObserver(TabContents* tab_contents); 125 explicit FileSelectObserver(TabContents* tab_contents);
126 ~FileSelectObserver(); 126 virtual ~FileSelectObserver();
127 127
128 private: 128 private:
129 // TabContentsObserver overrides. 129 // TabContentsObserver overrides.
130 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; 130 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
131 131
132 // Called when a file selection is to be done. 132 // Called when a file selection is to be done.
133 void OnRunFileChooser(const ViewHostMsg_RunFileChooser_Params& params); 133 void OnRunFileChooser(const ViewHostMsg_RunFileChooser_Params& params);
134 134
135 // Called when a direction enumeration is to be done. 135 // Called when a direction enumeration is to be done.
136 void OnEnumerateDirectory(int request_id, const FilePath& path); 136 void OnEnumerateDirectory(int request_id, const FilePath& path);
137 137
138 // FileSelectHelper, lazily created. 138 // FileSelectHelper, lazily created.
139 scoped_ptr<FileSelectHelper> file_select_helper_; 139 scoped_ptr<FileSelectHelper> file_select_helper_;
140 140
141 DISALLOW_COPY_AND_ASSIGN(FileSelectObserver); 141 DISALLOW_COPY_AND_ASSIGN(FileSelectObserver);
142 }; 142 };
143 143
144 #endif // CHROME_BROWSER_FILE_SELECT_HELPER_H_ 144 #endif // CHROME_BROWSER_FILE_SELECT_HELPER_H_
OLDNEW
« no previous file with comments | « chrome/browser/favicon/favicon_service.h ('k') | chrome/browser/history/history.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698