Skip to content

Commit

Permalink
Add local printing mojo interface
Browse files Browse the repository at this point in the history
This interface is used by lacros chrome to get printers
associated with the current Ash user profile as well as
their capabilities.

Bug: b/179305160
Test: deploy_chrome --lacros --nostrip

Change-Id: Id605713826eb74c886cc5bde18c53e6bdb04b434
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2763767
Commit-Queue: Sean Kau <skau@chromium.org>
Reviewed-by: Sean Kau <skau@chromium.org>
Reviewed-by: Jorge Lucangeli Obes <jorgelo@chromium.org>
Reviewed-by: Hidehiko Abe <hidehiko@chromium.org>
Reviewed-by: Rebekah Potter <rbpotter@chromium.org>
Cr-Commit-Position: refs/heads/master@{#879666}
  • Loading branch information
tsite authored and Chromium LUCI CQ committed May 6, 2021
1 parent f08904e commit 4c26263
Show file tree
Hide file tree
Showing 16 changed files with 719 additions and 61 deletions.
3 changes: 3 additions & 0 deletions chrome/browser/BUILD.gn
Expand Up @@ -5548,6 +5548,9 @@ static_library("browser") {
if (is_mac) {
sources += [ "printing/printer_manager_dialog_mac.mm" ]
}
if (is_chromeos) {
deps += [ "//chromeos/crosapi/mojom" ]
}
if (is_linux || is_chromeos) {
sources += [ "printing/printer_manager_dialog_linux.cc" ]
}
Expand Down
3 changes: 2 additions & 1 deletion chrome/browser/ash/crosapi/browser_util.cc
Expand Up @@ -192,6 +192,7 @@ constexpr InterfaceVersionEntry kInterfaceVersionEntries[] = {
MakeInterfaceVersionEntry<crosapi::mojom::FileManager>(),
MakeInterfaceVersionEntry<crosapi::mojom::IdleService>(),
MakeInterfaceVersionEntry<crosapi::mojom::KeystoreService>(),
MakeInterfaceVersionEntry<crosapi::mojom::LocalPrinter>(),
MakeInterfaceVersionEntry<
chromeos::machine_learning::mojom::MachineLearningService>(),
MakeInterfaceVersionEntry<crosapi::mojom::MessageCenter>(),
Expand Down Expand Up @@ -225,7 +226,7 @@ constexpr bool HasDuplicatedUuid() {
}

static_assert(
crosapi::mojom::Crosapi::Version_ == 24,
crosapi::mojom::Crosapi::Version_ == 25,
"if you add a new crosapi, please add it to the version map here");
static_assert(!HasDuplicatedUuid(),
"Each Crosapi Mojom interface should have unique UUID.");
Expand Down
8 changes: 8 additions & 0 deletions chrome/browser/ash/crosapi/crosapi_ash.cc
Expand Up @@ -24,6 +24,7 @@
#include "chrome/browser/ash/crosapi/file_manager_ash.h"
#include "chrome/browser/ash/crosapi/idle_service_ash.h"
#include "chrome/browser/ash/crosapi/keystore_service_ash.h"
#include "chrome/browser/ash/crosapi/local_printer_ash.h"
#include "chrome/browser/ash/crosapi/message_center_ash.h"
#include "chrome/browser/ash/crosapi/metrics_reporting_ash.h"
#include "chrome/browser/ash/crosapi/prefs_ash.h"
Expand All @@ -43,6 +44,7 @@
#include "chromeos/crosapi/mojom/feedback.mojom.h"
#include "chromeos/crosapi/mojom/file_manager.mojom.h"
#include "chromeos/crosapi/mojom/keystore_service.mojom.h"
#include "chromeos/crosapi/mojom/local_printer.mojom.h"
#include "chromeos/crosapi/mojom/message_center.mojom.h"
#include "chromeos/crosapi/mojom/screen_manager.mojom.h"
#include "chromeos/crosapi/mojom/select_file.mojom.h"
Expand All @@ -66,6 +68,7 @@ CrosapiAsh::CrosapiAsh()
file_manager_ash_(std::make_unique<FileManagerAsh>()),
idle_service_ash_(std::make_unique<IdleServiceAsh>()),
keystore_service_ash_(std::make_unique<KeystoreServiceAsh>()),
local_printer_ash_(std::make_unique<LocalPrinterAsh>()),
message_center_ash_(std::make_unique<MessageCenterAsh>()),
metrics_reporting_ash_(std::make_unique<MetricsReportingAsh>(
g_browser_process->local_state())),
Expand Down Expand Up @@ -160,6 +163,11 @@ void CrosapiAsh::BindKeystoreService(
keystore_service_ash_->BindReceiver(std::move(receiver));
}

void CrosapiAsh::BindLocalPrinter(
mojo::PendingReceiver<crosapi::mojom::LocalPrinter> receiver) {
local_printer_ash_->BindReceiver(std::move(receiver));
}

void CrosapiAsh::BindMessageCenter(
mojo::PendingReceiver<mojom::MessageCenter> receiver) {
message_center_ash_->BindReceiver(std::move(receiver));
Expand Down
4 changes: 4 additions & 0 deletions chrome/browser/ash/crosapi/crosapi_ash.h
Expand Up @@ -28,6 +28,7 @@ class FeedbackAsh;
class FileManagerAsh;
class IdleServiceAsh;
class KeystoreServiceAsh;
class LocalPrinterAsh;
class MessageCenterAsh;
class MetricsReportingAsh;
class PrefsAsh;
Expand Down Expand Up @@ -74,6 +75,8 @@ class CrosapiAsh : public mojom::Crosapi {
mojo::PendingReceiver<mojom::IdleService> receiver) override;
void BindKeystoreService(
mojo::PendingReceiver<mojom::KeystoreService> receiver) override;
void BindLocalPrinter(
mojo::PendingReceiver<mojom::LocalPrinter> receiver) override;
void BindMessageCenter(
mojo::PendingReceiver<mojom::MessageCenter> receiver) override;
void BindMetricsReporting(
Expand Down Expand Up @@ -139,6 +142,7 @@ class CrosapiAsh : public mojom::Crosapi {
std::unique_ptr<FileManagerAsh> file_manager_ash_;
std::unique_ptr<IdleServiceAsh> idle_service_ash_;
std::unique_ptr<KeystoreServiceAsh> keystore_service_ash_;
std::unique_ptr<LocalPrinterAsh> local_printer_ash_;
std::unique_ptr<MessageCenterAsh> message_center_ash_;
std::unique_ptr<MetricsReportingAsh> metrics_reporting_ash_;
std::unique_ptr<PrefsAsh> prefs_ash_;
Expand Down

0 comments on commit 4c26263

Please sign in to comment.