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) {
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) {
29 respondsToSelector:@selector(onAccessTokenRefreshFailed:error:)]) {
30 [observer_ onAccessTokenRefreshFailed:identity error:error];
34 void ChromeIdentityServiceObserverBridge::OnProfileUpdate(
35 ChromeIdentity* identity) {
36 if ([observer_ respondsToSelector:@selector(onProfileUpdate:)])
37 [observer_ onProfileUpdate:identity];