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

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

Issue 709813004: Remove the deprecated function ExtensionService::extensions(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed thestig@'s comments. Created 6 years, 1 month 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 <set> 7 #include <set>
8 #include <string> 8 #include <string>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
11 #include "base/i18n/time_formatting.h" 11 #include "base/i18n/time_formatting.h"
12 #include "base/strings/utf_string_conversions.h" 12 #include "base/strings/utf_string_conversions.h"
13 #include "base/values.h" 13 #include "base/values.h"
14 #include "chrome/browser/extensions/api/identity/identity_api.h" 14 #include "chrome/browser/extensions/api/identity/identity_api.h"
15 #include "chrome/browser/extensions/extension_service.h"
16 #include "chrome/browser/profiles/profile.h" 15 #include "chrome/browser/profiles/profile.h"
17 #include "chrome/common/url_constants.h" 16 #include "chrome/common/url_constants.h"
18 #include "chrome/grit/generated_resources.h" 17 #include "chrome/grit/generated_resources.h"
19 #include "content/public/browser/web_ui.h" 18 #include "content/public/browser/web_ui.h"
20 #include "content/public/browser/web_ui_controller.h" 19 #include "content/public/browser/web_ui_controller.h"
21 #include "content/public/browser/web_ui_data_source.h" 20 #include "content/public/browser/web_ui_data_source.h"
22 #include "content/public/browser/web_ui_message_handler.h" 21 #include "content/public/browser/web_ui_message_handler.h"
23 #include "extensions/browser/extension_system.h" 22 #include "extensions/browser/extension_registry.h"
24 #include "google_apis/gaia/gaia_auth_fetcher.h" 23 #include "google_apis/gaia/gaia_auth_fetcher.h"
25 #include "google_apis/gaia/gaia_constants.h" 24 #include "google_apis/gaia/gaia_constants.h"
26 #include "grit/browser_resources.h" 25 #include "grit/browser_resources.h"
27 #include "ui/base/l10n/l10n_util.h" 26 #include "ui/base/l10n/l10n_util.h"
28 27
29 namespace { 28 namespace {
30 29
31 // Properties of the Javascript object representing a token. 30 // Properties of the Javascript object representing a token.
32 const char kExtensionId[] = "extensionId"; 31 const char kExtensionId[] = "extensionId";
33 const char kExtensionName[] = "extensionName"; 32 const char kExtensionName[] = "extensionName";
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 153
155 // Erase the revoker. 154 // Erase the revoker.
156 ScopedVector<IdentityInternalsTokenRevoker>::iterator iter = 155 ScopedVector<IdentityInternalsTokenRevoker>::iterator iter =
157 std::find(token_revokers_.begin(), token_revokers_.end(), token_revoker); 156 std::find(token_revokers_.begin(), token_revokers_.end(), token_revoker);
158 DCHECK(iter != token_revokers_.end()); 157 DCHECK(iter != token_revokers_.end());
159 token_revokers_.erase(iter); 158 token_revokers_.erase(iter);
160 } 159 }
161 160
162 const std::string IdentityInternalsUIMessageHandler::GetExtensionName( 161 const std::string IdentityInternalsUIMessageHandler::GetExtensionName(
163 const extensions::ExtensionTokenKey& token_cache_key) { 162 const extensions::ExtensionTokenKey& token_cache_key) {
164 ExtensionService* extension_service = extensions::ExtensionSystem::Get( 163 const extensions::ExtensionRegistry* registry =
165 Profile::FromWebUI(web_ui()))->extension_service(); 164 extensions::ExtensionRegistry::Get(Profile::FromWebUI(web_ui()));
166 const extensions::Extension* extension = 165 const extensions::Extension* extension =
167 extension_service->extensions()->GetByID(token_cache_key.extension_id); 166 registry->enabled_extensions().GetByID(token_cache_key.extension_id);
168 if (!extension) 167 if (!extension)
169 return std::string(); 168 return std::string();
170 return extension->name(); 169 return extension->name();
171 } 170 }
172 171
173 base::ListValue* IdentityInternalsUIMessageHandler::GetScopes( 172 base::ListValue* IdentityInternalsUIMessageHandler::GetScopes(
174 const extensions::ExtensionTokenKey& token_cache_key) { 173 const extensions::ExtensionTokenKey& token_cache_key) {
175 base::ListValue* scopes_value = new base::ListValue(); 174 base::ListValue* scopes_value = new base::ListValue();
176 for (std::set<std::string>::const_iterator 175 for (std::set<std::string>::const_iterator
177 iter = token_cache_key.scopes.begin(); 176 iter = token_cache_key.scopes.begin();
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 html_source->AddResourcePath("identity_internals.js", 303 html_source->AddResourcePath("identity_internals.js",
305 IDR_IDENTITY_INTERNALS_JS); 304 IDR_IDENTITY_INTERNALS_JS);
306 html_source->SetDefaultResource(IDR_IDENTITY_INTERNALS_HTML); 305 html_source->SetDefaultResource(IDR_IDENTITY_INTERNALS_HTML);
307 306
308 content::WebUIDataSource::Add(Profile::FromWebUI(web_ui), html_source); 307 content::WebUIDataSource::Add(Profile::FromWebUI(web_ui), html_source);
309 308
310 web_ui->AddMessageHandler(new IdentityInternalsUIMessageHandler()); 309 web_ui->AddMessageHandler(new IdentityInternalsUIMessageHandler());
311 } 310 }
312 311
313 IdentityInternalsUI::~IdentityInternalsUI() {} 312 IdentityInternalsUI::~IdentityInternalsUI() {}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698