| 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 COMPONENTS_OMNIBOX_BROWSER_AUTOCOMPLETE_CLASSIFIER_H_ | 5 #ifndef COMPONENTS_OMNIBOX_BROWSER_AUTOCOMPLETE_CLASSIFIER_H_ |
| 6 #define COMPONENTS_OMNIBOX_BROWSER_AUTOCOMPLETE_CLASSIFIER_H_ | 6 #define COMPONENTS_OMNIBOX_BROWSER_AUTOCOMPLETE_CLASSIFIER_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "base/strings/string16.h" | 12 #include "base/strings/string16.h" |
| 13 #include "components/keyed_service/core/keyed_service.h" | 13 #include "components/keyed_service/core/keyed_service.h" |
| 14 #include "components/metrics/proto/omnibox_event.pb.h" | 14 #include "components/metrics/proto/omnibox_event.pb.h" |
| 15 #include "components/omnibox/browser/autocomplete_scheme_classifier.h" | 15 #include "components/omnibox/browser/autocomplete_scheme_classifier.h" |
| 16 | 16 |
| 17 class AutocompleteController; | 17 class AutocompleteController; |
| 18 struct AutocompleteMatch; | 18 struct AutocompleteMatch; |
| 19 class GURL; | 19 class GURL; |
| 20 | 20 |
| 21 class AutocompleteClassifier : public KeyedService { | 21 class AutocompleteClassifier : public KeyedService { |
| 22 public: | 22 public: |
| 23 // Bitmap of AutocompleteProvider::Type values describing the default set of | |
| 24 // providers queried for the omnibox. Intended to be passed to | |
| 25 // AutocompleteController(). | |
| 26 static const int kDefaultOmniboxProviders; | |
| 27 | |
| 28 AutocompleteClassifier( | 23 AutocompleteClassifier( |
| 29 std::unique_ptr<AutocompleteController> controller_, | 24 std::unique_ptr<AutocompleteController> controller_, |
| 30 std::unique_ptr<AutocompleteSchemeClassifier> scheme_classifier); | 25 std::unique_ptr<AutocompleteSchemeClassifier> scheme_classifier); |
| 31 ~AutocompleteClassifier() override; | 26 ~AutocompleteClassifier() override; |
| 32 | 27 |
| 33 // KeyedService: | 28 // KeyedService: |
| 34 void Shutdown() override; | 29 void Shutdown() override; |
| 35 | 30 |
| 31 // Bitmap of AutocompleteProvider::Type values describing the default set of |
| 32 // providers queried for the omnibox. Intended to be passed to |
| 33 // AutocompleteController(). |
| 34 static int DefaultOmniboxProviders(); |
| 35 |
| 36 // Given some string |text| that the user wants to use for navigation, | 36 // Given some string |text| that the user wants to use for navigation, |
| 37 // determines how it should be interpreted. | 37 // determines how it should be interpreted. |
| 38 // |prefer_keyword| should be true the when keyword UI is onscreen; see | 38 // |prefer_keyword| should be true the when keyword UI is onscreen; see |
| 39 // comments on AutocompleteController::Start(). | 39 // comments on AutocompleteController::Start(). |
| 40 // |allow_exact_keyword_match| should be true when treating the string as a | 40 // |allow_exact_keyword_match| should be true when treating the string as a |
| 41 // potential keyword search is valid; see | 41 // potential keyword search is valid; see |
| 42 // AutocompleteInput::allow_exact_keyword_match(). | 42 // AutocompleteInput::allow_exact_keyword_match(). |
| 43 // |page_classification| gives information about the context (e.g., is the | 43 // |page_classification| gives information about the context (e.g., is the |
| 44 // user on a search results page doing search term replacement); this may | 44 // user on a search results page doing search term replacement); this may |
| 45 // be useful in deciding how the input should be interpreted. | 45 // be useful in deciding how the input should be interpreted. |
| (...skipping 16 matching lines...) Expand all Loading... |
| 62 std::unique_ptr<AutocompleteSchemeClassifier> scheme_classifier_; | 62 std::unique_ptr<AutocompleteSchemeClassifier> scheme_classifier_; |
| 63 | 63 |
| 64 // Are we currently in Classify? Used to verify Classify isn't invoked | 64 // Are we currently in Classify? Used to verify Classify isn't invoked |
| 65 // recursively, since this can corrupt state and cause crashes. | 65 // recursively, since this can corrupt state and cause crashes. |
| 66 bool inside_classify_; | 66 bool inside_classify_; |
| 67 | 67 |
| 68 DISALLOW_IMPLICIT_CONSTRUCTORS(AutocompleteClassifier); | 68 DISALLOW_IMPLICIT_CONSTRUCTORS(AutocompleteClassifier); |
| 69 }; | 69 }; |
| 70 | 70 |
| 71 #endif // COMPONENTS_OMNIBOX_BROWSER_AUTOCOMPLETE_CLASSIFIER_H_ | 71 #endif // COMPONENTS_OMNIBOX_BROWSER_AUTOCOMPLETE_CLASSIFIER_H_ |
| OLD | NEW |