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 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 IPC_BEGIN_MESSAGE_MAP(AppBindings, message) | 200 IPC_BEGIN_MESSAGE_MAP(AppBindings, message) |
201 IPC_MESSAGE_HANDLER(ExtensionMsg_GetAppInstallStateResponse, | 201 IPC_MESSAGE_HANDLER(ExtensionMsg_GetAppInstallStateResponse, |
202 OnAppInstallStateResponse) | 202 OnAppInstallStateResponse) |
203 IPC_MESSAGE_UNHANDLED(CHECK(false) << "Unhandled IPC message") | 203 IPC_MESSAGE_UNHANDLED(CHECK(false) << "Unhandled IPC message") |
204 IPC_END_MESSAGE_MAP() | 204 IPC_END_MESSAGE_MAP() |
205 return true; | 205 return true; |
206 } | 206 } |
207 | 207 |
208 void AppBindings::OnAppInstallStateResponse( | 208 void AppBindings::OnAppInstallStateResponse( |
209 const std::string& state, int callback_id) { | 209 const std::string& state, int callback_id) { |
210 v8::HandleScope handle_scope; | 210 v8::HandleScope handle_scope(context()->isolate()); |
211 v8::Context::Scope context_scope(context()->v8_context()); | 211 v8::Context::Scope context_scope(context()->v8_context()); |
212 v8::Handle<v8::Value> argv[] = { | 212 v8::Handle<v8::Value> argv[] = { |
213 v8::String::New(state.c_str()), | 213 v8::String::New(state.c_str()), |
214 v8::Integer::New(callback_id) | 214 v8::Integer::New(callback_id) |
215 }; | 215 }; |
216 context()->module_system()->CallModuleMethod( | 216 context()->module_system()->CallModuleMethod( |
217 "app", "onInstallStateResponse", arraysize(argv), argv); | 217 "app", "onInstallStateResponse", arraysize(argv), argv); |
218 } | 218 } |
219 | 219 |
220 } // namespace extensions | 220 } // namespace extensions |
OLD | NEW |