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/ui/webui/chromeos/login/eula_screen_handler.h" | 5 #include "chrome/browser/ui/webui/chromeos/login/eula_screen_handler.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/values.h" | 9 #include "base/values.h" |
10 #include "chrome/browser/chromeos/login/help_app_launcher.h" | 10 #include "chrome/browser/chromeos/login/help_app_launcher.h" |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 AddCallback("eulaOnLearnMore", &EulaScreenHandler::HandleOnLearnMore); | 104 AddCallback("eulaOnLearnMore", &EulaScreenHandler::HandleOnLearnMore); |
105 AddCallback("eulaOnInstallationSettingsPopupOpened", | 105 AddCallback("eulaOnInstallationSettingsPopupOpened", |
106 &EulaScreenHandler::HandleOnInstallationSettingsPopupOpened); | 106 &EulaScreenHandler::HandleOnInstallationSettingsPopupOpened); |
107 } | 107 } |
108 | 108 |
109 void EulaScreenHandler::OnPasswordFetched(const std::string& tpm_password) { | 109 void EulaScreenHandler::OnPasswordFetched(const std::string& tpm_password) { |
110 StringValue tpm_password_value(tpm_password); | 110 StringValue tpm_password_value(tpm_password); |
111 CallJS("cr.ui.Oobe.setTpmPassword", tpm_password_value); | 111 CallJS("cr.ui.Oobe.setTpmPassword", tpm_password_value); |
112 } | 112 } |
113 | 113 |
114 void EulaScreenHandler::HandleOnExit(const base::ListValue* args) { | 114 void EulaScreenHandler::HandleOnExit(bool accepted, bool usage_stats_enabled) { |
115 DCHECK(args->GetSize() == 2); | 115 if (delegate_) |
116 | 116 delegate_->OnExit(accepted, usage_stats_enabled); |
117 bool accepted = false; | |
118 if (!args->GetBoolean(0, &accepted)) | |
119 NOTREACHED(); | |
120 | |
121 bool usage_stats_enabled = false; | |
122 if (!args->GetBoolean(1, &usage_stats_enabled)) | |
123 NOTREACHED(); | |
124 | |
125 if (!delegate_) | |
126 return; | |
127 | |
128 delegate_->OnExit(accepted, usage_stats_enabled); | |
129 } | 117 } |
130 | 118 |
131 void EulaScreenHandler::HandleOnLearnMore(const base::ListValue* args) { | 119 void EulaScreenHandler::HandleOnLearnMore() { |
132 if (!help_app_.get()) { | 120 if (!help_app_.get()) |
133 help_app_ = new HelpAppLauncher(GetNativeWindow()); | 121 help_app_ = new HelpAppLauncher(GetNativeWindow()); |
134 } | |
135 help_app_->ShowHelpTopic(HelpAppLauncher::HELP_STATS_USAGE); | 122 help_app_->ShowHelpTopic(HelpAppLauncher::HELP_STATS_USAGE); |
136 } | 123 } |
137 | 124 |
138 void EulaScreenHandler::HandleOnInstallationSettingsPopupOpened( | 125 void EulaScreenHandler::HandleOnInstallationSettingsPopupOpened() { |
139 const base::ListValue* args) { | 126 if (delegate_) |
140 if (!delegate_) | 127 delegate_->InitiatePasswordFetch(); |
141 return; | |
142 delegate_->InitiatePasswordFetch(); | |
143 } | 128 } |
144 | 129 |
145 } // namespace chromeos | 130 } // namespace chromeos |
OLD | NEW |