Chromium Code Reviews| Index: extensions/browser/api/display_source/wifi_display/wifi_display_session_service_impl.h |
| diff --git a/extensions/browser/api/display_source/wifi_display/wifi_display_session_service_impl.h b/extensions/browser/api/display_source/wifi_display/wifi_display_session_service_impl.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..1f3df2bab1fa741a4efd8409f9b8097740ae11fd |
| --- /dev/null |
| +++ b/extensions/browser/api/display_source/wifi_display/wifi_display_session_service_impl.h |
| @@ -0,0 +1,63 @@ |
| +// Copyright 2015 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef EXTENSIONS_BROWSER_API_DISPLAY_SOURCE_WIFI_DISPLAY_WIFI_DISPLAY_SESSION_SERVICE_IMPL_H_ |
| +#define EXTENSIONS_BROWSER_API_DISPLAY_SOURCE_WIFI_DISPLAY_WIFI_DISPLAY_SESSION_SERVICE_IMPL_H_ |
| + |
| +#include "components/keyed_service/content/browser_context_keyed_service_factory.h" |
| +#include "extensions/browser/api/display_source/display_source_connection_delegate.h" |
| +#include "extensions/common/mojo/wifi_display_session_service.mojom.h" |
| +#include "mojo/public/cpp/bindings/interface_request.h" |
| +#include "mojo/public/cpp/bindings/strong_binding.h" |
| + |
| +namespace content { |
| +class BrowserContext; |
| +} // namespace content |
| + |
| +namespace extensions { |
| + |
| +class WiFiDisplaySessionServiceImpl |
|
Ken Rockot(use gerrit already)
2016/01/05 17:21:37
Please document this class
Mikhail
2016/01/11 19:39:41
Done.
|
| + : public WiFiDisplaySessionService, |
| + public DisplaySourceConnectionDelegate::Observer { |
| + public: |
| + ~WiFiDisplaySessionServiceImpl() override; |
| + static void BindToRequest( |
| + content::BrowserContext* context, |
| + mojo::InterfaceRequest<WiFiDisplaySessionService> request); |
| + |
| + private: |
| + // WiFiDisplaySessionService overrides. |
| + void SetClient(WiFiDisplaySessionServiceClientPtr client) override; |
| + void Connect(int32_t sink_id, |
| + int32_t auth_method, |
| + const mojo::String& auth_data) override; |
| + void Disconnect() override; |
| + void SendMessage(const mojo::String& message) override; |
| + |
| + // DisplaySourceConnectionDelegate::Observer overrides. |
| + void OnSinksUpdated(const DisplaySourceSinkInfoList& sinks) override; |
| + |
| + explicit WiFiDisplaySessionServiceImpl( |
| + DisplaySourceConnectionDelegate* delegate, |
| + mojo::InterfaceRequest<WiFiDisplaySessionService> request); |
| + |
| + void OnConnectFailed(int sink_id, const std::string& message); |
| + void OnDisconnectFailed(int sink_id, const std::string& message); |
| + |
| + mojo::StrongBinding<WiFiDisplaySessionService> binding_; |
| + WiFiDisplaySessionServiceClientPtr client_; |
| + DisplaySourceConnectionDelegate* delegate_; |
| + |
| + // Id of the currenty connected sink (if any), obtained from connection |
| + // delegate. Keep it so that we know if a session has been ended. |
| + int last_connected_sink_; |
| + // Id of the sink of the session this object is associated with. |
| + int own_sink_; |
| + |
| + base::WeakPtrFactory<WiFiDisplaySessionServiceImpl> weak_factory_; |
| +}; |
|
Ken Rockot(use gerrit already)
2016/01/05 17:21:37
nit: DISALLOW_COPY_AND_ASSIGN
Mikhail
2016/01/11 19:39:41
Done.
|
| + |
| +} // namespace extensions |
| + |
| +#endif // EXTENSIONS_BROWSER_API_DISPLAY_SOURCE_WIFI_DISPLAY_WIFI_DISPLAY_SESSION_SERVICE_IMPL_H_ |