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

Unified Diff: chrome/browser/ui/webui/options/chromeos/internet_options_handler.cc

Issue 23447027: Merge 222390 "network_list.js should reflect the correct logged ..." (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1599/src/
Patch Set: Created 7 years, 3 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
« no previous file with comments | « chrome/browser/ui/webui/options/chromeos/internet_options_handler.h ('k') | chromeos/login/login_state.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/webui/options/chromeos/internet_options_handler.cc
===================================================================
--- chrome/browser/ui/webui/options/chromeos/internet_options_handler.cc (revision 222879)
+++ chrome/browser/ui/webui/options/chromeos/internet_options_handler.cc (working copy)
@@ -136,6 +136,8 @@
"options.internet.DetailsInternetPage.updateConnectionData";
const char kUpdateCarrierFunction[] =
"options.internet.DetailsInternetPage.updateCarrier";
+const char kUpdateLoggedInUserTypeFunction[] =
+ "options.network.NetworkList.updateLoggedInUserType";
const char kUpdateSecurityTabFunction[] =
"options.internet.DetailsInternetPage.updateSecurityTab";
@@ -342,6 +344,30 @@
return l10n_util::GetStringUTF8(id);
}
+std::string LoggedInUserTypeToString(
+ LoginState::LoggedInUserType type) {
+ switch (type) {
+ case LoginState::LOGGED_IN_USER_NONE:
+ return "none";
+ case LoginState::LOGGED_IN_USER_REGULAR:
+ return "regular";
+ case LoginState::LOGGED_IN_USER_OWNER:
+ return "owner";
+ case LoginState::LOGGED_IN_USER_GUEST:
+ return "guest";
+ case LoginState::LOGGED_IN_USER_RETAIL_MODE:
+ return "retail-mode";
+ case LoginState::LOGGED_IN_USER_PUBLIC_ACCOUNT:
+ return "public-account";
+ case LoginState::LOGGED_IN_USER_LOCALLY_MANAGED:
+ return "locally-managed";
+ case LoginState::LOGGED_IN_USER_KIOSK_APP:
+ return "kiosk-app";
+ default:
+ return "";
+ }
+}
+
std::string EncryptionString(const std::string& security,
const std::string& eap_method) {
if (security == flimflam::kSecurityNone)
@@ -772,6 +798,7 @@
registrar_.Add(this, chrome::NOTIFICATION_ENTER_PIN_ENDED,
content::NotificationService::AllSources());
NetworkHandler::Get()->network_state_handler()->AddObserver(this, FROM_HERE);
+ LoginState::Get()->AddObserver(this);
}
InternetOptionsHandler::~InternetOptionsHandler() {
@@ -779,6 +806,8 @@
NetworkHandler::Get()->network_state_handler()->RemoveObserver(
this, FROM_HERE);
}
+ if (LoginState::Get()->IsInitialized())
+ LoginState::Get()->RemoveObserver(this);
}
void InternetOptionsHandler::GetLocalizedValues(
@@ -962,6 +991,7 @@
dictionary);
NetworkHandler::Get()->network_state_handler()->RequestScan();
RefreshNetworkData();
+ UpdateLoggedInUserType();
}
void InternetOptionsHandler::RegisterMessages() {
@@ -1300,6 +1330,20 @@
UpdateConnectionData(network->path());
}
+void InternetOptionsHandler::LoggedInStateChanged(
+ LoginState::LoggedInState state) {
+ UpdateLoggedInUserType();
+}
+
+void InternetOptionsHandler::UpdateLoggedInUserType() {
+ if (!web_ui())
+ return;
+ base::StringValue login_type(
+ LoggedInUserTypeToString(LoginState::Get()->GetLoggedInUserType()));
+ web_ui()->CallJavascriptFunction(
+ kUpdateLoggedInUserTypeFunction, login_type);
+}
+
void InternetOptionsHandler::Observe(
int type,
const content::NotificationSource& source,
« no previous file with comments | « chrome/browser/ui/webui/options/chromeos/internet_options_handler.h ('k') | chromeos/login/login_state.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698