summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/app/generated_resources.grd14
-rw-r--r--chrome/browser/browser_resources.grd2
-rw-r--r--chrome/browser/managed_mode/managed_mode_navigation_observer.cc21
-rw-r--r--chrome/browser/managed_mode/managed_mode_navigation_observer.h10
-rw-r--r--chrome/browser/managed_mode/managed_user_passphrase.cc66
-rw-r--r--chrome/browser/managed_mode/managed_user_passphrase.h38
-rw-r--r--chrome/browser/managed_mode/managed_user_passphrase_unittest.cc68
-rw-r--r--chrome/browser/managed_mode/managed_user_service.cc47
-rw-r--r--chrome/browser/managed_mode/managed_user_service.h19
-rw-r--r--chrome/browser/resources/managed_user_passphrase_dialog.css35
-rw-r--r--chrome/browser/resources/managed_user_passphrase_dialog.html42
-rw-r--r--chrome/browser/resources/managed_user_passphrase_dialog.js45
-rw-r--r--chrome/browser/ui/webui/managed_user_passphrase_dialog.cc183
-rw-r--r--chrome/browser/ui/webui/managed_user_passphrase_dialog.h64
-rw-r--r--chrome/chrome_browser.gypi2
-rw-r--r--chrome/chrome_browser_ui.gypi2
-rw-r--r--chrome/chrome_tests_unit.gypi2
-rw-r--r--chrome/common/chrome_switches.cc4
-rw-r--r--chrome/common/chrome_switches.h1
-rw-r--r--chrome/common/pref_names.cc7
-rw-r--r--chrome/common/pref_names.h2
21 files changed, 1 insertions, 673 deletions
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd
index 81171ba..8e60c46 100644
--- a/chrome/app/generated_resources.grd
+++ b/chrome/app/generated_resources.grd
@@ -8229,20 +8229,6 @@ The following plug-in is unresponsive: <ph name="PLUGIN_NAME">$1
the beginning of time
</message>
- <!--Managed mode passphrase dialog data -->
- <message name="IDS_PASSPHRASE_TITLE" desc="A title for the passphrase page to unlock managed user settings.">
- Unlock
- </message>
- <message name="IDS_PASSPHRASE_INSTRUCTION" desc="Instruction to enter an unlock passphrase to unlock a page not accessible to the managed user.">
- Enter passphrase to unlock and make changes.
- </message>
- <message name="IDS_UNLOCK_PASSPHRASE_BUTTON" desc="A button for unlocking the managed user settings page.">
- Unlock
- </message>
- <message name="IDS_INCORRECT_PASSPHRASE_WARNING" desc="A warning for the passphrase page if the incorrect passphrase was entered.">
- The passphrase you entered is incorrect.
- </message>
-
<!-- Managed User Avatar Menu -->
<message name="IDS_MANAGED_USER_INFO" desc="A text which explains that the user is managed by a custodian.">
This user is managed by <ph name="CUSTODIAN_NAME">$1<ex>custodian@gmail.com</ex></ph>. Usage and history from this user may be tracked.
diff --git a/chrome/browser/browser_resources.grd b/chrome/browser/browser_resources.grd
index 0f4955a..812f8e6 100644
--- a/chrome/browser/browser_resources.grd
+++ b/chrome/browser/browser_resources.grd
@@ -62,7 +62,6 @@
<structure name="IDR_SSL_FIREFOX_HTML" file="resources\ssl\firefox.html" flattenhtml="true" type="chrome_html" />
<structure name="IDR_SSL_FANCY_FIREFOX_HTML" file="resources\ssl\fancy_firefox.html" flattenhtml="true" type="chrome_html" />
<structure name="IDR_SAFE_BROWSING_MALWARE_BLOCK_V2" file="resources\safe_browsing\malware_block_v2.html" flattenhtml="true" type="chrome_html" />
- <structure name="IDR_MANAGED_USER_PASSPHRASE_DIALOG_HTML" file="resources\managed_user_passphrase_dialog.html" flattenhtml="true" type="chrome_html" />
</structures>
<includes>
<if expr="is_win">
@@ -356,7 +355,6 @@
<include name="IDR_SET_AS_DEFAULT_BROWSER_HTML" file="resources\set_as_default_browser.html" flattenhtml="true" allowexternalscript="true" type="BINDATA" />
</if>
<include name="IDR_MANAGED_MODE_BLOCK_INTERSTITIAL_HTML" file="resources\managed_mode_block_interstitial.html" flattenhtml="true" type="BINDATA" />
- <include name="IDR_MANAGED_USER_PASSPHRASE_DIALOG_JS" file="resources\managed_user_passphrase_dialog.js" type="BINDATA" />
<include name="IDR_PROFILE_SIGNIN_CONFIRMATION_HTML" file="resources\profile_signin_confirmation.html" type="BINDATA" />
<include name="IDR_PROFILE_SIGNIN_CONFIRMATION_JS" file="resources\profile_signin_confirmation.js" type="BINDATA" />
<include name="IDR_PROFILE_SIGNIN_CONFIRMATION_CSS" file="resources\profile_signin_confirmation.css" type="BINDATA" />
diff --git a/chrome/browser/managed_mode/managed_mode_navigation_observer.cc b/chrome/browser/managed_mode/managed_mode_navigation_observer.cc
index 52be427..e474b90 100644
--- a/chrome/browser/managed_mode/managed_mode_navigation_observer.cc
+++ b/chrome/browser/managed_mode/managed_mode_navigation_observer.cc
@@ -162,13 +162,10 @@ ManagedModeNavigationObserver::~ManagedModeNavigationObserver() {
ManagedModeNavigationObserver::ManagedModeNavigationObserver(
content::WebContents* web_contents)
: WebContentsObserver(web_contents),
- warn_infobar_delegate_(NULL),
- is_elevated_(false) {
+ warn_infobar_delegate_(NULL) {
Profile* profile =
Profile::FromBrowserContext(web_contents->GetBrowserContext());
managed_user_service_ = ManagedUserServiceFactory::GetForProfile(profile);
- if (!managed_user_service_->ProfileIsManaged())
- is_elevated_ = true;
url_filter_ = managed_user_service_->GetURLFilterForUIThread();
}
@@ -177,22 +174,6 @@ void ManagedModeNavigationObserver::WarnInfobarDismissed() {
warn_infobar_delegate_ = NULL;
}
-bool ManagedModeNavigationObserver::is_elevated() const {
-#if defined(OS_CHROMEOS)
- return false;
-#else
- return is_elevated_;
-#endif
-}
-
-void ManagedModeNavigationObserver::set_elevated(bool is_elevated) {
-#if defined(OS_CHROMEOS)
- NOTREACHED();
-#else
- is_elevated_ = is_elevated;
-#endif
-}
-
void ManagedModeNavigationObserver::ProvisionalChangeToMainFrameUrl(
const GURL& url,
content::RenderViewHost* render_view_host) {
diff --git a/chrome/browser/managed_mode/managed_mode_navigation_observer.h b/chrome/browser/managed_mode/managed_mode_navigation_observer.h
index 85a3646..ab14e73 100644
--- a/chrome/browser/managed_mode/managed_mode_navigation_observer.h
+++ b/chrome/browser/managed_mode/managed_mode_navigation_observer.h
@@ -29,12 +29,6 @@ class ManagedModeNavigationObserver
// Sets the specific infobar as dismissed.
void WarnInfobarDismissed();
- // Returns the elevation state for the corresponding WebContents.
- bool is_elevated() const;
-
- // Set the elevation state for the corresponding WebContents.
- void set_elevated(bool is_elevated);
-
const std::vector<const content::NavigationEntry*>* blocked_navigations()
const {
return &blocked_navigations_.get();
@@ -75,10 +69,6 @@ class ManagedModeNavigationObserver
ScopedVector<const content::NavigationEntry> blocked_navigations_;
- // The elevation state corresponding to the current WebContents.
- // Will be set to true for non-managed users.
- bool is_elevated_;
-
DISALLOW_COPY_AND_ASSIGN(ManagedModeNavigationObserver);
};
diff --git a/chrome/browser/managed_mode/managed_user_passphrase.cc b/chrome/browser/managed_mode/managed_user_passphrase.cc
deleted file mode 100644
index 16f09c1..0000000
--- a/chrome/browser/managed_mode/managed_user_passphrase.cc
+++ /dev/null
@@ -1,66 +0,0 @@
-// Copyright (c) 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/browser/managed_mode/managed_user_passphrase.h"
-
-#include "base/base64.h"
-#include "base/logging.h"
-#include "base/string_util.h"
-#include "crypto/encryptor.h"
-#include "crypto/random.h"
-#include "crypto/symmetric_key.h"
-
-namespace {
-
-// These constants are used as parameters when calling |DeriveKeyFromPassword|.
-const int kNumberOfIterations = 1;
-const int kDerivedKeySize = 128;
-const int kSaltSize = 32;
-
-} // namespace
-
-ManagedUserPassphrase::ManagedUserPassphrase(const std::string& salt)
- : salt_(salt) {
- if (salt_.empty())
- GenerateRandomSalt();
-}
-
-ManagedUserPassphrase::~ManagedUserPassphrase() {
-}
-
-std::string ManagedUserPassphrase::GetSalt() {
- return salt_;
-}
-
-void ManagedUserPassphrase::GenerateRandomSalt() {
- std::string bytes;
- crypto::RandBytes(WriteInto(&bytes, kSaltSize+1), kSaltSize);
- bool success = base::Base64Encode(bytes, &salt_);
- DCHECK(success);
-}
-
-bool ManagedUserPassphrase::GenerateHashFromPassphrase(
- const std::string& passphrase,
- std::string* encoded_passphrase_hash) const {
- std::string passphrase_hash;
- if (!GetPassphraseHash(passphrase, &passphrase_hash))
- return false;
- return base::Base64Encode(passphrase_hash, encoded_passphrase_hash);
-}
-
-bool ManagedUserPassphrase::GetPassphraseHash(
- const std::string& passphrase,
- std::string* passphrase_hash) const {
- DCHECK(passphrase_hash);
- // Create a hash from the user-provided passphrase and the randomly generated
- // (or provided) salt.
- scoped_ptr<crypto::SymmetricKey> encryption_key(
- crypto::SymmetricKey::DeriveKeyFromPassword(
- crypto::SymmetricKey::AES,
- passphrase,
- salt_,
- kNumberOfIterations,
- kDerivedKeySize));
- return encryption_key->GetRawKey(passphrase_hash);
-}
diff --git a/chrome/browser/managed_mode/managed_user_passphrase.h b/chrome/browser/managed_mode/managed_user_passphrase.h
deleted file mode 100644
index ded2575..0000000
--- a/chrome/browser/managed_mode/managed_user_passphrase.h
+++ /dev/null
@@ -1,38 +0,0 @@
-// Copyright (c) 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CHROME_BROWSER_MANAGED_MODE_MANAGED_USER_PASSPHRASE_H_
-#define CHROME_BROWSER_MANAGED_MODE_MANAGED_USER_PASSPHRASE_H_
-
-#include <string>
-
-#include "base/basictypes.h"
-
-// This class can be used to derive a hash of a provided passphrase. When an
-// empty salt is given as parameter to the constructor, a new salt is
-// generated randomly, which can be accessed through the |GetSalt| method.
-class ManagedUserPassphrase {
- public:
- explicit ManagedUserPassphrase(const std::string& salt);
- ~ManagedUserPassphrase();
-
- std::string GetSalt();
-
- // This function generates a hash from a passphrase, which should be provided
- // as the first parameter. On return, the second parameter will contain the
- // Base64-encoded hash of the password.
- bool GenerateHashFromPassphrase(const std::string& passphrase,
- std::string* encoded_passphrase_hash) const;
-
- private:
- bool GetPassphraseHash(const std::string& passphrase,
- std::string* passphrase_hash) const;
- void GenerateRandomSalt();
-
- std::string salt_;
-
- DISALLOW_COPY_AND_ASSIGN(ManagedUserPassphrase);
-};
-
-#endif // CHROME_BROWSER_MANAGED_MODE_MANAGED_USER_PASSPHRASE_H_
diff --git a/chrome/browser/managed_mode/managed_user_passphrase_unittest.cc b/chrome/browser/managed_mode/managed_user_passphrase_unittest.cc
deleted file mode 100644
index c9f0fbb..0000000
--- a/chrome/browser/managed_mode/managed_user_passphrase_unittest.cc
+++ /dev/null
@@ -1,68 +0,0 @@
-// Copyright (c) 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/browser/managed_mode/managed_user_passphrase.h"
-
-#include <string>
-
-#include "testing/gtest/include/gtest/gtest.h"
-
-// This test checks the class ManagedUserPassphrase when providing a salt
-// as parameter of the constructor.
-TEST(ManagedUserPassphraseTest, WithSaltProvided) {
- std::string salt = "my special salt";
- std::string salt2 = "my other special salt";
- ManagedUserPassphrase instance_with_provided_salt(salt);
- ManagedUserPassphrase other_instance_with_provided_salt(salt2);
-
- // We expect that the provided salt is used internally as well.
- EXPECT_STREQ(salt.c_str(), instance_with_provided_salt.GetSalt().c_str());
- std::string passphrase_hash;
- std::string passphrase = "some_passphrase123";
- EXPECT_TRUE(instance_with_provided_salt.GenerateHashFromPassphrase(
- passphrase,
- &passphrase_hash));
- // As the method generates a Base64 encoded 128 bit key, we expect the
- // passphrase hash to have length at least 7 bytes.
- EXPECT_GE(passphrase_hash.size(), 7u);
-
- // When calling the function with a (slightly) different parameter, we
- // expect to get a different result.
- std::string passphrase2 = passphrase + "4";
- std::string passphrase_hash2;
- EXPECT_TRUE(instance_with_provided_salt.GenerateHashFromPassphrase(
- passphrase2,
- &passphrase_hash2));
- EXPECT_GE(passphrase_hash2.size(), 7u);
- EXPECT_STRNE(passphrase_hash.c_str(), passphrase_hash2.c_str());
-
- // When calling the function again with the first parameter, we expect to
- // get the same result as in the first call.
- EXPECT_TRUE(instance_with_provided_salt.GenerateHashFromPassphrase(
- passphrase,
- &passphrase_hash2));
- EXPECT_STREQ(passphrase_hash.c_str(), passphrase_hash2.c_str());
-
- // When calling the function on the instance with the other salt, but
- // with the same passphrase, we expect to get a different result.
- EXPECT_TRUE(other_instance_with_provided_salt.GenerateHashFromPassphrase(
- passphrase,
- &passphrase_hash2));
- EXPECT_STRNE(passphrase_hash.c_str(), passphrase_hash2.c_str());
-}
-
-// This test checks the class ManagedUserPassphraseTest when no salt is
-// provided as parameter of the constructor.
-TEST(ManagedUserPassphraseTest, WithEmptySalt) {
- ManagedUserPassphrase instance_with_empty_salt((std::string()));
- ManagedUserPassphrase other_instance_with_empty_salt((std::string()));
- std::string salt = instance_with_empty_salt.GetSalt();
- std::string salt2 = other_instance_with_empty_salt.GetSalt();
-
- // We expect that the class will generate a salt randomly, and for different
- // instances a different salt is calculated.
- EXPECT_GT(salt.size(), 0u);
- EXPECT_GT(salt2.size(), 0u);
- EXPECT_STRNE(salt.c_str(), salt2.c_str());
-}
diff --git a/chrome/browser/managed_mode/managed_user_service.cc b/chrome/browser/managed_mode/managed_user_service.cc
index 1e98bc5..668c206 100644
--- a/chrome/browser/managed_mode/managed_user_service.cc
+++ b/chrome/browser/managed_mode/managed_user_service.cc
@@ -12,7 +12,6 @@
#include "base/utf_string_conversions.h"
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/extensions/extension_system.h"
-#include "chrome/browser/managed_mode/managed_mode_navigation_observer.h"
#include "chrome/browser/managed_mode/managed_mode_site_list.h"
#include "chrome/browser/managed_mode/managed_user_registration_service.h"
#include "chrome/browser/policy/managed_mode_policy_provider.h"
@@ -146,43 +145,6 @@ bool ManagedUserService::ProfileIsManaged(Profile* profile) {
return profile->GetPrefs()->GetBoolean(prefs::kProfileIsManaged);
}
-bool ManagedUserService::IsElevatedForWebContents(
- const content::WebContents* web_contents) const {
- const ManagedModeNavigationObserver* observer =
- ManagedModeNavigationObserver::FromWebContents(web_contents);
- return observer ? observer->is_elevated() : false;
-}
-
-bool ManagedUserService::IsPassphraseEmpty() const {
- PrefService* pref_service = profile_->GetPrefs();
- return pref_service->GetString(prefs::kManagedModeLocalPassphrase).empty();
-}
-
-bool ManagedUserService::CanSkipPassphraseDialog(
- const content::WebContents* web_contents) const {
-#if defined(OS_CHROMEOS)
- NOTREACHED();
-#endif
- return IsElevatedForWebContents(web_contents) ||
- IsPassphraseEmpty();
-}
-
-void ManagedUserService::RequestAuthorization(
- content::WebContents* web_contents,
- const PassphraseCheckedCallback& callback) {
-#if defined(OS_CHROMEOS)
- NOTREACHED();
-#endif
-
- if (CanSkipPassphraseDialog(web_contents)) {
- callback.Run(true);
- return;
- }
-
- // Is deleted automatically when the dialog is closed.
- new ManagedUserPassphraseDialog(web_contents, callback);
-}
-
// static
void ManagedUserService::RegisterUserPrefs(
user_prefs::PrefRegistrySyncable* registry) {
@@ -195,12 +157,6 @@ void ManagedUserService::RegisterUserPrefs(
registry->RegisterIntegerPref(
prefs::kDefaultManagedModeFilteringBehavior, ManagedModeURLFilter::ALLOW,
user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
- registry->RegisterStringPref(
- prefs::kManagedModeLocalPassphrase, std::string(),
- user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
- registry->RegisterStringPref(
- prefs::kManagedModeLocalSalt, std::string(),
- user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
}
// static
@@ -341,9 +297,6 @@ bool ManagedUserService::ExtensionManagementPolicyImpl(
if (elevated_for_testing_)
return true;
- if (elevated_for_extensions_.count(extension_id))
- return true;
-
if (error)
*error = l10n_util::GetStringUTF16(IDS_EXTENSIONS_LOCKED_MANAGED_MODE);
return false;
diff --git a/chrome/browser/managed_mode/managed_user_service.h b/chrome/browser/managed_mode/managed_user_service.h
index 5720a8f..103b2e1 100644
--- a/chrome/browser/managed_mode/managed_user_service.h
+++ b/chrome/browser/managed_mode/managed_user_service.h
@@ -13,7 +13,6 @@
#include "base/string16.h"
#include "chrome/browser/extensions/management_policy.h"
#include "chrome/browser/managed_mode/managed_mode_url_filter.h"
-#include "chrome/browser/ui/webui/managed_user_passphrase_dialog.h"
#include "components/browser_context_keyed_service/browser_context_keyed_service.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
@@ -54,9 +53,6 @@ class ManagedUserService : public BrowserContextKeyedService,
// ManagedUserService (which could lead to cyclic dependencies).
static bool ProfileIsManaged(Profile* profile);
- // Returns the elevation state for specific WebContents.
- bool IsElevatedForWebContents(const content::WebContents* web_contents) const;
-
static void RegisterUserPrefs(user_prefs::PrefRegistrySyncable* registry);
// Returns whether managed users are enabled by Finch or the command line
@@ -109,14 +105,6 @@ class ManagedUserService : public BrowserContextKeyedService,
void GetManualExceptionsForHost(const std::string& host,
std::vector<GURL>* urls);
- // Checks if the passphrase dialog can be skipped (the profile is already in
- // elevated state for the given WebContents or the passphrase is empty).
- bool CanSkipPassphraseDialog(const content::WebContents* web_contents) const;
-
- // Handles the request to authorize as the custodian of the managed user.
- void RequestAuthorization(content::WebContents* web_contents,
- const PassphraseCheckedCallback& callback);
-
// Initializes this object. This method does nothing if the profile is not
// managed.
void Init();
@@ -213,9 +201,6 @@ class ManagedUserService : public BrowserContextKeyedService,
// corresponding preference is changed.
void UpdateManualURLs();
- // Returns if the passphrase to authorize as the custodian is empty.
- bool IsPassphraseEmpty() const;
-
base::WeakPtrFactory<ManagedUserService> weak_ptr_factory_;
// Owns us via the BrowserContextKeyedService mechanism.
@@ -224,10 +209,6 @@ class ManagedUserService : public BrowserContextKeyedService,
content::NotificationRegistrar registrar_;
PrefChangeRegistrar pref_change_registrar_;
- // Stores the extension ids of the extensions which currently can be modified
- // by the managed user.
- std::set<std::string> elevated_for_extensions_;
-
// Sets a profile in elevated state for testing if set to true.
bool elevated_for_testing_;
diff --git a/chrome/browser/resources/managed_user_passphrase_dialog.css b/chrome/browser/resources/managed_user_passphrase_dialog.css
deleted file mode 100644
index 53356d8..0000000
--- a/chrome/browser/resources/managed_user_passphrase_dialog.css
+++ /dev/null
@@ -1,35 +0,0 @@
-/* Copyright (c) 2013 The Chromium Authors. All rights reserved.
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file. */
-
-#managed-mode-passphrase-page {
- min-width: 350px;
- padding: 5px 15px;
-}
-
-#managed-user-logo {
- background-image: url('options/managed_user.png');
- height: 68px;
- width: 65px;
-}
-
-#entry {
- margin: 15px 0;
-}
-
-#passphrase-entry {
- width: 100%;
-}
-
-#buttons {
- float: right;
-}
-
-html[dir=rtl] #buttons {
- float: left;
-}
-
-#incorrect-passphrase-warning {
- color: red;
- font-weight: bold;
-}
diff --git a/chrome/browser/resources/managed_user_passphrase_dialog.html b/chrome/browser/resources/managed_user_passphrase_dialog.html
deleted file mode 100644
index d5075ac..0000000
--- a/chrome/browser/resources/managed_user_passphrase_dialog.html
+++ /dev/null
@@ -1,42 +0,0 @@
-<!DOCTYPE html>
-<!-- Copyright (c) 2013 The Chromium Authors. All rights reserved.
- Use of this source code is governed by a BSD-style license that can be
- found in the LICENSE file. -->
-<html i18n-values="dir:textdirection">
-<head>
- <link rel="stylesheet" href="chrome://resources/css/chrome_shared.css">
- <link rel="stylesheet" href="managed_user_passphrase_dialog.css">
- <script src="chrome://resources/js/load_time_data.js"></script>
- <script src="chrome://resources/js/util.js"></script>
- <script src="chrome://managed-user-passphrase/strings.js"></script>
- <script
- src="chrome://managed-user-passphrase/managed_user_passphrase_dialog.js">
- </script>
-</head>
-<body i18n-values=".style.fontFamily:fontfamily;.style.fontSize:fontsize">
- <div id="managed-mode-passphrase-page" class="page">
- <div id="managed-user-logo"></div>
- <h1 i18n-content="managedModePassphrasePage"></h1>
- <div class="content-area">
- <div id="instructions">
- <span i18n-content="passphraseInstruction"></span>
- </div>
- <div id="entry">
- <input id="passphrase-entry" type="password" required>
- </div>
- <div id="buttons">
- <button id="cancel-passphrase-button"
- i18n-content="cancelPassphraseButton">
- </button>
- <button id="unlock-passphrase-button"
- i18n-content="unlockPassphraseButton" disabled>
- </button>
- </div>
- <div id="incorrect-passphrase-warning" hidden>
- <span i18n-content="incorrectPassphraseWarning"></span>
- </div>
- </div>
- </div>
- <script src="chrome://resources/js/i18n_template2.js"></script>
-</body>
-</html>
diff --git a/chrome/browser/resources/managed_user_passphrase_dialog.js b/chrome/browser/resources/managed_user_passphrase_dialog.js
deleted file mode 100644
index b7a210e..0000000
--- a/chrome/browser/resources/managed_user_passphrase_dialog.js
+++ /dev/null
@@ -1,45 +0,0 @@
-// Copyright (c) 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-function load() {
- var checkPassphrase = function(event) {
- chrome.send('checkPassphrase', [$('passphrase-entry').value]);
- };
- var closeDialog = function(event) {
- // TODO(akuegel): Replace by closeDialog.
- chrome.send('DialogClose');
- };
- // Directly set the focus on the input box so the user can start typing right
- // away.
- $('passphrase-entry').focus();
- $('unlock-passphrase-button').onclick = checkPassphrase;
- $('cancel-passphrase-button').onclick = closeDialog;
- $('passphrase-entry').oninput = function(event) {
- $('unlock-passphrase-button').disabled = $('passphrase-entry').value == '';
- $('incorrect-passphrase-warning').hidden = true;
- };
- $('passphrase-entry').onkeypress = function(event) {
- // Check if the user pressed enter.
- if (event.keyCode == 13)
- checkPassphrase(event);
- };
-
- // Pressing escape anywhere in the frame should work.
- document.onkeyup = function(event) {
- // Check if the user pressed escape.
- if (event.keyCode == 27)
- closeDialog(event);
- };
-}
-
-function passphraseResult(passphraseCorrect) {
- if (passphraseCorrect) {
- chrome.send('DialogClose', ['true']);
- } else {
- $('incorrect-passphrase-warning').hidden = false;
- $('passphrase-entry').focus();
- }
-}
-
-window.addEventListener('DOMContentLoaded', load);
diff --git a/chrome/browser/ui/webui/managed_user_passphrase_dialog.cc b/chrome/browser/ui/webui/managed_user_passphrase_dialog.cc
deleted file mode 100644
index fe3d2e9..0000000
--- a/chrome/browser/ui/webui/managed_user_passphrase_dialog.cc
+++ /dev/null
@@ -1,183 +0,0 @@
-// Copyright (c) 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/browser/ui/webui/managed_user_passphrase_dialog.h"
-
-#include <string>
-#include <vector>
-
-#include "base/bind.h"
-#include "base/memory/weak_ptr.h"
-#include "base/metrics/histogram.h"
-#include "base/prefs/pref_service.h"
-#include "base/values.h"
-#include "chrome/browser/managed_mode/managed_user_passphrase.h"
-#include "chrome/browser/profiles/profile.h"
-#include "chrome/browser/ui/webui/constrained_web_dialog_ui.h"
-#include "chrome/common/pref_names.h"
-#include "chrome/common/url_constants.h"
-#include "content/public/browser/user_metrics.h"
-#include "content/public/browser/web_contents.h"
-#include "content/public/browser/web_ui_data_source.h"
-#include "content/public/browser/web_ui_message_handler.h"
-#include "grit/browser_resources.h"
-#include "grit/generated_resources.h"
-#include "ui/base/resource/resource_bundle.h"
-#include "ui/gfx/size.h"
-
-using content::UserMetricsAction;
-
-namespace {
-
-// Handles the message when the user entered a passphrase and clicks the Unlock
-// button.
-class ManagedUserPassphraseDialogMessageHandler
- : public content::WebUIMessageHandler {
-
- public:
- ManagedUserPassphraseDialogMessageHandler();
- virtual ~ManagedUserPassphraseDialogMessageHandler() {}
-
- // content::WebUIMessageHandler implementation.
- virtual void RegisterMessages() OVERRIDE;
-
- private:
- // Gets called from the UI with the entered passphrase as a parameter. The
- // correctness of the passphrase is checked and the result is returned to the
- // UI.
- void CheckPassphrase(const base::ListValue* args) const;
-
- base::WeakPtrFactory<ManagedUserPassphraseDialogMessageHandler> weak_factory_;
-
- DISALLOW_COPY_AND_ASSIGN(ManagedUserPassphraseDialogMessageHandler);
-};
-
-ManagedUserPassphraseDialogMessageHandler
- ::ManagedUserPassphraseDialogMessageHandler()
- : weak_factory_(this) {
-}
-
-void ManagedUserPassphraseDialogMessageHandler::RegisterMessages() {
- web_ui()->RegisterMessageCallback(
- "checkPassphrase",
- base::Bind(&ManagedUserPassphraseDialogMessageHandler::CheckPassphrase,
- weak_factory_.GetWeakPtr()));
-}
-
-void ManagedUserPassphraseDialogMessageHandler::CheckPassphrase(
- const base::ListValue* args) const {
- // Extract the passphrase from the provided ListValue parameter.
- const base::Value* passphrase_arg = NULL;
- args->Get(0, &passphrase_arg);
- std::string passphrase;
- passphrase_arg->GetAsString(&passphrase);
-
- // Get the hashed passphrase and the salt that was used to calculate it.
- Profile* profile = Profile::FromWebUI(web_ui());
- PrefService* pref_service = profile->GetPrefs();
- std::string stored_passphrase_hash =
- pref_service->GetString(prefs::kManagedModeLocalPassphrase);
- std::string salt = pref_service->GetString(prefs::kManagedModeLocalSalt);
-
- // Calculate the hash of the entered passphrase.
- ManagedUserPassphrase passphrase_key_generator(salt);
- std::string encoded_passphrase_hash;
- passphrase_key_generator.GenerateHashFromPassphrase(passphrase,
- &encoded_passphrase_hash);
-
- // Check if the entered passphrase is correct and give the result back to the
- // UI.
- bool is_correct = stored_passphrase_hash == encoded_passphrase_hash;
- base::FundamentalValue passphrase_correct(is_correct);
- web_ui()->CallJavascriptFunction("passphraseResult", passphrase_correct);
- UMA_HISTOGRAM_BOOLEAN("ManagedMode_PassphraseCorrect", is_correct);
-}
-
-} // namespace
-
-ManagedUserPassphraseDialog::ManagedUserPassphraseDialog(
- content::WebContents* web_contents,
- const PassphraseCheckedCallback& callback) : callback_(callback) {
- content::RecordAction(UserMetricsAction("ManagedMode_OpenPassphraseDialog"));
- Profile* profile =
- Profile::FromBrowserContext(web_contents->GetBrowserContext());
- CreateDataSource(profile);
- CreateConstrainedWebDialog(profile, this, NULL, web_contents);
-}
-
-
-ui::ModalType ManagedUserPassphraseDialog::GetDialogModalType() const {
- return ui::MODAL_TYPE_WINDOW;
-}
-
-string16 ManagedUserPassphraseDialog::GetDialogTitle() const {
- return string16();
-}
-
-GURL ManagedUserPassphraseDialog::GetDialogContentURL() const {
- return GURL(chrome::kChromeUIManagedUserPassphrasePageURL);
-}
-
-void ManagedUserPassphraseDialog::GetWebUIMessageHandlers(
- std::vector<content::WebUIMessageHandler*>* handlers) const {
- DCHECK(handlers);
- // The constrained window delegate takes care of registering the handler.
- // The handler is also deleted automatically.
- handlers->push_back(new ManagedUserPassphraseDialogMessageHandler());
-}
-
-void ManagedUserPassphraseDialog::GetDialogSize(gfx::Size* size) const {
- const int kDialogWidth = 383;
- const int kDialogHeight = 225;
- size->SetSize(kDialogWidth, kDialogHeight);
-}
-
-std::string ManagedUserPassphraseDialog::GetDialogArgs() const {
- return std::string();
-}
-
-void ManagedUserPassphraseDialog::OnDialogClosed(
- const std::string& json_retval) {
- if (!callback_.is_null()) {
- callback_.Run(!json_retval.empty());
- callback_.Reset();
- content::RecordAction(
- UserMetricsAction("ManagedMode_ClosePassphraseDialog"));
- }
-}
-
-void ManagedUserPassphraseDialog::OnCloseContents(
- content::WebContents* source, bool* out_close_dialog) {
-}
-
-bool ManagedUserPassphraseDialog::ShouldShowDialogTitle() const {
- return false;
-}
-
-ManagedUserPassphraseDialog::~ManagedUserPassphraseDialog() {
-}
-
-void ManagedUserPassphraseDialog::CreateDataSource(Profile* profile) const {
- content::WebUIDataSource* data_source = content::WebUIDataSource::Create(
- chrome::kChromeUIManagedUserPassphrasePageHost);
- data_source->SetDefaultResource(IDR_MANAGED_USER_PASSPHRASE_DIALOG_HTML);
- // DCHECK to uncover if the passphrase dialog can actually load and display
- // the html resource when running a browser test.
- DCHECK(ResourceBundle::GetSharedInstance().LoadDataResourceBytes(
- IDR_MANAGED_USER_PASSPHRASE_DIALOG_HTML));
- data_source->AddResourcePath("managed_user_passphrase_dialog.js",
- IDR_MANAGED_USER_PASSPHRASE_DIALOG_JS);
- data_source->AddLocalizedString("managedModePassphrasePage",
- IDS_PASSPHRASE_TITLE);
- data_source->AddLocalizedString("unlockPassphraseButton",
- IDS_UNLOCK_PASSPHRASE_BUTTON);
- data_source->AddLocalizedString("passphraseInstruction",
- IDS_PASSPHRASE_INSTRUCTION);
- data_source->AddLocalizedString("incorrectPassphraseWarning",
- IDS_INCORRECT_PASSPHRASE_WARNING);
- data_source->AddLocalizedString("cancelPassphraseButton", IDS_CANCEL);
- data_source->SetJsonPath("strings.js");
- data_source->SetUseJsonJSFormatV2();
- content::WebUIDataSource::Add(profile, data_source);
-}
diff --git a/chrome/browser/ui/webui/managed_user_passphrase_dialog.h b/chrome/browser/ui/webui/managed_user_passphrase_dialog.h
deleted file mode 100644
index 5b0c7f0..0000000
--- a/chrome/browser/ui/webui/managed_user_passphrase_dialog.h
+++ /dev/null
@@ -1,64 +0,0 @@
-// Copyright (c) 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CHROME_BROWSER_UI_WEBUI_MANAGED_USER_PASSPHRASE_DIALOG_H_
-#define CHROME_BROWSER_UI_WEBUI_MANAGED_USER_PASSPHRASE_DIALOG_H_
-
-#include "base/basictypes.h"
-#include "base/callback.h"
-#include "base/compiler_specific.h"
-#include "ui/web_dialogs/web_dialog_delegate.h"
-
-class ConstrainedWebDialogDelegate;
-class Profile;
-
-namespace content {
-class WebContents;
-}
-
-namespace base {
-class Value;
-}
-
-// Called on the UI thread after the Passphrase Dialog was closed. A boolean
-// flag is passed which indicates if the authentication was successful or not.
-typedef base::Callback<void(bool)> PassphraseCheckedCallback;
-
-// Displays a tab-modal dialog, i.e. a dialog that will block the current page
-// but still allow the user to switch to a different page.
-// To display the dialog, allocate this object on the heap. It will open the
-// dialog from its constructor and then delete itself when the user dismisses
-// the dialog.
-class ManagedUserPassphraseDialog : public ui::WebDialogDelegate {
- public:
- // Creates a passphrase dialog which will be deleted automatically when the
- // user closes the dialog.
- ManagedUserPassphraseDialog(content::WebContents* web_contents,
- const PassphraseCheckedCallback& callback);
-
- // ui::WebDialogDelegate implementation.
- virtual ui::ModalType GetDialogModalType() const OVERRIDE;
- virtual string16 GetDialogTitle() const OVERRIDE;
- virtual GURL GetDialogContentURL() const OVERRIDE;
- virtual void GetWebUIMessageHandlers(
- std::vector<content::WebUIMessageHandler*>* handlers) const OVERRIDE;
- virtual void GetDialogSize(gfx::Size* size) const OVERRIDE;
- virtual std::string GetDialogArgs() const OVERRIDE;
- virtual void OnDialogClosed(const std::string& json_retval) OVERRIDE;
- virtual void OnCloseContents(content::WebContents* source,
- bool* out_close_dialog) OVERRIDE;
- virtual bool ShouldShowDialogTitle() const OVERRIDE;
-
- private:
- virtual ~ManagedUserPassphraseDialog();
-
- // Creates and initializes the WebUIDataSource which is used for this dialog.
- void CreateDataSource(Profile* profile) const;
-
- PassphraseCheckedCallback callback_;
-
- DISALLOW_COPY_AND_ASSIGN(ManagedUserPassphraseDialog);
-};
-
-#endif // CHROME_BROWSER_UI_WEBUI_MANAGED_USER_PASSPHRASE_DIALOG_H_
diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi
index ea8c9a8..cecb5f7 100644
--- a/chrome/chrome_browser.gypi
+++ b/chrome/chrome_browser.gypi
@@ -955,8 +955,6 @@
'browser/managed_mode/managed_mode_site_list.h',
'browser/managed_mode/managed_mode_url_filter.cc',
'browser/managed_mode/managed_mode_url_filter.h',
- 'browser/managed_mode/managed_user_passphrase.cc',
- 'browser/managed_mode/managed_user_passphrase.h',
'browser/managed_mode/managed_user_registration_service.cc',
'browser/managed_mode/managed_user_registration_service.h',
'browser/managed_mode/managed_user_registration_service_factory.cc',
diff --git a/chrome/chrome_browser_ui.gypi b/chrome/chrome_browser_ui.gypi
index 5025cbf..0eaca3b 100644
--- a/chrome/chrome_browser_ui.gypi
+++ b/chrome/chrome_browser_ui.gypi
@@ -2079,8 +2079,6 @@
'browser/ui/webui/inspect_ui.h',
'browser/ui/webui/instant_ui.cc',
'browser/ui/webui/instant_ui.h',
- 'browser/ui/webui/managed_user_passphrase_dialog.cc',
- 'browser/ui/webui/managed_user_passphrase_dialog.h',
'browser/ui/webui/memory_internals/memory_internals_handler.cc',
'browser/ui/webui/memory_internals/memory_internals_handler.h',
'browser/ui/webui/memory_internals/memory_internals_proxy.cc',
diff --git a/chrome/chrome_tests_unit.gypi b/chrome/chrome_tests_unit.gypi
index e16c503..dccf2a0 100644
--- a/chrome/chrome_tests_unit.gypi
+++ b/chrome/chrome_tests_unit.gypi
@@ -913,7 +913,6 @@
'browser/mac/keystone_glue_unittest.mm',
'browser/managed_mode/managed_mode_unittest.cc',
'browser/managed_mode/managed_mode_url_filter_unittest.cc',
- 'browser/managed_mode/managed_user_passphrase_unittest.cc',
'browser/managed_mode/managed_user_registration_service_unittest.cc',
'browser/managed_mode/managed_user_service_unittest.cc',
'browser/media_galleries/fileapi/itunes_finder_win_unittest.cc',
@@ -2291,7 +2290,6 @@
'browser/browser_commands_unittest.cc',
'browser/download/download_shelf_unittest.cc',
- 'browser/managed_mode/managed_user_passphrase_unittest.cc',
'browser/net/gaia/gaia_oauth_fetcher_unittest.cc',
'browser/page_cycler/page_cycler_unittest.cc',
'browser/profiles/off_the_record_profile_impl_unittest.cc',
diff --git a/chrome/common/chrome_switches.cc b/chrome/common/chrome_switches.cc
index 13d4c97..216ae8c 100644
--- a/chrome/common/chrome_switches.cc
+++ b/chrome/common/chrome_switches.cc
@@ -1192,10 +1192,6 @@ const char kSilentDebuggerExtensionAPI[] = "silent-debugger-extension-api";
// Chrome and does nothing when directly passed to the browser.
const char kRendererPrintPreview[] = "renderer-print-preview";
-// Forces a reset of the local passphrase of the managed user account, and
-// the managed user settings dialog is shown where a new passphrase can be set.
-const char kResetLocalPassphrase[] = "reset-local-passphrase";
-
// Forces a reset of the one-time-randomized FieldTrials on this client, also
// known as the Chrome Variations state.
const char kResetVariationState[] = "reset-variation-state";
diff --git a/chrome/common/chrome_switches.h b/chrome/common/chrome_switches.h
index 80c695f..964bc58 100644
--- a/chrome/common/chrome_switches.h
+++ b/chrome/common/chrome_switches.h
@@ -316,7 +316,6 @@ extern const char kRecordMode[];
extern const char kRemoteDebuggingFrontend[];
extern const char kSilentDebuggerExtensionAPI[];
extern const char kRendererPrintPreview[];
-extern const char kResetLocalPassphrase[];
extern const char kResetVariationState[];
extern const char kRestoreLastSession[];
extern const char kSavePageAsMHTML[];
diff --git a/chrome/common/pref_names.cc b/chrome/common/pref_names.cc
index 321fa85..40abeab 100644
--- a/chrome/common/pref_names.cc
+++ b/chrome/common/pref_names.cc
@@ -33,13 +33,6 @@ const char kHomePageIsNewTabPage[] = "homepage_is_newtabpage";
// This is the URL of the page to load when opening new tabs.
const char kHomePage[] = "homepage";
-// This preference is used to store the hash of a password of the custodian of
-// a managed user. It allows to unlock options which should be not available to
-// the managed user. The salt preference is used to derive the hash from the
-// password.
-const char kManagedModeLocalPassphrase[] = "managed_mode.passphrase";
-const char kManagedModeLocalSalt[] = "managed_mode.salt";
-
// Maps host names to whether the host is manually allowed or blocked.
const char kManagedModeManualHosts[] = "profile.managed.manual_hosts";
// Maps URLs to whether the URL is manually allowed or blocked.
diff --git a/chrome/common/pref_names.h b/chrome/common/pref_names.h
index 5899c95..3da1adb 100644
--- a/chrome/common/pref_names.h
+++ b/chrome/common/pref_names.h
@@ -21,8 +21,6 @@ extern const char kDefaultAppsInstalled[];
extern const char kDisableScreenshots[];
extern const char kHomePageIsNewTabPage[];
extern const char kHomePage[];
-extern const char kManagedModeLocalPassphrase[];
-extern const char kManagedModeLocalSalt[];
extern const char kManagedModeManualHosts[];
extern const char kManagedModeManualURLs[];
extern const char kSessionExitedCleanly[];