| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "extensions/browser/extension_web_contents_observer.h" | 5 #include "extensions/browser/extension_web_contents_observer.h" |
| 6 | 6 |
| 7 #include "content/public/browser/child_process_security_policy.h" | 7 #include "content/public/browser/child_process_security_policy.h" |
| 8 #include "content/public/browser/render_process_host.h" | 8 #include "content/public/browser/render_process_host.h" |
| 9 #include "content/public/browser/render_view_host.h" | 9 #include "content/public/browser/render_view_host.h" |
| 10 #include "content/public/browser/site_instance.h" | 10 #include "content/public/browser/site_instance.h" |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 content::ChildProcessSecurityPolicy::GetInstance()->GrantScheme( | 48 content::ChildProcessSecurityPolicy::GetInstance()->GrantScheme( |
| 49 process->GetID(), content::kChromeUIScheme); | 49 process->GetID(), content::kChromeUIScheme); |
| 50 } | 50 } |
| 51 | 51 |
| 52 // Some extensions use file:// URLs. | 52 // Some extensions use file:// URLs. |
| 53 if (type == Manifest::TYPE_EXTENSION || | 53 if (type == Manifest::TYPE_EXTENSION || |
| 54 type == Manifest::TYPE_LEGACY_PACKAGED_APP) { | 54 type == Manifest::TYPE_LEGACY_PACKAGED_APP) { |
| 55 ExtensionPrefs* prefs = ExtensionPrefs::Get(browser_context_); | 55 ExtensionPrefs* prefs = ExtensionPrefs::Get(browser_context_); |
| 56 if (prefs->AllowFileAccess(extension->id())) { | 56 if (prefs->AllowFileAccess(extension->id())) { |
| 57 content::ChildProcessSecurityPolicy::GetInstance()->GrantScheme( | 57 content::ChildProcessSecurityPolicy::GetInstance()->GrantScheme( |
| 58 process->GetID(), content::kFileScheme); | 58 process->GetID(), url::kFileScheme); |
| 59 } | 59 } |
| 60 } | 60 } |
| 61 | 61 |
| 62 switch (type) { | 62 switch (type) { |
| 63 case Manifest::TYPE_EXTENSION: | 63 case Manifest::TYPE_EXTENSION: |
| 64 case Manifest::TYPE_USER_SCRIPT: | 64 case Manifest::TYPE_USER_SCRIPT: |
| 65 case Manifest::TYPE_HOSTED_APP: | 65 case Manifest::TYPE_HOSTED_APP: |
| 66 case Manifest::TYPE_LEGACY_PACKAGED_APP: | 66 case Manifest::TYPE_LEGACY_PACKAGED_APP: |
| 67 case Manifest::TYPE_PLATFORM_APP: | 67 case Manifest::TYPE_PLATFORM_APP: |
| 68 // Always send a Loaded message before ActivateExtension so that | 68 // Always send a Loaded message before ActivateExtension so that |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 // site, so we can ignore that wrinkle here. | 114 // site, so we can ignore that wrinkle here. |
| 115 const GURL& site = render_view_host->GetSiteInstance()->GetSiteURL(); | 115 const GURL& site = render_view_host->GetSiteInstance()->GetSiteURL(); |
| 116 | 116 |
| 117 if (!site.SchemeIs(kExtensionScheme)) | 117 if (!site.SchemeIs(kExtensionScheme)) |
| 118 return std::string(); | 118 return std::string(); |
| 119 | 119 |
| 120 return site.host(); | 120 return site.host(); |
| 121 } | 121 } |
| 122 | 122 |
| 123 } // namespace extensions | 123 } // namespace extensions |
| OLD | NEW |