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 "chrome/browser/autocomplete/autocomplete_classifier.h" | 8 #include "chrome/browser/autocomplete/autocomplete_classifier.h" |
9 #include "chrome/browser/autocomplete/autocomplete_classifier_factory.h" | 9 #include "chrome/browser/autocomplete/autocomplete_classifier_factory.h" |
10 #include "chrome/browser/bitmap_fetcher/bitmap_fetcher_service.h" | 10 #include "chrome/browser/bitmap_fetcher/bitmap_fetcher_service.h" |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 ServiceAccessType::EXPLICIT_ACCESS) | 79 ServiceAccessType::EXPLICIT_ACCESS) |
80 ->DeleteMatchingURLsForKeyword(keyword_id, term); | 80 ->DeleteMatchingURLsForKeyword(keyword_id, term); |
81 } | 81 } |
82 | 82 |
83 bool ChromeAutocompleteProviderClient::TabSyncEnabledAndUnencrypted() { | 83 bool ChromeAutocompleteProviderClient::TabSyncEnabledAndUnencrypted() { |
84 // Check field trials and settings allow sending the URL on suggest requests. | 84 // Check field trials and settings allow sending the URL on suggest requests. |
85 ProfileSyncService* service = | 85 ProfileSyncService* service = |
86 ProfileSyncServiceFactory::GetInstance()->GetForProfile(profile_); | 86 ProfileSyncServiceFactory::GetInstance()->GetForProfile(profile_); |
87 sync_driver::SyncPrefs sync_prefs(profile_->GetPrefs()); | 87 sync_driver::SyncPrefs sync_prefs(profile_->GetPrefs()); |
88 return service && | 88 return service && |
89 service->IsSyncEnabledAndLoggedIn() && | 89 service->CanSyncStart() && |
90 sync_prefs.GetPreferredDataTypes(syncer::UserTypes()).Has( | 90 sync_prefs.GetPreferredDataTypes(syncer::UserTypes()).Has( |
91 syncer::PROXY_TABS) && | 91 syncer::PROXY_TABS) && |
92 !service->GetEncryptedDataTypes().Has(syncer::SESSIONS); | 92 !service->GetEncryptedDataTypes().Has(syncer::SESSIONS); |
93 } | 93 } |
94 | 94 |
95 void ChromeAutocompleteProviderClient::PrefetchImage(const GURL& url) { | 95 void ChromeAutocompleteProviderClient::PrefetchImage(const GURL& url) { |
96 BitmapFetcherService* image_service = | 96 BitmapFetcherService* image_service = |
97 BitmapFetcherServiceFactory::GetForBrowserContext(profile_); | 97 BitmapFetcherServiceFactory::GetForBrowserContext(profile_); |
98 DCHECK(image_service); | 98 DCHECK(image_service); |
99 image_service->Prefetch(url); | 99 image_service->Prefetch(url); |
100 } | 100 } |
OLD | NEW |