| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "remoting/host/continue_window.h" | 5 #include "remoting/host/continue_window.h" |
| 6 | 6 |
| 7 #include "remoting/base/string_resources.h" |
| 8 #include "remoting/host/chromeos/message_box.h" |
| 9 #include "ui/base/l10n/l10n_util.h" |
| 10 |
| 7 namespace remoting { | 11 namespace remoting { |
| 8 | 12 |
| 9 namespace { | 13 namespace { |
| 10 | 14 |
| 11 // A place holder implementation for the ContinueWindow on | |
| 12 // ChromeOS. Remote assistance on Chrome OS is currently under a flag so it is | |
| 13 // secure to leave it unimplemented for now. | |
| 14 class ContinueWindowAura : public ContinueWindow { | 15 class ContinueWindowAura : public ContinueWindow { |
| 15 public: | 16 public: |
| 16 ContinueWindowAura(); | 17 ContinueWindowAura(); |
| 17 ~ContinueWindowAura() override; | 18 ~ContinueWindowAura() override; |
| 18 | 19 |
| 20 void OnMessageBoxResult(MessageBox::Result result); |
| 21 |
| 19 protected: | 22 protected: |
| 20 // ContinueWindow interface. | 23 // ContinueWindow interface. |
| 21 void ShowUi() override; | 24 void ShowUi() override; |
| 22 void HideUi() override; | 25 void HideUi() override; |
| 23 | 26 |
| 24 private: | 27 private: |
| 28 scoped_ptr<MessageBox> message_box_; |
| 25 DISALLOW_COPY_AND_ASSIGN(ContinueWindowAura); | 29 DISALLOW_COPY_AND_ASSIGN(ContinueWindowAura); |
| 26 }; | 30 }; |
| 27 | 31 |
| 28 ContinueWindowAura::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)))); |
| 29 } | 40 } |
| 30 | 41 |
| 31 ContinueWindowAura::~ContinueWindowAura() { | 42 ContinueWindowAura::~ContinueWindowAura() { |
| 43 message_box_->Hide(); |
| 44 } |
| 45 |
| 46 void ContinueWindowAura::OnMessageBoxResult(MessageBox::Result result) { |
| 47 if (result == MessageBox::OK) { |
| 48 ContinueSession(); |
| 49 } else { |
| 50 DisconnectSession(); |
| 51 } |
| 32 } | 52 } |
| 33 | 53 |
| 34 void ContinueWindowAura::ShowUi() { | 54 void ContinueWindowAura::ShowUi() { |
| 35 // TODO(kelvinp): Implement this on Chrome OS (See crbug.com/424908). | 55 message_box_->Show(); |
| 36 NOTIMPLEMENTED(); | |
| 37 } | 56 } |
| 38 | 57 |
| 39 void ContinueWindowAura::HideUi() { | 58 void ContinueWindowAura::HideUi() { |
| 40 // TODO(kelvinp): Implement this on Chrome OS (See crbug.com/424908). | 59 message_box_->Hide(); |
| 41 NOTIMPLEMENTED(); | |
| 42 } | 60 } |
| 43 | 61 |
| 44 } // namespace | 62 } // namespace |
| 45 | 63 |
| 46 // static | 64 // static |
| 47 scoped_ptr<HostWindow> HostWindow::CreateContinueWindow() { | 65 scoped_ptr<HostWindow> HostWindow::CreateContinueWindow() { |
| 48 return make_scoped_ptr(new ContinueWindowAura()); | 66 return make_scoped_ptr(new ContinueWindowAura()); |
| 49 } | 67 } |
| 50 | 68 |
| 51 } // namespace remoting | 69 } // namespace remoting |
| OLD | NEW |