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

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: rebase + manifestdata 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
« no previous file with comments | « no previous file | chrome/browser/extensions/api/omnibox/omnibox_api.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..db0ba837c72e8f127b62088f4291b6014c0ace1d 100644
--- a/chrome/browser/extensions/api/omnibox/omnibox_api.h
+++ b/chrome/browser/extensions/api/omnibox/omnibox_api.h
@@ -5,6 +5,7 @@
#ifndef CHROME_BROWSER_EXTENSIONS_API_OMNIBOX_OMNIBOX_API_H_
#define CHROME_BROWSER_EXTENSIONS_API_OMNIBOX_OMNIBOX_API_H_
+#include <set>
#include <string>
#include <vector>
@@ -12,8 +13,14 @@
#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 Profile;
class TemplateURL;
+class TemplateURLService;
namespace base {
class ListValue;
@@ -23,6 +30,10 @@ namespace content {
class WebContents;
}
+namespace gfx {
+class Image;
+}
+
namespace extensions {
// Event router class for events related to the omnibox API.
@@ -67,6 +78,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);
+
+ private:
+ typedef std::set<const Extension*> PendingExtensions;
+
+ TemplateURLService* url_service_;
+
+ // List of extensions waiting for the TemplateURLService to Load to
+ // have keywords registered.
+ PendingExtensions pending_extensions_;
+
+ 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");
« no previous file with comments | « no previous file | chrome/browser/extensions/api/omnibox/omnibox_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698