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

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

Issue 298863012: Use upstream libaddressinput in Chrome. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Validate required fields without rules. 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_INPUT_SUGGESTER_H_
6 #define THIRD_PARTY_LIBADDRESSINPUT_CHROMIUM_INPUT_SUGGESTER_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 // Suggests address completions for a partially entered address from the user.
24 class InputSuggester {
25 public:
26 // Does not take ownership of |supplier|, which should not be NULL.
27 explicit InputSuggester(::i18n::addressinput::PreloadSupplier* supplier);
28 ~InputSuggester();
29
30 // Fills in |suggestions| for the partially typed in |user_input|, assuming
31 // the user is typing in the |focused_field|. If the number of |suggestions|
32 // is over the |suggestion_limit|, then returns no |suggestions| at all.
33 //
34 // Sample user input:
35 // country code = "CN"
36 // dependent locality = "Zongyang"
37 // focused field = DEPENDENT_LOCALITY
38 // suggestions limit = 10
39 // Suggestion:
40 // [{dependent_locality: "Zongyang Xian",
41 // locality: "Anqing Shi",
42 // administrative_area: "Anhui Sheng"}]
43 //
44 // Builds the index for generating suggestions lazily.
45 //
46 // The |suggestions| parameter should not be NULL. The |focused_field|
47 // parameter should be either POSTAL_CODE or between ADMIN_AREA and
48 // DEPENDENT_LOCALITY inclusively.
49 void GetSuggestions(
50 const ::i18n::addressinput::AddressData& user_input,
51 ::i18n::addressinput::AddressField focused_field,
52 size_t suggestion_limit,
53 std::vector< ::i18n::addressinput::AddressData>* suggestions);
54
55 private:
56 class TrieCollection;
57
58 // A collection of tries for generating suggestions.
59 scoped_ptr<TrieCollection> trie_collection_;
60
61 DISALLOW_COPY_AND_ASSIGN(InputSuggester);
62 };
63
64 } // namespace autofill
65
66 #endif // THIRD_PARTY_LIBADDRESSINPUT_CHROMIUM_INPUT_SUGGESTER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698