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

Unified Diff: chrome/browser/extensions/api/identity/identity_signin_flow.h

Issue 12929014: Identity API: Pop-up a sign-in dialog if gaia credentials are bad (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lkgr
Patch Set: fix signin browser test for chromeos Created 7 years, 9 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/api/identity/identity_signin_flow.h
diff --git a/chrome/browser/extensions/api/identity/identity_signin_flow.h b/chrome/browser/extensions/api/identity/identity_signin_flow.h
new file mode 100644
index 0000000000000000000000000000000000000000..a1289f8ff035564fdb3398ef08cb2d85e2269d37
--- /dev/null
+++ b/chrome/browser/extensions/api/identity/identity_signin_flow.h
@@ -0,0 +1,59 @@
+// Copyright 2013 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.
+
+#ifndef CHROME_BROWSER_EXTENSIONS_API_IDENTITY_IDENTITY_SIGNIN_FLOW_H_
+#define CHROME_BROWSER_EXTENSIONS_API_IDENTITY_IDENTITY_SIGNIN_FLOW_H_
+
+#include <string>
+
+#include "base/memory/scoped_ptr.h"
+#include "content/public/browser/notification_observer.h"
+#include "content/public/browser/notification_registrar.h"
+
+class Profile;
+
+namespace extensions {
+
+// IdentitySigninFlow is a controller class to do a sign-in flow for an
+// interactive Identity API call. The UI is launched through the LoginUIService.
+// When the flow completes, the delegate is notified, and on success will
+// be given an OAuth2 login refresh token.
+class IdentitySigninFlow : public content::NotificationObserver {
+ public:
+ class Delegate {
+ public:
+ Delegate() {}
+ virtual ~Delegate() {}
+ // Called when the flow has completed successfully.
+ virtual void SigninSuccess(const std::string& token) = 0;
+ // Called when the flow has failed.
+ virtual void SigninFailed() = 0;
+
+ DISALLOW_COPY_AND_ASSIGN(Delegate);
+ };
+
+ IdentitySigninFlow(Delegate* delegate,
+ Profile* profile);
+ virtual ~IdentitySigninFlow();
+
+ // Starts the flow. Should only be called once.
+ void Start();
+
+ // content::NotificationObserver implementation.
+ virtual void Observe(int type,
+ const content::NotificationSource& source,
+ const content::NotificationDetails& details) OVERRIDE;
+
+ private:
+ Delegate* delegate_;
+ Profile* profile_;
+ // Used to listen to notifications from the TokenService.
+ content::NotificationRegistrar registrar_;
+
+ DISALLOW_COPY_AND_ASSIGN(IdentitySigninFlow);
+};
+
+} // namespace extensions
+
+#endif // CHROME_BROWSER_EXTENSIONS_API_IDENTITY_IDENTITY_SIGNIN_FLOW_H_

Powered by Google App Engine
This is Rietveld 408576698