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 <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 bool HasAPIPermission(APIPermission::ID permission) const; | 176 bool HasAPIPermission(APIPermission::ID permission) const; |
177 | 177 |
178 // Throws an Error in this context's JavaScript context, if this context does | 178 // Throws an Error in this context's JavaScript context, if this context does |
179 // not have access to |name|. Returns true if this context has access (i.e. | 179 // not have access to |name|. Returns true if this context has access (i.e. |
180 // no exception thrown), false if it does not (i.e. an exception was thrown). | 180 // no exception thrown), false if it does not (i.e. an exception was thrown). |
181 bool HasAccessOrThrowError(const std::string& name); | 181 bool HasAccessOrThrowError(const std::string& name); |
182 | 182 |
183 // Returns a string representation of this ScriptContext, for debugging. | 183 // Returns a string representation of this ScriptContext, for debugging. |
184 std::string GetDebugString() const; | 184 std::string GetDebugString() const; |
185 | 185 |
| 186 // Gets the current stack trace as a multi-line string to be logged. |
| 187 std::string GetStackTraceAsString() const; |
| 188 |
186 private: | 189 private: |
187 class Runner; | 190 class Runner; |
188 | 191 |
189 // Whether this context is valid. | 192 // Whether this context is valid. |
190 bool is_valid_; | 193 bool is_valid_; |
191 | 194 |
192 // The v8 context the bindings are accessible to. | 195 // The v8 context the bindings are accessible to. |
193 v8::Global<v8::Context> v8_context_; | 196 v8::Global<v8::Context> v8_context_; |
194 | 197 |
195 // The WebLocalFrame associated with this context. This can be NULL because | 198 // The WebLocalFrame associated with this context. This can be NULL because |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 GURL url_; | 232 GURL url_; |
230 | 233 |
231 scoped_ptr<Runner> runner_; | 234 scoped_ptr<Runner> runner_; |
232 | 235 |
233 DISALLOW_COPY_AND_ASSIGN(ScriptContext); | 236 DISALLOW_COPY_AND_ASSIGN(ScriptContext); |
234 }; | 237 }; |
235 | 238 |
236 } // namespace extensions | 239 } // namespace extensions |
237 | 240 |
238 #endif // EXTENSIONS_RENDERER_SCRIPT_CONTEXT_H_ | 241 #endif // EXTENSIONS_RENDERER_SCRIPT_CONTEXT_H_ |
OLD | NEW |