OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 2122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2133 const Extension* extension = *iter; | 2133 const Extension* extension = *iter; |
2134 if (!extension->is_theme() && extension->location() != Extension::COMPONENT) | 2134 if (!extension->is_theme() && extension->location() != Extension::COMPONENT) |
2135 extension_ids.insert(extension->id()); | 2135 extension_ids.insert(extension->id()); |
2136 } | 2136 } |
2137 | 2137 |
2138 child_process_logging::SetActiveExtensions(extension_ids); | 2138 child_process_logging::SetActiveExtensions(extension_ids); |
2139 } | 2139 } |
2140 | 2140 |
2141 void ExtensionService::OnExtensionInstalled( | 2141 void ExtensionService::OnExtensionInstalled( |
2142 const Extension* extension, | 2142 const Extension* extension, |
2143 bool from_webstore, | |
2144 const syncer::StringOrdinal& page_ordinal, | 2143 const syncer::StringOrdinal& page_ordinal, |
2145 bool has_requirement_errors) { | 2144 bool has_requirement_errors) { |
2146 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 2145 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
2147 | 2146 |
2148 // Ensure extension is deleted unless we transfer ownership. | 2147 // Ensure extension is deleted unless we transfer ownership. |
2149 scoped_refptr<const Extension> scoped_extension(extension); | 2148 scoped_refptr<const Extension> scoped_extension(extension); |
2150 const std::string& id = extension->id(); | 2149 const std::string& id = extension->id(); |
2151 // Extensions installed by policy can't be disabled. So even if a previous | 2150 // Extensions installed by policy can't be disabled. So even if a previous |
2152 // installation disabled the extension, make sure it is now enabled. | 2151 // installation disabled the extension, make sure it is now enabled. |
2153 bool initial_enable = | 2152 bool initial_enable = |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2213 } | 2212 } |
2214 | 2213 |
2215 // Certain extension locations are specific enough that we can | 2214 // Certain extension locations are specific enough that we can |
2216 // auto-acknowledge any extension that came from one of them. | 2215 // auto-acknowledge any extension that came from one of them. |
2217 if (extension->location() == Extension::EXTERNAL_POLICY_DOWNLOAD) | 2216 if (extension->location() == Extension::EXTERNAL_POLICY_DOWNLOAD) |
2218 AcknowledgeExternalExtension(extension->id()); | 2217 AcknowledgeExternalExtension(extension->id()); |
2219 | 2218 |
2220 extension_prefs_->OnExtensionInstalled( | 2219 extension_prefs_->OnExtensionInstalled( |
2221 extension, | 2220 extension, |
2222 initial_enable ? Extension::ENABLED : Extension::DISABLED, | 2221 initial_enable ? Extension::ENABLED : Extension::DISABLED, |
2223 from_webstore, | |
2224 page_ordinal); | 2222 page_ordinal); |
2225 | 2223 |
2226 // Unpacked extensions default to allowing file access, but if that has been | 2224 // Unpacked extensions default to allowing file access, but if that has been |
2227 // overridden, don't reset the value. | 2225 // overridden, don't reset the value. |
2228 if (Extension::ShouldAlwaysAllowFileAccess(extension->location()) && | 2226 if (Extension::ShouldAlwaysAllowFileAccess(extension->location()) && |
2229 !extension_prefs_->HasAllowFileAccessSetting(id)) { | 2227 !extension_prefs_->HasAllowFileAccessSetting(id)) { |
2230 extension_prefs_->SetAllowFileAccess(id, true); | 2228 extension_prefs_->SetAllowFileAccess(id, true); |
2231 } | 2229 } |
2232 | 2230 |
2233 content::NotificationService::current()->Notify( | 2231 content::NotificationService::current()->Notify( |
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2672 extension_host->extension(), | 2670 extension_host->extension(), |
2673 NULL, FilePath()); | 2671 NULL, FilePath()); |
2674 #endif | 2672 #endif |
2675 } | 2673 } |
2676 | 2674 |
2677 void ExtensionService::InspectExtensionHost( | 2675 void ExtensionService::InspectExtensionHost( |
2678 extensions::ExtensionHost* host) { | 2676 extensions::ExtensionHost* host) { |
2679 if (host) | 2677 if (host) |
2680 DevToolsWindow::OpenDevToolsWindow(host->render_view_host()); | 2678 DevToolsWindow::OpenDevToolsWindow(host->render_view_host()); |
2681 } | 2679 } |
OLD | NEW |