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