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_SEARCH_ENGINES_SEARCH_TERMS_DATA_H_ | 5 #ifndef CHROME_BROWSER_SEARCH_ENGINES_SEARCH_TERMS_DATA_H_ |
6 #define CHROME_BROWSER_SEARCH_ENGINES_SEARCH_TERMS_DATA_H_ | 6 #define CHROME_BROWSER_SEARCH_ENGINES_SEARCH_TERMS_DATA_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 virtual std::string GoogleBaseURLValue() const; | 25 virtual std::string GoogleBaseURLValue() const; |
26 | 26 |
27 // Returns the value for the GOOGLE_BASE_SUGGEST_URL term. This | 27 // Returns the value for the GOOGLE_BASE_SUGGEST_URL term. This |
28 // implementation simply returns the default value. | 28 // implementation simply returns the default value. |
29 std::string GoogleBaseSuggestURLValue() const; | 29 std::string GoogleBaseSuggestURLValue() const; |
30 | 30 |
31 // Returns the locale used by the application. This implementation returns | 31 // Returns the locale used by the application. This implementation returns |
32 // "en" and thus should be overridden where the result is actually meaningful. | 32 // "en" and thus should be overridden where the result is actually meaningful. |
33 virtual std::string GetApplicationLocale() const; | 33 virtual std::string GetApplicationLocale() const; |
34 | 34 |
35 #if defined(ENABLE_RLZ) | |
36 // Returns the value for the Chrome Omnibox rlz. This implementation returns | 35 // Returns the value for the Chrome Omnibox rlz. This implementation returns |
37 // the empty string. | 36 // the empty string. |
38 virtual string16 GetRlzParameterValue() const; | 37 virtual string16 GetRlzParameterValue() const; |
39 #endif | 38 |
| 39 // The optional client parameter passed with Google search requests. This |
| 40 // implementation returns the empty string. |
| 41 virtual std::string GetSearchClient() const; |
40 | 42 |
41 // Returns a string indicating whether Instant (in the visible-preview mode) | 43 // Returns a string indicating whether Instant (in the visible-preview mode) |
42 // is enabled, suitable for adding as a query string param to the homepage | 44 // is enabled, suitable for adding as a query string param to the homepage |
43 // (instant_url) request. Returns an empty string if Instant is disabled, | 45 // (instant_url) request. Returns an empty string if Instant is disabled, |
44 // or if it's only active in a hidden field trial mode. Determining this | 46 // or if it's only active in a hidden field trial mode. Determining this |
45 // requires accessing the Profile, so this can only ever be non-empty for | 47 // requires accessing the Profile, so this can only ever be non-empty for |
46 // UIThreadSearchTermsData. | 48 // UIThreadSearchTermsData. |
47 virtual std::string InstantEnabledParam() const; | 49 virtual std::string InstantEnabledParam() const; |
48 | 50 |
49 private: | 51 private: |
50 DISALLOW_COPY_AND_ASSIGN(SearchTermsData); | 52 DISALLOW_COPY_AND_ASSIGN(SearchTermsData); |
51 }; | 53 }; |
52 | 54 |
53 // Implementation of SearchTermsData that is only usable on the UI thread. | 55 // Implementation of SearchTermsData that is only usable on the UI thread. |
54 class UIThreadSearchTermsData : public SearchTermsData { | 56 class UIThreadSearchTermsData : public SearchTermsData { |
55 public: | 57 public: |
56 // If |profile_| is NULL, the Google base URL accessors will return default | 58 // If |profile_| is NULL, the Google base URL accessors will return default |
57 // values, and InstantEnabledParam() will return the empty string. | 59 // values, and InstantEnabledParam() will return the empty string. |
58 explicit UIThreadSearchTermsData(Profile* profile); | 60 explicit UIThreadSearchTermsData(Profile* profile); |
59 | 61 |
60 virtual std::string GoogleBaseURLValue() const OVERRIDE; | 62 virtual std::string GoogleBaseURLValue() const OVERRIDE; |
61 virtual std::string GetApplicationLocale() const OVERRIDE; | 63 virtual std::string GetApplicationLocale() const OVERRIDE; |
62 #if defined(ENABLE_RLZ) | |
63 virtual string16 GetRlzParameterValue() const OVERRIDE; | 64 virtual string16 GetRlzParameterValue() const OVERRIDE; |
64 #endif | 65 virtual std::string GetSearchClient() const OVERRIDE; |
65 virtual std::string InstantEnabledParam() const OVERRIDE; | 66 virtual std::string InstantEnabledParam() const OVERRIDE; |
66 | 67 |
67 // Used by tests to override the value for the Google base URL. Passing the | 68 // Used by tests to override the value for the Google base URL. Passing the |
68 // empty string cancels this override. | 69 // empty string cancels this override. |
69 static void SetGoogleBaseURL(const std::string& base_url); | 70 static void SetGoogleBaseURL(const std::string& base_url); |
70 | 71 |
71 private: | 72 private: |
72 static std::string* google_base_url_; | 73 static std::string* google_base_url_; |
73 Profile* profile_; | 74 Profile* profile_; |
74 | 75 |
75 DISALLOW_COPY_AND_ASSIGN(UIThreadSearchTermsData); | 76 DISALLOW_COPY_AND_ASSIGN(UIThreadSearchTermsData); |
76 }; | 77 }; |
77 | 78 |
78 #endif // CHROME_BROWSER_SEARCH_ENGINES_SEARCH_TERMS_DATA_H_ | 79 #endif // CHROME_BROWSER_SEARCH_ENGINES_SEARCH_TERMS_DATA_H_ |
OLD | NEW |