Commit 0b26f34d authored by Henrique Ferreiro's avatar Henrique Ferreiro Committed by Commit Bot

Migrate removable_storage_writer.mojom to the new Mojo types

Convert all users of the chrome::mojom::RemovableStorageWriterClient
interface.

Bug: 955171
Change-Id: I317bfccbae857d723f91184b7872c7316c152ee0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1834349Reviewed-by: default avatarAvi Drissman <avi@chromium.org>
Reviewed-by: default avatarKen Rockot <rockot@google.com>
Commit-Queue: Henrique Ferreiro <hferreiro@igalia.com>
Cr-Commit-Position: refs/heads/master@{#702354}
parent 7123044c
...@@ -18,16 +18,12 @@ void RemovableStorageWriter::Write( ...@@ -18,16 +18,12 @@ void RemovableStorageWriter::Write(
const base::FilePath& source, const base::FilePath& source,
const base::FilePath& target, const base::FilePath& target,
mojo::PendingRemote<chrome::mojom::RemovableStorageWriterClient> client) { mojo::PendingRemote<chrome::mojom::RemovableStorageWriterClient> client) {
writer_.Write( writer_.Write(source, target, std::move(client));
source, target,
chrome::mojom::RemovableStorageWriterClientPtr(std::move(client)));
} }
void RemovableStorageWriter::Verify( void RemovableStorageWriter::Verify(
const base::FilePath& source, const base::FilePath& source,
const base::FilePath& target, const base::FilePath& target,
mojo::PendingRemote<chrome::mojom::RemovableStorageWriterClient> client) { mojo::PendingRemote<chrome::mojom::RemovableStorageWriterClient> client) {
writer_.Verify( writer_.Verify(source, target, std::move(client));
source, target,
chrome::mojom::RemovableStorageWriterClientPtr(std::move(client)));
} }
...@@ -124,7 +124,11 @@ static_library("utility") { ...@@ -124,7 +124,11 @@ static_library("utility") {
"//chrome/services/removable_storage_writer:lib", "//chrome/services/removable_storage_writer:lib",
] ]
public_deps += [ "//chrome/common/extensions/api" ] public_deps += [
"//chrome/common/extensions/api",
"//chrome/services/removable_storage_writer/public/mojom",
"//mojo/public/cpp/bindings",
]
# Prevent wininet from loading in the renderer. http://crbug.com/460679 # Prevent wininet from loading in the renderer. http://crbug.com/460679
if (is_win) { if (is_win) {
......
...@@ -4,6 +4,8 @@ ...@@ -4,6 +4,8 @@
#include "chrome/utility/image_writer/image_writer_handler.h" #include "chrome/utility/image_writer/image_writer_handler.h"
#include <utility>
#include "base/bind.h" #include "base/bind.h"
#include "base/files/file_path.h" #include "base/files/file_path.h"
#include "base/optional.h" #include "base/optional.h"
...@@ -32,9 +34,9 @@ ImageWriterHandler::~ImageWriterHandler() = default; ...@@ -32,9 +34,9 @@ ImageWriterHandler::~ImageWriterHandler() = default;
void ImageWriterHandler::Write( void ImageWriterHandler::Write(
const base::FilePath& image, const base::FilePath& image,
const base::FilePath& device, const base::FilePath& device,
chrome::mojom::RemovableStorageWriterClientPtr client) { mojo::PendingRemote<chrome::mojom::RemovableStorageWriterClient> client) {
client_ = std::move(client); client_.Bind(std::move(client));
client_.set_connection_error_handler( client_.set_disconnect_handler(
base::BindOnce(&ImageWriterHandler::Cancel, base::Unretained(this))); base::BindOnce(&ImageWriterHandler::Cancel, base::Unretained(this)));
base::FilePath target_device = device; base::FilePath target_device = device;
...@@ -67,9 +69,9 @@ void ImageWriterHandler::Write( ...@@ -67,9 +69,9 @@ void ImageWriterHandler::Write(
void ImageWriterHandler::Verify( void ImageWriterHandler::Verify(
const base::FilePath& image, const base::FilePath& image,
const base::FilePath& device, const base::FilePath& device,
chrome::mojom::RemovableStorageWriterClientPtr client) { mojo::PendingRemote<chrome::mojom::RemovableStorageWriterClient> client) {
client_ = std::move(client); client_.Bind(std::move(client));
client_.set_connection_error_handler( client_.set_disconnect_handler(
base::BindOnce(&ImageWriterHandler::Cancel, base::Unretained(this))); base::BindOnce(&ImageWriterHandler::Cancel, base::Unretained(this)));
base::FilePath target_device = device; base::FilePath target_device = device;
......
...@@ -13,6 +13,8 @@ ...@@ -13,6 +13,8 @@
#include "base/macros.h" #include "base/macros.h"
#include "chrome/services/removable_storage_writer/public/mojom/removable_storage_writer.mojom.h" #include "chrome/services/removable_storage_writer/public/mojom/removable_storage_writer.mojom.h"
#include "chrome/utility/image_writer/image_writer.h" #include "chrome/utility/image_writer/image_writer.h"
#include "mojo/public/cpp/bindings/pending_remote.h"
#include "mojo/public/cpp/bindings/remote.h"
namespace base { namespace base {
class FilePath; class FilePath;
...@@ -25,12 +27,14 @@ class ImageWriterHandler { ...@@ -25,12 +27,14 @@ class ImageWriterHandler {
ImageWriterHandler(); ImageWriterHandler();
~ImageWriterHandler(); ~ImageWriterHandler();
void Write(const base::FilePath& image, void Write(
const base::FilePath& device, const base::FilePath& image,
chrome::mojom::RemovableStorageWriterClientPtr client); const base::FilePath& device,
void Verify(const base::FilePath& image, mojo::PendingRemote<chrome::mojom::RemovableStorageWriterClient> client);
const base::FilePath& device, void Verify(
chrome::mojom::RemovableStorageWriterClientPtr client); const base::FilePath& image,
const base::FilePath& device,
mojo::PendingRemote<chrome::mojom::RemovableStorageWriterClient> client);
// Methods for sending the different messages back to the |client_|. // Methods for sending the different messages back to the |client_|.
// Generally should be called by image_writer::ImageWriter. // Generally should be called by image_writer::ImageWriter.
...@@ -45,7 +49,7 @@ class ImageWriterHandler { ...@@ -45,7 +49,7 @@ class ImageWriterHandler {
bool ShouldResetImageWriter(const base::FilePath& image, bool ShouldResetImageWriter(const base::FilePath& image,
const base::FilePath& device); const base::FilePath& device);
chrome::mojom::RemovableStorageWriterClientPtr client_; mojo::Remote<chrome::mojom::RemovableStorageWriterClient> client_;
std::unique_ptr<ImageWriter> image_writer_; std::unique_ptr<ImageWriter> image_writer_;
DISALLOW_COPY_AND_ASSIGN(ImageWriterHandler); DISALLOW_COPY_AND_ASSIGN(ImageWriterHandler);
......
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