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

Unified Diff: chrome/browser/ui/webui/identity_internals_ui.cc

Issue 17468008: chrome://identity-internals code quality (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 6 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_ui.cc
diff --git a/chrome/browser/ui/webui/identity_internals_ui.cc b/chrome/browser/ui/webui/identity_internals_ui.cc
index 00e03df937d4bc91e485f947680f02e79fe9c8bb..882c77aec6b1b3cd0692ec0ee7e3d9005f898221 100644
--- a/chrome/browser/ui/webui/identity_internals_ui.cc
+++ b/chrome/browser/ui/webui/identity_internals_ui.cc
@@ -32,7 +32,7 @@ const char kExtensionName[] = "extensionName";
const char kScopes[] = "scopes";
const char kStatus[] = "status";
const char kTokenExpirationTime[] = "expirationTime";
-const char kTokenId[] = "tokenId";
+const char kAccessToken[] = "accessToken";
// RevokeToken message parameter offsets.
const int kRevokeTokenExtensionOffset = 0;
@@ -40,6 +40,7 @@ const int kRevokeTokenTokenOffset = 1;
class IdentityInternalsTokenRevoker;
+// Class acting as a controller of the chrome://identity-internals WebUI.
class IdentityInternalsUIMessageHandler : public content::WebUIMessageHandler {
public:
IdentityInternalsUIMessageHandler();
@@ -54,26 +55,41 @@ class IdentityInternalsUIMessageHandler : public content::WebUIMessageHandler {
virtual void RegisterMessages() OVERRIDE;
private:
+ // Gets a name of an extension referred to by |token_cache_key| as a string.
Michael Courage 2013/06/20 09:40:54 tinynit: s/Gets a/Gets the/
fgorski 2013/06/20 16:28:48 Done.
const std::string GetExtensionName(
const extensions::IdentityAPI::TokenCacheKey& token_cache_key);
+ // Gets a list of scopes specified in |token_cache_key| and returns a pointer
+ // to a ListValue containing the scopes. The caller gets ownership of the
+ // returned object.
ListValue* GetScopes(
const extensions::IdentityAPI::TokenCacheKey& token_cache_key);
+ // Gets a localized status of the access token in |token_cache_value|.
const base::string16 GetStatus(
const extensions::IdentityTokenCacheValue& token_cache_value);
+ // Gets a string representation of an expiration time of the access token in
+ // |token_cache_value|.
const std::string GetExpirationTime(
const extensions::IdentityTokenCacheValue& token_cache_value);
+ // Converts a pair of |token_cache_key| and |token_cache_value| to a
+ // DictionaryValue object with corresponding information in a localized and
+ // readible form and returns a pointer to created object. Caller gets the
Michael Courage 2013/06/20 09:40:54 nits: s/readible/readable/ returns a pointer to _t
fgorski 2013/06/20 16:28:48 Done.
+ // ownership of the returned object.
DictionaryValue* GetInfoForToken(
const extensions::IdentityAPI::TokenCacheKey& token_cache_key,
const extensions::IdentityTokenCacheValue& token_cache_value);
+ // Gets all of the tokens stored in IdenityAPI token cache and returns them
Michael Courage 2013/06/20 09:40:54 s/IdenityAPI/IdentityAPI/
fgorski 2013/06/20 16:28:48 Done.
+ // to the caller using Javascript callback function
+ // |identity_internals.returnTokens()|.
void GetInfoForAllTokens(const ListValue* args);
// Initiates revoking of the token, based on the extension ID and token
- // passed as entries in the args list.
+ // passed as entries in the |args| list. Updates the caller of completion
+ // using Javascript callback function |identity_internals.tokenRevokeDone()|.
void RevokeToken(const ListValue* args);
// A vector of token revokers that are currently revoking tokens.
@@ -192,7 +208,7 @@ DictionaryValue* IdentityInternalsUIMessageHandler::GetInfoForToken(
token_data->SetString(kExtensionName, GetExtensionName(token_cache_key));
token_data->Set(kScopes, GetScopes(token_cache_key));
token_data->SetString(kStatus, GetStatus(token_cache_value));
- token_data->SetString(kTokenId, token_cache_value.token());
+ token_data->SetString(kAccessToken, token_cache_value.token());
token_data->SetString(kTokenExpirationTime,
GetExpirationTime(token_cache_value));
return token_data;
@@ -262,8 +278,8 @@ IdentityInternalsUI::IdentityInternalsUI(content::WebUI* web_ui)
// Localized strings
html_source->AddLocalizedString("tokenCacheHeader",
IDS_IDENTITY_INTERNALS_TOKEN_CACHE_TEXT);
- html_source->AddLocalizedString("tokenId",
- IDS_IDENTITY_INTERNALS_TOKEN_ID);
+ html_source->AddLocalizedString("accessToken",
+ IDS_IDENTITY_INTERNALS_ACCESS_TOKEN);
html_source->AddLocalizedString("extensionName",
IDS_IDENTITY_INTERNALS_EXTENSION_NAME);
html_source->AddLocalizedString("extensionId",

Powered by Google App Engine
This is Rietveld 408576698