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 #ifndef EXTENSIONS_RENDERER_API_DISPLAY_SOURCE_WIFI_DISPLAY_WIFI_DISPLAY_SESSION
_H_ | 5 #ifndef EXTENSIONS_RENDERER_API_DISPLAY_SOURCE_WIFI_DISPLAY_WIFI_DISPLAY_SESSION
_H_ |
6 #define EXTENSIONS_RENDERER_API_DISPLAY_SOURCE_WIFI_DISPLAY_WIFI_DISPLAY_SESSION
_H_ | 6 #define EXTENSIONS_RENDERER_API_DISPLAY_SOURCE_WIFI_DISPLAY_WIFI_DISPLAY_SESSION
_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "extensions/common/mojo/wifi_display_session_service.mojom.h" | 11 #include "extensions/common/mojo/wifi_display_session_service.mojom.h" |
12 #include "extensions/renderer/api/display_source/display_source_session.h" | 12 #include "extensions/renderer/api/display_source/display_source_session.h" |
13 #include "mojo/public/cpp/bindings/binding.h" | 13 #include "mojo/public/cpp/bindings/binding.h" |
14 #include "third_party/wds/src/libwds/public/source.h" | 14 #include "third_party/wds/src/libwds/public/source.h" |
15 | 15 |
16 namespace base { | 16 namespace base { |
17 class Timer; | 17 class Timer; |
18 } // namespace base | 18 } // namespace base |
19 | 19 |
20 namespace extensions { | 20 namespace extensions { |
21 | 21 |
22 class WiFiDisplayMediaManager; | 22 class WiFiDisplayMediaManager; |
23 | 23 |
24 // This class represents a single Wi-Fi Display session. | 24 // This class represents a single Wi-Fi Display session. |
25 // It manages life-cycle of the session and it is also responsible for | 25 // It manages life-cycle of the session and it is also responsible for |
26 // exchange of session controlling (RTSP) messages with the sink. | 26 // exchange of session controlling (RTSP) messages with the sink. |
27 class WiFiDisplaySession: public DisplaySourceSession, | 27 class WiFiDisplaySession : public DisplaySourceSession, |
28 public WiFiDisplaySessionServiceClient, | 28 public mojom::WiFiDisplaySessionServiceClient, |
29 public wds::Peer::Delegate, | 29 public wds::Peer::Delegate, |
30 public wds::Peer::Observer { | 30 public wds::Peer::Observer { |
31 public: | 31 public: |
32 explicit WiFiDisplaySession( | 32 explicit WiFiDisplaySession( |
33 const DisplaySourceSessionParams& params); | 33 const DisplaySourceSessionParams& params); |
34 ~WiFiDisplaySession() override; | 34 ~WiFiDisplaySession() override; |
35 | 35 |
36 private: | 36 private: |
37 using DisplaySourceSession::CompletionCallback; | 37 using DisplaySourceSession::CompletionCallback; |
38 // DisplaySourceSession overrides. | 38 // DisplaySourceSession overrides. |
39 void Start(const CompletionCallback& callback) override; | 39 void Start(const CompletionCallback& callback) override; |
40 void Terminate(const CompletionCallback& callback) override; | 40 void Terminate(const CompletionCallback& callback) override; |
(...skipping 26 matching lines...) Expand all Loading... |
67 void OnMediaError(const std::string& error); | 67 void OnMediaError(const std::string& error); |
68 | 68 |
69 void Terminate(); | 69 void Terminate(); |
70 | 70 |
71 void RunStartCallback(bool success, const std::string& error = ""); | 71 void RunStartCallback(bool success, const std::string& error = ""); |
72 void RunTerminateCallback(bool success, const std::string& error = ""); | 72 void RunTerminateCallback(bool success, const std::string& error = ""); |
73 | 73 |
74 private: | 74 private: |
75 std::unique_ptr<wds::Source> wfd_source_; | 75 std::unique_ptr<wds::Source> wfd_source_; |
76 std::unique_ptr<WiFiDisplayMediaManager> media_manager_; | 76 std::unique_ptr<WiFiDisplayMediaManager> media_manager_; |
77 WiFiDisplaySessionServicePtr service_; | 77 mojom::WiFiDisplaySessionServicePtr service_; |
78 mojo::Binding<WiFiDisplaySessionServiceClient> binding_; | 78 mojo::Binding<WiFiDisplaySessionServiceClient> binding_; |
79 std::string local_ip_address_; | 79 std::string local_ip_address_; |
80 std::map<int, std::unique_ptr<base::Timer>> timers_; | 80 std::map<int, std::unique_ptr<base::Timer>> timers_; |
81 | 81 |
82 DisplaySourceSessionParams params_; | 82 DisplaySourceSessionParams params_; |
83 CompletionCallback start_completion_callback_; | 83 CompletionCallback start_completion_callback_; |
84 CompletionCallback teminate_completion_callback_; | 84 CompletionCallback teminate_completion_callback_; |
85 // Holds sequence number for the following RTSP request-response pair. | 85 // Holds sequence number for the following RTSP request-response pair. |
86 mutable int cseq_; | 86 mutable int cseq_; |
87 int timer_id_; | 87 int timer_id_; |
88 base::WeakPtrFactory<WiFiDisplaySession> weak_factory_; | 88 base::WeakPtrFactory<WiFiDisplaySession> weak_factory_; |
89 | 89 |
90 DISALLOW_COPY_AND_ASSIGN(WiFiDisplaySession); | 90 DISALLOW_COPY_AND_ASSIGN(WiFiDisplaySession); |
91 }; | 91 }; |
92 | 92 |
93 } // namespace extensions | 93 } // namespace extensions |
94 | 94 |
95 #endif // EXTENSIONS_RENDERER_API_DISPLAY_SOURCE_WIFI_DISPLAY_WIFI_DISPLAY_SESS
ION_H_ | 95 #endif // EXTENSIONS_RENDERER_API_DISPLAY_SOURCE_WIFI_DISPLAY_WIFI_DISPLAY_SESS
ION_H_ |
OLD | NEW |