| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/ui/omnibox/omnibox_controller.h" | 5 #include "chrome/browser/ui/omnibox/omnibox_controller.h" |
| 6 | 6 |
| 7 #include "base/metrics/histogram.h" | 7 #include "base/metrics/histogram.h" |
| 8 #include "chrome/browser/autocomplete/autocomplete_classifier.h" | 8 #include "chrome/browser/autocomplete/autocomplete_classifier.h" |
| 9 #include "chrome/browser/autocomplete/chrome_autocomplete_provider_client.h" |
| 9 #include "chrome/browser/bitmap_fetcher/bitmap_fetcher_service_factory.h" | 10 #include "chrome/browser/bitmap_fetcher/bitmap_fetcher_service_factory.h" |
| 10 #include "chrome/browser/net/predictor.h" | 11 #include "chrome/browser/net/predictor.h" |
| 11 #include "chrome/browser/predictors/autocomplete_action_predictor.h" | 12 #include "chrome/browser/predictors/autocomplete_action_predictor.h" |
| 12 #include "chrome/browser/prerender/prerender_field_trial.h" | 13 #include "chrome/browser/prerender/prerender_field_trial.h" |
| 13 #include "chrome/browser/prerender/prerender_manager.h" | 14 #include "chrome/browser/prerender/prerender_manager.h" |
| 14 #include "chrome/browser/prerender/prerender_manager_factory.h" | 15 #include "chrome/browser/prerender/prerender_manager_factory.h" |
| 15 #include "chrome/browser/profiles/profile.h" | 16 #include "chrome/browser/profiles/profile.h" |
| 16 #include "chrome/browser/profiles/profile_manager.h" | 17 #include "chrome/browser/profiles/profile_manager.h" |
| 17 #include "chrome/browser/search/search.h" | 18 #include "chrome/browser/search/search.h" |
| 18 #include "chrome/browser/search_engines/template_url_service_factory.h" | 19 #include "chrome/browser/search_engines/template_url_service_factory.h" |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 } | 95 } |
| 95 | 96 |
| 96 } // namespace | 97 } // namespace |
| 97 | 98 |
| 98 OmniboxController::OmniboxController(OmniboxEditModel* omnibox_edit_model, | 99 OmniboxController::OmniboxController(OmniboxEditModel* omnibox_edit_model, |
| 99 Profile* profile) | 100 Profile* profile) |
| 100 : omnibox_edit_model_(omnibox_edit_model), | 101 : omnibox_edit_model_(omnibox_edit_model), |
| 101 profile_(profile), | 102 profile_(profile), |
| 102 popup_(NULL), | 103 popup_(NULL), |
| 103 autocomplete_controller_(new AutocompleteController( | 104 autocomplete_controller_(new AutocompleteController( |
| 104 profile, | 105 make_scoped_ptr(new ChromeAutocompleteProviderClient(profile)), |
| 105 TemplateURLServiceFactory::GetForProfile(profile), | |
| 106 this, | 106 this, |
| 107 AutocompleteClassifier::kDefaultOmniboxProviders)), | 107 AutocompleteClassifier::kDefaultOmniboxProviders)), |
| 108 request_id_(BitmapFetcherService::REQUEST_ID_INVALID), | 108 request_id_(BitmapFetcherService::REQUEST_ID_INVALID), |
| 109 weak_ptr_factory_(this) { | 109 weak_ptr_factory_(this) { |
| 110 } | 110 } |
| 111 | 111 |
| 112 OmniboxController::~OmniboxController() { | 112 OmniboxController::~OmniboxController() { |
| 113 BitmapFetcherService* image_service = | 113 BitmapFetcherService* image_service = |
| 114 BitmapFetcherServiceFactory::GetForBrowserContext(profile_); | 114 BitmapFetcherServiceFactory::GetForBrowserContext(profile_); |
| 115 if (image_service) | 115 if (image_service) |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 // We could prefetch the alternate nav URL, if any, but because there | 209 // We could prefetch the alternate nav URL, if any, but because there |
| 210 // can be many of these as a user types an initial series of characters, | 210 // can be many of these as a user types an initial series of characters, |
| 211 // the OS DNS cache could suffer eviction problems for minimal gain. | 211 // the OS DNS cache could suffer eviction problems for minimal gain. |
| 212 } | 212 } |
| 213 } | 213 } |
| 214 | 214 |
| 215 void OmniboxController::SetAnswerBitmap(const SkBitmap& bitmap) { | 215 void OmniboxController::SetAnswerBitmap(const SkBitmap& bitmap) { |
| 216 request_id_ = BitmapFetcherService::REQUEST_ID_INVALID; | 216 request_id_ = BitmapFetcherService::REQUEST_ID_INVALID; |
| 217 popup_->SetAnswerBitmap(bitmap); | 217 popup_->SetAnswerBitmap(bitmap); |
| 218 } | 218 } |
| OLD | NEW |