Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / components / search / search.h
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 COMPONENTS_SEARCH_SEARCH_H_
6 #define COMPONENTS_SEARCH_SEARCH_H_
7
8 #include <string>
9 #include <utility>
10 #include <vector>
11
12 #include "base/basictypes.h"
13 #include "base/strings/string16.h"
14 #include "base/strings/string_split.h"
15
16 namespace chrome {
17
18 // Returns whether the Instant Extended API is enabled.
19 bool IsInstantExtendedAPIEnabled();
20
21 // Returns the value to pass to the &espv CGI parameter when loading the
22 // embedded search page from the user's default search provider. Returns 0 if
23 // the Instant Extended API is not enabled.
24 uint64 EmbeddedSearchPageVersion();
25
26 // Type for a collection of experiment configuration parameters.
27 typedef base::StringPairs FieldTrialFlags;
28
29 // Finds the active field trial group name and parses out the configuration
30 // flags. On success, |flags| will be filled with the field trial flags. |flags|
31 // must not be NULL. Returns true iff the active field trial is successfully
32 // parsed and not disabled.
33 // Note that |flags| may be successfully populated in some cases when false is
34 // returned - in these cases it should not be used.
35 // Exposed for testing only.
36 bool GetFieldTrialInfo(FieldTrialFlags* flags);
37
38 // Given a FieldTrialFlags object, returns the string value of the provided
39 // flag.
40 // Exposed for testing only.
41 std::string GetStringValueForFlagWithDefault(const std::string& flag,
42                                              const std::string& default_value,
43                                              const FieldTrialFlags& flags);
44
45 // Given a FieldTrialFlags object, returns the uint64 value of the provided
46 // flag.
47 // Exposed for testing only.
48 uint64 GetUInt64ValueForFlagWithDefault(const std::string& flag,
49                                         uint64 default_value,
50                                         const FieldTrialFlags& flags);
51
52 // Given a FieldTrialFlags object, returns the bool value of the provided flag.
53 // Exposed for testing only.
54 bool GetBoolValueForFlagWithDefault(const std::string& flag,
55                                     bool default_value,
56                                     const FieldTrialFlags& flags);
57
58 // Returns true if 'hide_verbatim' flag is enabled in field trials
59 // to hide the top match in the native suggestions dropdown if it is a verbatim
60 // match.  See comments on ShouldHideTopMatch in autocomplete_result.h.
61 bool ShouldHideTopVerbatimMatch();
62
63 }  // namespace chrome
64
65 #endif  // COMPONENTS_SEARCH_SEARCH_H_