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

Unified Diff: components/web_restrictions/browser/web_restrictions_mojo_implementation.cc

Issue 2326913003: Privatize StrongBinding lifetime management (Closed)
Patch Set: rebase Created 4 years, 3 months 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: components/web_restrictions/browser/web_restrictions_mojo_implementation.cc
diff --git a/components/web_restrictions/browser/web_restrictions_mojo_implementation.cc b/components/web_restrictions/browser/web_restrictions_mojo_implementation.cc
index bc0b8fef2c90416b84c543d4f0e46ff92eedcb5e..fe3b6809ae30c5df138a06253861eb505783944c 100644
--- a/components/web_restrictions/browser/web_restrictions_mojo_implementation.cc
+++ b/components/web_restrictions/browser/web_restrictions_mojo_implementation.cc
@@ -8,6 +8,7 @@
#include "base/bind.h"
#include "components/web_restrictions/browser/web_restrictions_client.h"
+#include "mojo/public/cpp/bindings/strong_binding.h"
namespace web_restrictions {
@@ -21,19 +22,20 @@ void ClientRequestPermissionCallback(
} // namespace
+WebRestrictionsMojoImplementation::WebRestrictionsMojoImplementation(
+ WebRestrictionsClient* client)
+ : web_restrictions_client_(client) {}
+
+WebRestrictionsMojoImplementation::~WebRestrictionsMojoImplementation() {}
+
void WebRestrictionsMojoImplementation::Create(
WebRestrictionsClient* client,
mojo::InterfaceRequest<mojom::WebRestrictions> request) {
- new WebRestrictionsMojoImplementation(client, std::move(request));
+ mojo::MakeStrongBinding(
+ base::MakeUnique<WebRestrictionsMojoImplementation>(client),
+ std::move(request));
}
-WebRestrictionsMojoImplementation::WebRestrictionsMojoImplementation(
- WebRestrictionsClient* client,
- mojo::InterfaceRequest<mojom::WebRestrictions> request)
- : binding_(this, std::move(request)), web_restrictions_client_(client) {}
-
-WebRestrictionsMojoImplementation::~WebRestrictionsMojoImplementation() {}
-
void WebRestrictionsMojoImplementation::GetResult(
const std::string& url,
const GetResultCallback& callback) {

Powered by Google App Engine
This is Rietveld 408576698