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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 void TermsOfServiceScreenHandler::SetDelegate(Delegate* screen) { | 75 void TermsOfServiceScreenHandler::SetDelegate(Delegate* screen) { |
76 screen_ = screen; | 76 screen_ = screen; |
77 } | 77 } |
78 | 78 |
79 void TermsOfServiceScreenHandler::Show() { | 79 void TermsOfServiceScreenHandler::Show() { |
80 if (!page_is_ready()) { | 80 if (!page_is_ready()) { |
81 show_on_init_ = true; | 81 show_on_init_ = true; |
82 return; | 82 return; |
83 } | 83 } |
84 | 84 |
85 const std::string locale = ProfileHelper::Get()->GetProfileByUser( | 85 const std::string locale = |
86 UserManager::Get()->GetActiveUser())->GetPrefs()->GetString( | 86 ProfileHelper::Get() |
87 prefs::kApplicationLocale); | 87 ->GetProfileByUserUnsafe(UserManager::Get()->GetActiveUser()) |
| 88 ->GetPrefs() |
| 89 ->GetString(prefs::kApplicationLocale); |
88 if (locale.empty() || locale == g_browser_process->GetApplicationLocale()) { | 90 if (locale.empty() || locale == g_browser_process->GetApplicationLocale()) { |
89 // If the user has not chosen a UI locale yet or the chosen locale matches | 91 // If the user has not chosen a UI locale yet or the chosen locale matches |
90 // the current UI locale, show the screen immediately. | 92 // the current UI locale, show the screen immediately. |
91 DoShow(); | 93 DoShow(); |
92 return; | 94 return; |
93 } | 95 } |
94 | 96 |
95 // Switch to the user's UI locale before showing the screen. | 97 // Switch to the user's UI locale before showing the screen. |
96 scoped_ptr<locale_util::SwitchLanguageCallback> callback( | 98 scoped_ptr<locale_util::SwitchLanguageCallback> callback( |
97 new locale_util::SwitchLanguageCallback( | 99 new locale_util::SwitchLanguageCallback( |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 ->GetLocalizedStrings(&localized_strings); | 143 ->GetLocalizedStrings(&localized_strings); |
142 core_oobe_actor_->ReloadContent(localized_strings); | 144 core_oobe_actor_->ReloadContent(localized_strings); |
143 | 145 |
144 DoShow(); | 146 DoShow(); |
145 } | 147 } |
146 | 148 |
147 void TermsOfServiceScreenHandler::DoShow() { | 149 void TermsOfServiceScreenHandler::DoShow() { |
148 // Determine the user's most preferred input method. | 150 // Determine the user's most preferred input method. |
149 std::vector<std::string> input_methods; | 151 std::vector<std::string> input_methods; |
150 base::SplitString( | 152 base::SplitString( |
151 ProfileHelper::Get()->GetProfileByUser( | 153 ProfileHelper::Get() |
152 UserManager::Get()->GetActiveUser())->GetPrefs()->GetString( | 154 ->GetProfileByUserUnsafe(UserManager::Get()->GetActiveUser()) |
153 prefs::kLanguagePreloadEngines), | 155 ->GetPrefs() |
| 156 ->GetString(prefs::kLanguagePreloadEngines), |
154 ',', | 157 ',', |
155 &input_methods); | 158 &input_methods); |
156 | 159 |
157 if (!input_methods.empty()) { | 160 if (!input_methods.empty()) { |
158 // If the user has a preferred input method, enable it and switch to it. | 161 // If the user has a preferred input method, enable it and switch to it. |
159 chromeos::input_method::InputMethodManager* input_method_manager = | 162 chromeos::input_method::InputMethodManager* input_method_manager = |
160 chromeos::input_method::InputMethodManager::Get(); | 163 chromeos::input_method::InputMethodManager::Get(); |
161 input_method_manager->EnableInputMethod(input_methods.front()); | 164 input_method_manager->EnableInputMethod(input_methods.front()); |
162 input_method_manager->ChangeInputMethod(input_methods.front()); | 165 input_method_manager->ChangeInputMethod(input_methods.front()); |
163 } | 166 } |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 // and continue" button should not be accessible. If the user managed to | 206 // and continue" button should not be accessible. If the user managed to |
204 // activate it somehow anway, do not treat this as acceptance of the Terms | 207 // activate it somehow anway, do not treat this as acceptance of the Terms |
205 // and Conditions and end the session instead, as if the user had declined. | 208 // and Conditions and end the session instead, as if the user had declined. |
206 if (terms_of_service_.empty()) | 209 if (terms_of_service_.empty()) |
207 screen_->OnDecline(); | 210 screen_->OnDecline(); |
208 else | 211 else |
209 screen_->OnAccept(); | 212 screen_->OnAccept(); |
210 } | 213 } |
211 | 214 |
212 } // namespace chromeos | 215 } // namespace chromeos |
OLD | NEW |