| 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> |
| 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 | 14 |
| 15 class Browser; | 15 class Browser; |
| 16 class Extension; |
| 16 class ExtensionFunction; | 17 class ExtensionFunction; |
| 17 class ExtensionHost; | 18 class ExtensionHost; |
| 18 class Profile; | 19 class Profile; |
| 19 class RenderViewHost; | 20 class RenderViewHost; |
| 20 class RenderViewHostDelegate; | 21 class RenderViewHostDelegate; |
| 21 | 22 |
| 22 // A factory function for creating new ExtensionFunction instances. | 23 // A factory function for creating new ExtensionFunction instances. |
| 23 typedef ExtensionFunction* (*ExtensionFunctionFactory)(); | 24 typedef ExtensionFunction* (*ExtensionFunctionFactory)(); |
| 24 | 25 |
| 25 // ExtensionFunctionDispatcher receives requests to execute functions from | 26 // ExtensionFunctionDispatcher receives requests to execute functions from |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 void SendResponse(ExtensionFunction* api, bool success); | 68 void SendResponse(ExtensionFunction* api, bool success); |
| 68 | 69 |
| 69 // Gets the browser extension functions should operate relative to. For | 70 // Gets the browser extension functions should operate relative to. For |
| 70 // example, for positioning windows, or alert boxes, or creating tabs. | 71 // example, for positioning windows, or alert boxes, or creating tabs. |
| 71 Browser* GetBrowser(); | 72 Browser* GetBrowser(); |
| 72 | 73 |
| 73 // Gets the ExtensionHost associated with this object. In the case of | 74 // Gets the ExtensionHost associated with this object. In the case of |
| 74 // tab hosted extension pages, this will return NULL. | 75 // tab hosted extension pages, this will return NULL. |
| 75 ExtensionHost* GetExtensionHost(); | 76 ExtensionHost* GetExtensionHost(); |
| 76 | 77 |
| 78 // Gets the extension the function is being invoked by. This should not ever |
| 79 // return NULL. |
| 80 Extension* GetExtension(); |
| 81 |
| 77 // Handle a malformed message. Possibly the result of an attack, so kill | 82 // Handle a malformed message. Possibly the result of an attack, so kill |
| 78 // the renderer. | 83 // the renderer. |
| 79 void HandleBadMessage(ExtensionFunction* api); | 84 void HandleBadMessage(ExtensionFunction* api); |
| 80 | 85 |
| 81 // Gets the URL for the view we're displaying. | 86 // Gets the URL for the view we're displaying. |
| 82 const GURL& url() { return url_; } | 87 const GURL& url() { return url_; } |
| 83 | 88 |
| 84 // Gets the ID for this extension. | 89 // Gets the ID for this extension. |
| 85 const std::string extension_id() { return url_.host(); } | 90 const std::string extension_id() { return url_.host(); } |
| 86 | 91 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 101 | 106 |
| 102 // AutomationExtensionFunction requires access to the RenderViewHost | 107 // AutomationExtensionFunction requires access to the RenderViewHost |
| 103 // associated with us. We make it a friend rather than exposing the | 108 // associated with us. We make it a friend rather than exposing the |
| 104 // RenderViewHost as a public method as we wouldn't want everyone to | 109 // RenderViewHost as a public method as we wouldn't want everyone to |
| 105 // start assuming a 1:1 relationship between us and RenderViewHost, | 110 // start assuming a 1:1 relationship between us and RenderViewHost, |
| 106 // whereas AutomationExtensionFunction is by necessity "tight" with us. | 111 // whereas AutomationExtensionFunction is by necessity "tight" with us. |
| 107 friend class AutomationExtensionFunction; | 112 friend class AutomationExtensionFunction; |
| 108 }; | 113 }; |
| 109 | 114 |
| 110 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_FUNCTION_DISPATCHER_H_ | 115 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_FUNCTION_DISPATCHER_H_ |
| OLD | NEW |