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

Side by Side Diff: chrome/browser/ui/webui/identity_internals_ui.cc

Issue 2812953002: Stop passing raw pointers to base::Value API in c/b/ui (Closed)
Patch Set: No ListValue::SetDouble Created 3 years, 8 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/webui/identity_internals_ui.h" 5 #include "chrome/browser/ui/webui/identity_internals_ui.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 10
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 void RegisterMessages() override; 59 void RegisterMessages() override;
60 60
61 private: 61 private:
62 // Gets the name of an extension referred to by |token_cache_key| as a string. 62 // Gets the name of an extension referred to by |token_cache_key| as a string.
63 const std::string GetExtensionName( 63 const std::string GetExtensionName(
64 const extensions::ExtensionTokenKey& token_cache_key); 64 const extensions::ExtensionTokenKey& token_cache_key);
65 65
66 // Gets a list of scopes specified in |token_cache_key| and returns a pointer 66 // Gets a list of scopes specified in |token_cache_key| and returns a pointer
67 // to a ListValue containing the scopes. The caller gets ownership of the 67 // to a ListValue containing the scopes. The caller gets ownership of the
68 // returned object. 68 // returned object.
69 base::ListValue* GetScopes( 69 std::unique_ptr<base::ListValue> GetScopes(
70 const extensions::ExtensionTokenKey& token_cache_key); 70 const extensions::ExtensionTokenKey& token_cache_key);
71 71
72 // Gets a localized status of the access token in |token_cache_value|. 72 // Gets a localized status of the access token in |token_cache_value|.
73 const base::string16 GetStatus( 73 const base::string16 GetStatus(
74 const extensions::IdentityTokenCacheValue& token_cache_value); 74 const extensions::IdentityTokenCacheValue& token_cache_value);
75 75
76 // Gets a string representation of an expiration time of the access token in 76 // Gets a string representation of an expiration time of the access token in
77 // |token_cache_value|. 77 // |token_cache_value|.
78 const std::string GetExpirationTime( 78 const std::string GetExpirationTime(
79 const extensions::IdentityTokenCacheValue& token_cache_value); 79 const extensions::IdentityTokenCacheValue& token_cache_value);
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 const extensions::ExtensionTokenKey& token_cache_key) { 174 const extensions::ExtensionTokenKey& token_cache_key) {
175 const extensions::ExtensionRegistry* registry = 175 const extensions::ExtensionRegistry* registry =
176 extensions::ExtensionRegistry::Get(Profile::FromWebUI(web_ui())); 176 extensions::ExtensionRegistry::Get(Profile::FromWebUI(web_ui()));
177 const extensions::Extension* extension = 177 const extensions::Extension* extension =
178 registry->enabled_extensions().GetByID(token_cache_key.extension_id); 178 registry->enabled_extensions().GetByID(token_cache_key.extension_id);
179 if (!extension) 179 if (!extension)
180 return std::string(); 180 return std::string();
181 return extension->name(); 181 return extension->name();
182 } 182 }
183 183
184 base::ListValue* IdentityInternalsUIMessageHandler::GetScopes( 184 std::unique_ptr<base::ListValue> IdentityInternalsUIMessageHandler::GetScopes(
185 const extensions::ExtensionTokenKey& token_cache_key) { 185 const extensions::ExtensionTokenKey& token_cache_key) {
186 base::ListValue* scopes_value = new base::ListValue(); 186 auto scopes_value = base::MakeUnique<base::ListValue>();
187 for (std::set<std::string>::const_iterator 187 for (std::set<std::string>::const_iterator
188 iter = token_cache_key.scopes.begin(); 188 iter = token_cache_key.scopes.begin();
189 iter != token_cache_key.scopes.end(); ++iter) { 189 iter != token_cache_key.scopes.end(); ++iter) {
190 scopes_value->AppendString(*iter); 190 scopes_value->AppendString(*iter);
191 } 191 }
192 return scopes_value; 192 return scopes_value;
193 } 193 }
194 194
195 const base::string16 IdentityInternalsUIMessageHandler::GetStatus( 195 const base::string16 IdentityInternalsUIMessageHandler::GetStatus(
196 const extensions::IdentityTokenCacheValue& token_cache_value) { 196 const extensions::IdentityTokenCacheValue& token_cache_value) {
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 IDR_IDENTITY_INTERNALS_JS); 322 IDR_IDENTITY_INTERNALS_JS);
323 html_source->SetDefaultResource(IDR_IDENTITY_INTERNALS_HTML); 323 html_source->SetDefaultResource(IDR_IDENTITY_INTERNALS_HTML);
324 324
325 content::WebUIDataSource::Add(Profile::FromWebUI(web_ui), html_source); 325 content::WebUIDataSource::Add(Profile::FromWebUI(web_ui), html_source);
326 326
327 web_ui->AddMessageHandler( 327 web_ui->AddMessageHandler(
328 base::MakeUnique<IdentityInternalsUIMessageHandler>()); 328 base::MakeUnique<IdentityInternalsUIMessageHandler>());
329 } 329 }
330 330
331 IdentityInternalsUI::~IdentityInternalsUI() {} 331 IdentityInternalsUI::~IdentityInternalsUI() {}
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/foreign_session_handler.cc ('k') | chrome/browser/ui/webui/instant_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698