Commit 94464131 authored by Wei Lee's avatar Wei Lee Committed by Chromium LUCI CQ

[CCA] Only use CameraDialog for intents under clamshell mode

For tablet mode, we should better use the regular way to launch CCA,
which means opening CCA in a Browser, rather than using CameraDialog so
that the size of the CCA can be fullscreen as well.

Bug: b/175322338, b/175326967, b/174891007
Test: tast run [DUT] camera.CCAUIIntent*
Change-Id: I39cecffb36e4d104253d74ffd9e44c6740a648b5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2596282
Commit-Queue: Scott Violet <sky@chromium.org>
Reviewed-by: default avatarScott Violet <sky@chromium.org>
Reviewed-by: default avatarShik Chen <shik@chromium.org>
Auto-Submit: Wei Lee <wtlee@chromium.org>
Cr-Commit-Position: refs/heads/master@{#838170}
parent e40efe13
......@@ -6,6 +6,7 @@
#include <vector>
#include "ash/public/cpp/tablet_mode.h"
#include "base/files/file_path.h"
#include "base/system/sys_info.h"
#include "chrome/browser/apps/app_service/app_service_proxy.h"
......@@ -18,7 +19,9 @@
#include "chrome/browser/media/webrtc/media_capture_devices_dispatcher.h"
#include "chrome/browser/metrics/chrome_metrics_service_accessor.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/ui/chrome_pages.h"
#include "chrome/browser/ui/web_applications/system_web_app_ui_utils.h"
#include "chrome/browser/web_applications/components/web_app_id_constants.h"
#include "chrome/browser/web_applications/web_app_tab_helper.h"
#include "chrome/browser/web_launch/web_launch_files_helper.h"
......@@ -31,15 +34,6 @@
#include "ui/gfx/native_widget_types.h"
#include "url/gurl.h"
// static
void ChromeCameraAppUIDelegate::CameraAppDialog::ShowIntent(
const std::string& queries,
gfx::NativeWindow parent) {
std::string url = chromeos::kChromeUICameraAppMainURL + queries;
CameraAppDialog* dialog = new CameraAppDialog(url);
dialog->ShowSystemDialog(parent);
}
ChromeCameraAppUIDelegate::CameraAppDialog::CameraAppDialog(
const std::string& url)
: chromeos::SystemWebDialogDelegate(GURL(url),
......@@ -80,6 +74,23 @@ bool ChromeCameraAppUIDelegate::CameraAppDialog::CheckMediaAccessPermission(
ChromeCameraAppUIDelegate::ChromeCameraAppUIDelegate(content::WebUI* web_ui)
: web_ui_(web_ui) {}
// static
void ChromeCameraAppUIDelegate::ShowIntent(const std::string& queries,
gfx::NativeWindow parent) {
std::string url = chromeos::kChromeUICameraAppMainURL + queries;
// For tablet mode, apps should better display in fullscreen. Therefore, it is
// preferable to launch CCA into a browser, which will handle the tablet mode
// case itself, rather than a system dialog.
if (ash::TabletMode::Get()->InTabletMode()) {
web_app::LaunchSystemWebApp(ProfileManager::GetActiveUserProfile(),
web_app::SystemAppType::CAMERA, GURL(url));
} else {
CameraAppDialog* dialog = new CameraAppDialog(url);
dialog->ShowSystemDialog(parent);
}
}
void ChromeCameraAppUIDelegate::SetLaunchDirectory() {
Profile* profile = Profile::FromWebUI(web_ui_);
content::WebContents* web_contents = web_ui_->GetWebContents();
......
......@@ -36,8 +36,7 @@ class ChromeCameraAppUIDelegate : public CameraAppUIDelegate {
public:
class CameraAppDialog : public chromeos::SystemWebDialogDelegate {
public:
static void ShowIntent(const std::string& queries,
gfx::NativeWindow parent);
explicit CameraAppDialog(const std::string& url);
// SystemWebDialogDelegate
ui::ModalType GetDialogModalType() const override;
......@@ -55,7 +54,6 @@ class ChromeCameraAppUIDelegate : public CameraAppUIDelegate {
blink::mojom::MediaStreamType type) override;
private:
explicit CameraAppDialog(const std::string& url);
~CameraAppDialog() override;
DISALLOW_COPY_AND_ASSIGN(CameraAppDialog);
......@@ -67,6 +65,8 @@ class ChromeCameraAppUIDelegate : public CameraAppUIDelegate {
ChromeCameraAppUIDelegate& operator=(const ChromeCameraAppUIDelegate&) =
delete;
static void ShowIntent(const std::string& queries, gfx::NativeWindow parent);
// CameraAppUIDelegate
void SetLaunchDirectory() override;
void PopulateLoadTimeData(content::WebUIDataSource* source) override;
......
......@@ -660,8 +660,7 @@ void ChromeNewWindowClient::LaunchCameraApp(const std::string& queries,
if (web_app::SystemWebAppManager::IsAppEnabled(
web_app::SystemAppType::CAMERA)) {
ChromeCameraAppUIDelegate::CameraAppDialog::ShowIntent(
queries, arc::GetArcWindow(task_id));
ChromeCameraAppUIDelegate::ShowIntent(queries, arc::GetArcWindow(task_id));
return;
}
......
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