Chromium Code Reviews| 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/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
| 11 #include "chrome/browser/chromeos/customization/customization_document.h" | 11 #include "chrome/browser/chromeos/customization/customization_document.h" |
| 12 #include "chrome/browser/chromeos/login/screens/base_screen_delegate.h" | 12 #include "chrome/browser/chromeos/login/screens/base_screen_delegate.h" |
| 13 #include "chrome/browser/chromeos/login/screens/eula_view.h" | 13 #include "chrome/browser/chromeos/login/screens/eula_view.h" |
| 14 #include "chrome/browser/chromeos/login/wizard_controller.h" | |
| 14 #include "chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos.h" | 15 #include "chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos.h" |
| 15 #include "chromeos/dbus/cryptohome_client.h" | 16 #include "chromeos/dbus/cryptohome_client.h" |
| 16 #include "chromeos/dbus/dbus_method_call_status.h" | 17 #include "chromeos/dbus/dbus_method_call_status.h" |
| 17 #include "chromeos/dbus/dbus_thread_manager.h" | 18 #include "chromeos/dbus/dbus_thread_manager.h" |
| 18 | 19 |
| 19 namespace chromeos { | 20 namespace chromeos { |
| 21 namespace { | |
| 22 constexpr const char kUserActionAcceptButtonClicked[] = "accept-button"; | |
|
achuithb
2017/01/13 20:10:05
Looks a bit crowded, a newline before this line ma
jdufault
2017/01/14 00:03:29
Done.
| |
| 23 constexpr const char kUserActionBackButtonClicked[] = "back-button"; | |
| 24 constexpr const char kContextKeyUsageStatsEnabled[] = "usageStatsEnabled"; | |
| 25 } // namespace | |
|
achuithb
2017/01/13 20:10:05
Drop comment since the namespace is small
jdufault
2017/01/14 00:03:29
Keeping since I added newlines. I can remove if yo
| |
| 20 | 26 |
| 21 EulaScreen::EulaScreen(BaseScreenDelegate* base_screen_delegate, | 27 EulaScreen::EulaScreen(BaseScreenDelegate* base_screen_delegate, |
| 22 Delegate* delegate, | 28 Delegate* delegate, |
| 23 EulaView* view) | 29 EulaView* view) |
| 24 : EulaModel(base_screen_delegate), | 30 : BaseScreen(base_screen_delegate, OobeScreen::SCREEN_OOBE_EULA), |
| 25 delegate_(delegate), | 31 delegate_(delegate), |
| 26 view_(view), | 32 view_(view), |
| 27 password_fetcher_(this) { | 33 password_fetcher_(this) { |
| 28 DCHECK(view_); | 34 DCHECK(view_); |
| 29 DCHECK(delegate_); | 35 DCHECK(delegate_); |
| 30 if (view_) | 36 if (view_) |
| 31 view_->Bind(*this); | 37 view_->Bind(this); |
| 32 } | 38 } |
| 33 | 39 |
| 34 EulaScreen::~EulaScreen() { | 40 EulaScreen::~EulaScreen() { |
| 35 if (view_) | 41 if (view_) |
| 36 view_->Unbind(); | 42 view_->Unbind(); |
| 37 } | 43 } |
| 38 | 44 |
| 39 void EulaScreen::Show() { | 45 void EulaScreen::Show() { |
| 40 // Command to own the TPM. | 46 // Command to own the TPM. |
| 41 DBusThreadManager::Get()->GetCryptohomeClient()->TpmCanAttemptOwnership( | 47 DBusThreadManager::Get()->GetCryptohomeClient()->TpmCanAttemptOwnership( |
| 42 EmptyVoidDBusMethodCallback()); | 48 EmptyVoidDBusMethodCallback()); |
| 43 if (policy::DeviceCloudPolicyManagerChromeOS::GetZeroTouchEnrollmentMode() == | 49 if (policy::DeviceCloudPolicyManagerChromeOS::GetZeroTouchEnrollmentMode() == |
| 44 policy::ZeroTouchEnrollmentMode::HANDS_OFF) | 50 policy::ZeroTouchEnrollmentMode::HANDS_OFF) |
| 45 OnUserAction(EulaModel::kUserActionAcceptButtonClicked); | 51 OnUserAction(kUserActionAcceptButtonClicked); |
| 46 else if (view_) | 52 else if (view_) |
| 47 view_->Show(); | 53 view_->Show(); |
| 48 } | 54 } |
| 49 | 55 |
| 50 void EulaScreen::Hide() { | 56 void EulaScreen::Hide() { |
| 51 if (view_) | 57 if (view_) |
| 52 view_->Hide(); | 58 view_->Hide(); |
| 53 } | 59 } |
| 54 | 60 |
| 55 GURL EulaScreen::GetOemEulaUrl() const { | 61 GURL EulaScreen::GetOemEulaUrl() const { |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 105 | 111 |
| 106 void EulaScreen::OnContextKeyUpdated( | 112 void EulaScreen::OnContextKeyUpdated( |
| 107 const ::login::ScreenContext::KeyType& key) { | 113 const ::login::ScreenContext::KeyType& key) { |
| 108 if (key == kContextKeyUsageStatsEnabled && delegate_) { | 114 if (key == kContextKeyUsageStatsEnabled && delegate_) { |
| 109 delegate_->SetUsageStatisticsReporting( | 115 delegate_->SetUsageStatisticsReporting( |
| 110 context_.GetBoolean(kContextKeyUsageStatsEnabled)); | 116 context_.GetBoolean(kContextKeyUsageStatsEnabled)); |
| 111 } | 117 } |
| 112 } | 118 } |
| 113 | 119 |
| 114 } // namespace chromeos | 120 } // namespace chromeos |
| OLD | NEW |