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

Unified Diff: chrome/browser/search_engines/template_url_model.h

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/search_engines/template_url.cc ('k') | chrome/browser/search_engines/template_url_model.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/search_engines/template_url_model.h
diff --git a/chrome/browser/search_engines/template_url_model.h b/chrome/browser/search_engines/template_url_model.h
index 5b7623402a75c4b2207edca77f8f6864c4926e1e..8bab7cb61c7e368b4c0563b5f05aa0767eb045f3 100644
--- a/chrome/browser/search_engines/template_url_model.h
+++ b/chrome/browser/search_engines/template_url_model.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -13,6 +13,7 @@
#include "chrome/common/notification_registrar.h"
#include "testing/gtest/include/gtest/gtest_prod.h"
+class Extension;
class PrefService;
class Profile;
@@ -136,6 +137,20 @@ class TemplateURLModel : public WebDataServiceConsumer,
// date passed in.
void RemoveAutoGeneratedSince(base::Time created_after);
+ // If the given extension has an omnibox keyword, adds a TemplateURL for that
+ // keyword. Only 1 keyword is allowed for a given extension. If the keyword
+ // already exists for this extension, does nothing.
+ void RegisterExtensionKeyword(Extension* extension);
+
+ // Removes the TemplateURL containing the keyword for the given extension,
+ // if any.
+ void UnregisterExtensionKeyword(Extension* extension);
+
+ // Returns the TemplateURL associated with the keyword for this extension.
+ // This works by checking the extension ID, not the keyword, so it will work
+ // even if the user changed the keyword.
+ const TemplateURL* GetTemplateURLForExtension(Extension* extension) const;
+
// Returns the set of URLs describing the keywords. The elements are owned
// by TemplateURLModel and should not be deleted.
std::vector<const TemplateURL*> GetTemplateURLs() const;
@@ -186,6 +201,12 @@ class TemplateURLModel : public WebDataServiceConsumer,
// number changes.
void RemoveDuplicatePrepopulateIDs(std::vector<const TemplateURL*>* urls);
+ // Returns the locale-direction-adjusted short name for the given keyword.
+ // Also sets the out param to indicate whether the keyword belongs to an
+ // extension.
+ std::wstring GetKeywordShortName(const std::wstring& keyword,
+ bool* is_extension_keyword);
+
// NotificationObserver method. TemplateURLModel listens for three
// notification types:
// . NOTIFY_HISTORY_URL_VISITED: adds keyword search terms if the visit
@@ -351,6 +372,9 @@ class TemplateURLModel : public WebDataServiceConsumer,
// increasing integer that is initialized from the database.
TemplateURL::IDType next_id_;
+ // List of extension IDs waiting for Load to have keywords registered.
+ std::vector<std::string> pending_extension_ids_;
+
DISALLOW_EVIL_CONSTRUCTORS(TemplateURLModel);
};
« no previous file with comments | « chrome/browser/search_engines/template_url.cc ('k') | chrome/browser/search_engines/template_url_model.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698