Commit 8655e1e7 authored by Gyuyoung Kim's avatar Gyuyoung Kim Committed by Commit Bot

Convert PrintSessionInstance interface to the new Mojo

This CL applies mojo::PendingRemote and mojo::Remote
to all uses of PrintSessionInstance interface.

Bug: 955171
Change-Id: I5a31ea941d9d8d8456f1880dcf0b4abc390d0b49
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2228295Reviewed-by: default avatarKinuko Yasuda <kinuko@chromium.org>
Reviewed-by: default avatarHidehiko Abe <hidehiko@chromium.org>
Reviewed-by: default avatarKen Rockot <rockot@google.com>
Commit-Queue: Gyuyoung Kim <gyuyoung@igalia.com>
Cr-Commit-Position: refs/heads/master@{#774894}
parent 2b263e14
......@@ -76,7 +76,7 @@ void ArcPrintSpoolerBridge::StartPrintInCustomTab(
int32_t task_id,
int32_t surface_id,
int32_t top_margin,
mojom::PrintSessionInstancePtr instance,
mojo::PendingRemote<mojom::PrintSessionInstance> instance,
StartPrintInCustomTabCallback callback) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
base::ThreadPool::PostTaskAndReplyWithResult(
......@@ -91,7 +91,7 @@ void ArcPrintSpoolerBridge::OnPrintDocumentSaved(
int32_t task_id,
int32_t surface_id,
int32_t top_margin,
mojom::PrintSessionInstancePtr instance,
mojo::PendingRemote<mojom::PrintSessionInstance> instance,
StartPrintInCustomTabCallback callback,
base::FilePath file_path) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
......
......@@ -9,6 +9,7 @@
#include "base/memory/weak_ptr.h"
#include "components/arc/mojom/print_spooler.mojom.h"
#include "components/keyed_service/core/keyed_service.h"
#include "mojo/public/cpp/bindings/pending_remote.h"
#include "mojo/public/cpp/system/platform_handle.h"
class Profile;
......@@ -37,19 +38,21 @@ class ArcPrintSpoolerBridge : public KeyedService,
~ArcPrintSpoolerBridge() override;
// mojom::PrintSpoolerHost:
void StartPrintInCustomTab(mojo::ScopedHandle scoped_handle,
int32_t task_id,
int32_t surface_id,
int32_t top_margin,
mojom::PrintSessionInstancePtr instance,
StartPrintInCustomTabCallback callback) override;
void OnPrintDocumentSaved(int32_t task_id,
int32_t surface_id,
int32_t top_margin,
mojom::PrintSessionInstancePtr instance,
StartPrintInCustomTabCallback callback,
base::FilePath file_path);
void StartPrintInCustomTab(
mojo::ScopedHandle scoped_handle,
int32_t task_id,
int32_t surface_id,
int32_t top_margin,
mojo::PendingRemote<mojom::PrintSessionInstance> instance,
StartPrintInCustomTabCallback callback) override;
void OnPrintDocumentSaved(
int32_t task_id,
int32_t surface_id,
int32_t top_margin,
mojo::PendingRemote<mojom::PrintSessionInstance> instance,
StartPrintInCustomTabCallback callback,
base::FilePath file_path);
private:
ArcBridgeService* const arc_bridge_service_; // Owned by ArcServiceManager.
......
......@@ -211,7 +211,7 @@ bool IsPdfPluginLoaded(content::WebContents* web_contents) {
mojo::PendingRemote<mojom::PrintSessionHost> PrintSessionImpl::Create(
std::unique_ptr<content::WebContents> web_contents,
std::unique_ptr<ash::ArcCustomTab> custom_tab,
mojom::PrintSessionInstancePtr instance) {
mojo::PendingRemote<mojom::PrintSessionInstance> instance) {
DCHECK(custom_tab);
if (!instance)
return mojo::NullRemote();
......@@ -227,7 +227,7 @@ mojo::PendingRemote<mojom::PrintSessionHost> PrintSessionImpl::Create(
PrintSessionImpl::PrintSessionImpl(
std::unique_ptr<content::WebContents> web_contents,
std::unique_ptr<ash::ArcCustomTab> custom_tab,
mojom::PrintSessionInstancePtr instance,
mojo::PendingRemote<mojom::PrintSessionInstance> instance,
mojo::PendingReceiver<mojom::PrintSessionHost> receiver)
: ArcCustomTabModalDialogHost(std::move(custom_tab), web_contents.get()),
instance_(std::move(instance)),
......
......@@ -20,6 +20,7 @@
#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "mojo/public/cpp/bindings/pending_remote.h"
#include "mojo/public/cpp/bindings/receiver.h"
#include "mojo/public/cpp/bindings/remote.h"
#include "mojo/public/cpp/system/platform_handle.h"
namespace ash {
......@@ -42,7 +43,7 @@ class PrintSessionImpl : public mojom::PrintSessionHost,
static mojo::PendingRemote<mojom::PrintSessionHost> Create(
std::unique_ptr<content::WebContents> web_contents,
std::unique_ptr<ash::ArcCustomTab> custom_tab,
mojom::PrintSessionInstancePtr instance);
mojo::PendingRemote<mojom::PrintSessionInstance> instance);
PrintSessionImpl(const PrintSessionImpl&) = delete;
PrintSessionImpl& operator=(const PrintSessionImpl&) = delete;
......@@ -54,7 +55,7 @@ class PrintSessionImpl : public mojom::PrintSessionHost,
private:
PrintSessionImpl(std::unique_ptr<content::WebContents> web_contents,
std::unique_ptr<ash::ArcCustomTab> custom_tab,
mojom::PrintSessionInstancePtr instance,
mojo::PendingRemote<mojom::PrintSessionInstance> instance,
mojo::PendingReceiver<mojom::PrintSessionHost> receiver);
friend class content::WebContentsUserData<PrintSessionImpl>;
......@@ -95,7 +96,7 @@ class PrintSessionImpl : public mojom::PrintSessionHost,
void StartPrintNow();
// Used to send messages to ARC and request a new print document.
mojom::PrintSessionInstancePtr instance_;
mojo::Remote<mojom::PrintSessionInstance> instance_;
// Receiver for PrintRenderer.
mojo::AssociatedReceiver<printing::mojom::PrintRenderer>
......
......@@ -42,11 +42,12 @@ interface PrintSpoolerHost {
// The |top_margin| is the height of the space at the top of the window.
// The returned |host| will be null if errors occur while saving the print
// document or locating the Android surface.
[MinVersion=1] StartPrintInCustomTab@0(handle scoped_handle,
int32 task_id,
int32 surface_id,
int32 top_margin,
PrintSessionInstance instance)
[MinVersion=1] StartPrintInCustomTab@0(
handle scoped_handle,
int32 task_id,
int32 surface_id,
int32 top_margin,
pending_remote<PrintSessionInstance> instance)
=> (PrintSessionHost? host);
};
......
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