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 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
221 should_do_verification_check_ = true; | 222 should_do_verification_check_ = true; |
222 | 223 |
223 bool corrupt_install = | 224 bool corrupt_install = |
224 (disable_reasons & Extension::DISABLE_CORRUPTED) != 0; | 225 (disable_reasons & Extension::DISABLE_CORRUPTED) != 0; |
225 extension_data->SetBoolean("corruptInstall", corrupt_install); | 226 extension_data->SetBoolean("corruptInstall", corrupt_install); |
226 | 227 |
227 bool managed_install = | 228 bool managed_install = |
228 !management_policy_->UserMayModifySettings(extension, NULL); | 229 !management_policy_->UserMayModifySettings(extension, NULL); |
229 extension_data->SetBoolean("managedInstall", managed_install); | 230 extension_data->SetBoolean("managedInstall", managed_install); |
230 | 231 |
232 bool managed_shared_module = | |
233 extension->is_shared_module() && extension->from_webstore(); | |
not at google - send to devlin
2014/07/17 20:44:52
why does being from the webstore make a difference
elijahtaylor1
2014/07/17 21:45:30
based on your other comment, I'm getting rid of th
| |
234 extension_data->SetBoolean("managedSharedModule", managed_shared_module); | |
235 | |
231 // We should not get into a state where both are true. | 236 // We should not get into a state where both are true. |
232 DCHECK(!managed_install || !suspicious_install); | 237 DCHECK(!managed_install || !suspicious_install); |
233 | 238 |
234 GURL icon = | 239 GURL icon = |
235 ExtensionIconSource::GetIconURL(extension, | 240 ExtensionIconSource::GetIconURL(extension, |
236 extension_misc::EXTENSION_ICON_MEDIUM, | 241 extension_misc::EXTENSION_ICON_MEDIUM, |
237 ExtensionIconSet::MATCH_BIGGER, | 242 ExtensionIconSet::MATCH_BIGGER, |
238 !enabled, NULL); | 243 !enabled, NULL); |
239 if (Manifest::IsUnpackedLocation(extension->location())) { | 244 if (Manifest::IsUnpackedLocation(extension->location())) { |
240 extension_data->SetString("path", extension->path().value()); | 245 extension_data->SetString("path", extension->path().value()); |
(...skipping 13 matching lines...) Expand all Loading... | |
254 util::IsIncognitoEnabled(extension->id(), extension_service_->profile())); | 259 util::IsIncognitoEnabled(extension->id(), extension_service_->profile())); |
255 extension_data->SetBoolean("incognitoCanBeEnabled", | 260 extension_data->SetBoolean("incognitoCanBeEnabled", |
256 extension->can_be_incognito_enabled()); | 261 extension->can_be_incognito_enabled()); |
257 extension_data->SetBoolean("wantsFileAccess", extension->wants_file_access()); | 262 extension_data->SetBoolean("wantsFileAccess", extension->wants_file_access()); |
258 extension_data->SetBoolean("allowFileAccess", | 263 extension_data->SetBoolean("allowFileAccess", |
259 util::AllowFileAccess(extension->id(), extension_service_->profile())); | 264 util::AllowFileAccess(extension->id(), extension_service_->profile())); |
260 extension_data->SetBoolean("allow_reload", | 265 extension_data->SetBoolean("allow_reload", |
261 Manifest::IsUnpackedLocation(extension->location())); | 266 Manifest::IsUnpackedLocation(extension->location())); |
262 extension_data->SetBoolean("is_hosted_app", extension->is_hosted_app()); | 267 extension_data->SetBoolean("is_hosted_app", extension->is_hosted_app()); |
263 extension_data->SetBoolean("is_platform_app", extension->is_platform_app()); | 268 extension_data->SetBoolean("is_platform_app", extension->is_platform_app()); |
269 extension_data->SetBoolean("is_shared_module", extension->is_shared_module()); | |
264 extension_data->SetBoolean("homepageProvided", | 270 extension_data->SetBoolean("homepageProvided", |
265 ManifestURL::GetHomepageURL(extension).is_valid()); | 271 ManifestURL::GetHomepageURL(extension).is_valid()); |
266 | 272 |
273 // Add dependent extensions. | |
274 if (extension->is_shared_module()) { | |
275 base::ListValue* dependents_list = new base::ListValue; | |
276 scoped_ptr<ExtensionSet> dependents = | |
not at google - send to devlin
2014/07/17 20:44:52
nit: can we call this 'dependentExtensions' not 'd
elijahtaylor1
2014/07/17 21:45:30
Done.
| |
277 extension_service_->shared_module_service()->GetDependentExtensions( | |
278 extension); | |
279 for (ExtensionSet::const_iterator i = dependents->begin(); | |
280 i != dependents->end(); | |
281 i++) { | |
282 dependents_list->Append(new base::StringValue((*i)->id())); | |
283 } | |
284 extension_data->Set("dependents", dependents_list); | |
285 } | |
286 | |
267 // Extensions only want all URL access if: | 287 // Extensions only want all URL access if: |
268 // - The feature is enabled. | 288 // - The feature is enabled. |
269 // - The extension has access to enough urls that we can't just let it run | 289 // - The extension has access to enough urls that we can't just let it run |
270 // on those specified in the permissions. | 290 // on those specified in the permissions. |
271 bool wants_all_urls = | 291 bool wants_all_urls = |
272 extension->permissions_data()->HasWithheldImpliedAllHosts(); | 292 extension->permissions_data()->HasWithheldImpliedAllHosts(); |
273 extension_data->SetBoolean("wantsAllUrls", wants_all_urls); | 293 extension_data->SetBoolean("wantsAllUrls", wants_all_urls); |
274 extension_data->SetBoolean( | 294 extension_data->SetBoolean( |
275 "allowAllUrls", | 295 "allowAllUrls", |
276 util::AllowedScriptingOnAllUrls( | 296 util::AllowedScriptingOnAllUrls( |
277 extension->id(), | 297 extension->id(), |
278 extension_service_->GetBrowserContext())); | 298 extension_service_->GetBrowserContext())); |
279 | 299 |
280 base::string16 location_text; | 300 base::string16 location_text; |
281 if (Manifest::IsPolicyLocation(extension->location())) { | 301 if (Manifest::IsPolicyLocation(extension->location())) { |
282 location_text = l10n_util::GetStringUTF16( | 302 location_text = l10n_util::GetStringUTF16( |
283 IDS_OPTIONS_INSTALL_LOCATION_ENTERPRISE); | 303 IDS_OPTIONS_INSTALL_LOCATION_ENTERPRISE); |
284 } else if (extension->location() == Manifest::INTERNAL && | 304 } else if (extension->location() == Manifest::INTERNAL && |
285 !ManifestURL::UpdatesFromGallery(extension)) { | 305 !ManifestURL::UpdatesFromGallery(extension)) { |
286 location_text = l10n_util::GetStringUTF16( | 306 location_text = l10n_util::GetStringUTF16( |
287 IDS_OPTIONS_INSTALL_LOCATION_UNKNOWN); | 307 IDS_OPTIONS_INSTALL_LOCATION_UNKNOWN); |
288 } else if (extension->location() == Manifest::EXTERNAL_REGISTRY) { | 308 } else if (extension->location() == Manifest::EXTERNAL_REGISTRY) { |
289 location_text = l10n_util::GetStringUTF16( | 309 location_text = l10n_util::GetStringUTF16( |
290 IDS_OPTIONS_INSTALL_LOCATION_3RD_PARTY); | 310 IDS_OPTIONS_INSTALL_LOCATION_3RD_PARTY); |
311 } else if (managed_shared_module) { | |
312 location_text = l10n_util::GetStringUTF16( | |
313 IDS_OPTIONS_INSTALL_LOCATION_SHARED_MODULE); | |
291 } | 314 } |
292 extension_data->SetString("locationText", location_text); | 315 extension_data->SetString("locationText", location_text); |
293 | 316 |
294 base::string16 blacklist_text; | 317 base::string16 blacklist_text; |
295 switch (prefs->GetExtensionBlacklistState(extension->id())) { | 318 switch (prefs->GetExtensionBlacklistState(extension->id())) { |
296 case BLACKLISTED_SECURITY_VULNERABILITY: | 319 case BLACKLISTED_SECURITY_VULNERABILITY: |
297 blacklist_text = l10n_util::GetStringUTF16( | 320 blacklist_text = l10n_util::GetStringUTF16( |
298 IDS_OPTIONS_BLACKLISTED_SECURITY_VULNERABILITY); | 321 IDS_OPTIONS_BLACKLISTED_SECURITY_VULNERABILITY); |
299 break; | 322 break; |
300 | 323 |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
484 source->AddString("extensionSettingsOptions", | 507 source->AddString("extensionSettingsOptions", |
485 l10n_util::GetStringUTF16(IDS_EXTENSIONS_OPTIONS_LINK)); | 508 l10n_util::GetStringUTF16(IDS_EXTENSIONS_OPTIONS_LINK)); |
486 source->AddString("extensionSettingsPermissions", | 509 source->AddString("extensionSettingsPermissions", |
487 l10n_util::GetStringUTF16(IDS_EXTENSIONS_PERMISSIONS_LINK)); | 510 l10n_util::GetStringUTF16(IDS_EXTENSIONS_PERMISSIONS_LINK)); |
488 source->AddString("extensionSettingsVisitWebsite", | 511 source->AddString("extensionSettingsVisitWebsite", |
489 l10n_util::GetStringUTF16(IDS_EXTENSIONS_VISIT_WEBSITE)); | 512 l10n_util::GetStringUTF16(IDS_EXTENSIONS_VISIT_WEBSITE)); |
490 source->AddString("extensionSettingsVisitWebStore", | 513 source->AddString("extensionSettingsVisitWebStore", |
491 l10n_util::GetStringUTF16(IDS_EXTENSIONS_VISIT_WEBSTORE)); | 514 l10n_util::GetStringUTF16(IDS_EXTENSIONS_VISIT_WEBSTORE)); |
492 source->AddString("extensionSettingsPolicyControlled", | 515 source->AddString("extensionSettingsPolicyControlled", |
493 l10n_util::GetStringUTF16(IDS_EXTENSIONS_POLICY_CONTROLLED)); | 516 l10n_util::GetStringUTF16(IDS_EXTENSIONS_POLICY_CONTROLLED)); |
517 source->AddString("extensionSettingsSharedModule", | |
518 l10n_util::GetStringUTF16(IDS_EXTENSIONS_SHARED_MODULE)); | |
494 source->AddString("extensionSettingsManagedMode", | 519 source->AddString("extensionSettingsManagedMode", |
495 l10n_util::GetStringUTF16(IDS_EXTENSIONS_LOCKED_SUPERVISED_USER)); | 520 l10n_util::GetStringUTF16(IDS_EXTENSIONS_LOCKED_SUPERVISED_USER)); |
496 source->AddString("extensionSettingsCorruptInstall", | 521 source->AddString("extensionSettingsCorruptInstall", |
497 l10n_util::GetStringUTF16( | 522 l10n_util::GetStringUTF16( |
498 IDS_EXTENSIONS_CORRUPTED_EXTENSION)); | 523 IDS_EXTENSIONS_CORRUPTED_EXTENSION)); |
499 source->AddString("extensionSettingsSuspiciousInstall", | 524 source->AddString("extensionSettingsSuspiciousInstall", |
500 l10n_util::GetStringFUTF16( | 525 l10n_util::GetStringFUTF16( |
501 IDS_EXTENSIONS_ADDED_WITHOUT_KNOWLEDGE, | 526 IDS_EXTENSIONS_ADDED_WITHOUT_KNOWLEDGE, |
502 l10n_util::GetStringUTF16(IDS_EXTENSION_WEB_STORE_TITLE))); | 527 l10n_util::GetStringUTF16(IDS_EXTENSION_WEB_STORE_TITLE))); |
503 source->AddString("extensionSettingsLearnMore", | 528 source->AddString("extensionSettingsLearnMore", |
(...skipping 862 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1366 extension_service_->EnableExtension(extension_id); | 1391 extension_service_->EnableExtension(extension_id); |
1367 } else { | 1392 } else { |
1368 ExtensionErrorReporter::GetInstance()->ReportError( | 1393 ExtensionErrorReporter::GetInstance()->ReportError( |
1369 base::UTF8ToUTF16(JoinString(requirement_errors, ' ')), | 1394 base::UTF8ToUTF16(JoinString(requirement_errors, ' ')), |
1370 true); // Be noisy. | 1395 true); // Be noisy. |
1371 } | 1396 } |
1372 requirements_checker_.reset(); | 1397 requirements_checker_.reset(); |
1373 } | 1398 } |
1374 | 1399 |
1375 } // namespace extensions | 1400 } // namespace extensions |
OLD | NEW |