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 11 matching lines...) Expand all Loading... |
22 const char kErrorNotSupported[] = "Not supported"; | 22 const char kErrorNotSupported[] = "Not supported"; |
23 const char kInvalidStreamArgs[] = "Invalid stream arguments"; | 23 const char kInvalidStreamArgs[] = "Invalid stream arguments"; |
24 const char kSessionAlreadyStarted[] = "The session has been already started"; | 24 const char kSessionAlreadyStarted[] = "The session has been already started"; |
25 const char kSessionAlreadyTerminating[] = "The session is already terminating"; | 25 const char kSessionAlreadyTerminating[] = "The session is already terminating"; |
26 const char kSessionNotFound[] = "Session not found"; | 26 const char kSessionNotFound[] = "Session not found"; |
27 } // namespace | 27 } // namespace |
28 | 28 |
29 DisplaySourceCustomBindings::DisplaySourceCustomBindings(ScriptContext* context) | 29 DisplaySourceCustomBindings::DisplaySourceCustomBindings(ScriptContext* context) |
30 : ObjectBackedNativeHandler(context), | 30 : ObjectBackedNativeHandler(context), |
31 weak_factory_(this) { | 31 weak_factory_(this) { |
32 RouteFunction("StartSession", | 32 RouteFunction("StartSession", "displaySource", |
33 base::Bind(&DisplaySourceCustomBindings::StartSession, | 33 base::Bind(&DisplaySourceCustomBindings::StartSession, |
34 weak_factory_.GetWeakPtr())); | 34 weak_factory_.GetWeakPtr())); |
35 RouteFunction("TerminateSession", | 35 RouteFunction("TerminateSession", "displaySource", |
36 base::Bind(&DisplaySourceCustomBindings::TerminateSession, | 36 base::Bind(&DisplaySourceCustomBindings::TerminateSession, |
37 weak_factory_.GetWeakPtr())); | 37 weak_factory_.GetWeakPtr())); |
38 } | 38 } |
39 | 39 |
40 DisplaySourceCustomBindings::~DisplaySourceCustomBindings() { | 40 DisplaySourceCustomBindings::~DisplaySourceCustomBindings() { |
41 } | 41 } |
42 | 42 |
43 void DisplaySourceCustomBindings::Invalidate() { | 43 void DisplaySourceCustomBindings::Invalidate() { |
44 session_map_.clear(); | 44 session_map_.clear(); |
45 weak_factory_.InvalidateWeakPtrs(); | 45 weak_factory_.InvalidateWeakPtrs(); |
(...skipping 251 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 |