Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(382)

Side by Side Diff: ios/chrome/browser/autocomplete/autocomplete_provider_client_impl.cc

Issue 2947643002: [ios] Enables the BuiltinProvider. (Closed)
Patch Set: Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « components/omnibox/browser/autocomplete_classifier.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/autocomplete/autocomplete_provider_client_impl.h" 5 #include "ios/chrome/browser/autocomplete/autocomplete_provider_client_impl.h"
6 6
7 #include "base/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.h"
8 #include "components/browser_sync/profile_sync_service.h" 8 #include "components/browser_sync/profile_sync_service.h"
9 #include "components/history/core/browser/history_service.h" 9 #include "components/history/core/browser/history_service.h"
10 #include "components/keyed_service/core/service_access_type.h" 10 #include "components/keyed_service/core/service_access_type.h"
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 111
112 std::string AutocompleteProviderClientImpl::GetAcceptLanguages() const { 112 std::string AutocompleteProviderClientImpl::GetAcceptLanguages() const {
113 return browser_state_->GetPrefs()->GetString(prefs::kAcceptLanguages); 113 return browser_state_->GetPrefs()->GetString(prefs::kAcceptLanguages);
114 } 114 }
115 115
116 std::string 116 std::string
117 AutocompleteProviderClientImpl::GetEmbedderRepresentationOfAboutScheme() { 117 AutocompleteProviderClientImpl::GetEmbedderRepresentationOfAboutScheme() {
118 return kChromeUIScheme; 118 return kChromeUIScheme;
119 } 119 }
120 120
121 std::vector<base::string16> AutocompleteProviderClientImpl::GetBuiltinURLs() { 121 std::vector<base::string16> AutocompleteProviderClientImpl::GetBuiltinURLs() {
Peter Kasting 2017/06/19 21:00:43 It looks like these two functions are basically co
rohitrao (ping after 24h) 2017/06/20 12:08:20 The Client interfaces exist to allow for embedder-
Justin Donnelly 2017/06/20 15:16:39 I had the same reaction as Peter (ugh, duplication
Peter Kasting 2017/06/21 01:10:15 Is there any reason not to just change the API to
rohitrao (ping after 24h) 2017/06/21 15:15:35 I'll send this out as a followup; we can look at t
122 // iOS does not supports BuiltinProvider. 122 std::vector<std::string> chrome_builtins(
123 return std::vector<base::string16>(); 123 kChromeHostURLs,
124 kChromeHostURLs + kNumberOfChromeHostURLs);
125 std::sort(chrome_builtins.begin(), chrome_builtins.end());
126
127 std::vector<base::string16> builtins;
128 for (std::vector<std::string>::iterator i(chrome_builtins.begin());
Peter Kasting 2017/06/19 21:00:43 Nit: Range-based for can help here
rohitrao (ping after 24h) 2017/06/20 12:08:20 Done.
129 i != chrome_builtins.end(); ++i)
130 builtins.push_back(base::ASCIIToUTF16(*i));
131 return builtins;
124 } 132 }
125 133
126 std::vector<base::string16> 134 std::vector<base::string16>
127 AutocompleteProviderClientImpl::GetBuiltinsToProvideAsUserTypes() { 135 AutocompleteProviderClientImpl::GetBuiltinsToProvideAsUserTypes() {
128 // iOS does not supports BuiltinProvider. 136 std::vector<base::string16> builtins_to_provide;
129 return std::vector<base::string16>(); 137 builtins_to_provide.push_back(base::ASCIIToUTF16(kChromeUIChromeURLsURL));
138 builtins_to_provide.push_back(base::ASCIIToUTF16(kChromeUIVersionURL));
139 return builtins_to_provide;
Peter Kasting 2017/06/19 21:00:43 Nit: I bet you could just do: return {base::ASC
rohitrao (ping after 24h) 2017/06/20 12:08:20 Done.
130 } 140 }
131 141
132 bool AutocompleteProviderClientImpl::IsOffTheRecord() const { 142 bool AutocompleteProviderClientImpl::IsOffTheRecord() const {
133 return browser_state_->IsOffTheRecord(); 143 return browser_state_->IsOffTheRecord();
134 } 144 }
135 145
136 bool AutocompleteProviderClientImpl::SearchSuggestEnabled() const { 146 bool AutocompleteProviderClientImpl::SearchSuggestEnabled() const {
137 return browser_state_->GetPrefs()->GetBoolean(prefs::kSearchSuggestEnabled); 147 return browser_state_->GetPrefs()->GetBoolean(prefs::kSearchSuggestEnabled);
138 } 148 }
139 149
(...skipping 20 matching lines...) Expand all
160 const base::string16& term) { 170 const base::string16& term) {
161 GetHistoryService()->DeleteMatchingURLsForKeyword(keyword_id, term); 171 GetHistoryService()->DeleteMatchingURLsForKeyword(keyword_id, term);
162 } 172 }
163 173
164 void AutocompleteProviderClientImpl::PrefetchImage(const GURL& url) {} 174 void AutocompleteProviderClientImpl::PrefetchImage(const GURL& url) {}
165 175
166 void AutocompleteProviderClientImpl::OnAutocompleteControllerResultReady( 176 void AutocompleteProviderClientImpl::OnAutocompleteControllerResultReady(
167 AutocompleteController* controller) { 177 AutocompleteController* controller) {
168 // iOS currently has no client for this event. 178 // iOS currently has no client for this event.
169 } 179 }
OLDNEW
« no previous file with comments | « components/omnibox/browser/autocomplete_classifier.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698