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

Unified Diff: chrome/browser/extensions/api/omnibox/omnibox_api.h

Issue 11446034: SupportsUserData and manifest handlers for Extension; use them for the Omnibox API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years 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/api/omnibox/omnibox_api.h
diff --git a/chrome/browser/extensions/api/omnibox/omnibox_api.h b/chrome/browser/extensions/api/omnibox/omnibox_api.h
index ee195d435eb71ece41cb7531be2f75a0f5bfe3e7..5beb728e8193baa8c7a1c294f1cd1b792c98cc6c 100644
--- a/chrome/browser/extensions/api/omnibox/omnibox_api.h
+++ b/chrome/browser/extensions/api/omnibox/omnibox_api.h
@@ -12,6 +12,10 @@
#include "base/string16.h"
#include "chrome/browser/autocomplete/autocomplete_match.h"
#include "chrome/browser/extensions/extension_function.h"
+#include "chrome/browser/extensions/extension_icon_manager.h"
+#include "chrome/browser/profiles/profile_keyed_service.h"
+#include "content/public/browser/notification_observer.h"
+#include "content/public/browser/notification_registrar.h"
class TemplateURL;
@@ -23,6 +27,10 @@ namespace content {
class WebContents;
}
+namespace gfx {
+class Image;
+}
+
namespace extensions {
// Event router class for events related to the omnibox API.
@@ -67,6 +75,46 @@ class OmniboxSendSuggestionsFunction : public SyncExtensionFunction {
virtual bool RunImpl() OVERRIDE;
};
+class OmniboxAPI : public ProfileKeyedService,
+ public content::NotificationObserver {
+ public:
+ explicit OmniboxAPI(Profile* profile);
+ virtual ~OmniboxAPI();
+
+ // ProfileKeyedService implementation.
+ virtual void Shutdown() OVERRIDE;
+
+ // Convenience method to get the OmniboxAPI for a profile.
+ static OmniboxAPI* Get(Profile* profile);
+
+ // content::NotificationObserver implementation.
+ virtual void Observe(int type,
+ const content::NotificationSource& source,
+ const content::NotificationDetails& details) OVERRIDE;
+
+ // Returns the icon to display in the omnibox for the given extension.
+ gfx::Image GetOmniboxIcon(const std::string& extension_id);
+
+ // Returns the icon to display in the omnibox popup window for the given
+ // extension.
+ gfx::Image GetOmniboxPopupIcon(const std::string& extension_id);
+
+ // Returns the omnibox keyword for the extension.
+ static const std::string& GetKeyword(const Extension* extension);
+
+ // Returns true if the extension needs a verbose install message.
+ // TODO(yoz): This should be associated with page actions, not
+ // the omnibox.
+ static bool IsVerboseInstallMessage(const Extension* extension);
+
+ private:
+ content::NotificationRegistrar registrar_;
+
+ // Keeps track of favicon-sized omnibox icons for extensions.
+ ExtensionIconManager omnibox_icon_manager_;
+ ExtensionIconManager omnibox_popup_icon_manager_;
+};
+
class OmniboxSetDefaultSuggestionFunction : public SyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION_NAME("omnibox.setDefaultSuggestion");

Powered by Google App Engine
This is Rietveld 408576698