| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/terms_of_service_screen_handler
.h" | 5 #include "chrome/browser/ui/webui/chromeos/login/terms_of_service_screen_handler
.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 ->GetString(prefs::kApplicationLocale); | 91 ->GetString(prefs::kApplicationLocale); |
| 92 | 92 |
| 93 if (locale.empty() || locale == g_browser_process->GetApplicationLocale()) { | 93 if (locale.empty() || locale == g_browser_process->GetApplicationLocale()) { |
| 94 // If the user has not chosen a UI locale yet or the chosen locale matches | 94 // If the user has not chosen a UI locale yet or the chosen locale matches |
| 95 // the current UI locale, show the screen immediately. | 95 // the current UI locale, show the screen immediately. |
| 96 DoShow(); | 96 DoShow(); |
| 97 return; | 97 return; |
| 98 } | 98 } |
| 99 | 99 |
| 100 // Switch to the user's UI locale before showing the screen. | 100 // Switch to the user's UI locale before showing the screen. |
| 101 scoped_ptr<locale_util::SwitchLanguageCallback> callback( | 101 locale_util::SwitchLanguageCallback callback( |
| 102 new locale_util::SwitchLanguageCallback( | 102 base::Bind(&TermsOfServiceScreenHandler::OnLanguageChangedCallback, |
| 103 base::Bind(&TermsOfServiceScreenHandler::OnLanguageChangedCallback, | 103 base::Unretained(this))); |
| 104 base::Unretained(this)))); | |
| 105 locale_util::SwitchLanguage(locale, | 104 locale_util::SwitchLanguage(locale, |
| 106 true, // enable_locale_keyboard_layouts | 105 true, // enable_locale_keyboard_layouts |
| 107 false, // login_layouts_only | 106 false, // login_layouts_only |
| 108 callback.Pass()); | 107 callback); |
| 109 } | 108 } |
| 110 | 109 |
| 111 void TermsOfServiceScreenHandler::Hide() { | 110 void TermsOfServiceScreenHandler::Hide() { |
| 112 } | 111 } |
| 113 | 112 |
| 114 void TermsOfServiceScreenHandler::SetDomain(const std::string& domain) { | 113 void TermsOfServiceScreenHandler::SetDomain(const std::string& domain) { |
| 115 domain_ = domain; | 114 domain_ = domain; |
| 116 UpdateDomainInUI(); | 115 UpdateDomainInUI(); |
| 117 } | 116 } |
| 118 | 117 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 130 } | 129 } |
| 131 | 130 |
| 132 void TermsOfServiceScreenHandler::Initialize() { | 131 void TermsOfServiceScreenHandler::Initialize() { |
| 133 if (show_on_init_) { | 132 if (show_on_init_) { |
| 134 Show(); | 133 Show(); |
| 135 show_on_init_ = false; | 134 show_on_init_ = false; |
| 136 } | 135 } |
| 137 } | 136 } |
| 138 | 137 |
| 139 void TermsOfServiceScreenHandler::OnLanguageChangedCallback( | 138 void TermsOfServiceScreenHandler::OnLanguageChangedCallback( |
| 140 const std::string& requested_locale, | 139 const locale_util::LanguageSwitchResult& result) { |
| 141 const std::string& loaded_locale, | |
| 142 const bool success) { | |
| 143 // Update the screen contents to the new locale. | 140 // Update the screen contents to the new locale. |
| 144 base::DictionaryValue localized_strings; | 141 base::DictionaryValue localized_strings; |
| 145 static_cast<OobeUI*>(web_ui()->GetController()) | 142 static_cast<OobeUI*>(web_ui()->GetController()) |
| 146 ->GetLocalizedStrings(&localized_strings); | 143 ->GetLocalizedStrings(&localized_strings); |
| 147 core_oobe_actor_->ReloadContent(localized_strings); | 144 core_oobe_actor_->ReloadContent(localized_strings); |
| 148 | 145 |
| 149 DoShow(); | 146 DoShow(); |
| 150 } | 147 } |
| 151 | 148 |
| 152 void TermsOfServiceScreenHandler::DoShow() { | 149 void TermsOfServiceScreenHandler::DoShow() { |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 // and continue" button should not be accessible. If the user managed to | 209 // and continue" button should not be accessible. If the user managed to |
| 213 // activate it somehow anway, do not treat this as acceptance of the Terms | 210 // activate it somehow anway, do not treat this as acceptance of the Terms |
| 214 // and Conditions and end the session instead, as if the user had declined. | 211 // and Conditions and end the session instead, as if the user had declined. |
| 215 if (terms_of_service_.empty()) | 212 if (terms_of_service_.empty()) |
| 216 screen_->OnDecline(); | 213 screen_->OnDecline(); |
| 217 else | 214 else |
| 218 screen_->OnAccept(); | 215 screen_->OnAccept(); |
| 219 } | 216 } |
| 220 | 217 |
| 221 } // namespace chromeos | 218 } // namespace chromeos |
| OLD | NEW |