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

Side by Side Diff: third_party/libaddressinput/chromium/suggestions.h

Issue 298863012: Use upstream libaddressinput in Chrome. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Work in progress for suggestions impl. Created 6 years, 6 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
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef THIRD_PARTY_LIBADDRESSINPUT_CHROMIUM_SUGGESTIONS_H_
6 #define THIRD_PARTY_LIBADDRESSINPUT_CHROMIUM_SUGGESTIONS_H_
7
8 #include <vector>
9
10 #include "base/basictypes.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "third_party/libaddressinput/src/cpp/include/libaddressinput/address_fi eld.h"
13
14 namespace i18n {
15 namespace addressinput {
16 class PreloadSupplier;
17 struct AddressData;
18 }
19 }
20
21 namespace autofill {
22
23 class Suggestions {
Evan Stade 2014/06/12 00:18:09 class level comment better class name needed. Mos
please use gerrit instead 2014/06/13 19:22:09 Done.
24 public:
25 // Does not take ownership of |supplier|, which should not be NULL.
26 explicit Suggestions(::i18n::addressinput::PreloadSupplier* supplier);
27 ~Suggestions();
28
29 // Fills in |suggestions| for the partially typed in |user_input|, assuming
30 // the user is typing in the |focused_field|. If the number of |suggestions|
31 // is over the |suggestion_limit|, then returns no |suggestions| at all.
32 //
33 // Sample user input 1:
34 // country code = "US"
35 // postal code = "90066"
36 // focused field = POSTAL_CODE
37 // suggestions limit = 1
38 // Suggestion:
39 // [{administrative_area: "CA"}]
40 //
41 // Sample user input 2:
42 // country code = "CN"
43 // dependent locality = "Zongyang"
44 // focused field = DEPENDENT_LOCALITY
45 // suggestions limit = 10
46 // Suggestion:
47 // [{dependent_locality: "Zongyang Xian",
48 // locality: "Anqing Shi",
49 // administrative_area: "Anhui Sheng"}]
50 //
51 // Builds the index for generating suggestions lazily.
52 //
53 // The |suggestions| parameter should not be NULL. The |focused_field|
54 // parameter should be either POSTAL_CODE or between ADMIN_AREA and
55 // DEPENDENT_LOCALITY inclusively.
56 void GetSuggestions(
57 const ::i18n::addressinput::AddressData& user_input,
58 ::i18n::addressinput::AddressField focused_field,
59 size_t suggestion_limit,
60 std::vector< ::i18n::addressinput::AddressData>* suggestions);
61
62 private:
63 class TrieCollection;
64
65 // A collection of tries for generating suggestions.
66 scoped_ptr<TrieCollection> trie_collection_;
67
68 DISALLOW_COPY_AND_ASSIGN(Suggestions);
69 };
70
71 } // namespace autofill
72
73 #endif // THIRD_PARTY_LIBADDRESSINPUT_CHROMIUM_SUGGESTIONS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698