| 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/v8_context_native_handler.h" | 5 #include "extensions/renderer/v8_context_native_handler.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "extensions/common/features/feature.h" | 8 #include "extensions/common/features/feature.h" |
| 9 #include "extensions/renderer/script_context.h" | 9 #include "extensions/renderer/script_context.h" |
| 10 #include "extensions/renderer/script_context_set.h" | 10 #include "extensions/renderer/script_context_set.h" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 v8::Integer::New(isolate, availability.result())); | 41 v8::Integer::New(isolate, availability.result())); |
| 42 args.GetReturnValue().Set(ret); | 42 args.GetReturnValue().Set(ret); |
| 43 } | 43 } |
| 44 | 44 |
| 45 void V8ContextNativeHandler::GetModuleSystem( | 45 void V8ContextNativeHandler::GetModuleSystem( |
| 46 const v8::FunctionCallbackInfo<v8::Value>& args) { | 46 const v8::FunctionCallbackInfo<v8::Value>& args) { |
| 47 CHECK_EQ(args.Length(), 1); | 47 CHECK_EQ(args.Length(), 1); |
| 48 CHECK(args[0]->IsObject()); | 48 CHECK(args[0]->IsObject()); |
| 49 ScriptContext* context = ScriptContextSet::GetContextByObject( | 49 ScriptContext* context = ScriptContextSet::GetContextByObject( |
| 50 v8::Local<v8::Object>::Cast(args[0])); | 50 v8::Local<v8::Object>::Cast(args[0])); |
| 51 if (blink::WebFrame::scriptCanAccess(context->web_frame())) | 51 if (context && blink::WebFrame::scriptCanAccess(context->web_frame())) |
| 52 args.GetReturnValue().Set(context->module_system()->NewInstance()); | 52 args.GetReturnValue().Set(context->module_system()->NewInstance()); |
| 53 } | 53 } |
| 54 | 54 |
| 55 } // namespace extensions | 55 } // namespace extensions |
| OLD | NEW |