| 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 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 432 } | 432 } |
| 433 | 433 |
| 434 void ArcAuthService::GetIsAccountManaged( | 434 void ArcAuthService::GetIsAccountManaged( |
| 435 const GetIsAccountManagedCallback& callback) { | 435 const GetIsAccountManagedCallback& callback) { |
| 436 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 436 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 437 | 437 |
| 438 callback.Run(policy_util::IsAccountManaged(profile_)); | 438 callback.Run(policy_util::IsAccountManaged(profile_)); |
| 439 } | 439 } |
| 440 | 440 |
| 441 void ArcAuthService::SetState(State state) { | 441 void ArcAuthService::SetState(State state) { |
| 442 if (state_ == state) | |
| 443 return; | |
| 444 | |
| 445 state_ = state; | 442 state_ = state; |
| 446 for (auto& observer : observer_list_) | |
| 447 observer.OnOptInChanged(state_); | |
| 448 } | 443 } |
| 449 | 444 |
| 450 bool ArcAuthService::IsAllowed() const { | 445 bool ArcAuthService::IsAllowed() const { |
| 451 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 446 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 452 return profile_ != nullptr; | 447 return profile_ != nullptr; |
| 453 } | 448 } |
| 454 | 449 |
| 455 void ArcAuthService::OnPrimaryUserProfilePrepared(Profile* profile) { | 450 void ArcAuthService::OnPrimaryUserProfilePrepared(Profile* profile) { |
| 456 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 451 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 457 DCHECK(profile && profile != profile_); | 452 DCHECK(profile && profile != profile_); |
| (...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 964 return os << "FETCHING_CODE"; | 959 return os << "FETCHING_CODE"; |
| 965 case ArcAuthService::State::ACTIVE: | 960 case ArcAuthService::State::ACTIVE: |
| 966 return os << "ACTIVE"; | 961 return os << "ACTIVE"; |
| 967 default: | 962 default: |
| 968 NOTREACHED(); | 963 NOTREACHED(); |
| 969 return os; | 964 return os; |
| 970 } | 965 } |
| 971 } | 966 } |
| 972 | 967 |
| 973 } // namespace arc | 968 } // namespace arc |
| OLD | NEW |