| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "remoting/host/host_extension_session_manager.h" | 5 #include "remoting/host/host_extension_session_manager.h" |
| 6 | 6 |
| 7 #include "remoting/base/capabilities.h" | 7 #include "remoting/base/capabilities.h" |
| 8 #include "remoting/codec/video_encoder.h" | 8 #include "remoting/codec/video_encoder.h" |
| 9 #include "remoting/host/client_session_control.h" | 9 #include "remoting/host/client_session_control.h" |
| 10 #include "remoting/host/host_extension.h" | 10 #include "remoting/host/host_extension.h" |
| 11 #include "remoting/host/host_extension_session.h" | 11 #include "remoting/host/host_extension_session.h" |
| 12 #include "third_party/webrtc/modules/desktop_capture/desktop_capturer.h" | 12 #include "third_party/webrtc/modules/desktop_capture/desktop_capturer.h" |
| 13 | 13 |
| 14 namespace remoting { | 14 namespace remoting { |
| 15 | 15 |
| 16 HostExtensionSessionManager::HostExtensionSessionManager( | 16 HostExtensionSessionManager::HostExtensionSessionManager( |
| 17 const std::vector<HostExtension*>& extensions, | 17 const std::vector<HostExtension*>& extensions, |
| 18 ClientSessionControl* client_session_control) | 18 ClientSessionControl* client_session_control, |
| 19 ClientSessionDetails* client_session_details) |
| 19 : client_session_control_(client_session_control), | 20 : client_session_control_(client_session_control), |
| 21 client_session_details_(client_session_details), |
| 20 client_stub_(nullptr), | 22 client_stub_(nullptr), |
| 21 extensions_(extensions) {} | 23 extensions_(extensions) {} |
| 22 | 24 |
| 23 HostExtensionSessionManager::~HostExtensionSessionManager() {} | 25 HostExtensionSessionManager::~HostExtensionSessionManager() {} |
| 24 | 26 |
| 25 std::string HostExtensionSessionManager::GetCapabilities() const { | 27 std::string HostExtensionSessionManager::GetCapabilities() const { |
| 26 std::string capabilities; | 28 std::string capabilities; |
| 27 for (HostExtensions::const_iterator extension = extensions_.begin(); | 29 for (HostExtensions::const_iterator extension = extensions_.begin(); |
| 28 extension != extensions_.end(); ++extension) { | 30 extension != extensions_.end(); ++extension) { |
| 29 const std::string& capability = (*extension)->capability(); | 31 const std::string& capability = (*extension)->capability(); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 50 extension != extensions_.end(); ++extension) { | 52 extension != extensions_.end(); ++extension) { |
| 51 // If the extension requires a capability that was not negotiated then do | 53 // If the extension requires a capability that was not negotiated then do |
| 52 // not instantiate it. | 54 // not instantiate it. |
| 53 if (!(*extension)->capability().empty() && | 55 if (!(*extension)->capability().empty() && |
| 54 !HasCapability(capabilities, (*extension)->capability())) { | 56 !HasCapability(capabilities, (*extension)->capability())) { |
| 55 continue; | 57 continue; |
| 56 } | 58 } |
| 57 | 59 |
| 58 std::unique_ptr<HostExtensionSession> extension_session = | 60 std::unique_ptr<HostExtensionSession> extension_session = |
| 59 (*extension) | 61 (*extension) |
| 60 ->CreateExtensionSession(client_session_control_, client_stub_); | 62 ->CreateExtensionSession(client_session_control_, |
| 63 client_session_details_, client_stub_); |
| 61 DCHECK(extension_session); | 64 DCHECK(extension_session); |
| 62 | 65 |
| 63 extension_sessions_.push_back(extension_session.release()); | 66 extension_sessions_.push_back(extension_session.release()); |
| 64 } | 67 } |
| 65 } | 68 } |
| 66 | 69 |
| 67 bool HostExtensionSessionManager::OnExtensionMessage( | 70 bool HostExtensionSessionManager::OnExtensionMessage( |
| 68 const protocol::ExtensionMessage& message) { | 71 const protocol::ExtensionMessage& message) { |
| 69 for(HostExtensionSessions::const_iterator it = extension_sessions_.begin(); | 72 for(HostExtensionSessions::const_iterator it = extension_sessions_.begin(); |
| 70 it != extension_sessions_.end(); ++it) { | 73 it != extension_sessions_.end(); ++it) { |
| 71 if ((*it)->OnExtensionMessage(client_session_control_, client_stub_, | 74 if ((*it)->OnExtensionMessage(client_session_control_, client_stub_, |
| 72 message)) { | 75 message)) { |
| 73 return true; | 76 return true; |
| 74 } | 77 } |
| 75 } | 78 } |
| 76 return false; | 79 return false; |
| 77 } | 80 } |
| 78 | 81 |
| 79 } // namespace remoting | 82 } // namespace remoting |
| OLD | NEW |