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

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

Issue 1995113002: Rename WebUI::CallJavascriptFunction to WebUI::CallJavascriptFunctionUnsafe (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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 unified diff | Download patch
« no previous file with comments | « chrome/browser/ui/webui/history_login_handler.cc ('k') | chrome/browser/ui/webui/inspect_ui.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 // which could conceivably be compromised. 148 // which could conceivably be compromised.
149 CHECK(api); 149 CHECK(api);
150 150
151 // Remove token from the cache. 151 // Remove token from the cache.
152 api->EraseCachedToken(token_revoker->extension_id(), 152 api->EraseCachedToken(token_revoker->extension_id(),
153 token_revoker->access_token()); 153 token_revoker->access_token());
154 154
155 // Update view about the token being removed. 155 // Update view about the token being removed.
156 base::ListValue result; 156 base::ListValue result;
157 result.AppendString(token_revoker->access_token()); 157 result.AppendString(token_revoker->access_token());
158 web_ui()->CallJavascriptFunction("identity_internals.tokenRevokeDone", 158 web_ui()->CallJavascriptFunctionUnsafe("identity_internals.tokenRevokeDone",
159 result); 159 result);
160 160
161 // Erase the revoker. 161 // Erase the revoker.
162 ScopedVector<IdentityInternalsTokenRevoker>::iterator iter = 162 ScopedVector<IdentityInternalsTokenRevoker>::iterator iter =
163 std::find(token_revokers_.begin(), token_revokers_.end(), token_revoker); 163 std::find(token_revokers_.begin(), token_revokers_.end(), token_revoker);
164 DCHECK(iter != token_revokers_.end()); 164 DCHECK(iter != token_revokers_.end());
165 token_revokers_.erase(iter); 165 token_revokers_.erase(iter);
166 } 166 }
167 167
168 const std::string IdentityInternalsUIMessageHandler::GetExtensionName( 168 const std::string IdentityInternalsUIMessageHandler::GetExtensionName(
169 const extensions::ExtensionTokenKey& token_cache_key) { 169 const extensions::ExtensionTokenKey& token_cache_key) {
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 extensions::IdentityAPI* api = 231 extensions::IdentityAPI* api =
232 extensions::IdentityAPI::GetFactoryInstance()->Get( 232 extensions::IdentityAPI::GetFactoryInstance()->Get(
233 Profile::FromWebUI(web_ui())); 233 Profile::FromWebUI(web_ui()));
234 if (api) 234 if (api)
235 tokens = api->GetAllCachedTokens(); 235 tokens = api->GetAllCachedTokens();
236 for (extensions::IdentityAPI::CachedTokens::const_iterator 236 for (extensions::IdentityAPI::CachedTokens::const_iterator
237 iter = tokens.begin(); iter != tokens.end(); ++iter) { 237 iter = tokens.begin(); iter != tokens.end(); ++iter) {
238 results.Append(GetInfoForToken(iter->first, iter->second)); 238 results.Append(GetInfoForToken(iter->first, iter->second));
239 } 239 }
240 240
241 web_ui()->CallJavascriptFunction("identity_internals.returnTokens", results); 241 web_ui()->CallJavascriptFunctionUnsafe("identity_internals.returnTokens",
242 results);
242 } 243 }
243 244
244 void IdentityInternalsUIMessageHandler::RegisterMessages() { 245 void IdentityInternalsUIMessageHandler::RegisterMessages() {
245 web_ui()->RegisterMessageCallback("identityInternalsGetTokens", 246 web_ui()->RegisterMessageCallback("identityInternalsGetTokens",
246 base::Bind(&IdentityInternalsUIMessageHandler::GetInfoForAllTokens, 247 base::Bind(&IdentityInternalsUIMessageHandler::GetInfoForAllTokens,
247 base::Unretained(this))); 248 base::Unretained(this)));
248 web_ui()->RegisterMessageCallback("identityInternalsRevokeToken", 249 web_ui()->RegisterMessageCallback("identityInternalsRevokeToken",
249 base::Bind(&IdentityInternalsUIMessageHandler::RevokeToken, 250 base::Bind(&IdentityInternalsUIMessageHandler::RevokeToken,
250 base::Unretained(this))); 251 base::Unretained(this)));
251 } 252 }
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 html_source->AddResourcePath("identity_internals.js", 314 html_source->AddResourcePath("identity_internals.js",
314 IDR_IDENTITY_INTERNALS_JS); 315 IDR_IDENTITY_INTERNALS_JS);
315 html_source->SetDefaultResource(IDR_IDENTITY_INTERNALS_HTML); 316 html_source->SetDefaultResource(IDR_IDENTITY_INTERNALS_HTML);
316 317
317 content::WebUIDataSource::Add(Profile::FromWebUI(web_ui), html_source); 318 content::WebUIDataSource::Add(Profile::FromWebUI(web_ui), html_source);
318 319
319 web_ui->AddMessageHandler(new IdentityInternalsUIMessageHandler()); 320 web_ui->AddMessageHandler(new IdentityInternalsUIMessageHandler());
320 } 321 }
321 322
322 IdentityInternalsUI::~IdentityInternalsUI() {} 323 IdentityInternalsUI::~IdentityInternalsUI() {}
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/history_login_handler.cc ('k') | chrome/browser/ui/webui/inspect_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698