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

Unified Diff: chrome/browser/chromeos/arc/arc_auth_service.cc

Issue 2206883002: Do not sync ARC opt-in preference (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/chromeos/arc/arc_auth_service.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/arc/arc_auth_service.cc
diff --git a/chrome/browser/chromeos/arc/arc_auth_service.cc b/chrome/browser/chromeos/arc/arc_auth_service.cc
index 3aaffd8a7f8ea675eb0469d64de27c42d2199212..2178865843ec9e0885709db99d970ddaad30d36d 100644
--- a/chrome/browser/chromeos/arc/arc_auth_service.cc
+++ b/chrome/browser/chromeos/arc/arc_auth_service.cc
@@ -22,7 +22,6 @@
#include "chrome/browser/extensions/extension_util.h"
#include "chrome/browser/policy/profile_policy_connector.h"
#include "chrome/browser/policy/profile_policy_connector_factory.h"
-#include "chrome/browser/prefs/pref_service_syncable_util.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/app_list/arc/arc_app_launcher.h"
#include "chrome/browser/ui/app_list/arc/arc_app_utils.h"
@@ -39,7 +38,6 @@
#include "components/policy/core/browser/browser_policy_connector.h"
#include "components/pref_registry/pref_registry_syncable.h"
#include "components/prefs/pref_service.h"
-#include "components/syncable_prefs/pref_service_syncable.h"
#include "components/user_manager/user.h"
#include "content/public/browser/browser_thread.h"
#include "extensions/browser/app_window/app_window_registry.h"
@@ -398,9 +396,6 @@ void ArcAuthService::OnPrimaryUserProfilePrepared(Profile* profile) {
profile_ = profile;
SetState(State::STOPPED);
- PrefServiceSyncableFromProfile(profile_)->AddSyncedPrefObserver(
- prefs::kArcEnabled, this);
-
context_.reset(new ArcAuthContext(this, profile_));
// In case UI is disabled we assume that ARC is opted-in.
@@ -422,36 +417,11 @@ void ArcAuthService::OnPrimaryUserProfilePrepared(Profile* profile) {
OnOptInPreferenceChanged();
} else {
UpdateEnabledStateUMA(false);
- PrefServiceSyncableFromProfile(profile_)->AddObserver(this);
- OnIsSyncingChanged();
- }
-}
-
-void ArcAuthService::OnIsSyncingChanged() {
- syncable_prefs::PrefServiceSyncable* const pref_service_syncable =
- PrefServiceSyncableFromProfile(profile_);
- if (!pref_service_syncable->IsSyncing())
- return;
-
- pref_service_syncable->RemoveObserver(this);
-
- if (IsArcEnabled())
- OnOptInPreferenceChanged();
-
- if (!g_disable_ui_for_testing && profile_->IsNewProfile() &&
- !profile_->GetPrefs()->HasPrefPath(prefs::kArcEnabled)) {
- ArcAuthNotification::Show(profile_);
}
}
void ArcAuthService::Shutdown() {
ShutdownBridgeAndCloseUI();
- if (profile_) {
- syncable_prefs::PrefServiceSyncable* pref_service_syncable =
- PrefServiceSyncableFromProfile(profile_);
- pref_service_syncable->RemoveObserver(this);
- pref_service_syncable->RemoveSyncedPrefObserver(prefs::kArcEnabled, this);
- }
pref_change_registrar_.RemoveAll();
context_.reset();
profile_ = nullptr;
@@ -488,25 +458,6 @@ void ArcAuthService::OnContextReady() {
CheckAndroidManagement(false);
}
-void ArcAuthService::OnSyncedPrefChanged(const std::string& path,
- bool from_sync) {
- DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
-
- // Update UMA only for local changes
- if (!from_sync) {
- const bool arc_enabled =
- profile_->GetPrefs()->GetBoolean(prefs::kArcEnabled);
- UpdateOptInActionUMA(arc_enabled ? OptInActionType::OPTED_IN
- : OptInActionType::OPTED_OUT);
-
- if (!disable_arc_from_ui_ && !arc_enabled && !IsArcManaged()) {
- ash::ShelfDelegate* shelf_delegate = GetShelfDelegate();
- if (shelf_delegate)
- shelf_delegate->UnpinAppWithID(ArcSupportHost::kHostAppId);
- }
- }
-}
-
void ArcAuthService::StopArc() {
if (state_ != State::STOPPED) {
UpdateEnabledStateUMA(false);
@@ -522,6 +473,15 @@ void ArcAuthService::OnOptInPreferenceChanged() {
const bool arc_enabled = IsArcEnabled();
FOR_EACH_OBSERVER(Observer, observer_list_, OnOptInEnabled(arc_enabled));
+ UpdateOptInActionUMA(arc_enabled ? OptInActionType::OPTED_IN
khmel 2016/08/03 14:28:32 Now this statistics is incorrect for managed pref.
+ : OptInActionType::OPTED_OUT);
+
+ if (!disable_arc_from_ui_ && !arc_enabled && !IsArcManaged()) {
+ ash::ShelfDelegate* shelf_delegate = GetShelfDelegate();
+ if (shelf_delegate)
+ shelf_delegate->UnpinAppWithID(ArcSupportHost::kHostAppId);
+ }
+
if (!arc_enabled) {
StopArc();
return;
« no previous file with comments | « chrome/browser/chromeos/arc/arc_auth_service.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698