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

Unified Diff: chrome/browser/autocomplete/autocomplete_provider.h

Issue 10909130: autocomplete: Add AutocompleteProvider::Type enum. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix inadvertently-change parameter in test Created 8 years, 3 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/autocomplete/autocomplete_provider.h
diff --git a/chrome/browser/autocomplete/autocomplete_provider.h b/chrome/browser/autocomplete/autocomplete_provider.h
index 5b2066ddb61b7c2d683f7cfb7ee2c336619118c9..377a5d383b8362b4c07e8e39a8824b3932ea0375 100644
--- a/chrome/browser/autocomplete/autocomplete_provider.h
+++ b/chrome/browser/autocomplete/autocomplete_provider.h
@@ -173,10 +173,25 @@ typedef std::vector<metrics::OmniboxEventProto_ProviderInfo> ProvidersInfo;
class AutocompleteProvider
: public base::RefCountedThreadSafe<AutocompleteProvider> {
public:
+ // Different AutocompleteProvider implementations.
+ enum Type {
+ TYPE_BUILTIN = 1 << 0,
+ TYPE_EXTENSION_APP = 1 << 1,
+ TYPE_HISTORY_CONTENTS = 1 << 2,
+ TYPE_HISTORY_QUICK = 1 << 3,
+ TYPE_HISTORY_URL = 1 << 4,
+ TYPE_KEYWORD = 1 << 5,
+ TYPE_SEARCH = 1 << 6,
+ TYPE_SHORTCUTS = 1 << 7,
+ TYPE_ZERO_SUGGEST = 1 << 8,
+ };
AutocompleteProvider(AutocompleteProviderListener* listener,
Profile* profile,
- const char* name);
+ Type type);
+
+ // Returns a string describing a particular AutocompleteProvider type.
+ static const char* TypeToString(Type type);
// Called to start an autocomplete query. The provider is responsible for
// tracking its matches for this query and whether it is done processing the
@@ -208,10 +223,15 @@ class AutocompleteProvider
// Returns whether the provider is done processing the query.
bool done() const { return done_; }
- // Returns the name of this provider.
- const std::string& name() const { return name_; }
+ // Returns this provider's type.
+ Type type() const { return type_; }
+
+ // Returns a string describing this provider's type.
+ const char* GetName() const;
// Returns the enum equivalent to the name of this provider.
+ // TODO(derat): Make metrics use AutocompleteProvider::Type directly, or at
+ // least move this method to the metrics directory.
metrics::OmniboxEventProto_ProviderType AsOmniboxEventProviderType() const;
// Called to delete a match and the backing data that produced it. This
@@ -265,8 +285,7 @@ class AutocompleteProvider
ACMatches matches_;
bool done_;
- // The name of this provider. Used for logging.
- std::string name_;
+ Type type_;
private:
DISALLOW_COPY_AND_ASSIGN(AutocompleteProvider);

Powered by Google App Engine
This is Rietveld 408576698