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_CLASSIFIER_H_ | 5 #ifndef CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_CLASSIFIER_H_ |
6 #define CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_CLASSIFIER_H_ | 6 #define CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_CLASSIFIER_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/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
11 #include "base/strings/string16.h" | 11 #include "base/strings/string16.h" |
12 #include "chrome/browser/autocomplete/autocomplete_input.h" | |
13 #include "components/keyed_service/core/keyed_service.h" | 12 #include "components/keyed_service/core/keyed_service.h" |
| 13 #include "components/metrics/proto/omnibox_event.pb.h" |
14 | 14 |
15 class AutocompleteController; | 15 class AutocompleteController; |
16 struct AutocompleteMatch; | 16 struct AutocompleteMatch; |
17 class GURL; | 17 class GURL; |
18 class Profile; | 18 class Profile; |
19 | 19 |
20 class AutocompleteClassifier : public KeyedService { | 20 class AutocompleteClassifier : public KeyedService { |
21 public: | 21 public: |
22 // Bitmap of AutocompleteProvider::Type values describing the default set of | 22 // Bitmap of AutocompleteProvider::Type values describing the default set of |
23 // providers queried for the omnibox. Intended to be passed to | 23 // providers queried for the omnibox. Intended to be passed to |
(...skipping 15 matching lines...) Expand all Loading... |
39 // be useful in deciding how the input should be interpreted. | 39 // be useful in deciding how the input should be interpreted. |
40 // |match| should be a non-NULL outparam that will be set to the default | 40 // |match| should be a non-NULL outparam that will be set to the default |
41 // match for this input, if any (for invalid input, there will be no default | 41 // match for this input, if any (for invalid input, there will be no default |
42 // match, and |match| will be left unchanged). |alternate_nav_url| is a | 42 // match, and |match| will be left unchanged). |alternate_nav_url| is a |
43 // possibly-NULL outparam that, if non-NULL, will be set to the navigational | 43 // possibly-NULL outparam that, if non-NULL, will be set to the navigational |
44 // URL (if any) in case of an accidental search; see comments on | 44 // URL (if any) in case of an accidental search; see comments on |
45 // AutocompleteResult::alternate_nav_url_ in autocomplete.h. | 45 // AutocompleteResult::alternate_nav_url_ in autocomplete.h. |
46 void Classify(const base::string16& text, | 46 void Classify(const base::string16& text, |
47 bool prefer_keyword, | 47 bool prefer_keyword, |
48 bool allow_exact_keyword_match, | 48 bool allow_exact_keyword_match, |
49 AutocompleteInput::PageClassification page_classification, | 49 metrics::OmniboxEventProto::PageClassification |
| 50 page_classification, |
50 AutocompleteMatch* match, | 51 AutocompleteMatch* match, |
51 GURL* alternate_nav_url); | 52 GURL* alternate_nav_url); |
52 | 53 |
53 private: | 54 private: |
54 // KeyedService: | 55 // KeyedService: |
55 virtual void Shutdown() OVERRIDE; | 56 virtual void Shutdown() OVERRIDE; |
56 | 57 |
57 scoped_ptr<AutocompleteController> controller_; | 58 scoped_ptr<AutocompleteController> controller_; |
58 | 59 |
59 // Are we currently in Classify? Used to verify Classify isn't invoked | 60 // Are we currently in Classify? Used to verify Classify isn't invoked |
60 // recursively, since this can corrupt state and cause crashes. | 61 // recursively, since this can corrupt state and cause crashes. |
61 bool inside_classify_; | 62 bool inside_classify_; |
62 | 63 |
63 DISALLOW_IMPLICIT_CONSTRUCTORS(AutocompleteClassifier); | 64 DISALLOW_IMPLICIT_CONSTRUCTORS(AutocompleteClassifier); |
64 }; | 65 }; |
65 | 66 |
66 #endif // CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_CLASSIFIER_H_ | 67 #endif // CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_CLASSIFIER_H_ |
OLD | NEW |