OLD | NEW |
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_EXTENSIONS_EXTENSION_FUNCTION_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_FUNCTION_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_FUNCTION_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_FUNCTION_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <list> | 9 #include <list> |
10 #include <string> | 10 #include <string> |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 return dispatcher_.get(); | 228 return dispatcher_.get(); |
229 } | 229 } |
230 | 230 |
231 protected: | 231 protected: |
232 friend struct content::BrowserThread::DeleteOnThread< | 232 friend struct content::BrowserThread::DeleteOnThread< |
233 content::BrowserThread::UI>; | 233 content::BrowserThread::UI>; |
234 friend class DeleteTask<UIThreadExtensionFunction>; | 234 friend class DeleteTask<UIThreadExtensionFunction>; |
235 | 235 |
236 virtual ~UIThreadExtensionFunction(); | 236 virtual ~UIThreadExtensionFunction(); |
237 | 237 |
238 virtual void SendResponse(bool success); | 238 virtual void SendResponse(bool success) OVERRIDE; |
239 | 239 |
240 // Gets the "current" browser, if any. | 240 // Gets the "current" browser, if any. |
241 // | 241 // |
242 // Many extension APIs operate relative to the current browser, which is the | 242 // Many extension APIs operate relative to the current browser, which is the |
243 // browser the calling code is running inside of. For example, popups, tabs, | 243 // browser the calling code is running inside of. For example, popups, tabs, |
244 // and infobars all have a containing browser, but background pages and | 244 // and infobars all have a containing browser, but background pages and |
245 // notification bubbles do not. | 245 // notification bubbles do not. |
246 // | 246 // |
247 // If there is no containing window, the current browser defaults to the | 247 // If there is no containing window, the current browser defaults to the |
248 // foremost one. | 248 // foremost one. |
(...skipping 26 matching lines...) Expand all Loading... |
275 public: | 275 public: |
276 explicit RenderViewHostTracker(UIThreadExtensionFunction* function); | 276 explicit RenderViewHostTracker(UIThreadExtensionFunction* function); |
277 private: | 277 private: |
278 virtual void Observe(int type, | 278 virtual void Observe(int type, |
279 const content::NotificationSource& source, | 279 const content::NotificationSource& source, |
280 const content::NotificationDetails& details) OVERRIDE; | 280 const content::NotificationDetails& details) OVERRIDE; |
281 UIThreadExtensionFunction* function_; | 281 UIThreadExtensionFunction* function_; |
282 content::NotificationRegistrar registrar_; | 282 content::NotificationRegistrar registrar_; |
283 }; | 283 }; |
284 | 284 |
285 virtual void Destruct() const; | 285 virtual void Destruct() const OVERRIDE; |
286 | 286 |
287 scoped_ptr<RenderViewHostTracker> tracker_; | 287 scoped_ptr<RenderViewHostTracker> tracker_; |
288 }; | 288 }; |
289 | 289 |
290 // Extension functions that run on the IO thread. This type of function avoids | 290 // Extension functions that run on the IO thread. This type of function avoids |
291 // a roundtrip to and from the UI thread (because communication with the | 291 // a roundtrip to and from the UI thread (because communication with the |
292 // extension process happens on the IO thread). It's intended to be used when | 292 // extension process happens on the IO thread). It's intended to be used when |
293 // performance is critical (e.g. the webRequest API which can block network | 293 // performance is critical (e.g. the webRequest API which can block network |
294 // requests). Generally, UIThreadExtensionFunction is more appropriate and will | 294 // requests). Generally, UIThreadExtensionFunction is more appropriate and will |
295 // be easier to use and interface with the rest of the browser. | 295 // be easier to use and interface with the rest of the browser. |
(...skipping 22 matching lines...) Expand all Loading... |
318 return extension_info_map_.get(); | 318 return extension_info_map_.get(); |
319 } | 319 } |
320 | 320 |
321 protected: | 321 protected: |
322 friend struct content::BrowserThread::DeleteOnThread< | 322 friend struct content::BrowserThread::DeleteOnThread< |
323 content::BrowserThread::IO>; | 323 content::BrowserThread::IO>; |
324 friend class DeleteTask<IOThreadExtensionFunction>; | 324 friend class DeleteTask<IOThreadExtensionFunction>; |
325 | 325 |
326 virtual ~IOThreadExtensionFunction(); | 326 virtual ~IOThreadExtensionFunction(); |
327 | 327 |
328 virtual void Destruct() const; | 328 virtual void Destruct() const OVERRIDE; |
329 | 329 |
330 virtual void SendResponse(bool success); | 330 virtual void SendResponse(bool success) OVERRIDE; |
331 | 331 |
332 private: | 332 private: |
333 base::WeakPtr<ChromeRenderMessageFilter> ipc_sender_; | 333 base::WeakPtr<ChromeRenderMessageFilter> ipc_sender_; |
334 int routing_id_; | 334 int routing_id_; |
335 | 335 |
336 scoped_refptr<const ExtensionInfoMap> extension_info_map_; | 336 scoped_refptr<const ExtensionInfoMap> extension_info_map_; |
337 }; | 337 }; |
338 | 338 |
339 // Base class for an extension function that runs asynchronously *relative to | 339 // Base class for an extension function that runs asynchronously *relative to |
340 // the browser's UI thread*. | 340 // the browser's UI thread*. |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
381 public: | 381 public: |
382 SyncIOThreadExtensionFunction(); | 382 SyncIOThreadExtensionFunction(); |
383 | 383 |
384 virtual void Run() OVERRIDE; | 384 virtual void Run() OVERRIDE; |
385 | 385 |
386 protected: | 386 protected: |
387 virtual ~SyncIOThreadExtensionFunction(); | 387 virtual ~SyncIOThreadExtensionFunction(); |
388 }; | 388 }; |
389 | 389 |
390 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_FUNCTION_H_ | 390 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_FUNCTION_H_ |
OLD | NEW |