Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(694)

Side by Side Diff: chrome/browser/autocomplete/autocomplete_result.h

Issue 363893002: Revert of Reduces dependency from AutocompleteMatch to Profile. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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_RESULT_H_ 5 #ifndef CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_RESULT_H_
6 #define CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_RESULT_H_ 6 #define CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_RESULT_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <map> 10 #include <map>
11 11
12 #include "base/basictypes.h" 12 #include "base/basictypes.h"
13 #include "chrome/browser/autocomplete/autocomplete_match.h" 13 #include "chrome/browser/autocomplete/autocomplete_match.h"
14 #include "components/metrics/proto/omnibox_event.pb.h" 14 #include "components/metrics/proto/omnibox_event.pb.h"
15 #include "url/gurl.h" 15 #include "url/gurl.h"
16 16
17 class AutocompleteInput; 17 class AutocompleteInput;
18 class AutocompleteProvider; 18 class AutocompleteProvider;
19 class TemplateURLService; 19 class Profile;
20 20
21 // All matches from all providers for a particular query. This also tracks 21 // All matches from all providers for a particular query. This also tracks
22 // what the default match should be if the user doesn't manually select another 22 // what the default match should be if the user doesn't manually select another
23 // match. 23 // match.
24 class AutocompleteResult { 24 class AutocompleteResult {
25 public: 25 public:
26 typedef ACMatches::const_iterator const_iterator; 26 typedef ACMatches::const_iterator const_iterator;
27 typedef ACMatches::iterator iterator; 27 typedef ACMatches::iterator iterator;
28 28
29 // The "Selection" struct is the information we need to select the same match 29 // The "Selection" struct is the information we need to select the same match
(...skipping 30 matching lines...) Expand all
60 // Max number of matches we'll show from the various providers. 60 // Max number of matches we'll show from the various providers.
61 static const size_t kMaxMatches; 61 static const size_t kMaxMatches;
62 62
63 AutocompleteResult(); 63 AutocompleteResult();
64 ~AutocompleteResult(); 64 ~AutocompleteResult();
65 65
66 // Copies matches from |old_matches| to provide a consistant result set. See 66 // Copies matches from |old_matches| to provide a consistant result set. See
67 // comments in code for specifics. 67 // comments in code for specifics.
68 void CopyOldMatches(const AutocompleteInput& input, 68 void CopyOldMatches(const AutocompleteInput& input,
69 const AutocompleteResult& old_matches, 69 const AutocompleteResult& old_matches,
70 TemplateURLService* template_url_service); 70 Profile* profile);
71 71
72 // Adds a new set of matches to the result set. Does not re-sort. 72 // Adds a new set of matches to the result set. Does not re-sort.
73 void AppendMatches(const ACMatches& matches); 73 void AppendMatches(const ACMatches& matches);
74 74
75 // Removes duplicates, puts the list in sorted order and culls to leave only 75 // Removes duplicates, puts the list in sorted order and culls to leave only
76 // the best kMaxMatches matches. Sets the default match to the best match 76 // the best kMaxMatches matches. Sets the default match to the best match
77 // and updates the alternate nav URL. 77 // and updates the alternate nav URL.
78 void SortAndCull(const AutocompleteInput& input, 78 void SortAndCull(const AutocompleteInput& input, Profile* profile);
79 TemplateURLService* template_url_service);
80 79
81 // Returns true if at least one match was copied from the last result. 80 // Returns true if at least one match was copied from the last result.
82 bool HasCopiedMatches() const; 81 bool HasCopiedMatches() const;
83 82
84 // Vector-style accessors/operators. 83 // Vector-style accessors/operators.
85 size_t size() const; 84 size_t size() const;
86 bool empty() const; 85 bool empty() const;
87 const_iterator begin() const; 86 const_iterator begin() const;
88 iterator begin(); 87 iterator begin();
89 const_iterator end() const; 88 const_iterator end() const;
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 // user's local intranet contains site "foo", and the user types "foo", we 195 // user's local intranet contains site "foo", and the user types "foo", we
197 // default to searching for "foo" when the user may have meant to navigate 196 // default to searching for "foo" when the user may have meant to navigate
198 // there. In cases like this, the default match will point to the "search for 197 // there. In cases like this, the default match will point to the "search for
199 // 'foo'" result, and this will contain "http://foo/". 198 // 'foo'" result, and this will contain "http://foo/".
200 GURL alternate_nav_url_; 199 GURL alternate_nav_url_;
201 200
202 DISALLOW_COPY_AND_ASSIGN(AutocompleteResult); 201 DISALLOW_COPY_AND_ASSIGN(AutocompleteResult);
203 }; 202 };
204 203
205 #endif // CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_RESULT_H_ 204 #endif // CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_RESULT_H_
OLDNEW
« no previous file with comments | « chrome/browser/autocomplete/autocomplete_provider_unittest.cc ('k') | chrome/browser/autocomplete/autocomplete_result.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698