Commit 59ff61b8 authored by Henrique Ferreiro's avatar Henrique Ferreiro Committed by Commit Bot

Migrate SiteEngagementDetailsProvider to the new Mojo types

Convert the implementation and all users of the
mojom::SiteEngagementDetailsProvider interface.

Bug: 955171
Change-Id: I73e3cff072d5a9bfdcda98b668822dacfba59ba5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1803290Reviewed-by: default avatarRebekah Potter <rbpotter@chromium.org>
Reviewed-by: default avatarOksana Zhuravlova <oksamyt@chromium.org>
Commit-Queue: Henrique Ferreiro <hferreiro@igalia.com>
Cr-Commit-Position: refs/heads/master@{#696978}
parent 2093640a
...@@ -5,12 +5,14 @@ ...@@ -5,12 +5,14 @@
#include "chrome/browser/ui/webui/engagement/site_engagement_ui.h" #include "chrome/browser/ui/webui/engagement/site_engagement_ui.h"
#include <cmath> #include <cmath>
#include <memory>
#include <utility> #include <utility>
#include <vector> #include <vector>
#include "base/bind.h" #include "base/bind.h"
#include "base/callback.h" #include "base/callback.h"
#include "base/macros.h" #include "base/macros.h"
#include "chrome/browser/engagement/site_engagement_details.mojom.h"
#include "chrome/browser/engagement/site_engagement_service.h" #include "chrome/browser/engagement/site_engagement_service.h"
#include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile.h"
#include "chrome/common/url_constants.h" #include "chrome/common/url_constants.h"
...@@ -18,7 +20,8 @@ ...@@ -18,7 +20,8 @@
#include "content/public/browser/web_ui.h" #include "content/public/browser/web_ui.h"
#include "content/public/browser/web_ui_controller.h" #include "content/public/browser/web_ui_controller.h"
#include "content/public/browser/web_ui_data_source.h" #include "content/public/browser/web_ui_data_source.h"
#include "mojo/public/cpp/bindings/binding.h" #include "mojo/public/cpp/bindings/pending_receiver.h"
#include "mojo/public/cpp/bindings/receiver.h"
namespace { namespace {
...@@ -30,8 +33,8 @@ class SiteEngagementDetailsProviderImpl ...@@ -30,8 +33,8 @@ class SiteEngagementDetailsProviderImpl
// Instance is deleted when the supplied pipe is destroyed. // Instance is deleted when the supplied pipe is destroyed.
SiteEngagementDetailsProviderImpl( SiteEngagementDetailsProviderImpl(
Profile* profile, Profile* profile,
mojo::InterfaceRequest<mojom::SiteEngagementDetailsProvider> request) mojo::PendingReceiver<mojom::SiteEngagementDetailsProvider> receiver)
: profile_(profile), binding_(this, std::move(request)) { : profile_(profile), receiver_(this, std::move(receiver)) {
DCHECK(profile_); DCHECK(profile_);
} }
...@@ -70,7 +73,7 @@ class SiteEngagementDetailsProviderImpl ...@@ -70,7 +73,7 @@ class SiteEngagementDetailsProviderImpl
// The Profile* handed to us in our constructor. // The Profile* handed to us in our constructor.
Profile* profile_; Profile* profile_;
mojo::Binding<mojom::SiteEngagementDetailsProvider> binding_; mojo::Receiver<mojom::SiteEngagementDetailsProvider> receiver_;
DISALLOW_COPY_AND_ASSIGN(SiteEngagementDetailsProviderImpl); DISALLOW_COPY_AND_ASSIGN(SiteEngagementDetailsProviderImpl);
}; };
...@@ -97,7 +100,7 @@ SiteEngagementUI::SiteEngagementUI(content::WebUI* web_ui) ...@@ -97,7 +100,7 @@ SiteEngagementUI::SiteEngagementUI(content::WebUI* web_ui)
SiteEngagementUI::~SiteEngagementUI() {} SiteEngagementUI::~SiteEngagementUI() {}
void SiteEngagementUI::BindSiteEngagementDetailsProvider( void SiteEngagementUI::BindSiteEngagementDetailsProvider(
mojom::SiteEngagementDetailsProviderRequest request) { mojo::PendingReceiver<mojom::SiteEngagementDetailsProvider> receiver) {
ui_handler_ = std::make_unique<SiteEngagementDetailsProviderImpl>( ui_handler_ = std::make_unique<SiteEngagementDetailsProviderImpl>(
Profile::FromWebUI(web_ui()), std::move(request)); Profile::FromWebUI(web_ui()), std::move(receiver));
} }
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include "base/macros.h" #include "base/macros.h"
#include "chrome/browser/engagement/site_engagement_details.mojom.h" #include "chrome/browser/engagement/site_engagement_details.mojom.h"
#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "ui/webui/mojo_web_ui_controller.h" #include "ui/webui/mojo_web_ui_controller.h"
// The UI for chrome://site-engagement/. // The UI for chrome://site-engagement/.
...@@ -17,7 +18,7 @@ class SiteEngagementUI : public ui::MojoWebUIController { ...@@ -17,7 +18,7 @@ class SiteEngagementUI : public ui::MojoWebUIController {
private: private:
void BindSiteEngagementDetailsProvider( void BindSiteEngagementDetailsProvider(
mojom::SiteEngagementDetailsProviderRequest request); mojo::PendingReceiver<mojom::SiteEngagementDetailsProvider> receiver);
std::unique_ptr<mojom::SiteEngagementDetailsProvider> ui_handler_; std::unique_ptr<mojom::SiteEngagementDetailsProvider> ui_handler_;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment