Chromium Code Reviews| OLD | NEW |
|---|---|
| 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_UI_SEARCH_SEARCH_H_ | 5 #ifndef CHROME_BROWSER_UI_SEARCH_SEARCH_H_ |
| 6 #define CHROME_BROWSER_UI_SEARCH_SEARCH_H_ | 6 #define CHROME_BROWSER_UI_SEARCH_SEARCH_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
| 13 | 13 |
| 14 class GURL; | 14 class GURL; |
| 15 class Profile; | 15 class Profile; |
| 16 | 16 |
| 17 namespace chrome { | 17 namespace chrome { |
| 18 namespace search { | 18 namespace search { |
| 19 | 19 |
| 20 enum InstantExtendedDefault { | |
| 21 INSTANT_FORCE_ON, // Force the setting on if no other setting exists. | |
| 22 INSTANT_USE_EXISTING, // Use same the value of the old instant.enabled pref. | |
| 23 INSTANT_FORCE_OFF, // Force the setting off if no other setting exists. | |
| 24 }; | |
| 25 | |
| 26 // Returns an enum value indicating which mode to set the new | |
| 27 // instant_extended.enabled pref to by default. | |
| 28 InstantExtendedDefault GetInstantExtendedDefaultSetting(); | |
| 29 | |
| 20 // Returns whether the Instant extended API is enabled for the given |profile|. | 30 // Returns whether the Instant extended API is enabled for the given |profile|. |
| 21 // |profile| may not be NULL. | 31 // |profile| may not be NULL. |
| 22 bool IsInstantExtendedAPIEnabled(Profile* profile); | 32 bool IsInstantExtendedAPIEnabled(Profile* profile); |
| 23 | 33 |
| 24 // Returns the value to pass to the &espv cgi parameter when loading the | 34 // Returns the value to pass to the &espv cgi parameter when loading the |
| 25 // embedded search page from the user's default search provider. Will be | 35 // embedded search page from the user's default search provider. Will be |
| 26 // 0 if the Instant Extended API is not enabled. | 36 // 0 if the Instant Extended API is not enabled. |
| 27 uint64 EmbeddedSearchPageVersion(Profile* profile); | 37 uint64 EmbeddedSearchPageVersion(Profile* profile); |
| 28 | 38 |
| 29 // Force the instant extended API to be enabled for tests. | 39 // Force the instant extended API to be enabled for tests. |
| 30 void EnableInstantExtendedAPIForTesting(); | 40 void EnableInstantExtendedAPIForTesting(); |
| 31 | 41 |
| 32 // Returns whether query extraction is enabled. If | 42 // Returns whether query extraction is enabled. If |
| 33 // |IsInstantExtendedAPIEnabled()| and the profile is not off the record, then | 43 // |IsInstantExtendedAPIEnabled()| and the profile is not off the record, then |
| 34 // this method will also return true. | 44 // this method will also return true. |
| 35 bool IsQueryExtractionEnabled(Profile* profile); | 45 bool IsQueryExtractionEnabled(Profile* profile); |
| 36 | 46 |
| 37 // Force query extraction to be enabled for tests. | 47 // Force query extraction to be enabled for tests. |
| 38 void EnableQueryExtractionForTesting(); | 48 void EnableQueryExtractionForTesting(); |
| 39 | 49 |
| 40 // Returns true if |url| has the same scheme, host, port and path as the | 50 // Returns true if |url| has the same scheme, host, port and path as the |
| 41 // Instant URL set via --instant-url. | 51 // Instant URL set via --instant-url. |
| 42 bool IsForcedInstantURL(const GURL& url); | 52 bool IsForcedInstantURL(const GURL& url); |
| 43 | 53 |
| 44 // Type for a collection of experiment configuration parameters. | 54 // Type for a collection of experiment configuration parameters. |
| 45 typedef std::vector<std::pair<std::string, std::string> > FieldTrialFlags; | 55 typedef std::vector<std::pair<std::string, std::string> > FieldTrialFlags; |
| 46 | 56 |
| 47 // Given a field trial group name, parses out the group number and configuration | 57 // Given a field trial group name, parses out the group number and configuration |
| 48 // flags. | 58 // flags. |
| 49 // Exposed for testing only. | 59 // Exposed for testing only. |
|
MAD
2013/01/31 15:44:57
Document return value?
robertshield
2013/01/31 18:56:52
Done.
| |
| 50 void GetFieldTrialInfo(const std::string& group_name, | 60 bool GetFieldTrialInfo(const std::string& group_name, |
| 51 FieldTrialFlags* flags, | 61 FieldTrialFlags* flags, |
| 52 uint64* group_number); | 62 uint64* group_number); |
| 53 | 63 |
| 54 // Given a FieldTrialFlags object, returns the string value of the provided | 64 // Given a FieldTrialFlags object, returns the string value of the provided |
| 55 // flag. | 65 // flag. |
| 56 // Exposed for testing only. | 66 // Exposed for testing only. |
| 57 std::string GetStringValueForFlagWithDefault( | 67 std::string GetStringValueForFlagWithDefault( |
| 58 const std::string& flag, | 68 const std::string& flag, |
| 59 const std::string& default_value, | 69 const std::string& default_value, |
| 60 FieldTrialFlags& flags); | 70 FieldTrialFlags& flags); |
| 61 | 71 |
| 62 // Given a FieldTrialFlags object, returns the uint64 value of the provided | 72 // Given a FieldTrialFlags object, returns the uint64 value of the provided |
| 63 // flag. | 73 // flag. |
| 64 // Exposed for testing only. | 74 // Exposed for testing only. |
| 65 uint64 GetUInt64ValueForFlagWithDefault( | 75 uint64 GetUInt64ValueForFlagWithDefault( |
| 66 const std::string& flag, uint64 default_value, FieldTrialFlags& flags); | 76 const std::string& flag, uint64 default_value, FieldTrialFlags& flags); |
| 67 | 77 |
| 68 // Given a FieldTrialFlags object, returns the bool value of the provided flag. | 78 // Given a FieldTrialFlags object, returns the bool value of the provided flag. |
| 69 // Exposed for testing only. | 79 // Exposed for testing only. |
| 70 bool GetBoolValueForFlagWithDefault( | 80 bool GetBoolValueForFlagWithDefault( |
| 71 const std::string& flag, bool default_value, FieldTrialFlags& flags); | 81 const std::string& flag, bool default_value, FieldTrialFlags& flags); |
| 72 | 82 |
| 73 } // namespace search | 83 } // namespace search |
| 74 } // namespace chrome | 84 } // namespace chrome |
| 75 | 85 |
| 76 #endif // CHROME_BROWSER_UI_SEARCH_SEARCH_H_ | 86 #endif // CHROME_BROWSER_UI_SEARCH_SEARCH_H_ |
| OLD | NEW |