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

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

Issue 13474015: drive: Fix lifetime model of FileBrowserEventRouter (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address comments 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 25 matching lines...) Expand all
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 bool PerformFileWatchOperation(
111 scoped_refptr<FileBrowserEventRouter> event_router, 111 FileBrowserEventRouter* event_router,
112 const base::FilePath& local_path, const base::FilePath& virtual_path, 112 const base::FilePath& local_path, 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 private:
119 void RespondOnUIThread(bool success); 119 void RespondOnUIThread(bool success);
120 void RunFileWatchOperationOnFileThread( 120 void RunFileWatchOperationOnFileThread(
121 scoped_refptr<FileBrowserEventRouter> event_router, 121 FileBrowserEventRouter* event_router,
122 const fileapi::FileSystemURL& file_url, 122 const fileapi::FileSystemURL& file_url,
123 const std::string& extension_id); 123 const std::string& extension_id);
124 }; 124 };
125 125
126 // Implements the chrome.fileBrowserPrivate.addFileWatch method. 126 // Implements the chrome.fileBrowserPrivate.addFileWatch method.
127 class AddFileWatchBrowserFunction : public FileWatchBrowserFunctionBase { 127 class AddFileWatchBrowserFunction : public FileWatchBrowserFunctionBase {
128 public: 128 public:
129 DECLARE_EXTENSION_FUNCTION("fileBrowserPrivate.addFileWatch", 129 DECLARE_EXTENSION_FUNCTION("fileBrowserPrivate.addFileWatch",
130 FILEBROWSERPRIVATE_ADDFILEWATCH) 130 FILEBROWSERPRIVATE_ADDFILEWATCH)
131 131
132 protected: 132 protected:
133 virtual ~AddFileWatchBrowserFunction() {} 133 virtual ~AddFileWatchBrowserFunction() {}
134 134
135 virtual bool PerformFileWatchOperation( 135 virtual bool PerformFileWatchOperation(
136 scoped_refptr<FileBrowserEventRouter> event_router, 136 FileBrowserEventRouter* event_router,
137 const base::FilePath& local_path, const base::FilePath& virtual_path, 137 const base::FilePath& local_path, const base::FilePath& virtual_path,
138 const std::string& extension_id) OVERRIDE; 138 const std::string& extension_id) OVERRIDE;
139 }; 139 };
140 140
141 141
142 // Implements the chrome.fileBrowserPrivate.removeFileWatch method. 142 // Implements the chrome.fileBrowserPrivate.removeFileWatch method.
143 class RemoveFileWatchBrowserFunction : public FileWatchBrowserFunctionBase { 143 class RemoveFileWatchBrowserFunction : public FileWatchBrowserFunctionBase {
144 public: 144 public:
145 DECLARE_EXTENSION_FUNCTION("fileBrowserPrivate.removeFileWatch", 145 DECLARE_EXTENSION_FUNCTION("fileBrowserPrivate.removeFileWatch",
146 FILEBROWSERPRIVATE_REMOVEFILEWATCH) 146 FILEBROWSERPRIVATE_REMOVEFILEWATCH)
147 147
148 protected: 148 protected:
149 virtual ~RemoveFileWatchBrowserFunction() {} 149 virtual ~RemoveFileWatchBrowserFunction() {}
150 150
151 virtual bool PerformFileWatchOperation( 151 virtual bool PerformFileWatchOperation(
152 scoped_refptr<FileBrowserEventRouter> event_router, 152 FileBrowserEventRouter* event_router,
153 const base::FilePath& local_path, const base::FilePath& virtual_path, 153 const base::FilePath& local_path, const base::FilePath& virtual_path,
154 const std::string& extension_id) OVERRIDE; 154 const std::string& extension_id) OVERRIDE;
155 }; 155 };
156 156
157 // Implements the chrome.fileBrowserPrivate.getFileTasks method. 157 // Implements the chrome.fileBrowserPrivate.getFileTasks method.
158 class GetFileTasksFileBrowserFunction : public AsyncExtensionFunction { 158 class GetFileTasksFileBrowserFunction : public AsyncExtensionFunction {
159 public: 159 public:
160 DECLARE_EXTENSION_FUNCTION("fileBrowserPrivate.getFileTasks", 160 DECLARE_EXTENSION_FUNCTION("fileBrowserPrivate.getFileTasks",
161 FILEBROWSERPRIVATE_GETFILETASKS) 161 FILEBROWSERPRIVATE_GETFILETASKS)
162 162
(...skipping 718 matching lines...) Expand 10 before | Expand all | Expand 10 after
881 OpenNewWindowFunction(); 881 OpenNewWindowFunction();
882 882
883 protected: 883 protected:
884 virtual ~OpenNewWindowFunction(); 884 virtual ~OpenNewWindowFunction();
885 885
886 // AsyncExtensionFunction overrides. 886 // AsyncExtensionFunction overrides.
887 virtual bool RunImpl() OVERRIDE; 887 virtual bool RunImpl() OVERRIDE;
888 }; 888 };
889 889
890 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_BROWSER_PRIVATE_API_H_ 890 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_BROWSER_PRIVATE_API_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698