OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/app_list/search_builder.h" | 5 #include "chrome/browser/ui/app_list/search_builder.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
11 #include "chrome/browser/autocomplete/autocomplete_classifier.h" | 11 #include "chrome/browser/autocomplete/autocomplete_classifier.h" |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 *bundle.GetImageSkiaNamed(IDR_CONTACT_ACTION_EMAIL), | 247 *bundle.GetImageSkiaNamed(IDR_CONTACT_ACTION_EMAIL), |
248 *bundle.GetImageSkiaNamed(IDR_CONTACT_ACTION_EMAIL_H), | 248 *bundle.GetImageSkiaNamed(IDR_CONTACT_ACTION_EMAIL_H), |
249 *bundle.GetImageSkiaNamed(IDR_CONTACT_ACTION_EMAIL), | 249 *bundle.GetImageSkiaNamed(IDR_CONTACT_ACTION_EMAIL), |
250 l10n_util::GetStringUTF16(IDS_APP_LIST_CONTACT_EMAIL_TOOLTIP))); | 250 l10n_util::GetStringUTF16(IDS_APP_LIST_CONTACT_EMAIL_TOOLTIP))); |
251 SetActionIcons(icons); | 251 SetActionIcons(icons); |
252 } | 252 } |
253 | 253 |
254 protected: | 254 protected: |
255 // Overridden from SearchBuilderResult: | 255 // Overridden from SearchBuilderResult: |
256 virtual void UpdateIcon() OVERRIDE { | 256 virtual void UpdateIcon() OVERRIDE { |
| 257 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
257 const contacts::Contact* contact = GetContact(); | 258 const contacts::Contact* contact = GetContact(); |
258 if (contact && contact->has_raw_untrusted_photo()) { | 259 if (contact && contact->has_raw_untrusted_photo()) { |
259 photo_decoder_ = | 260 photo_decoder_ = |
260 new ImageDecoder( | 261 new ImageDecoder( |
261 this, | 262 this, |
262 contact->raw_untrusted_photo(), | 263 contact->raw_untrusted_photo(), |
263 ImageDecoder::DEFAULT_CODEC); | 264 ImageDecoder::DEFAULT_CODEC); |
264 photo_decoder_->Start(); | 265 scoped_refptr<base::MessageLoopProxy> task_runner = |
| 266 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI); |
| 267 photo_decoder_->Start(task_runner); |
265 } else { | 268 } else { |
266 SetIcon( | 269 SetIcon( |
267 *ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed( | 270 *ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed( |
268 IDR_CONTACT_DEFAULT_PHOTO)); | 271 IDR_CONTACT_DEFAULT_PHOTO)); |
269 } | 272 } |
270 } | 273 } |
271 | 274 |
272 private: | 275 private: |
273 // Overridden from ImageDecoder::Delegate: | 276 // Overridden from ImageDecoder::Delegate: |
274 virtual void OnImageDecoded(const ImageDecoder* decoder, | 277 virtual void OnImageDecoded(const ImageDecoder* decoder, |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
438 result->Init(profile_, *it); | 441 result->Init(profile_, *it); |
439 results_->Add(result); | 442 results_->Add(result); |
440 } | 443 } |
441 } | 444 } |
442 | 445 |
443 void SearchBuilder::OnResultChanged(bool default_match_changed) { | 446 void SearchBuilder::OnResultChanged(bool default_match_changed) { |
444 // TODO(xiyuan): Handle default match properly. | 447 // TODO(xiyuan): Handle default match properly. |
445 const AutocompleteResult& ac_result = controller_->result(); | 448 const AutocompleteResult& ac_result = controller_->result(); |
446 PopulateFromACResult(ac_result); | 449 PopulateFromACResult(ac_result); |
447 } | 450 } |
OLD | NEW |