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/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 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 | 264 |
265 bool recommended_install = | 265 bool recommended_install = |
266 !managed_install && | 266 !managed_install && |
267 management_policy_->MustRemainInstalled(extension, NULL); | 267 management_policy_->MustRemainInstalled(extension, NULL); |
268 extension_data->SetBoolean("recommendedInstall", recommended_install); | 268 extension_data->SetBoolean("recommendedInstall", recommended_install); |
269 | 269 |
270 // Suspicious install should always be mutually exclusive to managed and/or | 270 // Suspicious install should always be mutually exclusive to managed and/or |
271 // recommended install. | 271 // recommended install. |
272 DCHECK(!(managed_install || recommended_install) || !suspicious_install); | 272 DCHECK(!(managed_install || recommended_install) || !suspicious_install); |
273 | 273 |
| 274 // |web_ui()| can be null in unit tests. |
| 275 bool installed_by_custodian = web_ui() && |
| 276 util::IsExtensionSupervised(extension, Profile::FromWebUI(web_ui())); |
| 277 extension_data->SetBoolean("installedByCustodian", installed_by_custodian); |
| 278 |
274 GURL icon = | 279 GURL icon = |
275 ExtensionIconSource::GetIconURL(extension, | 280 ExtensionIconSource::GetIconURL(extension, |
276 extension_misc::EXTENSION_ICON_MEDIUM, | 281 extension_misc::EXTENSION_ICON_MEDIUM, |
277 ExtensionIconSet::MATCH_BIGGER, | 282 ExtensionIconSet::MATCH_BIGGER, |
278 !enabled, NULL); | 283 !enabled, NULL); |
279 if (Manifest::IsUnpackedLocation(extension->location())) { | 284 if (Manifest::IsUnpackedLocation(extension->location())) { |
280 extension_data->SetString("path", extension->path().value()); | 285 extension_data->SetString("path", extension->path().value()); |
281 extension_data->SetString( | 286 extension_data->SetString( |
282 "prettifiedPath", | 287 "prettifiedPath", |
283 extensions::path_util::PrettifyPath(extension->path()).value()); | 288 extensions::path_util::PrettifyPath(extension->path()).value()); |
(...skipping 822 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1106 const base::ListValue* args) { | 1111 const base::ListValue* args) { |
1107 CHECK_EQ(2U, args->GetSize()); | 1112 CHECK_EQ(2U, args->GetSize()); |
1108 std::string extension_id, allow_str; | 1113 std::string extension_id, allow_str; |
1109 CHECK(args->GetString(0, &extension_id)); | 1114 CHECK(args->GetString(0, &extension_id)); |
1110 CHECK(args->GetString(1, &allow_str)); | 1115 CHECK(args->GetString(1, &allow_str)); |
1111 const Extension* extension = | 1116 const Extension* extension = |
1112 extension_service_->GetInstalledExtension(extension_id); | 1117 extension_service_->GetInstalledExtension(extension_id); |
1113 if (!extension) | 1118 if (!extension) |
1114 return; | 1119 return; |
1115 | 1120 |
| 1121 if (util::IsExtensionSupervised(extension, Profile::FromWebUI(web_ui()))) |
| 1122 return; |
| 1123 |
1116 if (!management_policy_->UserMayModifySettings(extension, NULL)) { | 1124 if (!management_policy_->UserMayModifySettings(extension, NULL)) { |
1117 LOG(ERROR) << "An attempt was made to change allow file access of an" | 1125 LOG(ERROR) << "An attempt was made to change allow file access of an" |
1118 << " extension that is non-usermanagable. Extension id : " | 1126 << " extension that is non-usermanagable. Extension id : " |
1119 << extension->id(); | 1127 << extension->id(); |
1120 return; | 1128 return; |
1121 } | 1129 } |
1122 | 1130 |
1123 util::SetAllowFileAccess( | 1131 util::SetAllowFileAccess( |
1124 extension_id, extension_service_->profile(), allow_str == "true"); | 1132 extension_id, extension_service_->profile(), allow_str == "true"); |
1125 } | 1133 } |
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1467 } | 1475 } |
1468 | 1476 |
1469 void ExtensionSettingsHandler::OnReinstallComplete( | 1477 void ExtensionSettingsHandler::OnReinstallComplete( |
1470 bool success, | 1478 bool success, |
1471 const std::string& error, | 1479 const std::string& error, |
1472 webstore_install::Result result) { | 1480 webstore_install::Result result) { |
1473 MaybeUpdateAfterNotification(); | 1481 MaybeUpdateAfterNotification(); |
1474 } | 1482 } |
1475 | 1483 |
1476 } // namespace extensions | 1484 } // namespace extensions |
OLD | NEW |