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/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 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 231 should_do_verification_check_ = true; | 231 should_do_verification_check_ = true; |
| 232 | 232 |
| 233 bool corrupt_install = | 233 bool corrupt_install = |
| 234 (disable_reasons & Extension::DISABLE_CORRUPTED) != 0; | 234 (disable_reasons & Extension::DISABLE_CORRUPTED) != 0; |
| 235 extension_data->SetBoolean("corruptInstall", corrupt_install); | 235 extension_data->SetBoolean("corruptInstall", corrupt_install); |
| 236 | 236 |
| 237 bool managed_install = | 237 bool managed_install = |
| 238 !management_policy_->UserMayModifySettings(extension, NULL); | 238 !management_policy_->UserMayModifySettings(extension, NULL); |
| 239 extension_data->SetBoolean("managedInstall", managed_install); | 239 extension_data->SetBoolean("managedInstall", managed_install); |
| 240 | 240 |
| 241 bool recommended_install = | |
| 242 !managed_install && | |
| 243 management_policy_->MustRemainInstalled(extension, NULL); | |
|
Joao da Silva
2014/09/18 12:21:23
This is conflating logic for different things. It
binjin
2014/09/18 16:25:16
How about management_policy_->UserMayModifySetting
binjin
2014/09/18 17:44:07
Okay, I got what you mean. But I still don't think
Joao da Silva
2014/09/19 07:55:52
The point is that ManagementPolicy has more than o
| |
| 244 extension_data->SetBoolean("recommendedInstall", recommended_install); | |
| 245 | |
| 241 // We should not get into a state where both are true. | 246 // We should not get into a state where both are true. |
| 242 DCHECK(!managed_install || !suspicious_install); | 247 DCHECK(!(managed_install || recommended_install) || !suspicious_install); |
| 243 | 248 |
| 244 GURL icon = | 249 GURL icon = |
| 245 ExtensionIconSource::GetIconURL(extension, | 250 ExtensionIconSource::GetIconURL(extension, |
| 246 extension_misc::EXTENSION_ICON_MEDIUM, | 251 extension_misc::EXTENSION_ICON_MEDIUM, |
| 247 ExtensionIconSet::MATCH_BIGGER, | 252 ExtensionIconSet::MATCH_BIGGER, |
| 248 !enabled, NULL); | 253 !enabled, NULL); |
| 249 if (Manifest::IsUnpackedLocation(extension->location())) { | 254 if (Manifest::IsUnpackedLocation(extension->location())) { |
| 250 extension_data->SetString("path", extension->path().value()); | 255 extension_data->SetString("path", extension->path().value()); |
| 251 extension_data->SetString( | 256 extension_data->SetString( |
| 252 "prettifiedPath", | 257 "prettifiedPath", |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 303 util::AllowedScriptingOnAllUrls( | 308 util::AllowedScriptingOnAllUrls( |
| 304 extension->id(), extension_service_->GetBrowserContext())); | 309 extension->id(), extension_service_->GetBrowserContext())); |
| 305 extension_data->SetBoolean("wantsAllUrls", wants_all_urls); | 310 extension_data->SetBoolean("wantsAllUrls", wants_all_urls); |
| 306 extension_data->SetBoolean( | 311 extension_data->SetBoolean( |
| 307 "allowAllUrls", | 312 "allowAllUrls", |
| 308 util::AllowedScriptingOnAllUrls( | 313 util::AllowedScriptingOnAllUrls( |
| 309 extension->id(), | 314 extension->id(), |
| 310 extension_service_->GetBrowserContext())); | 315 extension_service_->GetBrowserContext())); |
| 311 | 316 |
| 312 base::string16 location_text; | 317 base::string16 location_text; |
| 313 if (Manifest::IsPolicyLocation(extension->location())) { | 318 if (Manifest::IsPolicyLocation(extension->location()) || |
| 319 extension->location() == Manifest::EXTERNAL_PREF_DOWNLOAD && | |
| 320 recommended_install) { | |
| 314 location_text = l10n_util::GetStringUTF16( | 321 location_text = l10n_util::GetStringUTF16( |
| 315 IDS_OPTIONS_INSTALL_LOCATION_ENTERPRISE); | 322 IDS_OPTIONS_INSTALL_LOCATION_ENTERPRISE); |
| 316 } else if (extension->location() == Manifest::INTERNAL && | 323 } else if (extension->location() == Manifest::INTERNAL && |
| 317 !ManifestURL::UpdatesFromGallery(extension)) { | 324 !ManifestURL::UpdatesFromGallery(extension)) { |
| 318 location_text = l10n_util::GetStringUTF16( | 325 location_text = l10n_util::GetStringUTF16( |
| 319 IDS_OPTIONS_INSTALL_LOCATION_UNKNOWN); | 326 IDS_OPTIONS_INSTALL_LOCATION_UNKNOWN); |
| 320 } else if (extension->location() == Manifest::EXTERNAL_REGISTRY) { | 327 } else if (extension->location() == Manifest::EXTERNAL_REGISTRY) { |
| 321 location_text = l10n_util::GetStringUTF16( | 328 location_text = l10n_util::GetStringUTF16( |
| 322 IDS_OPTIONS_INSTALL_LOCATION_3RD_PARTY); | 329 IDS_OPTIONS_INSTALL_LOCATION_3RD_PARTY); |
| 323 } else if (extension->is_shared_module()) { | 330 } else if (extension->is_shared_module()) { |
| (...skipping 1092 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1416 extension_service_->EnableExtension(extension_id); | 1423 extension_service_->EnableExtension(extension_id); |
| 1417 } else { | 1424 } else { |
| 1418 ExtensionErrorReporter::GetInstance()->ReportError( | 1425 ExtensionErrorReporter::GetInstance()->ReportError( |
| 1419 base::UTF8ToUTF16(JoinString(requirement_errors, ' ')), | 1426 base::UTF8ToUTF16(JoinString(requirement_errors, ' ')), |
| 1420 true); // Be noisy. | 1427 true); // Be noisy. |
| 1421 } | 1428 } |
| 1422 requirements_checker_.reset(); | 1429 requirements_checker_.reset(); |
| 1423 } | 1430 } |
| 1424 | 1431 |
| 1425 } // namespace extensions | 1432 } // namespace extensions |
| OLD | NEW |