| 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/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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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() { |
| 122 // iOS does not supports BuiltinProvider. | 122 std::vector<std::string> chrome_builtins( |
| 123 return std::vector<base::string16>(); | 123 kChromeHostURLs, kChromeHostURLs + kNumberOfChromeHostURLs); |
| 124 std::sort(chrome_builtins.begin(), chrome_builtins.end()); |
| 125 |
| 126 std::vector<base::string16> builtins; |
| 127 for (auto& url : chrome_builtins) { |
| 128 builtins.push_back(base::ASCIIToUTF16(url)); |
| 129 } |
| 130 return builtins; |
| 124 } | 131 } |
| 125 | 132 |
| 126 std::vector<base::string16> | 133 std::vector<base::string16> |
| 127 AutocompleteProviderClientImpl::GetBuiltinsToProvideAsUserTypes() { | 134 AutocompleteProviderClientImpl::GetBuiltinsToProvideAsUserTypes() { |
| 128 // iOS does not supports BuiltinProvider. | 135 return {base::ASCIIToUTF16(kChromeUIChromeURLsURL), |
| 129 return std::vector<base::string16>(); | 136 base::ASCIIToUTF16(kChromeUIVersionURL)}; |
| 130 } | 137 } |
| 131 | 138 |
| 132 bool AutocompleteProviderClientImpl::IsOffTheRecord() const { | 139 bool AutocompleteProviderClientImpl::IsOffTheRecord() const { |
| 133 return browser_state_->IsOffTheRecord(); | 140 return browser_state_->IsOffTheRecord(); |
| 134 } | 141 } |
| 135 | 142 |
| 136 bool AutocompleteProviderClientImpl::SearchSuggestEnabled() const { | 143 bool AutocompleteProviderClientImpl::SearchSuggestEnabled() const { |
| 137 return browser_state_->GetPrefs()->GetBoolean(prefs::kSearchSuggestEnabled); | 144 return browser_state_->GetPrefs()->GetBoolean(prefs::kSearchSuggestEnabled); |
| 138 } | 145 } |
| 139 | 146 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 160 const base::string16& term) { | 167 const base::string16& term) { |
| 161 GetHistoryService()->DeleteMatchingURLsForKeyword(keyword_id, term); | 168 GetHistoryService()->DeleteMatchingURLsForKeyword(keyword_id, term); |
| 162 } | 169 } |
| 163 | 170 |
| 164 void AutocompleteProviderClientImpl::PrefetchImage(const GURL& url) {} | 171 void AutocompleteProviderClientImpl::PrefetchImage(const GURL& url) {} |
| 165 | 172 |
| 166 void AutocompleteProviderClientImpl::OnAutocompleteControllerResultReady( | 173 void AutocompleteProviderClientImpl::OnAutocompleteControllerResultReady( |
| 167 AutocompleteController* controller) { | 174 AutocompleteController* controller) { |
| 168 // iOS currently has no client for this event. | 175 // iOS currently has no client for this event. |
| 169 } | 176 } |
| OLD | NEW |