| 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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 // Runs |function| with appropriate scopes. Doesn't catch exceptions, callers | 111 // Runs |function| with appropriate scopes. Doesn't catch exceptions, callers |
| 112 // must do that if they want. | 112 // must do that if they want. |
| 113 // | 113 // |
| 114 // USE THIS METHOD RATHER THAN v8::Function::Call WHEREVER POSSIBLE. | 114 // USE THIS METHOD RATHER THAN v8::Function::Call WHEREVER POSSIBLE. |
| 115 v8::Local<v8::Value> CallFunction(const v8::Local<v8::Function>& function, | 115 v8::Local<v8::Value> CallFunction(const v8::Local<v8::Function>& function, |
| 116 int argc, | 116 int argc, |
| 117 v8::Local<v8::Value> argv[]) const; | 117 v8::Local<v8::Value> argv[]) const; |
| 118 v8::Local<v8::Value> CallFunction( | 118 v8::Local<v8::Value> CallFunction( |
| 119 const v8::Local<v8::Function>& function) const; | 119 const v8::Local<v8::Function>& function) const; |
| 120 | 120 |
| 121 // Safely calls the v8::Function, respecting the page load deferrer and |
| 122 // possibly executing asynchronously. |
| 123 // TODO(devlin): Remove the above variants in favor of this. |
| 124 void SafeCallFunction(const v8::Local<v8::Function>& function, |
| 125 int argc, |
| 126 v8::Local<v8::Value> argv[]); |
| 127 |
| 121 void DispatchEvent(const char* event_name, v8::Local<v8::Array> args) const; | 128 void DispatchEvent(const char* event_name, v8::Local<v8::Array> args) const; |
| 122 | 129 |
| 123 // Returns the availability of the API |api_name|. | 130 // Returns the availability of the API |api_name|. |
| 124 Feature::Availability GetAvailability(const std::string& api_name); | 131 Feature::Availability GetAvailability(const std::string& api_name); |
| 125 | 132 |
| 126 // Returns a string description of the type of context this is. | 133 // Returns a string description of the type of context this is. |
| 127 std::string GetContextTypeDescription() const; | 134 std::string GetContextTypeDescription() const; |
| 128 | 135 |
| 129 // Returns a string description of the effective type of context this is. | 136 // Returns a string description of the effective type of context this is. |
| 130 std::string GetEffectiveContextTypeDescription() const; | 137 std::string GetEffectiveContextTypeDescription() const; |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 std::unique_ptr<Runner> runner_; | 265 std::unique_ptr<Runner> runner_; |
| 259 | 266 |
| 260 base::ThreadChecker thread_checker_; | 267 base::ThreadChecker thread_checker_; |
| 261 | 268 |
| 262 DISALLOW_COPY_AND_ASSIGN(ScriptContext); | 269 DISALLOW_COPY_AND_ASSIGN(ScriptContext); |
| 263 }; | 270 }; |
| 264 | 271 |
| 265 } // namespace extensions | 272 } // namespace extensions |
| 266 | 273 |
| 267 #endif // EXTENSIONS_RENDERER_SCRIPT_CONTEXT_H_ | 274 #endif // EXTENSIONS_RENDERER_SCRIPT_CONTEXT_H_ |
| OLD | NEW |