Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "chrome/browser/ui/webui/engagement/site_engagement_ui_handler.h" | |
| 6 | |
| 7 #include "chrome/browser/engagement/site_engagement_service.h" | |
| 8 #include "mojo/common/common_type_converters.h" | |
| 9 #include "url/gurl.h" | |
| 10 | |
| 11 SiteEngagementUIHandler::SiteEngagementUIHandler( | |
| 12 Profile* profile, | |
| 13 mojo::InterfaceRequest<SiteEngagementUIHandlerMojo> request) | |
| 14 : profile_(profile), binding_(this, request.Pass()) {} | |
| 15 | |
| 16 SiteEngagementUIHandler::~SiteEngagementUIHandler() {} | |
| 17 | |
| 18 void SiteEngagementUIHandler::GetSiteEngagementInfo( | |
| 19 const GetSiteEngagementInfoCallback& callback) { | |
| 20 mojo::Array<SiteEngagementInfoPtr> engagement_info; | |
|
Sam McNally
2015/09/08 08:25:47
You probably need to resize this to 0. Otherwise,
calamity
2015/09/10 06:57:33
Done.
| |
| 21 | |
| 22 SiteEngagementService* service = SiteEngagementService::Get(profile_); | |
| 23 DCHECK(service); | |
| 24 | |
| 25 for (auto info : service->GetScoreMap()) { | |
| 26 SiteEngagementInfoPtr origin_info(SiteEngagementInfo::New()); | |
| 27 origin_info->origin = mojo::String::From(info.first.spec()); | |
|
Sam McNally
2015/09/08 08:25:47
#include "mojo/common/url_type_converters.h" and c
calamity
2015/09/10 06:57:33
Done.
| |
| 28 origin_info->score = info.second; | |
| 29 engagement_info.push_back(origin_info.Pass()); | |
| 30 } | |
| 31 | |
| 32 callback.Run(engagement_info.Pass()); | |
| 33 } | |
| OLD | NEW |