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

Unified Diff: chrome/browser/signin/signin_global_error.h

Issue 11817045: Move auth-error reporting code out of SyncGlobalError and into SigninGlobalError (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Disabled ExtensionActionContextMenuTest.BrowserAction Created 7 years, 11 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
« no previous file with comments | « chrome/browser/signin/oauth2_token_service_factory.cc ('k') | chrome/browser/signin/signin_global_error.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/signin/signin_global_error.h
diff --git a/chrome/browser/signin/signin_global_error.h b/chrome/browser/signin/signin_global_error.h
new file mode 100644
index 0000000000000000000000000000000000000000..b316f5e3035d15e7571e48c5fb5b095d1b772325
--- /dev/null
+++ b/chrome/browser/signin/signin_global_error.h
@@ -0,0 +1,73 @@
+// Copyright (c) 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_SIGNIN_SIGNIN_GLOBAL_ERROR_H_
+#define CHROME_BROWSER_SIGNIN_SIGNIN_GLOBAL_ERROR_H_
+
+#include <set>
+#include "base/basictypes.h"
+#include "base/compiler_specific.h"
+#include "chrome/browser/ui/global_error/global_error.h"
+#include "google_apis/gaia/google_service_auth_error.h"
+
+class Profile;
+
+// Shows auth errors on the wrench menu using a bubble view and a
+// menu item. Services that wish to expose auth errors to the user should
+// register an AuthStatusProvider to report their current authentication state,
+// and should invoke AuthStatusChanged() when their authentication state may
+// have changed.
+class SigninGlobalError : public GlobalError {
+ public:
+ class AuthStatusProvider {
+ public:
+ AuthStatusProvider();
+ virtual ~AuthStatusProvider();
+
+ // API invoked by SigninGlobalError to get the current auth status of
+ // the various signed in services.
+ virtual GoogleServiceAuthError GetAuthStatus() const = 0;
+ };
+
+ explicit SigninGlobalError(Profile* profile);
+ virtual ~SigninGlobalError();
+
+ // Adds a provider which the SigninGlobalError object will start querying for
+ // auth status.
+ void AddProvider(const AuthStatusProvider* provider);
+
+ // Removes a provider previously added by SigninGlobalError (generally only
+ // called in preparation for shutdown).
+ void RemoveProvider(const AuthStatusProvider* provider);
+
+ // Invoked when the auth status of an AuthStatusProvider has changed.
+ void AuthStatusChanged();
+
+ // GlobalError implementation.
+ virtual bool HasBadge() OVERRIDE;
+ virtual bool HasMenuItem() OVERRIDE;
+ virtual int MenuItemCommandID() OVERRIDE;
+ virtual string16 MenuItemLabel() OVERRIDE;
+ virtual void ExecuteMenuItem(Browser* browser) OVERRIDE;
+ virtual bool HasBubbleView() OVERRIDE;
+ virtual string16 GetBubbleViewTitle() OVERRIDE;
+ virtual string16 GetBubbleViewMessage() OVERRIDE;
+ virtual string16 GetBubbleViewAcceptButtonLabel() OVERRIDE;
+ virtual string16 GetBubbleViewCancelButtonLabel() OVERRIDE;
+ virtual void OnBubbleViewDidClose(Browser* browser) OVERRIDE;
+ virtual void BubbleViewAcceptButtonPressed(Browser* browser) OVERRIDE;
+ virtual void BubbleViewCancelButtonPressed(Browser* browser) OVERRIDE;
+
+ private:
+ std::set<const AuthStatusProvider*> provider_set_;
+
+ // The auth error detected the last time AuthStatusChanged() was invoked (or
+ // NONE if AuthStatusChanged() has never been invoked).
+ GoogleServiceAuthError auth_error_;
+
+ // The Profile this object belongs to.
+ Profile* profile_;
+};
+
+#endif // CHROME_BROWSER_SIGNIN_SIGNIN_GLOBAL_ERROR_H_
« no previous file with comments | « chrome/browser/signin/oauth2_token_service_factory.cc ('k') | chrome/browser/signin/signin_global_error.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698