Chromium Code Reviews| 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" | |
| 9 #include "base/macros.h" | 10 #include "base/macros.h" |
| 10 #include "base/memory/ptr_util.h" | 11 #include "base/memory/ptr_util.h" |
| 11 #include "base/strings/utf_string_conversions.h" | 12 #include "base/strings/utf_string_conversions.h" |
| 12 #include "build/build_config.h" | 13 #include "build/build_config.h" |
| 13 #include "chrome/browser/autocomplete/autocomplete_classifier_factory.h" | 14 #include "chrome/browser/autocomplete/autocomplete_classifier_factory.h" |
| 14 #include "chrome/browser/autocomplete/in_memory_url_index_factory.h" | 15 #include "chrome/browser/autocomplete/in_memory_url_index_factory.h" |
| 15 #include "chrome/browser/autocomplete/shortcuts_backend_factory.h" | 16 #include "chrome/browser/autocomplete/shortcuts_backend_factory.h" |
| 16 #include "chrome/browser/bitmap_fetcher/bitmap_fetcher_service.h" | 17 #include "chrome/browser/bitmap_fetcher/bitmap_fetcher_service.h" |
| 17 #include "chrome/browser/bitmap_fetcher/bitmap_fetcher_service_factory.h" | 18 #include "chrome/browser/bitmap_fetcher/bitmap_fetcher_service_factory.h" |
| 18 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | 19 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
| 19 #include "chrome/browser/chrome_notification_types.h" | 20 #include "chrome/browser/chrome_notification_types.h" |
| 20 #include "chrome/browser/history/history_service_factory.h" | 21 #include "chrome/browser/history/history_service_factory.h" |
| 21 #include "chrome/browser/history/top_sites_factory.h" | 22 #include "chrome/browser/history/top_sites_factory.h" |
| 22 #include "chrome/browser/profiles/profile.h" | 23 #include "chrome/browser/profiles/profile.h" |
| 23 #include "chrome/browser/search_engines/template_url_service_factory.h" | 24 #include "chrome/browser/search_engines/template_url_service_factory.h" |
| 24 #include "chrome/browser/sync/profile_sync_service_factory.h" | 25 #include "chrome/browser/sync/profile_sync_service_factory.h" |
| 26 #include "chrome/common/chrome_features.h" | |
| 25 #include "chrome/common/pref_names.h" | 27 #include "chrome/common/pref_names.h" |
| 26 #include "chrome/common/url_constants.h" | 28 #include "chrome/common/url_constants.h" |
| 27 #include "components/browser_sync/profile_sync_service.h" | 29 #include "components/browser_sync/profile_sync_service.h" |
| 28 #include "components/history/core/browser/history_service.h" | 30 #include "components/history/core/browser/history_service.h" |
| 29 #include "components/omnibox/browser/autocomplete_classifier.h" | 31 #include "components/omnibox/browser/autocomplete_classifier.h" |
| 30 #include "components/prefs/pref_service.h" | 32 #include "components/prefs/pref_service.h" |
| 31 #include "components/sync/driver/sync_service_utils.h" | 33 #include "components/sync/driver/sync_service_utils.h" |
| 32 #include "content/public/browser/notification_service.h" | 34 #include "content/public/browser/notification_service.h" |
| 33 | 35 |
| 34 #if defined(ENABLE_EXTENSIONS) | 36 #if defined(ENABLE_EXTENSIONS) |
| 35 #include "chrome/browser/autocomplete/keyword_extensions_delegate_impl.h" | 37 #include "chrome/browser/autocomplete/keyword_extensions_delegate_impl.h" |
| 36 #endif | 38 #endif |
| 37 | 39 |
| 38 #if !defined(OS_ANDROID) | 40 #if !defined(OS_ANDROID) |
| 39 namespace { | 41 namespace { |
| 40 | 42 |
| 41 // This list should be kept in sync with chrome/common/url_constants.h. | 43 // This list should be kept in sync with chrome/common/url_constants.h. |
| 42 // Only include useful sub-pages, confirmation alerts are not useful. | 44 // Only include useful sub-pages, confirmation alerts are not useful. |
| 43 const char* const kChromeSettingsSubPages[] = { | 45 const char* const kChromeSettingsSubPages[] = { |
| 44 chrome::kAutofillSubPage, | 46 chrome::kAutofillSubPage, |
| 45 chrome::kClearBrowserDataSubPage, | 47 chrome::kClearBrowserDataSubPage, |
| 46 chrome::kContentSettingsSubPage, | 48 chrome::kContentSettingsSubPage, |
| 47 chrome::kContentSettingsExceptionsSubPage, | |
| 48 chrome::kImportDataSubPage, | 49 chrome::kImportDataSubPage, |
| 49 chrome::kLanguageOptionsSubPage, | 50 chrome::kLanguageOptionsSubPage, |
| 50 chrome::kPasswordManagerSubPage, | 51 chrome::kPasswordManagerSubPage, |
| 51 chrome::kResetProfileSettingsSubPage, | 52 chrome::kResetProfileSettingsSubPage, |
| 52 chrome::kSearchEnginesSubPage, | 53 chrome::kSearchEnginesSubPage, |
| 53 chrome::kSyncSetupSubPage, | 54 chrome::kSyncSetupSubPage, |
| 54 #if defined(OS_CHROMEOS) | 55 #if defined(OS_CHROMEOS) |
| 55 chrome::kInternetOptionsSubPage, | 56 chrome::kInternetOptionsSubPage, |
| 56 #endif | 57 #endif |
| 57 }; | 58 }; |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 175 i != chrome_builtins.end(); ++i) | 176 i != chrome_builtins.end(); ++i) |
| 176 builtins.push_back(base::ASCIIToUTF16(*i)); | 177 builtins.push_back(base::ASCIIToUTF16(*i)); |
| 177 | 178 |
| 178 #if !defined(OS_ANDROID) | 179 #if !defined(OS_ANDROID) |
| 179 base::string16 settings(base::ASCIIToUTF16(chrome::kChromeUISettingsHost) + | 180 base::string16 settings(base::ASCIIToUTF16(chrome::kChromeUISettingsHost) + |
| 180 base::ASCIIToUTF16("/")); | 181 base::ASCIIToUTF16("/")); |
| 181 for (size_t i = 0; i < arraysize(kChromeSettingsSubPages); i++) { | 182 for (size_t i = 0; i < arraysize(kChromeSettingsSubPages); i++) { |
| 182 builtins.push_back(settings + | 183 builtins.push_back(settings + |
| 183 base::ASCIIToUTF16(kChromeSettingsSubPages[i])); | 184 base::ASCIIToUTF16(kChromeSettingsSubPages[i])); |
| 184 } | 185 } |
| 186 | |
| 187 if (!base::FeatureList::IsEnabled(features::kMaterialDesignSettings)) { | |
| 188 builtins.push_back( | |
| 189 settings + | |
| 190 base::ASCIIToUTF16( | |
| 191 chrome::kDeprecatedOptionsContentSettingsExceptionsSubPage)); | |
| 192 } | |
| 193 | |
|
Peter Kasting
2016/10/28 21:13:34
Nit: No blank line here
tommycli
2016/10/28 21:57:13
Done.
| |
| 185 #endif | 194 #endif |
| 186 | 195 |
| 187 return builtins; | 196 return builtins; |
| 188 } | 197 } |
| 189 | 198 |
| 190 std::vector<base::string16> | 199 std::vector<base::string16> |
| 191 ChromeAutocompleteProviderClient::GetBuiltinsToProvideAsUserTypes() { | 200 ChromeAutocompleteProviderClient::GetBuiltinsToProvideAsUserTypes() { |
| 192 std::vector<base::string16> builtins_to_provide; | 201 std::vector<base::string16> builtins_to_provide; |
| 193 builtins_to_provide.push_back( | 202 builtins_to_provide.push_back( |
| 194 base::ASCIIToUTF16(chrome::kChromeUIChromeURLsURL)); | 203 base::ASCIIToUTF16(chrome::kChromeUIChromeURLsURL)); |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 241 image_service->Prefetch(url); | 250 image_service->Prefetch(url); |
| 242 } | 251 } |
| 243 | 252 |
| 244 void ChromeAutocompleteProviderClient::OnAutocompleteControllerResultReady( | 253 void ChromeAutocompleteProviderClient::OnAutocompleteControllerResultReady( |
| 245 AutocompleteController* controller) { | 254 AutocompleteController* controller) { |
| 246 content::NotificationService::current()->Notify( | 255 content::NotificationService::current()->Notify( |
| 247 chrome::NOTIFICATION_AUTOCOMPLETE_CONTROLLER_RESULT_READY, | 256 chrome::NOTIFICATION_AUTOCOMPLETE_CONTROLLER_RESULT_READY, |
| 248 content::Source<AutocompleteController>(controller), | 257 content::Source<AutocompleteController>(controller), |
| 249 content::NotificationService::NoDetails()); | 258 content::NotificationService::NoDetails()); |
| 250 } | 259 } |
| OLD | NEW |