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

Unified Diff: trunk/src/chrome/browser/chromeos/login/screens/chrome_user_selection_screen.cc

Issue 441143002: Revert 287581 "Allow recommended locales to be set for public se..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 6 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: trunk/src/chrome/browser/chromeos/login/screens/chrome_user_selection_screen.cc
===================================================================
--- trunk/src/chrome/browser/chromeos/login/screens/chrome_user_selection_screen.cc (revision 287633)
+++ trunk/src/chrome/browser/chromeos/login/screens/chrome_user_selection_screen.cc (working copy)
@@ -6,24 +6,15 @@
#include "base/bind.h"
#include "base/location.h"
-#include "base/logging.h"
-#include "base/memory/scoped_ptr.h"
#include "base/message_loop/message_loop.h"
#include "base/strings/utf_string_conversions.h"
-#include "base/values.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/browser_process_platform_part.h"
#include "chrome/browser/chromeos/login/users/user_manager.h"
#include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h"
-#include "chrome/browser/ui/webui/chromeos/login/l10n_util.h"
#include "chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h"
-#include "components/policy/core/common/cloud/cloud_policy_core.h"
-#include "components/policy/core/common/cloud/cloud_policy_store.h"
-#include "components/policy/core/common/policy_map.h"
-#include "components/policy/core/common/policy_types.h"
#include "components/user_manager/user.h"
#include "components/user_manager/user_type.h"
-#include "policy/policy_constants.h"
namespace chromeos {
@@ -63,7 +54,6 @@
return;
CheckForPublicSessionDisplayNameChange(broker);
- CheckForPublicSessionLocalePolicyChange(broker);
}
void ChromeUserSelectionScreen::OnDeviceLocalAccountsChanged() {
@@ -101,55 +91,6 @@
user_id));
}
-void ChromeUserSelectionScreen::CheckForPublicSessionLocalePolicyChange(
- policy::DeviceLocalAccountPolicyBroker* broker) {
- const std::string& user_id = broker->user_id();
- const policy::PolicyMap::Entry* entry =
- broker->core()->store()->policy_map().Get(policy::key::kSessionLocales);
-
- // Parse the list of recommended locales set by policy.
- std::vector<std::string> new_recommended_locales;
- base::ListValue const* list = NULL;
- if (entry &&
- entry->level == policy::POLICY_LEVEL_RECOMMENDED &&
- entry->value &&
- entry->value->GetAsList(&list)) {
- for (base::ListValue::const_iterator it = list->begin(); it != list->end();
- ++it) {
- std::string locale;
- if (!(*it)->GetAsString(&locale)) {
- NOTREACHED();
- new_recommended_locales.clear();
- break;
- }
- new_recommended_locales.push_back(locale);
- }
- }
-
- if (new_recommended_locales.empty()) {
- // There are no recommended locales.
- PublicSessionRecommendedLocaleMap::iterator it =
- public_session_recommended_locales_.find(user_id);
- if (it != public_session_recommended_locales_.end()) {
- // If there previously were recommended locales, remove them from
- // |public_session_recommended_locales_| and notify the UI.
- public_session_recommended_locales_.erase(it);
- SetPublicSessionLocales(user_id, &new_recommended_locales);
- }
- return;
- }
-
- // There are recommended locales.
- std::vector<std::string>& recommended_locales =
- public_session_recommended_locales_[user_id];
- if (new_recommended_locales != recommended_locales) {
- // If the list of recommended locales has changed, update
- // |public_session_recommended_locales_| and notify the UI.
- recommended_locales = new_recommended_locales;
- SetPublicSessionLocales(user_id, &new_recommended_locales);
- }
-}
-
void ChromeUserSelectionScreen::SetPublicSessionDisplayName(
const std::string& user_id) {
const user_manager::User* user = UserManager::Get()->FindUser(user_id);
@@ -161,33 +102,4 @@
base::UTF16ToUTF8(user->GetDisplayName()));
}
-void ChromeUserSelectionScreen::SetPublicSessionLocales(
- const std::string& user_id,
- const std::vector<std::string>* recommended_locales) {
- if (!handler_initialized_)
- return;
-
- // Construct the list of available locales. This list consists of the
- // recommended locales, followed by all others.
- scoped_ptr<base::ListValue> locales =
- GetUILanguageList(recommended_locales, std::string());
-
- // Set the initially selected locale. If the list of recommended locales is
- // not empty, select its first entry. Otherwise, select the current UI locale.
- const std::string& default_locale = recommended_locales->empty() ?
- g_browser_process->GetApplicationLocale() : recommended_locales->front();
-
- // Set a flag to indicate whether the list of recommended locales contains at
- // least two entries. This is used to decide whether the public session pod
- // expands to its basic form (for zero or one recommended locales) or the
- // advanced form (two or more recommended locales).
- const bool two_or_more_recommended_locales = recommended_locales->size() >= 2;
-
- // Notify the UI.
- handler_->SetPublicSessionLocales(user_id,
- locales.Pass(),
- default_locale,
- two_or_more_recommended_locales);
-}
-
} // namespace chromeos

Powered by Google App Engine
This is Rietveld 408576698