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

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

Issue 23466015: network_list.js should reflect the correct logged in user type. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased and addressed stevenjb@'s comments. 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
diff --git a/chrome/browser/ui/webui/options/chromeos/internet_options_handler.cc b/chrome/browser/ui/webui/options/chromeos/internet_options_handler.cc
index bed50f60935f27adeddc9ff0e57c09c3a09a6d16..14cf2d36b09f4f58c8ab3d9352d22305113383a7 100644
--- a/chrome/browser/ui/webui/options/chromeos/internet_options_handler.cc
+++ b/chrome/browser/ui/webui/options/chromeos/internet_options_handler.cc
@@ -135,6 +135,8 @@ const char kUpdateConnectionDataFunction[] =
"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";
@@ -341,6 +343,30 @@ std::string ConnectionStateString(const std::string& state) {
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)
@@ -777,6 +803,7 @@ InternetOptionsHandler::InternetOptionsHandler()
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() {
@@ -784,6 +811,8 @@ InternetOptionsHandler::~InternetOptionsHandler() {
NetworkHandler::Get()->network_state_handler()->RemoveObserver(
this, FROM_HERE);
}
+ if (LoginState::Get()->IsInitialized())
+ LoginState::Get()->RemoveObserver(this);
}
void InternetOptionsHandler::GetLocalizedValues(
@@ -967,6 +996,7 @@ void InternetOptionsHandler::InitializePage() {
dictionary);
NetworkHandler::Get()->network_state_handler()->RequestScan();
RefreshNetworkData();
+ UpdateLoggedInUserType();
}
void InternetOptionsHandler::RegisterMessages() {
@@ -1315,6 +1345,20 @@ void InternetOptionsHandler::NetworkPropertiesUpdated(
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