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 "chrome/browser/chromeos/login/screens/host_pairing_screen.h" | 5 #include "chrome/browser/chromeos/login/screens/host_pairing_screen.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "chrome/browser/chromeos/login/wizard_controller.h" | 8 #include "chrome/browser/chromeos/login/wizard_controller.h" |
9 #include "components/pairing/host_pairing_controller.h" | 9 #include "components/pairing/host_pairing_controller.h" |
10 | 10 |
11 namespace chromeos { | 11 namespace chromeos { |
12 | 12 |
13 using namespace host_pairing; | 13 using namespace host_pairing; |
14 using namespace pairing_chromeos; | 14 using namespace pairing_chromeos; |
15 | 15 |
16 HostPairingScreen::HostPairingScreen( | 16 HostPairingScreen::HostPairingScreen( |
17 ScreenObserver* observer, | 17 ScreenObserver* observer, |
18 HostPairingScreenActor* actor, | 18 HostPairingScreenActor* actor, |
19 pairing_chromeos::HostPairingController* remora_controller) | 19 pairing_chromeos::HostPairingController* remora_controller) |
20 : BaseScreen(observer), | 20 : BaseScreen(observer), |
21 actor_(actor), | 21 actor_(actor), |
22 remora_controller_(remora_controller), | 22 remora_controller_(remora_controller), |
| 23 delegate_(nullptr), |
23 current_stage_(HostPairingController::STAGE_NONE) { | 24 current_stage_(HostPairingController::STAGE_NONE) { |
24 actor_->SetDelegate(this); | 25 actor_->SetDelegate(this); |
25 remora_controller_->AddObserver(this); | 26 remora_controller_->AddObserver(this); |
26 } | 27 } |
27 | 28 |
28 HostPairingScreen::~HostPairingScreen() { | 29 HostPairingScreen::~HostPairingScreen() { |
29 if (actor_) | 30 if (actor_) |
30 actor_->SetDelegate(NULL); | 31 actor_->SetDelegate(NULL); |
31 remora_controller_->RemoveObserver(this); | 32 remora_controller_->RemoveObserver(this); |
32 } | 33 } |
33 | 34 |
| 35 void HostPairingScreen::SetDelegate(Delegate* delegate) { |
| 36 delegate_ = delegate; |
| 37 } |
| 38 |
34 void HostPairingScreen::CommitContextChanges() { | 39 void HostPairingScreen::CommitContextChanges() { |
35 if (!context_.HasChanges()) | 40 if (!context_.HasChanges()) |
36 return; | 41 return; |
37 base::DictionaryValue diff; | 42 base::DictionaryValue diff; |
38 context_.GetChangesAndReset(&diff); | 43 context_.GetChangesAndReset(&diff); |
39 if (actor_) | 44 if (actor_) |
40 actor_->OnContextChanged(diff); | 45 actor_->OnContextChanged(diff); |
41 } | 46 } |
42 | 47 |
43 void HostPairingScreen::PrepareToShow() { | 48 void HostPairingScreen::PrepareToShow() { |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 void HostPairingScreen::ConfigureHost(bool accepted_eula, | 90 void HostPairingScreen::ConfigureHost(bool accepted_eula, |
86 const std::string& lang, | 91 const std::string& lang, |
87 const std::string& timezone, | 92 const std::string& timezone, |
88 bool send_reports, | 93 bool send_reports, |
89 const std::string& keyboard_layout) { | 94 const std::string& keyboard_layout) { |
90 VLOG(1) << "ConfigureHostMessage language=" << lang | 95 VLOG(1) << "ConfigureHostMessage language=" << lang |
91 << ", timezone=" << timezone | 96 << ", timezone=" << timezone |
92 << ", keyboard_layout=" << keyboard_layout; | 97 << ", keyboard_layout=" << keyboard_layout; |
93 | 98 |
94 remora_controller_->RemoveObserver(this); | 99 remora_controller_->RemoveObserver(this); |
95 get_screen_observer()->ConfigureHost(accepted_eula, lang, timezone, | 100 if (delegate_) { |
96 send_reports, keyboard_layout); | 101 delegate_->ConfigureHost( |
| 102 accepted_eula, lang, timezone, send_reports, keyboard_layout); |
| 103 } |
97 get_screen_observer()->OnExit(WizardController::HOST_PAIRING_FINISHED); | 104 get_screen_observer()->OnExit(WizardController::HOST_PAIRING_FINISHED); |
98 } | 105 } |
99 | 106 |
100 void HostPairingScreen::EnrollHost(const std::string& auth_token) { | 107 void HostPairingScreen::EnrollHost(const std::string& auth_token) { |
101 NOTREACHED(); | 108 NOTREACHED(); |
102 } | 109 } |
103 | 110 |
104 void HostPairingScreen::OnActorDestroyed(HostPairingScreenActor* actor) { | 111 void HostPairingScreen::OnActorDestroyed(HostPairingScreenActor* actor) { |
105 if (actor_ == actor) | 112 if (actor_ == actor) |
106 actor_ = NULL; | 113 actor_ = NULL; |
107 } | 114 } |
108 | 115 |
109 } // namespace chromeos | 116 } // namespace chromeos |
OLD | NEW |