Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4533)

Unified Diff: chrome/browser/net/gaia/token_service.h

Issue 3305003: New authorization framework for sync. ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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);

Powered by Google App Engine
This is Rietveld 408576698