OLD | NEW |
---|---|
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 <iterator> | 8 #include <iterator> |
9 #include <set> | 9 #include <set> |
10 | 10 |
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
366 install_updates_when_idle_(true), | 366 install_updates_when_idle_(true), |
367 ready_(ready), | 367 ready_(ready), |
368 toolbar_model_(this), | 368 toolbar_model_(this), |
369 menu_manager_(profile), | 369 menu_manager_(profile), |
370 event_routers_initialized_(false), | 370 event_routers_initialized_(false), |
371 update_once_all_providers_are_ready_(false), | 371 update_once_all_providers_are_ready_(false), |
372 browser_terminating_(false), | 372 browser_terminating_(false), |
373 installs_delayed_for_gc_(false), | 373 installs_delayed_for_gc_(false), |
374 is_first_run_(false), | 374 is_first_run_(false), |
375 app_sync_bundle_(this), | 375 app_sync_bundle_(this), |
376 extension_sync_bundle_(this) { | 376 extension_sync_bundle_(this), |
377 disable_garbage_collection_(false) { | |
scherkus (not reviewing)
2013/09/04 23:24:11
FYI this isn't covered by defined(OS_CHROMEOS)
rkc
2013/09/04 23:52:55
Yep, causing the builds to fail. Fixed.
| |
377 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 378 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
378 | 379 |
379 // Figure out if extension installation should be enabled. | 380 // Figure out if extension installation should be enabled. |
380 if (command_line->HasSwitch(switches::kDisableExtensions) || | 381 if (command_line->HasSwitch(switches::kDisableExtensions) || |
381 profile->GetPrefs()->GetBoolean(prefs::kDisableExtensions)) { | 382 profile->GetPrefs()->GetBoolean(prefs::kDisableExtensions)) { |
382 extensions_enabled_ = false; | 383 extensions_enabled_ = false; |
383 } | 384 } |
384 | 385 |
385 registrar_.Add(this, chrome::NOTIFICATION_APP_TERMINATING, | 386 registrar_.Add(this, chrome::NOTIFICATION_APP_TERMINATING, |
386 content::NotificationService::AllBrowserContextsAndSources()); | 387 content::NotificationService::AllBrowserContextsAndSources()); |
(...skipping 1589 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1976 | 1977 |
1977 void ExtensionService::ReloadExtensions() { | 1978 void ExtensionService::ReloadExtensions() { |
1978 UnloadAllExtensions(); | 1979 UnloadAllExtensions(); |
1979 component_loader_->LoadAll(); | 1980 component_loader_->LoadAll(); |
1980 extensions::InstalledLoader(this).LoadAllExtensions(); | 1981 extensions::InstalledLoader(this).LoadAllExtensions(); |
1981 // Don't call SetReadyAndNotifyListeners() since tests call this multiple | 1982 // Don't call SetReadyAndNotifyListeners() since tests call this multiple |
1982 // times. | 1983 // times. |
1983 } | 1984 } |
1984 | 1985 |
1985 void ExtensionService::GarbageCollectExtensions() { | 1986 void ExtensionService::GarbageCollectExtensions() { |
1987 #if defined(OS_CHROMEOS) | |
1988 if (disable_garbage_collection_) | |
1989 return; | |
1990 #endif | |
1991 | |
1986 if (extension_prefs_->pref_service()->ReadOnly()) | 1992 if (extension_prefs_->pref_service()->ReadOnly()) |
1987 return; | 1993 return; |
1988 | 1994 |
1989 if (pending_extension_manager()->HasPendingExtensions()) { | 1995 if (pending_extension_manager()->HasPendingExtensions()) { |
1990 // Don't garbage collect while there are pending installations, which may | 1996 // Don't garbage collect while there are pending installations, which may |
1991 // be using the temporary installation directory. Try to garbage collect | 1997 // be using the temporary installation directory. Try to garbage collect |
1992 // again later. | 1998 // again later. |
1993 base::MessageLoop::current()->PostDelayedTask( | 1999 base::MessageLoop::current()->PostDelayedTask( |
1994 FROM_HERE, | 2000 FROM_HERE, |
1995 base::Bind(&ExtensionService::GarbageCollectExtensions, AsWeakPtr()), | 2001 base::Bind(&ExtensionService::GarbageCollectExtensions, AsWeakPtr()), |
(...skipping 1167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3163 } | 3169 } |
3164 | 3170 |
3165 void ExtensionService::AddUpdateObserver(extensions::UpdateObserver* observer) { | 3171 void ExtensionService::AddUpdateObserver(extensions::UpdateObserver* observer) { |
3166 update_observers_.AddObserver(observer); | 3172 update_observers_.AddObserver(observer); |
3167 } | 3173 } |
3168 | 3174 |
3169 void ExtensionService::RemoveUpdateObserver( | 3175 void ExtensionService::RemoveUpdateObserver( |
3170 extensions::UpdateObserver* observer) { | 3176 extensions::UpdateObserver* observer) { |
3171 update_observers_.RemoveObserver(observer); | 3177 update_observers_.RemoveObserver(observer); |
3172 } | 3178 } |
OLD | NEW |