Skip to content

Commit

Permalink
Rename "managed (mode|user)" to "supervised user" (part 1)
Browse files Browse the repository at this point in the history
This CL changes:
- "IsManaged" and similar methods in Profile, ProfileInfoCache, and a few other places (which mostly forward to either of those)
- Enum and constant names
- Variable names
- Comments

Still missing:
- I almost certainly missed a few variables and comments
- The actual SU implementation, i.e. c/b/managed_mode/
- JavaScript
- Resource names

But since this CL is already way too huge, I'll try to commit this part now and do the rest in one or more followup CLs.

TBR=thakis@chromium.org (chrome/)
TBR=rogerta@chromium.org (google_apis/)
TBR=haitaol@chromium.org (sync/ and components/sync_driver/)

All the TBRs are simple renames.

BUG=none

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@276722 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
treib@chromium.org committed Jun 12, 2014
1 parent d882d90 commit d20d043
Show file tree
Hide file tree
Showing 137 changed files with 772 additions and 740 deletions.
2 changes: 1 addition & 1 deletion chrome/browser/app_controller_mac.mm
Original file line number Diff line number Diff line change
Expand Up @@ -1455,7 +1455,7 @@ - (NSMenu*)applicationDockMenu:(NSApplication*)sender {
[dockMenu addItem:item];

// |profile| can be NULL during unit tests.
if (!profile || !profile->IsManaged()) {
if (!profile || !profile->IsSupervised()) {
titleStr = l10n_util::GetNSStringWithFixup(IDS_NEW_INCOGNITO_WINDOW_MAC);
item.reset(
[[NSMenuItem alloc] initWithTitle:titleStr
Expand Down
10 changes: 5 additions & 5 deletions chrome/browser/chromeos/login/fake_login_utils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,13 @@ void FakeLoginUtils::PrepareProfile(const UserContext& user_context,

if (UserManager::Get()->IsLoggedInAsLocallyManagedUser()) {
User* active_user = UserManager::Get()->GetActiveUser();
std::string managed_user_sync_id =
std::string supervised_user_sync_id =
UserManager::Get()->GetSupervisedUserManager()->
GetUserSyncId(active_user->email());
if (managed_user_sync_id.empty())
managed_user_sync_id = "DUMMY ID";
profile->GetPrefs()->SetString(prefs::kManagedUserId,
managed_user_sync_id);
if (supervised_user_sync_id.empty())
supervised_user_sync_id = "DUMMY ID";
profile->GetPrefs()->SetString(prefs::kSupervisedUserId,
supervised_user_sync_id);
}

content::NotificationService::current()->Notify(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ ManagedUsersSyncTestAdapter::ManagedUsersSyncTestAdapter(Profile* profile)
service_ = ManagedUserSyncServiceFactory::GetForProfile(profile);
processor_ = new syncer::FakeSyncChangeProcessor();
service_->MergeDataAndStartSyncing(
syncer::MANAGED_USERS,
syncer::SUPERVISED_USERS,
syncer::SyncDataList(),
scoped_ptr<syncer::SyncChangeProcessor>(processor_),
scoped_ptr<syncer::SyncErrorFactory>(new syncer::SyncErrorFactoryMock));
Expand All @@ -70,7 +70,7 @@ ManagedUsersSyncTestAdapter::GetFirstChange() {
CHECK(HasChanges())
<< "GetFirstChange() should only be callled if HasChanges() is true";
const syncer::SyncData& data = processor_->changes().front().sync_data();
EXPECT_EQ(syncer::MANAGED_USERS, data.GetDataType());
EXPECT_EQ(syncer::SUPERVISED_USERS, data.GetDataType());
result->CopyFrom(data.GetSpecifics().managed_user());
return result.Pass();
}
Expand Down Expand Up @@ -106,7 +106,7 @@ ManagedUsersSharedSettingsSyncTestAdapter::
ManagedUserSharedSettingsServiceFactory::GetForBrowserContext(profile);
processor_ = new syncer::FakeSyncChangeProcessor();
service_->MergeDataAndStartSyncing(
syncer::MANAGED_USER_SHARED_SETTINGS,
syncer::SUPERVISED_USER_SHARED_SETTINGS,
syncer::SyncDataList(),
scoped_ptr<syncer::SyncChangeProcessor>(processor_),
scoped_ptr<syncer::SyncErrorFactory>(new syncer::SyncErrorFactoryMock));
Expand All @@ -119,7 +119,7 @@ ManagedUsersSharedSettingsSyncTestAdapter::GetFirstChange() {
CHECK(HasChanges())
<< "GetFirstChange() should only be callled if HasChanges() is true";
const syncer::SyncData& data = processor_->changes().front().sync_data();
EXPECT_EQ(syncer::MANAGED_USER_SHARED_SETTINGS, data.GetDataType());
EXPECT_EQ(syncer::SUPERVISED_USER_SHARED_SETTINGS, data.GetDataType());
result->CopyFrom(data.GetSpecifics().managed_user_shared_setting());
return result.Pass();
}
Expand Down
3 changes: 2 additions & 1 deletion chrome/browser/chromeos/login/session/session_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,8 @@ void SessionManager::InitProfilePreferences(Profile* profile,
std::string managed_user_sync_id =
UserManager::Get()->GetSupervisedUserManager()->
GetUserSyncId(active_user->email());
profile->GetPrefs()->SetString(prefs::kManagedUserId, managed_user_sync_id);
profile->GetPrefs()->SetString(prefs::kSupervisedUserId,
managed_user_sync_id);
} else if (UserManager::Get()->IsLoggedInAsRegularUser()) {
// Make sure that the google service username is properly set (we do this
// on every sign in, not just the first login, to deal with existing
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ void AvatarMenuActionsChromeOS::EditProfile(Profile* profile, size_t index) {

bool AvatarMenuActionsChromeOS::ShouldShowAddNewProfileLink() const {
// |browser_| can be NULL in unit_tests.
return (!browser_ || !browser_->profile()->IsManaged()) &&
return (!browser_ || !browser_->profile()->IsSupervised()) &&
UserManager::Get()->GetUsersAdmittedForMultiProfile().size();
}

Expand Down
2 changes: 1 addition & 1 deletion chrome/browser/chromeos/profiles/profile_list_chromeos.cc
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ void ProfileListChromeOS::RebuildMenu() {
item->name = (*it)->GetDisplayName();
item->sync_state = profile_info_->GetUserNameOfProfileAtIndex(i);
item->profile_path = profile_info_->GetPathOfProfileAtIndex(i);
item->managed = false;
item->supervised = false;
item->signed_in = true;
item->active = profile_info_->GetPathOfProfileAtIndex(i) ==
active_profile_path_;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1318,7 +1318,7 @@ void DeveloperPrivateChoosePathFunction::FileSelectionCanceled() {
DeveloperPrivateChoosePathFunction::~DeveloperPrivateChoosePathFunction() {}

bool DeveloperPrivateIsProfileManagedFunction::RunSync() {
SetResult(new base::FundamentalValue(GetProfile()->IsManaged()));
SetResult(new base::FundamentalValue(GetProfile()->IsSupervised()));
return true;
}

Expand Down
8 changes: 5 additions & 3 deletions chrome/browser/extensions/extension_service_test_base.cc
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ scoped_ptr<TestingProfile> BuildTestingProfile(
profile_builder.SetPrefService(prefs.Pass());
}

if (params.profile_is_managed)
profile_builder.SetManagedUserId("asdf");
if (params.profile_is_supervised)
profile_builder.SetSupervisedUserId("asdf");

profile_builder.SetPath(params.profile_path);
return profile_builder.Build();
Expand All @@ -63,7 +63,9 @@ scoped_ptr<TestingProfile> BuildTestingProfile(

ExtensionServiceTestBase::ExtensionServiceInitParams::
ExtensionServiceInitParams()
: autoupdate_enabled(false), is_first_run(true), profile_is_managed(false) {
: autoupdate_enabled(false),
is_first_run(true),
profile_is_supervised(false) {
}

// Our message loop may be used in tests which require it to be an IO loop.
Expand Down
6 changes: 3 additions & 3 deletions chrome/browser/extensions/extension_service_test_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ class ExtensionServiceTestBase : public testing::Test {
base::FilePath profile_path;
base::FilePath pref_file;
base::FilePath extensions_install_dir;
bool autoupdate_enabled; // defaults to false.
bool is_first_run; // defaults to true.
bool profile_is_managed; // defaults to false.
bool autoupdate_enabled; // defaults to false.
bool is_first_run; // defaults to true.
bool profile_is_supervised; // defaults to false.

// Though you could use this constructor, you probably want to use
// CreateDefaultInitParams(), and then make a change or two.
Expand Down
8 changes: 4 additions & 4 deletions chrome/browser/extensions/external_provider_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ void ExternalProviderImpl::CreateExternalProviders(
#endif

#if defined(OS_LINUX) && !defined(OS_CHROMEOS)
if (!profile->IsManaged()) {
if (!profile->IsSupervised()) {
provider_list->push_back(
linked_ptr<ExternalProviderInterface>(
new ExternalProviderImpl(
Expand All @@ -446,8 +446,8 @@ void ExternalProviderImpl::CreateExternalProviders(

#if defined(OS_CHROMEOS)
if (!is_chromeos_demo_session && !is_chrome_os_public_session) {
int external_apps_path_id = profile->IsManaged() ?
chrome::DIR_MANAGED_USERS_DEFAULT_APPS :
int external_apps_path_id = profile->IsSupervised() ?
chrome::DIR_SUPERVISED_USERS_DEFAULT_APPS :
chrome::DIR_STANDALONE_EXTERNAL_EXTENSIONS;
provider_list->push_back(
linked_ptr<ExternalProviderInterface>(new ExternalProviderImpl(
Expand Down Expand Up @@ -488,7 +488,7 @@ void ExternalProviderImpl::CreateExternalProviders(
}
#endif

if (!profile->IsManaged() && !is_chromeos_demo_session) {
if (!profile->IsSupervised() && !is_chromeos_demo_session) {
#if !defined(OS_WIN)
provider_list->push_back(
linked_ptr<ExternalProviderInterface>(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ class WebstoreStartupInstallerManagedUsersTest
// InProcessBrowserTest overrides:
virtual void SetUpCommandLine(base::CommandLine* command_line) OVERRIDE {
WebstoreStartupInstallerTest::SetUpCommandLine(command_line);
command_line->AppendSwitchASCII(switches::kManagedUserId, "asdf");
command_line->AppendSwitchASCII(switches::kSupervisedUserId, "asdf");
}
};

Expand Down
2 changes: 1 addition & 1 deletion chrome/browser/managed_mode/managed_mode_browsertest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ class ManagedModeBlockModeTest : public InProcessBrowserTest {
"MAP *.new-example.com " + host_port + "," +
"MAP *.a.com " + host_port);

command_line->AppendSwitchASCII(switches::kManagedUserId, "asdf");
command_line->AppendSwitchASCII(switches::kSupervisedUserId, "asdf");
}

// Acts like a synchronous call to history's QueryHistory. Modified from
Expand Down
6 changes: 3 additions & 3 deletions chrome/browser/managed_mode/managed_mode_interstitial.cc
Original file line number Diff line number Diff line change
Expand Up @@ -98,15 +98,15 @@ bool ManagedModeInterstitial::Init() {
PrefService* prefs = profile->GetPrefs();
pref_change_registrar_.Init(prefs);
pref_change_registrar_.Add(
prefs::kDefaultManagedModeFilteringBehavior,
prefs::kDefaultSupervisedUserFilteringBehavior,
base::Bind(&ManagedModeInterstitial::OnFilteringPrefsChanged,
base::Unretained(this)));
pref_change_registrar_.Add(
prefs::kManagedModeManualHosts,
prefs::kSupervisedUserManualHosts,
base::Bind(&ManagedModeInterstitial::OnFilteringPrefsChanged,
base::Unretained(this)));
pref_change_registrar_.Add(
prefs::kManagedModeManualURLs,
prefs::kSupervisedUserManualURLs,
base::Bind(&ManagedModeInterstitial::OnFilteringPrefsChanged,
base::Unretained(this)));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ void ManagedModeResourceThrottleTest::SetUpOnMainThread() {

void ManagedModeResourceThrottleTest::SetUpCommandLine(
CommandLine* command_line) {
command_line->AppendSwitchASCII(switches::kManagedUserId, "asdf");
command_line->AppendSwitchASCII(switches::kSupervisedUserId, "asdf");
}

// Tests that showing the blocking interstitial for a WebContents without a
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#include "net/url_request/url_fetcher.h"
#include "net/url_request/url_request_status.h"

using GaiaConstants::kChromeSyncManagedOAuth2Scope;
using GaiaConstants::kChromeSyncSupervisedOAuth2Scope;
using base::Time;
using gaia::GaiaOAuthClient;
using net::URLFetcher;
Expand Down Expand Up @@ -159,7 +159,7 @@ void ManagedUserRefreshTokenFetcherImpl::OnGetTokenSuccess(
kIssueTokenBodyFormat,
net::EscapeUrlEncodedData(
GaiaUrls::GetInstance()->oauth2_chrome_client_id(), true).c_str(),
net::EscapeUrlEncodedData(kChromeSyncManagedOAuth2Scope, true).c_str(),
net::EscapeUrlEncodedData(kChromeSyncSupervisedOAuth2Scope, true).c_str(),
net::EscapeUrlEncodedData(managed_user_id_, true).c_str(),
net::EscapeUrlEncodedData(device_name_, true).c_str());
url_fetcher_->SetUploadData("application/x-www-form-urlencoded", body);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ void ManagedUserRegistrationUtilityImpl::Register(

bool need_password_update = !info.password_data.empty();
const base::DictionaryValue* dict =
prefs_->GetDictionary(prefs::kManagedUsers);
prefs_->GetDictionary(prefs::kSupervisedUsers);
is_existing_managed_user_ = dict->HasKey(managed_user_id);
if (!is_existing_managed_user_) {
managed_user_sync_service_->AddManagedUser(pending_managed_user_id_,
Expand Down Expand Up @@ -351,7 +351,7 @@ void ManagedUserRegistrationUtilityImpl::OnReceivedToken(

void ManagedUserRegistrationUtilityImpl::CompleteRegistrationIfReady() {
bool skip_check = CommandLine::ForCurrentProcess()->HasSwitch(
switches::kNoManagedUserAcknowledgmentCheck);
switches::kNoSupervisedUserAcknowledgmentCheck);

if (!pending_managed_user_acknowledged_ && !skip_check)
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#include "testing/gtest/include/gtest/gtest.h"

using sync_pb::ManagedUserSpecifics;
using syncer::MANAGED_USERS;
using syncer::SUPERVISED_USERS;
using syncer::SyncChange;
using syncer::SyncChangeList;
using syncer::SyncChangeProcessor;
Expand All @@ -39,7 +39,7 @@ using syncer::SyncMergeResult;

namespace {

const char kManagedUserToken[] = "managedusertoken";
const char kSupervisedUserToken[] = "supervisedusertoken";

class MockChangeProcessor : public SyncChangeProcessor {
public:
Expand Down Expand Up @@ -80,7 +80,7 @@ class MockManagedUserRefreshTokenFetcher
const std::string& device_name,
const TokenCallback& callback) OVERRIDE {
GoogleServiceAuthError error(GoogleServiceAuthError::NONE);
callback.Run(error, kManagedUserToken);
callback.Run(error, kSupervisedUserToken);
}
};

Expand Down Expand Up @@ -180,7 +180,7 @@ ManagedUserRegistrationUtilityTest::CreateErrorFactory() {
SyncMergeResult ManagedUserRegistrationUtilityTest::StartInitialSync() {
SyncDataList initial_sync_data;
SyncMergeResult result =
service()->MergeDataAndStartSyncing(MANAGED_USERS,
service()->MergeDataAndStartSyncing(SUPERVISED_USERS,
initial_sync_data,
CreateChangeProcessor(),
CreateErrorFactory());
Expand Down Expand Up @@ -249,7 +249,7 @@ TEST_F(ManagedUserRegistrationUtilityTest, Register) {
ManagedUserRegistrationUtility::GenerateNewManagedUserId(),
ManagedUserRegistrationInfo(base::ASCIIToUTF16("Dug"), 0),
GetRegistrationCallback());
EXPECT_EQ(1u, prefs()->GetDictionary(prefs::kManagedUsers)->size());
EXPECT_EQ(1u, prefs()->GetDictionary(prefs::kSupervisedUsers)->size());
Acknowledge();

EXPECT_TRUE(received_callback());
Expand All @@ -262,7 +262,7 @@ TEST_F(ManagedUserRegistrationUtilityTest, RegisterBeforeInitialSync) {
ManagedUserRegistrationUtility::GenerateNewManagedUserId(),
ManagedUserRegistrationInfo(base::ASCIIToUTF16("Nemo"), 5),
GetRegistrationCallback());
EXPECT_EQ(1u, prefs()->GetDictionary(prefs::kManagedUsers)->size());
EXPECT_EQ(1u, prefs()->GetDictionary(prefs::kSupervisedUsers)->size());
StartInitialSync();
Acknowledge();

Expand All @@ -277,9 +277,9 @@ TEST_F(ManagedUserRegistrationUtilityTest, SyncServiceShutdownBeforeRegFinish) {
ManagedUserRegistrationUtility::GenerateNewManagedUserId(),
ManagedUserRegistrationInfo(base::ASCIIToUTF16("Remy"), 12),
GetRegistrationCallback());
EXPECT_EQ(1u, prefs()->GetDictionary(prefs::kManagedUsers)->size());
EXPECT_EQ(1u, prefs()->GetDictionary(prefs::kSupervisedUsers)->size());
service()->Shutdown();
EXPECT_EQ(0u, prefs()->GetDictionary(prefs::kManagedUsers)->size());
EXPECT_EQ(0u, prefs()->GetDictionary(prefs::kSupervisedUsers)->size());
EXPECT_TRUE(received_callback());
EXPECT_EQ(GoogleServiceAuthError::REQUEST_CANCELED, error().state());
EXPECT_EQ(std::string(), token());
Expand All @@ -291,9 +291,9 @@ TEST_F(ManagedUserRegistrationUtilityTest, StopSyncingBeforeRegFinish) {
ManagedUserRegistrationUtility::GenerateNewManagedUserId(),
ManagedUserRegistrationInfo(base::ASCIIToUTF16("Mike"), 17),
GetRegistrationCallback());
EXPECT_EQ(1u, prefs()->GetDictionary(prefs::kManagedUsers)->size());
service()->StopSyncing(MANAGED_USERS);
EXPECT_EQ(0u, prefs()->GetDictionary(prefs::kManagedUsers)->size());
EXPECT_EQ(1u, prefs()->GetDictionary(prefs::kSupervisedUsers)->size());
service()->StopSyncing(SUPERVISED_USERS);
EXPECT_EQ(0u, prefs()->GetDictionary(prefs::kSupervisedUsers)->size());
EXPECT_TRUE(received_callback());
EXPECT_EQ(GoogleServiceAuthError::REQUEST_CANCELED, error().state());
EXPECT_EQ(std::string(), token());
Expand Down
Loading

0 comments on commit d20d043

Please sign in to comment.