Chromium Code Reviews| 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 19 matching lines...) Expand all Loading... | |
| 30 extensions::api::hangouts_private::OnHangoutRequested; | 30 extensions::api::hangouts_private::OnHangoutRequested; |
| 31 | 31 |
| 32 using extensions::api::hangouts_private::User; | 32 using extensions::api::hangouts_private::User; |
| 33 using extensions::api::hangouts_private::HangoutRequest; | 33 using extensions::api::hangouts_private::HangoutRequest; |
| 34 | 34 |
| 35 namespace { | 35 namespace { |
| 36 | 36 |
| 37 const char kImageSizePath[] = "s64-p/"; | 37 const char kImageSizePath[] = "s64-p/"; |
| 38 const char kEmailUrlPrefix[] = "mailto:"; | 38 const char kEmailUrlPrefix[] = "mailto:"; |
| 39 | 39 |
| 40 const char* const kHangoutsExtensionIds[] = { | |
| 41 "nckgahadagoaajjgafhacjanaoiihapd", | |
| 42 "ljclpkphhpbpinifbeabbhlfddcpfdde", | |
| 43 "ppleadejekpmccmnpjdimmlfljlkdfej", | |
| 44 "eggnbpckecmjlblplehfpjjdhhidfdoj", | |
| 45 "jfjjdfefebklmdbmenmlehlopoocnoeh", | |
| 46 "knipolnnllmklapflnccelgolnpehhpl" | |
| 47 }; | |
| 48 | |
| 49 // Add a query parameter to specify the size to fetch the image in. The | 40 // Add a query parameter to specify the size to fetch the image in. The |
| 50 // original profile image can be of an arbitrary size, we ask the server to | 41 // original profile image can be of an arbitrary size, we ask the server to |
| 51 // crop it to a square 64x64 using its smart cropping algorithm. | 42 // crop it to a square 64x64 using its smart cropping algorithm. |
| 52 GURL GetImageUrl(const GURL& url) { | 43 GURL GetImageUrl(const GURL& url) { |
| 53 std::string image_filename = url.ExtractFileName(); | 44 std::string image_filename = url.ExtractFileName(); |
| 54 if (image_filename.empty()) | 45 if (image_filename.empty()) |
| 55 return url; | 46 return url; |
| 56 | 47 |
| 57 return url.Resolve(kImageSizePath + image_filename); | 48 return url.Resolve(kImageSizePath + image_filename); |
| 58 } | 49 } |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 181 | 172 |
| 182 void PeopleResult::SendEmail() { | 173 void PeopleResult::SendEmail() { |
| 183 controller_->OpenURL(profile_, | 174 controller_->OpenURL(profile_, |
| 184 GURL(kEmailUrlPrefix + person_->email), | 175 GURL(kEmailUrlPrefix + person_->email), |
| 185 ui::PAGE_TRANSITION_LINK, | 176 ui::PAGE_TRANSITION_LINK, |
| 186 NEW_FOREGROUND_TAB); | 177 NEW_FOREGROUND_TAB); |
| 187 content::RecordAction(base::UserMetricsAction("PeopleSearch_SendEmail")); | 178 content::RecordAction(base::UserMetricsAction("PeopleSearch_SendEmail")); |
| 188 } | 179 } |
| 189 | 180 |
| 190 void PeopleResult::RefreshHangoutsExtensionId() { | 181 void PeopleResult::RefreshHangoutsExtensionId() { |
| 191 // TODO(rkc): Change this once we remove the hangoutsPrivate API. | 182 for (const char* id : extension_misc::kHangoutsExtensionIds) { |
| 192 // See crbug.com/306672 | 183 if (extensions::EventRouter::Get(profile_) |
|
tapted
2015/09/07 05:30:27
This has been closed WontFix, so I don't think thi
| |
| 193 for (size_t i = 0; i < arraysize(kHangoutsExtensionIds); ++i) { | 184 ->ExtensionHasEventListener(id, OnHangoutRequested::kEventName)) { |
| 194 if (extensions::EventRouter::Get(profile_)->ExtensionHasEventListener( | 185 hangouts_extension_id_ = id; |
| 195 kHangoutsExtensionIds[i], OnHangoutRequested::kEventName)) { | |
| 196 hangouts_extension_id_ = kHangoutsExtensionIds[i]; | |
| 197 return; | 186 return; |
| 198 } | 187 } |
| 199 } | 188 } |
| 200 hangouts_extension_id_.clear(); | 189 hangouts_extension_id_.clear(); |
| 201 } | 190 } |
| 202 | 191 |
| 203 } // namespace app_list | 192 } // namespace app_list |
| OLD | NEW |