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