| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 Browser* GetCurrentBrowser(bool include_incognito); | 107 Browser* GetCurrentBrowser(bool include_incognito); |
| 108 | 108 |
| 109 // Handle a malformed message. Possibly the result of an attack, so kill | 109 // Handle a malformed message. Possibly the result of an attack, so kill |
| 110 // the renderer. | 110 // the renderer. |
| 111 void HandleBadMessage(ExtensionFunction* api); | 111 void HandleBadMessage(ExtensionFunction* api); |
| 112 | 112 |
| 113 // Gets the URL for the view we're displaying. | 113 // Gets the URL for the view we're displaying. |
| 114 const GURL& url() { return url_; } | 114 const GURL& url() { return url_; } |
| 115 | 115 |
| 116 // Gets the ID for this extension. | 116 // Gets the ID for this extension. |
| 117 const std::string extension_id() { return url_.host(); } | 117 const std::string extension_id() { return extension_id_; } |
| 118 | 118 |
| 119 // The profile that this dispatcher is associated with. | 119 // The profile that this dispatcher is associated with. |
| 120 Profile* profile(); | 120 Profile* profile(); |
| 121 | 121 |
| 122 // The RenderViewHost this dispatcher is associated with. | 122 // The RenderViewHost this dispatcher is associated with. |
| 123 RenderViewHost* render_view_host() { return render_view_host_; } | 123 RenderViewHost* render_view_host() { return render_view_host_; } |
| 124 | 124 |
| 125 private: | 125 private: |
| 126 ExtensionFunctionDispatcher(RenderViewHost* render_view_host, | 126 ExtensionFunctionDispatcher(RenderViewHost* render_view_host, |
| 127 Delegate* delegate, | 127 Delegate* delegate, |
| 128 Extension* extension, | 128 Extension* extension, |
| 129 const GURL& url); | 129 const GURL& url); |
| 130 | 130 |
| 131 // We need to keep a pointer to the profile because we use it in the dtor | 131 // We need to keep a pointer to the profile because we use it in the dtor |
| 132 // in sending EXTENSION_FUNCTION_DISPATCHER_DESTROYED, but by that point | 132 // in sending EXTENSION_FUNCTION_DISPATCHER_DESTROYED, but by that point |
| 133 // the render_view_host_ has been deleted. | 133 // the render_view_host_ has been deleted. |
| 134 Profile* profile_; | 134 Profile* profile_; |
| 135 | 135 |
| 136 RenderViewHost* render_view_host_; | 136 RenderViewHost* render_view_host_; |
| 137 | 137 |
| 138 Delegate* delegate_; | 138 Delegate* delegate_; |
| 139 | 139 |
| 140 GURL url_; | 140 GURL url_; |
| 141 | 141 |
| 142 std::string extension_id_; |
| 143 |
| 142 scoped_refptr<Peer> peer_; | 144 scoped_refptr<Peer> peer_; |
| 143 | 145 |
| 144 // AutomationExtensionFunction requires access to the RenderViewHost | 146 // AutomationExtensionFunction requires access to the RenderViewHost |
| 145 // associated with us. We make it a friend rather than exposing the | 147 // associated with us. We make it a friend rather than exposing the |
| 146 // RenderViewHost as a public method as we wouldn't want everyone to | 148 // RenderViewHost as a public method as we wouldn't want everyone to |
| 147 // start assuming a 1:1 relationship between us and RenderViewHost, | 149 // start assuming a 1:1 relationship between us and RenderViewHost, |
| 148 // whereas AutomationExtensionFunction is by necessity "tight" with us. | 150 // whereas AutomationExtensionFunction is by necessity "tight" with us. |
| 149 friend class AutomationExtensionFunction; | 151 friend class AutomationExtensionFunction; |
| 150 }; | 152 }; |
| 151 | 153 |
| 152 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_FUNCTION_DISPATCHER_H_ | 154 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_FUNCTION_DISPATCHER_H_ |
| OLD | NEW |