| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/chromeos/arc/arc_auth_service.h" | 5 #include "chrome/browser/chromeos/arc/arc_auth_service.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "ash/common/shelf/shelf_delegate.h" | 9 #include "ash/common/shelf/shelf_delegate.h" |
| 10 #include "ash/common/wm_shell.h" | 10 #include "ash/common/wm_shell.h" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 #include "chrome/browser/ui/extensions/application_launch.h" | 33 #include "chrome/browser/ui/extensions/application_launch.h" |
| 34 #include "chrome/common/pref_names.h" | 34 #include "chrome/common/pref_names.h" |
| 35 #include "chrome/grit/generated_resources.h" | 35 #include "chrome/grit/generated_resources.h" |
| 36 #include "chromeos/chromeos_switches.h" | 36 #include "chromeos/chromeos_switches.h" |
| 37 #include "chromeos/cryptohome/cryptohome_parameters.h" | 37 #include "chromeos/cryptohome/cryptohome_parameters.h" |
| 38 #include "chromeos/dbus/dbus_thread_manager.h" | 38 #include "chromeos/dbus/dbus_thread_manager.h" |
| 39 #include "chromeos/dbus/session_manager_client.h" | 39 #include "chromeos/dbus/session_manager_client.h" |
| 40 #include "components/arc/arc_bridge_service.h" | 40 #include "components/arc/arc_bridge_service.h" |
| 41 #include "components/pref_registry/pref_registry_syncable.h" | 41 #include "components/pref_registry/pref_registry_syncable.h" |
| 42 #include "components/prefs/pref_service.h" | 42 #include "components/prefs/pref_service.h" |
| 43 #include "components/syncable_prefs/pref_service_syncable.h" | 43 #include "components/sync_preferences/pref_service_syncable.h" |
| 44 #include "components/user_manager/user.h" | 44 #include "components/user_manager/user.h" |
| 45 #include "content/public/browser/browser_thread.h" | 45 #include "content/public/browser/browser_thread.h" |
| 46 #include "extensions/browser/app_window/app_window_registry.h" | 46 #include "extensions/browser/app_window/app_window_registry.h" |
| 47 #include "extensions/browser/extension_prefs.h" | 47 #include "extensions/browser/extension_prefs.h" |
| 48 #include "extensions/browser/extension_registry.h" | 48 #include "extensions/browser/extension_registry.h" |
| 49 #include "ui/base/l10n/l10n_util.h" | 49 #include "ui/base/l10n/l10n_util.h" |
| 50 | 50 |
| 51 namespace arc { | 51 namespace arc { |
| 52 | 52 |
| 53 namespace { | 53 namespace { |
| (...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 500 OnOptInPreferenceChanged(); | 500 OnOptInPreferenceChanged(); |
| 501 } else { | 501 } else { |
| 502 RemoveArcData(); | 502 RemoveArcData(); |
| 503 UpdateEnabledStateUMA(false); | 503 UpdateEnabledStateUMA(false); |
| 504 PrefServiceSyncableFromProfile(profile_)->AddObserver(this); | 504 PrefServiceSyncableFromProfile(profile_)->AddObserver(this); |
| 505 OnIsSyncingChanged(); | 505 OnIsSyncingChanged(); |
| 506 } | 506 } |
| 507 } | 507 } |
| 508 | 508 |
| 509 void ArcAuthService::OnIsSyncingChanged() { | 509 void ArcAuthService::OnIsSyncingChanged() { |
| 510 syncable_prefs::PrefServiceSyncable* const pref_service_syncable = | 510 sync_preferences::PrefServiceSyncable* const pref_service_syncable = |
| 511 PrefServiceSyncableFromProfile(profile_); | 511 PrefServiceSyncableFromProfile(profile_); |
| 512 if (!pref_service_syncable->IsSyncing()) | 512 if (!pref_service_syncable->IsSyncing()) |
| 513 return; | 513 return; |
| 514 | 514 |
| 515 pref_service_syncable->RemoveObserver(this); | 515 pref_service_syncable->RemoveObserver(this); |
| 516 | 516 |
| 517 if (IsArcEnabled()) | 517 if (IsArcEnabled()) |
| 518 OnOptInPreferenceChanged(); | 518 OnOptInPreferenceChanged(); |
| 519 | 519 |
| 520 if (!g_disable_ui_for_testing && profile_->IsNewProfile() && | 520 if (!g_disable_ui_for_testing && profile_->IsNewProfile() && |
| 521 !profile_->GetPrefs()->HasPrefPath(prefs::kArcEnabled)) { | 521 !profile_->GetPrefs()->HasPrefPath(prefs::kArcEnabled)) { |
| 522 ArcAuthNotification::Show(profile_); | 522 ArcAuthNotification::Show(profile_); |
| 523 } | 523 } |
| 524 } | 524 } |
| 525 | 525 |
| 526 void ArcAuthService::Shutdown() { | 526 void ArcAuthService::Shutdown() { |
| 527 ShutdownBridgeAndCloseUI(); | 527 ShutdownBridgeAndCloseUI(); |
| 528 if (profile_) { | 528 if (profile_) { |
| 529 syncable_prefs::PrefServiceSyncable* pref_service_syncable = | 529 sync_preferences::PrefServiceSyncable* pref_service_syncable = |
| 530 PrefServiceSyncableFromProfile(profile_); | 530 PrefServiceSyncableFromProfile(profile_); |
| 531 pref_service_syncable->RemoveObserver(this); | 531 pref_service_syncable->RemoveObserver(this); |
| 532 pref_service_syncable->RemoveSyncedPrefObserver(prefs::kArcEnabled, this); | 532 pref_service_syncable->RemoveSyncedPrefObserver(prefs::kArcEnabled, this); |
| 533 } | 533 } |
| 534 pref_change_registrar_.RemoveAll(); | 534 pref_change_registrar_.RemoveAll(); |
| 535 context_.reset(); | 535 context_.reset(); |
| 536 profile_ = nullptr; | 536 profile_ = nullptr; |
| 537 SetState(State::NOT_INITIALIZED); | 537 SetState(State::NOT_INITIALIZED); |
| 538 } | 538 } |
| 539 | 539 |
| (...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 964 return os << "FETCHING_CODE"; | 964 return os << "FETCHING_CODE"; |
| 965 case ArcAuthService::State::ACTIVE: | 965 case ArcAuthService::State::ACTIVE: |
| 966 return os << "ACTIVE"; | 966 return os << "ACTIVE"; |
| 967 default: | 967 default: |
| 968 NOTREACHED(); | 968 NOTREACHED(); |
| 969 return os; | 969 return os; |
| 970 } | 970 } |
| 971 } | 971 } |
| 972 | 972 |
| 973 } // namespace arc | 973 } // namespace arc |
| OLD | NEW |