| 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/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
| 11 #include "base/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
| 12 #include "build/build_config.h" | 12 #include "build/build_config.h" |
| 13 #include "chrome/browser/autocomplete/autocomplete_classifier_factory.h" | 13 #include "chrome/browser/autocomplete/autocomplete_classifier_factory.h" |
| 14 #include "chrome/browser/autocomplete/in_memory_url_index_factory.h" | 14 #include "chrome/browser/autocomplete/in_memory_url_index_factory.h" |
| 15 #include "chrome/browser/autocomplete/shortcuts_backend_factory.h" | 15 #include "chrome/browser/autocomplete/shortcuts_backend_factory.h" |
| 16 #include "chrome/browser/bitmap_fetcher/bitmap_fetcher_service.h" | 16 #include "chrome/browser/bitmap_fetcher/bitmap_fetcher_service.h" |
| 17 #include "chrome/browser/bitmap_fetcher/bitmap_fetcher_service_factory.h" | 17 #include "chrome/browser/bitmap_fetcher/bitmap_fetcher_service_factory.h" |
| 18 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | 18 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
| 19 #include "chrome/browser/chrome_notification_types.h" | 19 #include "chrome/browser/chrome_notification_types.h" |
| 20 #include "chrome/browser/history/history_service_factory.h" | 20 #include "chrome/browser/history/history_service_factory.h" |
| 21 #include "chrome/browser/history/top_sites_factory.h" | 21 #include "chrome/browser/history/top_sites_factory.h" |
| 22 #include "chrome/browser/profiles/profile.h" | 22 #include "chrome/browser/profiles/profile.h" |
| 23 #include "chrome/browser/search_engines/template_url_service_factory.h" | 23 #include "chrome/browser/search_engines/template_url_service_factory.h" |
| 24 #include "chrome/browser/sync/profile_sync_service_factory.h" | 24 #include "chrome/browser/sync/profile_sync_service_factory.h" |
| 25 #include "chrome/common/pref_names.h" | 25 #include "chrome/common/pref_names.h" |
| 26 #include "chrome/common/url_constants.h" | 26 #include "chrome/common/url_constants.h" |
| 27 #include "components/bookmarks/common/bookmark_pref_names.h" | |
| 28 #include "components/browser_sync/browser/profile_sync_service.h" | 27 #include "components/browser_sync/browser/profile_sync_service.h" |
| 29 #include "components/history/core/browser/history_service.h" | 28 #include "components/history/core/browser/history_service.h" |
| 30 #include "components/omnibox/browser/autocomplete_classifier.h" | 29 #include "components/omnibox/browser/autocomplete_classifier.h" |
| 31 #include "components/sync_driver/sync_service_utils.h" | 30 #include "components/sync_driver/sync_service_utils.h" |
| 32 #include "content/public/browser/notification_service.h" | 31 #include "content/public/browser/notification_service.h" |
| 33 | 32 |
| 34 #if defined(ENABLE_EXTENSIONS) | 33 #if defined(ENABLE_EXTENSIONS) |
| 35 #include "chrome/browser/autocomplete/keyword_extensions_delegate_impl.h" | 34 #include "chrome/browser/autocomplete/keyword_extensions_delegate_impl.h" |
| 36 #endif | 35 #endif |
| 37 | 36 |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 } | 196 } |
| 198 | 197 |
| 199 bool ChromeAutocompleteProviderClient::IsOffTheRecord() const { | 198 bool ChromeAutocompleteProviderClient::IsOffTheRecord() const { |
| 200 return profile_->IsOffTheRecord(); | 199 return profile_->IsOffTheRecord(); |
| 201 } | 200 } |
| 202 | 201 |
| 203 bool ChromeAutocompleteProviderClient::SearchSuggestEnabled() const { | 202 bool ChromeAutocompleteProviderClient::SearchSuggestEnabled() const { |
| 204 return profile_->GetPrefs()->GetBoolean(prefs::kSearchSuggestEnabled); | 203 return profile_->GetPrefs()->GetBoolean(prefs::kSearchSuggestEnabled); |
| 205 } | 204 } |
| 206 | 205 |
| 207 bool ChromeAutocompleteProviderClient::BookmarkBarIsVisible() const { | |
| 208 return profile_->GetPrefs()->GetBoolean(bookmarks::prefs::kShowBookmarkBar); | |
| 209 } | |
| 210 | |
| 211 bool ChromeAutocompleteProviderClient::TabSyncEnabledAndUnencrypted() const { | 206 bool ChromeAutocompleteProviderClient::TabSyncEnabledAndUnencrypted() const { |
| 212 return sync_driver::IsTabSyncEnabledAndUnencrypted( | 207 return sync_driver::IsTabSyncEnabledAndUnencrypted( |
| 213 ProfileSyncServiceFactory::GetInstance()->GetForProfile(profile_), | 208 ProfileSyncServiceFactory::GetInstance()->GetForProfile(profile_), |
| 214 profile_->GetPrefs()); | 209 profile_->GetPrefs()); |
| 215 } | 210 } |
| 216 | 211 |
| 217 void ChromeAutocompleteProviderClient::Classify( | 212 void ChromeAutocompleteProviderClient::Classify( |
| 218 const base::string16& text, | 213 const base::string16& text, |
| 219 bool prefer_keyword, | 214 bool prefer_keyword, |
| 220 bool allow_exact_keyword_match, | 215 bool allow_exact_keyword_match, |
| (...skipping 19 matching lines...) Expand all Loading... |
| 240 image_service->Prefetch(url); | 235 image_service->Prefetch(url); |
| 241 } | 236 } |
| 242 | 237 |
| 243 void ChromeAutocompleteProviderClient::OnAutocompleteControllerResultReady( | 238 void ChromeAutocompleteProviderClient::OnAutocompleteControllerResultReady( |
| 244 AutocompleteController* controller) { | 239 AutocompleteController* controller) { |
| 245 content::NotificationService::current()->Notify( | 240 content::NotificationService::current()->Notify( |
| 246 chrome::NOTIFICATION_AUTOCOMPLETE_CONTROLLER_RESULT_READY, | 241 chrome::NOTIFICATION_AUTOCOMPLETE_CONTROLLER_RESULT_READY, |
| 247 content::Source<AutocompleteController>(controller), | 242 content::Source<AutocompleteController>(controller), |
| 248 content::NotificationService::NoDetails()); | 243 content::NotificationService::NoDetails()); |
| 249 } | 244 } |
| OLD | NEW |