| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_UI_WEBUI_IDENTITY_INTERNALS_IDENTITY_INTERNALS_TOKEN_REVO
KER_H_ |
| 6 #define CHROME_BROWSER_UI_WEBUI_IDENTITY_INTERNALS_IDENTITY_INTERNALS_TOKEN_REVO
KER_H_ |
| 7 |
| 8 #include <string> |
| 9 |
| 10 #include "base/basictypes.h" |
| 11 #include "base/compiler_specific.h" |
| 12 #include "google_apis/gaia/gaia_auth_fetcher.h" |
| 13 #include "mojo/public/cpp/bindings/callback.h" |
| 14 |
| 15 class IdentityInternalsUIHandler; |
| 16 class Profile; |
| 17 |
| 18 // Handles the revoking of an access token and helps performing the clean up |
| 19 // after it is revoked by holding information about the access token and related |
| 20 // extension ID. |
| 21 class IdentityInternalsTokenRevoker : public GaiaAuthConsumer { |
| 22 public: |
| 23 // Revokes |access_token| from extension with |extension_id|. |
| 24 // |profile| is required for its request context. |consumer| will be |
| 25 // notified when revocation succeeds via |OnTokenRevokerDone()|. |
| 26 IdentityInternalsTokenRevoker(const std::string& extension_id, |
| 27 const std::string& access_token, |
| 28 const mojo::Callback<void()>& callback, |
| 29 Profile* profile, |
| 30 IdentityInternalsUIHandler* consumer); |
| 31 virtual ~IdentityInternalsTokenRevoker(); |
| 32 |
| 33 // Returns the access token being revoked. |
| 34 const std::string& access_token() const { return access_token_; } |
| 35 |
| 36 // Returns the ID of the extension the access token is related to. |
| 37 const std::string& extension_id() const { return extension_id_; } |
| 38 |
| 39 const mojo::Callback<void()>& callback() const { return callback_; } |
| 40 |
| 41 // GaiaAuthConsumer implementation. |
| 42 virtual void OnOAuth2RevokeTokenCompleted() OVERRIDE; |
| 43 |
| 44 private: |
| 45 // An object used to start a token revoke request. |
| 46 GaiaAuthFetcher fetcher_; |
| 47 |
| 48 // An ID of an extension the access token is related to. |
| 49 const std::string extension_id_; |
| 50 |
| 51 // The access token to revoke. |
| 52 const std::string access_token_; |
| 53 |
| 54 // Callback for when we complete. |
| 55 const mojo::Callback<void()> callback_; |
| 56 |
| 57 // An object that needs to be notified once the access token is revoked. |
| 58 IdentityInternalsUIHandler* consumer_; // weak. |
| 59 |
| 60 DISALLOW_COPY_AND_ASSIGN(IdentityInternalsTokenRevoker); |
| 61 }; |
| 62 |
| 63 #endif // CHROME_BROWSER_UI_WEBUI_IDENTITY_INTERNALS_IDENTITY_INTERNALS_TOKEN_R
EVOKER_H_ |
| OLD | NEW |