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

Unified Diff: chrome/browser/ui/webui/options/managed_user_settings_handler.cc

Issue 13778004: Start in elevated mode when creating a new managed user profile. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Replace user preference with boolean flag. Created 7 years, 8 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/managed_user_settings_handler.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/webui/options/managed_user_settings_handler.cc
diff --git a/chrome/browser/ui/webui/options/managed_user_settings_handler.cc b/chrome/browser/ui/webui/options/managed_user_settings_handler.cc
index c4055829f77f9af35480bb35def68177dcdf8480..0da0ed5b4103547aebe297fd1487d3ea3c413bf6 100644
--- a/chrome/browser/ui/webui/options/managed_user_settings_handler.cc
+++ b/chrome/browser/ui/webui/options/managed_user_settings_handler.cc
@@ -13,7 +13,6 @@
#include "base/prefs/pref_service.h"
#include "base/time.h"
#include "base/values.h"
-#include "chrome/browser/first_run/first_run.h"
#include "chrome/browser/managed_mode/managed_mode_navigation_observer.h"
#include "chrome/browser/managed_mode/managed_user_service.h"
#include "chrome/browser/managed_mode/managed_user_service_factory.h"
@@ -92,7 +91,8 @@ void AddCurrentURLEntries(content::WebUI* web_ui, ListValue* entries) {
namespace options {
-ManagedUserSettingsHandler::ManagedUserSettingsHandler() {
+ManagedUserSettingsHandler::ManagedUserSettingsHandler()
+ : has_seen_settings_dialog_(false) {
}
ManagedUserSettingsHandler::~ManagedUserSettingsHandler() {
@@ -111,19 +111,14 @@ void ManagedUserSettingsHandler::InitializePage() {
switches::kEnableManagedUsers)) {
return;
}
+
PrefService* pref_service = Profile::FromWebUI(web_ui())->GetPrefs();
- base::FundamentalValue is_passphrase_set(!pref_service->GetString(
- prefs::kManagedModeLocalPassphrase).empty());
+ bool passphrase_empty =
+ pref_service->GetString(prefs::kManagedModeLocalPassphrase).empty();
+ base::FundamentalValue is_passphrase_set(!passphrase_empty);
web_ui()->CallJavascriptFunction(
"ManagedUserSettings.passphraseChanged",
is_passphrase_set);
- if ((first_run::IsChromeFirstRun() &&
- !CommandLine::ForCurrentProcess()->HasSwitch(switches::kNoFirstRun)) ||
- CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kResetLocalPassphrase)) {
- ManagedModeNavigationObserver::FromWebContents(
- web_ui()->GetWebContents())->set_elevated(true);
- }
// Populate the list.
UpdateViewFromModel();
@@ -132,8 +127,20 @@ void ManagedUserSettingsHandler::InitializePage() {
void ManagedUserSettingsHandler::HandlePageOpened(const base::ListValue* args) {
start_time_ = base::TimeTicks::Now();
content::RecordAction(UserMetricsAction("ManagedMode_OpenSettings"));
- if (ManagedModeNavigationObserver::FromWebContents(
- web_ui()->GetWebContents())->is_elevated()) {
+ ManagedUserService* service = ManagedUserServiceFactory::GetForProfile(
+ Profile::FromWebUI(web_ui()));
+ ManagedModeNavigationObserver* observer =
+ ManagedModeNavigationObserver::FromWebContents(
+ web_ui()->GetWebContents());
+
+ // Check if we need to give initial elevation for startup of a new profile.
+ if (service->startup_elevation()) {
+ service->set_startup_elevation(false);
+ observer->set_elevated(true);
+ has_seen_settings_dialog_ = false;
Bernhard Bauer 2013/04/10 12:17:12 Why do you set this to false again?
Adrian Kuegel 2013/04/10 12:22:42 Oh, the bug is in fact in the constructor. I shoul
+ }
+
+ if (observer->is_elevated()) {
web_ui()->CallJavascriptFunction("ManagedUserSettings.isAuthenticated",
base::FundamentalValue(true));
}
@@ -207,7 +214,8 @@ void ManagedUserSettingsHandler::RegisterMessages() {
}
void ManagedUserSettingsHandler::SaveMetrics(const ListValue* args) {
- if (first_run::IsChromeFirstRun()) {
+ if (!has_seen_settings_dialog_) {
+ has_seen_settings_dialog_ = true;
UMA_HISTOGRAM_LONG_TIMES("ManagedMode.UserSettingsFirstRunTime",
base::TimeTicks::Now() - start_time_);
} else {
« no previous file with comments | « chrome/browser/ui/webui/options/managed_user_settings_handler.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698