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

Side by Side Diff: chrome/browser/chromeos/extensions/file_browser_private_api.h

Issue 13776005: drive: Fix two instances of madness in FileBrowserEventRouter (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_CHROMEOS_EXTENSIONS_FILE_BROWSER_PRIVATE_API_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_BROWSER_PRIVATE_API_H_
6 #define CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_BROWSER_PRIVATE_API_H_ 6 #define CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_BROWSER_PRIVATE_API_H_
7 7
8 #include <map> 8 #include <map>
9 #include <queue> 9 #include <queue>
10 #include <string> 10 #include <string>
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 public: 50 public:
51 explicit FileBrowserPrivateAPI(Profile* profile); 51 explicit FileBrowserPrivateAPI(Profile* profile);
52 virtual ~FileBrowserPrivateAPI(); 52 virtual ~FileBrowserPrivateAPI();
53 53
54 // ProfileKeyedService overrides. 54 // ProfileKeyedService overrides.
55 virtual void Shutdown() OVERRIDE; 55 virtual void Shutdown() OVERRIDE;
56 56
57 // Convenience function to return the FileBrowserPrivateAPI for a Profile. 57 // Convenience function to return the FileBrowserPrivateAPI for a Profile.
58 static FileBrowserPrivateAPI* Get(Profile* profile); 58 static FileBrowserPrivateAPI* Get(Profile* profile);
59 59
60 scoped_refptr<FileBrowserEventRouter> event_router() { 60 FileBrowserEventRouter* event_router() {
61 return event_router_; 61 return event_router_.get();
62 } 62 }
63 63
64 private: 64 private:
65 scoped_refptr<FileBrowserEventRouter> event_router_; 65 scoped_ptr<FileBrowserEventRouter> event_router_;
66 }; 66 };
67 67
68 // Implements the chrome.fileBrowserPrivate.logoutUser method. 68 // Implements the chrome.fileBrowserPrivate.logoutUser method.
69 class LogoutUserFunction : public SyncExtensionFunction { 69 class LogoutUserFunction : public SyncExtensionFunction {
70 public: 70 public:
71 DECLARE_EXTENSION_FUNCTION("fileBrowserPrivate.logoutUser", 71 DECLARE_EXTENSION_FUNCTION("fileBrowserPrivate.logoutUser",
72 FILEBROWSERPRIVATE_LOGOUTUSER) 72 FILEBROWSERPRIVATE_LOGOUTUSER)
73 73
74 protected: 74 protected:
75 virtual ~LogoutUserFunction() {} 75 virtual ~LogoutUserFunction() {}
(...skipping 24 matching lines...) Expand all
100 scoped_refptr<fileapi::FileSystemContext> file_system_context, 100 scoped_refptr<fileapi::FileSystemContext> file_system_context,
101 const GURL& source_url, 101 const GURL& source_url,
102 int child_id); 102 int child_id);
103 }; 103 };
104 104
105 // Implements the chrome.fileBrowserPrivate.addFileWatch method. 105 // Implements the chrome.fileBrowserPrivate.addFileWatch method.
106 class FileWatchBrowserFunctionBase : public AsyncExtensionFunction { 106 class FileWatchBrowserFunctionBase : public AsyncExtensionFunction {
107 protected: 107 protected:
108 virtual ~FileWatchBrowserFunctionBase() {} 108 virtual ~FileWatchBrowserFunctionBase() {}
109 109
110 virtual bool PerformFileWatchOperation( 110 virtual void PerformFileWatchOperation(
hashimoto 2013/04/08 11:10:26 nit: Could you add a comment for this method while
satorux1 2013/04/09 01:24:38 Done.
111 scoped_refptr<FileBrowserEventRouter> event_router, 111 const base::FilePath& local_path,
112 const base::FilePath& local_path, const base::FilePath& virtual_path, 112 const base::FilePath& virtual_path,
113 const std::string& extension_id) = 0; 113 const std::string& extension_id) = 0;
114 114
115 // AsyncExtensionFunction overrides. 115 // AsyncExtensionFunction overrides.
116 virtual bool RunImpl() OVERRIDE; 116 virtual bool RunImpl() OVERRIDE;
117 117
118 private: 118 // Calls SendResponse() with |success| converted to base::Value.
119 void RespondOnUIThread(bool success); 119 void Respond(bool success);
120 void RunFileWatchOperationOnFileThread(
121 scoped_refptr<FileBrowserEventRouter> event_router,
122 const fileapi::FileSystemURL& file_url,
123 const std::string& extension_id);
124 }; 120 };
125 121
126 // Implements the chrome.fileBrowserPrivate.addFileWatch method. 122 // Implements the chrome.fileBrowserPrivate.addFileWatch method.
127 class AddFileWatchBrowserFunction : public FileWatchBrowserFunctionBase { 123 class AddFileWatchBrowserFunction : public FileWatchBrowserFunctionBase {
128 public: 124 public:
129 DECLARE_EXTENSION_FUNCTION("fileBrowserPrivate.addFileWatch", 125 DECLARE_EXTENSION_FUNCTION("fileBrowserPrivate.addFileWatch",
130 FILEBROWSERPRIVATE_ADDFILEWATCH) 126 FILEBROWSERPRIVATE_ADDFILEWATCH)
131 127
132 protected: 128 protected:
133 virtual ~AddFileWatchBrowserFunction() {} 129 virtual ~AddFileWatchBrowserFunction() {}
134 130
135 virtual bool PerformFileWatchOperation( 131 virtual void PerformFileWatchOperation(
hashimoto 2013/04/08 11:10:26 nit: Could you add a "FileWatchBrowserFunctionBase
satorux1 2013/04/09 01:24:38 Done.
136 scoped_refptr<FileBrowserEventRouter> event_router, 132 const base::FilePath& local_path,
137 const base::FilePath& local_path, const base::FilePath& virtual_path, 133 const base::FilePath& virtual_path,
138 const std::string& extension_id) OVERRIDE; 134 const std::string& extension_id) OVERRIDE;
139 }; 135 };
140 136
141 137
142 // Implements the chrome.fileBrowserPrivate.removeFileWatch method. 138 // Implements the chrome.fileBrowserPrivate.removeFileWatch method.
143 class RemoveFileWatchBrowserFunction : public FileWatchBrowserFunctionBase { 139 class RemoveFileWatchBrowserFunction : public FileWatchBrowserFunctionBase {
144 public: 140 public:
145 DECLARE_EXTENSION_FUNCTION("fileBrowserPrivate.removeFileWatch", 141 DECLARE_EXTENSION_FUNCTION("fileBrowserPrivate.removeFileWatch",
146 FILEBROWSERPRIVATE_REMOVEFILEWATCH) 142 FILEBROWSERPRIVATE_REMOVEFILEWATCH)
147 143
148 protected: 144 protected:
149 virtual ~RemoveFileWatchBrowserFunction() {} 145 virtual ~RemoveFileWatchBrowserFunction() {}
150 146
151 virtual bool PerformFileWatchOperation( 147 virtual void PerformFileWatchOperation(
hashimoto 2013/04/08 11:10:26 ditto.
satorux1 2013/04/09 01:24:38 Done.
152 scoped_refptr<FileBrowserEventRouter> event_router, 148 const base::FilePath& local_path,
153 const base::FilePath& local_path, const base::FilePath& virtual_path, 149 const base::FilePath& virtual_path,
154 const std::string& extension_id) OVERRIDE; 150 const std::string& extension_id) OVERRIDE;
155 }; 151 };
156 152
157 // Implements the chrome.fileBrowserPrivate.getFileTasks method. 153 // Implements the chrome.fileBrowserPrivate.getFileTasks method.
158 class GetFileTasksFileBrowserFunction : public AsyncExtensionFunction { 154 class GetFileTasksFileBrowserFunction : public AsyncExtensionFunction {
159 public: 155 public:
160 DECLARE_EXTENSION_FUNCTION("fileBrowserPrivate.getFileTasks", 156 DECLARE_EXTENSION_FUNCTION("fileBrowserPrivate.getFileTasks",
161 FILEBROWSERPRIVATE_GETFILETASKS) 157 FILEBROWSERPRIVATE_GETFILETASKS)
162 158
163 protected: 159 protected:
(...skipping 717 matching lines...) Expand 10 before | Expand all | Expand 10 after
881 OpenNewWindowFunction(); 877 OpenNewWindowFunction();
882 878
883 protected: 879 protected:
884 virtual ~OpenNewWindowFunction(); 880 virtual ~OpenNewWindowFunction();
885 881
886 // AsyncExtensionFunction overrides. 882 // AsyncExtensionFunction overrides.
887 virtual bool RunImpl() OVERRIDE; 883 virtual bool RunImpl() OVERRIDE;
888 }; 884 };
889 885
890 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_BROWSER_PRIVATE_API_H_ 886 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_BROWSER_PRIVATE_API_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698