| 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 <string> | 9 #include <string> |
| 9 | 10 |
| 10 #include "extensions/common/mojo/wifi_display_session_service.mojom.h" | 11 #include "extensions/common/mojo/wifi_display_session_service.mojom.h" |
| 11 #include "extensions/renderer/api/display_source/display_source_session.h" | 12 #include "extensions/renderer/api/display_source/display_source_session.h" |
| 12 #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" |
| 15 |
| 16 namespace base { |
| 17 class Timer; |
| 18 } // namespace base |
| 13 | 19 |
| 14 namespace extensions { | 20 namespace extensions { |
| 15 | 21 |
| 22 class WiFiDisplayMediaManager; |
| 23 |
| 16 class WiFiDisplaySession: public DisplaySourceSession, | 24 class WiFiDisplaySession: public DisplaySourceSession, |
| 17 public WiFiDisplaySessionServiceClient { | 25 public WiFiDisplaySessionServiceClient, |
| 26 public wds::Peer::Delegate, |
| 27 public wds::Peer::Observer { |
| 18 public: | 28 public: |
| 19 explicit WiFiDisplaySession( | 29 explicit WiFiDisplaySession( |
| 20 const DisplaySourceSessionParams& params); | 30 const DisplaySourceSessionParams& params); |
| 21 ~WiFiDisplaySession() override; | 31 ~WiFiDisplaySession() override; |
| 22 | 32 |
| 23 private: | 33 private: |
| 24 // DisplaySourceSession overrides. | 34 // DisplaySourceSession overrides. |
| 25 void Start() override; | 35 void Start() override; |
| 26 void Terminate() override; | 36 void Terminate() override; |
| 27 | 37 |
| 28 // WiFiDisplaySessionServiceClient overrides. | 38 // WiFiDisplaySessionServiceClient overrides. |
| 29 void OnEstablished(const mojo::String& ip_address) override; | 39 void OnEstablished(const mojo::String& ip_address) override; |
| 30 void OnTerminated() override; | 40 void OnTerminated() override; |
| 31 void OnError(int32_t type, const mojo::String& description) override; | 41 void OnError(int32_t type, const mojo::String& description) override; |
| 32 void OnMessage(const mojo::String& data) override; | 42 void OnMessage(const mojo::String& data) override; |
| 33 | 43 |
| 44 // wds::Peer::Delegate overrides. |
| 45 uint CreateTimer(int seconds) override; |
| 46 void ReleaseTimer(uint timer_id) override; |
| 47 void SendRTSPData(const std::string& message) override; |
| 48 std::string GetLocalIPAddress() const override; |
| 49 int GetNextCSeq(int* initial_peer_cseq = nullptr) const override; |
| 50 |
| 51 // wds::Peer::Observer overrides. |
| 52 void ErrorOccurred(wds::ErrorType error) override; |
| 53 void SessionCompleted() override; |
| 54 |
| 34 // A connection error handler for the mojo objects used in this class. | 55 // A connection error handler for the mojo objects used in this class. |
| 35 void OnConnectionError(); | 56 void OnIPCConnectionError(); |
| 36 | 57 |
| 37 private: | 58 private: |
| 59 scoped_ptr<wds::Source> wfd_source_; |
| 60 scoped_ptr<WiFiDisplayMediaManager> media_manager_; |
| 38 WiFiDisplaySessionServicePtr service_; | 61 WiFiDisplaySessionServicePtr service_; |
| 39 mojo::Binding<WiFiDisplaySessionServiceClient> binding_; | 62 mojo::Binding<WiFiDisplaySessionServiceClient> binding_; |
| 40 std::string ip_address_; | 63 std::string ip_address_; |
| 64 std::map<uint, scoped_ptr<base::Timer>> timers_; |
| 65 |
| 41 DisplaySourceSessionParams params_; | 66 DisplaySourceSessionParams params_; |
| 42 base::WeakPtrFactory<WiFiDisplaySession> weak_factory_; | 67 base::WeakPtrFactory<WiFiDisplaySession> weak_factory_; |
| 43 | 68 |
| 44 DISALLOW_COPY_AND_ASSIGN(WiFiDisplaySession); | 69 DISALLOW_COPY_AND_ASSIGN(WiFiDisplaySession); |
| 45 }; | 70 }; |
| 46 | 71 |
| 47 } // namespace extensions | 72 } // namespace extensions |
| 48 | 73 |
| 49 #endif // EXTENSIONS_RENDERER_API_DISPLAY_SOURCE_WIFI_DISPLAY_WIFI_DISPLAY_SESS
ION_H_ | 74 #endif // EXTENSIONS_RENDERER_API_DISPLAY_SOURCE_WIFI_DISPLAY_WIFI_DISPLAY_SESS
ION_H_ |
| OLD | NEW |