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 2012 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2023 for (size_t i = 0; i < extensions_.size(); ++i) { | 2023 for (size_t i = 0; i < extensions_.size(); ++i) { |
2024 if (!extensions_[i]->is_theme() && | 2024 if (!extensions_[i]->is_theme() && |
2025 extensions_[i]->location() != Extension::COMPONENT) | 2025 extensions_[i]->location() != Extension::COMPONENT) |
2026 extension_ids.insert(extensions_[i]->id()); | 2026 extension_ids.insert(extensions_[i]->id()); |
2027 } | 2027 } |
2028 | 2028 |
2029 child_process_logging::SetActiveExtensions(extension_ids); | 2029 child_process_logging::SetActiveExtensions(extension_ids); |
2030 } | 2030 } |
2031 | 2031 |
2032 void ExtensionService::OnExtensionInstalled( | 2032 void ExtensionService::OnExtensionInstalled( |
2033 const Extension* extension, bool from_webstore, int page_index) { | 2033 const Extension* extension, |
| 2034 bool from_webstore, |
| 2035 const StringOrdinal& page_ordinal) { |
2034 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 2036 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
2035 | 2037 |
2036 // Ensure extension is deleted unless we transfer ownership. | 2038 // Ensure extension is deleted unless we transfer ownership. |
2037 scoped_refptr<const Extension> scoped_extension(extension); | 2039 scoped_refptr<const Extension> scoped_extension(extension); |
2038 const std::string& id = extension->id(); | 2040 const std::string& id = extension->id(); |
2039 // Extensions installed by policy can't be disabled. So even if a previous | 2041 // Extensions installed by policy can't be disabled. So even if a previous |
2040 // installation disabled the extension, make sure it is now enabled. | 2042 // installation disabled the extension, make sure it is now enabled. |
2041 bool initial_enable = | 2043 bool initial_enable = |
2042 !extension_prefs_->IsExtensionDisabled(id) || | 2044 !extension_prefs_->IsExtensionDisabled(id) || |
2043 !Extension::UserMayDisable(extension->location()); | 2045 !Extension::UserMayDisable(extension->location()); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2080 UMA_HISTOGRAM_ENUMERATION("Extensions.InstallType", | 2082 UMA_HISTOGRAM_ENUMERATION("Extensions.InstallType", |
2081 extension->GetType(), 100); | 2083 extension->GetType(), 100); |
2082 RecordPermissionMessagesHistogram( | 2084 RecordPermissionMessagesHistogram( |
2083 extension, "Extensions.Permissions_Install"); | 2085 extension, "Extensions.Permissions_Install"); |
2084 } | 2086 } |
2085 | 2087 |
2086 extension_prefs_->OnExtensionInstalled( | 2088 extension_prefs_->OnExtensionInstalled( |
2087 extension, | 2089 extension, |
2088 initial_enable ? Extension::ENABLED : Extension::DISABLED, | 2090 initial_enable ? Extension::ENABLED : Extension::DISABLED, |
2089 from_webstore, | 2091 from_webstore, |
2090 page_index); | 2092 page_ordinal); |
2091 | 2093 |
2092 // Unpacked extensions default to allowing file access, but if that has been | 2094 // Unpacked extensions default to allowing file access, but if that has been |
2093 // overridden, don't reset the value. | 2095 // overridden, don't reset the value. |
2094 if (Extension::ShouldAlwaysAllowFileAccess(extension->location()) && | 2096 if (Extension::ShouldAlwaysAllowFileAccess(extension->location()) && |
2095 !extension_prefs_->HasAllowFileAccessSetting(id)) { | 2097 !extension_prefs_->HasAllowFileAccessSetting(id)) { |
2096 extension_prefs_->SetAllowFileAccess(id, true); | 2098 extension_prefs_->SetAllowFileAccess(id, true); |
2097 } | 2099 } |
2098 | 2100 |
2099 // If the extension should automatically block network startup (e.g., it uses | 2101 // If the extension should automatically block network startup (e.g., it uses |
2100 // the webRequest API), set the preference. Otherwise clear it, in case the | 2102 // the webRequest API), set the preference. Otherwise clear it, in case the |
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2518 | 2520 |
2519 ExtensionService::NaClModuleInfoList::iterator | 2521 ExtensionService::NaClModuleInfoList::iterator |
2520 ExtensionService::FindNaClModule(const GURL& url) { | 2522 ExtensionService::FindNaClModule(const GURL& url) { |
2521 for (NaClModuleInfoList::iterator iter = nacl_module_list_.begin(); | 2523 for (NaClModuleInfoList::iterator iter = nacl_module_list_.begin(); |
2522 iter != nacl_module_list_.end(); ++iter) { | 2524 iter != nacl_module_list_.end(); ++iter) { |
2523 if (iter->url == url) | 2525 if (iter->url == url) |
2524 return iter; | 2526 return iter; |
2525 } | 2527 } |
2526 return nacl_module_list_.end(); | 2528 return nacl_module_list_.end(); |
2527 } | 2529 } |
OLD | NEW |