Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(537)

Side by Side Diff: chrome/browser/ui/webui/engagement/site_engagement_ui_handler.cc

Issue 1430313003: Change MojoWebUIController to use mojo::StrongBindingSet. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mojo-geolocation-untangle
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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 <utility>
8
9 #include "chrome/browser/engagement/site_engagement_service.h"
10 #include "chrome/browser/profiles/profile.h"
11 #include "mojo/common/url_type_converters.h"
12
13 // Implementation of SiteEngagementUIHandler that gets information from the
14 // SiteEngagementService to provide data for the WebUI.
15 SiteEngagementUIHandlerImpl::SiteEngagementUIHandlerImpl(content::WebUI* web_ui)
16 : profile_(Profile::FromWebUI(web_ui)) {
17 DCHECK(profile_);
18 }
19
20 SiteEngagementUIHandlerImpl::~SiteEngagementUIHandlerImpl() {}
21
22 // SiteEngagementUIHandler overrides:
23 void SiteEngagementUIHandlerImpl::GetSiteEngagementInfo(
24 const GetSiteEngagementInfoCallback& callback) {
25 mojo::Array<SiteEngagementInfoPtr> engagement_info(0);
26
27 SiteEngagementService* service = SiteEngagementService::Get(profile_);
28
29 for (const std::pair<GURL, double>& info : service->GetScoreMap()) {
30 SiteEngagementInfoPtr origin_info(SiteEngagementInfo::New());
31 origin_info->origin = mojo::String::From(info.first);
32 origin_info->score = info.second;
33 engagement_info.push_back(std::move(origin_info));
34 }
35
36 callback.Run(std::move(engagement_info));
37 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/engagement/site_engagement_ui_handler.h ('k') | chrome/browser/ui/webui/mojo_web_ui_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698