| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 #include <utility> | 8 #include <utility> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 | 49 |
| 50 return url.Resolve(kImageSizePath + image_filename); | 50 return url.Resolve(kImageSizePath + image_filename); |
| 51 } | 51 } |
| 52 | 52 |
| 53 } // namespace | 53 } // namespace |
| 54 | 54 |
| 55 namespace app_list { | 55 namespace app_list { |
| 56 | 56 |
| 57 PeopleResult::PeopleResult(Profile* profile, | 57 PeopleResult::PeopleResult(Profile* profile, |
| 58 AppListControllerDelegate* controller, | 58 AppListControllerDelegate* controller, |
| 59 scoped_ptr<Person> person) | 59 std::unique_ptr<Person> person) |
| 60 : profile_(profile), | 60 : profile_(profile), |
| 61 controller_(controller), | 61 controller_(controller), |
| 62 person_(std::move(person)), | 62 person_(std::move(person)), |
| 63 weak_factory_(this) { | 63 weak_factory_(this) { |
| 64 set_id(person_->id); | 64 set_id(person_->id); |
| 65 set_title(base::UTF8ToUTF16(person_->display_name)); | 65 set_title(base::UTF8ToUTF16(person_->display_name)); |
| 66 set_relevance(person_->interaction_rank); | 66 set_relevance(person_->interaction_rank); |
| 67 set_details(base::UTF8ToUTF16(person_->email)); | 67 set_details(base::UTF8ToUTF16(person_->email)); |
| 68 | 68 |
| 69 RefreshHangoutsExtensionId(); | 69 RefreshHangoutsExtensionId(); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 break; | 103 break; |
| 104 case 1: | 104 case 1: |
| 105 SendEmail(); | 105 SendEmail(); |
| 106 break; | 106 break; |
| 107 default: | 107 default: |
| 108 LOG(ERROR) << "Invalid people search action: " << action_index; | 108 LOG(ERROR) << "Invalid people search action: " << action_index; |
| 109 } | 109 } |
| 110 } | 110 } |
| 111 } | 111 } |
| 112 | 112 |
| 113 scoped_ptr<SearchResult> PeopleResult::Duplicate() const { | 113 std::unique_ptr<SearchResult> PeopleResult::Duplicate() const { |
| 114 return scoped_ptr<SearchResult>( | 114 return std::unique_ptr<SearchResult>( |
| 115 new PeopleResult(profile_, controller_, person_->Duplicate())); | 115 new PeopleResult(profile_, controller_, person_->Duplicate())); |
| 116 } | 116 } |
| 117 | 117 |
| 118 void PeopleResult::OnIconLoaded() { | 118 void PeopleResult::OnIconLoaded() { |
| 119 // Remove the existing image reps since the icon data is loaded and they | 119 // Remove the existing image reps since the icon data is loaded and they |
| 120 // need to be re-created. | 120 // need to be re-created. |
| 121 const std::vector<gfx::ImageSkiaRep>& image_reps = image_.image_reps(); | 121 const std::vector<gfx::ImageSkiaRep>& image_reps = image_.image_reps(); |
| 122 for (size_t i = 0; i < image_reps.size(); ++i) | 122 for (size_t i = 0; i < image_reps.size(); ++i) |
| 123 image_.RemoveRepresentation(image_reps[i].scale()); | 123 image_.RemoveRepresentation(image_reps[i].scale()); |
| 124 | 124 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 153 SigninManagerBase* signin_manager = | 153 SigninManagerBase* signin_manager = |
| 154 SigninManagerFactory::GetInstance()->GetForProfile(profile_); | 154 SigninManagerFactory::GetInstance()->GetForProfile(profile_); |
| 155 DCHECK(signin_manager); | 155 DCHECK(signin_manager); |
| 156 request.from = signin_manager->GetAuthenticatedAccountInfo().email; | 156 request.from = signin_manager->GetAuthenticatedAccountInfo().email; |
| 157 | 157 |
| 158 // to: list of users with whom to start this hangout is with. | 158 // to: list of users with whom to start this hangout is with. |
| 159 User target; | 159 User target; |
| 160 target.id = person_->owner_id; | 160 target.id = person_->owner_id; |
| 161 request.to.push_back(std::move(target)); | 161 request.to.push_back(std::move(target)); |
| 162 | 162 |
| 163 scoped_ptr<extensions::Event> event(new extensions::Event( | 163 std::unique_ptr<extensions::Event> event(new extensions::Event( |
| 164 extensions::events::HANGOUTS_PRIVATE_ON_HANGOUT_REQUESTED, | 164 extensions::events::HANGOUTS_PRIVATE_ON_HANGOUT_REQUESTED, |
| 165 OnHangoutRequested::kEventName, OnHangoutRequested::Create(request))); | 165 OnHangoutRequested::kEventName, OnHangoutRequested::Create(request))); |
| 166 | 166 |
| 167 // TODO(rkc): Change this once we remove the hangoutsPrivate API. | 167 // TODO(rkc): Change this once we remove the hangoutsPrivate API. |
| 168 // See crbug.com/306672 | 168 // See crbug.com/306672 |
| 169 extensions::EventRouter::Get(profile_) | 169 extensions::EventRouter::Get(profile_) |
| 170 ->DispatchEventToExtension(hangouts_extension_id_, std::move(event)); | 170 ->DispatchEventToExtension(hangouts_extension_id_, std::move(event)); |
| 171 | 171 |
| 172 content::RecordAction(base::UserMetricsAction("PeopleSearch_OpenChat")); | 172 content::RecordAction(base::UserMetricsAction("PeopleSearch_OpenChat")); |
| 173 } | 173 } |
| (...skipping 11 matching lines...) Expand all Loading... |
| 185 if (extensions::EventRouter::Get(profile_) | 185 if (extensions::EventRouter::Get(profile_) |
| 186 ->ExtensionHasEventListener(id, OnHangoutRequested::kEventName)) { | 186 ->ExtensionHasEventListener(id, OnHangoutRequested::kEventName)) { |
| 187 hangouts_extension_id_ = id; | 187 hangouts_extension_id_ = id; |
| 188 return; | 188 return; |
| 189 } | 189 } |
| 190 } | 190 } |
| 191 hangouts_extension_id_.clear(); | 191 hangouts_extension_id_.clear(); |
| 192 } | 192 } |
| 193 | 193 |
| 194 } // namespace app_list | 194 } // namespace app_list |
| OLD | NEW |