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

Unified Diff: chrome/browser/extensions/token_cache/token_cache_service.cc

Issue 170383005: Move TokenCacheService away from listening for Signin notifications. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Nit Created 6 years, 10 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/extensions/token_cache/token_cache_service.cc
diff --git a/chrome/browser/extensions/token_cache/token_cache_service.cc b/chrome/browser/extensions/token_cache/token_cache_service.cc
index 9d5aabd3b403aa91c6d5ba9060fa497cf85a91ca..166a17873b7ebf720b34da2a76df81be97d30e4e 100644
--- a/chrome/browser/extensions/token_cache/token_cache_service.cc
+++ b/chrome/browser/extensions/token_cache/token_cache_service.cc
@@ -2,11 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/browser/extensions/token_cache/token_cache_service.h"
-
#include "base/logging.h"
-#include "chrome/browser/chrome_notification_types.h"
-#include "content/public/browser/notification_source.h"
+#include "chrome/browser/extensions/token_cache/token_cache_service.h"
+#include "chrome/browser/signin/signin_manager.h"
+#include "chrome/browser/signin/signin_manager_factory.h"
using base::Time;
using base::TimeDelta;
@@ -14,12 +13,12 @@ using base::TimeDelta;
namespace extensions {
TokenCacheService::TokenCacheService(Profile* profile) : profile_(profile) {
- registrar_.Add(this,
- chrome::NOTIFICATION_GOOGLE_SIGNED_OUT,
- content::Source<Profile>(profile_));
+ SigninManagerFactory::GetForProfile(profile)->AddObserver(this);
}
TokenCacheService::~TokenCacheService() {
+ SigninManagerFactory::GetForProfile(const_cast<Profile*>(profile_))
Yoyo Zhou 2014/02/18 17:45:54 This should be in TokenCacheService::Shutdown. Al
blundell 2014/02/18 19:53:42 Great catches, thanks. Done. On 2014/02/18 17:45:
+ ->RemoveObserver(this);
}
void TokenCacheService::StoreToken(const std::string& token_name,
@@ -67,11 +66,7 @@ std::string TokenCacheService::RetrieveToken(const std::string& token_name) {
return std::string();
}
-// Inherited from NotificationObserver.
-void TokenCacheService::Observe(int type,
- const content::NotificationSource& source,
- const content::NotificationDetails& details) {
- DCHECK(chrome::NOTIFICATION_GOOGLE_SIGNED_OUT == type);
+void TokenCacheService::GoogleSignedOut(const std::string& username) {
token_cache_.clear();
}

Powered by Google App Engine
This is Rietveld 408576698