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 <string> | 8 #include <string> |
9 | 9 |
10 #include "extensions/common/mojo/wifi_display_session_service.mojom.h" | 10 #include "extensions/common/mojo/wifi_display_session_service.mojom.h" |
11 #include "extensions/renderer/api/display_source/display_source_session.h" | 11 #include "extensions/renderer/api/display_source/display_source_session.h" |
12 #include "mojo/public/cpp/bindings/binding.h" | 12 #include "mojo/public/cpp/bindings/binding.h" |
13 | 13 |
14 namespace extensions { | 14 namespace extensions { |
15 | 15 |
16 class WiFiDisplaySession: public DisplaySourceSession, | 16 class WiFiDisplaySession: public DisplaySourceSession, |
17 public WiFiDisplaySessionServiceClient { | 17 public WiFiDisplaySessionServiceClient { |
18 public: | 18 public: |
19 explicit WiFiDisplaySession( | 19 explicit WiFiDisplaySession( |
20 const DisplaySourceSessionParams& params); | 20 const DisplaySourceSessionParams& params); |
21 ~WiFiDisplaySession() override; | 21 ~WiFiDisplaySession() override; |
22 | 22 |
23 private: | 23 private: |
24 using DisplaySourceSession::CompletionCallback; | |
24 // DisplaySourceSession overrides. | 25 // DisplaySourceSession overrides. |
25 void Start() override; | 26 void Start(const CompletionCallback& callback) override; |
26 void Terminate() override; | 27 void Terminate(const CompletionCallback& callback) override; |
27 | 28 |
28 // WiFiDisplaySessionServiceClient overrides. | 29 // WiFiDisplaySessionServiceClient overrides. |
29 void OnEstablished(const mojo::String& ip_address) override; | 30 void OnConnected(const mojo::String& ip_address) override; |
31 void OnConnectRequestHandled(bool success, | |
32 const mojo::String& error) override; | |
30 void OnTerminated() override; | 33 void OnTerminated() override; |
34 void OnDisconnectRequestHandled(bool success, | |
35 const mojo::String& error) override; | |
31 void OnError(int32_t type, const mojo::String& description) override; | 36 void OnError(int32_t type, const mojo::String& description) override; |
32 void OnMessage(const mojo::String& data) override; | 37 void OnMessage(const mojo::String& data) override; |
33 | 38 |
34 // A connection error handler for the mojo objects used in this class. | 39 // A connection error handler for the mojo objects used in this class. |
35 void OnConnectionError(); | 40 void OnConnectionError(); |
36 | 41 |
42 void RunStartCompletionCB(bool success, const std::string& error = ""); | |
asargent_no_longer_on_chrome
2016/02/25 23:03:45
nit: the style guide states that names should avoi
Mikhail
2016/02/26 10:21:40
Done.
| |
43 void RunTerminateCompletionCB(bool success, const std::string& error = ""); | |
asargent_no_longer_on_chrome
2016/02/25 23:03:45
same thing here (and maybe "RunTerminateCallback"
Mikhail
2016/02/26 10:21:40
Done.
| |
44 | |
37 private: | 45 private: |
38 WiFiDisplaySessionServicePtr service_; | 46 WiFiDisplaySessionServicePtr service_; |
39 mojo::Binding<WiFiDisplaySessionServiceClient> binding_; | 47 mojo::Binding<WiFiDisplaySessionServiceClient> binding_; |
40 std::string ip_address_; | 48 std::string ip_address_; |
41 DisplaySourceSessionParams params_; | 49 DisplaySourceSessionParams params_; |
50 CompletionCallback start_completion_callback_; | |
51 CompletionCallback teminate_completion_callback_; | |
42 base::WeakPtrFactory<WiFiDisplaySession> weak_factory_; | 52 base::WeakPtrFactory<WiFiDisplaySession> weak_factory_; |
43 | 53 |
44 DISALLOW_COPY_AND_ASSIGN(WiFiDisplaySession); | 54 DISALLOW_COPY_AND_ASSIGN(WiFiDisplaySession); |
45 }; | 55 }; |
46 | 56 |
47 } // namespace extensions | 57 } // namespace extensions |
48 | 58 |
49 #endif // EXTENSIONS_RENDERER_API_DISPLAY_SOURCE_WIFI_DISPLAY_WIFI_DISPLAY_SESS ION_H_ | 59 #endif // EXTENSIONS_RENDERER_API_DISPLAY_SOURCE_WIFI_DISPLAY_WIFI_DISPLAY_SESS ION_H_ |
OLD | NEW |