Chromium Code Reviews| 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..5362f0b0fab451f506042cffc299eebd2f4e5716 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, |
|
Peter Kasting
2012/09/07 23:23:02
Nit: I guess this should be EXTENSION_APPS for con
Daniel Erat
2012/09/08 16:37:36
I noticed this too. The class is ExtensionAppCont
|
| + 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, |
| + }; |
| + |
| + // Returns a string describing a particular AutocompleteProvider type. |
| + static const char* TypeToString(Type type); |
|
Peter Kasting
2012/09/07 23:23:02
Nit: Google style guide says constructors go befor
Daniel Erat
2012/09/08 16:37:36
Done.
|
| AutocompleteProvider(AutocompleteProviderListener* listener, |
| Profile* profile, |
| - const char* name); |
| + 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,8 +223,9 @@ 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(); } |
| + const char* name() const { return TypeToString(type_); } |
|
Peter Kasting
2012/09/07 23:23:02
Nit: This isn't a true cheap-accessor, so it shoul
Daniel Erat
2012/09/08 16:37:36
Done.
|
| // Returns the enum equivalent to the name of this provider. |
| metrics::OmniboxEventProto_ProviderType AsOmniboxEventProviderType() const; |
| @@ -265,8 +281,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); |