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

Side by Side Diff: chrome/browser/ui/webui/extensions/extension_settings_handler.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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/extensions/extension_settings_handler.h" 5 #include "chrome/browser/ui/webui/extensions/extension_settings_handler.h"
6 6
7 #include "apps/app_load_service.h" 7 #include "apps/app_load_service.h"
8 #include "apps/saved_files_service.h" 8 #include "apps/saved_files_service.h"
9 #include "base/auto_reset.h" 9 #include "base/auto_reset.h"
10 #include "base/base64.h" 10 #include "base/base64.h"
(...skipping 846 matching lines...) Expand 10 before | Expand all | Expand 10 after
857 857
858 void ExtensionSettingsHandler::InstallUIAbort(bool user_initiated) { 858 void ExtensionSettingsHandler::InstallUIAbort(bool user_initiated) {
859 extension_id_prompting_.clear(); 859 extension_id_prompting_.clear();
860 } 860 }
861 861
862 void ExtensionSettingsHandler::AppInfoDialogClosed() { 862 void ExtensionSettingsHandler::AppInfoDialogClosed() {
863 extension_id_prompting_.clear(); 863 extension_id_prompting_.clear();
864 } 864 }
865 865
866 void ExtensionSettingsHandler::ReloadUnpackedExtensions() { 866 void ExtensionSettingsHandler::ReloadUnpackedExtensions() {
867 const ExtensionSet* extensions = extension_service_->extensions(); 867 ExtensionRegistry* registry =
868 ExtensionRegistry::Get(extension_service_->profile());
868 std::vector<const Extension*> unpacked_extensions; 869 std::vector<const Extension*> unpacked_extensions;
869 for (ExtensionSet::const_iterator extension = extensions->begin(); 870 for (const scoped_refptr<const extensions::Extension>& extension :
870 extension != extensions->end(); ++extension) { 871 registry->enabled_extensions()) {
871 if (Manifest::IsUnpackedLocation((*extension)->location())) 872 if (Manifest::IsUnpackedLocation(extension->location()))
872 unpacked_extensions.push_back(extension->get()); 873 unpacked_extensions.push_back(extension.get());
873 } 874 }
874 875
875 for (std::vector<const Extension*>::iterator iter = 876 for (std::vector<const Extension*>::iterator iter =
876 unpacked_extensions.begin(); iter != unpacked_extensions.end(); ++iter) { 877 unpacked_extensions.begin(); iter != unpacked_extensions.end(); ++iter) {
877 extension_service_->ReloadExtensionWithQuietFailure((*iter)->id()); 878 extension_service_->ReloadExtensionWithQuietFailure((*iter)->id());
878 } 879 }
879 } 880 }
880 881
881 void ExtensionSettingsHandler::HandleRequestExtensionsData( 882 void ExtensionSettingsHandler::HandleRequestExtensionsData(
882 const base::ListValue* args) { 883 const base::ListValue* args) {
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
991 CHECK_EQ(4U, args->GetSize()); 992 CHECK_EQ(4U, args->GetSize());
992 CHECK(args->GetString(0, &extension_id)); 993 CHECK(args->GetString(0, &extension_id));
993 CHECK(args->GetString(1, &render_process_id_str)); 994 CHECK(args->GetString(1, &render_process_id_str));
994 CHECK(args->GetString(2, &render_view_id_str)); 995 CHECK(args->GetString(2, &render_view_id_str));
995 CHECK(args->GetBoolean(3, &incognito)); 996 CHECK(args->GetBoolean(3, &incognito));
996 CHECK(base::StringToInt(render_process_id_str, &render_process_id)); 997 CHECK(base::StringToInt(render_process_id_str, &render_process_id));
997 CHECK(base::StringToInt(render_view_id_str, &render_view_id)); 998 CHECK(base::StringToInt(render_view_id_str, &render_view_id));
998 999
999 if (render_process_id == -1) { 1000 if (render_process_id == -1) {
1000 // This message is for a lazy background page. Start the page if necessary. 1001 // This message is for a lazy background page. Start the page if necessary.
1002 Profile* profile = Profile::FromWebUI(web_ui());
1001 const Extension* extension = 1003 const Extension* extension =
1002 extension_service_->extensions()->GetByID(extension_id); 1004 ExtensionRegistry::Get(profile)->enabled_extensions().GetByID(
1005 extension_id);
1003 DCHECK(extension); 1006 DCHECK(extension);
1004 Profile* profile = Profile::FromWebUI(web_ui());
1005 if (incognito) 1007 if (incognito)
1006 profile = profile->GetOffTheRecordProfile(); 1008 profile = profile->GetOffTheRecordProfile();
1007 devtools_util::InspectBackgroundPage(extension, profile); 1009 devtools_util::InspectBackgroundPage(extension, profile);
1008 return; 1010 return;
1009 } 1011 }
1010 1012
1011 RenderViewHost* host = RenderViewHost::FromID(render_process_id, 1013 RenderViewHost* host = RenderViewHost::FromID(render_process_id,
1012 render_view_id); 1014 render_view_id);
1013 if (!host || !WebContents::FromRenderViewHost(host)) { 1015 if (!host || !WebContents::FromRenderViewHost(host)) {
1014 // This can happen if the host has gone away since the page was displayed. 1016 // This can happen if the host has gone away since the page was displayed.
(...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after
1512 extension_service_->EnableExtension(extension_id); 1514 extension_service_->EnableExtension(extension_id);
1513 } else { 1515 } else {
1514 ExtensionErrorReporter::GetInstance()->ReportError( 1516 ExtensionErrorReporter::GetInstance()->ReportError(
1515 base::UTF8ToUTF16(JoinString(requirement_errors, ' ')), 1517 base::UTF8ToUTF16(JoinString(requirement_errors, ' ')),
1516 true); // Be noisy. 1518 true); // Be noisy.
1517 } 1519 }
1518 requirements_checker_.reset(); 1520 requirements_checker_.reset();
1519 } 1521 }
1520 1522
1521 } // namespace extensions 1523 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/extensions/extension_settings_browsertest.cc ('k') | chrome/browser/ui/webui/identity_internals_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698