Chromium Code Reviews| 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 558 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 569 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 569 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 570 | 570 |
| 571 DCHECK(!ready_); // Can't redo init. | 571 DCHECK(!ready_); // Can't redo init. |
| 572 DCHECK_EQ(extensions_.size(), 0u); | 572 DCHECK_EQ(extensions_.size(), 0u); |
| 573 | 573 |
| 574 component_loader_->LoadAll(); | 574 component_loader_->LoadAll(); |
| 575 extensions::InstalledLoader(this).LoadAllExtensions(); | 575 extensions::InstalledLoader(this).LoadAllExtensions(); |
| 576 | 576 |
| 577 // The Sideload Wipeout effort takes place during load (see above), so once | 577 // The Sideload Wipeout effort takes place during load (see above), so once |
| 578 // that is done the flag can be set so that we don't have to check again. | 578 // that is done the flag can be set so that we don't have to check again. |
| 579 #if defined(OS_WIN) | |
|
Aaron Boodman
2012/10/23 15:20:20
See other comment about OS_WIN ifdef.
| |
| 579 if (FeatureSwitch::sideload_wipeout()->IsEnabled()) | 580 if (FeatureSwitch::sideload_wipeout()->IsEnabled()) |
| 580 extension_prefs_->SetSideloadWipeoutDone(); | 581 extension_prefs_->SetSideloadWipeoutDone(); |
| 582 #endif | |
| 581 | 583 |
| 582 // If we are running in the import process, don't bother initializing the | 584 // If we are running in the import process, don't bother initializing the |
| 583 // extension service since this can interfere with the main browser process | 585 // extension service since this can interfere with the main browser process |
| 584 // that is already running an extension service for this profile. | 586 // that is already running an extension service for this profile. |
| 585 // TODO(aa): can we start up even less of ExtensionService? | 587 // TODO(aa): can we start up even less of ExtensionService? |
| 586 // http://crbug.com/107636 | 588 // http://crbug.com/107636 |
| 587 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kImport) && | 589 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kImport) && |
| 588 !CommandLine::ForCurrentProcess()->HasSwitch(switches::kImportFromFile)) { | 590 !CommandLine::ForCurrentProcess()->HasSwitch(switches::kImportFromFile)) { |
| 589 if (g_browser_process->profile_manager() && | 591 if (g_browser_process->profile_manager() && |
| 590 g_browser_process->profile_manager()->will_import()) { | 592 g_browser_process->profile_manager()->will_import()) { |
| (...skipping 1586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2177 extension_prefs_->SetExtensionState(extension->id(), Extension::DISABLED); | 2179 extension_prefs_->SetExtensionState(extension->id(), Extension::DISABLED); |
| 2178 extension_prefs_->SetDidExtensionEscalatePermissions(extension, true); | 2180 extension_prefs_->SetDidExtensionEscalatePermissions(extension, true); |
| 2179 extension_prefs_->AddDisableReason( | 2181 extension_prefs_->AddDisableReason( |
| 2180 extension->id(), | 2182 extension->id(), |
| 2181 static_cast<Extension::DisableReason>(disable_reasons)); | 2183 static_cast<Extension::DisableReason>(disable_reasons)); |
| 2182 } | 2184 } |
| 2183 } | 2185 } |
| 2184 | 2186 |
| 2185 void ExtensionService::MaybeWipeout( | 2187 void ExtensionService::MaybeWipeout( |
| 2186 const extensions::Extension* extension) { | 2188 const extensions::Extension* extension) { |
| 2189 #if !defined(OS_WIN) | |
|
Aaron Boodman
2012/10/23 15:20:20
Better to chokepoint this in the feature switch it
| |
| 2190 // We are targeting registry-installed extensions, which are Windows-specific, | |
| 2191 // and extensions marked internal and not from the web store, which are mostly | |
| 2192 // problematic on Windows. | |
| 2193 return; | |
| 2194 #endif | |
| 2195 | |
| 2187 if (!FeatureSwitch::sideload_wipeout()->IsEnabled()) | 2196 if (!FeatureSwitch::sideload_wipeout()->IsEnabled()) |
| 2188 return; | 2197 return; |
| 2189 | 2198 |
| 2190 bool done = extension_prefs_->GetSideloadWipeoutDone(); | 2199 bool done = extension_prefs_->GetSideloadWipeoutDone(); |
| 2191 if (done) | 2200 if (done) |
| 2192 return; | 2201 return; |
| 2193 | 2202 |
| 2194 int disable_reasons = extension_prefs_->GetDisableReasons(extension->id()); | 2203 int disable_reasons = extension_prefs_->GetDisableReasons(extension->id()); |
| 2195 if (disable_reasons == Extension::DISABLE_NONE) { | 2204 if (disable_reasons == Extension::DISABLE_NONE) { |
| 2196 Extension::Location location = extension->location(); | 2205 Extension::Location location = extension->location(); |
| (...skipping 588 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2785 // enabling them. | 2794 // enabling them. |
| 2786 if (Extension::IsExternalLocation(extension->location()) && | 2795 if (Extension::IsExternalLocation(extension->location()) && |
| 2787 !extension_prefs_->IsExternalExtensionAcknowledged(extension->id())) { | 2796 !extension_prefs_->IsExternalExtensionAcknowledged(extension->id())) { |
| 2788 return false; | 2797 return false; |
| 2789 } | 2798 } |
| 2790 } | 2799 } |
| 2791 #endif | 2800 #endif |
| 2792 | 2801 |
| 2793 return true; | 2802 return true; |
| 2794 } | 2803 } |
| OLD | NEW |