OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/signin/token_service.h" | 5 #include "chrome/browser/signin/token_service.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 | 201 |
202 // Note that this can fire twice or more for any given service. | 202 // Note that this can fire twice or more for any given service. |
203 // It can fire once from the DB read, and then once from the initial | 203 // It can fire once from the DB read, and then once from the initial |
204 // fetcher. Future fetches can cause more notification firings. | 204 // fetcher. Future fetches can cause more notification firings. |
205 // The DB read will not however fire a notification if the fetcher | 205 // The DB read will not however fire a notification if the fetcher |
206 // returned first. So it's always safe to use the latest notification. | 206 // returned first. So it's always safe to use the latest notification. |
207 void TokenService::FireTokenAvailableNotification( | 207 void TokenService::FireTokenAvailableNotification( |
208 const std::string& service, | 208 const std::string& service, |
209 const std::string& auth_token) { | 209 const std::string& auth_token) { |
210 | 210 |
| 211 LOG(WARNING) << "Token available for " << service; |
211 TokenAvailableDetails details(service, auth_token); | 212 TokenAvailableDetails details(service, auth_token); |
212 content::NotificationService::current()->Notify( | 213 content::NotificationService::current()->Notify( |
213 chrome::NOTIFICATION_TOKEN_AVAILABLE, | 214 chrome::NOTIFICATION_TOKEN_AVAILABLE, |
214 content::Source<TokenService>(this), | 215 content::Source<TokenService>(this), |
215 content::Details<const TokenAvailableDetails>(&details)); | 216 content::Details<const TokenAvailableDetails>(&details)); |
216 } | 217 } |
217 | 218 |
218 void TokenService::FireTokenRequestFailedNotification( | 219 void TokenService::FireTokenRequestFailedNotification( |
219 const std::string& service, | 220 const std::string& service, |
220 const GoogleServiceAuthError& error) { | 221 const GoogleServiceAuthError& error) { |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
361 } | 362 } |
362 | 363 |
363 void TokenService::Observe(int type, | 364 void TokenService::Observe(int type, |
364 const content::NotificationSource& source, | 365 const content::NotificationSource& source, |
365 const content::NotificationDetails& details) { | 366 const content::NotificationDetails& details) { |
366 DCHECK_EQ(type, chrome::NOTIFICATION_TOKEN_UPDATED); | 367 DCHECK_EQ(type, chrome::NOTIFICATION_TOKEN_UPDATED); |
367 TokenAvailableDetails* tok_details = | 368 TokenAvailableDetails* tok_details = |
368 content::Details<TokenAvailableDetails>(details).ptr(); | 369 content::Details<TokenAvailableDetails>(details).ptr(); |
369 OnIssueAuthTokenSuccess(tok_details->service(), tok_details->token()); | 370 OnIssueAuthTokenSuccess(tok_details->service(), tok_details->token()); |
370 } | 371 } |
OLD | NEW |