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_RENDERER_EXTENSIONS_CHROME_V8_EXTENSION_H_ | 5 #ifndef CHROME_RENDERER_EXTENSIONS_CHROME_V8_EXTENSION_H_ |
6 #define CHROME_RENDERER_EXTENSIONS_CHROME_V8_EXTENSION_H_ | 6 #define CHROME_RENDERER_EXTENSIONS_CHROME_V8_EXTENSION_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/memory/linked_ptr.h" | 10 #include "base/memory/linked_ptr.h" |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 static content::RenderView* GetCurrentRenderView(); | 73 static content::RenderView* GetCurrentRenderView(); |
74 | 74 |
75 // Note: do not call this function before or during the chromeHidden.onLoad | 75 // Note: do not call this function before or during the chromeHidden.onLoad |
76 // event dispatch. The URL might not have been committed yet and might not | 76 // event dispatch. The URL might not have been committed yet and might not |
77 // be an extension URL. | 77 // be an extension URL. |
78 const ::Extension* GetExtensionForCurrentRenderView() const; | 78 const ::Extension* GetExtensionForCurrentRenderView() const; |
79 | 79 |
80 // Checks that the current context contains an extension that has permission | 80 // Checks that the current context contains an extension that has permission |
81 // to execute the specified function. If it does not, a v8 exception is thrown | 81 // to execute the specified function. If it does not, a v8 exception is thrown |
82 // and the method returns false. Otherwise returns true. | 82 // and the method returns false. Otherwise returns true. |
83 bool CheckPermissionForCurrentRenderView( | 83 bool CheckCurrentContextAccessToExtensionAPI( |
84 const std::string& function_name) const; | 84 const std::string& function_name) const; |
85 | 85 |
86 // Create a handler for |context|. If a subclass of ChromeV8Extension wishes | 86 // Create a handler for |context|. If a subclass of ChromeV8Extension wishes |
87 // to support handlers, it should override this. | 87 // to support handlers, it should override this. |
88 virtual ChromeV8ExtensionHandler* CreateHandler(ChromeV8Context* context); | 88 virtual ChromeV8ExtensionHandler* CreateHandler(ChromeV8Context* context); |
89 | 89 |
90 // Returns the chromeHidden object for the current context. | 90 // Returns the chromeHidden object for the current context. |
91 static v8::Handle<v8::Value> GetChromeHidden(const v8::Arguments& args); | 91 static v8::Handle<v8::Value> GetChromeHidden(const v8::Arguments& args); |
92 | 92 |
93 ExtensionDispatcher* extension_dispatcher_; | 93 ExtensionDispatcher* extension_dispatcher_; |
(...skipping 12 matching lines...) Expand all Loading... |
106 | 106 |
107 // Map of all current handlers. | 107 // Map of all current handlers. |
108 typedef std::map<ChromeV8Context*, | 108 typedef std::map<ChromeV8Context*, |
109 linked_ptr<ChromeV8ExtensionHandler> > HandlerMap; | 109 linked_ptr<ChromeV8ExtensionHandler> > HandlerMap; |
110 HandlerMap handlers_; | 110 HandlerMap handlers_; |
111 | 111 |
112 DISALLOW_COPY_AND_ASSIGN(ChromeV8Extension); | 112 DISALLOW_COPY_AND_ASSIGN(ChromeV8Extension); |
113 }; | 113 }; |
114 | 114 |
115 #endif // CHROME_RENDERER_EXTENSIONS_CHROME_V8_EXTENSION_H_ | 115 #endif // CHROME_RENDERER_EXTENSIONS_CHROME_V8_EXTENSION_H_ |
OLD | NEW |