| 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/app_list/search/people/people_result.h" | 5 #include "chrome/browser/ui/app_list/search/people/people_result.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 #include "ui/base/resource/resource_bundle.h" | 26 #include "ui/base/resource/resource_bundle.h" |
| 27 | 27 |
| 28 namespace OnHangoutRequested = | 28 namespace OnHangoutRequested = |
| 29 extensions::api::hangouts_private::OnHangoutRequested; | 29 extensions::api::hangouts_private::OnHangoutRequested; |
| 30 | 30 |
| 31 using extensions::api::hangouts_private::User; | 31 using extensions::api::hangouts_private::User; |
| 32 using extensions::api::hangouts_private::HangoutRequest; | 32 using extensions::api::hangouts_private::HangoutRequest; |
| 33 | 33 |
| 34 namespace { | 34 namespace { |
| 35 | 35 |
| 36 const int kIconSize = 32; | |
| 37 const char kImageSizePath[] = "s64-p/"; | 36 const char kImageSizePath[] = "s64-p/"; |
| 38 const char kEmailUrlPrefix[] = "mailto:"; | 37 const char kEmailUrlPrefix[] = "mailto:"; |
| 39 | 38 |
| 40 const char* const kHangoutsExtensionIds[] = { | 39 const char* const kHangoutsExtensionIds[] = { |
| 41 "nckgahadagoaajjgafhacjanaoiihapd", | 40 "nckgahadagoaajjgafhacjanaoiihapd", |
| 42 "ljclpkphhpbpinifbeabbhlfddcpfdde", | 41 "ljclpkphhpbpinifbeabbhlfddcpfdde", |
| 43 "ppleadejekpmccmnpjdimmlfljlkdfej", | 42 "ppleadejekpmccmnpjdimmlfljlkdfej", |
| 44 "eggnbpckecmjlblplehfpjjdhhidfdoj", | 43 "eggnbpckecmjlblplehfpjjdhhidfdoj", |
| 45 "jfjjdfefebklmdbmenmlehlopoocnoeh", | 44 "jfjjdfefebklmdbmenmlehlopoocnoeh", |
| 46 "knipolnnllmklapflnccelgolnpehhpl" | 45 "knipolnnllmklapflnccelgolnpehhpl" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 64 PeopleResult::PeopleResult(Profile* profile, scoped_ptr<Person> person) | 63 PeopleResult::PeopleResult(Profile* profile, scoped_ptr<Person> person) |
| 65 : profile_(profile), person_(person.Pass()), weak_factory_(this) { | 64 : profile_(profile), person_(person.Pass()), weak_factory_(this) { |
| 66 set_id(person_->id); | 65 set_id(person_->id); |
| 67 set_title(base::UTF8ToUTF16(person_->display_name)); | 66 set_title(base::UTF8ToUTF16(person_->display_name)); |
| 68 set_relevance(person_->interaction_rank); | 67 set_relevance(person_->interaction_rank); |
| 69 set_details(base::UTF8ToUTF16(person_->email)); | 68 set_details(base::UTF8ToUTF16(person_->email)); |
| 70 | 69 |
| 71 RefreshHangoutsExtensionId(); | 70 RefreshHangoutsExtensionId(); |
| 72 SetDefaultActions(); | 71 SetDefaultActions(); |
| 73 | 72 |
| 73 int icon_size = GetPreferredIconSize(); |
| 74 image_ = gfx::ImageSkia( | 74 image_ = gfx::ImageSkia( |
| 75 new UrlIconSource(base::Bind(&PeopleResult::OnIconLoaded, | 75 new UrlIconSource( |
| 76 weak_factory_.GetWeakPtr()), | 76 base::Bind(&PeopleResult::OnIconLoaded, weak_factory_.GetWeakPtr()), |
| 77 profile_->GetRequestContext(), | 77 profile_->GetRequestContext(), |
| 78 GetImageUrl(person_->image_url), | 78 GetImageUrl(person_->image_url), |
| 79 kIconSize, | 79 icon_size, |
| 80 IDR_PROFILE_PICTURE_LOADING), | 80 IDR_PROFILE_PICTURE_LOADING), |
| 81 gfx::Size(kIconSize, kIconSize)); | 81 gfx::Size(icon_size, icon_size)); |
| 82 SetIcon(image_); | 82 SetIcon(image_); |
| 83 } | 83 } |
| 84 | 84 |
| 85 PeopleResult::~PeopleResult() { | 85 PeopleResult::~PeopleResult() { |
| 86 } | 86 } |
| 87 | 87 |
| 88 void PeopleResult::Open(int event_flags) { | 88 void PeopleResult::Open(int event_flags) { |
| 89 // Action 0 will always be our default action. | 89 // Action 0 will always be our default action. |
| 90 InvokeAction(0, event_flags); | 90 InvokeAction(0, event_flags); |
| 91 } | 91 } |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 } | 192 } |
| 193 } | 193 } |
| 194 hangouts_extension_id_.clear(); | 194 hangouts_extension_id_.clear(); |
| 195 } | 195 } |
| 196 | 196 |
| 197 ChromeSearchResultType PeopleResult::GetType() { | 197 ChromeSearchResultType PeopleResult::GetType() { |
| 198 return SEARCH_PEOPLE_SEARCH_RESULT; | 198 return SEARCH_PEOPLE_SEARCH_RESULT; |
| 199 } | 199 } |
| 200 | 200 |
| 201 } // namespace app_list | 201 } // namespace app_list |
| OLD | NEW |