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 #include "base/string16.h" |
13 | 14 |
14 class GURL; | 15 class GURL; |
15 class Profile; | 16 class Profile; |
16 | 17 |
| 18 namespace content { |
| 19 class NavigationEntry; |
| 20 } |
| 21 |
17 namespace chrome { | 22 namespace chrome { |
18 namespace search { | 23 namespace search { |
19 | 24 |
| 25 // The key used to store search terms data in the NavigationEntry to be later |
| 26 // displayed in the Omnibox. With the context of the user's exact query, |
| 27 // InstantController sets the correct search terms to be displayed. |
| 28 extern const char kInstantExtendedSearchTermsKey[]; |
| 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 |
| 50 // Return the search terms attached to a specific NavigationEntry, or empty |
| 51 // string otherwise. |
| 52 string16 GetSearchTermsFromNavigationEntry( |
| 53 const content::NavigationEntry* entry); |
| 54 |
40 // Returns true if |url| has the same scheme, host, port and path as the | 55 // Returns true if |url| has the same scheme, host, port and path as the |
41 // Instant URL set via --instant-url. | 56 // Instant URL set via --instant-url. |
42 bool IsForcedInstantURL(const GURL& url); | 57 bool IsForcedInstantURL(const GURL& url); |
43 | 58 |
44 // Type for a collection of experiment configuration parameters. | 59 // Type for a collection of experiment configuration parameters. |
45 typedef std::vector<std::pair<std::string, std::string> > FieldTrialFlags; | 60 typedef std::vector<std::pair<std::string, std::string> > FieldTrialFlags; |
46 | 61 |
47 // Given a field trial group name, parses out the group number and configuration | 62 // Given a field trial group name, parses out the group number and configuration |
48 // flags. | 63 // flags. |
49 // Exposed for testing only. | 64 // Exposed for testing only. |
(...skipping 17 matching lines...) Expand all Loading... |
67 | 82 |
68 // Given a FieldTrialFlags object, returns the bool value of the provided flag. | 83 // Given a FieldTrialFlags object, returns the bool value of the provided flag. |
69 // Exposed for testing only. | 84 // Exposed for testing only. |
70 bool GetBoolValueForFlagWithDefault( | 85 bool GetBoolValueForFlagWithDefault( |
71 const std::string& flag, bool default_value, FieldTrialFlags& flags); | 86 const std::string& flag, bool default_value, FieldTrialFlags& flags); |
72 | 87 |
73 } // namespace search | 88 } // namespace search |
74 } // namespace chrome | 89 } // namespace chrome |
75 | 90 |
76 #endif // CHROME_BROWSER_UI_SEARCH_SEARCH_H_ | 91 #endif // CHROME_BROWSER_UI_SEARCH_SEARCH_H_ |
OLD | NEW |