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> |
11 | 11 |
12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
15 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
16 #include "base/process.h" | 16 #include "base/process.h" |
17 #include "chrome/browser/extensions/extension_info_map.h" | 17 #include "chrome/browser/extensions/extension_info_map.h" |
18 #include "chrome/common/extensions/extension.h" | 18 #include "chrome/common/extensions/extension.h" |
19 #include "content/browser/renderer_host/render_view_host_observer.h" | |
20 #include "content/public/browser/browser_thread.h" | 19 #include "content/public/browser/browser_thread.h" |
21 #include "content/public/browser/notification_observer.h" | 20 #include "content/public/browser/notification_observer.h" |
22 #include "content/public/browser/notification_registrar.h" | 21 #include "content/public/browser/notification_registrar.h" |
| 22 #include "content/public/browser/render_view_host_observer.h" |
23 #include "ipc/ipc_message.h" | 23 #include "ipc/ipc_message.h" |
24 | 24 |
25 class Browser; | 25 class Browser; |
26 class ChromeRenderMessageFilter; | 26 class ChromeRenderMessageFilter; |
27 class ExtensionFunction; | 27 class ExtensionFunction; |
28 class ExtensionFunctionDispatcher; | 28 class ExtensionFunctionDispatcher; |
29 class UIThreadExtensionFunction; | 29 class UIThreadExtensionFunction; |
30 class IOThreadExtensionFunction; | 30 class IOThreadExtensionFunction; |
31 class Profile; | 31 class Profile; |
32 class QuotaLimitHeuristic; | 32 class QuotaLimitHeuristic; |
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 | 282 |
283 private: | 283 private: |
284 // Helper class to track the lifetime of ExtensionFunction's RenderViewHost | 284 // Helper class to track the lifetime of ExtensionFunction's RenderViewHost |
285 // pointer and NULL it out when it dies. It also allows us to filter IPC | 285 // pointer and NULL it out when it dies. It also allows us to filter IPC |
286 // messages comming from the RenderViewHost. We use this separate class | 286 // messages comming from the RenderViewHost. We use this separate class |
287 // (instead of implementing NotificationObserver on ExtensionFunction) because | 287 // (instead of implementing NotificationObserver on ExtensionFunction) because |
288 // it is/ common for subclasses of ExtensionFunction to be | 288 // it is/ common for subclasses of ExtensionFunction to be |
289 // NotificationObservers, and it would be an easy error to forget to call the | 289 // NotificationObservers, and it would be an easy error to forget to call the |
290 // base class's Observe() method. | 290 // base class's Observe() method. |
291 class RenderViewHostTracker : public content::NotificationObserver, | 291 class RenderViewHostTracker : public content::NotificationObserver, |
292 public RenderViewHostObserver { | 292 public content::RenderViewHostObserver { |
293 public: | 293 public: |
294 RenderViewHostTracker(UIThreadExtensionFunction* function, | 294 RenderViewHostTracker(UIThreadExtensionFunction* function, |
295 RenderViewHost* render_view_host); | 295 RenderViewHost* render_view_host); |
296 private: | 296 private: |
297 virtual void Observe(int type, | 297 virtual void Observe(int type, |
298 const content::NotificationSource& source, | 298 const content::NotificationSource& source, |
299 const content::NotificationDetails& details) OVERRIDE; | 299 const content::NotificationDetails& details) OVERRIDE; |
300 | 300 |
301 virtual void RenderViewHostDestroyed( | 301 virtual void RenderViewHostDestroyed( |
302 RenderViewHost* render_view_host) OVERRIDE; | 302 RenderViewHost* render_view_host) OVERRIDE; |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
395 public: | 395 public: |
396 SyncIOThreadExtensionFunction(); | 396 SyncIOThreadExtensionFunction(); |
397 | 397 |
398 virtual void Run() OVERRIDE; | 398 virtual void Run() OVERRIDE; |
399 | 399 |
400 protected: | 400 protected: |
401 virtual ~SyncIOThreadExtensionFunction(); | 401 virtual ~SyncIOThreadExtensionFunction(); |
402 }; | 402 }; |
403 | 403 |
404 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_FUNCTION_H_ | 404 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_FUNCTION_H_ |
OLD | NEW |