| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/eula_screen.h" | 5 #include "chrome/browser/chromeos/login/screens/eula_screen.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "chrome/browser/browser_process.h" | 8 #include "chrome/browser/browser_process.h" |
| 9 #include "chrome/browser/chromeos/customization_document.h" | 9 #include "chrome/browser/chromeos/customization_document.h" |
| 10 #include "chrome/browser/chromeos/login/screens/screen_observer.h" | 10 #include "chrome/browser/chromeos/login/screens/base_screen_delegate.h" |
| 11 #include "chrome/browser/chromeos/login/wizard_controller.h" | 11 #include "chrome/browser/chromeos/login/wizard_controller.h" |
| 12 #include "chromeos/dbus/cryptohome_client.h" | 12 #include "chromeos/dbus/cryptohome_client.h" |
| 13 #include "chromeos/dbus/dbus_method_call_status.h" | 13 #include "chromeos/dbus/dbus_method_call_status.h" |
| 14 #include "chromeos/dbus/dbus_thread_manager.h" | 14 #include "chromeos/dbus/dbus_thread_manager.h" |
| 15 | 15 |
| 16 namespace chromeos { | 16 namespace chromeos { |
| 17 | 17 |
| 18 EulaScreen::EulaScreen(ScreenObserver* observer, EulaScreenActor* actor) | 18 EulaScreen::EulaScreen(BaseScreenDelegate* base_screen_delegate, |
| 19 : BaseScreen(observer), | 19 EulaScreenActor* actor) |
| 20 : BaseScreen(base_screen_delegate), |
| 20 actor_(actor), | 21 actor_(actor), |
| 21 delegate_(nullptr), | 22 delegate_(nullptr), |
| 22 password_fetcher_(this) { | 23 password_fetcher_(this) { |
| 23 DCHECK(actor_); | 24 DCHECK(actor_); |
| 24 if (actor_) | 25 if (actor_) |
| 25 actor_->SetDelegate(this); | 26 actor_->SetDelegate(this); |
| 26 } | 27 } |
| 27 | 28 |
| 28 EulaScreen::~EulaScreen() { | 29 EulaScreen::~EulaScreen() { |
| 29 if (actor_) | 30 if (actor_) |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 VLOG(1) << "No eula found for locale: " << locale; | 72 VLOG(1) << "No eula found for locale: " << locale; |
| 72 } else { | 73 } else { |
| 73 LOG(ERROR) << "No manifest found."; | 74 LOG(ERROR) << "No manifest found."; |
| 74 } | 75 } |
| 75 return GURL(); | 76 return GURL(); |
| 76 } | 77 } |
| 77 | 78 |
| 78 void EulaScreen::OnExit(bool accepted, bool usage_stats_enabled) { | 79 void EulaScreen::OnExit(bool accepted, bool usage_stats_enabled) { |
| 79 if (delegate_) | 80 if (delegate_) |
| 80 delegate_->SetUsageStatisticsReporting(usage_stats_enabled); | 81 delegate_->SetUsageStatisticsReporting(usage_stats_enabled); |
| 81 get_screen_observer()->OnExit(accepted | 82 get_base_screen_delegate()->OnExit(accepted |
| 82 ? ScreenObserver::EULA_ACCEPTED | 83 ? BaseScreenDelegate::EULA_ACCEPTED |
| 83 : ScreenObserver::EULA_BACK); | 84 : BaseScreenDelegate::EULA_BACK); |
| 84 } | 85 } |
| 85 | 86 |
| 86 void EulaScreen::InitiatePasswordFetch() { | 87 void EulaScreen::InitiatePasswordFetch() { |
| 87 if (tpm_password_.empty()) { | 88 if (tpm_password_.empty()) { |
| 88 password_fetcher_.Fetch(); | 89 password_fetcher_.Fetch(); |
| 89 // Will call actor after password has been fetched. | 90 // Will call actor after password has been fetched. |
| 90 } else if (actor_) { | 91 } else if (actor_) { |
| 91 actor_->OnPasswordFetched(tpm_password_); | 92 actor_->OnPasswordFetched(tpm_password_); |
| 92 } | 93 } |
| 93 } | 94 } |
| 94 | 95 |
| 95 void EulaScreen::OnPasswordFetched(const std::string& tpm_password) { | 96 void EulaScreen::OnPasswordFetched(const std::string& tpm_password) { |
| 96 tpm_password_ = tpm_password; | 97 tpm_password_ = tpm_password; |
| 97 if (actor_) | 98 if (actor_) |
| 98 actor_->OnPasswordFetched(tpm_password_); | 99 actor_->OnPasswordFetched(tpm_password_); |
| 99 } | 100 } |
| 100 | 101 |
| 101 bool EulaScreen::IsUsageStatsEnabled() const { | 102 bool EulaScreen::IsUsageStatsEnabled() const { |
| 102 return delegate_ && delegate_->GetUsageStatisticsReporting(); | 103 return delegate_ && delegate_->GetUsageStatisticsReporting(); |
| 103 } | 104 } |
| 104 | 105 |
| 105 void EulaScreen::OnActorDestroyed(EulaScreenActor* actor) { | 106 void EulaScreen::OnActorDestroyed(EulaScreenActor* actor) { |
| 106 if (actor_ == actor) | 107 if (actor_ == actor) |
| 107 actor_ = NULL; | 108 actor_ = NULL; |
| 108 } | 109 } |
| 109 | 110 |
| 110 } // namespace chromeos | 111 } // namespace chromeos |
| OLD | NEW |