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

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

Issue 190723002: Fixed null pointer crash in ExtensionSettingsHandler. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Changed the message 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 825 matching lines...) Expand 10 before | Expand all | Expand 10 after
836 836
837 void ExtensionSettingsHandler::HandleEnableMessage( 837 void ExtensionSettingsHandler::HandleEnableMessage(
838 const base::ListValue* args) { 838 const base::ListValue* args) {
839 CHECK_EQ(2U, args->GetSize()); 839 CHECK_EQ(2U, args->GetSize());
840 std::string extension_id, enable_str; 840 std::string extension_id, enable_str;
841 CHECK(args->GetString(0, &extension_id)); 841 CHECK(args->GetString(0, &extension_id));
842 CHECK(args->GetString(1, &enable_str)); 842 CHECK(args->GetString(1, &enable_str));
843 843
844 const Extension* extension = 844 const Extension* extension =
845 extension_service_->GetInstalledExtension(extension_id); 845 extension_service_->GetInstalledExtension(extension_id);
846 if (!extension || 846 if (!extension)
847 !management_policy_->UserMayModifySettings(extension, NULL)) { 847 return;
848 LOG(ERROR) << "Attempt to enable an extension that is non-usermanagable was" 848
849 << "made. Extension id: " << extension->id(); 849 if (!management_policy_->UserMayModifySettings(extension, NULL)) {
850 LOG(ERROR) << "An attempt was made to enable an extension that is "
851 << "non-usermanagable. Extension id: " << extension->id();
850 return; 852 return;
851 } 853 }
852 854
853 if (enable_str == "true") { 855 if (enable_str == "true") {
854 ExtensionPrefs* prefs = ExtensionPrefs::Get(extension_service_->profile()); 856 ExtensionPrefs* prefs = ExtensionPrefs::Get(extension_service_->profile());
855 if (prefs->DidExtensionEscalatePermissions(extension_id)) { 857 if (prefs->DidExtensionEscalatePermissions(extension_id)) {
856 ShowExtensionDisabledDialog( 858 ShowExtensionDisabledDialog(
857 extension_service_, web_ui()->GetWebContents(), extension); 859 extension_service_, web_ui()->GetWebContents(), extension);
858 } else if ((prefs->GetDisableReasons(extension_id) & 860 } else if ((prefs->GetDisableReasons(extension_id) &
859 Extension::DISABLE_UNSUPPORTED_REQUIREMENT) && 861 Extension::DISABLE_UNSUPPORTED_REQUIREMENT) &&
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
910 CHECK_EQ(2U, args->GetSize()); 912 CHECK_EQ(2U, args->GetSize());
911 std::string extension_id, allow_str; 913 std::string extension_id, allow_str;
912 CHECK(args->GetString(0, &extension_id)); 914 CHECK(args->GetString(0, &extension_id));
913 CHECK(args->GetString(1, &allow_str)); 915 CHECK(args->GetString(1, &allow_str));
914 const Extension* extension = 916 const Extension* extension =
915 extension_service_->GetInstalledExtension(extension_id); 917 extension_service_->GetInstalledExtension(extension_id);
916 if (!extension) 918 if (!extension)
917 return; 919 return;
918 920
919 if (!management_policy_->UserMayModifySettings(extension, NULL)) { 921 if (!management_policy_->UserMayModifySettings(extension, NULL)) {
920 LOG(ERROR) << "Attempt to change allow file access of an extension that is " 922 LOG(ERROR) << "An attempt was made to change allow file access of an"
921 << "non-usermanagable was made. Extension id : " 923 << " extension that is non-usermanagable. Extension id : "
922 << extension->id(); 924 << extension->id();
923 return; 925 return;
924 } 926 }
925 927
926 util::SetAllowFileAccess( 928 util::SetAllowFileAccess(
927 extension_id, extension_service_->profile(), allow_str == "true"); 929 extension_id, extension_service_->profile(), allow_str == "true");
928 } 930 }
929 931
930 void ExtensionSettingsHandler::HandleUninstallMessage( 932 void ExtensionSettingsHandler::HandleUninstallMessage(
931 const base::ListValue* args) { 933 const base::ListValue* args) {
932 CHECK_EQ(1U, args->GetSize()); 934 CHECK_EQ(1U, args->GetSize());
933 std::string extension_id; 935 std::string extension_id;
934 CHECK(args->GetString(0, &extension_id)); 936 CHECK(args->GetString(0, &extension_id));
935 const Extension* extension = 937 const Extension* extension =
936 extension_service_->GetInstalledExtension(extension_id); 938 extension_service_->GetInstalledExtension(extension_id);
937 if (!extension) 939 if (!extension)
938 return; 940 return;
939 941
940 if (!management_policy_->UserMayModifySettings(extension, NULL)) { 942 if (!management_policy_->UserMayModifySettings(extension, NULL)) {
941 LOG(ERROR) << "Attempt to uninstall an extension that is non-usermanagable " 943 LOG(ERROR) << "An attempt was made to uninstall an extension that is "
942 << "was made. Extension id : " << extension->id(); 944 << "non-usermanagable. Extension id : " << extension->id();
943 return; 945 return;
944 } 946 }
945 947
946 if (!extension_id_prompting_.empty()) 948 if (!extension_id_prompting_.empty())
947 return; // Only one prompt at a time. 949 return; // Only one prompt at a time.
948 950
949 extension_id_prompting_ = extension_id; 951 extension_id_prompting_ = extension_id;
950 952
951 GetExtensionUninstallDialog()->ConfirmUninstall(extension); 953 GetExtensionUninstallDialog()->ConfirmUninstall(extension);
952 } 954 }
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
1247 extension_service_->EnableExtension(extension_id); 1249 extension_service_->EnableExtension(extension_id);
1248 } else { 1250 } else {
1249 ExtensionErrorReporter::GetInstance()->ReportError( 1251 ExtensionErrorReporter::GetInstance()->ReportError(
1250 base::UTF8ToUTF16(JoinString(requirement_errors, ' ')), 1252 base::UTF8ToUTF16(JoinString(requirement_errors, ' ')),
1251 true /* be noisy */); 1253 true /* be noisy */);
1252 } 1254 }
1253 requirements_checker_.reset(); 1255 requirements_checker_.reset();
1254 } 1256 }
1255 1257
1256 } // namespace extensions 1258 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698