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 23 matching lines...) Expand all Loading... | |
| 34 #include "chrome/browser/extensions/extension_action_manager.h" | 34 #include "chrome/browser/extensions/extension_action_manager.h" |
| 35 #include "chrome/browser/extensions/extension_disabled_ui.h" | 35 #include "chrome/browser/extensions/extension_disabled_ui.h" |
| 36 #include "chrome/browser/extensions/extension_error_reporter.h" | 36 #include "chrome/browser/extensions/extension_error_reporter.h" |
| 37 #include "chrome/browser/extensions/extension_service.h" | 37 #include "chrome/browser/extensions/extension_service.h" |
| 38 #include "chrome/browser/extensions/extension_tab_util.h" | 38 #include "chrome/browser/extensions/extension_tab_util.h" |
| 39 #include "chrome/browser/extensions/extension_ui_util.h" | 39 #include "chrome/browser/extensions/extension_ui_util.h" |
| 40 #include "chrome/browser/extensions/extension_util.h" | 40 #include "chrome/browser/extensions/extension_util.h" |
| 41 #include "chrome/browser/extensions/extension_warning_set.h" | 41 #include "chrome/browser/extensions/extension_warning_set.h" |
| 42 #include "chrome/browser/extensions/install_verifier.h" | 42 #include "chrome/browser/extensions/install_verifier.h" |
| 43 #include "chrome/browser/extensions/path_util.h" | 43 #include "chrome/browser/extensions/path_util.h" |
| 44 #include "chrome/browser/extensions/shared_module_service.h" | |
| 44 #include "chrome/browser/extensions/updater/extension_updater.h" | 45 #include "chrome/browser/extensions/updater/extension_updater.h" |
| 45 #include "chrome/browser/platform_util.h" | 46 #include "chrome/browser/platform_util.h" |
| 46 #include "chrome/browser/profiles/profile.h" | 47 #include "chrome/browser/profiles/profile.h" |
| 47 #include "chrome/browser/supervised_user/supervised_user_service.h" | 48 #include "chrome/browser/supervised_user/supervised_user_service.h" |
| 48 #include "chrome/browser/supervised_user/supervised_user_service_factory.h" | 49 #include "chrome/browser/supervised_user/supervised_user_service_factory.h" |
| 49 #include "chrome/browser/tab_contents/background_contents.h" | 50 #include "chrome/browser/tab_contents/background_contents.h" |
| 50 #include "chrome/browser/ui/browser_finder.h" | 51 #include "chrome/browser/ui/browser_finder.h" |
| 51 #include "chrome/browser/ui/extensions/application_launch.h" | 52 #include "chrome/browser/ui/extensions/application_launch.h" |
| 52 #include "chrome/browser/ui/webui/extensions/extension_basic_info.h" | 53 #include "chrome/browser/ui/webui/extensions/extension_basic_info.h" |
| 53 #include "chrome/browser/ui/webui/extensions/extension_icon_source.h" | 54 #include "chrome/browser/ui/webui/extensions/extension_icon_source.h" |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 257 extension_data->SetBoolean("wantsFileAccess", extension->wants_file_access()); | 258 extension_data->SetBoolean("wantsFileAccess", extension->wants_file_access()); |
| 258 extension_data->SetBoolean("allowFileAccess", | 259 extension_data->SetBoolean("allowFileAccess", |
| 259 util::AllowFileAccess(extension->id(), extension_service_->profile())); | 260 util::AllowFileAccess(extension->id(), extension_service_->profile())); |
| 260 extension_data->SetBoolean("allow_reload", | 261 extension_data->SetBoolean("allow_reload", |
| 261 Manifest::IsUnpackedLocation(extension->location())); | 262 Manifest::IsUnpackedLocation(extension->location())); |
| 262 extension_data->SetBoolean("is_hosted_app", extension->is_hosted_app()); | 263 extension_data->SetBoolean("is_hosted_app", extension->is_hosted_app()); |
| 263 extension_data->SetBoolean("is_platform_app", extension->is_platform_app()); | 264 extension_data->SetBoolean("is_platform_app", extension->is_platform_app()); |
| 264 extension_data->SetBoolean("homepageProvided", | 265 extension_data->SetBoolean("homepageProvided", |
| 265 ManifestURL::GetHomepageURL(extension).is_valid()); | 266 ManifestURL::GetHomepageURL(extension).is_valid()); |
| 266 | 267 |
| 268 // Add dependent extensions. | |
| 269 base::ListValue* dependents_list = new base::ListValue; | |
| 270 if (extension->is_shared_module()) { | |
| 271 scoped_ptr<ExtensionSet> dependentExtensions = | |
|
not at google - send to devlin
2014/07/17 22:03:41
depentent_extensions
not at google - send to devlin
2014/07/17 22:03:57
by which I mean dependent_extensions
elijahtaylor1
2014/07/17 23:28:04
Arg, too much JS/C++ context switching :)
| |
| 272 extension_service_->shared_module_service()->GetDependentExtensions( | |
| 273 extension); | |
| 274 for (ExtensionSet::const_iterator i = dependentExtensions->begin(); | |
| 275 i != dependentExtensions->end(); | |
| 276 i++) { | |
| 277 dependents_list->Append(new base::StringValue((*i)->id())); | |
| 278 } | |
| 279 } | |
| 280 extension_data->Set("dependentExtensions", dependents_list); | |
| 281 | |
| 267 // Extensions only want all URL access if: | 282 // Extensions only want all URL access if: |
| 268 // - The feature is enabled. | 283 // - The feature is enabled. |
| 269 // - The extension has access to enough urls that we can't just let it run | 284 // - The extension has access to enough urls that we can't just let it run |
| 270 // on those specified in the permissions. | 285 // on those specified in the permissions. |
| 271 bool wants_all_urls = | 286 bool wants_all_urls = |
| 272 extension->permissions_data()->HasWithheldImpliedAllHosts(); | 287 extension->permissions_data()->HasWithheldImpliedAllHosts(); |
| 273 extension_data->SetBoolean("wantsAllUrls", wants_all_urls); | 288 extension_data->SetBoolean("wantsAllUrls", wants_all_urls); |
| 274 extension_data->SetBoolean( | 289 extension_data->SetBoolean( |
| 275 "allowAllUrls", | 290 "allowAllUrls", |
| 276 util::AllowedScriptingOnAllUrls( | 291 util::AllowedScriptingOnAllUrls( |
| 277 extension->id(), | 292 extension->id(), |
| 278 extension_service_->GetBrowserContext())); | 293 extension_service_->GetBrowserContext())); |
| 279 | 294 |
| 280 base::string16 location_text; | 295 base::string16 location_text; |
| 281 if (Manifest::IsPolicyLocation(extension->location())) { | 296 if (Manifest::IsPolicyLocation(extension->location())) { |
| 282 location_text = l10n_util::GetStringUTF16( | 297 location_text = l10n_util::GetStringUTF16( |
| 283 IDS_OPTIONS_INSTALL_LOCATION_ENTERPRISE); | 298 IDS_OPTIONS_INSTALL_LOCATION_ENTERPRISE); |
| 284 } else if (extension->location() == Manifest::INTERNAL && | 299 } else if (extension->location() == Manifest::INTERNAL && |
| 285 !ManifestURL::UpdatesFromGallery(extension)) { | 300 !ManifestURL::UpdatesFromGallery(extension)) { |
| 286 location_text = l10n_util::GetStringUTF16( | 301 location_text = l10n_util::GetStringUTF16( |
| 287 IDS_OPTIONS_INSTALL_LOCATION_UNKNOWN); | 302 IDS_OPTIONS_INSTALL_LOCATION_UNKNOWN); |
| 288 } else if (extension->location() == Manifest::EXTERNAL_REGISTRY) { | 303 } else if (extension->location() == Manifest::EXTERNAL_REGISTRY) { |
| 289 location_text = l10n_util::GetStringUTF16( | 304 location_text = l10n_util::GetStringUTF16( |
| 290 IDS_OPTIONS_INSTALL_LOCATION_3RD_PARTY); | 305 IDS_OPTIONS_INSTALL_LOCATION_3RD_PARTY); |
| 306 } else if (extension->is_shared_module() && extension->from_webstore()) { | |
|
not at google - send to devlin
2014/07/17 22:03:41
remove the from_webstore check here?
elijahtaylor1
2014/07/17 23:28:04
This I would like to keep because it controls the
not at google - send to devlin
2014/07/17 23:30:35
all this sets is location text, it can't hurt to a
elijahtaylor1
2014/07/18 00:22:31
eh, ok, I don't feel too strongly about this. Rem
| |
| 307 location_text = l10n_util::GetStringUTF16( | |
| 308 IDS_OPTIONS_INSTALL_LOCATION_SHARED_MODULE); | |
| 291 } | 309 } |
| 292 extension_data->SetString("locationText", location_text); | 310 extension_data->SetString("locationText", location_text); |
| 293 | 311 |
| 294 base::string16 blacklist_text; | 312 base::string16 blacklist_text; |
| 295 switch (prefs->GetExtensionBlacklistState(extension->id())) { | 313 switch (prefs->GetExtensionBlacklistState(extension->id())) { |
| 296 case BLACKLISTED_SECURITY_VULNERABILITY: | 314 case BLACKLISTED_SECURITY_VULNERABILITY: |
| 297 blacklist_text = l10n_util::GetStringUTF16( | 315 blacklist_text = l10n_util::GetStringUTF16( |
| 298 IDS_OPTIONS_BLACKLISTED_SECURITY_VULNERABILITY); | 316 IDS_OPTIONS_BLACKLISTED_SECURITY_VULNERABILITY); |
| 299 break; | 317 break; |
| 300 | 318 |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 484 source->AddString("extensionSettingsOptions", | 502 source->AddString("extensionSettingsOptions", |
| 485 l10n_util::GetStringUTF16(IDS_EXTENSIONS_OPTIONS_LINK)); | 503 l10n_util::GetStringUTF16(IDS_EXTENSIONS_OPTIONS_LINK)); |
| 486 source->AddString("extensionSettingsPermissions", | 504 source->AddString("extensionSettingsPermissions", |
| 487 l10n_util::GetStringUTF16(IDS_EXTENSIONS_PERMISSIONS_LINK)); | 505 l10n_util::GetStringUTF16(IDS_EXTENSIONS_PERMISSIONS_LINK)); |
| 488 source->AddString("extensionSettingsVisitWebsite", | 506 source->AddString("extensionSettingsVisitWebsite", |
| 489 l10n_util::GetStringUTF16(IDS_EXTENSIONS_VISIT_WEBSITE)); | 507 l10n_util::GetStringUTF16(IDS_EXTENSIONS_VISIT_WEBSITE)); |
| 490 source->AddString("extensionSettingsVisitWebStore", | 508 source->AddString("extensionSettingsVisitWebStore", |
| 491 l10n_util::GetStringUTF16(IDS_EXTENSIONS_VISIT_WEBSTORE)); | 509 l10n_util::GetStringUTF16(IDS_EXTENSIONS_VISIT_WEBSTORE)); |
| 492 source->AddString("extensionSettingsPolicyControlled", | 510 source->AddString("extensionSettingsPolicyControlled", |
| 493 l10n_util::GetStringUTF16(IDS_EXTENSIONS_POLICY_CONTROLLED)); | 511 l10n_util::GetStringUTF16(IDS_EXTENSIONS_POLICY_CONTROLLED)); |
| 512 source->AddString("extensionSettingsDependentExtensions", | |
| 513 l10n_util::GetStringUTF16(IDS_EXTENSIONS_DEPENDENT_EXTENSIONS)); | |
| 494 source->AddString("extensionSettingsManagedMode", | 514 source->AddString("extensionSettingsManagedMode", |
| 495 l10n_util::GetStringUTF16(IDS_EXTENSIONS_LOCKED_SUPERVISED_USER)); | 515 l10n_util::GetStringUTF16(IDS_EXTENSIONS_LOCKED_SUPERVISED_USER)); |
| 496 source->AddString("extensionSettingsCorruptInstall", | 516 source->AddString("extensionSettingsCorruptInstall", |
| 497 l10n_util::GetStringUTF16( | 517 l10n_util::GetStringUTF16( |
| 498 IDS_EXTENSIONS_CORRUPTED_EXTENSION)); | 518 IDS_EXTENSIONS_CORRUPTED_EXTENSION)); |
| 499 source->AddString("extensionSettingsSuspiciousInstall", | 519 source->AddString("extensionSettingsSuspiciousInstall", |
| 500 l10n_util::GetStringFUTF16( | 520 l10n_util::GetStringFUTF16( |
| 501 IDS_EXTENSIONS_ADDED_WITHOUT_KNOWLEDGE, | 521 IDS_EXTENSIONS_ADDED_WITHOUT_KNOWLEDGE, |
| 502 l10n_util::GetStringUTF16(IDS_EXTENSION_WEB_STORE_TITLE))); | 522 l10n_util::GetStringUTF16(IDS_EXTENSION_WEB_STORE_TITLE))); |
| 503 source->AddString("extensionSettingsLearnMore", | 523 source->AddString("extensionSettingsLearnMore", |
| (...skipping 862 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1366 extension_service_->EnableExtension(extension_id); | 1386 extension_service_->EnableExtension(extension_id); |
| 1367 } else { | 1387 } else { |
| 1368 ExtensionErrorReporter::GetInstance()->ReportError( | 1388 ExtensionErrorReporter::GetInstance()->ReportError( |
| 1369 base::UTF8ToUTF16(JoinString(requirement_errors, ' ')), | 1389 base::UTF8ToUTF16(JoinString(requirement_errors, ' ')), |
| 1370 true); // Be noisy. | 1390 true); // Be noisy. |
| 1371 } | 1391 } |
| 1372 requirements_checker_.reset(); | 1392 requirements_checker_.reset(); |
| 1373 } | 1393 } |
| 1374 | 1394 |
| 1375 } // namespace extensions | 1395 } // namespace extensions |
| OLD | NEW |