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 | |
184 private: | 181 private: |
185 class Runner; | 182 class Runner; |
186 | 183 |
187 // Whether this context is valid. | 184 // Whether this context is valid. |
188 bool is_valid_; | 185 bool is_valid_; |
189 | 186 |
190 // The v8 context the bindings are accessible to. | 187 // The v8 context the bindings are accessible to. |
191 v8::Global<v8::Context> v8_context_; | 188 v8::Global<v8::Context> v8_context_; |
192 | 189 |
193 // The WebLocalFrame associated with this context. This can be NULL because | 190 // The WebLocalFrame associated with this context. This can be NULL because |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 GURL url_; | 224 GURL url_; |
228 | 225 |
229 scoped_ptr<Runner> runner_; | 226 scoped_ptr<Runner> runner_; |
230 | 227 |
231 DISALLOW_COPY_AND_ASSIGN(ScriptContext); | 228 DISALLOW_COPY_AND_ASSIGN(ScriptContext); |
232 }; | 229 }; |
233 | 230 |
234 } // namespace extensions | 231 } // namespace extensions |
235 | 232 |
236 #endif // EXTENSIONS_RENDERER_SCRIPT_CONTEXT_H_ | 233 #endif // EXTENSIONS_RENDERER_SCRIPT_CONTEXT_H_ |
OLD | NEW |