Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_CONTROLLER_H_ |
| 6 #define CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_CONTROLLER_H_ | 6 #define CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_CONTROLLER_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/gtest_prod_util.h" | 10 #include "base/gtest_prod_util.h" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 43 // matches from a series of providers into one AutocompleteResult. | 43 // matches from a series of providers into one AutocompleteResult. |
| 44 class AutocompleteController : public AutocompleteProviderListener { | 44 class AutocompleteController : public AutocompleteProviderListener { |
| 45 public: | 45 public: |
| 46 // Used to indicate an index that is not selected in a call to Update(). | 46 // Used to indicate an index that is not selected in a call to Update(). |
| 47 static const int kNoItemSelected; | 47 static const int kNoItemSelected; |
| 48 | 48 |
| 49 // Normally, you will call the first constructor. Unit tests can use the | 49 // Normally, you will call the first constructor. Unit tests can use the |
| 50 // second to set the providers to some known testing providers. The default | 50 // second to set the providers to some known testing providers. The default |
| 51 // providers will be overridden and the controller will take ownership of the | 51 // providers will be overridden and the controller will take ownership of the |
| 52 // providers, Release()ing them on destruction. | 52 // providers, Release()ing them on destruction. |
| 53 // | |
| 54 // |provider_types| is a bitmap containing AutocompleteProvider::Type values | |
| 55 // that will (potentially, depending on platform, flags, etc.) be | |
| 56 // instantiated. | |
| 53 AutocompleteController(Profile* profile, | 57 AutocompleteController(Profile* profile, |
| 54 AutocompleteControllerDelegate* delegate); | 58 AutocompleteControllerDelegate* delegate, |
| 59 int provider_types); | |
| 55 #ifdef UNIT_TEST | 60 #ifdef UNIT_TEST |
| 56 AutocompleteController(const ACProviders& providers, Profile* profile) | 61 AutocompleteController(const ACProviders& providers, Profile* profile) |
| 57 : delegate_(NULL), | 62 : delegate_(NULL), |
| 58 providers_(providers), | 63 providers_(providers), |
| 59 keyword_provider_(NULL), | 64 keyword_provider_(NULL), |
| 60 search_provider_(NULL), | 65 search_provider_(NULL), |
| 61 done_(true), | 66 done_(true), |
| 62 in_start_(false), | 67 in_start_(false), |
| 63 profile_(profile) { | 68 profile_(profile) { |
| 64 } | 69 } |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 121 | 126 |
| 122 // Asks the relevant provider to delete |match|, and ensures observers are | 127 // Asks the relevant provider to delete |match|, and ensures observers are |
| 123 // notified of resulting changes immediately. This should only be called when | 128 // notified of resulting changes immediately. This should only be called when |
| 124 // no query is running. | 129 // no query is running. |
| 125 void DeleteMatch(const AutocompleteMatch& match); | 130 void DeleteMatch(const AutocompleteMatch& match); |
| 126 | 131 |
| 127 // Removes any entries that were copied from the last result. This is used by | 132 // Removes any entries that were copied from the last result. This is used by |
| 128 // the popup to ensure it's not showing an out-of-date query. | 133 // the popup to ensure it's not showing an out-of-date query. |
| 129 void ExpireCopiedEntries(); | 134 void ExpireCopiedEntries(); |
| 130 | 135 |
| 131 #ifdef UNIT_TEST | 136 #ifdef UNIT_TEST |
|
Peter Kasting
2012/09/07 23:23:02
Can we kill these?
Daniel Erat
2012/09/08 16:37:36
Done.
But in a fairly ugly manner: the UNIT_TEST
| |
| 132 void set_search_provider(SearchProvider* provider) { | 137 void set_search_provider(SearchProvider* provider) { |
| 133 search_provider_ = provider; | 138 search_provider_ = provider; |
| 134 } | 139 } |
| 135 void set_keyword_provider(KeywordProvider* provider) { | 140 void set_keyword_provider(KeywordProvider* provider) { |
| 136 keyword_provider_ = provider; | 141 keyword_provider_ = provider; |
| 137 } | 142 } |
| 138 #endif | 143 #endif |
| 139 SearchProvider* search_provider() const { return search_provider_; } | 144 SearchProvider* search_provider() const { return search_provider_; } |
| 140 KeywordProvider* keyword_provider() const { return keyword_provider_; } | 145 KeywordProvider* keyword_provider() const { return keyword_provider_; } |
| 141 | 146 |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 220 | 225 |
| 221 // Has StartZeroSuggest() been called but not Start()? | 226 // Has StartZeroSuggest() been called but not Start()? |
| 222 bool in_zero_suggest_; | 227 bool in_zero_suggest_; |
| 223 | 228 |
| 224 Profile* profile_; | 229 Profile* profile_; |
| 225 | 230 |
| 226 DISALLOW_COPY_AND_ASSIGN(AutocompleteController); | 231 DISALLOW_COPY_AND_ASSIGN(AutocompleteController); |
| 227 }; | 232 }; |
| 228 | 233 |
| 229 #endif // CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_CONTROLLER_H_ | 234 #endif // CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_CONTROLLER_H_ |
| OLD | NEW |