Chromium Code Reviews| 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, |
|
asargent_no_longer_on_chrome
2016/02/25 22:09:39
nit: this class could use a brief overview comment
Mikhail
2016/02/26 14:42:46
Done.
| |
| 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 unsigned CreateTimer(int seconds) override; | |
| 46 void ReleaseTimer(unsigned 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<unsigned, scoped_ptr<base::Timer>> timers_; | |
| 65 | |
| 41 DisplaySourceSessionParams params_; | 66 DisplaySourceSessionParams params_; |
| 67 mutable int cseq_; | |
|
asargent_no_longer_on_chrome
2016/02/25 22:09:39
nits:
-"cseq" isn't a very descriptive name - at
Mikhail
2016/02/26 14:42:46
Added a description comment. This member is mutabl
asargent_no_longer_on_chrome
2016/02/26 17:01:34
To be clear, the point I was trying to make is as
| |
| 68 unsigned timer_id_; | |
|
asargent_no_longer_on_chrome
2016/02/25 22:09:39
nit: we usually prefer to use either int, size_t,
Mikhail
2016/02/26 14:42:46
'unsigned' was used due to the inherited WDS inter
| |
| 42 base::WeakPtrFactory<WiFiDisplaySession> weak_factory_; | 69 base::WeakPtrFactory<WiFiDisplaySession> weak_factory_; |
| 43 | 70 |
| 44 DISALLOW_COPY_AND_ASSIGN(WiFiDisplaySession); | 71 DISALLOW_COPY_AND_ASSIGN(WiFiDisplaySession); |
| 45 }; | 72 }; |
| 46 | 73 |
| 47 } // namespace extensions | 74 } // namespace extensions |
| 48 | 75 |
| 49 #endif // EXTENSIONS_RENDERER_API_DISPLAY_SOURCE_WIFI_DISPLAY_WIFI_DISPLAY_SESS ION_H_ | 76 #endif // EXTENSIONS_RENDERER_API_DISPLAY_SOURCE_WIFI_DISPLAY_WIFI_DISPLAY_SESS ION_H_ |
| OLD | NEW |