| 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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 console::Error(args.GetIsolate()->GetCallingContext(), |
| 116 "Could not find frame for specified object."); | 116 "Could not find frame for specified object."); |
| 117 return; | 117 return; |
| 118 } | 118 } |
| 119 | 119 |
| 120 args.GetReturnValue().Set(GetDetailsForFrameImpl(target_frame)); | 120 args.GetReturnValue().Set(GetDetailsForFrameImpl(target_frame)); |
| 121 } | 121 } |
| 122 | 122 |
| 123 v8::Handle<v8::Value> AppBindings::GetDetailsForFrameImpl( | 123 v8::Local<v8::Value> AppBindings::GetDetailsForFrameImpl( |
| 124 WebFrame* frame) { | 124 WebFrame* frame) { |
| 125 v8::Isolate* isolate = frame->mainWorldScriptContext()->GetIsolate(); | 125 v8::Isolate* isolate = frame->mainWorldScriptContext()->GetIsolate(); |
| 126 if (frame->document().securityOrigin().isUnique()) | 126 if (frame->document().securityOrigin().isUnique()) |
| 127 return v8::Null(isolate); | 127 return v8::Null(isolate); |
| 128 | 128 |
| 129 const Extension* extension = | 129 const Extension* extension = |
| 130 dispatcher_->extensions()->GetExtensionOrAppByURL( | 130 dispatcher_->extensions()->GetExtensionOrAppByURL( |
| 131 frame->document().url()); | 131 frame->document().url()); |
| 132 | 132 |
| 133 if (!extension) | 133 if (!extension) |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 IPC_MESSAGE_UNHANDLED(CHECK(false) << "Unhandled IPC message") | 209 IPC_MESSAGE_UNHANDLED(CHECK(false) << "Unhandled IPC message") |
| 210 IPC_END_MESSAGE_MAP() | 210 IPC_END_MESSAGE_MAP() |
| 211 return true; | 211 return true; |
| 212 } | 212 } |
| 213 | 213 |
| 214 void AppBindings::OnAppInstallStateResponse( | 214 void AppBindings::OnAppInstallStateResponse( |
| 215 const std::string& state, int callback_id) { | 215 const std::string& state, int callback_id) { |
| 216 v8::Isolate* isolate = context()->isolate(); | 216 v8::Isolate* isolate = context()->isolate(); |
| 217 v8::HandleScope handle_scope(isolate); | 217 v8::HandleScope handle_scope(isolate); |
| 218 v8::Context::Scope context_scope(context()->v8_context()); | 218 v8::Context::Scope context_scope(context()->v8_context()); |
| 219 v8::Handle<v8::Value> argv[] = { | 219 v8::Local<v8::Value> argv[] = { |
| 220 v8::String::NewFromUtf8(isolate, state.c_str()), | 220 v8::String::NewFromUtf8(isolate, state.c_str()), |
| 221 v8::Integer::New(isolate, callback_id) | 221 v8::Integer::New(isolate, callback_id) |
| 222 }; | 222 }; |
| 223 context()->module_system()->CallModuleMethod( | 223 context()->module_system()->CallModuleMethod( |
| 224 "app", "onInstallStateResponse", arraysize(argv), argv); | 224 "app", "onInstallStateResponse", arraysize(argv), argv); |
| 225 } | 225 } |
| 226 | 226 |
| 227 } // namespace extensions | 227 } // namespace extensions |
| OLD | NEW |