| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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_DISPATCHER_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_FUNCTION_DISPATCHER_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_FUNCTION_DISPATCHER_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_FUNCTION_DISPATCHER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 | 24 |
| 25 // ExtensionFunctionDispatcher receives requests to execute functions from | 25 // ExtensionFunctionDispatcher receives requests to execute functions from |
| 26 // Chromium extensions running in a RenderViewHost and dispatches them to the | 26 // Chromium extensions running in a RenderViewHost and dispatches them to the |
| 27 // appropriate handler. It lives entirely on the UI thread. | 27 // appropriate handler. It lives entirely on the UI thread. |
| 28 class ExtensionFunctionDispatcher { | 28 class ExtensionFunctionDispatcher { |
| 29 public: | 29 public: |
| 30 class Delegate { | 30 class Delegate { |
| 31 public: | 31 public: |
| 32 virtual Browser* GetBrowser() = 0; | 32 virtual Browser* GetBrowser() = 0; |
| 33 virtual ExtensionHost* GetExtensionHost() { return NULL; } | 33 virtual ExtensionHost* GetExtensionHost() { return NULL; } |
| 34 protected: | |
| 35 ~Delegate() {} | |
| 36 }; | 34 }; |
| 37 | 35 |
| 38 // The peer object allows us to notify ExtensionFunctions when we are | 36 // The peer object allows us to notify ExtensionFunctions when we are |
| 39 // destroyed. | 37 // destroyed. |
| 40 struct Peer : public base::RefCounted<Peer> { | 38 struct Peer : public base::RefCounted<Peer> { |
| 41 Peer(ExtensionFunctionDispatcher* dispatcher) : dispatcher_(dispatcher) {} | 39 Peer(ExtensionFunctionDispatcher* dispatcher) : dispatcher_(dispatcher) {} |
| 42 ExtensionFunctionDispatcher* dispatcher_; | 40 ExtensionFunctionDispatcher* dispatcher_; |
| 43 }; | 41 }; |
| 44 | 42 |
| 45 // Gets a list of all known extension function names. | 43 // Gets a list of all known extension function names. |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 | 101 |
| 104 // AutomationExtensionFunction requires access to the RenderViewHost | 102 // AutomationExtensionFunction requires access to the RenderViewHost |
| 105 // associated with us. We make it a friend rather than exposing the | 103 // associated with us. We make it a friend rather than exposing the |
| 106 // RenderViewHost as a public method as we wouldn't want everyone to | 104 // RenderViewHost as a public method as we wouldn't want everyone to |
| 107 // start assuming a 1:1 relationship between us and RenderViewHost, | 105 // start assuming a 1:1 relationship between us and RenderViewHost, |
| 108 // whereas AutomationExtensionFunction is by necessity "tight" with us. | 106 // whereas AutomationExtensionFunction is by necessity "tight" with us. |
| 109 friend class AutomationExtensionFunction; | 107 friend class AutomationExtensionFunction; |
| 110 }; | 108 }; |
| 111 | 109 |
| 112 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_FUNCTION_DISPATCHER_H_ | 110 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_FUNCTION_DISPATCHER_H_ |
| OLD | NEW |