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