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

Unified Diff: chrome/browser/ui/webui/identity_internals/identity_internals_token_revoker.h

Issue 365513002: Port identity_internals to mojo (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase to ToT for commit Created 6 years, 5 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/ui/webui/identity_internals/identity_internals_token_revoker.h
diff --git a/chrome/browser/ui/webui/identity_internals/identity_internals_token_revoker.h b/chrome/browser/ui/webui/identity_internals/identity_internals_token_revoker.h
new file mode 100644
index 0000000000000000000000000000000000000000..58c957cadb496779ae3880b520d7233a3309fd86
--- /dev/null
+++ b/chrome/browser/ui/webui/identity_internals/identity_internals_token_revoker.h
@@ -0,0 +1,63 @@
+// Copyright 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.
+
+#ifndef CHROME_BROWSER_UI_WEBUI_IDENTITY_INTERNALS_IDENTITY_INTERNALS_TOKEN_REVOKER_H_
+#define CHROME_BROWSER_UI_WEBUI_IDENTITY_INTERNALS_IDENTITY_INTERNALS_TOKEN_REVOKER_H_
+
+#include <string>
+
+#include "base/basictypes.h"
+#include "base/compiler_specific.h"
+#include "google_apis/gaia/gaia_auth_fetcher.h"
+#include "mojo/public/cpp/bindings/callback.h"
+
+class IdentityInternalsUIHandler;
+class Profile;
+
+// Handles the revoking of an access token and helps performing the clean up
+// after it is revoked by holding information about the access token and related
+// extension ID.
+class IdentityInternalsTokenRevoker : public GaiaAuthConsumer {
+ public:
+ // Revokes |access_token| from extension with |extension_id|.
+ // |profile| is required for its request context. |consumer| will be
+ // notified when revocation succeeds via |OnTokenRevokerDone()|.
+ IdentityInternalsTokenRevoker(const std::string& extension_id,
+ const std::string& access_token,
+ const mojo::Callback<void()>& callback,
+ Profile* profile,
+ IdentityInternalsUIHandler* consumer);
+ virtual ~IdentityInternalsTokenRevoker();
+
+ // Returns the access token being revoked.
+ const std::string& access_token() const { return access_token_; }
+
+ // Returns the ID of the extension the access token is related to.
+ const std::string& extension_id() const { return extension_id_; }
+
+ const mojo::Callback<void()>& callback() const { return callback_; }
+
+ // GaiaAuthConsumer implementation.
+ virtual void OnOAuth2RevokeTokenCompleted() OVERRIDE;
+
+ private:
+ // An object used to start a token revoke request.
+ GaiaAuthFetcher fetcher_;
+
+ // An ID of an extension the access token is related to.
+ const std::string extension_id_;
+
+ // The access token to revoke.
+ const std::string access_token_;
+
+ // Callback for when we complete.
+ const mojo::Callback<void()> callback_;
+
+ // An object that needs to be notified once the access token is revoked.
+ IdentityInternalsUIHandler* consumer_; // weak.
+
+ DISALLOW_COPY_AND_ASSIGN(IdentityInternalsTokenRevoker);
+};
+
+#endif // CHROME_BROWSER_UI_WEBUI_IDENTITY_INTERNALS_IDENTITY_INTERNALS_TOKEN_REVOKER_H_

Powered by Google App Engine
This is Rietveld 408576698