OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #include "ios/chrome/browser/search_engines/ui_thread_search_terms_data.h" | 5 #include "ios/chrome/browser/search_engines/ui_thread_search_terms_data.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/strings/string16.h" | 8 #include "base/strings/string16.h" |
9 #include "components/google/core/browser/google_url_tracker.h" | 9 #include "components/google/core/browser/google_url_tracker.h" |
10 #include "components/google/core/browser/google_util.h" | 10 #include "components/google/core/browser/google_util.h" |
11 #include "components/omnibox/browser/omnibox_field_trial.h" | 11 #include "components/omnibox/browser/omnibox_field_trial.h" |
12 #include "components/search/search.h" | 12 #include "components/search/search.h" |
13 #include "components/version_info/version_info.h" | 13 #include "components/version_info/version_info.h" |
14 #include "ios/chrome/browser/application_context.h" | 14 #include "ios/chrome/browser/application_context.h" |
15 #include "ios/chrome/browser/google/google_brand.h" | 15 #include "ios/chrome/browser/google/google_brand.h" |
16 #include "ios/chrome/browser/google/google_url_tracker_factory.h" | 16 #include "ios/chrome/browser/google/google_url_tracker_factory.h" |
17 #include "ios/chrome/common/channel_info.h" | 17 #include "ios/chrome/common/channel_info.h" |
18 #include "ios/public/provider/chrome/browser/chrome_browser_provider.h" | |
19 #include "ios/public/provider/chrome/browser/search_provider.h" | |
20 #include "ios/web/public/web_thread.h" | 18 #include "ios/web/public/web_thread.h" |
21 #include "url/gurl.h" | 19 #include "url/gurl.h" |
22 | 20 |
23 #if defined(ENABLE_RLZ) | 21 #if defined(ENABLE_RLZ) |
24 #include "components/rlz/rlz_tracker.h" | 22 #include "components/rlz/rlz_tracker.h" |
25 #endif | 23 #endif |
26 | 24 |
27 namespace ios { | 25 namespace ios { |
28 | 26 |
29 UIThreadSearchTermsData::UIThreadSearchTermsData( | 27 UIThreadSearchTermsData::UIThreadSearchTermsData( |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 return rlz_string; | 74 return rlz_string; |
77 } | 75 } |
78 | 76 |
79 std::string UIThreadSearchTermsData::GetSearchClient() const { | 77 std::string UIThreadSearchTermsData::GetSearchClient() const { |
80 DCHECK(thread_checker_.CalledOnValidThread()); | 78 DCHECK(thread_checker_.CalledOnValidThread()); |
81 return std::string(); | 79 return std::string(); |
82 } | 80 } |
83 | 81 |
84 std::string UIThreadSearchTermsData::GetSuggestClient() const { | 82 std::string UIThreadSearchTermsData::GetSuggestClient() const { |
85 DCHECK(thread_checker_.CalledOnValidThread()); | 83 DCHECK(thread_checker_.CalledOnValidThread()); |
86 return chrome::IsInstantExtendedAPIEnabled() ? "chrome-omni" : "chrome"; | 84 return search::IsInstantExtendedAPIEnabled() ? "chrome-omni" : "chrome"; |
87 } | 85 } |
88 | 86 |
89 std::string UIThreadSearchTermsData::GetSuggestRequestIdentifier() const { | 87 std::string UIThreadSearchTermsData::GetSuggestRequestIdentifier() const { |
90 DCHECK(thread_checker_.CalledOnValidThread()); | 88 DCHECK(thread_checker_.CalledOnValidThread()); |
91 return "chrome-ext-ansg"; | 89 return "chrome-ext-ansg"; |
92 } | 90 } |
93 | 91 |
94 bool UIThreadSearchTermsData::IsShowingSearchTermsOnSearchResultsPages() const { | 92 bool UIThreadSearchTermsData::IsShowingSearchTermsOnSearchResultsPages() const { |
95 DCHECK(thread_checker_.CalledOnValidThread()); | 93 DCHECK(thread_checker_.CalledOnValidThread()); |
96 return chrome::IsInstantExtendedAPIEnabled() && | 94 return search::IsInstantExtendedAPIEnabled() && |
97 ios::GetChromeBrowserProvider() | 95 search::IsQueryExtractionEnabled(); |
98 ->GetSearchProvider() | |
99 ->IsQueryExtractionEnabled(); | |
100 } | 96 } |
101 | 97 |
102 std::string UIThreadSearchTermsData::InstantExtendedEnabledParam( | 98 std::string UIThreadSearchTermsData::InstantExtendedEnabledParam( |
103 bool for_search) const { | 99 bool for_search) const { |
104 DCHECK(thread_checker_.CalledOnValidThread()); | 100 DCHECK(thread_checker_.CalledOnValidThread()); |
105 return ios::GetChromeBrowserProvider() | 101 return search::InstantExtendedEnabledParam(for_search); |
106 ->GetSearchProvider() | |
107 ->InstantExtendedEnabledParam(for_search); | |
108 } | 102 } |
109 | 103 |
110 std::string UIThreadSearchTermsData::ForceInstantResultsParam( | 104 std::string UIThreadSearchTermsData::ForceInstantResultsParam( |
111 bool for_prerender) const { | 105 bool for_prerender) const { |
112 DCHECK(thread_checker_.CalledOnValidThread()); | 106 DCHECK(thread_checker_.CalledOnValidThread()); |
113 return ios::GetChromeBrowserProvider() | 107 return search::ForceInstantResultsParam(for_prerender); |
114 ->GetSearchProvider() | |
115 ->ForceInstantResultsParam(for_prerender); | |
116 } | 108 } |
117 | 109 |
118 int UIThreadSearchTermsData::OmniboxStartMargin() const { | 110 int UIThreadSearchTermsData::OmniboxStartMargin() const { |
119 DCHECK(thread_checker_.CalledOnValidThread()); | 111 DCHECK(thread_checker_.CalledOnValidThread()); |
120 return ios::GetChromeBrowserProvider() | 112 // iOS has not InstantService. |
121 ->GetSearchProvider() | 113 return search::kDisableStartMargin; |
122 ->OmniboxStartMargin(); | |
123 } | 114 } |
124 | 115 |
125 std::string UIThreadSearchTermsData::NTPIsThemedParam() const { | 116 std::string UIThreadSearchTermsData::NTPIsThemedParam() const { |
126 DCHECK(thread_checker_.CalledOnValidThread()); | 117 DCHECK(thread_checker_.CalledOnValidThread()); |
| 118 // iOS does not supports themed NTP. |
127 return std::string(); | 119 return std::string(); |
128 } | 120 } |
129 | 121 |
130 std::string UIThreadSearchTermsData::GoogleImageSearchSource() const { | 122 std::string UIThreadSearchTermsData::GoogleImageSearchSource() const { |
131 DCHECK(thread_checker_.CalledOnValidThread()); | 123 DCHECK(thread_checker_.CalledOnValidThread()); |
132 std::string version(version_info::GetProductName() + " " + | 124 std::string version(version_info::GetProductName() + " " + |
133 version_info::GetVersionNumber()); | 125 version_info::GetVersionNumber()); |
134 if (version_info::IsOfficialBuild()) | 126 if (version_info::IsOfficialBuild()) |
135 version += " (Official)"; | 127 version += " (Official)"; |
136 version += " " + version_info::GetOSType(); | 128 version += " " + version_info::GetOSType(); |
137 std::string modifier(GetChannelString()); | 129 std::string modifier(GetChannelString()); |
138 if (!modifier.empty()) | 130 if (!modifier.empty()) |
139 version += " " + modifier; | 131 version += " " + modifier; |
140 return version; | 132 return version; |
141 } | 133 } |
142 | 134 |
143 } // namespace ios | 135 } // namespace ios |
OLD | NEW |