| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/extensions/extension_web_contents_observer.h" | 5 #include "chrome/browser/extensions/extension_web_contents_observer.h" |
| 6 | 6 |
| 7 #include "chrome/browser/extensions/api/messaging/message_service.h" | 7 #include "chrome/browser/extensions/api/messaging/message_service.h" |
| 8 #include "chrome/browser/extensions/error_console/error_console.h" | 8 #include "chrome/browser/extensions/error_console/error_console.h" |
| 9 #include "chrome/browser/extensions/extension_service.h" | 9 #include "chrome/browser/extensions/extension_service.h" |
| 10 #include "chrome/common/extensions/api/messaging/message.h" | 10 #include "chrome/common/extensions/api/messaging/message.h" |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 | 49 |
| 50 // Some extensions use chrome:// URLs. | 50 // Some extensions use chrome:// URLs. |
| 51 // This is a temporary solution. Replace it with access to chrome-static:// | 51 // This is a temporary solution. Replace it with access to chrome-static:// |
| 52 // once it is implemented. See: crbug.com/226927. | 52 // once it is implemented. See: crbug.com/226927. |
| 53 Manifest::Type type = extension->GetType(); | 53 Manifest::Type type = extension->GetType(); |
| 54 if (type == Manifest::TYPE_EXTENSION || | 54 if (type == Manifest::TYPE_EXTENSION || |
| 55 type == Manifest::TYPE_LEGACY_PACKAGED_APP || | 55 type == Manifest::TYPE_LEGACY_PACKAGED_APP || |
| 56 (type == Manifest::TYPE_PLATFORM_APP && | 56 (type == Manifest::TYPE_PLATFORM_APP && |
| 57 extension->location() == Manifest::COMPONENT)) { | 57 extension->location() == Manifest::COMPONENT)) { |
| 58 content::ChildProcessSecurityPolicy::GetInstance()->GrantScheme( | 58 content::ChildProcessSecurityPolicy::GetInstance()->GrantScheme( |
| 59 process->GetID(), chrome::kChromeUIScheme); | 59 process->GetID(), content::kChromeUIScheme); |
| 60 } | 60 } |
| 61 | 61 |
| 62 // Some extensions use file:// URLs. | 62 // Some extensions use file:// URLs. |
| 63 if (type == Manifest::TYPE_EXTENSION || | 63 if (type == Manifest::TYPE_EXTENSION || |
| 64 type == Manifest::TYPE_LEGACY_PACKAGED_APP) { | 64 type == Manifest::TYPE_LEGACY_PACKAGED_APP) { |
| 65 ExtensionPrefs* prefs = ExtensionPrefs::Get(browser_context_); | 65 ExtensionPrefs* prefs = ExtensionPrefs::Get(browser_context_); |
| 66 if (prefs->AllowFileAccess(extension->id())) { | 66 if (prefs->AllowFileAccess(extension->id())) { |
| 67 content::ChildProcessSecurityPolicy::GetInstance()->GrantScheme( | 67 content::ChildProcessSecurityPolicy::GetInstance()->GrantScheme( |
| 68 process->GetID(), content::kFileScheme); | 68 process->GetID(), content::kFileScheme); |
| 69 } | 69 } |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 ExtensionSystem::Get(browser_context_)-> | 158 ExtensionSystem::Get(browser_context_)-> |
| 159 extension_service()->ReloadExtension(extension_id); | 159 extension_service()->ReloadExtension(extension_id); |
| 160 } | 160 } |
| 161 | 161 |
| 162 // May be null if the extension doesn't exist, for example if somebody typos | 162 // May be null if the extension doesn't exist, for example if somebody typos |
| 163 // a chrome-extension:// URL. | 163 // a chrome-extension:// URL. |
| 164 return registry->enabled_extensions().GetByID(extension_id); | 164 return registry->enabled_extensions().GetByID(extension_id); |
| 165 } | 165 } |
| 166 | 166 |
| 167 } // namespace extensions | 167 } // namespace extensions |
| OLD | NEW |