| 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 | |
| 11 namespace remoting { | 7 namespace remoting { |
| 12 | 8 |
| 13 namespace { | 9 namespace { |
| 14 | 10 |
| 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. |
| 15 class ContinueWindowAura : public ContinueWindow { | 14 class ContinueWindowAura : public ContinueWindow { |
| 16 public: | 15 public: |
| 17 ContinueWindowAura(); | 16 ContinueWindowAura(); |
| 18 ~ContinueWindowAura() override; | 17 ~ContinueWindowAura() override; |
| 19 | 18 |
| 20 void OnMessageBoxResult(MessageBox::Result result); | |
| 21 | |
| 22 protected: | 19 protected: |
| 23 // ContinueWindow interface. | 20 // ContinueWindow interface. |
| 24 void ShowUi() override; | 21 void ShowUi() override; |
| 25 void HideUi() override; | 22 void HideUi() override; |
| 26 | 23 |
| 27 private: | 24 private: |
| 28 scoped_ptr<MessageBox> message_box_; | |
| 29 DISALLOW_COPY_AND_ASSIGN(ContinueWindowAura); | 25 DISALLOW_COPY_AND_ASSIGN(ContinueWindowAura); |
| 30 }; | 26 }; |
| 31 | 27 |
| 32 ContinueWindowAura::ContinueWindowAura() { | 28 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)))); | |
| 40 } | 29 } |
| 41 | 30 |
| 42 ContinueWindowAura::~ContinueWindowAura() { | 31 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 } | |
| 52 } | 32 } |
| 53 | 33 |
| 54 void ContinueWindowAura::ShowUi() { | 34 void ContinueWindowAura::ShowUi() { |
| 55 message_box_->Show(); | 35 // TODO(kelvinp): Implement this on Chrome OS (See crbug.com/424908). |
| 36 NOTIMPLEMENTED(); |
| 56 } | 37 } |
| 57 | 38 |
| 58 void ContinueWindowAura::HideUi() { | 39 void ContinueWindowAura::HideUi() { |
| 59 message_box_->Hide(); | 40 // TODO(kelvinp): Implement this on Chrome OS (See crbug.com/424908). |
| 41 NOTIMPLEMENTED(); |
| 60 } | 42 } |
| 61 | 43 |
| 62 } // namespace | 44 } // namespace |
| 63 | 45 |
| 64 // static | 46 // static |
| 65 scoped_ptr<HostWindow> HostWindow::CreateContinueWindow() { | 47 scoped_ptr<HostWindow> HostWindow::CreateContinueWindow() { |
| 66 return make_scoped_ptr(new ContinueWindowAura()); | 48 return make_scoped_ptr(new ContinueWindowAura()); |
| 67 } | 49 } |
| 68 | 50 |
| 69 } // namespace remoting | 51 } // namespace remoting |
| OLD | NEW |