| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/renderer/extensions/app_bindings.h" | 5 #include "chrome/renderer/extensions/app_bindings.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/strings/string16.h" | 8 #include "base/strings/string16.h" |
| 9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 context()->isolate(), "Argument 0 must be an object.")); | 105 context()->isolate(), "Argument 0 must be an object.")); |
| 106 return; | 106 return; |
| 107 } | 107 } |
| 108 | 108 |
| 109 v8::Local<v8::Context> context = | 109 v8::Local<v8::Context> context = |
| 110 v8::Local<v8::Object>::Cast(args[0])->CreationContext(); | 110 v8::Local<v8::Object>::Cast(args[0])->CreationContext(); |
| 111 CHECK(!context.IsEmpty()); | 111 CHECK(!context.IsEmpty()); |
| 112 | 112 |
| 113 WebLocalFrame* target_frame = WebLocalFrame::frameForContext(context); | 113 WebLocalFrame* target_frame = WebLocalFrame::frameForContext(context); |
| 114 if (!target_frame) { | 114 if (!target_frame) { |
| 115 console::Error(args.GetIsolate()->GetCallingContext(), | 115 ScriptContext* script_context = ScriptContextSet::GetContextByV8Context( |
| 116 args.GetIsolate()->GetCallingContext()); |
| 117 console::Error(script_context ? script_context->GetRenderFrame() : nullptr, |
| 116 "Could not find frame for specified object."); | 118 "Could not find frame for specified object."); |
| 117 return; | 119 return; |
| 118 } | 120 } |
| 119 | 121 |
| 120 args.GetReturnValue().Set(GetDetailsForFrameImpl(target_frame)); | 122 args.GetReturnValue().Set(GetDetailsForFrameImpl(target_frame)); |
| 121 } | 123 } |
| 122 | 124 |
| 123 v8::Local<v8::Value> AppBindings::GetDetailsForFrameImpl( | 125 v8::Local<v8::Value> AppBindings::GetDetailsForFrameImpl( |
| 124 WebFrame* frame) { | 126 WebFrame* frame) { |
| 125 v8::Isolate* isolate = frame->mainWorldScriptContext()->GetIsolate(); | 127 v8::Isolate* isolate = frame->mainWorldScriptContext()->GetIsolate(); |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 v8::Context::Scope context_scope(context()->v8_context()); | 220 v8::Context::Scope context_scope(context()->v8_context()); |
| 219 v8::Local<v8::Value> argv[] = { | 221 v8::Local<v8::Value> argv[] = { |
| 220 v8::String::NewFromUtf8(isolate, state.c_str()), | 222 v8::String::NewFromUtf8(isolate, state.c_str()), |
| 221 v8::Integer::New(isolate, callback_id) | 223 v8::Integer::New(isolate, callback_id) |
| 222 }; | 224 }; |
| 223 context()->module_system()->CallModuleMethod( | 225 context()->module_system()->CallModuleMethod( |
| 224 "app", "onInstallStateResponse", arraysize(argv), argv); | 226 "app", "onInstallStateResponse", arraysize(argv), argv); |
| 225 } | 227 } |
| 226 | 228 |
| 227 } // namespace extensions | 229 } // namespace extensions |
| OLD | NEW |