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