Commit 43d33e91 authored by treib@chromium.org's avatar treib@chromium.org

Rename "managed (mode|user)" to "supervised user" (part 6)

Followup to https://codereview.chromium.org/350183002/

This CL renames (hopefully) all remaining C++/ObjC code apart from CrOS-specific code.
It also renames a test data folder.

Still missing:
- ChromeOS-specific code in c/b/chromeos/login/managed/ and ash/system/
- JavaScript, HTML, CSS
- The global ENABLE_MANAGED_USERS define

TBR=msw@chromium.org (c/b/ui)
TBR=atwilson@chromium.org (c/b/sync)
The TBRs are simple renames.

BUG=385113

Review URL: https://codereview.chromium.org/384023002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@282962 0039d316-1c4b-4281-b951-d872f2087c98
parent df4f58a1
...@@ -400,10 +400,6 @@ ...@@ -400,10 +400,6 @@
'linux_seccomp_bpf': { 'linux_seccomp_bpf': {
'filepath': 'content/common/sandbox.*linux.cc', 'filepath': 'content/common/sandbox.*linux.cc',
}, },
'managed_users': {
'filepath': 'chrome/browser/.*managed_mode'\
'|chrome/browser/.*managed_user',
},
'media': { 'media': {
'filepath': 'media/|third_party/(ffmpeg|openmax)/|webmediaplayer|'\ 'filepath': 'media/|third_party/(ffmpeg|openmax)/|webmediaplayer|'\
'audio_message_filter|video_layer|media_internals', 'audio_message_filter|video_layer|media_internals',
...@@ -576,6 +572,11 @@ ...@@ -576,6 +572,11 @@
'streams': { 'streams': {
'filepath': 'content/browser/streams/', 'filepath': 'content/browser/streams/',
}, },
'supervised_users': {
'filepath': 'chrome/browser/.*managed_mode'\
'|chrome/browser/.*managed_user'\
'|chrome/browser/.*supervised_user',
},
'sync': { 'sync': {
'filepath': 'chrome/browser/sync/|sync/|components/sync_driver/', 'filepath': 'chrome/browser/sync/|sync/|components/sync_driver/',
}, },
...@@ -856,7 +857,7 @@ ...@@ -856,7 +857,7 @@
'linux_fonts': ['derat+watch@chromium.org'], 'linux_fonts': ['derat+watch@chromium.org'],
'linux_sandboxing': ['agl@chromium.org', 'jln+watch@chromium.org'], 'linux_sandboxing': ['agl@chromium.org', 'jln+watch@chromium.org'],
'linux_seccomp_bpf': ['jln+watch@chromium.org'], 'linux_seccomp_bpf': ['jln+watch@chromium.org'],
'managed_users': ['pam+watch@chromium.org'], 'supervised_users': ['pam+watch@chromium.org'],
'media': ['feature-media-reviews@chromium.org'], 'media': ['feature-media-reviews@chromium.org'],
'media_galleries': ['gbillock@chromium.org', 'thestig@chromium.org', 'media_galleries': ['gbillock@chromium.org', 'thestig@chromium.org',
'tommycli@chromium.org', 'vandebo@chromium.org'], 'tommycli@chromium.org', 'vandebo@chromium.org'],
......
...@@ -378,7 +378,7 @@ ...@@ -378,7 +378,7 @@
<include name="IDR_USER_MANAGER_JS" file="resources\user_manager\user_manager.js" flattenhtml="true" type="BINDATA" /> <include name="IDR_USER_MANAGER_JS" file="resources\user_manager\user_manager.js" flattenhtml="true" type="BINDATA" />
<include name="IDR_USER_MANAGER_HTML" file="resources\user_manager\user_manager.html" flattenhtml="true" allowexternalscript="true" type="BINDATA" /> <include name="IDR_USER_MANAGER_HTML" file="resources\user_manager\user_manager.html" flattenhtml="true" allowexternalscript="true" type="BINDATA" />
</if> </if>
<include name="IDR_SUPERVISED_USER_BLOCK_INTERSTITIAL_HTML" file="resources\managed_mode_block_interstitial.html" flattenhtml="true" type="BINDATA" /> <include name="IDR_SUPERVISED_USER_BLOCK_INTERSTITIAL_HTML" file="resources\supervised_user_block_interstitial.html" flattenhtml="true" type="BINDATA" />
<include name="IDR_PROFILE_SIGNIN_CONFIRMATION_HTML" file="resources\profile_signin_confirmation.html" 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_JS" file="resources\profile_signin_confirmation.js" type="BINDATA" />
<include name="IDR_PROFILE_SIGNIN_CONFIRMATION_CSS" file="resources\profile_signin_confirmation.css" type="BINDATA" /> <include name="IDR_PROFILE_SIGNIN_CONFIRMATION_CSS" file="resources\profile_signin_confirmation.css" type="BINDATA" />
......
/* Copyright (c) 2012 The Chromium Authors. All rights reserved. /* Copyright 2014 The Chromium Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be * Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file. */ * found in the LICENSE file. */
body { body {
...@@ -45,8 +45,10 @@ a { ...@@ -45,8 +45,10 @@ a {
* the resource manually. */ * the resource manually. */
-webkit-user-select: none; -webkit-user-select: none;
content: -webkit-image-set( content: -webkit-image-set(
url('../../app/theme/default_100_percent/common/error_managed_mode_blocked_page.png') 1x, url('../../app/theme/default_100_percent/common/'
url('../../app/theme/default_200_percent/common/error_managed_mode_blocked_page.png') 2x); 'error_managed_mode_blocked_page.png') 1x,
url('../../app/theme/default_200_percent/common/'
'error_managed_mode_blocked_page.png') 2x);
margin-bottom: 10px; margin-bottom: 10px;
margin-top: 10px; margin-top: 10px;
} }
......
...@@ -4,11 +4,11 @@ ...@@ -4,11 +4,11 @@
<meta name="viewport" content="width=device-width"> <meta name="viewport" content="width=device-width">
<meta charset="utf-8"> <meta charset="utf-8">
<title i18n-content="blockPageTitle"></title> <title i18n-content="blockPageTitle"></title>
<link rel="stylesheet" href="managed_mode_block_interstitial.css"> <link rel="stylesheet" href="supervised_user_block_interstitial.css">
<script src="../../../ui/webui/resources/js/cr.js"></script> <script src="../../../ui/webui/resources/js/cr.js"></script>
<script src="../../../ui/webui/resources/js/load_time_data.js"></script> <script src="../../../ui/webui/resources/js/load_time_data.js"></script>
<script src="../../../ui/webui/resources/js/util.js"></script> <script src="../../../ui/webui/resources/js/util.js"></script>
<script src="managed_mode_block_interstitial.js"></script> <script src="supervised_user_block_interstitial.js"></script>
</head> </head>
<body> <body>
......
// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
......
...@@ -330,7 +330,7 @@ TEST_F(SupervisedUserServiceExtensionTest, InstallContentPacks) { ...@@ -330,7 +330,7 @@ TEST_F(SupervisedUserServiceExtensionTest, InstallContentPacks) {
base::FilePath test_data_dir; base::FilePath test_data_dir;
ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &test_data_dir)); ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &test_data_dir));
base::FilePath extension_path = base::FilePath extension_path =
test_data_dir.AppendASCII("extensions/managed_mode/content_pack"); test_data_dir.AppendASCII("extensions/supervised_user/content_pack");
content::WindowedNotificationObserver extension_load_observer( content::WindowedNotificationObserver extension_load_observer(
chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED, chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED,
content::Source<Profile>(profile_.get())); content::Source<Profile>(profile_.get()));
...@@ -361,7 +361,7 @@ TEST_F(SupervisedUserServiceExtensionTest, InstallContentPacks) { ...@@ -361,7 +361,7 @@ TEST_F(SupervisedUserServiceExtensionTest, InstallContentPacks) {
// Load a second content pack. // Load a second content pack.
installer = extensions::UnpackedInstaller::Create(service_); installer = extensions::UnpackedInstaller::Create(service_);
extension_path = extension_path =
test_data_dir.AppendASCII("extensions/managed_mode/content_pack_2"); test_data_dir.AppendASCII("extensions/supervised_user/content_pack_2");
installer->Load(extension_path); installer->Load(extension_path);
observer.Wait(); observer.Wait();
......
// Copyright (c) 2013 The Chromium Authors. All rights reserved. // Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
......
...@@ -93,7 +93,7 @@ void PopulateUsers(const ProfileInfoCache& profile_info, ...@@ -93,7 +93,7 @@ void PopulateUsers(const ProfileInfoCache& profile_info,
users->clear(); users->clear();
const size_t count = profile_info.GetNumberOfProfiles(); const size_t count = profile_info.GetNumberOfProfiles();
for (size_t i = 0; i < count; ++i) { for (size_t i = 0; i < count; ++i) {
// Don't display managed users. // Don't display supervised users.
if (profile_info.ProfileIsSupervisedAtIndex(i)) if (profile_info.ProfileIsSupervisedAtIndex(i))
continue; continue;
......
...@@ -19,11 +19,12 @@ class Browser; ...@@ -19,11 +19,12 @@ class Browser;
// will open the profile menu; in Incognito, clicking will do nothing. // will open the profile menu; in Incognito, clicking will do nothing.
@interface AvatarIconController : AvatarBaseController { @interface AvatarIconController : AvatarBaseController {
@private @private
// The managed user avatar label button. Only used for managed user profiles. // The supervised user avatar label button. Only used for supervised user
// profiles.
base::scoped_nsobject<AvatarLabelButton> labelButton_; base::scoped_nsobject<AvatarLabelButton> labelButton_;
} }
// The managed user avatar label button view. // The supervised user avatar label button view.
@property(readonly, nonatomic) NSButton* labelButtonView; @property(readonly, nonatomic) NSButton* labelButtonView;
// Designated initializer. // Designated initializer.
......
...@@ -25,7 +25,7 @@ class Browser; ...@@ -25,7 +25,7 @@ class Browser;
// Array of the below view controllers. // Array of the below view controllers.
base::scoped_nsobject<NSMutableArray> items_; base::scoped_nsobject<NSMutableArray> items_;
// Is set to true if the managed user has clicked on Switch Users. // Is set to true if the supervised user has clicked on Switch Users.
BOOL expanded_; BOOL expanded_;
} }
...@@ -43,7 +43,7 @@ class Browser; ...@@ -43,7 +43,7 @@ class Browser;
// Edits a given profile. |sender| is an AvatarMenuItemController. // Edits a given profile. |sender| is an AvatarMenuItemController.
- (IBAction)editProfile:(id)sender; - (IBAction)editProfile:(id)sender;
// Switches from the managed user avatar menu to the normal avatar menu which // Switches from the supervised user avatar menu to the normal avatar menu which
// allows to switch profiles. // allows to switch profiles.
- (IBAction)switchProfile:(id)sender; - (IBAction)switchProfile:(id)sender;
......
...@@ -244,9 +244,9 @@ TEST_F(ProfileMenuControllerTest, DeleteActiveProfile) { ...@@ -244,9 +244,9 @@ TEST_F(ProfileMenuControllerTest, DeleteActiveProfile) {
base::ThreadRestrictions::SetIOAllowed(io_was_allowed); base::ThreadRestrictions::SetIOAllowed(io_was_allowed);
} }
TEST_F(ProfileMenuControllerTest, ManagedProfile) { TEST_F(ProfileMenuControllerTest, SupervisedProfile) {
TestingProfileManager* manager = testing_profile_manager(); TestingProfileManager* manager = testing_profile_manager();
TestingProfile* managed_profile = TestingProfile* supervised_profile =
manager->CreateTestingProfile("test1", manager->CreateTestingProfile("test1",
scoped_ptr<PrefServiceSyncable>(), scoped_ptr<PrefServiceSyncable>(),
base::ASCIIToUTF16("Supervised User"), base::ASCIIToUTF16("Supervised User"),
...@@ -269,12 +269,12 @@ TEST_F(ProfileMenuControllerTest, ManagedProfile) { ...@@ -269,12 +269,12 @@ TEST_F(ProfileMenuControllerTest, ManagedProfile) {
ASSERT_EQ(@selector(newProfile:), [item action]); ASSERT_EQ(@selector(newProfile:), [item action]);
EXPECT_TRUE([controller() validateMenuItem:item]); EXPECT_TRUE([controller() validateMenuItem:item]);
// Open a new browser for the managed user and switch to it. // Open a new browser for the supervised user and switch to it.
Browser::CreateParams managed_profile_params( Browser::CreateParams supervised_profile_params(
managed_profile, chrome::HOST_DESKTOP_TYPE_NATIVE); supervised_profile, chrome::HOST_DESKTOP_TYPE_NATIVE);
scoped_ptr<Browser> managed_browser( scoped_ptr<Browser> supervised_browser(
chrome::CreateBrowserWithTestWindowForParams(&managed_profile_params)); chrome::CreateBrowserWithTestWindowForParams(&supervised_profile_params));
BrowserList::SetLastActive(managed_browser.get()); BrowserList::SetLastActive(supervised_browser.get());
item = [menu itemAtIndex:0]; item = [menu itemAtIndex:0];
ASSERT_EQ(@selector(switchToProfileFromMenu:), [item action]); ASSERT_EQ(@selector(switchToProfileFromMenu:), [item action]);
......
...@@ -72,7 +72,7 @@ class BrowserNonClientFrameView : public views::NonClientFrameView { ...@@ -72,7 +72,7 @@ class BrowserNonClientFrameView : public views::NonClientFrameView {
// icon. May be NULL for some frame styles. // icon. May be NULL for some frame styles.
AvatarMenuButton* avatar_button_; AvatarMenuButton* avatar_button_;
// Avatar label that is used for a managed user. // Avatar label that is used for a supervised user.
AvatarLabel* avatar_label_; AvatarLabel* avatar_label_;
// Menu button that displays the name of the active or guest profile. // Menu button that displays the name of the active or guest profile.
......
...@@ -29,8 +29,8 @@ class AvatarMenuButton : public views::MenuButton, ...@@ -29,8 +29,8 @@ class AvatarMenuButton : public views::MenuButton,
// Internal class name. // Internal class name.
static const char kViewClassName[]; static const char kViewClassName[];
// Creates a new button. If |disabled| is true and we're not in managed mode, // Creates a new button. Unless |disabled| is true, clicking on the button
// clicking on the button will cause the profile menu to be displayed. // will cause the profile menu to be displayed.
AvatarMenuButton(Browser* browser, bool disabled); AvatarMenuButton(Browser* browser, bool disabled);
virtual ~AvatarMenuButton(); virtual ~AvatarMenuButton();
......
...@@ -94,7 +94,7 @@ class CreateProfileHandler: public OptionsPageUIHandler { ...@@ -94,7 +94,7 @@ class CreateProfileHandler: public OptionsPageUIHandler {
// with the management server. // with the management server.
void RegisterSupervisedUser(bool create_shortcut, void RegisterSupervisedUser(bool create_shortcut,
chrome::HostDesktopType desktop_type, chrome::HostDesktopType desktop_type,
const std::string& managed_user_id, const std::string& supervised_user_id,
Profile* new_profile); Profile* new_profile);
// Called back with the result of the supervised user registration. // Called back with the result of the supervised user registration.
......
...@@ -39,14 +39,14 @@ ...@@ -39,14 +39,14 @@
#include "chrome/browser/ui/webui/options/language_dictionary_overlay_handler.h" #include "chrome/browser/ui/webui/options/language_dictionary_overlay_handler.h"
#include "chrome/browser/ui/webui/options/language_options_handler.h" #include "chrome/browser/ui/webui/options/language_options_handler.h"
#include "chrome/browser/ui/webui/options/manage_profile_handler.h" #include "chrome/browser/ui/webui/options/manage_profile_handler.h"
#include "chrome/browser/ui/webui/options/managed_user_create_confirm_handler.h"
#include "chrome/browser/ui/webui/options/managed_user_import_handler.h"
#include "chrome/browser/ui/webui/options/managed_user_learn_more_handler.h"
#include "chrome/browser/ui/webui/options/media_devices_selection_handler.h" #include "chrome/browser/ui/webui/options/media_devices_selection_handler.h"
#include "chrome/browser/ui/webui/options/password_manager_handler.h" #include "chrome/browser/ui/webui/options/password_manager_handler.h"
#include "chrome/browser/ui/webui/options/reset_profile_settings_handler.h" #include "chrome/browser/ui/webui/options/reset_profile_settings_handler.h"
#include "chrome/browser/ui/webui/options/search_engine_manager_handler.h" #include "chrome/browser/ui/webui/options/search_engine_manager_handler.h"
#include "chrome/browser/ui/webui/options/startup_pages_handler.h" #include "chrome/browser/ui/webui/options/startup_pages_handler.h"
#include "chrome/browser/ui/webui/options/supervised_user_create_confirm_handler.h"
#include "chrome/browser/ui/webui/options/supervised_user_import_handler.h"
#include "chrome/browser/ui/webui/options/supervised_user_learn_more_handler.h"
#include "chrome/browser/ui/webui/sync_setup_handler.h" #include "chrome/browser/ui/webui/sync_setup_handler.h"
#include "chrome/browser/ui/webui/theme_source.h" #include "chrome/browser/ui/webui/theme_source.h"
#include "chrome/common/url_constants.h" #include "chrome/common/url_constants.h"
...@@ -284,15 +284,16 @@ OptionsUI::OptionsUI(content::WebUI* web_ui) ...@@ -284,15 +284,16 @@ OptionsUI::OptionsUI(content::WebUI* web_ui)
AddOptionsPageUIHandler(localized_strings, AddOptionsPageUIHandler(localized_strings,
new LanguageDictionaryOverlayHandler()); new LanguageDictionaryOverlayHandler());
AddOptionsPageUIHandler(localized_strings, new ManageProfileHandler()); AddOptionsPageUIHandler(localized_strings, new ManageProfileHandler());
AddOptionsPageUIHandler(localized_strings,
new ManagedUserCreateConfirmHandler());
AddOptionsPageUIHandler(localized_strings, new ManagedUserImportHandler());
AddOptionsPageUIHandler(localized_strings, new ManagedUserLearnMoreHandler());
AddOptionsPageUIHandler(localized_strings, new PasswordManagerHandler()); AddOptionsPageUIHandler(localized_strings, new PasswordManagerHandler());
AddOptionsPageUIHandler(localized_strings, new ResetProfileSettingsHandler()); AddOptionsPageUIHandler(localized_strings, new ResetProfileSettingsHandler());
AddOptionsPageUIHandler(localized_strings, new SearchEngineManagerHandler()); AddOptionsPageUIHandler(localized_strings, new SearchEngineManagerHandler());
AddOptionsPageUIHandler(localized_strings, new ImportDataHandler()); AddOptionsPageUIHandler(localized_strings, new ImportDataHandler());
AddOptionsPageUIHandler(localized_strings, new StartupPagesHandler()); AddOptionsPageUIHandler(localized_strings, new StartupPagesHandler());
AddOptionsPageUIHandler(localized_strings,
new SupervisedUserCreateConfirmHandler());
AddOptionsPageUIHandler(localized_strings, new SupervisedUserImportHandler());
AddOptionsPageUIHandler(localized_strings,
new SupervisedUserLearnMoreHandler());
AddOptionsPageUIHandler(localized_strings, new SyncSetupHandler( AddOptionsPageUIHandler(localized_strings, new SyncSetupHandler(
g_browser_process->profile_manager())); g_browser_process->profile_manager()));
#if defined(OS_CHROMEOS) #if defined(OS_CHROMEOS)
......
// Copyright 2013 The Chromium Authors. All rights reserved. // Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "chrome/browser/ui/webui/options/managed_user_create_confirm_handler.h" #include "chrome/browser/ui/webui/options/supervised_user_create_confirm_handler.h"
#include "base/bind.h" #include "base/bind.h"
#include "base/files/file_path.h" #include "base/files/file_path.h"
...@@ -24,13 +24,13 @@ ...@@ -24,13 +24,13 @@
namespace options { namespace options {
ManagedUserCreateConfirmHandler::ManagedUserCreateConfirmHandler() { SupervisedUserCreateConfirmHandler::SupervisedUserCreateConfirmHandler() {
} }
ManagedUserCreateConfirmHandler::~ManagedUserCreateConfirmHandler() { SupervisedUserCreateConfirmHandler::~SupervisedUserCreateConfirmHandler() {
} }
void ManagedUserCreateConfirmHandler::GetLocalizedValues( void SupervisedUserCreateConfirmHandler::GetLocalizedValues(
base::DictionaryValue* localized_strings) { base::DictionaryValue* localized_strings) {
DCHECK(localized_strings); DCHECK(localized_strings);
...@@ -53,13 +53,13 @@ void ManagedUserCreateConfirmHandler::GetLocalizedValues( ...@@ -53,13 +53,13 @@ void ManagedUserCreateConfirmHandler::GetLocalizedValues(
RegisterStrings(localized_strings, resources, arraysize(resources)); RegisterStrings(localized_strings, resources, arraysize(resources));
} }
void ManagedUserCreateConfirmHandler::RegisterMessages() { void SupervisedUserCreateConfirmHandler::RegisterMessages() {
web_ui()->RegisterMessageCallback("switchToProfile", web_ui()->RegisterMessageCallback("switchToProfile",
base::Bind(&ManagedUserCreateConfirmHandler::SwitchToProfile, base::Bind(&SupervisedUserCreateConfirmHandler::SwitchToProfile,
base::Unretained(this))); base::Unretained(this)));
} }
void ManagedUserCreateConfirmHandler::SwitchToProfile( void SupervisedUserCreateConfirmHandler::SwitchToProfile(
const base::ListValue* args) { const base::ListValue* args) {
DCHECK(args); DCHECK(args);
const base::Value* file_path_value; const base::Value* file_path_value;
......
// Copyright 2013 The Chromium Authors. All rights reserved. // Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#ifndef CHROME_BROWSER_UI_WEBUI_OPTIONS_MANAGED_USER_CREATE_CONFIRM_HANDLER_H_ #ifndef CHROME_BROWSER_UI_WEBUI_OPTIONS_SUPERVISED_USER_CREATE_CONFIRM_HANDLER_H_
#define CHROME_BROWSER_UI_WEBUI_OPTIONS_MANAGED_USER_CREATE_CONFIRM_HANDLER_H_ #define CHROME_BROWSER_UI_WEBUI_OPTIONS_SUPERVISED_USER_CREATE_CONFIRM_HANDLER_H_
#include "chrome/browser/ui/webui/options/options_ui.h" #include "chrome/browser/ui/webui/options/options_ui.h"
...@@ -13,12 +13,12 @@ class DictionaryValue; ...@@ -13,12 +13,12 @@ class DictionaryValue;
namespace options { namespace options {
// Handler for the confirmation dialog after successful creation of a managed // Handler for the confirmation dialog after successful creation of a supervised
// user. // user.
class ManagedUserCreateConfirmHandler : public OptionsPageUIHandler { class SupervisedUserCreateConfirmHandler : public OptionsPageUIHandler {
public: public:
ManagedUserCreateConfirmHandler(); SupervisedUserCreateConfirmHandler();
virtual ~ManagedUserCreateConfirmHandler(); virtual ~SupervisedUserCreateConfirmHandler();
// OptionsPageUIHandler implementation. // OptionsPageUIHandler implementation.
virtual void GetLocalizedValues( virtual void GetLocalizedValues(
...@@ -33,9 +33,9 @@ class ManagedUserCreateConfirmHandler : public OptionsPageUIHandler { ...@@ -33,9 +33,9 @@ class ManagedUserCreateConfirmHandler : public OptionsPageUIHandler {
// |args| is of the form [ {string} profileFilePath ] // |args| is of the form [ {string} profileFilePath ]
void SwitchToProfile(const base::ListValue* args); void SwitchToProfile(const base::ListValue* args);
DISALLOW_COPY_AND_ASSIGN(ManagedUserCreateConfirmHandler); DISALLOW_COPY_AND_ASSIGN(SupervisedUserCreateConfirmHandler);
}; };
} // namespace options } // namespace options
#endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_MANAGED_USER_CREATE_CONFIRM_HANDLER_H_ #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_SUPERVISED_USER_CREATE_CONFIRM_HANDLER_H_
// Copyright 2013 The Chromium Authors. All rights reserved. // Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "chrome/browser/ui/webui/options/managed_user_import_handler.h" #include "chrome/browser/ui/webui/options/supervised_user_import_handler.h"
#include <set> #include <set>
...@@ -47,11 +47,11 @@ scoped_ptr<base::ListValue> GetAvatarIcons() { ...@@ -47,11 +47,11 @@ scoped_ptr<base::ListValue> GetAvatarIcons() {
namespace options { namespace options {
ManagedUserImportHandler::ManagedUserImportHandler() SupervisedUserImportHandler::SupervisedUserImportHandler()
: observer_(this), : observer_(this),
weak_ptr_factory_(this) {} weak_ptr_factory_(this) {}
ManagedUserImportHandler::~ManagedUserImportHandler() { SupervisedUserImportHandler::~SupervisedUserImportHandler() {
Profile* profile = Profile::FromWebUI(web_ui()); Profile* profile = Profile::FromWebUI(web_ui());
if (!profile->IsSupervised()) { if (!profile->IsSupervised()) {
SupervisedUserSyncService* service = SupervisedUserSyncService* service =
...@@ -62,7 +62,7 @@ ManagedUserImportHandler::~ManagedUserImportHandler() { ...@@ -62,7 +62,7 @@ ManagedUserImportHandler::~ManagedUserImportHandler() {
} }
} }
void ManagedUserImportHandler::GetLocalizedValues( void SupervisedUserImportHandler::GetLocalizedValues(
base::DictionaryValue* localized_strings) { base::DictionaryValue* localized_strings) {
DCHECK(localized_strings); DCHECK(localized_strings);
...@@ -86,7 +86,7 @@ void ManagedUserImportHandler::GetLocalizedValues( ...@@ -86,7 +86,7 @@ void ManagedUserImportHandler::GetLocalizedValues(
localized_strings->Set("avatarIcons", GetAvatarIcons().release()); localized_strings->Set("avatarIcons", GetAvatarIcons().release());
} }
void ManagedUserImportHandler::InitializeHandler() { void SupervisedUserImportHandler::InitializeHandler() {
Profile* profile = Profile::FromWebUI(web_ui()); Profile* profile = Profile::FromWebUI(web_ui());
if (!profile->IsSupervised()) { if (!profile->IsSupervised()) {
SupervisedUserSyncService* sync_service = SupervisedUserSyncService* sync_service =
...@@ -99,7 +99,7 @@ void ManagedUserImportHandler::InitializeHandler() { ...@@ -99,7 +99,7 @@ void ManagedUserImportHandler::InitializeHandler() {
SupervisedUserSharedSettingsServiceFactory::GetForBrowserContext( SupervisedUserSharedSettingsServiceFactory::GetForBrowserContext(
profile); profile);
subscription_ = settings_service->Subscribe( subscription_ = settings_service->Subscribe(
base::Bind(&ManagedUserImportHandler::OnSharedSettingChanged, base::Bind(&SupervisedUserImportHandler::OnSharedSettingChanged,
weak_ptr_factory_.GetWeakPtr())); weak_ptr_factory_.GetWeakPtr()));
} else { } else {
DCHECK(!SupervisedUserSharedSettingsServiceFactory::GetForBrowserContext( DCHECK(!SupervisedUserSharedSettingsServiceFactory::GetForBrowserContext(
...@@ -109,41 +109,42 @@ void ManagedUserImportHandler::InitializeHandler() { ...@@ -109,41 +109,42 @@ void ManagedUserImportHandler::InitializeHandler() {
} }
} }
void ManagedUserImportHandler::RegisterMessages() { void SupervisedUserImportHandler::RegisterMessages() {
web_ui()->RegisterMessageCallback("requestManagedUserImportUpdate", web_ui()->RegisterMessageCallback("requestManagedUserImportUpdate",
base::Bind(&ManagedUserImportHandler::RequestManagedUserImportUpdate, base::Bind(&SupervisedUserImportHandler::
RequestSupervisedUserImportUpdate,
base::Unretained(this))); base::Unretained(this)));
} }
void ManagedUserImportHandler::OnSupervisedUsersChanged() { void SupervisedUserImportHandler::OnSupervisedUsersChanged() {
FetchManagedUsers(); FetchSupervisedUsers();
} }
void ManagedUserImportHandler::FetchManagedUsers() { void SupervisedUserImportHandler::FetchSupervisedUsers() {
web_ui()->CallJavascriptFunction("options.ManagedUserListData.resetPromise"); web_ui()->CallJavascriptFunction("options.ManagedUserListData.resetPromise");
RequestManagedUserImportUpdate(NULL); RequestSupervisedUserImportUpdate(NULL);
} }
void ManagedUserImportHandler::RequestManagedUserImportUpdate( void SupervisedUserImportHandler::RequestSupervisedUserImportUpdate(
const base::ListValue* /* args */) { const base::ListValue* /* args */) {
if (Profile::FromWebUI(web_ui())->IsSupervised()) if (Profile::FromWebUI(web_ui())->IsSupervised())
return; return;
if (!IsAccountConnected() || HasAuthError()) { if (!IsAccountConnected() || HasAuthError()) {
ClearManagedUsersAndShowError(); ClearSupervisedUsersAndShowError();
} else { } else {
SupervisedUserSyncService* supervised_user_sync_service = SupervisedUserSyncService* supervised_user_sync_service =
SupervisedUserSyncServiceFactory::GetForProfile( SupervisedUserSyncServiceFactory::GetForProfile(
Profile::FromWebUI(web_ui())); Profile::FromWebUI(web_ui()));
if (supervised_user_sync_service) { if (supervised_user_sync_service) {
supervised_user_sync_service->GetSupervisedUsersAsync( supervised_user_sync_service->GetSupervisedUsersAsync(
base::Bind(&ManagedUserImportHandler::SendExistingManagedUsers, base::Bind(&SupervisedUserImportHandler::SendExistingSupervisedUsers,
weak_ptr_factory_.GetWeakPtr())); weak_ptr_factory_.GetWeakPtr()));
} }
} }
} }
void ManagedUserImportHandler::SendExistingManagedUsers( void SupervisedUserImportHandler::SendExistingSupervisedUsers(
const base::DictionaryValue* dict) { const base::DictionaryValue* dict) {
DCHECK(dict); DCHECK(dict);
const ProfileInfoCache& cache = const ProfileInfoCache& cache =
...@@ -208,18 +209,18 @@ void ManagedUserImportHandler::SendExistingManagedUsers( ...@@ -208,18 +209,18 @@ void ManagedUserImportHandler::SendExistingManagedUsers(
supervised_users); supervised_users);
} }
void ManagedUserImportHandler::ClearManagedUsersAndShowError() { void SupervisedUserImportHandler::ClearSupervisedUsersAndShowError() {
web_ui()->CallJavascriptFunction("options.ManagedUserListData.onSigninError"); web_ui()->CallJavascriptFunction("options.ManagedUserListData.onSigninError");
} }
bool ManagedUserImportHandler::IsAccountConnected() const { bool SupervisedUserImportHandler::IsAccountConnected() const {
Profile* profile = Profile::FromWebUI(web_ui()); Profile* profile = Profile::FromWebUI(web_ui());
SigninManagerBase* signin_manager = SigninManagerBase* signin_manager =
SigninManagerFactory::GetForProfile(profile); SigninManagerFactory::GetForProfile(profile);
return signin_manager && !signin_manager->GetAuthenticatedUsername().empty(); return signin_manager && !signin_manager->GetAuthenticatedUsername().empty();
} }
bool ManagedUserImportHandler::HasAuthError() const { bool SupervisedUserImportHandler::HasAuthError() const {
Profile* profile = Profile::FromWebUI(web_ui()); Profile* profile = Profile::FromWebUI(web_ui());
ProfileOAuth2TokenService* token_service = ProfileOAuth2TokenService* token_service =
ProfileOAuth2TokenServiceFactory::GetForProfile(profile); ProfileOAuth2TokenServiceFactory::GetForProfile(profile);
...@@ -237,15 +238,15 @@ bool ManagedUserImportHandler::HasAuthError() const { ...@@ -237,15 +238,15 @@ bool ManagedUserImportHandler::HasAuthError() const {
state == GoogleServiceAuthError::ACCOUNT_DISABLED; state == GoogleServiceAuthError::ACCOUNT_DISABLED;
} }
void ManagedUserImportHandler::OnSharedSettingChanged( void SupervisedUserImportHandler::OnSharedSettingChanged(
const std::string& supervised_user_id, const std::string& supervised_user_id,
const std::string& key) { const std::string& key) {
if (key == supervised_users::kChromeAvatarIndex) if (key == supervised_users::kChromeAvatarIndex)
FetchManagedUsers(); FetchSupervisedUsers();
} }
void ManagedUserImportHandler::OnErrorChanged() { void SupervisedUserImportHandler::OnErrorChanged() {
FetchManagedUsers(); FetchSupervisedUsers();
} }
} // namespace options } // namespace options
// Copyright 2013 The Chromium Authors. All rights reserved. // Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#ifndef CHROME_BROWSER_UI_WEBUI_OPTIONS_MANAGED_USER_IMPORT_HANDLER_H_ #ifndef CHROME_BROWSER_UI_WEBUI_OPTIONS_SUPERVISED_USER_IMPORT_HANDLER_H_
#define CHROME_BROWSER_UI_WEBUI_OPTIONS_MANAGED_USER_IMPORT_HANDLER_H_ #define CHROME_BROWSER_UI_WEBUI_OPTIONS_SUPERVISED_USER_IMPORT_HANDLER_H_
#include "base/callback_list.h" #include "base/callback_list.h"
#include "base/memory/weak_ptr.h" #include "base/memory/weak_ptr.h"
...@@ -19,16 +19,16 @@ class ListValue; ...@@ -19,16 +19,16 @@ class ListValue;
namespace options { namespace options {
// Handler for the 'import existing managed user' dialog. // Handler for the 'import existing supervised user' dialog.
class ManagedUserImportHandler : public OptionsPageUIHandler, class SupervisedUserImportHandler : public OptionsPageUIHandler,
public SupervisedUserSyncServiceObserver, public SupervisedUserSyncServiceObserver,
public SigninErrorController::Observer { public SigninErrorController::Observer {
public: public:
typedef base::CallbackList<void(const std::string&, const std::string&)> typedef base::CallbackList<void(const std::string&, const std::string&)>
CallbackList; CallbackList;
ManagedUserImportHandler(); SupervisedUserImportHandler();
virtual ~ManagedUserImportHandler(); virtual ~SupervisedUserImportHandler();
// OptionsPageUIHandler implementation. // OptionsPageUIHandler implementation.
virtual void GetLocalizedValues( virtual void GetLocalizedValues(
...@@ -48,49 +48,49 @@ class ManagedUserImportHandler : public OptionsPageUIHandler, ...@@ -48,49 +48,49 @@ class ManagedUserImportHandler : public OptionsPageUIHandler,
virtual void OnErrorChanged() OVERRIDE; virtual void OnErrorChanged() OVERRIDE;
private: private:
// Clears the cached list of managed users and fetches the new list of managed // Clears the cached list of supervised users and fetches the new list of
// users. // supervised users.
void FetchManagedUsers(); void FetchSupervisedUsers();
// Callback for the "requestManagedUserImportUpdate" message. // Callback for the "requestManagedUserImportUpdate" message.
// Checks the sign-in status of the custodian and accordingly // Checks the sign-in status of the custodian and accordingly
// sends an update to the WebUI. The update can be to show/hide // sends an update to the WebUI. The update can be to show/hide
// an error bubble and update/clear the managed user list. // an error bubble and update/clear the supervised user list.
void RequestManagedUserImportUpdate(const base::ListValue* args); void RequestSupervisedUserImportUpdate(const base::ListValue* args);
// Sends an array of managed users to WebUI. Each entry is of the form: // Sends an array of supervised users to WebUI. Each entry is of the form:
// managedProfile = { // supervisedProfile = {
// id: "Managed User ID", // id: "Supervised User ID",
// name: "Managed User Name", // name: "Supervised User Name",
// iconURL: "chrome://path/to/icon/image", // iconURL: "chrome://path/to/icon/image",
// onCurrentDevice: true or false, // onCurrentDevice: true or false,
// needAvatar: true or false // needAvatar: true or false
// } // }
// The array holds all existing managed users attached to the // The array holds all existing supervised users attached to the
// custodian's profile which initiated the request. // custodian's profile which initiated the request.
void SendExistingManagedUsers(const base::DictionaryValue* dict); void SendExistingSupervisedUsers(const base::DictionaryValue* dict);
// Sends messages to the JS side to clear managed users and show an error // Sends messages to the JS side to clear supervised users and show an error
// bubble. // bubble.
void ClearManagedUsersAndShowError(); void ClearSupervisedUsersAndShowError();
bool IsAccountConnected() const; bool IsAccountConnected() const;
bool HasAuthError() const; bool HasAuthError() const;
// Called when a managed user shared setting is changed. If the avatar was // Called when a supervised user shared setting is changed. If the avatar was
// changed, FetchManagedUsers() is called. // changed, FetchSupervisedUsers() is called.
void OnSharedSettingChanged(const std::string& managed_user_id, void OnSharedSettingChanged(const std::string& supervised_user_id,
const std::string& key); const std::string& key);
scoped_ptr<CallbackList::Subscription> subscription_; scoped_ptr<CallbackList::Subscription> subscription_;
ScopedObserver<SigninErrorController, ManagedUserImportHandler> observer_; ScopedObserver<SigninErrorController, SupervisedUserImportHandler> observer_;
base::WeakPtrFactory<ManagedUserImportHandler> weak_ptr_factory_; base::WeakPtrFactory<SupervisedUserImportHandler> weak_ptr_factory_;
DISALLOW_COPY_AND_ASSIGN(ManagedUserImportHandler); DISALLOW_COPY_AND_ASSIGN(SupervisedUserImportHandler);
}; };
} // namespace options } // namespace options
#endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_MANAGED_USER_IMPORT_HANDLER_H_ #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_SUPERVISED_USER_IMPORT_HANDLER_H_
// Copyright 2013 The Chromium Authors. All rights reserved. // Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "chrome/browser/ui/webui/options/managed_user_learn_more_handler.h" #include "chrome/browser/ui/webui/options/supervised_user_learn_more_handler.h"
#include "base/values.h" #include "base/values.h"
#include "grit/generated_resources.h" #include "grit/generated_resources.h"
namespace options { namespace options {
ManagedUserLearnMoreHandler::ManagedUserLearnMoreHandler() { SupervisedUserLearnMoreHandler::SupervisedUserLearnMoreHandler() {
} }
ManagedUserLearnMoreHandler::~ManagedUserLearnMoreHandler() { SupervisedUserLearnMoreHandler::~SupervisedUserLearnMoreHandler() {
} }
void ManagedUserLearnMoreHandler::GetLocalizedValues( void SupervisedUserLearnMoreHandler::GetLocalizedValues(
base::DictionaryValue* localized_strings) { base::DictionaryValue* localized_strings) {
DCHECK(localized_strings); DCHECK(localized_strings);
......
// Copyright 2013 The Chromium Authors. All rights reserved. // Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#ifndef CHROME_BROWSER_UI_WEBUI_OPTIONS_MANAGED_USER_LEARN_MORE_HANDLER_H_ #ifndef CHROME_BROWSER_UI_WEBUI_OPTIONS_SUPERVISED_USER_LEARN_MORE_HANDLER_H_
#define CHROME_BROWSER_UI_WEBUI_OPTIONS_MANAGED_USER_LEARN_MORE_HANDLER_H_ #define CHROME_BROWSER_UI_WEBUI_OPTIONS_SUPERVISED_USER_LEARN_MORE_HANDLER_H_
#include "chrome/browser/ui/webui/options/options_ui.h" #include "chrome/browser/ui/webui/options/options_ui.h"
...@@ -13,21 +13,21 @@ class DictionaryValue; ...@@ -13,21 +13,21 @@ class DictionaryValue;
namespace options { namespace options {
// Handler for the "Learn more" dialog available during creation of a managed // Handler for the "Learn more" dialog available during creation of a supervised
// user. // user.
class ManagedUserLearnMoreHandler : public OptionsPageUIHandler { class SupervisedUserLearnMoreHandler : public OptionsPageUIHandler {
public: public:
ManagedUserLearnMoreHandler(); SupervisedUserLearnMoreHandler();
virtual ~ManagedUserLearnMoreHandler(); virtual ~SupervisedUserLearnMoreHandler();
// OptionsPageUIHandler implementation. // OptionsPageUIHandler implementation.
virtual void GetLocalizedValues( virtual void GetLocalizedValues(
base::DictionaryValue* localized_strings) OVERRIDE; base::DictionaryValue* localized_strings) OVERRIDE;
private: private:
DISALLOW_COPY_AND_ASSIGN(ManagedUserLearnMoreHandler); DISALLOW_COPY_AND_ASSIGN(SupervisedUserLearnMoreHandler);
}; };
} // namespace options } // namespace options
#endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_MANAGED_USER_LEARN_MORE_HANDLER_H_ #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_SUPERVISED_USER_LEARN_MORE_HANDLER_H_
...@@ -1723,12 +1723,6 @@ ...@@ -1723,12 +1723,6 @@
'browser/ui/webui/options/language_options_handler_common.h', 'browser/ui/webui/options/language_options_handler_common.h',
'browser/ui/webui/options/manage_profile_handler.cc', 'browser/ui/webui/options/manage_profile_handler.cc',
'browser/ui/webui/options/manage_profile_handler.h', 'browser/ui/webui/options/manage_profile_handler.h',
'browser/ui/webui/options/managed_user_create_confirm_handler.cc',
'browser/ui/webui/options/managed_user_create_confirm_handler.h',
'browser/ui/webui/options/managed_user_import_handler.cc',
'browser/ui/webui/options/managed_user_import_handler.h',
'browser/ui/webui/options/managed_user_learn_more_handler.cc',
'browser/ui/webui/options/managed_user_learn_more_handler.h',
'browser/ui/webui/options/media_devices_selection_handler.cc', 'browser/ui/webui/options/media_devices_selection_handler.cc',
'browser/ui/webui/options/media_devices_selection_handler.h', 'browser/ui/webui/options/media_devices_selection_handler.h',
'browser/ui/webui/options/options_handlers_helper.cc', 'browser/ui/webui/options/options_handlers_helper.cc',
...@@ -1745,6 +1739,12 @@ ...@@ -1745,6 +1739,12 @@
'browser/ui/webui/options/search_engine_manager_handler.h', 'browser/ui/webui/options/search_engine_manager_handler.h',
'browser/ui/webui/options/startup_pages_handler.cc', 'browser/ui/webui/options/startup_pages_handler.cc',
'browser/ui/webui/options/startup_pages_handler.h', 'browser/ui/webui/options/startup_pages_handler.h',
'browser/ui/webui/options/supervised_user_create_confirm_handler.cc',
'browser/ui/webui/options/supervised_user_create_confirm_handler.h',
'browser/ui/webui/options/supervised_user_import_handler.cc',
'browser/ui/webui/options/supervised_user_import_handler.h',
'browser/ui/webui/options/supervised_user_learn_more_handler.cc',
'browser/ui/webui/options/supervised_user_learn_more_handler.h',
'browser/ui/webui/performance_monitor/performance_monitor_handler.cc', 'browser/ui/webui/performance_monitor/performance_monitor_handler.cc',
'browser/ui/webui/performance_monitor/performance_monitor_handler.h', 'browser/ui/webui/performance_monitor/performance_monitor_handler.h',
'browser/ui/webui/performance_monitor/performance_monitor_l10n.cc', 'browser/ui/webui/performance_monitor/performance_monitor_l10n.cc',
......
...@@ -2418,11 +2418,11 @@ ...@@ -2418,11 +2418,11 @@
'browser/sync/test/integration/single_client_bookmarks_sync_test.cc', 'browser/sync/test/integration/single_client_bookmarks_sync_test.cc',
'browser/sync/test/integration/single_client_dictionary_sync_test.cc', 'browser/sync/test/integration/single_client_dictionary_sync_test.cc',
'browser/sync/test/integration/single_client_extensions_sync_test.cc', 'browser/sync/test/integration/single_client_extensions_sync_test.cc',
'browser/sync/test/integration/single_client_managed_user_settings_sync_test.cc',
'browser/sync/test/integration/single_client_passwords_sync_test.cc', 'browser/sync/test/integration/single_client_passwords_sync_test.cc',
'browser/sync/test/integration/single_client_preferences_sync_test.cc', 'browser/sync/test/integration/single_client_preferences_sync_test.cc',
'browser/sync/test/integration/single_client_search_engines_sync_test.cc', 'browser/sync/test/integration/single_client_search_engines_sync_test.cc',
'browser/sync/test/integration/single_client_sessions_sync_test.cc', 'browser/sync/test/integration/single_client_sessions_sync_test.cc',
'browser/sync/test/integration/single_client_supervised_user_settings_sync_test.cc',
'browser/sync/test/integration/single_client_themes_sync_test.cc', 'browser/sync/test/integration/single_client_themes_sync_test.cc',
'browser/sync/test/integration/single_client_typed_urls_sync_test.cc', 'browser/sync/test/integration/single_client_typed_urls_sync_test.cc',
'browser/sync/test/integration/sync_auth_test.cc', 'browser/sync/test/integration/sync_auth_test.cc',
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment