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/chrome_omnibox_client.h" | 5 #include "chrome/browser/ui/omnibox/chrome_omnibox_client.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 30 matching lines...) Expand all Loading... | |
41 #include "components/omnibox/browser/autocomplete_match.h" | 41 #include "components/omnibox/browser/autocomplete_match.h" |
42 #include "components/omnibox/browser/autocomplete_result.h" | 42 #include "components/omnibox/browser/autocomplete_result.h" |
43 #include "components/omnibox/browser/search_provider.h" | 43 #include "components/omnibox/browser/search_provider.h" |
44 #include "components/prefs/pref_service.h" | 44 #include "components/prefs/pref_service.h" |
45 #include "components/search/search.h" | 45 #include "components/search/search.h" |
46 #include "components/search_engines/template_url_service.h" | 46 #include "components/search_engines/template_url_service.h" |
47 #include "content/public/browser/navigation_controller.h" | 47 #include "content/public/browser/navigation_controller.h" |
48 #include "content/public/browser/navigation_entry.h" | 48 #include "content/public/browser/navigation_entry.h" |
49 #include "content/public/browser/web_contents.h" | 49 #include "content/public/browser/web_contents.h" |
50 #include "extensions/common/constants.h" | 50 #include "extensions/common/constants.h" |
51 #include "third_party/skia/include/core/SkBitmap.h" | |
Peter Kasting
2016/12/15 07:54:26
Nit: Is this an IWYU change?
Evan Stade
2016/12/15 23:49:02
more or less. It was relying on a transitive inclu
| |
51 #include "ui/base/window_open_disposition.h" | 52 #include "ui/base/window_open_disposition.h" |
52 #include "url/gurl.h" | 53 #include "url/gurl.h" |
53 | 54 |
54 using predictors::AutocompleteActionPredictor; | 55 using predictors::AutocompleteActionPredictor; |
55 | 56 |
56 namespace { | 57 namespace { |
57 | 58 |
58 // Returns the AutocompleteMatch that the InstantController should prefetch, if | 59 // Returns the AutocompleteMatch that the InstantController should prefetch, if |
59 // any. | 60 // any. |
60 // | 61 // |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
207 return AutocompleteClassifierFactory::GetForProfile(profile_); | 208 return AutocompleteClassifierFactory::GetForProfile(profile_); |
208 } | 209 } |
209 | 210 |
210 gfx::Image ChromeOmniboxClient::GetIconIfExtensionMatch( | 211 gfx::Image ChromeOmniboxClient::GetIconIfExtensionMatch( |
211 const AutocompleteMatch& match) const { | 212 const AutocompleteMatch& match) const { |
212 TemplateURLService* service = | 213 TemplateURLService* service = |
213 TemplateURLServiceFactory::GetForProfile(profile_); | 214 TemplateURLServiceFactory::GetForProfile(profile_); |
214 const TemplateURL* template_url = match.GetTemplateURL(service, false); | 215 const TemplateURL* template_url = match.GetTemplateURL(service, false); |
215 if (template_url && | 216 if (template_url && |
216 (template_url->type() == TemplateURL::OMNIBOX_API_EXTENSION)) { | 217 (template_url->type() == TemplateURL::OMNIBOX_API_EXTENSION)) { |
217 return extensions::OmniboxAPI::Get(profile_) | 218 return extensions::OmniboxAPI::Get(profile_)->GetOmniboxIcon( |
218 ->GetOmniboxPopupIcon(template_url->GetExtensionId()); | 219 template_url->GetExtensionId()); |
219 } | 220 } |
220 return gfx::Image(); | 221 return gfx::Image(); |
221 } | 222 } |
222 | 223 |
223 bool ChromeOmniboxClient::ProcessExtensionKeyword( | 224 bool ChromeOmniboxClient::ProcessExtensionKeyword( |
224 TemplateURL* template_url, | 225 TemplateURL* template_url, |
225 const AutocompleteMatch& match, | 226 const AutocompleteMatch& match, |
226 WindowOpenDisposition disposition, | 227 WindowOpenDisposition disposition, |
227 OmniboxNavigationObserver* observer) { | 228 OmniboxNavigationObserver* observer) { |
228 if (template_url->type() != TemplateURL::OMNIBOX_API_EXTENSION) | 229 if (template_url->type() != TemplateURL::OMNIBOX_API_EXTENSION) |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
452 InstantSearchPrerenderer::GetForProfile(profile_); | 453 InstantSearchPrerenderer::GetForProfile(profile_); |
453 if (prerenderer) | 454 if (prerenderer) |
454 prerenderer->Prerender(suggestion); | 455 prerenderer->Prerender(suggestion); |
455 } | 456 } |
456 | 457 |
457 void ChromeOmniboxClient::OnBitmapFetched(const BitmapFetchedCallback& callback, | 458 void ChromeOmniboxClient::OnBitmapFetched(const BitmapFetchedCallback& callback, |
458 const SkBitmap& bitmap) { | 459 const SkBitmap& bitmap) { |
459 request_id_ = BitmapFetcherService::REQUEST_ID_INVALID; | 460 request_id_ = BitmapFetcherService::REQUEST_ID_INVALID; |
460 callback.Run(bitmap); | 461 callback.Run(bitmap); |
461 } | 462 } |
OLD | NEW |