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

Unified Diff: extensions/browser/api/mime_handler_private/mime_handler_private.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: extensions/browser/api/mime_handler_private/mime_handler_private.cc
diff --git a/extensions/browser/api/mime_handler_private/mime_handler_private.cc b/extensions/browser/api/mime_handler_private/mime_handler_private.cc
index 229ea83b6c0844c23f077978aa3431744df7cd2f..b24bf8d257643166084c0888ed01627fb81c9525 100644
--- a/extensions/browser/api/mime_handler_private/mime_handler_private.cc
+++ b/extensions/browser/api/mime_handler_private/mime_handler_private.cc
@@ -13,6 +13,7 @@
#include "extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.h"
#include "extensions/common/constants.h"
#include "mojo/public/cpp/bindings/map.h"
+#include "mojo/public/cpp/bindings/strong_binding.h"
#include "net/http/http_response_headers.h"
namespace extensions {
@@ -47,21 +48,19 @@ mojo::Map<mojo::String, mojo::String> CreateResponseHeadersMap(
} // namespace
+MimeHandlerServiceImpl::MimeHandlerServiceImpl(
+ base::WeakPtr<StreamContainer> stream_container)
+ : stream_(stream_container), weak_factory_(this) {}
+
+MimeHandlerServiceImpl::~MimeHandlerServiceImpl() {}
+
// static
void MimeHandlerServiceImpl::Create(
base::WeakPtr<StreamContainer> stream_container,
- mojo::InterfaceRequest<mime_handler::MimeHandlerService> request) {
- new MimeHandlerServiceImpl(stream_container, std::move(request));
-}
-
-MimeHandlerServiceImpl::MimeHandlerServiceImpl(
- base::WeakPtr<StreamContainer> stream_container,
- mojo::InterfaceRequest<mime_handler::MimeHandlerService> request)
- : stream_(stream_container),
- binding_(this, std::move(request)),
- weak_factory_(this) {}
-
-MimeHandlerServiceImpl::~MimeHandlerServiceImpl() {
+ mime_handler::MimeHandlerServiceRequest request) {
+ mojo::MakeStrongBinding(
+ base::MakeUnique<MimeHandlerServiceImpl>(stream_container),
+ std::move(request));
}
void MimeHandlerServiceImpl::GetStreamInfo(

Powered by Google App Engine
This is Rietveld 408576698