| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "chrome/browser/autocomplete/chrome_autocomplete_provider_client.h" | 5 #include "chrome/browser/autocomplete/chrome_autocomplete_provider_client.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/feature_list.h" | |
| 10 #include "base/macros.h" | 9 #include "base/macros.h" |
| 11 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| 12 #include "base/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
| 13 #include "build/build_config.h" | 12 #include "build/build_config.h" |
| 14 #include "chrome/browser/autocomplete/autocomplete_classifier_factory.h" | 13 #include "chrome/browser/autocomplete/autocomplete_classifier_factory.h" |
| 15 #include "chrome/browser/autocomplete/in_memory_url_index_factory.h" | 14 #include "chrome/browser/autocomplete/in_memory_url_index_factory.h" |
| 16 #include "chrome/browser/autocomplete/shortcuts_backend_factory.h" | 15 #include "chrome/browser/autocomplete/shortcuts_backend_factory.h" |
| 17 #include "chrome/browser/bitmap_fetcher/bitmap_fetcher_service.h" | 16 #include "chrome/browser/bitmap_fetcher/bitmap_fetcher_service.h" |
| 18 #include "chrome/browser/bitmap_fetcher/bitmap_fetcher_service_factory.h" | 17 #include "chrome/browser/bitmap_fetcher/bitmap_fetcher_service_factory.h" |
| 19 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | 18 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
| 20 #include "chrome/browser/browser_process.h" | 19 #include "chrome/browser/browser_process.h" |
| 21 #include "chrome/browser/chrome_notification_types.h" | 20 #include "chrome/browser/chrome_notification_types.h" |
| 22 #include "chrome/browser/history/history_service_factory.h" | 21 #include "chrome/browser/history/history_service_factory.h" |
| 23 #include "chrome/browser/history/top_sites_factory.h" | 22 #include "chrome/browser/history/top_sites_factory.h" |
| 24 #include "chrome/browser/profiles/profile.h" | 23 #include "chrome/browser/profiles/profile.h" |
| 25 #include "chrome/browser/search_engines/template_url_service_factory.h" | 24 #include "chrome/browser/search_engines/template_url_service_factory.h" |
| 26 #include "chrome/browser/sync/profile_sync_service_factory.h" | 25 #include "chrome/browser/sync/profile_sync_service_factory.h" |
| 27 #include "chrome/common/chrome_features.h" | |
| 28 #include "chrome/common/pref_names.h" | 26 #include "chrome/common/pref_names.h" |
| 29 #include "chrome/common/url_constants.h" | 27 #include "chrome/common/url_constants.h" |
| 30 #include "components/browser_sync/profile_sync_service.h" | 28 #include "components/browser_sync/profile_sync_service.h" |
| 31 #include "components/history/core/browser/history_service.h" | 29 #include "components/history/core/browser/history_service.h" |
| 32 #include "components/omnibox/browser/autocomplete_classifier.h" | 30 #include "components/omnibox/browser/autocomplete_classifier.h" |
| 33 #include "components/prefs/pref_service.h" | 31 #include "components/prefs/pref_service.h" |
| 34 #include "components/sync/driver/sync_service_utils.h" | 32 #include "components/sync/driver/sync_service_utils.h" |
| 35 #include "content/public/browser/notification_service.h" | 33 #include "content/public/browser/notification_service.h" |
| 36 #include "extensions/features/features.h" | 34 #include "extensions/features/features.h" |
| 37 #include "net/traffic_annotation/network_traffic_annotation.h" | 35 #include "net/traffic_annotation/network_traffic_annotation.h" |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 i != chrome_builtins.end(); ++i) | 178 i != chrome_builtins.end(); ++i) |
| 181 builtins.push_back(base::ASCIIToUTF16(*i)); | 179 builtins.push_back(base::ASCIIToUTF16(*i)); |
| 182 | 180 |
| 183 #if !defined(OS_ANDROID) | 181 #if !defined(OS_ANDROID) |
| 184 base::string16 settings(base::ASCIIToUTF16(chrome::kChromeUISettingsHost) + | 182 base::string16 settings(base::ASCIIToUTF16(chrome::kChromeUISettingsHost) + |
| 185 base::ASCIIToUTF16("/")); | 183 base::ASCIIToUTF16("/")); |
| 186 for (size_t i = 0; i < arraysize(kChromeSettingsSubPages); i++) { | 184 for (size_t i = 0; i < arraysize(kChromeSettingsSubPages); i++) { |
| 187 builtins.push_back(settings + | 185 builtins.push_back(settings + |
| 188 base::ASCIIToUTF16(kChromeSettingsSubPages[i])); | 186 base::ASCIIToUTF16(kChromeSettingsSubPages[i])); |
| 189 } | 187 } |
| 190 | |
| 191 if (!base::FeatureList::IsEnabled(features::kMaterialDesignSettings)) { | |
| 192 builtins.push_back( | |
| 193 settings + | |
| 194 base::ASCIIToUTF16( | |
| 195 chrome::kDeprecatedOptionsContentSettingsExceptionsSubPage)); | |
| 196 } | |
| 197 #endif | 188 #endif |
| 198 | 189 |
| 199 return builtins; | 190 return builtins; |
| 200 } | 191 } |
| 201 | 192 |
| 202 std::vector<base::string16> | 193 std::vector<base::string16> |
| 203 ChromeAutocompleteProviderClient::GetBuiltinsToProvideAsUserTypes() { | 194 ChromeAutocompleteProviderClient::GetBuiltinsToProvideAsUserTypes() { |
| 204 std::vector<base::string16> builtins_to_provide; | 195 std::vector<base::string16> builtins_to_provide; |
| 205 builtins_to_provide.push_back( | 196 builtins_to_provide.push_back( |
| 206 base::ASCIIToUTF16(chrome::kChromeUIChromeURLsURL)); | 197 base::ASCIIToUTF16(chrome::kChromeUIChromeURLsURL)); |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 293 image_service->Prefetch(url, traffic_annotation); | 284 image_service->Prefetch(url, traffic_annotation); |
| 294 } | 285 } |
| 295 | 286 |
| 296 void ChromeAutocompleteProviderClient::OnAutocompleteControllerResultReady( | 287 void ChromeAutocompleteProviderClient::OnAutocompleteControllerResultReady( |
| 297 AutocompleteController* controller) { | 288 AutocompleteController* controller) { |
| 298 content::NotificationService::current()->Notify( | 289 content::NotificationService::current()->Notify( |
| 299 chrome::NOTIFICATION_AUTOCOMPLETE_CONTROLLER_RESULT_READY, | 290 chrome::NOTIFICATION_AUTOCOMPLETE_CONTROLLER_RESULT_READY, |
| 300 content::Source<AutocompleteController>(controller), | 291 content::Source<AutocompleteController>(controller), |
| 301 content::NotificationService::NoDetails()); | 292 content::NotificationService::NoDetails()); |
| 302 } | 293 } |
| OLD | NEW |