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

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

Issue 178193030: Rename ProfileKeyedAPI to BrowserContextKeyedAPI and GetProfile to Get. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: nits Created 6 years, 9 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
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 <set> 7 #include <set>
8 #include <string> 8 #include <string>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 DISALLOW_COPY_AND_ASSIGN(IdentityInternalsTokenRevoker); 134 DISALLOW_COPY_AND_ASSIGN(IdentityInternalsTokenRevoker);
135 }; 135 };
136 136
137 IdentityInternalsUIMessageHandler::IdentityInternalsUIMessageHandler() {} 137 IdentityInternalsUIMessageHandler::IdentityInternalsUIMessageHandler() {}
138 138
139 IdentityInternalsUIMessageHandler::~IdentityInternalsUIMessageHandler() {} 139 IdentityInternalsUIMessageHandler::~IdentityInternalsUIMessageHandler() {}
140 140
141 void IdentityInternalsUIMessageHandler::OnTokenRevokerDone( 141 void IdentityInternalsUIMessageHandler::OnTokenRevokerDone(
142 IdentityInternalsTokenRevoker* token_revoker) { 142 IdentityInternalsTokenRevoker* token_revoker) {
143 // Remove token from the cache. 143 // Remove token from the cache.
144 extensions::IdentityAPI::GetFactoryInstance()->GetForProfile( 144 extensions::IdentityAPI::GetFactoryInstance()
145 Profile::FromWebUI(web_ui()))->EraseCachedToken( 145 ->Get(Profile::FromWebUI(web_ui()))
146 token_revoker->extension_id(), token_revoker->access_token()); 146 ->EraseCachedToken(token_revoker->extension_id(),
147 token_revoker->access_token());
147 148
148 // Update view about the token being removed. 149 // Update view about the token being removed.
149 base::ListValue result; 150 base::ListValue result;
150 result.AppendString(token_revoker->access_token()); 151 result.AppendString(token_revoker->access_token());
151 web_ui()->CallJavascriptFunction("identity_internals.tokenRevokeDone", 152 web_ui()->CallJavascriptFunction("identity_internals.tokenRevokeDone",
152 result); 153 result);
153 154
154 // Erase the revoker. 155 // Erase the revoker.
155 ScopedVector<IdentityInternalsTokenRevoker>::iterator iter = 156 ScopedVector<IdentityInternalsTokenRevoker>::iterator iter =
156 std::find(token_revokers_.begin(), token_revokers_.end(), token_revoker); 157 std::find(token_revokers_.begin(), token_revokers_.end(), token_revoker);
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 token_data->SetString(kAccessToken, token_cache_value.token()); 214 token_data->SetString(kAccessToken, token_cache_value.token());
214 token_data->SetString(kTokenExpirationTime, 215 token_data->SetString(kTokenExpirationTime,
215 GetExpirationTime(token_cache_value)); 216 GetExpirationTime(token_cache_value));
216 return token_data; 217 return token_data;
217 } 218 }
218 219
219 void IdentityInternalsUIMessageHandler::GetInfoForAllTokens( 220 void IdentityInternalsUIMessageHandler::GetInfoForAllTokens(
220 const base::ListValue* args) { 221 const base::ListValue* args) {
221 base::ListValue results; 222 base::ListValue results;
222 extensions::IdentityAPI::CachedTokens tokens = 223 extensions::IdentityAPI::CachedTokens tokens =
223 extensions::IdentityAPI::GetFactoryInstance()->GetForProfile( 224 extensions::IdentityAPI::GetFactoryInstance()
224 Profile::FromWebUI(web_ui()))->GetAllCachedTokens(); 225 ->Get(Profile::FromWebUI(web_ui()))
226 ->GetAllCachedTokens();
225 for (extensions::IdentityAPI::CachedTokens::const_iterator 227 for (extensions::IdentityAPI::CachedTokens::const_iterator
226 iter = tokens.begin(); iter != tokens.end(); ++iter) { 228 iter = tokens.begin(); iter != tokens.end(); ++iter) {
227 results.Append(GetInfoForToken(iter->first, iter->second)); 229 results.Append(GetInfoForToken(iter->first, iter->second));
228 } 230 }
229 231
230 web_ui()->CallJavascriptFunction("identity_internals.returnTokens", results); 232 web_ui()->CallJavascriptFunction("identity_internals.returnTokens", results);
231 } 233 }
232 234
233 void IdentityInternalsUIMessageHandler::RegisterMessages() { 235 void IdentityInternalsUIMessageHandler::RegisterMessages() {
234 web_ui()->RegisterMessageCallback("identityInternalsGetTokens", 236 web_ui()->RegisterMessageCallback("identityInternalsGetTokens",
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 html_source->AddResourcePath("identity_internals.js", 305 html_source->AddResourcePath("identity_internals.js",
304 IDR_IDENTITY_INTERNALS_JS); 306 IDR_IDENTITY_INTERNALS_JS);
305 html_source->SetDefaultResource(IDR_IDENTITY_INTERNALS_HTML); 307 html_source->SetDefaultResource(IDR_IDENTITY_INTERNALS_HTML);
306 308
307 content::WebUIDataSource::Add(Profile::FromWebUI(web_ui), html_source); 309 content::WebUIDataSource::Add(Profile::FromWebUI(web_ui), html_source);
308 310
309 web_ui->AddMessageHandler(new IdentityInternalsUIMessageHandler()); 311 web_ui->AddMessageHandler(new IdentityInternalsUIMessageHandler());
310 } 312 }
311 313
312 IdentityInternalsUI::~IdentityInternalsUI() {} 314 IdentityInternalsUI::~IdentityInternalsUI() {}
OLDNEW
« no previous file with comments | « chrome/browser/speech/extension_api/tts_extension_api.cc ('k') | chrome/browser/ui/webui/identity_internals_ui_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698