Commit 4f119d8b authored by xhwang's avatar xhwang Committed by Commit bot

Use mojo::StrongBinding in PlatformVerificationImpl.

mojo::InterfaceImpl is being deprecated. See bug for details.

BUG=489756,479836

Review URL: https://codereview.chromium.org/1133493007

Cr-Commit-Position: refs/heads/master@{#330607}
parent e981c21c
...@@ -5,27 +5,30 @@ ...@@ -5,27 +5,30 @@
#include "chrome/browser/chromeos/attestation/platform_verification_impl.h" #include "chrome/browser/chromeos/attestation/platform_verification_impl.h"
#include "content/public/browser/browser_thread.h" #include "content/public/browser/browser_thread.h"
#include "content/public/browser/web_contents.h" #include "content/public/browser/web_contents.h"
#include "third_party/mojo/src/mojo/public/cpp/bindings/interface_impl.h"
namespace chromeos { namespace chromeos {
namespace attestation { namespace attestation {
using media::interfaces::PlatformVerification;
// static // static
void PlatformVerificationImpl::Create( void PlatformVerificationImpl::Create(
content::RenderFrameHost* render_frame_host, content::RenderFrameHost* render_frame_host,
mojo::InterfaceRequest<media::interfaces::PlatformVerification> request) { mojo::InterfaceRequest<PlatformVerification> request) {
DVLOG(2) << __FUNCTION__; DVLOG(2) << __FUNCTION__;
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
DCHECK(render_frame_host); DCHECK(render_frame_host);
// The created object is bound to (and owned by) the pipe. // The created object is strongly bound to (and owned by) the pipe.
mojo::BindToRequest(new PlatformVerificationImpl(render_frame_host), new PlatformVerificationImpl(render_frame_host, request.Pass());
&request);
} }
PlatformVerificationImpl::PlatformVerificationImpl( PlatformVerificationImpl::PlatformVerificationImpl(
content::RenderFrameHost* render_frame_host) content::RenderFrameHost* render_frame_host,
: render_frame_host_(render_frame_host), weak_factory_(this) { mojo::InterfaceRequest<PlatformVerification> request)
: binding_(this, request.Pass()),
render_frame_host_(render_frame_host),
weak_factory_(this) {
DCHECK(render_frame_host); DCHECK(render_frame_host);
} }
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
#include "chrome/browser/chromeos/attestation/platform_verification_flow.h" #include "chrome/browser/chromeos/attestation/platform_verification_flow.h"
#include "content/public/browser/render_frame_host.h" #include "content/public/browser/render_frame_host.h"
#include "media/mojo/interfaces/platform_verification.mojom.h" #include "media/mojo/interfaces/platform_verification.mojom.h"
#include "third_party/mojo/src/mojo/public/cpp/bindings/interface_impl.h" #include "third_party/mojo/src/mojo/public/cpp/bindings/strong_binding.h"
namespace chromeos { namespace chromeos {
namespace attestation { namespace attestation {
...@@ -22,14 +22,15 @@ namespace attestation { ...@@ -22,14 +22,15 @@ namespace attestation {
// PlatformVerificationFlow. Can only be used on the UI thread because // PlatformVerificationFlow. Can only be used on the UI thread because
// PlatformVerificationFlow lives on the UI thread. // PlatformVerificationFlow lives on the UI thread.
class PlatformVerificationImpl class PlatformVerificationImpl
: public mojo::InterfaceImpl<media::interfaces::PlatformVerification> { : public media::interfaces::PlatformVerification {
public: public:
static void Create( static void Create(
content::RenderFrameHost* render_frame_host, content::RenderFrameHost* render_frame_host,
mojo::InterfaceRequest<media::interfaces::PlatformVerification> request); mojo::InterfaceRequest<media::interfaces::PlatformVerification> request);
explicit PlatformVerificationImpl( PlatformVerificationImpl(
content::RenderFrameHost* render_frame_host); content::RenderFrameHost* render_frame_host,
mojo::InterfaceRequest<PlatformVerification> request);
~PlatformVerificationImpl() override; ~PlatformVerificationImpl() override;
// mojo::InterfaceImpl<PlatformVerification> implementation. // mojo::InterfaceImpl<PlatformVerification> implementation.
...@@ -46,6 +47,8 @@ class PlatformVerificationImpl ...@@ -46,6 +47,8 @@ class PlatformVerificationImpl
const std::string& signature, const std::string& signature,
const std::string& platform_key_certificate); const std::string& platform_key_certificate);
mojo::StrongBinding<media::interfaces::PlatformVerification> binding_;
content::RenderFrameHost* const render_frame_host_; content::RenderFrameHost* const render_frame_host_;
scoped_refptr<PlatformVerificationFlow> platform_verification_flow_; scoped_refptr<PlatformVerificationFlow> platform_verification_flow_;
......
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