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 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
328 i != dependent_extensions->end(); | 328 i != dependent_extensions->end(); |
329 i++) { | 329 i++) { |
330 base::DictionaryValue* dependent_entry = new base::DictionaryValue; | 330 base::DictionaryValue* dependent_entry = new base::DictionaryValue; |
331 dependent_entry->SetString("id", (*i)->id()); | 331 dependent_entry->SetString("id", (*i)->id()); |
332 dependent_entry->SetString("name", (*i)->name()); | 332 dependent_entry->SetString("name", (*i)->name()); |
333 dependents_list->Append(dependent_entry); | 333 dependents_list->Append(dependent_entry); |
334 } | 334 } |
335 } | 335 } |
336 extension_data->Set("dependentExtensions", dependents_list); | 336 extension_data->Set("dependentExtensions", dependents_list); |
337 | 337 |
338 // Extensions only want all URL access if: | 338 // We show the "all urls" checkbox if: |
339 // - The feature is enabled for the given extension. | 339 // - The feature is enabled for the given extension. |
340 // - The extension has access to enough urls that we can't just let it run | 340 // - The extension has access to enough urls that we can't just let it run |
341 // on those specified in the permissions. | 341 // on those specified in the permissions. |
342 bool wants_all_urls = | 342 bool show_all_urls = |
343 util::ScriptsMayRequireActionForExtension(extension) && | 343 (FeatureSwitch::scripts_require_action()->IsEnabled() && |
344 (extension->permissions_data()->HasWithheldImpliedAllHosts() || | 344 util::ScriptsMayRequireActionForExtension( |
345 util::AllowedScriptingOnAllUrls( | 345 extension, |
346 extension->id(), extension_service_->GetBrowserContext())); | 346 extension->permissions_data()->active_permissions().get())) || |
347 extension_data->SetBoolean("wantsAllUrls", wants_all_urls); | 347 extension->permissions_data()->HasWithheldImpliedAllHosts(); |
| 348 extension_data->SetBoolean("showAllUrls", show_all_urls); |
348 extension_data->SetBoolean( | 349 extension_data->SetBoolean( |
349 "allowAllUrls", | 350 "allowAllUrls", |
350 util::AllowedScriptingOnAllUrls( | 351 util::AllowedScriptingOnAllUrls( |
351 extension->id(), | 352 extension->id(), |
352 extension_service_->GetBrowserContext())); | 353 extension_service_->GetBrowserContext())); |
353 | 354 |
354 base::string16 location_text; | 355 base::string16 location_text; |
355 if (extension->location() == Manifest::INTERNAL && | 356 if (extension->location() == Manifest::INTERNAL && |
356 !ManifestURL::UpdatesFromGallery(extension)) { | 357 !ManifestURL::UpdatesFromGallery(extension)) { |
357 location_text = l10n_util::GetStringUTF16( | 358 location_text = l10n_util::GetStringUTF16( |
(...skipping 1172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1530 extension_service_->EnableExtension(extension_id); | 1531 extension_service_->EnableExtension(extension_id); |
1531 } else { | 1532 } else { |
1532 ExtensionErrorReporter::GetInstance()->ReportError( | 1533 ExtensionErrorReporter::GetInstance()->ReportError( |
1533 base::UTF8ToUTF16(JoinString(requirement_errors, ' ')), | 1534 base::UTF8ToUTF16(JoinString(requirement_errors, ' ')), |
1534 true); // Be noisy. | 1535 true); // Be noisy. |
1535 } | 1536 } |
1536 requirements_checker_.reset(); | 1537 requirements_checker_.reset(); |
1537 } | 1538 } |
1538 | 1539 |
1539 } // namespace extensions | 1540 } // namespace extensions |
OLD | NEW |