blob: 9c7e413ea97642a8eb989806d36af50f30cb689f [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
5#include "remoting/host/continue_window.h"
6
kelvinpf4691122014-11-04 23:27:037#include "remoting/base/string_resources.h"
8#include "remoting/host/chromeos/message_box.h"
9#include "ui/base/l10n/l10n_util.h"
10
kelvinp561074cf2014-10-30 21:46:1611namespace remoting {
12
13namespace {
14
kelvinp561074cf2014-10-30 21:46:1615class ContinueWindowAura : public ContinueWindow {
16 public:
17 ContinueWindowAura();
18 ~ContinueWindowAura() override;
19
kelvinpf4691122014-11-04 23:27:0320 void OnMessageBoxResult(MessageBox::Result result);
21
kelvinp561074cf2014-10-30 21:46:1622 protected:
23 // ContinueWindow interface.
24 void ShowUi() override;
25 void HideUi() override;
26
27 private:
kelvinpf4691122014-11-04 23:27:0328 scoped_ptr<MessageBox> message_box_;
kelvinp561074cf2014-10-30 21:46:1629 DISALLOW_COPY_AND_ASSIGN(ContinueWindowAura);
30};
31
32ContinueWindowAura::ContinueWindowAura() {
kelvinpf4691122014-11-04 23:27:0333 message_box_.reset(new MessageBox(
34 l10n_util::GetStringUTF16(IDS_MODE_IT2ME), // title
35 l10n_util::GetStringUTF16(IDS_CONTINUE_PROMPT), // dialog label
36 l10n_util::GetStringUTF16(IDS_CONTINUE_BUTTON), // ok label
37 l10n_util::GetStringUTF16(IDS_STOP_SHARING_BUTTON), // cancel label
38 base::Bind(&ContinueWindowAura::OnMessageBoxResult,
39 base::Unretained(this))));
kelvinp561074cf2014-10-30 21:46:1640}
41
42ContinueWindowAura::~ContinueWindowAura() {
kelvinpf4691122014-11-04 23:27:0343 message_box_->Hide();
44}
45
46void ContinueWindowAura::OnMessageBoxResult(MessageBox::Result result) {
47 if (result == MessageBox::OK) {
48 ContinueSession();
49 } else {
50 DisconnectSession();
51 }
kelvinp561074cf2014-10-30 21:46:1652}
53
54void ContinueWindowAura::ShowUi() {
kelvinpf4691122014-11-04 23:27:0355 message_box_->Show();
kelvinp561074cf2014-10-30 21:46:1656}
57
58void ContinueWindowAura::HideUi() {
kelvinpf4691122014-11-04 23:27:0359 message_box_->Hide();
kelvinp561074cf2014-10-30 21:46:1660}
61
62} // namespace
63
64// static
65scoped_ptr<HostWindow> HostWindow::CreateContinueWindow() {
66 return make_scoped_ptr(new ContinueWindowAura());
67}
68
69} // namespace remoting