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

Side by Side Diff: content/browser/loader/downloaded_temp_file_impl.cc

Issue 2561743003: Use associated interface on DownloadedTempFile (Closed)
Patch Set: update LayoutTest/TestExpectations Created 4 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/loader/downloaded_temp_file_impl.h" 5 #include "content/browser/loader/downloaded_temp_file_impl.h"
6 6
7 #include "content/browser/loader/resource_dispatcher_host_impl.h" 7 #include "content/browser/loader/resource_dispatcher_host_impl.h"
8 #include "mojo/public/cpp/bindings/strong_associated_binding.h"
yhirano 2016/12/09 03:49:23 +mojo/public/cpp/bindings/associated_group.h
tzik 2016/12/09 07:08:39 Done.
8 #include "mojo/public/cpp/bindings/strong_binding.h" 9 #include "mojo/public/cpp/bindings/strong_binding.h"
9 10
10 namespace content { 11 namespace content {
11 12
12 // static 13 // static
13 mojo::InterfacePtr<mojom::DownloadedTempFile> DownloadedTempFileImpl::Create( 14 mojom::DownloadedTempFileAssociatedPtrInfo DownloadedTempFileImpl::Create(
15 mojo::AssociatedGroup* associated_group,
16 int child_id,
17 int request_id) {
18 mojo::AssociatedInterfacePtrInfo<mojom::DownloadedTempFile> ptr_info;
19 mojo::AssociatedInterfaceRequest<mojom::DownloadedTempFile> request;
20 associated_group->CreateAssociatedInterface(
21 mojo::AssociatedGroup::WILL_PASS_PTR, &ptr_info, &request);
22 mojo::MakeStrongAssociatedBinding(
23 base::MakeUnique<DownloadedTempFileImpl>(child_id, request_id),
24 std::move(request));
25 return ptr_info;
26 }
27
28 // static
29 mojom::DownloadedTempFilePtr DownloadedTempFileImpl::CreateForTesting(
14 int child_id, 30 int child_id,
15 int request_id) { 31 int request_id) {
16 mojo::InterfacePtr<mojom::DownloadedTempFile> ptr; 32 mojo::InterfacePtr<mojom::DownloadedTempFile> ptr;
17 auto binding = mojo::MakeStrongBinding( 33 mojo::MakeStrongBinding(
18 base::MakeUnique<DownloadedTempFileImpl>(child_id, request_id), 34 base::MakeUnique<DownloadedTempFileImpl>(child_id, request_id),
19 mojo::GetProxy(&ptr)); 35 mojo::GetProxy(&ptr));
20 return ptr; 36 return ptr;
21 } 37 }
22 38
23 DownloadedTempFileImpl::~DownloadedTempFileImpl() { 39 DownloadedTempFileImpl::~DownloadedTempFileImpl() {
24 ResourceDispatcherHostImpl::Get()->UnregisterDownloadedTempFile(child_id_, 40 ResourceDispatcherHostImpl::Get()->UnregisterDownloadedTempFile(child_id_,
25 request_id_); 41 request_id_);
26 } 42 }
27 DownloadedTempFileImpl::DownloadedTempFileImpl(int child_id, int request_id) 43 DownloadedTempFileImpl::DownloadedTempFileImpl(int child_id, int request_id)
28 : child_id_(child_id), request_id_(request_id) {} 44 : child_id_(child_id), request_id_(request_id) {}
29 45
30 } // namespace content 46 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698