[Android] Ensure popups hidden when ContentViewCore destroyed
[chromium-blink-merge.git] / remoting / host / continue_window_chromeos.cc
blob9c7e413ea97642a8eb989806d36af50f30cb689f
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.
5 #include "remoting/host/continue_window.h"
7 #include "remoting/base/string_resources.h"
8 #include "remoting/host/chromeos/message_box.h"
9 #include "ui/base/l10n/l10n_util.h"
11 namespace remoting {
13 namespace {
15 class ContinueWindowAura : public ContinueWindow {
16 public:
17 ContinueWindowAura();
18 ~ContinueWindowAura() override;
20 void OnMessageBoxResult(MessageBox::Result result);
22 protected:
23 // ContinueWindow interface.
24 void ShowUi() override;
25 void HideUi() override;
27 private:
28 scoped_ptr<MessageBox> message_box_;
29 DISALLOW_COPY_AND_ASSIGN(ContinueWindowAura);
32 ContinueWindowAura::ContinueWindowAura() {
33 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))));
42 ContinueWindowAura::~ContinueWindowAura() {
43 message_box_->Hide();
46 void ContinueWindowAura::OnMessageBoxResult(MessageBox::Result result) {
47 if (result == MessageBox::OK) {
48 ContinueSession();
49 } else {
50 DisconnectSession();
54 void ContinueWindowAura::ShowUi() {
55 message_box_->Show();
58 void ContinueWindowAura::HideUi() {
59 message_box_->Hide();
62 } // namespace
64 // static
65 scoped_ptr<HostWindow> HostWindow::CreateContinueWindow() {
66 return make_scoped_ptr(new ContinueWindowAura());
69 } // namespace remoting