| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 EXTENSIONS_RENDERER_SCRIPT_CONTEXT_H_ | 5 #ifndef EXTENSIONS_RENDERER_SCRIPT_CONTEXT_H_ |
| 6 #define EXTENSIONS_RENDERER_SCRIPT_CONTEXT_H_ | 6 #define EXTENSIONS_RENDERER_SCRIPT_CONTEXT_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 const SafeBuiltins* safe_builtins() const { return &safe_builtins_; } | 101 const SafeBuiltins* safe_builtins() const { return &safe_builtins_; } |
| 102 | 102 |
| 103 // Returns the ID of the extension associated with this context, or empty | 103 // Returns the ID of the extension associated with this context, or empty |
| 104 // string if there is no such extension. | 104 // string if there is no such extension. |
| 105 const std::string& GetExtensionID() const; | 105 const std::string& GetExtensionID() const; |
| 106 | 106 |
| 107 // Returns the RenderFrame associated with this context. Can return NULL if | 107 // Returns the RenderFrame associated with this context. Can return NULL if |
| 108 // the context is in the process of being destroyed. | 108 // the context is in the process of being destroyed. |
| 109 content::RenderFrame* GetRenderFrame() const; | 109 content::RenderFrame* GetRenderFrame() const; |
| 110 | 110 |
| 111 // Runs |function| with appropriate scopes. Doesn't catch exceptions, callers | 111 // DEPRECATED. |
| 112 // must do that if they want. | |
| 113 // | |
| 114 // USE THIS METHOD RATHER THAN v8::Function::Call WHEREVER POSSIBLE. | |
| 115 v8::Local<v8::Value> CallFunction(const v8::Local<v8::Function>& function, | 112 v8::Local<v8::Value> CallFunction(const v8::Local<v8::Function>& function, |
| 116 int argc, | 113 int argc, |
| 117 v8::Local<v8::Value> argv[]) const; | 114 v8::Local<v8::Value> argv[]) const; |
| 118 v8::Local<v8::Value> CallFunction( | |
| 119 const v8::Local<v8::Function>& function) const; | |
| 120 | 115 |
| 121 // Safely calls the v8::Function, respecting the page load deferrer and | 116 // Safely calls the v8::Function, respecting the page load deferrer and |
| 122 // possibly executing asynchronously. | 117 // possibly executing asynchronously. |
| 118 // Doesn't catch exceptions; callers must do that if they want. |
| 119 // USE THIS METHOD RATHER THAN v8::Function::Call WHEREVER POSSIBLE. |
| 123 // TODO(devlin): Remove the above variants in favor of this. | 120 // TODO(devlin): Remove the above variants in favor of this. |
| 124 void SafeCallFunction(const v8::Local<v8::Function>& function, | 121 void SafeCallFunction(const v8::Local<v8::Function>& function, |
| 125 int argc, | 122 int argc, |
| 126 v8::Local<v8::Value> argv[]); | 123 v8::Local<v8::Value> argv[]); |
| 127 | 124 |
| 128 void DispatchEvent(const char* event_name, v8::Local<v8::Array> args) const; | 125 void DispatchEvent(const char* event_name, v8::Local<v8::Array> args) const; |
| 129 | 126 |
| 130 // Returns the availability of the API |api_name|. | 127 // Returns the availability of the API |api_name|. |
| 131 Feature::Availability GetAvailability(const std::string& api_name); | 128 Feature::Availability GetAvailability(const std::string& api_name); |
| 132 | 129 |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 std::unique_ptr<Runner> runner_; | 262 std::unique_ptr<Runner> runner_; |
| 266 | 263 |
| 267 base::ThreadChecker thread_checker_; | 264 base::ThreadChecker thread_checker_; |
| 268 | 265 |
| 269 DISALLOW_COPY_AND_ASSIGN(ScriptContext); | 266 DISALLOW_COPY_AND_ASSIGN(ScriptContext); |
| 270 }; | 267 }; |
| 271 | 268 |
| 272 } // namespace extensions | 269 } // namespace extensions |
| 273 | 270 |
| 274 #endif // EXTENSIONS_RENDERER_SCRIPT_CONTEXT_H_ | 271 #endif // EXTENSIONS_RENDERER_SCRIPT_CONTEXT_H_ |
| OLD | NEW |