Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 | |
| 849 if (!management_policy_->UserMayModifySettings(extension, NULL)) { | |
| 848 LOG(ERROR) << "Attempt to enable an extension that is non-usermanagable was" | 850 LOG(ERROR) << "Attempt to enable an extension that is non-usermanagable was" |
| 849 << "made. Extension id: " << extension->id(); | 851 << "made. Extension id: " << extension->id(); |
| 850 return; | 852 return; |
| 851 } | 853 } |
|
Finnur
2014/03/07 12:55:53
Wow... this gave me a serious sense of deja-vu! An
vasilii
2014/03/07 13:02:00
That means the log message is wrong. What should I
Finnur
2014/03/07 13:44:03
If you are sure that we should not output this LOG
vasilii
2014/03/07 15:16:55
We definitely shouldn't output this message. The b
Finnur
2014/03/07 16:27:16
Nah, probably not. We return early for NULL extens
| |
| 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) && |
| 860 !requirements_checker_.get()) { | 862 !requirements_checker_.get()) { |
| 861 // Recheck the requirements. | 863 // Recheck the requirements. |
| (...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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 |
| OLD | NEW |