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_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> |
11 | 11 |
12 #include "base/ref_counted.h" | 12 #include "base/ref_counted.h" |
13 #include "googleurl/src/gurl.h" | 13 #include "googleurl/src/gurl.h" |
14 #include "ui/gfx/native_widget_types.h" | 14 #include "ui/gfx/native_widget_types.h" |
15 | 15 |
16 class Browser; | 16 class Browser; |
17 class Extension; | 17 class Extension; |
18 class ExtensionFunction; | 18 class ExtensionFunction; |
19 class ListValue; | 19 class ListValue; |
20 class Profile; | 20 class Profile; |
21 class RenderViewHost; | 21 class RenderViewHost; |
22 class TabContents; | 22 class TabContents; |
23 struct ViewHostMsg_DomMessage_Params; | 23 struct ExtensionHostMsg_DomMessage_Params; |
24 | 24 |
25 // A factory function for creating new ExtensionFunction instances. | 25 // A factory function for creating new ExtensionFunction instances. |
26 typedef ExtensionFunction* (*ExtensionFunctionFactory)(); | 26 typedef ExtensionFunction* (*ExtensionFunctionFactory)(); |
27 | 27 |
28 // ExtensionFunctionDispatcher receives requests to execute functions from | 28 // ExtensionFunctionDispatcher receives requests to execute functions from |
29 // Chromium extensions running in a RenderViewHost and dispatches them to the | 29 // Chromium extensions running in a RenderViewHost and dispatches them to the |
30 // appropriate handler. It lives entirely on the UI thread. | 30 // appropriate handler. It lives entirely on the UI thread. |
31 class ExtensionFunctionDispatcher { | 31 class ExtensionFunctionDispatcher { |
32 public: | 32 public: |
33 class Delegate { | 33 class Delegate { |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 // does not contain a valid extension, returns NULL. | 79 // does not contain a valid extension, returns NULL. |
80 static ExtensionFunctionDispatcher* Create(RenderViewHost* render_view_host, | 80 static ExtensionFunctionDispatcher* Create(RenderViewHost* render_view_host, |
81 Delegate* delegate, | 81 Delegate* delegate, |
82 const GURL& url); | 82 const GURL& url); |
83 | 83 |
84 ~ExtensionFunctionDispatcher(); | 84 ~ExtensionFunctionDispatcher(); |
85 | 85 |
86 Delegate* delegate() { return delegate_; } | 86 Delegate* delegate() { return delegate_; } |
87 | 87 |
88 // Handle a request to execute an extension function. | 88 // Handle a request to execute an extension function. |
89 void HandleRequest(const ViewHostMsg_DomMessage_Params& params); | 89 void HandleRequest(const ExtensionHostMsg_DomMessage_Params& params); |
90 | 90 |
91 // Send a response to a function. | 91 // Send a response to a function. |
92 void SendResponse(ExtensionFunction* api, bool success); | 92 void SendResponse(ExtensionFunction* api, bool success); |
93 | 93 |
94 // Returns the current browser. Callers should generally prefer | 94 // Returns the current browser. Callers should generally prefer |
95 // ExtensionFunction::GetCurrentBrowser() over this method, as that one | 95 // ExtensionFunction::GetCurrentBrowser() over this method, as that one |
96 // provides the correct value for |include_incognito|. | 96 // provides the correct value for |include_incognito|. |
97 // | 97 // |
98 // See the comments for ExtensionFunction::GetCurrentBrowser() for more | 98 // See the comments for ExtensionFunction::GetCurrentBrowser() for more |
99 // details. | 99 // details. |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 | 138 |
139 // AutomationExtensionFunction requires access to the RenderViewHost | 139 // AutomationExtensionFunction requires access to the RenderViewHost |
140 // associated with us. We make it a friend rather than exposing the | 140 // associated with us. We make it a friend rather than exposing the |
141 // RenderViewHost as a public method as we wouldn't want everyone to | 141 // RenderViewHost as a public method as we wouldn't want everyone to |
142 // start assuming a 1:1 relationship between us and RenderViewHost, | 142 // start assuming a 1:1 relationship between us and RenderViewHost, |
143 // whereas AutomationExtensionFunction is by necessity "tight" with us. | 143 // whereas AutomationExtensionFunction is by necessity "tight" with us. |
144 friend class AutomationExtensionFunction; | 144 friend class AutomationExtensionFunction; |
145 }; | 145 }; |
146 | 146 |
147 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_FUNCTION_DISPATCHER_H_ | 147 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_FUNCTION_DISPATCHER_H_ |
OLD | NEW |