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

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

Issue 13119011: Enable WebContents elevation for managed users. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Enable the tab elevation for managed users. Created 7 years, 9 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: chrome/browser/ui/webui/options/managed_user_passphrase_handler.cc
diff --git a/chrome/browser/ui/webui/options/managed_user_passphrase_handler.cc b/chrome/browser/ui/webui/options/managed_user_passphrase_handler.cc
index de6106d09c8a8a4eed647c01ae3f4580e8599b55..2090137358c1a1389042bbafb7edae0fcd57a500 100644
--- a/chrome/browser/ui/webui/options/managed_user_passphrase_handler.cc
+++ b/chrome/browser/ui/webui/options/managed_user_passphrase_handler.cc
@@ -8,6 +8,7 @@
#include "base/logging.h"
#include "base/prefs/pref_service.h"
#include "base/values.h"
+#include "chrome/browser/managed_mode/managed_mode_navigation_observer.h"
#include "chrome/browser/managed_mode/managed_user_passphrase.h"
#include "chrome/browser/managed_mode/managed_user_service.h"
#include "chrome/browser/managed_mode/managed_user_service_factory.h"
@@ -67,9 +68,8 @@ void ManagedUserPassphraseHandler::GetLocalizedValues(
}
void ManagedUserPassphraseHandler::PassphraseDialogCallback(bool success) {
- ManagedUserService* managed_user_service =
- ManagedUserServiceFactory::GetForProfile(Profile::FromWebUI(web_ui()));
- managed_user_service->SetElevated(true);
+ ManagedModeNavigationObserver::FromWebContents(
+ web_ui()->GetWebContents())->set_elevated(success);
base::FundamentalValue unlock_success(success);
web_ui()->CallJavascriptFunction("ManagedUserSettings.isAuthenticated",
unlock_success);
@@ -85,7 +85,8 @@ void ManagedUserPassphraseHandler::SetElevated(
ManagedUserService* managed_user_service =
ManagedUserServiceFactory::GetForProfile(profile);
if (!elevated) {
- managed_user_service->SetElevated(false);
+ ManagedModeNavigationObserver::FromWebContents(
+ web_ui()->GetWebContents())->set_elevated(false);
return;
}
managed_user_service->RequestAuthorization(
@@ -116,10 +117,8 @@ void ManagedUserPassphraseHandler::ResetPassphrase(
void ManagedUserPassphraseHandler::SetLocalPassphrase(
const base::ListValue* args) {
// Only change the passphrase if the custodian is authenticated.
- Profile* profile = Profile::FromWebUI(web_ui());
- ManagedUserService* managed_user_service =
- ManagedUserServiceFactory::GetForProfile(profile);
- if (!managed_user_service->IsElevated())
+ if (!ManagedModeNavigationObserver::FromWebContents(
+ web_ui()->GetWebContents())->is_elevated())
return;
std::string passphrase;

Powered by Google App Engine
This is Rietveld 408576698