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

Revert "[CCA] Only use CameraDialog for intents under clamshell mode"

This reverts commit 94464131.

Reason for revert: b/176770937

Original change's description:
> [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: Scott Violet <sky@chromium.org>
> Reviewed-by: Shik Chen <shik@chromium.org>
> Auto-Submit: Wei Lee <wtlee@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#838170}

TBR=sky@chromium.org,shik@chromium.org,wtlee@chromium.org,chromium-scoped@luci-project-accounts.iam.gserviceaccount.com

# Not skipping CQ checks because original CL landed > 1 day ago.

Bug: b/175322338
Bug: b/175326967
Bug: b/174891007
Change-Id: If6ffd5e3903b7e10174e05651ada687292289db6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2620823Reviewed-by: default avatarWei Lee <wtlee@chromium.org>
Commit-Queue: Wei Lee <wtlee@chromium.org>
Cr-Commit-Position: refs/heads/master@{#841994}
parent 531f31a4
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
#include <vector> #include <vector>
#include "ash/public/cpp/tablet_mode.h"
#include "base/files/file_path.h" #include "base/files/file_path.h"
#include "base/system/sys_info.h" #include "base/system/sys_info.h"
#include "chrome/browser/apps/app_service/app_service_proxy.h" #include "chrome/browser/apps/app_service/app_service_proxy.h"
...@@ -19,9 +18,7 @@ ...@@ -19,9 +18,7 @@
#include "chrome/browser/media/webrtc/media_capture_devices_dispatcher.h" #include "chrome/browser/media/webrtc/media_capture_devices_dispatcher.h"
#include "chrome/browser/metrics/chrome_metrics_service_accessor.h" #include "chrome/browser/metrics/chrome_metrics_service_accessor.h"
#include "chrome/browser/profiles/profile.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/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/components/web_app_id_constants.h"
#include "chrome/browser/web_applications/web_app_tab_helper.h" #include "chrome/browser/web_applications/web_app_tab_helper.h"
#include "chrome/browser/web_launch/web_launch_files_helper.h" #include "chrome/browser/web_launch/web_launch_files_helper.h"
...@@ -34,6 +31,15 @@ ...@@ -34,6 +31,15 @@
#include "ui/gfx/native_widget_types.h" #include "ui/gfx/native_widget_types.h"
#include "url/gurl.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( ChromeCameraAppUIDelegate::CameraAppDialog::CameraAppDialog(
const std::string& url) const std::string& url)
: chromeos::SystemWebDialogDelegate(GURL(url), : chromeos::SystemWebDialogDelegate(GURL(url),
...@@ -74,23 +80,6 @@ bool ChromeCameraAppUIDelegate::CameraAppDialog::CheckMediaAccessPermission( ...@@ -74,23 +80,6 @@ bool ChromeCameraAppUIDelegate::CameraAppDialog::CheckMediaAccessPermission(
ChromeCameraAppUIDelegate::ChromeCameraAppUIDelegate(content::WebUI* web_ui) ChromeCameraAppUIDelegate::ChromeCameraAppUIDelegate(content::WebUI* web_ui)
: web_ui_(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() { void ChromeCameraAppUIDelegate::SetLaunchDirectory() {
Profile* profile = Profile::FromWebUI(web_ui_); Profile* profile = Profile::FromWebUI(web_ui_);
content::WebContents* web_contents = web_ui_->GetWebContents(); content::WebContents* web_contents = web_ui_->GetWebContents();
......
...@@ -36,7 +36,8 @@ class ChromeCameraAppUIDelegate : public CameraAppUIDelegate { ...@@ -36,7 +36,8 @@ class ChromeCameraAppUIDelegate : public CameraAppUIDelegate {
public: public:
class CameraAppDialog : public chromeos::SystemWebDialogDelegate { class CameraAppDialog : public chromeos::SystemWebDialogDelegate {
public: public:
explicit CameraAppDialog(const std::string& url); static void ShowIntent(const std::string& queries,
gfx::NativeWindow parent);
// SystemWebDialogDelegate // SystemWebDialogDelegate
ui::ModalType GetDialogModalType() const override; ui::ModalType GetDialogModalType() const override;
...@@ -54,6 +55,7 @@ class ChromeCameraAppUIDelegate : public CameraAppUIDelegate { ...@@ -54,6 +55,7 @@ class ChromeCameraAppUIDelegate : public CameraAppUIDelegate {
blink::mojom::MediaStreamType type) override; blink::mojom::MediaStreamType type) override;
private: private:
explicit CameraAppDialog(const std::string& url);
~CameraAppDialog() override; ~CameraAppDialog() override;
DISALLOW_COPY_AND_ASSIGN(CameraAppDialog); DISALLOW_COPY_AND_ASSIGN(CameraAppDialog);
...@@ -65,8 +67,6 @@ class ChromeCameraAppUIDelegate : public CameraAppUIDelegate { ...@@ -65,8 +67,6 @@ class ChromeCameraAppUIDelegate : public CameraAppUIDelegate {
ChromeCameraAppUIDelegate& operator=(const ChromeCameraAppUIDelegate&) = ChromeCameraAppUIDelegate& operator=(const ChromeCameraAppUIDelegate&) =
delete; delete;
static void ShowIntent(const std::string& queries, gfx::NativeWindow parent);
// CameraAppUIDelegate // CameraAppUIDelegate
void SetLaunchDirectory() override; void SetLaunchDirectory() override;
void PopulateLoadTimeData(content::WebUIDataSource* source) override; void PopulateLoadTimeData(content::WebUIDataSource* source) override;
......
...@@ -660,7 +660,8 @@ void ChromeNewWindowClient::LaunchCameraApp(const std::string& queries, ...@@ -660,7 +660,8 @@ void ChromeNewWindowClient::LaunchCameraApp(const std::string& queries,
if (web_app::SystemWebAppManager::IsAppEnabled( if (web_app::SystemWebAppManager::IsAppEnabled(
web_app::SystemAppType::CAMERA)) { web_app::SystemAppType::CAMERA)) {
ChromeCameraAppUIDelegate::ShowIntent(queries, arc::GetArcWindow(task_id)); ChromeCameraAppUIDelegate::CameraAppDialog::ShowIntent(
queries, arc::GetArcWindow(task_id));
return; 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