Revert "Fix broken channel icon in chrome://help on CrOS" and try again
[chromium-blink-merge.git] / ios / chrome / browser / signin / chrome_identity_service_observer_bridge.mm
blob2962c8c8a664d121854a70e790660d94a51c86e9
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
3 // found in the LICENSE file.
5 #include "ios/chrome/browser/signin/chrome_identity_service_observer_bridge.h"
7 #include "base/logging.h"
8 #include "ios/public/provider/chrome/browser/chrome_browser_provider.h"
10 ChromeIdentityServiceObserverBridge::ChromeIdentityServiceObserverBridge(
11     id<ChromeIdentityServiceObserver> observer)
12     : observer_(observer), scoped_observer_(this) {
13   DCHECK(observer_);
14   scoped_observer_.Add(
15       ios::GetChromeBrowserProvider()->GetChromeIdentityService());
18 ChromeIdentityServiceObserverBridge::~ChromeIdentityServiceObserverBridge() {}
20 void ChromeIdentityServiceObserverBridge::OnIdentityListChanged() {
21   if ([observer_ respondsToSelector:@selector(onIdentityListChanged)])
22     [observer_ onIdentityListChanged];
25 void ChromeIdentityServiceObserverBridge::OnAccessTokenRefreshFailed(
26     ChromeIdentity* identity,
27     ios::AccessTokenErrorReason error) {
28   if ([observer_
29           respondsToSelector:@selector(onAccessTokenRefreshFailed:error:)]) {
30     [observer_ onAccessTokenRefreshFailed:identity error:error];
31   }
34 void ChromeIdentityServiceObserverBridge::OnProfileUpdate(
35     ChromeIdentity* identity) {
36   if ([observer_ respondsToSelector:@selector(onProfileUpdate:)])
37     [observer_ onProfileUpdate:identity];