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

Unified Diff: chrome/browser/ui/webui/engagement/site_engagement_ui.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.cc
diff --git a/chrome/browser/ui/webui/engagement/site_engagement_ui.cc b/chrome/browser/ui/webui/engagement/site_engagement_ui.cc
index f756bc59f93b81b61869cb2ac38a92a1fea84b89..0e7f49144a96ca2f6df5875e051117bc395756cf 100644
--- a/chrome/browser/ui/webui/engagement/site_engagement_ui.cc
+++ b/chrome/browser/ui/webui/engagement/site_engagement_ui.cc
@@ -4,62 +4,13 @@
#include "chrome/browser/ui/webui/engagement/site_engagement_ui.h"
-#include "chrome/browser/engagement/site_engagement_service.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/common/url_constants.h"
-#include "content/public/browser/web_ui.h"
-#include "content/public/browser/web_ui_controller.h"
#include "content/public/browser/web_ui_data_source.h"
#include "grit/browser_resources.h"
-#include "mojo/common/url_type_converters.h"
-#include "mojo/public/cpp/bindings/strong_binding.h"
-
-namespace {
-
-// Implementation of SiteEngagementUIHandler that gets information from the
-// SiteEngagementService to provide data for the WebUI.
-class SiteEngagementUIHandlerImpl : public SiteEngagementUIHandler {
- public:
- // SiteEngagementUIHandlerImpl is deleted when the supplied pipe is destroyed.
- SiteEngagementUIHandlerImpl(
- Profile* profile,
- mojo::InterfaceRequest<SiteEngagementUIHandler> request)
- : profile_(profile), binding_(this, request.Pass()) {
- DCHECK(profile_);
- }
-
- ~SiteEngagementUIHandlerImpl() override {}
-
- // SiteEngagementUIHandler overrides:
- void GetSiteEngagementInfo(
- const GetSiteEngagementInfoCallback& callback) override {
- 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(origin_info.Pass());
- }
-
- callback.Run(engagement_info.Pass());
- }
-
- private:
- // The Profile* handed to us in our constructor.
- Profile* profile_;
-
- mojo::StrongBinding<SiteEngagementUIHandler> binding_;
-
- DISALLOW_COPY_AND_ASSIGN(SiteEngagementUIHandlerImpl);
-};
-
-} // namespace
SiteEngagementUI::SiteEngagementUI(content::WebUI* web_ui)
- : MojoWebUIController<SiteEngagementUIHandler>(web_ui) {
+ : MojoWebUIController(web_ui) {
// Set up the chrome://site-engagement/ source.
scoped_ptr<content::WebUIDataSource> source(
content::WebUIDataSource::Create(chrome::kChromeUISiteEngagementHost));
@@ -80,9 +31,3 @@ SiteEngagementUI::SiteEngagementUI(content::WebUI* web_ui)
}
SiteEngagementUI::~SiteEngagementUI() {}
-
-void SiteEngagementUI::BindUIHandler(
- mojo::InterfaceRequest<SiteEngagementUIHandler> request) {
- // SiteEngagementUIHandlerImpl deletes itself when the pipe is closed.
- new SiteEngagementUIHandlerImpl(Profile::FromWebUI(web_ui()), request.Pass());
-}

Powered by Google App Engine
This is Rietveld 408576698