| 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 #include "extensions/renderer/script_context.h" | 5 #include "extensions/renderer/script_context.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/strings/string_split.h" | 10 #include "base/strings/string_split.h" |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 gin_data->set_runner(runner_.get()); | 114 gin_data->set_runner(runner_.get()); |
| 115 if (web_frame_) | 115 if (web_frame_) |
| 116 url_ = GetAccessCheckedFrameURL(web_frame_); | 116 url_ = GetAccessCheckedFrameURL(web_frame_); |
| 117 } | 117 } |
| 118 | 118 |
| 119 ScriptContext::~ScriptContext() { | 119 ScriptContext::~ScriptContext() { |
| 120 VLOG(1) << "Destroyed context for extension\n" | 120 VLOG(1) << "Destroyed context for extension\n" |
| 121 << " extension id: " << GetExtensionID() << "\n" | 121 << " extension id: " << GetExtensionID() << "\n" |
| 122 << " effective extension id: " | 122 << " effective extension id: " |
| 123 << (effective_extension_.get() ? effective_extension_->id() : ""); | 123 << (effective_extension_.get() ? effective_extension_->id() : ""); |
| 124 CHECK(!is_valid_) << "ScriptContexts must be invalidated before destruction"; | 124 // ScriptContexts must be invalidated before destruction |
| 125 CHECK(!is_valid_); |
| 125 } | 126 } |
| 126 | 127 |
| 127 // static | 128 // static |
| 128 bool ScriptContext::IsSandboxedPage(const GURL& url) { | 129 bool ScriptContext::IsSandboxedPage(const GURL& url) { |
| 129 // TODO(kalman): This is checking the wrong thing. See comment in | 130 // TODO(kalman): This is checking the wrong thing. See comment in |
| 130 // HasAccessOrThrowError. | 131 // HasAccessOrThrowError. |
| 131 if (url.SchemeIs(kExtensionScheme)) { | 132 if (url.SchemeIs(kExtensionScheme)) { |
| 132 const Extension* extension = | 133 const Extension* extension = |
| 133 RendererExtensionRegistry::Get()->GetByID(url.host()); | 134 RendererExtensionRegistry::Get()->GetByID(url.host()); |
| 134 if (extension) { | 135 if (extension) { |
| (...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 519 v8::Local<v8::Value> argv[]) { | 520 v8::Local<v8::Value> argv[]) { |
| 520 return context_->CallFunction(function, argc, argv); | 521 return context_->CallFunction(function, argc, argv); |
| 521 } | 522 } |
| 522 | 523 |
| 523 gin::ContextHolder* ScriptContext::Runner::GetContextHolder() { | 524 gin::ContextHolder* ScriptContext::Runner::GetContextHolder() { |
| 524 v8::HandleScope handle_scope(context_->isolate()); | 525 v8::HandleScope handle_scope(context_->isolate()); |
| 525 return gin::PerContextData::From(context_->v8_context())->context_holder(); | 526 return gin::PerContextData::From(context_->v8_context())->context_holder(); |
| 526 } | 527 } |
| 527 | 528 |
| 528 } // namespace extensions | 529 } // namespace extensions |
| OLD | NEW |