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

Side by Side Diff: chrome/browser/extensions/api/history/history_api.h

Issue 257333002: Drive extension functions from ExtensionFunction::Run. The (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix comment Created 6 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
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_EXTENSIONS_API_HISTORY_HISTORY_API_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_HISTORY_HISTORY_API_H_
6 #define CHROME_BROWSER_EXTENSIONS_API_HISTORY_HISTORY_API_H_ 6 #define CHROME_BROWSER_EXTENSIONS_API_HISTORY_HISTORY_API_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 // Base class for history funciton APIs which require async interaction with 98 // Base class for history funciton APIs which require async interaction with
99 // chrome services and the extension thread. 99 // chrome services and the extension thread.
100 class HistoryFunctionWithCallback : public HistoryFunction { 100 class HistoryFunctionWithCallback : public HistoryFunction {
101 public: 101 public:
102 HistoryFunctionWithCallback(); 102 HistoryFunctionWithCallback();
103 103
104 protected: 104 protected:
105 virtual ~HistoryFunctionWithCallback(); 105 virtual ~HistoryFunctionWithCallback();
106 106
107 // ExtensionFunction: 107 // ExtensionFunction:
108 virtual bool RunImpl() OVERRIDE; 108 virtual bool RunAsync() OVERRIDE;
109 109
110 // Return true if the async call was completed, false otherwise. 110 // Return true if the async call was completed, false otherwise.
111 virtual bool RunAsyncImpl() = 0; 111 virtual bool RunAsyncImpl() = 0;
112 112
113 // Call this method to report the results of the async method to the caller. 113 // Call this method to report the results of the async method to the caller.
114 // This method calls Release(). 114 // This method calls Release().
115 virtual void SendAsyncResponse(); 115 virtual void SendAsyncResponse();
116 116
117 // The consumer for the HistoryService callbacks. 117 // The consumer for the HistoryService callbacks.
118 CancelableRequestConsumer cancelable_consumer_; 118 CancelableRequestConsumer cancelable_consumer_;
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 }; 157 };
158 158
159 class HistoryAddUrlFunction : public HistoryFunction { 159 class HistoryAddUrlFunction : public HistoryFunction {
160 public: 160 public:
161 DECLARE_EXTENSION_FUNCTION("history.addUrl", HISTORY_ADDURL) 161 DECLARE_EXTENSION_FUNCTION("history.addUrl", HISTORY_ADDURL)
162 162
163 protected: 163 protected:
164 virtual ~HistoryAddUrlFunction() {} 164 virtual ~HistoryAddUrlFunction() {}
165 165
166 // HistoryFunctionWithCallback: 166 // HistoryFunctionWithCallback:
167 virtual bool RunImpl() OVERRIDE; 167 virtual bool RunAsync() OVERRIDE;
168 }; 168 };
169 169
170 class HistoryDeleteAllFunction : public HistoryFunctionWithCallback { 170 class HistoryDeleteAllFunction : public HistoryFunctionWithCallback {
171 public: 171 public:
172 DECLARE_EXTENSION_FUNCTION("history.deleteAll", HISTORY_DELETEALL) 172 DECLARE_EXTENSION_FUNCTION("history.deleteAll", HISTORY_DELETEALL)
173 173
174 protected: 174 protected:
175 virtual ~HistoryDeleteAllFunction() {} 175 virtual ~HistoryDeleteAllFunction() {}
176 176
177 // HistoryFunctionWithCallback: 177 // HistoryFunctionWithCallback:
178 virtual bool RunAsyncImpl() OVERRIDE; 178 virtual bool RunAsyncImpl() OVERRIDE;
179 179
180 // Callback for the history service to acknowledge deletion. 180 // Callback for the history service to acknowledge deletion.
181 void DeleteComplete(); 181 void DeleteComplete();
182 }; 182 };
183 183
184 184
185 class HistoryDeleteUrlFunction : public HistoryFunction { 185 class HistoryDeleteUrlFunction : public HistoryFunction {
186 public: 186 public:
187 DECLARE_EXTENSION_FUNCTION("history.deleteUrl", HISTORY_DELETEURL) 187 DECLARE_EXTENSION_FUNCTION("history.deleteUrl", HISTORY_DELETEURL)
188 188
189 protected: 189 protected:
190 virtual ~HistoryDeleteUrlFunction() {} 190 virtual ~HistoryDeleteUrlFunction() {}
191 191
192 // HistoryFunctionWithCallback: 192 // HistoryFunctionWithCallback:
193 virtual bool RunImpl() OVERRIDE; 193 virtual bool RunAsync() OVERRIDE;
194 }; 194 };
195 195
196 class HistoryDeleteRangeFunction : public HistoryFunctionWithCallback { 196 class HistoryDeleteRangeFunction : public HistoryFunctionWithCallback {
197 public: 197 public:
198 DECLARE_EXTENSION_FUNCTION("history.deleteRange", HISTORY_DELETERANGE) 198 DECLARE_EXTENSION_FUNCTION("history.deleteRange", HISTORY_DELETERANGE)
199 199
200 protected: 200 protected:
201 virtual ~HistoryDeleteRangeFunction() {} 201 virtual ~HistoryDeleteRangeFunction() {}
202 202
203 // HistoryFunctionWithCallback: 203 // HistoryFunctionWithCallback:
204 virtual bool RunAsyncImpl() OVERRIDE; 204 virtual bool RunAsyncImpl() OVERRIDE;
205 205
206 // Callback for the history service to acknowledge deletion. 206 // Callback for the history service to acknowledge deletion.
207 void DeleteComplete(); 207 void DeleteComplete();
208 }; 208 };
209 209
210 } // namespace extensions 210 } // namespace extensions
211 211
212 #endif // CHROME_BROWSER_EXTENSIONS_API_HISTORY_HISTORY_API_H_ 212 #endif // CHROME_BROWSER_EXTENSIONS_API_HISTORY_HISTORY_API_H_
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/gcm/gcm_api.cc ('k') | chrome/browser/extensions/api/history/history_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698