Commit 91d32831 authored by Wei Lee's avatar Wei Lee Committed by Commit Bot

[CCA WebUI] Pass task id when launching camera through intent

We plan to use |task_id| in this CL: https://crrev.com/c/2131545

It is used to solve the issue (b/147770827) that the camera app
window launched by camera intent is independent to the caller
Android app. We plan to pass the |task_id| of the caller Android app
to Chrome, get that caller app window and launch camera app in a
window which is a child of the caller app window.

Bug: 980846
Test: Build successfully
Change-Id: If476dc7a9c0910e9fa07fe5395c0478ec94ccd66
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2131541
Commit-Queue: Wei Lee <wtlee@chromium.org>
Reviewed-by: default avatarRobert Sesek <rsesek@chromium.org>
Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Reviewed-by: default avatarDavid Jacobo <djacobo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#759167}
parent c1d2a7fb
...@@ -548,7 +548,8 @@ void ChromeNewWindowClient::OpenChromePageFromArc(ChromePage page) { ...@@ -548,7 +548,8 @@ void ChromeNewWindowClient::OpenChromePageFromArc(ChromePage page) {
NOTREACHED(); NOTREACHED();
} }
void ChromeNewWindowClient::LaunchCameraApp(const std::string& queries) { void ChromeNewWindowClient::LaunchCameraApp(const std::string& queries,
int32_t task_id) {
Profile* const profile = ProfileManager::GetActiveUserProfile(); Profile* const profile = ProfileManager::GetActiveUserProfile();
const extensions::ExtensionRegistry* registry = const extensions::ExtensionRegistry* registry =
extensions::ExtensionRegistry::Get(profile); extensions::ExtensionRegistry::Get(profile);
......
...@@ -60,7 +60,7 @@ class ChromeNewWindowClient : public ash::NewWindowDelegate, ...@@ -60,7 +60,7 @@ class ChromeNewWindowClient : public ash::NewWindowDelegate,
void OpenChromePageFromArc(arc::mojom::ChromePage page) override; void OpenChromePageFromArc(arc::mojom::ChromePage page) override;
// arc::ControlCameraAppDelegate: // arc::ControlCameraAppDelegate:
void LaunchCameraApp(const std::string& queries) override; void LaunchCameraApp(const std::string& queries, int32_t task_id) override;
void CloseCameraApp() override; void CloseCameraApp() override;
bool IsCameraAppEnabled() override; bool IsCameraAppEnabled() override;
......
...@@ -233,7 +233,8 @@ void ArcIntentHelperBridge::LaunchCameraApp(uint32_t intent_id, ...@@ -233,7 +233,8 @@ void ArcIntentHelperBridge::LaunchCameraApp(uint32_t intent_id,
arc::mojom::CameraIntentMode mode, arc::mojom::CameraIntentMode mode,
bool should_handle_result, bool should_handle_result,
bool should_down_scale, bool should_down_scale,
bool is_secure) { bool is_secure,
int32_t task_id) {
DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
base::DictionaryValue intent_info; base::DictionaryValue intent_info;
...@@ -245,7 +246,7 @@ void ArcIntentHelperBridge::LaunchCameraApp(uint32_t intent_id, ...@@ -245,7 +246,7 @@ void ArcIntentHelperBridge::LaunchCameraApp(uint32_t intent_id,
<< "&shouldHandleResult=" << should_handle_result << "&shouldHandleResult=" << should_handle_result
<< "&shouldDownScale=" << should_down_scale << "&shouldDownScale=" << should_down_scale
<< "&isSecure=" << is_secure; << "&isSecure=" << is_secure;
g_control_camera_app_delegate->LaunchCameraApp(queries.str()); g_control_camera_app_delegate->LaunchCameraApp(queries.str(), task_id);
} }
void ArcIntentHelperBridge::OnIntentFiltersUpdatedForPackage( void ArcIntentHelperBridge::OnIntentFiltersUpdatedForPackage(
......
...@@ -92,7 +92,8 @@ class ArcIntentHelperBridge : public KeyedService, ...@@ -92,7 +92,8 @@ class ArcIntentHelperBridge : public KeyedService,
arc::mojom::CameraIntentMode mode, arc::mojom::CameraIntentMode mode,
bool should_handle_result, bool should_handle_result,
bool should_down_scale, bool should_down_scale,
bool is_secure) override; bool is_secure,
int32_t task_id) override;
void OnIntentFiltersUpdatedForPackage( void OnIntentFiltersUpdatedForPackage(
const std::string& package_name, const std::string& package_name,
std::vector<IntentFilter> intent_filters) override; std::vector<IntentFilter> intent_filters) override;
......
...@@ -14,8 +14,9 @@ class ControlCameraAppDelegate { ...@@ -14,8 +14,9 @@ class ControlCameraAppDelegate {
virtual ~ControlCameraAppDelegate() = default; virtual ~ControlCameraAppDelegate() = default;
// Launches the camera app from Android camera intent with the intent // Launches the camera app from Android camera intent with the intent
// information as url |queries|. // information as url |queries|. |task_id| represents the id of the caller
virtual void LaunchCameraApp(const std::string& queries) = 0; // task in ARC.
virtual void LaunchCameraApp(const std::string& queries, int32_t task_id) = 0;
// Closes the camera app. // Closes the camera app.
virtual void CloseCameraApp() = 0; virtual void CloseCameraApp() = 0;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// //
// Next MinVersion: 36 // Next MinVersion: 37
module arc.mojom; module arc.mojom;
...@@ -288,12 +288,13 @@ interface IntentHelperHost { ...@@ -288,12 +288,13 @@ interface IntentHelperHost {
// intent expects the captured image would be down-scaled to a small enough // intent expects the captured image would be down-scaled to a small enough
// size. If |is_secure| is true, the intent is fired when the device is // size. If |is_secure| is true, the intent is fired when the device is
// secured, which means the camera app should not show any user-sensitive // secured, which means the camera app should not show any user-sensitive
// data. // data. |task_id| represents the id of the caller task in ARC.
[MinVersion=28] LaunchCameraApp@12(uint32 intent_id, [MinVersion=28] LaunchCameraApp@12(uint32 intent_id,
CameraIntentMode mode, CameraIntentMode mode,
bool should_handle_result, bool should_handle_result,
bool should_down_scale, bool should_down_scale,
bool is_secure); bool is_secure,
[MinVersion=36] int32 task_id);
// Called when intent filters are updated for one package. This will be // Called when intent filters are updated for one package. This will be
// called when apps are installed, uninstalled or updated. // called when apps are installed, uninstalled or updated.
......
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