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 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 AutocompleteClassifier* ChromeOmniboxClient::GetAutocompleteClassifier() { | 205 AutocompleteClassifier* ChromeOmniboxClient::GetAutocompleteClassifier() { |
206 return AutocompleteClassifierFactory::GetForProfile(profile_); | 206 return AutocompleteClassifierFactory::GetForProfile(profile_); |
207 } | 207 } |
208 | 208 |
209 gfx::Image ChromeOmniboxClient::GetIconIfExtensionMatch( | 209 gfx::Image ChromeOmniboxClient::GetIconIfExtensionMatch( |
210 const AutocompleteMatch& match) const { | 210 const AutocompleteMatch& match) const { |
211 TemplateURLService* service = | 211 TemplateURLService* service = |
212 TemplateURLServiceFactory::GetForProfile(profile_); | 212 TemplateURLServiceFactory::GetForProfile(profile_); |
213 const TemplateURL* template_url = match.GetTemplateURL(service, false); | 213 const TemplateURL* template_url = match.GetTemplateURL(service, false); |
214 if (template_url && | 214 if (template_url && |
215 (template_url->GetType() == TemplateURL::OMNIBOX_API_EXTENSION)) { | 215 (template_url->type() == TemplateURL::OMNIBOX_API_EXTENSION)) { |
216 return extensions::OmniboxAPI::Get(profile_) | 216 return extensions::OmniboxAPI::Get(profile_) |
217 ->GetOmniboxPopupIcon(template_url->GetExtensionId()); | 217 ->GetOmniboxPopupIcon(template_url->GetExtensionId()); |
218 } | 218 } |
219 return gfx::Image(); | 219 return gfx::Image(); |
220 } | 220 } |
221 | 221 |
222 bool ChromeOmniboxClient::ProcessExtensionKeyword( | 222 bool ChromeOmniboxClient::ProcessExtensionKeyword( |
223 TemplateURL* template_url, | 223 TemplateURL* template_url, |
224 const AutocompleteMatch& match, | 224 const AutocompleteMatch& match, |
225 WindowOpenDisposition disposition, | 225 WindowOpenDisposition disposition, |
226 OmniboxNavigationObserver* observer) { | 226 OmniboxNavigationObserver* observer) { |
227 if (template_url->GetType() != TemplateURL::OMNIBOX_API_EXTENSION) | 227 if (template_url->type() != TemplateURL::OMNIBOX_API_EXTENSION) |
228 return false; | 228 return false; |
229 | 229 |
230 // Strip the keyword + leading space off the input, but don't exceed | 230 // Strip the keyword + leading space off the input, but don't exceed |
231 // fill_into_edit. An obvious case is that the user may not have entered | 231 // fill_into_edit. An obvious case is that the user may not have entered |
232 // a leading space and is asking to launch this extension without any | 232 // a leading space and is asking to launch this extension without any |
233 // additional input. | 233 // additional input. |
234 size_t prefix_length = | 234 size_t prefix_length = |
235 std::min(match.keyword.length() + 1, match.fill_into_edit.length()); | 235 std::min(match.keyword.length() + 1, match.fill_into_edit.length()); |
236 extensions::ExtensionOmniboxEventRouter::OnInputEntered( | 236 extensions::ExtensionOmniboxEventRouter::OnInputEntered( |
237 controller_->GetWebContents(), | 237 controller_->GetWebContents(), |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
451 InstantSearchPrerenderer::GetForProfile(profile_); | 451 InstantSearchPrerenderer::GetForProfile(profile_); |
452 if (prerenderer) | 452 if (prerenderer) |
453 prerenderer->Prerender(suggestion); | 453 prerenderer->Prerender(suggestion); |
454 } | 454 } |
455 | 455 |
456 void ChromeOmniboxClient::OnBitmapFetched(const BitmapFetchedCallback& callback, | 456 void ChromeOmniboxClient::OnBitmapFetched(const BitmapFetchedCallback& callback, |
457 const SkBitmap& bitmap) { | 457 const SkBitmap& bitmap) { |
458 request_id_ = BitmapFetcherService::REQUEST_ID_INVALID; | 458 request_id_ = BitmapFetcherService::REQUEST_ID_INVALID; |
459 callback.Run(bitmap); | 459 callback.Run(bitmap); |
460 } | 460 } |
OLD | NEW |