ServiceWorker: Make the path restriction check more stabilized (1/2)
[chromium-blink-merge.git] / components / search / search.h
blob9558ee8b95b17165be9818ae8d07f8208f0e2061
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.
5 #ifndef COMPONENTS_SEARCH_SEARCH_H_
6 #define COMPONENTS_SEARCH_SEARCH_H_
8 #include <string>
9 #include <utility>
10 #include <vector>
12 #include "base/basictypes.h"
13 #include "base/strings/string16.h"
14 #include "base/strings/string_split.h"
16 namespace chrome {
18 // Returns whether the Instant Extended API is enabled.
19 bool IsInstantExtendedAPIEnabled();
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();
26 // Type for a collection of experiment configuration parameters.
27 typedef base::StringPairs FieldTrialFlags;
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);
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);
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);
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);
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();
63 } // namespace chrome
65 #endif // COMPONENTS_SEARCH_SEARCH_H_