OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 } | 47 } |
48 | 48 |
49 // Gets the render view for the current v8 context. | 49 // Gets the render view for the current v8 context. |
50 static content::RenderView* GetCurrentRenderView(); | 50 static content::RenderView* GetCurrentRenderView(); |
51 | 51 |
52 // Note: do not call this function before or during the chromeHidden.onLoad | 52 // Note: do not call this function before or during the chromeHidden.onLoad |
53 // event dispatch. The URL might not have been committed yet and might not | 53 // event dispatch. The URL might not have been committed yet and might not |
54 // be an extension URL. | 54 // be an extension URL. |
55 const ::Extension* GetExtensionForCurrentRenderView() const; | 55 const ::Extension* GetExtensionForCurrentRenderView() const; |
56 | 56 |
57 // Checks that the current context contains an extension that has permission | |
58 // to execute the specified function. If it does not, a v8 exception is thrown | |
59 // and the method returns false. Otherwise returns true. | |
60 bool CheckCurrentContextAccessToExtensionAPI( | |
61 const std::string& function_name) const; | |
62 | |
63 // Returns the chromeHidden object for the current context. | 57 // Returns the chromeHidden object for the current context. |
64 static v8::Handle<v8::Value> GetChromeHidden(const v8::Arguments& args); | 58 static v8::Handle<v8::Value> GetChromeHidden(const v8::Arguments& args); |
65 | 59 |
66 ExtensionDispatcher* extension_dispatcher_; | 60 ExtensionDispatcher* extension_dispatcher_; |
67 | 61 |
68 private: | 62 private: |
69 DISALLOW_COPY_AND_ASSIGN(ChromeV8Extension); | 63 DISALLOW_COPY_AND_ASSIGN(ChromeV8Extension); |
70 }; | 64 }; |
71 | 65 |
72 #endif // CHROME_RENDERER_EXTENSIONS_CHROME_V8_EXTENSION_H_ | 66 #endif // CHROME_RENDERER_EXTENSIONS_CHROME_V8_EXTENSION_H_ |
OLD | NEW |