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

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

Issue 2078021: First pass at experimental omnibox API. There are plenty of rough edges and (Closed)
Patch Set: no prefer_keyword Created 10 years, 7 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
« no previous file with comments | « chrome/browser/extensions/extensions_service.h ('k') | chrome/browser/gtk/location_bar_view_gtk.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/extensions_service.cc
diff --git a/chrome/browser/extensions/extensions_service.cc b/chrome/browser/extensions/extensions_service.cc
index 849243f6087d60ffbdbe0adfd15a04f7c3a681dc..ed6e6d325089e99b4fcc2b48b1ff643bbeb2ab92 100644
--- a/chrome/browser/extensions/extensions_service.cc
+++ b/chrome/browser/extensions/extensions_service.cc
@@ -29,9 +29,10 @@
#include "chrome/browser/extensions/extension_updater.h"
#include "chrome/browser/extensions/external_extension_provider.h"
#include "chrome/browser/extensions/external_pref_extension_provider.h"
+#include "chrome/browser/net/chrome_url_request_context.h"
#include "chrome/browser/pref_service.h"
#include "chrome/browser/profile.h"
-#include "chrome/browser/net/chrome_url_request_context.h"
+#include "chrome/browser/search_engines/template_url_model.h"
#include "chrome/common/child_process_logging.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/extensions/extension.h"
@@ -324,6 +325,9 @@ void ExtensionsService::UninstallExtension(const std::string& extension_id,
// obtained via Extension::id().
std::string extension_id_copy(extension_id);
+ if (profile_->GetTemplateURLModel())
+ profile_->GetTemplateURLModel()->UnregisterExtensionKeyword(extension);
+
// Unload before doing more cleanup to ensure that nothing is hanging on to
// any of these resources.
UnloadExtension(extension_id);
@@ -763,7 +767,7 @@ void ExtensionsService::OnLoadedInstalledExtensions() {
NotificationService::NoDetails());
}
-void ExtensionsService::OnExtensionLoaded(Extension* extension,
+bool ExtensionsService::OnExtensionLoaded(Extension* extension,
bool allow_privilege_increase) {
// Ensure extension is deleted unless we transfer ownership.
scoped_ptr<Extension> scoped_extension(extension);
@@ -831,6 +835,7 @@ void ExtensionsService::OnExtensionLoaded(Extension* extension,
extension->set_being_upgraded(false);
UpdateActiveExtensionsInCrashReporter();
+ return true;
}
void ExtensionsService::UpdateActiveExtensionsInCrashReporter() {
@@ -878,12 +883,17 @@ void ExtensionsService::OnExtensionInstalled(Extension* extension,
}
// Also load the extension.
- OnExtensionLoaded(extension, allow_privilege_increase);
+ bool success = OnExtensionLoaded(extension, allow_privilege_increase);
+ if (!success)
+ extension = NULL; // extension is deleted on failure.
// Erase any pending extension.
if (it != pending_extensions_.end()) {
pending_extensions_.erase(it);
}
+
+ if (success && profile_->GetTemplateURLModel())
+ profile_->GetTemplateURLModel()->RegisterExtensionKeyword(extension);
}
Extension* ExtensionsService::GetExtensionByIdInternal(const std::string& id,
« no previous file with comments | « chrome/browser/extensions/extensions_service.h ('k') | chrome/browser/gtk/location_bar_view_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698