| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "extensions/renderer/display_source_custom_bindings.h" | 5 #include "extensions/renderer/display_source_custom_bindings.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "content/public/child/v8_value_converter.h" | 10 #include "content/public/child/v8_value_converter.h" |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 v8::HandleScope handle_scope(isolate); | 225 v8::HandleScope handle_scope(isolate); |
| 226 v8::Context::Scope context_scope(context()->v8_context()); | 226 v8::Context::Scope context_scope(context()->v8_context()); |
| 227 | 227 |
| 228 v8::Local<v8::Value> callback_args[2]; | 228 v8::Local<v8::Value> callback_args[2]; |
| 229 callback_args[0] = v8::Integer::New(isolate, call_id); | 229 callback_args[0] = v8::Integer::New(isolate, call_id); |
| 230 if (success) | 230 if (success) |
| 231 callback_args[1] = v8::Null(isolate); | 231 callback_args[1] = v8::Null(isolate); |
| 232 else | 232 else |
| 233 callback_args[1] = v8::String::NewFromUtf8(isolate, error_message.c_str()); | 233 callback_args[1] = v8::String::NewFromUtf8(isolate, error_message.c_str()); |
| 234 | 234 |
| 235 module_system->CallModuleMethod("displaySource", "callCompletionCallback", 2, | 235 module_system->CallModuleMethodSafe("displaySource", "callCompletionCallback", |
| 236 callback_args); | 236 2, callback_args); |
| 237 } | 237 } |
| 238 | 238 |
| 239 void DisplaySourceCustomBindings::OnSessionStarted( | 239 void DisplaySourceCustomBindings::OnSessionStarted( |
| 240 int sink_id, | 240 int sink_id, |
| 241 int call_id, | 241 int call_id, |
| 242 bool success, | 242 bool success, |
| 243 const std::string& error_message) { | 243 const std::string& error_message) { |
| 244 CHECK(GetDisplaySession(sink_id)); | 244 CHECK(GetDisplaySession(sink_id)); |
| 245 if (!success) { | 245 if (!success) { |
| 246 // Session has failed to start, removing it. | 246 // Session has failed to start, removing it. |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 } | 297 } |
| 298 | 298 |
| 299 void DisplaySourceCustomBindings::OnSessionError(int sink_id, | 299 void DisplaySourceCustomBindings::OnSessionError(int sink_id, |
| 300 DisplaySourceErrorType type, | 300 DisplaySourceErrorType type, |
| 301 const std::string& message) { | 301 const std::string& message) { |
| 302 CHECK(GetDisplaySession(sink_id)); | 302 CHECK(GetDisplaySession(sink_id)); |
| 303 DispatchSessionError(sink_id, type, message); | 303 DispatchSessionError(sink_id, type, message); |
| 304 } | 304 } |
| 305 | 305 |
| 306 } // extensions | 306 } // extensions |
| OLD | NEW |