Index: chrome/browser/net/gaia/token_service.h |
=================================================================== |
--- chrome/browser/net/gaia/token_service.h (revision 58702) |
+++ chrome/browser/net/gaia/token_service.h (working copy) |
@@ -37,12 +37,15 @@ |
#include <map> |
#include <string> |
+ |
+#include "base/gtest_prod_util.h" |
#include "base/scoped_ptr.h" |
#include "chrome/browser/webdata/web_data_service.h" |
#include "chrome/common/net/gaia/gaia_auth_consumer.h" |
#include "chrome/common/net/gaia/gaia_authenticator2.h" |
#include "chrome/common/net/gaia/google_service_auth_error.h" |
-#include "base/gtest_prod_util.h" |
+#include "chrome/common/notification_observer.h" |
+#include "chrome/common/notification_registrar.h" |
class URLRequestContextGetter; |
class Profile; |
@@ -50,7 +53,8 @@ |
// The TokenService is a Profile member, so all calls are expected |
// from the UI thread. |
class TokenService : public GaiaAuthConsumer, |
- public WebDataServiceConsumer { |
+ public WebDataServiceConsumer, |
+ public NotificationObserver { |
public: |
TokenService(); |
virtual ~TokenService(); |
@@ -123,6 +127,10 @@ |
const bool HasTokenForService(const char* const service) const; |
const std::string& GetTokenForService(const char* const service) const; |
+ // For tests only. Doesn't save to the WebDB. |
+ void IssueAuthTokenForTest(const std::string& service, |
+ const std::string& auth_token); |
+ |
// GaiaAuthConsumer implementation. |
virtual void OnIssueAuthTokenSuccess(const std::string& service, |
const std::string& auth_token); |
@@ -133,6 +141,11 @@ |
virtual void OnWebDataServiceRequestDone(WebDataService::Handle h, |
const WDTypedResult* result); |
+ // NotificationObserver implementation. |
+ virtual void Observe(NotificationType type, |
+ const NotificationSource& source, |
+ const NotificationDetails& details); |
+ |
private: |
void FireTokenAvailableNotification(const std::string& service, |
@@ -169,6 +182,8 @@ |
// Map from service to token. |
std::map<std::string, std::string> token_map_; |
+ NotificationRegistrar registrar_; |
+ |
FRIEND_TEST_ALL_PREFIXES(TokenServiceTest, LoadTokensIntoMemoryBasic); |
FRIEND_TEST_ALL_PREFIXES(TokenServiceTest, LoadTokensIntoMemoryAdvanced); |