| 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_delegate.h" | 5 #include "chrome/browser/autocomplete/chrome_autocomplete_provider_delegate.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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 return scheme_classifier_; | 51 return scheme_classifier_; |
| 52 } | 52 } |
| 53 | 53 |
| 54 void ChromeAutocompleteProviderDelegate::Classify( | 54 void ChromeAutocompleteProviderDelegate::Classify( |
| 55 const base::string16& text, | 55 const base::string16& text, |
| 56 bool prefer_keyword, | 56 bool prefer_keyword, |
| 57 bool allow_exact_keyword_match, | 57 bool allow_exact_keyword_match, |
| 58 metrics::OmniboxEventProto::PageClassification page_classification, | 58 metrics::OmniboxEventProto::PageClassification page_classification, |
| 59 AutocompleteMatch* match, | 59 AutocompleteMatch* match, |
| 60 GURL* alternate_nav_url) { | 60 GURL* alternate_nav_url) { |
| 61 AutocompleteClassifierFactory::GetForProfile(profile_)->Classify( | 61 AutocompleteClassifier* classifier = |
| 62 text, prefer_keyword, allow_exact_keyword_match, page_classification, | 62 AutocompleteClassifierFactory::GetForProfile(profile_); |
| 63 match, alternate_nav_url); | 63 DCHECK(classifier); |
| 64 classifier->Classify(text, prefer_keyword, allow_exact_keyword_match, |
| 65 page_classification, match, alternate_nav_url); |
| 64 } | 66 } |
| 65 | 67 |
| 66 history::URLDatabase* ChromeAutocompleteProviderDelegate::InMemoryDatabase() { | 68 history::URLDatabase* ChromeAutocompleteProviderDelegate::InMemoryDatabase() { |
| 67 HistoryService* history_service = | 69 HistoryService* history_service = |
| 68 HistoryServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS); | 70 HistoryServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS); |
| 69 return history_service ? history_service->InMemoryDatabase() : NULL; | 71 return history_service ? history_service->InMemoryDatabase() : NULL; |
| 70 } | 72 } |
| 71 | 73 |
| 72 void | 74 void |
| 73 ChromeAutocompleteProviderDelegate::DeleteMatchingURLsForKeywordFromHistory( | 75 ChromeAutocompleteProviderDelegate::DeleteMatchingURLsForKeywordFromHistory( |
| (...skipping 14 matching lines...) Expand all Loading... |
| 88 syncer::PROXY_TABS) && | 90 syncer::PROXY_TABS) && |
| 89 !service->GetEncryptedDataTypes().Has(syncer::SESSIONS); | 91 !service->GetEncryptedDataTypes().Has(syncer::SESSIONS); |
| 90 } | 92 } |
| 91 | 93 |
| 92 void ChromeAutocompleteProviderDelegate::PrefetchImage(const GURL& url) { | 94 void ChromeAutocompleteProviderDelegate::PrefetchImage(const GURL& url) { |
| 93 BitmapFetcherService* image_service = | 95 BitmapFetcherService* image_service = |
| 94 BitmapFetcherServiceFactory::GetForBrowserContext(profile_); | 96 BitmapFetcherServiceFactory::GetForBrowserContext(profile_); |
| 95 DCHECK(image_service); | 97 DCHECK(image_service); |
| 96 image_service->Prefetch(url); | 98 image_service->Prefetch(url); |
| 97 } | 99 } |
| OLD | NEW |