web_ui_injection_host.cc 997 B

123456789101112131415161718192021222324252627282930313233
  1. // Copyright 2015 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #include "extensions/renderer/web_ui_injection_host.h"
  5. WebUIInjectionHost::WebUIInjectionHost(const extensions::mojom::HostID& host_id)
  6. : InjectionHost(host_id), url_(host_id.id) {}
  7. WebUIInjectionHost::~WebUIInjectionHost() {
  8. }
  9. const std::string* WebUIInjectionHost::GetContentSecurityPolicy() const {
  10. // Use the main world CSP.
  11. return nullptr;
  12. }
  13. const GURL& WebUIInjectionHost::url() const {
  14. return url_;
  15. }
  16. const std::string& WebUIInjectionHost::name() const {
  17. return id().id;
  18. }
  19. extensions::PermissionsData::PageAccess WebUIInjectionHost::CanExecuteOnFrame(
  20. const GURL& document_url,
  21. content::RenderFrame* render_frame,
  22. int tab_id,
  23. bool is_declarative) const {
  24. // Content scripts are allowed to inject on webviews created by WebUI.
  25. return extensions::PermissionsData::PageAccess::kAllowed;
  26. }