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_BOOKMARK_PROVIDER_H_ | 5 #ifndef CHROME_BROWSER_AUTOCOMPLETE_BOOKMARK_PROVIDER_H_ |
6 #define CHROME_BROWSER_AUTOCOMPLETE_BOOKMARK_PROVIDER_H_ | 6 #define CHROME_BROWSER_AUTOCOMPLETE_BOOKMARK_PROVIDER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "components/omnibox/autocomplete_input.h" | 10 #include "components/omnibox/autocomplete_input.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 // | 27 // |
28 // TODO(mrossetti): Propose a way to coordinate with the HQP the taking of typed | 28 // TODO(mrossetti): Propose a way to coordinate with the HQP the taking of typed |
29 // and visit counts and last visit dates, etc. into consideration while scoring. | 29 // and visit counts and last visit dates, etc. into consideration while scoring. |
30 class BookmarkProvider : public AutocompleteProvider { | 30 class BookmarkProvider : public AutocompleteProvider { |
31 public: | 31 public: |
32 explicit BookmarkProvider(Profile* profile); | 32 explicit BookmarkProvider(Profile* profile); |
33 | 33 |
34 // When |minimal_changes| is true short circuit any additional searching and | 34 // When |minimal_changes| is true short circuit any additional searching and |
35 // leave the previous matches for this provider unchanged, otherwise perform | 35 // leave the previous matches for this provider unchanged, otherwise perform |
36 // a complete search for |input| across all bookmark titles. | 36 // a complete search for |input| across all bookmark titles. |
37 virtual void Start(const AutocompleteInput& input, | 37 void Start(const AutocompleteInput& input, bool minimal_changes) override; |
38 bool minimal_changes) override; | |
39 | 38 |
40 // Sets the BookmarkModel for unit tests. | 39 // Sets the BookmarkModel for unit tests. |
41 void set_bookmark_model_for_testing(BookmarkModel* bookmark_model) { | 40 void set_bookmark_model_for_testing(BookmarkModel* bookmark_model) { |
42 bookmark_model_ = bookmark_model; | 41 bookmark_model_ = bookmark_model; |
43 } | 42 } |
44 | 43 |
45 private: | 44 private: |
46 FRIEND_TEST_ALL_PREFIXES(BookmarkProviderTest, InlineAutocompletion); | 45 FRIEND_TEST_ALL_PREFIXES(BookmarkProviderTest, InlineAutocompletion); |
47 | 46 |
48 virtual ~BookmarkProvider(); | 47 ~BookmarkProvider() override; |
49 | 48 |
50 // Performs the actual matching of |input| over the bookmarks and fills in | 49 // Performs the actual matching of |input| over the bookmarks and fills in |
51 // |matches_|. | 50 // |matches_|. |
52 void DoAutocomplete(const AutocompleteInput& input); | 51 void DoAutocomplete(const AutocompleteInput& input); |
53 | 52 |
54 // Compose an AutocompleteMatch based on |match| that has 1) the URL of | 53 // Compose an AutocompleteMatch based on |match| that has 1) the URL of |
55 // |match|'s bookmark, and 2) the bookmark's title, not the URL's page | 54 // |match|'s bookmark, and 2) the bookmark's title, not the URL's page |
56 // title, as the description. |input| is used to compute the match's | 55 // title, as the description. |input| is used to compute the match's |
57 // inline_autocompletion. |fixed_up_input_text| is used in that way as well; | 56 // inline_autocompletion. |fixed_up_input_text| is used in that way as well; |
58 // it's passed separately so this function doesn't have to compute it. | 57 // it's passed separately so this function doesn't have to compute it. |
(...skipping 14 matching lines...) Expand all Loading... |
73 Profile* profile_; | 72 Profile* profile_; |
74 BookmarkModel* bookmark_model_; | 73 BookmarkModel* bookmark_model_; |
75 | 74 |
76 // Languages used during the URL formatting. | 75 // Languages used during the URL formatting. |
77 std::string languages_; | 76 std::string languages_; |
78 | 77 |
79 DISALLOW_COPY_AND_ASSIGN(BookmarkProvider); | 78 DISALLOW_COPY_AND_ASSIGN(BookmarkProvider); |
80 }; | 79 }; |
81 | 80 |
82 #endif // CHROME_BROWSER_AUTOCOMPLETE_BOOKMARK_PROVIDER_H_ | 81 #endif // CHROME_BROWSER_AUTOCOMPLETE_BOOKMARK_PROVIDER_H_ |
OLD | NEW |