Commit 21c6e35c authored by Travis Skare's avatar Travis Skare Committed by Commit Bot

Handle OOP GenerateQRCode on Android in Service Process.

Change-Id: I8353bf9af8aaf858d882af03608be6fe30532a1d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2211098Reviewed-by: default avatarKen Rockot <rockot@google.com>
Reviewed-by: default avatarGayane Petrosyan <gayane@chromium.org>
Commit-Queue: Travis Skare <skare@chromium.org>
Cr-Commit-Position: refs/heads/master@{#771142}
parent 2039a347
...@@ -44,12 +44,10 @@ QRCodeGenerationRequest::QRCodeGenerationRequest( ...@@ -44,12 +44,10 @@ QRCodeGenerationRequest::QRCodeGenerationRequest(
// base::Unretained(this) is safe here because the callback won't be invoked // base::Unretained(this) is safe here because the callback won't be invoked
// after |remote_| is destroyed, and |remote_| will be destroyed if this // after |remote_| is destroyed, and |remote_| will be destroyed if this
// object is destroyed. // object is destroyed.
// TODO(skare): Reenable this handler.
/*
remote_.set_disconnect_handler( remote_.set_disconnect_handler(
base::BindOnce(&QRCodeGenerationRequest::OnGenerateCodeResponse, base::BindOnce(&QRCodeGenerationRequest::OnGenerateCodeResponse,
base::Unretained(this), nullptr)); base::Unretained(this), nullptr));
*/
auto callback = base::BindOnce( auto callback = base::BindOnce(
&QRCodeGenerationRequest::OnGenerateCodeResponse, base::Unretained(this)); &QRCodeGenerationRequest::OnGenerateCodeResponse, base::Unretained(this));
remote_.get()->GenerateQRCode(std::move(request), std::move(callback)); remote_.get()->GenerateQRCode(std::move(request), std::move(callback));
...@@ -65,8 +63,9 @@ void QRCodeGenerationRequest::OnGenerateCodeResponse( ...@@ -65,8 +63,9 @@ void QRCodeGenerationRequest::OnGenerateCodeResponse(
const qrcode_generator::mojom::GenerateQRCodeResponsePtr service_response) { const qrcode_generator::mojom::GenerateQRCodeResponsePtr service_response) {
JNIEnv* env = base::android::AttachCurrentThread(); JNIEnv* env = base::android::AttachCurrentThread();
if (service_response->error_code != if (!service_response ||
qrcode_generator::mojom::QRCodeGeneratorError::NONE) { service_response->error_code !=
qrcode_generator::mojom::QRCodeGeneratorError::NONE) {
Java_QRCodeGenerationRequest_onQRCodeAvailable( Java_QRCodeGenerationRequest_onQRCodeAvailable(
env, java_qr_code_generation_request_, nullptr); env, java_qr_code_generation_request_, nullptr);
return; return;
......
...@@ -34,8 +34,6 @@ ...@@ -34,8 +34,6 @@
#if !defined(OS_ANDROID) #if !defined(OS_ANDROID)
#include "chrome/common/importer/profile_import.mojom.h" #include "chrome/common/importer/profile_import.mojom.h"
#include "chrome/services/qrcode_generator/public/mojom/qrcode_generator.mojom.h" // nogncheck
#include "chrome/services/qrcode_generator/qrcode_generator_service_impl.h" // nogncheck
#include "chrome/services/sharing/public/mojom/sharing.mojom.h" #include "chrome/services/sharing/public/mojom/sharing.mojom.h"
#include "chrome/services/sharing/sharing_impl.h" #include "chrome/services/sharing/sharing_impl.h"
#include "chrome/services/speech/speech_recognition_service_impl.h" #include "chrome/services/speech/speech_recognition_service_impl.h"
...@@ -55,6 +53,9 @@ ...@@ -55,6 +53,9 @@
#include "chrome/services/file_util/file_util_service.h" // nogncheck #include "chrome/services/file_util/file_util_service.h" // nogncheck
#endif #endif
#include "chrome/services/qrcode_generator/public/mojom/qrcode_generator.mojom.h" // nogncheck
#include "chrome/services/qrcode_generator/qrcode_generator_service_impl.h" // nogncheck
#if BUILDFLAG(ENABLE_EXTENSIONS) #if BUILDFLAG(ENABLE_EXTENSIONS)
#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/services/removable_storage_writer/removable_storage_writer.h" #include "chrome/services/removable_storage_writer/removable_storage_writer.h"
...@@ -106,6 +107,13 @@ auto RunLanguageDetectionService( ...@@ -106,6 +107,13 @@ auto RunLanguageDetectionService(
std::move(receiver)); std::move(receiver));
} }
auto RunQRCodeGeneratorService(
mojo::PendingReceiver<qrcode_generator::mojom::QRCodeGeneratorService>
receiver) {
return std::make_unique<qrcode_generator::QRCodeGeneratorServiceImpl>(
std::move(receiver));
}
#if defined(OS_WIN) #if defined(OS_WIN)
auto RunQuarantineService( auto RunQuarantineService(
mojo::PendingReceiver<quarantine::mojom::Quarantine> receiver) { mojo::PendingReceiver<quarantine::mojom::Quarantine> receiver) {
...@@ -131,13 +139,6 @@ auto RunProfileImporter( ...@@ -131,13 +139,6 @@ auto RunProfileImporter(
return std::make_unique<ProfileImportImpl>(std::move(receiver)); return std::make_unique<ProfileImportImpl>(std::move(receiver));
} }
auto RunQRCodeGeneratorService(
mojo::PendingReceiver<qrcode_generator::mojom::QRCodeGeneratorService>
receiver) {
return std::make_unique<qrcode_generator::QRCodeGeneratorServiceImpl>(
std::move(receiver));
}
auto RunMirroringService( auto RunMirroringService(
mojo::PendingReceiver<mirroring::mojom::MirroringService> receiver) { mojo::PendingReceiver<mirroring::mojom::MirroringService> receiver) {
return std::make_unique<mirroring::MirroringService>( return std::make_unique<mirroring::MirroringService>(
...@@ -248,10 +249,10 @@ mojo::ServiceFactory* GetMainThreadServiceFactory() { ...@@ -248,10 +249,10 @@ mojo::ServiceFactory* GetMainThreadServiceFactory() {
RunFilePatcher, RunFilePatcher,
RunUnzipper, RunUnzipper,
RunLanguageDetectionService, RunLanguageDetectionService,
RunQRCodeGeneratorService,
#if !defined(OS_ANDROID) #if !defined(OS_ANDROID)
RunProfileImporter, RunProfileImporter,
RunQRCodeGeneratorService,
RunMirroringService, RunMirroringService,
RunSharing, RunSharing,
RunSpeechRecognitionService, RunSpeechRecognitionService,
......
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