| 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_BINDINGS_UTILS_H_ | 5 #ifndef CHROME_RENDERER_EXTENSIONS_BINDINGS_UTILS_H_ |
| 6 #define CHROME_RENDERER_EXTENSIONS_BINDINGS_UTILS_H_ | 6 #define CHROME_RENDERER_EXTENSIONS_BINDINGS_UTILS_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/memory/linked_ptr.h" | 9 #include "base/memory/linked_ptr.h" |
| 10 #include "base/memory/singleton.h" | 10 #include "base/memory/singleton.h" |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 // Checks that the current context contains an extension that has permission | 60 // Checks that the current context contains an extension that has permission |
| 61 // to execute the specified function. If it does not, a v8 exception is thrown | 61 // to execute the specified function. If it does not, a v8 exception is thrown |
| 62 // and the method returns false. Otherwise returns true. | 62 // and the method returns false. Otherwise returns true. |
| 63 bool CheckPermissionForCurrentContext(const std::string& function_name) const; | 63 bool CheckPermissionForCurrentContext(const std::string& function_name) const; |
| 64 | 64 |
| 65 // Returns a hidden variable for use by the bindings that is unreachable | 65 // Returns a hidden variable for use by the bindings that is unreachable |
| 66 // by the page. | 66 // by the page. |
| 67 static v8::Handle<v8::Value> GetChromeHidden(const v8::Arguments& args); | 67 static v8::Handle<v8::Value> GetChromeHidden(const v8::Arguments& args); |
| 68 | 68 |
| 69 ExtensionDispatcher* extension_dispatcher_; | 69 ExtensionDispatcher* extension_dispatcher_; |
| 70 |
| 71 private: |
| 72 // Helper to print from bindings javascript. |
| 73 static v8::Handle<v8::Value> Print(const v8::Arguments& args); |
| 70 }; | 74 }; |
| 71 | 75 |
| 72 const char* GetStringResource(int resource_id); | 76 const char* GetStringResource(int resource_id); |
| 73 | 77 |
| 74 // Contains information about a single javascript context. | 78 // Contains information about a single javascript context. |
| 75 struct ContextInfo { | 79 struct ContextInfo { |
| 76 ContextInfo(v8::Persistent<v8::Context> context, | 80 ContextInfo(v8::Persistent<v8::Context> context, |
| 77 const std::string& extension_id, | 81 const std::string& extension_id, |
| 78 WebKit::WebFrame* parent_frame, | 82 WebKit::WebFrame* parent_frame, |
| 79 RenderView* render_view); | 83 RenderView* render_view); |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 // be a sub-property like "Port.dispatchOnMessage". Returns the result of | 137 // be a sub-property like "Port.dispatchOnMessage". Returns the result of |
| 134 // the function call. If an exception is thrown an empty Handle will be | 138 // the function call. If an exception is thrown an empty Handle will be |
| 135 // returned. | 139 // returned. |
| 136 v8::Handle<v8::Value> CallFunctionInContext(v8::Handle<v8::Context> context, | 140 v8::Handle<v8::Value> CallFunctionInContext(v8::Handle<v8::Context> context, |
| 137 const std::string& function_name, int argc, | 141 const std::string& function_name, int argc, |
| 138 v8::Handle<v8::Value>* argv); | 142 v8::Handle<v8::Value>* argv); |
| 139 | 143 |
| 140 } // namespace bindings_utils | 144 } // namespace bindings_utils |
| 141 | 145 |
| 142 #endif // CHROME_RENDERER_EXTENSIONS_BINDINGS_UTILS_H_ | 146 #endif // CHROME_RENDERER_EXTENSIONS_BINDINGS_UTILS_H_ |
| OLD | NEW |