blob: 408e09f05c2cf6c29aa0c389dfb54b4a92531107 [file] [log] [blame]
kelvinp561074cf2014-10-30 21:46:161// 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
Jinho Bang138fde32018-01-18 23:13:425#include <memory>
6
kelvinp561074cf2014-10-30 21:46:167#include "remoting/host/continue_window.h"
8
Sebastien Marchand6d0558fd2019-01-25 16:49:379#include "base/bind.h"
avic5960f32015-12-22 22:49:4810#include "base/macros.h"
kelvinpf4691122014-11-04 23:27:0311#include "remoting/base/string_resources.h"
12#include "remoting/host/chromeos/message_box.h"
13#include "ui/base/l10n/l10n_util.h"
14
kelvinp561074cf2014-10-30 21:46:1615namespace remoting {
16
17namespace {
18
kelvinp561074cf2014-10-30 21:46:1619class ContinueWindowAura : public ContinueWindow {
20 public:
21 ContinueWindowAura();
22 ~ContinueWindowAura() override;
23
kelvinpf4691122014-11-04 23:27:0324 void OnMessageBoxResult(MessageBox::Result result);
25
kelvinp561074cf2014-10-30 21:46:1626 protected:
27 // ContinueWindow interface.
28 void ShowUi() override;
29 void HideUi() override;
30
31 private:
dcheng0765c492016-04-06 22:41:5332 std::unique_ptr<MessageBox> message_box_;
kelvinp561074cf2014-10-30 21:46:1633 DISALLOW_COPY_AND_ASSIGN(ContinueWindowAura);
34};
35
Chris Watkins6fe52aa2017-11-28 03:24:0536ContinueWindowAura::ContinueWindowAura() = default;
kelvinp561074cf2014-10-30 21:46:1637
Chris Watkins6fe52aa2017-11-28 03:24:0538ContinueWindowAura::~ContinueWindowAura() = default;
kelvinpf4691122014-11-04 23:27:0339
40void ContinueWindowAura::OnMessageBoxResult(MessageBox::Result result) {
41 if (result == MessageBox::OK) {
42 ContinueSession();
43 } else {
44 DisconnectSession();
45 }
kelvinp561074cf2014-10-30 21:46:1646}
47
48void ContinueWindowAura::ShowUi() {
Jinho Bang138fde32018-01-18 23:13:4249 message_box_ = std::make_unique<MessageBox>(
kelvinp8607d9d2017-01-27 03:33:5250 l10n_util::GetStringUTF16(IDS_MODE_IT2ME), // title
51 l10n_util::GetStringUTF16(IDS_CONTINUE_PROMPT), // dialog label
52 l10n_util::GetStringUTF16(IDS_CONTINUE_BUTTON), // ok label
53 l10n_util::GetStringUTF16(IDS_STOP_SHARING_BUTTON), // cancel label
54 base::Bind(&ContinueWindowAura::OnMessageBoxResult,
55 base::Unretained(this)));
kelvinp561074cf2014-10-30 21:46:1656}
57
58void ContinueWindowAura::HideUi() {
kelvinp8607d9d2017-01-27 03:33:5259 message_box_.reset();
kelvinp561074cf2014-10-30 21:46:1660}
61
62} // namespace
63
64// static
dcheng0765c492016-04-06 22:41:5365std::unique_ptr<HostWindow> HostWindow::CreateContinueWindow() {
Jinho Bang138fde32018-01-18 23:13:4266 return std::make_unique<ContinueWindowAura>();
kelvinp561074cf2014-10-30 21:46:1667}
68
69} // namespace remoting