| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_service.h" | 5 #include "chrome/browser/extensions/extension_service.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <set> | 8 #include <set> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 2006 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2017 for (size_t i = 0; i < extensions_.size(); ++i) { | 2017 for (size_t i = 0; i < extensions_.size(); ++i) { |
| 2018 if (!extensions_[i]->is_theme() && | 2018 if (!extensions_[i]->is_theme() && |
| 2019 extensions_[i]->location() != Extension::COMPONENT) | 2019 extensions_[i]->location() != Extension::COMPONENT) |
| 2020 extension_ids.insert(extensions_[i]->id()); | 2020 extension_ids.insert(extensions_[i]->id()); |
| 2021 } | 2021 } |
| 2022 | 2022 |
| 2023 child_process_logging::SetActiveExtensions(extension_ids); | 2023 child_process_logging::SetActiveExtensions(extension_ids); |
| 2024 } | 2024 } |
| 2025 | 2025 |
| 2026 void ExtensionService::OnExtensionInstalled( | 2026 void ExtensionService::OnExtensionInstalled( |
| 2027 const Extension* extension, bool from_webstore, int page_index) { | 2027 const Extension* extension, |
| 2028 bool from_webstore, |
| 2029 StringOrdinal page_ordinal) { |
| 2028 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 2030 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 2029 | 2031 |
| 2030 // Ensure extension is deleted unless we transfer ownership. | 2032 // Ensure extension is deleted unless we transfer ownership. |
| 2031 scoped_refptr<const Extension> scoped_extension(extension); | 2033 scoped_refptr<const Extension> scoped_extension(extension); |
| 2032 const std::string& id = extension->id(); | 2034 const std::string& id = extension->id(); |
| 2033 // Extensions installed by policy can't be disabled. So even if a previous | 2035 // Extensions installed by policy can't be disabled. So even if a previous |
| 2034 // installation disabled the extension, make sure it is now enabled. | 2036 // installation disabled the extension, make sure it is now enabled. |
| 2035 bool initial_enable = | 2037 bool initial_enable = |
| 2036 !extension_prefs_->IsExtensionDisabled(id) || | 2038 !extension_prefs_->IsExtensionDisabled(id) || |
| 2037 !Extension::UserMayDisable(extension->location()); | 2039 !Extension::UserMayDisable(extension->location()); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2074 UMA_HISTOGRAM_ENUMERATION("Extensions.InstallType", | 2076 UMA_HISTOGRAM_ENUMERATION("Extensions.InstallType", |
| 2075 extension->GetType(), 100); | 2077 extension->GetType(), 100); |
| 2076 RecordPermissionMessagesHistogram( | 2078 RecordPermissionMessagesHistogram( |
| 2077 extension, "Extensions.Permissions_Install"); | 2079 extension, "Extensions.Permissions_Install"); |
| 2078 } | 2080 } |
| 2079 | 2081 |
| 2080 extension_prefs_->OnExtensionInstalled( | 2082 extension_prefs_->OnExtensionInstalled( |
| 2081 extension, | 2083 extension, |
| 2082 initial_enable ? Extension::ENABLED : Extension::DISABLED, | 2084 initial_enable ? Extension::ENABLED : Extension::DISABLED, |
| 2083 from_webstore, | 2085 from_webstore, |
| 2084 page_index); | 2086 page_ordinal); |
| 2085 | 2087 |
| 2086 // Unpacked extensions default to allowing file access, but if that has been | 2088 // Unpacked extensions default to allowing file access, but if that has been |
| 2087 // overridden, don't reset the value. | 2089 // overridden, don't reset the value. |
| 2088 if (Extension::ShouldAlwaysAllowFileAccess(extension->location()) && | 2090 if (Extension::ShouldAlwaysAllowFileAccess(extension->location()) && |
| 2089 !extension_prefs_->HasAllowFileAccessSetting(id)) { | 2091 !extension_prefs_->HasAllowFileAccessSetting(id)) { |
| 2090 extension_prefs_->SetAllowFileAccess(id, true); | 2092 extension_prefs_->SetAllowFileAccess(id, true); |
| 2091 } | 2093 } |
| 2092 | 2094 |
| 2093 // If the extension should automatically block network startup (e.g., it uses | 2095 // If the extension should automatically block network startup (e.g., it uses |
| 2094 // the webRequest API), set the preference. Otherwise clear it, in case the | 2096 // the webRequest API), set the preference. Otherwise clear it, in case the |
| (...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2511 | 2513 |
| 2512 ExtensionService::NaClModuleInfoList::iterator | 2514 ExtensionService::NaClModuleInfoList::iterator |
| 2513 ExtensionService::FindNaClModule(const GURL& url) { | 2515 ExtensionService::FindNaClModule(const GURL& url) { |
| 2514 for (NaClModuleInfoList::iterator iter = nacl_module_list_.begin(); | 2516 for (NaClModuleInfoList::iterator iter = nacl_module_list_.begin(); |
| 2515 iter != nacl_module_list_.end(); ++iter) { | 2517 iter != nacl_module_list_.end(); ++iter) { |
| 2516 if (iter->url == url) | 2518 if (iter->url == url) |
| 2517 return iter; | 2519 return iter; |
| 2518 } | 2520 } |
| 2519 return nacl_module_list_.end(); | 2521 return nacl_module_list_.end(); |
| 2520 } | 2522 } |
| OLD | NEW |