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

Unified Diff: chrome/browser/extensions/extension_service.cc

Issue 9360005: Handle termination/crashes of an extension hosted in the ExtensionDialog. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/extension_service.cc
diff --git a/chrome/browser/extensions/extension_service.cc b/chrome/browser/extensions/extension_service.cc
index 84397982cc4e10874b4d7d1a24dfd29d71d0adef..2845f8be5f21976c28596a91775e0a74823f7079 100644
--- a/chrome/browser/extensions/extension_service.cc
+++ b/chrome/browser/extensions/extension_service.cc
@@ -12,6 +12,7 @@
#include "base/callback.h"
#include "base/command_line.h"
#include "base/file_util.h"
+#include "base/json/json_value_serializer.h"
#include "base/logging.h"
#include "base/metrics/field_trial.h"
#include "base/metrics/histogram.h"
@@ -688,10 +689,18 @@ bool ExtensionService::UpdateExtension(
void ExtensionService::ReloadExtension(const std::string& extension_id) {
CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
FilePath path;
- const Extension* current_extension = GetExtensionById(extension_id, false);
+ const Extension* current_extension = GetExtensionByIdInternal(extension_id,
+ true,
+ true,
+ true);
+
+ // We have no knowledge of this extension ever having even existed,
+ // we can't 'reload' it.
+ if (!current_extension)
+ return;
// Disable the extension if it's loaded. It might not be loaded if it crashed.
- if (current_extension) {
+ if (IsExtensionEnabled(extension_id)) {
// If the extension has an inspector open for its background page, detach
// the inspector and hang onto a cookie for it, so that we can reattach
// later.
@@ -716,6 +725,13 @@ void ExtensionService::ReloadExtension(const std::string& extension_id) {
path = unloaded_extension_paths_[extension_id];
}
+ // If we're reloading a component extension, use the component extension
+ // loader's reloader.
+ if (current_extension->location() == Extension::COMPONENT) {
+ component_loader_->Reload(extension_id);
+ return;
+ }
+
// Check the installed extensions to see if what we're reloading was already
// installed.
scoped_ptr<ExtensionInfo> installed_extension(

Powered by Google App Engine
This is Rietveld 408576698