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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/webui/engagement/site_engagement_ui_handler.cc
diff --git a/chrome/browser/ui/webui/engagement/site_engagement_ui_handler.cc b/chrome/browser/ui/webui/engagement/site_engagement_ui_handler.cc
new file mode 100644
index 0000000000000000000000000000000000000000..1272d2f418f3b25d8fc0ccf6960a414b8d37a1f1
--- /dev/null
+++ b/chrome/browser/ui/webui/engagement/site_engagement_ui_handler.cc
@@ -0,0 +1,37 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/ui/webui/engagement/site_engagement_ui_handler.h"
+
+#include <utility>
+
+#include "chrome/browser/engagement/site_engagement_service.h"
+#include "chrome/browser/profiles/profile.h"
+#include "mojo/common/url_type_converters.h"
+
+// Implementation of SiteEngagementUIHandler that gets information from the
+// SiteEngagementService to provide data for the WebUI.
+SiteEngagementUIHandlerImpl::SiteEngagementUIHandlerImpl(content::WebUI* web_ui)
+ : profile_(Profile::FromWebUI(web_ui)) {
+ DCHECK(profile_);
+}
+
+SiteEngagementUIHandlerImpl::~SiteEngagementUIHandlerImpl() {}
+
+// SiteEngagementUIHandler overrides:
+void SiteEngagementUIHandlerImpl::GetSiteEngagementInfo(
+ const GetSiteEngagementInfoCallback& callback) {
+ mojo::Array<SiteEngagementInfoPtr> engagement_info(0);
+
+ SiteEngagementService* service = SiteEngagementService::Get(profile_);
+
+ for (const std::pair<GURL, double>& info : service->GetScoreMap()) {
+ SiteEngagementInfoPtr origin_info(SiteEngagementInfo::New());
+ origin_info->origin = mojo::String::From(info.first);
+ origin_info->score = info.second;
+ engagement_info.push_back(std::move(origin_info));
+ }
+
+ callback.Run(std::move(engagement_info));
+}
« 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