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

Side by Side Diff: chrome/browser/ui/webui/extensions/extension_settings_handler.cc

Issue 342003005: Show alert failure for reloading unpacked extensions with bad manifest (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added ReloadExtensionImpl, enhanced loader handler to send ListValue of failures Created 6 years, 5 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 (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/app_restore_service.h" 8 #include "apps/app_restore_service.h"
9 #include "apps/app_window.h" 9 #include "apps/app_window.h"
10 #include "apps/app_window_registry.h" 10 #include "apps/app_window_registry.h"
(...skipping 755 matching lines...) Expand 10 before | Expand all | Expand 10 after
766 const ExtensionSet* extensions = extension_service_->extensions(); 766 const ExtensionSet* extensions = extension_service_->extensions();
767 std::vector<const Extension*> unpacked_extensions; 767 std::vector<const Extension*> unpacked_extensions;
768 for (ExtensionSet::const_iterator extension = extensions->begin(); 768 for (ExtensionSet::const_iterator extension = extensions->begin();
769 extension != extensions->end(); ++extension) { 769 extension != extensions->end(); ++extension) {
770 if (Manifest::IsUnpackedLocation((*extension)->location())) 770 if (Manifest::IsUnpackedLocation((*extension)->location()))
771 unpacked_extensions.push_back(extension->get()); 771 unpacked_extensions.push_back(extension->get());
772 } 772 }
773 773
774 for (std::vector<const Extension*>::iterator iter = 774 for (std::vector<const Extension*>::iterator iter =
775 unpacked_extensions.begin(); iter != unpacked_extensions.end(); ++iter) { 775 unpacked_extensions.begin(); iter != unpacked_extensions.end(); ++iter) {
776 extension_service_->ReloadExtension((*iter)->id()); 776 extension_service_->ReloadExtensionWithQuietFailure((*iter)->id());
777 } 777 }
778 } 778 }
779 779
780 void ExtensionSettingsHandler::HandleRequestExtensionsData( 780 void ExtensionSettingsHandler::HandleRequestExtensionsData(
781 const base::ListValue* args) { 781 const base::ListValue* args) {
782 base::DictionaryValue results; 782 base::DictionaryValue results;
783 783
784 Profile* profile = Profile::FromWebUI(web_ui()); 784 Profile* profile = Profile::FromWebUI(web_ui());
785 785
786 // Add the extensions to the results structure. 786 // Add the extensions to the results structure.
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
918 extension_service_->GetExtensionById(extension_id, false); 918 extension_service_->GetExtensionById(extension_id, false);
919 OpenApplication(AppLaunchParams(extension_service_->profile(), extension, 919 OpenApplication(AppLaunchParams(extension_service_->profile(), extension,
920 extensions::LAUNCH_CONTAINER_WINDOW, 920 extensions::LAUNCH_CONTAINER_WINDOW,
921 NEW_WINDOW)); 921 NEW_WINDOW));
922 } 922 }
923 923
924 void ExtensionSettingsHandler::HandleReloadMessage( 924 void ExtensionSettingsHandler::HandleReloadMessage(
925 const base::ListValue* args) { 925 const base::ListValue* args) {
926 std::string extension_id = base::UTF16ToUTF8(ExtractStringValue(args)); 926 std::string extension_id = base::UTF16ToUTF8(ExtractStringValue(args));
927 CHECK(!extension_id.empty()); 927 CHECK(!extension_id.empty());
928 extension_service_->ReloadExtension(extension_id); 928 extension_service_->ReloadExtensionWithQuietFailure(extension_id);
929 } 929 }
930 930
931 void ExtensionSettingsHandler::HandleEnableMessage( 931 void ExtensionSettingsHandler::HandleEnableMessage(
932 const base::ListValue* args) { 932 const base::ListValue* args) {
933 CHECK_EQ(2U, args->GetSize()); 933 CHECK_EQ(2U, args->GetSize());
934 std::string extension_id, enable_str; 934 std::string extension_id, enable_str;
935 CHECK(args->GetString(0, &extension_id)); 935 CHECK(args->GetString(0, &extension_id));
936 CHECK(args->GetString(1, &enable_str)); 936 CHECK(args->GetString(1, &enable_str));
937 937
938 const Extension* extension = 938 const Extension* extension =
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after
1345 extension_service_->EnableExtension(extension_id); 1345 extension_service_->EnableExtension(extension_id);
1346 } else { 1346 } else {
1347 ExtensionErrorReporter::GetInstance()->ReportError( 1347 ExtensionErrorReporter::GetInstance()->ReportError(
1348 base::UTF8ToUTF16(JoinString(requirement_errors, ' ')), 1348 base::UTF8ToUTF16(JoinString(requirement_errors, ' ')),
1349 true); // Be noisy. 1349 true); // Be noisy.
1350 } 1350 }
1351 requirements_checker_.reset(); 1351 requirements_checker_.reset();
1352 } 1352 }
1353 1353
1354 } // namespace extensions 1354 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698