Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1617)

Side by Side Diff: chrome/browser/ui/webui/chromeos/login/terms_of_service_screen_handler.cc

Issue 653123002: Revert of ChromeOS NetworkScreenHandler should not call CheckAndResolveLocale on UI thread. (patchs… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/ui/webui/chromeos/login/terms_of_service_screen_handler.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 locale_util::SwitchLanguageCallback callback( 101 scoped_ptr<locale_util::SwitchLanguageCallback> callback(
102 base::Bind(&TermsOfServiceScreenHandler::OnLanguageChangedCallback, 102 new locale_util::SwitchLanguageCallback(
103 base::Unretained(this))); 103 base::Bind(&TermsOfServiceScreenHandler::OnLanguageChangedCallback,
104 base::Unretained(this))));
104 locale_util::SwitchLanguage(locale, 105 locale_util::SwitchLanguage(locale,
105 true, // enable_locale_keyboard_layouts 106 true, // enable_locale_keyboard_layouts
106 false, // login_layouts_only 107 false, // login_layouts_only
107 callback); 108 callback.Pass());
108 } 109 }
109 110
110 void TermsOfServiceScreenHandler::Hide() { 111 void TermsOfServiceScreenHandler::Hide() {
111 } 112 }
112 113
113 void TermsOfServiceScreenHandler::SetDomain(const std::string& domain) { 114 void TermsOfServiceScreenHandler::SetDomain(const std::string& domain) {
114 domain_ = domain; 115 domain_ = domain;
115 UpdateDomainInUI(); 116 UpdateDomainInUI();
116 } 117 }
117 118
(...skipping 11 matching lines...) Expand all
129 } 130 }
130 131
131 void TermsOfServiceScreenHandler::Initialize() { 132 void TermsOfServiceScreenHandler::Initialize() {
132 if (show_on_init_) { 133 if (show_on_init_) {
133 Show(); 134 Show();
134 show_on_init_ = false; 135 show_on_init_ = false;
135 } 136 }
136 } 137 }
137 138
138 void TermsOfServiceScreenHandler::OnLanguageChangedCallback( 139 void TermsOfServiceScreenHandler::OnLanguageChangedCallback(
139 const locale_util::LanguageSwitchResult& result) { 140 const std::string& requested_locale,
141 const std::string& loaded_locale,
142 const bool success) {
140 // Update the screen contents to the new locale. 143 // Update the screen contents to the new locale.
141 base::DictionaryValue localized_strings; 144 base::DictionaryValue localized_strings;
142 static_cast<OobeUI*>(web_ui()->GetController()) 145 static_cast<OobeUI*>(web_ui()->GetController())
143 ->GetLocalizedStrings(&localized_strings); 146 ->GetLocalizedStrings(&localized_strings);
144 core_oobe_actor_->ReloadContent(localized_strings); 147 core_oobe_actor_->ReloadContent(localized_strings);
145 148
146 DoShow(); 149 DoShow();
147 } 150 }
148 151
149 void TermsOfServiceScreenHandler::DoShow() { 152 void TermsOfServiceScreenHandler::DoShow() {
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 // and continue" button should not be accessible. If the user managed to 212 // and continue" button should not be accessible. If the user managed to
210 // activate it somehow anway, do not treat this as acceptance of the Terms 213 // activate it somehow anway, do not treat this as acceptance of the Terms
211 // and Conditions and end the session instead, as if the user had declined. 214 // and Conditions and end the session instead, as if the user had declined.
212 if (terms_of_service_.empty()) 215 if (terms_of_service_.empty())
213 screen_->OnDecline(); 216 screen_->OnDecline();
214 else 217 else
215 screen_->OnAccept(); 218 screen_->OnAccept();
216 } 219 }
217 220
218 } // namespace chromeos 221 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/chromeos/login/terms_of_service_screen_handler.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698