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