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 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 #if defined(OS_CHROMEOS) |
| 378 disable_garbage_collection_ = false; |
| 379 #endif |
377 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 380 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
378 | 381 |
379 // Figure out if extension installation should be enabled. | 382 // Figure out if extension installation should be enabled. |
380 if (command_line->HasSwitch(switches::kDisableExtensions) || | 383 if (command_line->HasSwitch(switches::kDisableExtensions) || |
381 profile->GetPrefs()->GetBoolean(prefs::kDisableExtensions)) { | 384 profile->GetPrefs()->GetBoolean(prefs::kDisableExtensions)) { |
382 extensions_enabled_ = false; | 385 extensions_enabled_ = false; |
383 } | 386 } |
384 | 387 |
385 registrar_.Add(this, chrome::NOTIFICATION_APP_TERMINATING, | 388 registrar_.Add(this, chrome::NOTIFICATION_APP_TERMINATING, |
386 content::NotificationService::AllBrowserContextsAndSources()); | 389 content::NotificationService::AllBrowserContextsAndSources()); |
(...skipping 1589 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1976 | 1979 |
1977 void ExtensionService::ReloadExtensions() { | 1980 void ExtensionService::ReloadExtensions() { |
1978 UnloadAllExtensions(); | 1981 UnloadAllExtensions(); |
1979 component_loader_->LoadAll(); | 1982 component_loader_->LoadAll(); |
1980 extensions::InstalledLoader(this).LoadAllExtensions(); | 1983 extensions::InstalledLoader(this).LoadAllExtensions(); |
1981 // Don't call SetReadyAndNotifyListeners() since tests call this multiple | 1984 // Don't call SetReadyAndNotifyListeners() since tests call this multiple |
1982 // times. | 1985 // times. |
1983 } | 1986 } |
1984 | 1987 |
1985 void ExtensionService::GarbageCollectExtensions() { | 1988 void ExtensionService::GarbageCollectExtensions() { |
| 1989 #if defined(OS_CHROMEOS) |
| 1990 if (disable_garbage_collection_) |
| 1991 return; |
| 1992 #endif |
| 1993 |
1986 if (extension_prefs_->pref_service()->ReadOnly()) | 1994 if (extension_prefs_->pref_service()->ReadOnly()) |
1987 return; | 1995 return; |
1988 | 1996 |
1989 if (pending_extension_manager()->HasPendingExtensions()) { | 1997 if (pending_extension_manager()->HasPendingExtensions()) { |
1990 // Don't garbage collect while there are pending installations, which may | 1998 // Don't garbage collect while there are pending installations, which may |
1991 // be using the temporary installation directory. Try to garbage collect | 1999 // be using the temporary installation directory. Try to garbage collect |
1992 // again later. | 2000 // again later. |
1993 base::MessageLoop::current()->PostDelayedTask( | 2001 base::MessageLoop::current()->PostDelayedTask( |
1994 FROM_HERE, | 2002 FROM_HERE, |
1995 base::Bind(&ExtensionService::GarbageCollectExtensions, AsWeakPtr()), | 2003 base::Bind(&ExtensionService::GarbageCollectExtensions, AsWeakPtr()), |
(...skipping 1167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3163 } | 3171 } |
3164 | 3172 |
3165 void ExtensionService::AddUpdateObserver(extensions::UpdateObserver* observer) { | 3173 void ExtensionService::AddUpdateObserver(extensions::UpdateObserver* observer) { |
3166 update_observers_.AddObserver(observer); | 3174 update_observers_.AddObserver(observer); |
3167 } | 3175 } |
3168 | 3176 |
3169 void ExtensionService::RemoveUpdateObserver( | 3177 void ExtensionService::RemoveUpdateObserver( |
3170 extensions::UpdateObserver* observer) { | 3178 extensions::UpdateObserver* observer) { |
3171 update_observers_.RemoveObserver(observer); | 3179 update_observers_.RemoveObserver(observer); |
3172 } | 3180 } |
OLD | NEW |