summaryrefslogtreecommitdiffstats
path: root/chrome/browser/chromeos/arc/arc_auth_service.cc
diff options
context:
space:
mode:
authornya <nya@chromium.org>2016-03-23 03:12:33 -0700
committerCommit bot <commit-bot@chromium.org>2016-03-23 10:13:46 +0000
commit1b5973d3a7a70a3446502035ef5431c7fda56518 (patch)
tree71ffc3e755a02b918d1d0382c96a04a88e1d7356 /chrome/browser/chromeos/arc/arc_auth_service.cc
parent26d91d2108a891ad9e0cfed8d15fbb312381fda1 (diff)
downloadchromium_src-1b5973d3a7a70a3446502035ef5431c7fda56518.zip
chromium_src-1b5973d3a7a70a3446502035ef5431c7fda56518.tar.gz
chromium_src-1b5973d3a7a70a3446502035ef5431c7fda56518.tar.bz2
Revert of Add ArcEnabled policy implementation
Reason for revert: This change broke --disable-arc-opt-in-verification used for autotests. > Add ArcEnabled policy implementation > > Hide "ARC OptIn" control from Chrome:Settings for enterprise users, > map ArcEnabled policy to ArcEnabled pref. > > BUG=582440 > > Review URL: https://codereview.chromium.org/1684063002 > > Cr-Commit-Position: refs/heads/master@{#382266} TBR=pbond@chromium.org,bartfab@chromium.org,jochen@chromium.org,dbeam@chromium.org,tnagel@chromium.org,hidehiko@chromium.org,hashimoto@chromium.org BUG=582440 Review URL: https://codereview.chromium.org/1825143003 Cr-Commit-Position: refs/heads/master@{#382819}
Diffstat (limited to 'chrome/browser/chromeos/arc/arc_auth_service.cc')
-rw-r--r--chrome/browser/chromeos/arc/arc_auth_service.cc45
1 files changed, 24 insertions, 21 deletions
diff --git a/chrome/browser/chromeos/arc/arc_auth_service.cc b/chrome/browser/chromeos/arc/arc_auth_service.cc
index 60802a3..7dba38b 100644
--- a/chrome/browser/chromeos/arc/arc_auth_service.cc
+++ b/chrome/browser/chromeos/arc/arc_auth_service.cc
@@ -202,17 +202,24 @@ void ArcAuthService::OnPrimaryUserProfilePrepared(Profile* profile) {
profile_, GURL(site_url));
CHECK(storage_partition_);
- pref_change_registrar_.Init(profile_->GetPrefs());
- pref_change_registrar_.Add(
- prefs::kArcEnabled, base::Bind(&ArcAuthService::OnOptInPreferenceChanged,
- base::Unretained(this)));
- if (profile_->GetPrefs()->GetBoolean(prefs::kArcEnabled)) {
- OnOptInPreferenceChanged();
- } else {
- if (!disable_ui_for_testing && profile_->IsNewProfile()) {
- PrefServiceSyncableFromProfile(profile_)->AddObserver(this);
- OnIsSyncingChanged();
+ // In case UI is disabled we assume that ARC is opted-in.
+ if (!IsOptInVerificationDisabled()) {
+ pref_change_registrar_.Init(profile_->GetPrefs());
+ pref_change_registrar_.Add(
+ prefs::kArcEnabled,
+ base::Bind(&ArcAuthService::OnOptInPreferenceChanged,
+ base::Unretained(this)));
+ if (profile_->GetPrefs()->GetBoolean(prefs::kArcEnabled)) {
+ OnOptInPreferenceChanged();
+ } else {
+ if (!disable_ui_for_testing && profile_->IsNewProfile()) {
+ PrefServiceSyncableFromProfile(profile_)->AddObserver(this);
+ OnIsSyncingChanged();
+ }
}
+ } else {
+ auth_code_.clear();
+ StartArc();
}
}
@@ -291,20 +298,16 @@ void ArcAuthService::OnOptInPreferenceChanged() {
if (profile_->GetPrefs()->GetBoolean(prefs::kArcEnabled)) {
if (state_ != State::ACTIVE) {
+ CloseUI();
auth_code_.clear();
- if (!IsOptInVerificationDisabled()) {
- CloseUI();
- if (!profile_->GetPrefs()->GetBoolean(prefs::kArcSignedIn)) {
- // Need pre-fetch auth code and show OptIn UI if needed.
- initial_opt_in_ = true;
- SetState(State::FETCHING_CODE);
- FetchAuthCode();
- } else {
- // Ready to start Arc.
- StartArc();
- }
+ if (!profile_->GetPrefs()->GetBoolean(prefs::kArcSignedIn)) {
+ // Need pre-fetch auth code and show OptIn UI if needed.
+ initial_opt_in_ = true;
+ SetState(State::FETCHING_CODE);
+ FetchAuthCode();
} else {
+ // Ready to start Arc.
StartArc();
}
}