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