Roll src/third_party/WebKit f36d5e0:68b67cd (svn 193299:193303)
[chromium-blink-merge.git] / components / signin / ios / browser / oauth2_token_service_observer_bridge.mm
blob7d649a939e958aa35c2744708b66389795652110
1 // Copyright 2014 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 "components/signin/ios/browser/oauth2_token_service_observer_bridge.h"
7 OAuth2TokenServiceObserverBridge::OAuth2TokenServiceObserverBridge(
8     OAuth2TokenService* token_service,
9     id<OAuth2TokenServiceObserverBridgeDelegate> delegate)
10         : token_service_(token_service),
11           delegate_(delegate) {
12     DCHECK(token_service_);
13     token_service_->AddObserver(this);
15 OAuth2TokenServiceObserverBridge::~OAuth2TokenServiceObserverBridge() {
16   token_service_->RemoveObserver(this);
19 void OAuth2TokenServiceObserverBridge::OnRefreshTokenAvailable(
20     const std::string& account_id) {
21   if ([delegate_ respondsToSelector:@selector(onRefreshTokenAvailable:)]) {
22     [delegate_ onRefreshTokenAvailable:account_id];
23   }
26 void OAuth2TokenServiceObserverBridge::OnRefreshTokenRevoked(
27     const std::string& account_id) {
28   if ([delegate_ respondsToSelector:@selector(onRefreshTokenRevoked:)]) {
29     [delegate_ onRefreshTokenRevoked:account_id];
30   }
32 void OAuth2TokenServiceObserverBridge::OnRefreshTokensLoaded() {
33   if ([delegate_ respondsToSelector:@selector(onRefreshTokensLoaded)]) {
34     [delegate_ onRefreshTokensLoaded];
35   }
37 void OAuth2TokenServiceObserverBridge::OnStartBatchChanges() {
38   if ([delegate_ respondsToSelector:@selector(onStartBatchChanges)]) {
39     [delegate_ onStartBatchChanges];
40   }
44 void OAuth2TokenServiceObserverBridge::OnEndBatchChanges() {
45   if ([delegate_ respondsToSelector:@selector(onEndBatchChanges)]) {
46     [delegate_ onEndBatchChanges];
47   }