disconnect_window_chromeos.cc 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. // Copyright 2014 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #include <memory>
  5. #include <string>
  6. #include "ash/shell.h"
  7. #include "ash/system/tray/system_tray_notifier.h"
  8. #include "base/bind.h"
  9. #include "remoting/host/client_session_control.h"
  10. #include "remoting/host/host_window.h"
  11. namespace remoting {
  12. namespace {
  13. class DisconnectWindowAura : public HostWindow {
  14. public:
  15. DisconnectWindowAura();
  16. DisconnectWindowAura(const DisconnectWindowAura&) = delete;
  17. DisconnectWindowAura& operator=(const DisconnectWindowAura&) = delete;
  18. ~DisconnectWindowAura() override;
  19. // HostWindow interface.
  20. void Start(const base::WeakPtr<ClientSessionControl>& client_session_control)
  21. override;
  22. };
  23. DisconnectWindowAura::DisconnectWindowAura() = default;
  24. DisconnectWindowAura::~DisconnectWindowAura() {
  25. ash::Shell::Get()->system_tray_notifier()->NotifyScreenShareStop();
  26. }
  27. void DisconnectWindowAura::Start(
  28. const base::WeakPtr<ClientSessionControl>& client_session_control) {
  29. // TODO(kelvinp): Clean up the NotifyScreenShareStart interface when we
  30. // completely retire Hangout Remote Desktop v1.
  31. std::u16string helper_name;
  32. ash::Shell::Get()->system_tray_notifier()->NotifyScreenShareStart(
  33. base::BindRepeating(&ClientSessionControl::DisconnectSession,
  34. client_session_control, protocol::OK),
  35. helper_name);
  36. }
  37. } // namespace
  38. // static
  39. std::unique_ptr<HostWindow> HostWindow::CreateDisconnectWindow() {
  40. return std::make_unique<DisconnectWindowAura>();
  41. }
  42. } // namespace remoting