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

Side by Side Diff: chrome/browser/ui/webui/identity_internals/identity_internals_ui_handler.h

Issue 365513002: Port identity_internals to mojo (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Maybe fix the gn build. 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(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_UI_HANDLER _H_
6 #define CHROME_BROWSER_UI_WEBUI_IDENTITY_INTERNALS_IDENTITY_INTERNALS_UI_HANDLER _H_
7
8 #include "base/basictypes.h"
9 #include "base/compiler_specific.h"
10 #include "chrome/browser/extensions/api/identity/identity_api.h"
11 #include "chrome/browser/ui/webui/identity_internals/identity_internals.mojom.h"
12 #include "chrome/browser/ui/webui/mojo_web_ui_handler.h"
13
14 class Profile;
15 class IdentityInternalsTokenRevoker;
16
17 // Class acting as a controller of the chrome://identity-internals WebUI.
18 class IdentityInternalsUIHandler
19 : public mojo::InterfaceImpl<IdentityInternalsHandlerMojo>,
20 public MojoWebUIHandler {
21 public:
22 explicit IdentityInternalsUIHandler(Profile* profile);
23 virtual ~IdentityInternalsUIHandler();
24
25 // Ensures that a proper clean up happens after a token is revoked. That
26 // includes deleting the |token_revoker|, removing the token from Identity API
27 // cache and updating the UI that the token is gone.
28 void OnTokenRevokerDone(IdentityInternalsTokenRevoker* token_revoker);
29
30 // Overridden from IdentityInternalsHandlerMojo:
31 virtual void GetTokens() OVERRIDE;
32 virtual void RevokeToken(const mojo::String& extension_id,
33 const mojo::String& access_token) OVERRIDE;
34
35 private:
36 // We use an explicit conversion function instead of TypeConverter because
37 // creating an IdentityTokenMojo relies on having the Profile* as state.
38 mojo::Array<IdentityTokenMojoPtr> ConvertCachedTokens(
39 const extensions::IdentityAPI::CachedTokens& tokens);
40
41 // Gets the name of an extension referred to by |token_cache_key| as a string.
42 const std::string GetExtensionName(
43 const extensions::ExtensionTokenKey& token_cache_key);
44
45 // Gets a list of scopes specified in |token_cache_key| and returns a pointer
46 // to a ListValue containing the scopes. The caller gets ownership of the
47 // returned object.
48 mojo::Array<mojo::String> GetScopes(
49 const extensions::ExtensionTokenKey& token_cache_key);
50
51 // Gets a localized status of the access token in |token_cache_value|.
52 const std::string GetStatus(
53 const extensions::IdentityTokenCacheValue& token_cache_value);
54
55 // Gets a string representation of an expiration time of the access token in
56 // |token_cache_value|.
57 const std::string GetExpirationTime(
58 const extensions::IdentityTokenCacheValue& token_cache_value);
59
60 Profile* profile_;
61
62 // A vector of token revokers that are currently revoking tokens.
63 ScopedVector<IdentityInternalsTokenRevoker> token_revokers_;
64
65 DISALLOW_COPY_AND_ASSIGN(IdentityInternalsUIHandler);
66 };
67
68 #endif // CHROME_BROWSER_UI_WEBUI_IDENTITY_INTERNALS_IDENTITY_INTERNALS_UI_HAND LER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698