| 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> |
| 8 |
| 7 #include "base/bind.h" | 9 #include "base/bind.h" |
| 8 #include "content/public/child/v8_value_converter.h" | 10 #include "content/public/child/v8_value_converter.h" |
| 9 #include "extensions/renderer/script_context.h" | 11 #include "extensions/renderer/script_context.h" |
| 10 #include "third_party/WebKit/public/platform/WebMediaStream.h" | 12 #include "third_party/WebKit/public/platform/WebMediaStream.h" |
| 11 #include "third_party/WebKit/public/platform/WebMediaStreamTrack.h" | 13 #include "third_party/WebKit/public/platform/WebMediaStreamTrack.h" |
| 12 #include "third_party/WebKit/public/web/WebDOMMediaStreamTrack.h" | 14 #include "third_party/WebKit/public/web/WebDOMMediaStreamTrack.h" |
| 13 #include "v8/include/v8.h" | 15 #include "v8/include/v8.h" |
| 14 | 16 |
| 15 namespace extensions { | 17 namespace extensions { |
| 16 | 18 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 43 weak_factory_.InvalidateWeakPtrs(); | 45 weak_factory_.InvalidateWeakPtrs(); |
| 44 ObjectBackedNativeHandler::Invalidate(); | 46 ObjectBackedNativeHandler::Invalidate(); |
| 45 } | 47 } |
| 46 | 48 |
| 47 namespace { | 49 namespace { |
| 48 | 50 |
| 49 v8::Local<v8::Value> GetChildValue(v8::Local<v8::Object> value, | 51 v8::Local<v8::Value> GetChildValue(v8::Local<v8::Object> value, |
| 50 const std::string& key_name, | 52 const std::string& key_name, |
| 51 v8::Isolate* isolate) { | 53 v8::Isolate* isolate) { |
| 52 v8::Local<v8::Array> property_names(value->GetOwnPropertyNames()); | 54 v8::Local<v8::Array> property_names(value->GetOwnPropertyNames()); |
| 53 for (uint32 i = 0; i < property_names->Length(); ++i) { | 55 for (uint32_t i = 0; i < property_names->Length(); ++i) { |
| 54 v8::Local<v8::Value> key(property_names->Get(i)); | 56 v8::Local<v8::Value> key(property_names->Get(i)); |
| 55 if (key_name == *v8::String::Utf8Value(key)) { | 57 if (key_name == *v8::String::Utf8Value(key)) { |
| 56 v8::TryCatch try_catch(isolate); | 58 v8::TryCatch try_catch(isolate); |
| 57 v8::Local<v8::Value> child_v8 = value->Get(key); | 59 v8::Local<v8::Value> child_v8 = value->Get(key); |
| 58 if (try_catch.HasCaught()) { | 60 if (try_catch.HasCaught()) { |
| 59 return v8::Null(isolate); | 61 return v8::Null(isolate); |
| 60 } | 62 } |
| 61 return child_v8; | 63 return child_v8; |
| 62 } | 64 } |
| 63 } | 65 } |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 CHECK(session); | 251 CHECK(session); |
| 250 if (session->state() == DisplaySourceSession::Establishing) { | 252 if (session->state() == DisplaySourceSession::Establishing) { |
| 251 // Error has occured before the session has actually started. | 253 // Error has occured before the session has actually started. |
| 252 session_map_.erase(sink_id); | 254 session_map_.erase(sink_id); |
| 253 } | 255 } |
| 254 | 256 |
| 255 DispatchSessionError(sink_id, type, message); | 257 DispatchSessionError(sink_id, type, message); |
| 256 } | 258 } |
| 257 | 259 |
| 258 } // extensions | 260 } // extensions |
| OLD | NEW |