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

Unified Diff: chrome/browser/invalidation/profile_invalidation_auth_provider.cc

Issue 179843002: Make invalidations work for Chrome OS Kiosk Apps. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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/invalidation/profile_invalidation_auth_provider.cc
diff --git a/chrome/browser/invalidation/profile_invalidation_auth_provider.cc b/chrome/browser/invalidation/profile_invalidation_auth_provider.cc
new file mode 100644
index 0000000000000000000000000000000000000000..bf6f62711bdabc39961d2e0978f20fa5993a7213
--- /dev/null
+++ b/chrome/browser/invalidation/profile_invalidation_auth_provider.cc
@@ -0,0 +1,56 @@
+// Copyright (c) 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/invalidation/profile_invalidation_auth_provider.h"
+
+#include "chrome/browser/chrome_notification_types.h"
+#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/signin/profile_oauth2_token_service.h"
+#include "chrome/browser/signin/signin_manager.h"
+#include "chrome/browser/ui/webui/signin/login_ui_service.h"
+#include "content/public/browser/notification_service.h"
+
+namespace invalidation {
+
+ProfileInvalidationAuthProvider::ProfileInvalidationAuthProvider(
+ SigninManagerBase* signin_manager,
+ ProfileOAuth2TokenService* token_service,
+ LoginUIService* login_ui_service,
+ Profile* profile)
+ : signin_manager_(signin_manager),
+ token_service_(token_service),
+ login_ui_service_(login_ui_service),
+ profile_(profile) {
+ notification_registrar_.Add(this,
+ chrome::NOTIFICATION_GOOGLE_SIGNED_OUT,
+ content::Source<Profile>(profile_));
+}
+
+ProfileInvalidationAuthProvider::
+ ~ProfileInvalidationAuthProvider() {
+ notification_registrar_.RemoveAll();
+}
+
+std::string ProfileInvalidationAuthProvider::GetAccountId() {
+ return signin_manager_->GetAuthenticatedUsername();
+}
+
+OAuth2TokenService* ProfileInvalidationAuthProvider::GetTokenService() {
+ return token_service_;
+}
+
+bool ProfileInvalidationAuthProvider::ShowLoginUI() {
+ login_ui_service_->ShowLoginPopup();
+ return true;
+}
+
+void ProfileInvalidationAuthProvider::Observe(
+ int type,
+ const content::NotificationSource& source,
+ const content::NotificationDetails& details) {
+ DCHECK_EQ(type, chrome::NOTIFICATION_GOOGLE_SIGNED_OUT);
+ FireInvalidationAuthLogout();
+}
+
+} // namespace invalidation

Powered by Google App Engine
This is Rietveld 408576698