| 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/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/strings/string16.h" | 9 #include "base/strings/string16.h" |
| 10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 IPC_BEGIN_MESSAGE_MAP(AppBindings, message) | 155 IPC_BEGIN_MESSAGE_MAP(AppBindings, message) |
| 156 IPC_MESSAGE_HANDLER(ExtensionMsg_GetAppInstallStateResponse, | 156 IPC_MESSAGE_HANDLER(ExtensionMsg_GetAppInstallStateResponse, |
| 157 OnAppInstallStateResponse) | 157 OnAppInstallStateResponse) |
| 158 IPC_MESSAGE_UNHANDLED(CHECK(false) << "Unhandled IPC message") | 158 IPC_MESSAGE_UNHANDLED(CHECK(false) << "Unhandled IPC message") |
| 159 IPC_END_MESSAGE_MAP() | 159 IPC_END_MESSAGE_MAP() |
| 160 return true; | 160 return true; |
| 161 } | 161 } |
| 162 | 162 |
| 163 void AppBindings::OnAppInstallStateResponse( | 163 void AppBindings::OnAppInstallStateResponse( |
| 164 const std::string& state, int callback_id) { | 164 const std::string& state, int callback_id) { |
| 165 if (!is_valid()) |
| 166 return; |
| 167 |
| 165 v8::Isolate* isolate = context()->isolate(); | 168 v8::Isolate* isolate = context()->isolate(); |
| 166 v8::HandleScope handle_scope(isolate); | 169 v8::HandleScope handle_scope(isolate); |
| 167 v8::Context::Scope context_scope(context()->v8_context()); | 170 v8::Context::Scope context_scope(context()->v8_context()); |
| 168 v8::Local<v8::Value> argv[] = { | 171 v8::Local<v8::Value> argv[] = { |
| 169 v8::String::NewFromUtf8(isolate, state.c_str()), | 172 v8::String::NewFromUtf8(isolate, state.c_str()), |
| 170 v8::Integer::New(isolate, callback_id) | 173 v8::Integer::New(isolate, callback_id) |
| 171 }; | 174 }; |
| 172 context()->module_system()->CallModuleMethod( | 175 context()->module_system()->CallModuleMethod( |
| 173 "app", "onInstallStateResponse", arraysize(argv), argv); | 176 "app", "onInstallStateResponse", arraysize(argv), argv); |
| 174 } | 177 } |
| 175 | 178 |
| 176 } // namespace extensions | 179 } // namespace extensions |
| OLD | NEW |