Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(108)

Side by Side Diff: chrome/browser/extensions/extensions_service.cc

Issue 1120006: detect preferences errors (Closed)
Patch Set: changes from review Created 10 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/extensions_service.h" 5 #include "chrome/browser/extensions/extensions_service.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/histogram.h" 10 #include "base/histogram.h"
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after
414 backend_.get(), 414 backend_.get(),
415 &ExtensionsServiceBackend::LoadSingleExtension, 415 &ExtensionsServiceBackend::LoadSingleExtension,
416 extension_path, scoped_refptr<ExtensionsService>(this))); 416 extension_path, scoped_refptr<ExtensionsService>(this)));
417 } 417 }
418 418
419 void ExtensionsService::LoadComponentExtensions() { 419 void ExtensionsService::LoadComponentExtensions() {
420 for (RegisteredComponentExtensions::iterator it = 420 for (RegisteredComponentExtensions::iterator it =
421 component_extension_manifests_.begin(); 421 component_extension_manifests_.begin();
422 it != component_extension_manifests_.end(); ++it) { 422 it != component_extension_manifests_.end(); ++it) {
423 JSONStringValueSerializer serializer(it->manifest); 423 JSONStringValueSerializer serializer(it->manifest);
424 scoped_ptr<Value> manifest(serializer.Deserialize(NULL)); 424 scoped_ptr<Value> manifest(serializer.Deserialize(NULL, NULL));
425 if (!manifest.get()) { 425 if (!manifest.get()) {
426 NOTREACHED() << "Failed to retrieve manifest for extension"; 426 NOTREACHED() << "Failed to retrieve manifest for extension";
427 continue; 427 continue;
428 } 428 }
429 429
430 scoped_ptr<Extension> extension(new Extension(it->root_directory)); 430 scoped_ptr<Extension> extension(new Extension(it->root_directory));
431 extension->set_location(Extension::COMPONENT); 431 extension->set_location(Extension::COMPONENT);
432 432
433 std::string error; 433 std::string error;
434 if (!extension->InitFromValue( 434 if (!extension->InitFromValue(
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
750 // EXTENSION_UNLOADED since that implies that the extension has been disabled 750 // EXTENSION_UNLOADED since that implies that the extension has been disabled
751 // or uninstalled, and UnloadAll is just part of shutdown. 751 // or uninstalled, and UnloadAll is just part of shutdown.
752 } 752 }
753 753
754 void ExtensionsService::ReloadExtensions() { 754 void ExtensionsService::ReloadExtensions() {
755 UnloadAllExtensions(); 755 UnloadAllExtensions();
756 LoadAllExtensions(); 756 LoadAllExtensions();
757 } 757 }
758 758
759 void ExtensionsService::GarbageCollectExtensions() { 759 void ExtensionsService::GarbageCollectExtensions() {
760 if (extension_prefs_->pref_service()->read_only())
761 return;
762
760 InstalledExtensionSet installed(extension_prefs_.get()); 763 InstalledExtensionSet installed(extension_prefs_.get());
761 ChromeThread::PostTask( 764 ChromeThread::PostTask(
762 ChromeThread::FILE, FROM_HERE, 765 ChromeThread::FILE, FROM_HERE,
763 NewRunnableFunction( 766 NewRunnableFunction(
764 &extension_file_util::GarbageCollectExtensions, install_directory_, 767 &extension_file_util::GarbageCollectExtensions, install_directory_,
765 installed.extensions(), installed.versions())); 768 installed.extensions(), installed.versions()));
766 } 769 }
767 770
768 void ExtensionsService::OnLoadedInstalledExtensions() { 771 void ExtensionsService::OnLoadedInstalledExtensions() {
769 ready_ = true; 772 ready_ = true;
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after
1245 // Finish installing on UI thread. 1248 // Finish installing on UI thread.
1246 ChromeThread::PostTask( 1249 ChromeThread::PostTask(
1247 ChromeThread::UI, FROM_HERE, 1250 ChromeThread::UI, FROM_HERE,
1248 NewRunnableMethod( 1251 NewRunnableMethod(
1249 frontend_, 1252 frontend_,
1250 &ExtensionsService::ContinueLoadAllExtensions, 1253 &ExtensionsService::ContinueLoadAllExtensions,
1251 extensions_to_reload, 1254 extensions_to_reload,
1252 start_time, 1255 start_time,
1253 true)); 1256 true));
1254 } 1257 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_ui_unittest.cc ('k') | chrome/browser/extensions/extensions_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698