0

Move kAppType and AppType enums to ::chromoeos

ui::aura::kAppType -> chromeos::kAppTypeKey
ash::AppType -> chromeos::AppType

It's done to avoid static casting when comparing window's app type.

Bug: b/328628805
Change-Id: I4ad420d63140bbad8de7644dcc00f8a4749fc7a7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5500836
Reviewed-by: Francois Pierre Doray <fdoray@chromium.org>
Reviewed-by: Xiyuan Xia <xiyuan@chromium.org>
Commit-Queue: Xiaoqian Dai <xdai@chromium.org>
Reviewed-by: Scott Violet <sky@chromium.org>
Reviewed-by: Mitsuru Oshima <oshima@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1300167}
This commit is contained in:
Xiaoqian Dai
2024-05-13 18:30:23 +00:00
committed by Chromium LUCI CQ
parent a92969bb58
commit e4397ab3ec
154 changed files with 893 additions and 868 deletions
ash
accelerators
components
constants
display
drag_drop
frame
frame_throttler
game_dashboard
metrics
public
session
system
video_conference
test
wm
chrome/browser
apps
ash
performance_manager
ui
chromeos/ui
components
ui/aura/client

@@ -3508,7 +3508,7 @@ TEST_F(AcceleratorControllerGameDashboardTests,
// Create an ARC app window. // Create an ARC app window.
std::unique_ptr<aura::Window> window = std::unique_ptr<aura::Window> window =
CreateAppWindow(gfx::Rect(5, 5, 20, 20), AppType::ARC_APP); CreateAppWindow(gfx::Rect(5, 5, 20, 20), chromeos::AppType::ARC_APP);
window->SetProperty(kAppIDKey, window->SetProperty(kAppIDKey,
std::string(TestGameDashboardDelegate::kGameAppId)); std::string(TestGameDashboardDelegate::kGameAppId));
// Verify the accelerator is not processed until the game controls status is // Verify the accelerator is not processed until the game controls status is
@@ -3524,7 +3524,7 @@ TEST_F(AcceleratorControllerGameDashboardTests,
EXPECT_FALSE(ProcessInController(accelerator)); EXPECT_FALSE(ProcessInController(accelerator));
// Create a non-ARC app window. // Create a non-ARC app window.
window = CreateAppWindow(gfx::Rect(5, 5, 20, 20), AppType::BROWSER); window = CreateAppWindow(gfx::Rect(5, 5, 20, 20), chromeos::AppType::BROWSER);
window->SetProperty( window->SetProperty(
kAppIDKey, std::string(TestGameDashboardDelegate::kAllowlistedAppId)); kAppIDKey, std::string(TestGameDashboardDelegate::kAllowlistedAppId));
EXPECT_TRUE(ProcessInController(accelerator)); EXPECT_TRUE(ProcessInController(accelerator));

@@ -11,7 +11,6 @@
#include "ash/components/arc/arc_features.h" #include "ash/components/arc/arc_features.h"
#include "ash/components/arc/arc_prefs.h" #include "ash/components/arc/arc_prefs.h"
#include "ash/components/arc/session/arc_vm_data_migration_status.h" #include "ash/components/arc/session/arc_vm_data_migration_status.h"
#include "ash/constants/app_types.h"
#include "ash/constants/ash_switches.h" #include "ash/constants/ash_switches.h"
#include "ash/system/time/calendar_utils.h" #include "ash/system/time/calendar_utils.h"
#include "ash/system/time/date_helper.h" #include "ash/system/time/date_helper.h"

@@ -13,7 +13,6 @@
#include "ash/components/arc/arc_prefs.h" #include "ash/components/arc/arc_prefs.h"
#include "ash/components/arc/session/arc_vm_data_migration_status.h" #include "ash/components/arc/session/arc_vm_data_migration_status.h"
#include "ash/components/arc/test/arc_util_test_support.h" #include "ash/components/arc/test/arc_util_test_support.h"
#include "ash/constants/app_types.h"
#include "ash/constants/ash_switches.h" #include "ash/constants/ash_switches.h"
#include "ash/test/ash_test_base.h" #include "ash/test/ash_test_base.h"
#include "base/base_switches.h" #include "base/base_switches.h"

@@ -10,7 +10,6 @@
#include "ash/components/arc/arc_features.h" #include "ash/components/arc/arc_features.h"
#include "ash/components/arc/compat_mode/metrics.h" #include "ash/components/arc/compat_mode/metrics.h"
#include "ash/components/arc/compat_mode/test/compat_mode_test_base.h" #include "ash/components/arc/compat_mode/test/compat_mode_test_base.h"
#include "ash/constants/app_types.h"
#include "ash/public/cpp/arc_resize_lock_type.h" #include "ash/public/cpp/arc_resize_lock_type.h"
#include "ash/public/cpp/resize_shadow_type.h" #include "ash/public/cpp/resize_shadow_type.h"
#include "ash/public/cpp/window_properties.h" #include "ash/public/cpp/window_properties.h"
@@ -20,6 +19,7 @@
#include "base/test/bind.h" #include "base/test/bind.h"
#include "base/test/metrics/histogram_tester.h" #include "base/test/metrics/histogram_tester.h"
#include "base/test/scoped_feature_list.h" #include "base/test/scoped_feature_list.h"
#include "chromeos/ui/base/app_types.h"
#include "chromeos/ui/base/window_properties.h" #include "chromeos/ui/base/window_properties.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
#include "ui/aura/client/aura_constants.h" #include "ui/aura/client/aura_constants.h"
@@ -122,8 +122,7 @@ class ArcResizeLockManagerTest : public CompatModeTestBase {
auto window = std::make_unique<aura::Window>( auto window = std::make_unique<aura::Window>(
nullptr, aura::client::WINDOW_TYPE_NORMAL); nullptr, aura::client::WINDOW_TYPE_NORMAL);
if (is_arc) { if (is_arc) {
window->SetProperty(aura::client::kAppType, window->SetProperty(chromeos::kAppTypeKey, chromeos::AppType::ARC_APP);
static_cast<int>(ash::AppType::ARC_APP));
} }
window->Init(ui::LAYER_TEXTURED); window->Init(ui::LAYER_TEXTURED);
window->Show(); window->Show();

@@ -9,7 +9,6 @@
#include "ash/components/arc/compat_mode/resize_util.h" #include "ash/components/arc/compat_mode/resize_util.h"
#include "ash/components/arc/compat_mode/test/compat_mode_test_base.h" #include "ash/components/arc/compat_mode/test/compat_mode_test_base.h"
#include "ash/constants/app_types.h"
#include "ash/public/cpp/window_properties.h" #include "ash/public/cpp/window_properties.h"
#include "chromeos/ui/frame/caption_buttons/frame_center_button.h" #include "chromeos/ui/frame/caption_buttons/frame_center_button.h"
#include "chromeos/ui/frame/default_frame_header.h" #include "chromeos/ui/frame/default_frame_header.h"

@@ -5,9 +5,10 @@
#include "ash/components/arc/compat_mode/test/compat_mode_test_base.h" #include "ash/components/arc/compat_mode/test/compat_mode_test_base.h"
#include "ash/components/arc/compat_mode/arc_window_property_util.h" #include "ash/components/arc/compat_mode/arc_window_property_util.h"
#include "ash/constants/app_types.h"
#include "ash/public/cpp/window_properties.h" #include "ash/public/cpp/window_properties.h"
#include "base/containers/flat_map.h" #include "base/containers/flat_map.h"
#include "chromeos/ui/base/app_types.h"
#include "chromeos/ui/base/window_properties.h"
#include "ui/aura/client/aura_constants.h" #include "ui/aura/client/aura_constants.h"
#include "ui/events/base_event_utils.h" #include "ui/events/base_event_utils.h"
#include "ui/events/test/event_generator.h" #include "ui/events/test/event_generator.h"
@@ -97,8 +98,8 @@ std::unique_ptr<views::Widget> CompatModeTestBase::CreateArcWidget(
auto widget = CreateWidget(/*show=*/false); auto widget = CreateWidget(/*show=*/false);
if (app_id) if (app_id)
widget->GetNativeWindow()->SetProperty(ash::kAppIDKey, *app_id); widget->GetNativeWindow()->SetProperty(ash::kAppIDKey, *app_id);
widget->GetNativeWindow()->SetProperty( widget->GetNativeWindow()->SetProperty(chromeos::kAppTypeKey,
aura::client::kAppType, static_cast<int>(ash::AppType::ARC_APP)); chromeos::AppType::ARC_APP);
if (show) if (show)
widget->Show(); widget->Show();
return widget; return widget;

@@ -109,8 +109,9 @@ class ArcWindowDelegateImpl : public ArcImeService::ArcWindowDelegate {
// IsArcAppWindow returns false for a window of ARC++ Kiosk app, so we // IsArcAppWindow returns false for a window of ARC++ Kiosk app, so we
// have to check application id of the active window to cover that case. // have to check application id of the active window to cover that case.
// TODO(yhanada): Make IsArcAppWindow support a window of ARC++ Kiosk. // TODO(yhanada): Make IsArcAppWindow support a window of ARC++ Kiosk.
// Specifically, a window of ARC++ Kiosk should have ash::AppType::ARC_APP // Specifically, a window of ARC++ Kiosk should have
// property. Please see implementation of IsArcAppWindow(). // chromeos::AppType::ARC_APP property. Please see implementation of
// IsArcAppWindow().
if (window == active && IsArcKioskMode() && if (window == active && IsArcKioskMode() &&
GetWindowTaskId(window).has_value()) { GetWindowTaskId(window).has_value()) {
return true; return true;

@@ -15,7 +15,6 @@
#include "ash/components/arc/metrics/stability_metrics_manager.h" #include "ash/components/arc/metrics/stability_metrics_manager.h"
#include "ash/components/arc/session/arc_service_manager.h" #include "ash/components/arc/session/arc_service_manager.h"
#include "ash/components/arc/test/fake_process_instance.h" #include "ash/components/arc/test/fake_process_instance.h"
#include "ash/constants/app_types.h"
#include "base/command_line.h" #include "base/command_line.h"
#include "base/memory/raw_ptr.h" #include "base/memory/raw_ptr.h"
#include "base/metrics/histogram_samples.h" #include "base/metrics/histogram_samples.h"
@@ -25,6 +24,8 @@
#include "base/test/metrics/histogram_tester.h" #include "base/test/metrics/histogram_tester.h"
#include "chromeos/ash/components/dbus/concierge/fake_concierge_client.h" #include "chromeos/ash/components/dbus/concierge/fake_concierge_client.h"
#include "chromeos/ash/components/dbus/session_manager/fake_session_manager_client.h" #include "chromeos/ash/components/dbus/session_manager/fake_session_manager_client.h"
#include "chromeos/ui/base/app_types.h"
#include "chromeos/ui/base/window_properties.h"
#include "components/prefs/testing_pref_service.h" #include "components/prefs/testing_pref_service.h"
#include "components/session_manager/core/session_manager.h" #include "components/session_manager/core/session_manager.h"
#include "components/user_prefs/test/test_browser_context_with_prefs.h" #include "components/user_prefs/test/test_browser_context_with_prefs.h"
@@ -142,8 +143,8 @@ class ArcMetricsServiceTest : public testing::Test {
void CreateFakeWindows() { void CreateFakeWindows() {
fake_arc_window_.reset(aura::test::CreateTestWindowWithId( fake_arc_window_.reset(aura::test::CreateTestWindowWithId(
/*id=*/0, nullptr)); /*id=*/0, nullptr));
fake_arc_window_->SetProperty(aura::client::kAppType, fake_arc_window_->SetProperty(chromeos::kAppTypeKey,
static_cast<int>(ash::AppType::ARC_APP)); chromeos::AppType::ARC_APP);
fake_non_arc_window_.reset(aura::test::CreateTestWindowWithId( fake_non_arc_window_.reset(aura::test::CreateTestWindowWithId(
/*id=*/1, nullptr)); /*id=*/1, nullptr));
} }

@@ -4,7 +4,6 @@
#include "ash/components/arc/metrics/arc_wm_metrics.h" #include "ash/components/arc/metrics/arc_wm_metrics.h"
#include "ash/constants/app_types.h"
#include "ash/public/cpp/app_types_util.h" #include "ash/public/cpp/app_types_util.h"
#include "ash/root_window_controller.h" #include "ash/root_window_controller.h"
#include "ash/screen_util.h" #include "ash/screen_util.h"
@@ -16,6 +15,8 @@
#include "base/metrics/histogram_functions.h" #include "base/metrics/histogram_functions.h"
#include "base/strings/strcat.h" #include "base/strings/strcat.h"
#include "base/timer/elapsed_timer.h" #include "base/timer/elapsed_timer.h"
#include "chromeos/ui/base/app_types.h"
#include "chromeos/ui/base/window_properties.h"
#include "chromeos/ui/base/window_state_type.h" #include "chromeos/ui/base/window_state_type.h"
#include "components/exo/shell_surface_base.h" #include "components/exo/shell_surface_base.h"
#include "components/exo/shell_surface_util.h" #include "components/exo/shell_surface_util.h"
@@ -56,17 +57,17 @@ constexpr char kChromeAppHistogramName[] = "ChromeApp";
constexpr char kSystemAppHistogramName[] = "SystemApp"; constexpr char kSystemAppHistogramName[] = "SystemApp";
constexpr char kCrostiniAppHistogramName[] = "CrostiniApp"; constexpr char kCrostiniAppHistogramName[] = "CrostiniApp";
std::string GetAppTypeName(ash::AppType app_type) { std::string GetAppTypeName(chromeos::AppType app_type) {
switch (app_type) { switch (app_type) {
case ash::AppType::ARC_APP: case chromeos::AppType::ARC_APP:
return kArcHistogramName; return kArcHistogramName;
case ash::AppType::BROWSER: case chromeos::AppType::BROWSER:
return kBrowserHistogramName; return kBrowserHistogramName;
case ash::AppType::CHROME_APP: case chromeos::AppType::CHROME_APP:
return kChromeAppHistogramName; return kChromeAppHistogramName;
case ash::AppType::SYSTEM_APP: case chromeos::AppType::SYSTEM_APP:
return kSystemAppHistogramName; return kSystemAppHistogramName;
case ash::AppType::CROSTINI_APP: case chromeos::AppType::CROSTINI_APP:
return kCrostiniAppHistogramName; return kCrostiniAppHistogramName;
default: default:
return "Others"; return "Others";
@@ -115,8 +116,8 @@ class ArcWmMetrics::WindowStateChangeObserver
private: private:
void RecordWindowStateChangeDelay(ash::WindowState* state) { void RecordWindowStateChangeDelay(ash::WindowState* state) {
const ash::AppType app_type = const chromeos::AppType app_type =
static_cast<ash::AppType>(window_->GetProperty(aura::client::kAppType)); window_->GetProperty(chromeos::kAppTypeKey);
if (display::Screen::GetScreen()->InTabletMode()) { if (display::Screen::GetScreen()->InTabletMode()) {
// When entering tablet mode, we only collect the data of visible window. // When entering tablet mode, we only collect the data of visible window.
if (state->IsMaximized() && window_->IsVisible()) { if (state->IsMaximized() && window_->IsVisible()) {
@@ -226,8 +227,8 @@ class ArcWmMetrics::WindowRotationObserver : public aura::WindowObserver {
private: private:
void RecordWindowRotateDelay() { void RecordWindowRotateDelay() {
const ash::AppType app_type = const chromeos::AppType app_type =
static_cast<ash::AppType>(window_->GetProperty(aura::client::kAppType)); window_->GetProperty(chromeos::kAppTypeKey);
base::UmaHistogramCustomTimes( base::UmaHistogramCustomTimes(
ArcWmMetrics::GetWindowRotateTimeHistogramName(app_type), ArcWmMetrics::GetWindowRotateTimeHistogramName(app_type),
window_bounds_change_elapsed_timer_.Elapsed(), window_bounds_change_elapsed_timer_.Elapsed(),
@@ -259,27 +260,28 @@ ArcWmMetrics::~ArcWmMetrics() = default;
// static // static
std::string ArcWmMetrics::GetWindowMaximizedTimeHistogramName( std::string ArcWmMetrics::GetWindowMaximizedTimeHistogramName(
ash::AppType app_type) { chromeos::AppType app_type) {
const std::string app_type_str = GetAppTypeName(app_type); const std::string app_type_str = GetAppTypeName(app_type);
return base::StrCat({kWindowMaximizedTimeHistogramPrefix, app_type_str}); return base::StrCat({kWindowMaximizedTimeHistogramPrefix, app_type_str});
} }
// static // static
std::string ArcWmMetrics::GetWindowMinimizedTimeHistogramName( std::string ArcWmMetrics::GetWindowMinimizedTimeHistogramName(
ash::AppType app_type) { chromeos::AppType app_type) {
const std::string app_type_str = GetAppTypeName(app_type); const std::string app_type_str = GetAppTypeName(app_type);
return base::StrCat({kWindowMinimizedTimeHistogramPrefix, app_type_str}); return base::StrCat({kWindowMinimizedTimeHistogramPrefix, app_type_str});
} }
// static // static
std::string ArcWmMetrics::GetArcWindowClosedTimeHistogramName() { std::string ArcWmMetrics::GetArcWindowClosedTimeHistogramName() {
const std::string arc_app_type_str = GetAppTypeName(ash::AppType::ARC_APP); const std::string arc_app_type_str =
GetAppTypeName(chromeos::AppType::ARC_APP);
return base::StrCat({kWindowClosedTimeHistogramPrefix, arc_app_type_str}); return base::StrCat({kWindowClosedTimeHistogramPrefix, arc_app_type_str});
} }
// static // static
std::string ArcWmMetrics::GetWindowEnterTabletModeTimeHistogramName( std::string ArcWmMetrics::GetWindowEnterTabletModeTimeHistogramName(
ash::AppType app_type) { chromeos::AppType app_type) {
const std::string app_type_str = GetAppTypeName(app_type); const std::string app_type_str = GetAppTypeName(app_type);
return base::StrCat( return base::StrCat(
{kWindowEnterTabletModeTimeHistogramPrefix, app_type_str}); {kWindowEnterTabletModeTimeHistogramPrefix, app_type_str});
@@ -287,22 +289,21 @@ std::string ArcWmMetrics::GetWindowEnterTabletModeTimeHistogramName(
// static // static
std::string ArcWmMetrics::GetWindowExitTabletModeTimeHistogramName( std::string ArcWmMetrics::GetWindowExitTabletModeTimeHistogramName(
ash::AppType app_type) { chromeos::AppType app_type) {
const std::string app_type_str = GetAppTypeName(app_type); const std::string app_type_str = GetAppTypeName(app_type);
return base::StrCat({kWindowExitTabletModeTimeHistogramPrefix, app_type_str}); return base::StrCat({kWindowExitTabletModeTimeHistogramPrefix, app_type_str});
} }
// static // static
std::string ArcWmMetrics::GetWindowRotateTimeHistogramName( std::string ArcWmMetrics::GetWindowRotateTimeHistogramName(
ash::AppType app_type) { chromeos::AppType app_type) {
const std::string app_type_str = GetAppTypeName(app_type); const std::string app_type_str = GetAppTypeName(app_type);
return base::StrCat({kWindowRotateTimeHistogramPrefix, app_type_str}); return base::StrCat({kWindowRotateTimeHistogramPrefix, app_type_str});
} }
void ArcWmMetrics::OnWindowInitialized(aura::Window* new_window) { void ArcWmMetrics::OnWindowInitialized(aura::Window* new_window) {
ash::AppType app_type = static_cast<ash::AppType>( chromeos::AppType app_type = new_window->GetProperty(chromeos::kAppTypeKey);
new_window->GetProperty(aura::client::kAppType)); if (app_type == chromeos::AppType::NON_APP) {
if (app_type == ash::AppType::NON_APP) {
return; return;
} }
@@ -312,7 +313,7 @@ void ArcWmMetrics::OnWindowInitialized(aura::Window* new_window) {
window_observations_.AddObservation(new_window); window_observations_.AddObservation(new_window);
if (app_type == ash::AppType::ARC_APP) { if (app_type == chromeos::AppType::ARC_APP) {
auto* shell_surface_base = exo::GetShellSurfaceBaseForWindow(new_window); auto* shell_surface_base = exo::GetShellSurfaceBaseForWindow(new_window);
// |shell_surface_base| can be null in unit tests. // |shell_surface_base| can be null in unit tests.

@@ -8,13 +8,13 @@
#include <memory> #include <memory>
#include <string> #include <string>
#include "ash/constants/app_types.h"
#include "ash/rotator/screen_rotation_animator.h" #include "ash/rotator/screen_rotation_animator.h"
#include "ash/rotator/screen_rotation_animator_observer.h" #include "ash/rotator/screen_rotation_animator_observer.h"
#include "ash/shell.h" #include "ash/shell.h"
#include "ash/shell_observer.h" #include "ash/shell_observer.h"
#include "base/scoped_multi_source_observation.h" #include "base/scoped_multi_source_observation.h"
#include "base/scoped_observation.h" #include "base/scoped_observation.h"
#include "chromeos/ui/base/app_types.h"
#include "ui/aura/env.h" #include "ui/aura/env.h"
#include "ui/aura/env_observer.h" #include "ui/aura/env_observer.h"
#include "ui/aura/window.h" #include "ui/aura/window.h"
@@ -38,19 +38,22 @@ class ArcWmMetrics : public aura::EnvObserver,
ArcWmMetrics& operator=(const ArcWmMetrics&) = delete; ArcWmMetrics& operator=(const ArcWmMetrics&) = delete;
~ArcWmMetrics() override; ~ArcWmMetrics() override;
static std::string GetWindowMaximizedTimeHistogramName(ash::AppType app_type); static std::string GetWindowMaximizedTimeHistogramName(
chromeos::AppType app_type);
static std::string GetWindowMinimizedTimeHistogramName(ash::AppType app_type); static std::string GetWindowMinimizedTimeHistogramName(
chromeos::AppType app_type);
static std::string GetArcWindowClosedTimeHistogramName(); static std::string GetArcWindowClosedTimeHistogramName();
static std::string GetWindowEnterTabletModeTimeHistogramName( static std::string GetWindowEnterTabletModeTimeHistogramName(
ash::AppType app_type); chromeos::AppType app_type);
static std::string GetWindowExitTabletModeTimeHistogramName( static std::string GetWindowExitTabletModeTimeHistogramName(
ash::AppType app_type); chromeos::AppType app_type);
static std::string GetWindowRotateTimeHistogramName(ash::AppType app_type); static std::string GetWindowRotateTimeHistogramName(
chromeos::AppType app_type);
// aura::EnvObserver // aura::EnvObserver
void OnWindowInitialized(aura::Window* new_window) override; void OnWindowInitialized(aura::Window* new_window) override;

@@ -6,10 +6,10 @@
#include <memory> #include <memory>
#include "ash/constants/app_types.h"
#include "ash/test/ash_test_base.h" #include "ash/test/ash_test_base.h"
#include "ash/wm/tablet_mode/tablet_mode_controller_test_api.h" #include "ash/wm/tablet_mode/tablet_mode_controller_test_api.h"
#include "base/test/metrics/histogram_tester.h" #include "base/test/metrics/histogram_tester.h"
#include "chromeos/ui/base/app_types.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
#include "ui/aura/client/aura_constants.h" #include "ui/aura/client/aura_constants.h"
#include "ui/aura/window.h" #include "ui/aura/window.h"
@@ -52,7 +52,7 @@ class ArcWmMetricsTest : public ash::AshTestBase {
}; };
TEST_F(ArcWmMetricsTest, TestWindowMaximizeDelayMetrics) { TEST_F(ArcWmMetricsTest, TestWindowMaximizeDelayMetrics) {
ash::AppType app_type = ash::AppType::ARC_APP; chromeos::AppType app_type = chromeos::AppType::ARC_APP;
auto window = CreateAppWindow(gfx::Rect(0, 0, 100, 100), app_type); auto window = CreateAppWindow(gfx::Rect(0, 0, 100, 100), app_type);
window->SetProperty(aura::client::kResizeBehaviorKey, window->SetProperty(aura::client::kResizeBehaviorKey,
aura::client::kResizeBehaviorCanMaximize); aura::client::kResizeBehaviorCanMaximize);
@@ -81,7 +81,7 @@ TEST_F(ArcWmMetricsTest, TestWindowMaximizeDelayMetrics) {
} }
TEST_F(ArcWmMetricsTest, TestWindowMinimizeDelayMetrics) { TEST_F(ArcWmMetricsTest, TestWindowMinimizeDelayMetrics) {
ash::AppType app_type = ash::AppType::ARC_APP; chromeos::AppType app_type = chromeos::AppType::ARC_APP;
auto window = CreateAppWindow(gfx::Rect(0, 0, 100, 100), app_type); auto window = CreateAppWindow(gfx::Rect(0, 0, 100, 100), app_type);
window->SetProperty(aura::client::kResizeBehaviorKey, window->SetProperty(aura::client::kResizeBehaviorKey,
aura::client::kResizeBehaviorCanMinimize); aura::client::kResizeBehaviorCanMinimize);
@@ -105,7 +105,7 @@ TEST_F(ArcWmMetricsTest, TestWindowMinimizeDelayMetrics) {
TEST_F(ArcWmMetricsTest, TestWindowCloseDelayMetrics) { TEST_F(ArcWmMetricsTest, TestWindowCloseDelayMetrics) {
auto window = auto window =
CreateAppWindow(gfx::Rect(0, 0, 100, 100), ash::AppType::ARC_APP); CreateAppWindow(gfx::Rect(0, 0, 100, 100), chromeos::AppType::ARC_APP);
window->Show(); window->Show();
base::HistogramTester histogram_tester; base::HistogramTester histogram_tester;
@@ -121,7 +121,7 @@ TEST_F(ArcWmMetricsTest, TestWindowCloseDelayMetrics) {
} }
TEST_F(ArcWmMetricsTest, TestWindowEnterTabletModeDelayMetrics) { TEST_F(ArcWmMetricsTest, TestWindowEnterTabletModeDelayMetrics) {
ash::AppType app_type = ash::AppType::ARC_APP; chromeos::AppType app_type = chromeos::AppType::ARC_APP;
auto window = CreateAppWindow(gfx::Rect(0, 0, 100, 100), app_type); auto window = CreateAppWindow(gfx::Rect(0, 0, 100, 100), app_type);
window->Show(); window->Show();
@@ -140,19 +140,19 @@ TEST_F(ArcWmMetricsTest, TestWindowEnterTabletModeDelayMetrics) {
TEST_F(ArcWmMetricsTest, TestMultipleWindowsEnterTabletModeDelayMetrics) { TEST_F(ArcWmMetricsTest, TestMultipleWindowsEnterTabletModeDelayMetrics) {
auto lower_window = auto lower_window =
CreateAppWindow(gfx::Rect(0, 0, 100, 100), ash::AppType::BROWSER); CreateAppWindow(gfx::Rect(0, 0, 100, 100), chromeos::AppType::BROWSER);
lower_window->Show(); lower_window->Show();
auto upper_window = auto upper_window =
CreateAppWindow(gfx::Rect(0, 0, 100, 100), ash::AppType::ARC_APP); CreateAppWindow(gfx::Rect(0, 0, 100, 100), chromeos::AppType::ARC_APP);
upper_window->Show(); upper_window->Show();
base::HistogramTester histogram_tester; base::HistogramTester histogram_tester;
const auto histogram_name_lower_window = const auto histogram_name_lower_window =
ArcWmMetrics::GetWindowEnterTabletModeTimeHistogramName( ArcWmMetrics::GetWindowEnterTabletModeTimeHistogramName(
ash::AppType::BROWSER); chromeos::AppType::BROWSER);
const auto histogram_name_upper_window = const auto histogram_name_upper_window =
ArcWmMetrics::GetWindowEnterTabletModeTimeHistogramName( ArcWmMetrics::GetWindowEnterTabletModeTimeHistogramName(
ash::AppType::ARC_APP); chromeos::AppType::ARC_APP);
histogram_tester.ExpectTotalCount(histogram_name_lower_window, 0); histogram_tester.ExpectTotalCount(histogram_name_lower_window, 0);
histogram_tester.ExpectTotalCount(histogram_name_upper_window, 0); histogram_tester.ExpectTotalCount(histogram_name_upper_window, 0);
@@ -164,7 +164,7 @@ TEST_F(ArcWmMetricsTest, TestMultipleWindowsEnterTabletModeDelayMetrics) {
} }
TEST_F(ArcWmMetricsTest, TestWindowLeaveTabletModeDelayMetrics) { TEST_F(ArcWmMetricsTest, TestWindowLeaveTabletModeDelayMetrics) {
ash::AppType app_type = ash::AppType::ARC_APP; chromeos::AppType app_type = chromeos::AppType::ARC_APP;
auto window = CreateAppWindow(gfx::Rect(0, 0, 100, 100), app_type); auto window = CreateAppWindow(gfx::Rect(0, 0, 100, 100), app_type);
window->Show(); window->Show();
@@ -190,7 +190,7 @@ TEST_F(ArcWmMetricsTest, TestWindowLeaveTabletModeDelayMetrics) {
} }
TEST_F(ArcWmMetricsTest, TestWindowRotateDelayOnDisplayRotationMetrics) { TEST_F(ArcWmMetricsTest, TestWindowRotateDelayOnDisplayRotationMetrics) {
ash::AppType app_type = ash::AppType::ARC_APP; chromeos::AppType app_type = chromeos::AppType::ARC_APP;
auto window = CreateAppWindow(gfx::Rect(0, 0, 100, 100), app_type); auto window = CreateAppWindow(gfx::Rect(0, 0, 100, 100), app_type);
window->Show(); window->Show();

@@ -13,7 +13,6 @@ component("constants") {
"ambient_time_of_day_constants.h", "ambient_time_of_day_constants.h",
"ambient_video.cc", "ambient_video.cc",
"ambient_video.h", "ambient_video.h",
"app_types.h",
"ash_constants.cc", "ash_constants.cc",
"ash_constants.h", "ash_constants.h",
"ash_features.cc", "ash_features.cc",

@@ -8,7 +8,6 @@
#include "ash/accelerometer/accelerometer_reader.h" #include "ash/accelerometer/accelerometer_reader.h"
#include "ash/accelerometer/accelerometer_types.h" #include "ash/accelerometer/accelerometer_types.h"
#include "ash/app_list/app_list_controller_impl.h" #include "ash/app_list/app_list_controller_impl.h"
#include "ash/constants/app_types.h"
#include "ash/constants/ash_switches.h" #include "ash/constants/ash_switches.h"
#include "ash/display/cursor_window_controller.h" #include "ash/display/cursor_window_controller.h"
#include "ash/display/display_configuration_controller.h" #include "ash/display/display_configuration_controller.h"
@@ -42,6 +41,8 @@
#include "base/strings/stringprintf.h" #include "base/strings/stringprintf.h"
#include "base/test/scoped_feature_list.h" #include "base/test/scoped_feature_list.h"
#include "build/build_config.h" #include "build/build_config.h"
#include "chromeos/ui/base/app_types.h"
#include "chromeos/ui/base/window_properties.h"
#include "ui/aura/client/aura_constants.h" #include "ui/aura/client/aura_constants.h"
#include "ui/aura/env.h" #include "ui/aura/env.h"
#include "ui/aura/window_observer.h" #include "ui/aura/window_observer.h"
@@ -4271,22 +4272,19 @@ TEST_F(DisplayManagerOrientationTest, SaveRestoreUserRotationLock) {
// Set up windows with portrait, landscape, and any. // Set up windows with portrait, landscape, and any.
aura::Window* window_a = CreateTestWindowInShellWithId(0); aura::Window* window_a = CreateTestWindowInShellWithId(0);
{ {
window_a->SetProperty(aura::client::kAppType, window_a->SetProperty(chromeos::kAppTypeKey, chromeos::AppType::CHROME_APP);
static_cast<int>(AppType::CHROME_APP));
orientation_controller->LockOrientationForWindow( orientation_controller->LockOrientationForWindow(
window_a, chromeos::OrientationType::kAny); window_a, chromeos::OrientationType::kAny);
} }
aura::Window* window_p = CreateTestWindowInShellWithId(0); aura::Window* window_p = CreateTestWindowInShellWithId(0);
{ {
window_p->SetProperty(aura::client::kAppType, window_p->SetProperty(chromeos::kAppTypeKey, chromeos::AppType::CHROME_APP);
static_cast<int>(AppType::CHROME_APP));
orientation_controller->LockOrientationForWindow( orientation_controller->LockOrientationForWindow(
window_p, chromeos::OrientationType::kPortrait); window_p, chromeos::OrientationType::kPortrait);
} }
aura::Window* window_l = CreateTestWindowInShellWithId(0); aura::Window* window_l = CreateTestWindowInShellWithId(0);
{ {
window_l->SetProperty(aura::client::kAppType, window_l->SetProperty(chromeos::kAppTypeKey, chromeos::AppType::CHROME_APP);
static_cast<int>(AppType::CHROME_APP));
orientation_controller->LockOrientationForWindow( orientation_controller->LockOrientationForWindow(
window_l, chromeos::OrientationType::kLandscape); window_l, chromeos::OrientationType::kLandscape);
} }
@@ -4393,8 +4391,7 @@ TEST_F(DisplayManagerOrientationTest, UserRotationLockReverse) {
// Set up windows with portrait, landscape, and any. // Set up windows with portrait, landscape, and any.
aura::Window* window = CreateTestWindowInShellWithId(0); aura::Window* window = CreateTestWindowInShellWithId(0);
window->SetProperty(aura::client::kAppType, window->SetProperty(chromeos::kAppTypeKey, chromeos::AppType::CHROME_APP);
static_cast<int>(AppType::CHROME_APP));
display::Screen* screen = display::Screen::GetScreen(); display::Screen* screen = display::Screen::GetScreen();
// Just enabling will not save the lock. // Just enabling will not save the lock.
@@ -4437,8 +4434,7 @@ TEST_F(DisplayManagerOrientationTest, LockToSpecificOrientation) {
aura::Window* window_a = CreateTestWindowInShellWithId(0); aura::Window* window_a = CreateTestWindowInShellWithId(0);
{ {
window_a->SetProperty(aura::client::kAppType, window_a->SetProperty(chromeos::kAppTypeKey, chromeos::AppType::CHROME_APP);
static_cast<int>(AppType::CHROME_APP));
orientation_controller->LockOrientationForWindow( orientation_controller->LockOrientationForWindow(
window_a, chromeos::OrientationType::kAny); window_a, chromeos::OrientationType::kAny);
} }
@@ -4453,12 +4449,10 @@ TEST_F(DisplayManagerOrientationTest, LockToSpecificOrientation) {
orientation_controller->OnAccelerometerUpdated(portrait_secondary); orientation_controller->OnAccelerometerUpdated(portrait_secondary);
aura::Window* window_lsc = CreateTestWindowInShellWithId(1); aura::Window* window_lsc = CreateTestWindowInShellWithId(1);
window_lsc->SetProperty(aura::client::kAppType, window_lsc->SetProperty(chromeos::kAppTypeKey, chromeos::AppType::CHROME_APP);
static_cast<int>(AppType::CHROME_APP));
aura::Window* window_psc = CreateTestWindowInShellWithId(1); aura::Window* window_psc = CreateTestWindowInShellWithId(1);
window_psc->SetProperty(aura::client::kAppType, window_psc->SetProperty(chromeos::kAppTypeKey, chromeos::AppType::CHROME_APP);
static_cast<int>(AppType::CHROME_APP));
orientation_controller->LockOrientationForWindow( orientation_controller->LockOrientationForWindow(
window_psc, chromeos::OrientationType::kPortraitSecondary); window_psc, chromeos::OrientationType::kPortraitSecondary);

@@ -6,7 +6,6 @@
#include "ash/accelerometer/accelerometer_reader.h" #include "ash/accelerometer/accelerometer_reader.h"
#include "ash/accelerometer/accelerometer_types.h" #include "ash/accelerometer/accelerometer_types.h"
#include "ash/constants/app_types.h"
#include "ash/constants/ash_switches.h" #include "ash/constants/ash_switches.h"
#include "ash/shell.h" #include "ash/shell.h"
#include "ash/wm/mru_window_tracker.h" #include "ash/wm/mru_window_tracker.h"
@@ -18,8 +17,9 @@
#include "base/command_line.h" #include "base/command_line.h"
#include "base/containers/contains.h" #include "base/containers/contains.h"
#include "base/scoped_observation.h" #include "base/scoped_observation.h"
#include "chromeos/ui/base/app_types.h"
#include "chromeos/ui/base/display_util.h" #include "chromeos/ui/base/display_util.h"
#include "ui/aura/client/aura_constants.h" #include "chromeos/ui/base/window_properties.h"
#include "ui/display/display.h" #include "ui/display/display.h"
#include "ui/display/manager/display_manager.h" #include "ui/display/manager/display_manager.h"
#include "ui/display/manager/managed_display_info.h" #include "ui/display/manager/managed_display_info.h"
@@ -744,8 +744,8 @@ bool ScreenOrientationController::ApplyLockForWindowIfPossible(
// The default orientation for all chrome browser/apps windows is // The default orientation for all chrome browser/apps windows is
// ANY, so use the user_locked_orientation_; // ANY, so use the user_locked_orientation_;
if (static_cast<AppType>(window->GetProperty(aura::client::kAppType)) != if (window->GetProperty(chromeos::kAppTypeKey) !=
AppType::NON_APP) { chromeos::AppType::NON_APP) {
LockRotationToOrientation(user_locked_orientation_); LockRotationToOrientation(user_locked_orientation_);
return true; return true;
} }

@@ -9,7 +9,6 @@
#include "ash/accelerometer/accelerometer_reader.h" #include "ash/accelerometer/accelerometer_reader.h"
#include "ash/accelerometer/accelerometer_types.h" #include "ash/accelerometer/accelerometer_types.h"
#include "ash/constants/app_types.h"
#include "ash/constants/ash_switches.h" #include "ash/constants/ash_switches.h"
#include "ash/display/screen_orientation_controller_test_api.h" #include "ash/display/screen_orientation_controller_test_api.h"
#include "ash/shell.h" #include "ash/shell.h"
@@ -24,6 +23,8 @@
#include "ash/wm/window_util.h" #include "ash/wm/window_util.h"
#include "base/command_line.h" #include "base/command_line.h"
#include "base/numerics/math_constants.h" #include "base/numerics/math_constants.h"
#include "chromeos/ui/base/app_types.h"
#include "chromeos/ui/base/window_properties.h"
#include "ui/aura/client/aura_constants.h" #include "ui/aura/client/aura_constants.h"
#include "ui/aura/window.h" #include "ui/aura/window.h"
#include "ui/compositor/layer_type.h" #include "ui/compositor/layer_type.h"
@@ -128,8 +129,7 @@ class ScreenOrientationControllerTest : public AshTestBase {
protected: protected:
aura::Window* CreateAppWindowInShellWithId(int id) { aura::Window* CreateAppWindowInShellWithId(int id) {
aura::Window* window = CreateTestWindowInShellWithId(id); aura::Window* window = CreateTestWindowInShellWithId(id);
window->SetProperty(aura::client::kAppType, window->SetProperty(chromeos::kAppTypeKey, chromeos::AppType::CHROME_APP);
static_cast<int>(AppType::CHROME_APP));
return window; return window;
} }

@@ -4,7 +4,6 @@
#include "ash/drag_drop/tab_drag_drop_delegate.h" #include "ash/drag_drop/tab_drag_drop_delegate.h"
#include "ash/constants/app_types.h"
#include "ash/constants/ash_features.h" #include "ash/constants/ash_features.h"
#include "ash/drag_drop/tab_drag_drop_windows_hider.h" #include "ash/drag_drop/tab_drag_drop_windows_hider.h"
#include "ash/public/cpp/new_window_delegate.h" #include "ash/public/cpp/new_window_delegate.h"
@@ -24,7 +23,8 @@
#include "base/pickle.h" #include "base/pickle.h"
#include "base/strings/utf_string_conversions.h" #include "base/strings/utf_string_conversions.h"
#include "chromeos/crosapi/cpp/lacros_startup_state.h" #include "chromeos/crosapi/cpp/lacros_startup_state.h"
#include "ui/aura/client/aura_constants.h" #include "chromeos/ui/base/app_types.h"
#include "chromeos/ui/base/window_properties.h"
#include "ui/base/clipboard/clipboard_format_type.h" #include "ui/base/clipboard/clipboard_format_type.h"
#include "ui/base/clipboard/custom_data_helper.h" #include "ui/base/clipboard/custom_data_helper.h"
#include "ui/base/dragdrop/os_exchange_data.h" #include "ui/base/dragdrop/os_exchange_data.h"
@@ -66,9 +66,8 @@ constexpr char kTabDraggingInTabletModeMaxLatencyHistogram[] =
DEFINE_UI_CLASS_PROPERTY_KEY(bool, kIsSourceWindowForDrag, false) DEFINE_UI_CLASS_PROPERTY_KEY(bool, kIsSourceWindowForDrag, false)
bool IsLacrosWindow(const aura::Window* window) { bool IsLacrosWindow(const aura::Window* window) {
auto app_type = auto app_type = window->GetProperty(chromeos::kAppTypeKey);
static_cast<AppType>(window->GetProperty(aura::client::kAppType)); return app_type == chromeos::AppType::LACROS;
return app_type == AppType::LACROS;
} }
// Returns the overview session if overview mode is active, otherwise returns // Returns the overview session if overview mode is active, otherwise returns

@@ -30,6 +30,8 @@
#include "base/test/gmock_callback_support.h" #include "base/test/gmock_callback_support.h"
#include "base/test/metrics/histogram_tester.h" #include "base/test/metrics/histogram_tester.h"
#include "base/test/scoped_feature_list.h" #include "base/test/scoped_feature_list.h"
#include "chromeos/ui/base/app_types.h"
#include "chromeos/ui/base/window_properties.h"
#include "testing/gmock/include/gmock/gmock.h" #include "testing/gmock/include/gmock/gmock.h"
#include "ui/aura/client/aura_constants.h" #include "ui/aura/client/aura_constants.h"
#include "ui/base/clipboard/clipboard_format_type.h" #include "ui/base/clipboard/clipboard_format_type.h"
@@ -574,8 +576,7 @@ TEST_F(TabDragDropDelegateTest, DropWithoutNewWindow) {
TEST_F(TabDragDropDelegateTest, CancelTabDragWithFloatedWindow) { TEST_F(TabDragDropDelegateTest, CancelTabDragWithFloatedWindow) {
// Create a floated window. // Create a floated window.
std::unique_ptr<aura::Window> source_window = CreateToplevelTestWindow(); std::unique_ptr<aura::Window> source_window = CreateToplevelTestWindow();
source_window->SetProperty(aura::client::kAppType, source_window->SetProperty(chromeos::kAppTypeKey, chromeos::AppType::BROWSER);
static_cast<int>(AppType::BROWSER));
wm::ActivateWindow(source_window.get()); wm::ActivateWindow(source_window.get());
PressAndReleaseKey(ui::VKEY_F, ui::EF_ALT_DOWN | ui::EF_COMMAND_DOWN); PressAndReleaseKey(ui::VKEY_F, ui::EF_ALT_DOWN | ui::EF_COMMAND_DOWN);
ASSERT_TRUE(WindowState::Get(source_window.get())->IsFloated()); ASSERT_TRUE(WindowState::Get(source_window.get())->IsFloated());

@@ -426,8 +426,8 @@ TEST_F(FrameCaptionButtonContainerViewTest, FloatButtonVisibility) {
// allowed. // allowed.
auto* widget1 = CreateTestWidget(MAXIMIZE_ALLOWED, MINIMIZE_ALLOWED, auto* widget1 = CreateTestWidget(MAXIMIZE_ALLOWED, MINIMIZE_ALLOWED,
CLOSE_BUTTON_VISIBLE); CLOSE_BUTTON_VISIBLE);
widget1->GetNativeWindow()->SetProperty(aura::client::kAppType, widget1->GetNativeWindow()->SetProperty(chromeos::kAppTypeKey,
static_cast<int>(AppType::ARC_APP)); chromeos::AppType::ARC_APP);
FrameCaptionButtonContainerView container1(widget1); FrameCaptionButtonContainerView container1(widget1);
InitContainer(&container1); InitContainer(&container1);
views::test::RunScheduledLayout(&container1); views::test::RunScheduledLayout(&container1);
@@ -443,8 +443,8 @@ TEST_F(FrameCaptionButtonContainerViewTest, FloatButtonVisibility) {
// maximizing (resizing) is disallowed. // maximizing (resizing) is disallowed.
auto* widget2 = CreateTestWidget(MAXIMIZE_DISALLOWED, MINIMIZE_ALLOWED, auto* widget2 = CreateTestWidget(MAXIMIZE_DISALLOWED, MINIMIZE_ALLOWED,
CLOSE_BUTTON_VISIBLE); CLOSE_BUTTON_VISIBLE);
widget2->GetNativeWindow()->SetProperty(aura::client::kAppType, widget2->GetNativeWindow()->SetProperty(chromeos::kAppTypeKey,
static_cast<int>(AppType::ARC_APP)); chromeos::AppType::ARC_APP);
FrameCaptionButtonContainerView container2(widget2); FrameCaptionButtonContainerView container2(widget2);
InitContainer(&container2); InitContainer(&container2);
views::test::RunScheduledLayout(&container2); views::test::RunScheduledLayout(&container2);
@@ -461,8 +461,7 @@ TEST_F(FrameCaptionButtonContainerViewTest, TestFloatButtonBehavior) {
auto* widget = CreateTestWidget(MAXIMIZE_DISALLOWED, MINIMIZE_ALLOWED, auto* widget = CreateTestWidget(MAXIMIZE_DISALLOWED, MINIMIZE_ALLOWED,
CLOSE_BUTTON_VISIBLE); CLOSE_BUTTON_VISIBLE);
auto* window = widget->GetNativeWindow(); auto* window = widget->GetNativeWindow();
window->SetProperty(aura::client::kAppType, window->SetProperty(chromeos::kAppTypeKey, chromeos::AppType::BROWSER);
static_cast<int>(AppType::BROWSER));
widget->Show(); widget->Show();
FrameCaptionButtonContainerView container(widget); FrameCaptionButtonContainerView container(widget);

@@ -176,8 +176,8 @@ class FrameSizeButtonTest : public AshTestBase {
widget_delegate_ = new TestWidgetDelegate(resizable_); widget_delegate_ = new TestWidgetDelegate(resizable_);
widget_ = CreateWidget(widget_delegate_); widget_ = CreateWidget(widget_delegate_);
widget_->GetNativeWindow()->SetProperty(aura::client::kAppType, widget_->GetNativeWindow()->SetProperty(chromeos::kAppTypeKey,
static_cast<int>(AppType::BROWSER)); chromeos::AppType::BROWSER);
window_state_ = WindowState::Get(widget_->GetNativeWindow()); window_state_ = WindowState::Get(widget_->GetNativeWindow());
FrameCaptionButtonContainerView::TestApi test( FrameCaptionButtonContainerView::TestApi test(

@@ -114,7 +114,7 @@ TEST_F(DefaultFrameHeaderTest, MinimumHeaderWidthRTL) {
// Ensure the right frame colors are used. // Ensure the right frame colors are used.
TEST_F(DefaultFrameHeaderTest, FrameColors) { TEST_F(DefaultFrameHeaderTest, FrameColors) {
const auto win0_bounds = gfx::Rect{1, 2, 3, 4}; const auto win0_bounds = gfx::Rect{1, 2, 3, 4};
auto win0 = CreateAppWindow(win0_bounds, AppType::BROWSER); auto win0 = CreateAppWindow(win0_bounds, chromeos::AppType::BROWSER);
Widget* widget = Widget::GetWidgetForNativeWindow(win0.get()); Widget* widget = Widget::GetWidgetForNativeWindow(win0.get());
DefaultFrameHeader* frame_header = DefaultFrameHeader* frame_header =
static_cast<DefaultFrameHeader*>(FrameHeader::Get(widget)); static_cast<DefaultFrameHeader*>(FrameHeader::Get(widget));
@@ -195,8 +195,8 @@ class FramePaintWaiter : public ui::CompositorObserver {
TEST_F(DefaultFrameHeaderTest, DeleteDuringAnimation) { TEST_F(DefaultFrameHeaderTest, DeleteDuringAnimation) {
const auto bounds = gfx::Rect(100, 100); const auto bounds = gfx::Rect(100, 100);
auto win0 = CreateAppWindow(bounds, AppType::BROWSER); auto win0 = CreateAppWindow(bounds, chromeos::AppType::BROWSER);
auto win1 = CreateAppWindow(bounds, AppType::BROWSER); auto win1 = CreateAppWindow(bounds, chromeos::AppType::BROWSER);
Widget* widget = Widget::GetWidgetForNativeWindow(win0.get()); Widget* widget = Widget::GetWidgetForNativeWindow(win0.get());
EXPECT_TRUE(FrameHeader::Get(widget)); EXPECT_TRUE(FrameHeader::Get(widget));
@@ -233,8 +233,8 @@ TEST_F(DefaultFrameHeaderTest, DeleteDuringAnimation) {
// Make sure that the animation is canceled when resized. // Make sure that the animation is canceled when resized.
TEST_F(DefaultFrameHeaderTest, ResizeAndReorderDuringAnimation) { TEST_F(DefaultFrameHeaderTest, ResizeAndReorderDuringAnimation) {
const auto bounds = gfx::Rect(100, 100); const auto bounds = gfx::Rect(100, 100);
auto win_0 = CreateAppWindow(bounds, AppType::BROWSER); auto win_0 = CreateAppWindow(bounds, chromeos::AppType::BROWSER);
auto win_1 = CreateAppWindow(bounds, AppType::BROWSER); auto win_1 = CreateAppWindow(bounds, chromeos::AppType::BROWSER);
EXPECT_TRUE(wm::IsActiveWindow(win_1.get())); EXPECT_TRUE(wm::IsActiveWindow(win_1.get()));
@@ -309,14 +309,14 @@ TEST_F(DefaultFrameHeaderTest, ResizeAndReorderDuringAnimation) {
// create another animation. // create another animation.
TEST_F(DefaultFrameHeaderTest, AnimateDuringAnimation) { TEST_F(DefaultFrameHeaderTest, AnimateDuringAnimation) {
const auto bounds = gfx::Rect(100, 100); const auto bounds = gfx::Rect(100, 100);
auto win_0 = CreateAppWindow(bounds, AppType::BROWSER); auto win_0 = CreateAppWindow(bounds, chromeos::AppType::BROWSER);
// A frame will not animate until it is painted first. // A frame will not animate until it is painted first.
FramePaintWaiter(win_0.get()).Wait(); FramePaintWaiter(win_0.get()).Wait();
auto* widget = Widget::GetWidgetForNativeWindow(win_0.get()); auto* widget = Widget::GetWidgetForNativeWindow(win_0.get());
auto lock = widget->LockPaintAsActive(); auto lock = widget->LockPaintAsActive();
auto win_1 = CreateAppWindow(bounds, AppType::BROWSER); auto win_1 = CreateAppWindow(bounds, chromeos::AppType::BROWSER);
FramePaintWaiter(win_1.get()).Wait(); FramePaintWaiter(win_1.get()).Wait();
EXPECT_TRUE(wm::IsActiveWindow(win_1.get())); EXPECT_TRUE(wm::IsActiveWindow(win_1.get()));
@@ -334,7 +334,7 @@ TEST_F(DefaultFrameHeaderTest, AnimateDuringAnimation) {
// Ensure that the number of frame color changes is recorded as metrics. // Ensure that the number of frame color changes is recorded as metrics.
TEST_F(DefaultFrameHeaderTest, FrameColorChangeMetrics) { TEST_F(DefaultFrameHeaderTest, FrameColorChangeMetrics) {
const auto app_type = AppType::ARC_APP; const auto app_type = chromeos::AppType::ARC_APP;
auto win0 = CreateAppWindow(gfx::Rect(300, 300), app_type); auto win0 = CreateAppWindow(gfx::Rect(300, 300), app_type);
Widget* widget = Widget::GetWidgetForNativeWindow(win0.get()); Widget* widget = Widget::GetWidgetForNativeWindow(win0.get());
DefaultFrameHeader* frame_header = DefaultFrameHeader* frame_header =

@@ -6,7 +6,6 @@
#include <utility> #include <utility>
#include "ash/constants/app_types.h"
#include "ash/public/cpp/window_properties.h" #include "ash/public/cpp/window_properties.h"
#include "ash/shell.h" #include "ash/shell.h"
#include "ash/wm/mru_window_tracker.h" #include "ash/wm/mru_window_tracker.h"
@@ -15,6 +14,8 @@
#include "base/numerics/safe_conversions.h" #include "base/numerics/safe_conversions.h"
#include "base/ranges/algorithm.h" #include "base/ranges/algorithm.h"
#include "base/strings/string_number_conversions.h" #include "base/strings/string_number_conversions.h"
#include "chromeos/ui/base/app_types.h"
#include "chromeos/ui/base/window_properties.h"
#include "components/viz/common/surfaces/frame_sink_id.h" #include "components/viz/common/surfaces/frame_sink_id.h"
#include "components/viz/host/host_frame_sink_manager.h" #include "components/viz/host/host_frame_sink_manager.h"
#include "ui/aura/client/aura_constants.h" #include "ui/aura/client/aura_constants.h"
@@ -55,9 +56,8 @@ void CollectBrowserFrameSinkIdsInWindow(
bool inside_browser, bool inside_browser,
const base::flat_set<viz::FrameSinkId>& ids, const base::flat_set<viz::FrameSinkId>& ids,
base::flat_set<viz::FrameSinkId>* frame_sink_ids) { base::flat_set<viz::FrameSinkId>* frame_sink_ids) {
if (inside_browser || ash::AppType::BROWSER == if (inside_browser || chromeos::AppType::BROWSER ==
static_cast<ash::AppType>( window->GetProperty(chromeos::kAppTypeKey)) {
window->GetProperty(aura::client::kAppType))) {
auto id = GetFrameSinkId(window); auto id = GetFrameSinkId(window);
if (id.is_valid() && ids.contains(id)) if (id.is_valid() && ids.contains(id))
frame_sink_ids->insert(id); frame_sink_ids->insert(id);
@@ -127,25 +127,24 @@ void FrameThrottlingController::StartThrottling(
base::ranges::copy_if( base::ranges::copy_if(
Shell::Get()->mru_window_tracker()->BuildMruWindowList(kActiveDesk), Shell::Get()->mru_window_tracker()->BuildMruWindowList(kActiveDesk),
std::back_inserter(all_arc_windows), [](aura::Window* window) { std::back_inserter(all_arc_windows), [](aura::Window* window) {
return AppType::ARC_APP == static_cast<AppType>(window->GetProperty( return chromeos::AppType::ARC_APP ==
aura::client::kAppType)); window->GetProperty(chromeos::kAppTypeKey);
}); });
std::vector<aura::Window*> arc_windows; std::vector<aura::Window*> arc_windows;
arc_windows.reserve(windows.size()); arc_windows.reserve(windows.size());
for (aura::Window* window : windows) { for (aura::Window* window : windows) {
ash::AppType type = chromeos::AppType type = window->GetProperty(chromeos::kAppTypeKey);
static_cast<ash::AppType>(window->GetProperty(aura::client::kAppType));
switch (type) { switch (type) {
case ash::AppType::NON_APP: case chromeos::AppType::NON_APP:
case ash::AppType::BROWSER: case chromeos::AppType::BROWSER:
CollectFrameSinkIds( CollectFrameSinkIds(
window, &manually_throttled_candidates_.browser_frame_sink_ids); window, &manually_throttled_candidates_.browser_frame_sink_ids);
break; break;
case ash::AppType::ARC_APP: case chromeos::AppType::ARC_APP:
arc_windows.push_back(window); arc_windows.push_back(window);
break; break;
case ash::AppType::LACROS: case chromeos::AppType::LACROS:
CollectLacrosCandidates( CollectLacrosCandidates(
window, &manually_throttled_candidates_.lacros_candidates, window); window, &manually_throttled_candidates_.lacros_candidates, window);
break; break;
@@ -334,8 +333,7 @@ void FrameThrottlingController::CollectLacrosWindowsInWindow(
const base::flat_set<viz::FrameSinkId>& ids, const base::flat_set<viz::FrameSinkId>& ids,
base::flat_map<aura::Window*, viz::FrameSinkId>* candidates, base::flat_map<aura::Window*, viz::FrameSinkId>* candidates,
aura::Window* lacros_window) { aura::Window* lacros_window) {
if (ash::AppType::LACROS == if (chromeos::AppType::LACROS == window->GetProperty(chromeos::kAppTypeKey)) {
static_cast<ash::AppType>(window->GetProperty(aura::client::kAppType))) {
DCHECK(!lacros_window); DCHECK(!lacros_window);
lacros_window = window; lacros_window = window;
inside_lacros = true; inside_lacros = true;

@@ -7,7 +7,6 @@
#include <utility> #include <utility>
#include <vector> #include <vector>
#include "ash/constants/app_types.h"
#include "ash/test/ash_test_base.h" #include "ash/test/ash_test_base.h"
#include "ash/test/ash_test_helper.h" #include "ash/test/ash_test_helper.h"
#include "base/functional/callback.h" #include "base/functional/callback.h"
@@ -87,7 +86,7 @@ class FrameThrottlingControllerTest : public AshTestBase {
std::unique_ptr<aura::Window> CreateTestBrowserWindow( std::unique_ptr<aura::Window> CreateTestBrowserWindow(
const viz::FrameSinkId frame_sink_id) { const viz::FrameSinkId frame_sink_id) {
std::unique_ptr<aura::Window> browser_window = std::unique_ptr<aura::Window> browser_window =
CreateAppWindow(gfx::Rect(100, 100), AppType::BROWSER); CreateAppWindow(gfx::Rect(100, 100), chromeos::AppType::BROWSER);
browser_window->SetEmbedFrameSinkId(frame_sink_id); browser_window->SetEmbedFrameSinkId(frame_sink_id);
return browser_window; return browser_window;
} }

@@ -260,10 +260,12 @@ class GameDashboardContextTest : public GameDashboardTestBase {
bool set_arc_game_controls_flags_prop = true) { bool set_arc_game_controls_flags_prop = true) {
ASSERT_FALSE(game_window_); ASSERT_FALSE(game_window_);
ASSERT_FALSE(test_api_); ASSERT_FALSE(test_api_);
game_window_ = CreateAppWindow( game_window_ =
(is_arc_window ? TestGameDashboardDelegate::kGameAppId CreateAppWindow((is_arc_window ? TestGameDashboardDelegate::kGameAppId
: extension_misc::kGeForceNowAppId), : extension_misc::kGeForceNowAppId),
(is_arc_window ? AppType::ARC_APP : AppType::NON_APP), app_bounds()); (is_arc_window ? chromeos::AppType::ARC_APP
: chromeos::AppType::NON_APP),
app_bounds());
auto* context = GameDashboardController::Get()->GetGameDashboardContext( auto* context = GameDashboardController::Get()->GetGameDashboardContext(
game_window_.get()); game_window_.get());
ASSERT_TRUE(context); ASSERT_TRUE(context);
@@ -1121,9 +1123,9 @@ TEST_F(GameDashboardContextTest, TwoGameWindowsRecordingState) {
// Create a GFN game window that doesn't overlap with the ARC game window. // Create a GFN game window that doesn't overlap with the ARC game window.
// This allows the test to interact with both windows without having to // This allows the test to interact with both windows without having to
// artificially activate it. // artificially activate it.
auto gfn_game_window = auto gfn_game_window = CreateAppWindow(extension_misc::kGeForceNowAppId,
CreateAppWindow(extension_misc::kGeForceNowAppId, AppType::NON_APP, chromeos::AppType::NON_APP,
gfx::Rect(950, 550, 400, 200)); gfx::Rect(950, 550, 400, 200));
auto* gfn_game_context = auto* gfn_game_context =
GameDashboardController::Get()->GetGameDashboardContext( GameDashboardController::Get()->GetGameDashboardContext(
gfn_game_window.get()); gfn_game_window.get());
@@ -1481,8 +1483,8 @@ TEST_F(GameDashboardContextTest, OverviewModeWithTwoWindows) {
// Create a GFN game window with the toolbar displayed. // Create a GFN game window with the toolbar displayed.
game_dashboard_utils::SetShowToolbar(true); game_dashboard_utils::SetShowToolbar(true);
std::unique_ptr<aura::Window> gfn_game_window = std::unique_ptr<aura::Window> gfn_game_window =
CreateAppWindow(extension_misc::kGeForceNowAppId, AppType::NON_APP, CreateAppWindow(extension_misc::kGeForceNowAppId,
gfx::Rect(50, 50, 400, 200)); chromeos::AppType::NON_APP, gfx::Rect(50, 50, 400, 200));
ASSERT_TRUE(gfn_game_window->HasFocus()); ASSERT_TRUE(gfn_game_window->HasFocus());
auto gfn_window_test_api = GameDashboardContextTestApi( auto gfn_window_test_api = GameDashboardContextTestApi(
GameDashboardController::Get()->GetGameDashboardContext( GameDashboardController::Get()->GetGameDashboardContext(

@@ -4,11 +4,11 @@
#include "ash/game_dashboard/game_dashboard_controller.h" #include "ash/game_dashboard/game_dashboard_controller.h"
#include "ash/constants/app_types.h"
#include "ash/game_dashboard/game_dashboard_test_base.h" #include "ash/game_dashboard/game_dashboard_test_base.h"
#include "ash/game_dashboard/test_game_dashboard_delegate.h" #include "ash/game_dashboard/test_game_dashboard_delegate.h"
#include "ash/public/cpp/window_properties.h" #include "ash/public/cpp/window_properties.h"
#include "ash/test/ash_test_base.h" #include "ash/test/ash_test_base.h"
#include "chromeos/ui/base/app_types.h"
#include "chromeos/ui/base/window_properties.h" #include "chromeos/ui/base/window_properties.h"
#include "chromeos/ui/wm/window_util.h" #include "chromeos/ui/wm/window_util.h"
#include "extensions/common/constants.h" #include "extensions/common/constants.h"
@@ -36,7 +36,7 @@ class GameDashboardControllerTest : public GameDashboardTestBase {
void CreateAppWindowAndVerifyIsGameWindowProperty( void CreateAppWindowAndVerifyIsGameWindowProperty(
const char app_id[], const char app_id[],
bool expected_is_game, bool expected_is_game,
AppType app_type = AppType::NON_APP) { chromeos::AppType app_type = chromeos::AppType::NON_APP) {
auto window = CreateAppWindow(app_id, app_type, gfx::Rect(5, 5, 20, 20)); auto window = CreateAppWindow(app_id, app_type, gfx::Rect(5, 5, 20, 20));
VerifyIsGameWindowProperty(window.get(), expected_is_game); VerifyIsGameWindowProperty(window.get(), expected_is_game);
@@ -74,21 +74,21 @@ TEST_F(GameDashboardControllerTest, IsGameWindowProperty_GameArcWindow) {
// Verifies a game ARC window is a game. // Verifies a game ARC window is a game.
CreateAppWindowAndVerifyIsGameWindowProperty( CreateAppWindowAndVerifyIsGameWindowProperty(
TestGameDashboardDelegate::kGameAppId, /*expected_is_game=*/true, TestGameDashboardDelegate::kGameAppId, /*expected_is_game=*/true,
AppType::ARC_APP); chromeos::AppType::ARC_APP);
} }
TEST_F(GameDashboardControllerTest, IsGameWindowProperty_AllowlistedArcWindow) { TEST_F(GameDashboardControllerTest, IsGameWindowProperty_AllowlistedArcWindow) {
// Verifies an allowlisted ARC window is a game. // Verifies an allowlisted ARC window is a game.
CreateAppWindowAndVerifyIsGameWindowProperty( CreateAppWindowAndVerifyIsGameWindowProperty(
TestGameDashboardDelegate::kAllowlistedAppId, TestGameDashboardDelegate::kAllowlistedAppId,
/*expected_is_game=*/true, AppType::ARC_APP); /*expected_is_game=*/true, chromeos::AppType::ARC_APP);
} }
TEST_F(GameDashboardControllerTest, IsGameWindowProperty_OtherArcWindow) { TEST_F(GameDashboardControllerTest, IsGameWindowProperty_OtherArcWindow) {
// Verifies a not-game ARC window is not a game. // Verifies a not-game ARC window is not a game.
CreateAppWindowAndVerifyIsGameWindowProperty( CreateAppWindowAndVerifyIsGameWindowProperty(
TestGameDashboardDelegate::kOtherAppId, /*expected_is_game=*/false, TestGameDashboardDelegate::kOtherAppId, /*expected_is_game=*/false,
AppType::ARC_APP); chromeos::AppType::ARC_APP);
} }
TEST_F(GameDashboardControllerTest, IsGameWindowProperty_GFNWindows) { TEST_F(GameDashboardControllerTest, IsGameWindowProperty_GFNWindows) {
@@ -105,8 +105,8 @@ TEST_F(GameDashboardControllerTest, IsGameWindowProperty_OtherWindows) {
TEST_F(GameDashboardControllerTest, GameWindowToNonGameWindow) { TEST_F(GameDashboardControllerTest, GameWindowToNonGameWindow) {
const auto window = const auto window =
CreateAppWindow(TestGameDashboardDelegate::kGameAppId, AppType::ARC_APP, CreateAppWindow(TestGameDashboardDelegate::kGameAppId,
gfx::Rect(5, 5, 20, 20)); chromeos::AppType::ARC_APP, gfx::Rect(5, 5, 20, 20));
VerifyIsGameWindowProperty(window.get(), /*expected_is_game=*/true); VerifyIsGameWindowProperty(window.get(), /*expected_is_game=*/true);
// Update the window property where the window is no longer considered to be a // Update the window property where the window is no longer considered to be a

@@ -4,10 +4,10 @@
#include "ash/game_dashboard/game_dashboard_test_base.h" #include "ash/game_dashboard/game_dashboard_test_base.h"
#include "ash/constants/app_types.h"
#include "ash/constants/ash_features.h" #include "ash/constants/ash_features.h"
#include "ash/game_dashboard/game_dashboard_controller.h" #include "ash/game_dashboard/game_dashboard_controller.h"
#include "ash/public/cpp/window_properties.h" #include "ash/public/cpp/window_properties.h"
#include "chromeos/ui/base/app_types.h"
#include "chromeos/ui/base/window_properties.h" #include "chromeos/ui/base/window_properties.h"
#include "chromeos/ui/wm/window_util.h" #include "chromeos/ui/wm/window_util.h"
#include "ui/aura/window.h" #include "ui/aura/window.h"
@@ -42,7 +42,7 @@ bool GameDashboardTestBase::IsControllerObservingWindow(
std::unique_ptr<aura::Window> GameDashboardTestBase::CreateAppWindow( std::unique_ptr<aura::Window> GameDashboardTestBase::CreateAppWindow(
const std::string& app_id, const std::string& app_id,
AppType app_type, chromeos::AppType app_type,
const gfx::Rect& bounds_in_screen) { const gfx::Rect& bounds_in_screen) {
std::unique_ptr<aura::Window> window = std::unique_ptr<aura::Window> window =
AshTestBase::CreateAppWindow(bounds_in_screen, app_type); AshTestBase::CreateAppWindow(bounds_in_screen, app_type);

@@ -37,7 +37,7 @@ class GameDashboardTestBase : public AshTestBase {
// bounds. // bounds.
std::unique_ptr<aura::Window> CreateAppWindow( std::unique_ptr<aura::Window> CreateAppWindow(
const std::string& app_id, const std::string& app_id,
AppType app_type = AppType::NON_APP, chromeos::AppType app_type = chromeos::AppType::NON_APP,
const gfx::Rect& bounds_in_screen = gfx::Rect()); const gfx::Rect& bounds_in_screen = gfx::Rect());
private: private:

@@ -8,7 +8,6 @@
#include <string> #include <string>
#include <utility> #include <utility>
#include "ash/constants/app_types.h"
#include "ash/public/cpp/app_types_util.h" #include "ash/public/cpp/app_types_util.h"
#include "ash/public/cpp/window_properties.h" #include "ash/public/cpp/window_properties.h"
#include "ash/shelf/shelf_window_watcher.h" #include "ash/shelf/shelf_window_watcher.h"
@@ -19,9 +18,10 @@
#include "base/scoped_multi_source_observation.h" #include "base/scoped_multi_source_observation.h"
#include "base/time/time.h" #include "base/time/time.h"
#include "base/timer/timer.h" #include "base/timer/timer.h"
#include "chromeos/ui/base/app_types.h"
#include "chromeos/ui/base/window_properties.h"
#include "components/app_constants/constants.h" #include "components/app_constants/constants.h"
#include "extensions/common/constants.h" #include "extensions/common/constants.h"
#include "ui/aura/client/aura_constants.h"
#include "ui/aura/client/window_types.h" #include "ui/aura/client/window_types.h"
#include "ui/aura/window.h" #include "ui/aura/window.h"
#include "ui/base/ui_base_features.h" #include "ui/base/ui_base_features.h"
@@ -154,8 +154,8 @@ DemoModeApp GetAppFromPackageName(const std::string& package_name) {
return DemoModeApp::kOtherArcApp; return DemoModeApp::kOtherArcApp;
} }
AppType GetAppType(const aura::Window* window) { chromeos::AppType GetAppType(const aura::Window* window) {
return static_cast<AppType>(window->GetProperty(aura::client::kAppType)); return window->GetProperty(chromeos::kAppTypeKey);
} }
const std::string* GetArcPackageName(const aura::Window* window) { const std::string* GetArcPackageName(const aura::Window* window) {
@@ -181,10 +181,10 @@ const ShelfID GetShelfID(const aura::Window* window) {
DemoModeApp GetAppFromWindow(const aura::Window* window) { DemoModeApp GetAppFromWindow(const aura::Window* window) {
DCHECK(CanGetAppFromWindow(window)); DCHECK(CanGetAppFromWindow(window));
AppType app_type = GetAppType(window); chromeos::AppType app_type = GetAppType(window);
if (app_type == AppType::ARC_APP) { if (app_type == chromeos::AppType::ARC_APP) {
// The ShelfID app id isn't used to identify ARC++ apps since it's a hash of // The ShelfID app id isn't used to identify ARC++ apps since it's a hash
// both the package name and the activity. // of both the package name and the activity.
const std::string* package_name = GetArcPackageName(window); const std::string* package_name = GetArcPackageName(window);
return GetAppFromPackageName(*package_name); return GetAppFromPackageName(*package_name);
} }
@@ -192,18 +192,20 @@ DemoModeApp GetAppFromWindow(const aura::Window* window) {
std::string app_id = GetShelfID(window).app_id; std::string app_id = GetShelfID(window).app_id;
// The Chrome "app" in the shelf is just the browser. // The Chrome "app" in the shelf is just the browser.
if (app_id == app_constants::kChromeAppId) if (app_id == app_constants::kChromeAppId) {
return DemoModeApp::kBrowser; return DemoModeApp::kBrowser;
}
// If the window is the "browser" type, having an app ID other than the // If the window is the "browser" type, having an app ID other than the
// default indicates a hosted/bookmark app. // default indicates a hosted/bookmark app.
if (app_type == AppType::CHROME_APP || if (app_type == chromeos::AppType::CHROME_APP ||
(app_type == AppType::BROWSER && !app_id.empty())) { (app_type == chromeos::AppType::BROWSER && !app_id.empty())) {
return GetAppFromAppId(app_id); return GetAppFromAppId(app_id);
} }
if (app_type == AppType::BROWSER) if (app_type == chromeos::AppType::BROWSER) {
return DemoModeApp::kBrowser; return DemoModeApp::kBrowser;
}
return DemoModeApp::kOtherWindow; return DemoModeApp::kOtherWindow;
} }
@@ -298,7 +300,8 @@ class DemoSessionMetricsRecorder::UniqueAppsLaunchedArcPackageNameObserver
const std::string* package_name = GetArcPackageName(window); const std::string* package_name = GetArcPackageName(window);
if (package_name) { if (package_name) {
metrics_recorder_->RecordAppLaunch(*package_name, AppType::ARC_APP); metrics_recorder_->RecordAppLaunch(*package_name,
chromeos::AppType::ARC_APP);
} else { } else {
VLOG(1) << "Got null ARC package name"; VLOG(1) << "Got null ARC package name";
} }
@@ -366,15 +369,16 @@ DemoSessionMetricsRecorder::~DemoSessionMetricsRecorder() {
} }
void DemoSessionMetricsRecorder::RecordAppLaunch(const std::string& id, void DemoSessionMetricsRecorder::RecordAppLaunch(const std::string& id,
AppType app_type) { chromeos::AppType app_type) {
if (!ShouldRecordAppLaunch(id)) { if (!ShouldRecordAppLaunch(id)) {
return; return;
} }
DemoModeApp app; DemoModeApp app;
if (app_type == AppType::ARC_APP) if (app_type == chromeos::AppType::ARC_APP) {
app = GetAppFromPackageName(id); app = GetAppFromPackageName(id);
else } else {
app = GetAppFromAppId(id); app = GetAppFromAppId(id);
}
if (!unique_apps_launched_.contains(id)) { if (!unique_apps_launched_.contains(id)) {
unique_apps_launched_.insert(id); unique_apps_launched_.insert(id);
@@ -405,10 +409,10 @@ void DemoSessionMetricsRecorder::OnWindowActivated(ActivationReason reason,
if (gained_active->GetType() != aura::client::WINDOW_TYPE_NORMAL) if (gained_active->GetType() != aura::client::WINDOW_TYPE_NORMAL)
return; return;
AppType app_type = GetAppType(gained_active); chromeos::AppType app_type = GetAppType(gained_active);
std::string app_id; std::string app_id;
if (app_type == AppType::ARC_APP) { if (app_type == chromeos::AppType::ARC_APP) {
const std::string* package_name = GetArcPackageName(gained_active); const std::string* package_name = GetArcPackageName(gained_active);
if (!package_name) { if (!package_name) {

@@ -10,11 +10,11 @@
#include <vector> #include <vector>
#include "ash/ash_export.h" #include "ash/ash_export.h"
#include "ash/constants/app_types.h"
#include "base/containers/flat_set.h" #include "base/containers/flat_set.h"
#include "base/memory/raw_ptr.h" #include "base/memory/raw_ptr.h"
#include "base/scoped_observation.h" #include "base/scoped_observation.h"
#include "base/time/time.h" #include "base/time/time.h"
#include "chromeos/ui/base/app_types.h"
#include "ui/aura/window_observer.h" #include "ui/aura/window_observer.h"
#include "ui/base/user_activity/user_activity_detector.h" #include "ui/base/user_activity/user_activity_detector.h"
#include "ui/base/user_activity/user_activity_observer.h" #include "ui/base/user_activity/user_activity_observer.h"
@@ -134,7 +134,7 @@ class ASH_EXPORT DemoSessionMetricsRecorder
// Records the specified app's launch, subject to the // Records the specified app's launch, subject to the
// restrictions of ShouldRecordAppLaunch(). // restrictions of ShouldRecordAppLaunch().
void RecordAppLaunch(const std::string& id, AppType app_type); void RecordAppLaunch(const std::string& id, chromeos::AppType app_type);
// Emits various histograms for unique apps launched. // Emits various histograms for unique apps launched.
void ReportUniqueAppsLaunched(); void ReportUniqueAppsLaunched();

@@ -8,7 +8,6 @@
#include <string> #include <string>
#include <utility> #include <utility>
#include "ash/constants/app_types.h"
#include "ash/metrics/user_metrics_recorder.h" #include "ash/metrics/user_metrics_recorder.h"
#include "ash/public/cpp/shelf_types.h" #include "ash/public/cpp/shelf_types.h"
#include "ash/public/cpp/window_properties.h" #include "ash/public/cpp/window_properties.h"
@@ -21,9 +20,10 @@
#include "base/memory/raw_ptr.h" #include "base/memory/raw_ptr.h"
#include "base/test/metrics/histogram_tester.h" #include "base/test/metrics/histogram_tester.h"
#include "base/timer/mock_timer.h" #include "base/timer/mock_timer.h"
#include "chromeos/ui/base/app_types.h"
#include "chromeos/ui/base/window_properties.h"
#include "components/app_constants/constants.h" #include "components/app_constants/constants.h"
#include "extensions/common/constants.h" #include "extensions/common/constants.h"
#include "ui/aura/client/aura_constants.h"
#include "ui/aura/client/window_types.h" #include "ui/aura/client/window_types.h"
#include "ui/aura/test/test_window_delegate.h" #include "ui/aura/test/test_window_delegate.h"
#include "ui/aura/window.h" #include "ui/aura/window.h"
@@ -94,8 +94,7 @@ class DemoSessionMetricsRecorderTest : public AshTestBase {
std::unique_ptr<aura::Window> window(CreateTestWindowInShellWithDelegate( std::unique_ptr<aura::Window> window(CreateTestWindowInShellWithDelegate(
aura::test::TestWindowDelegate::CreateSelfDestroyingDelegate(), 0, aura::test::TestWindowDelegate::CreateSelfDestroyingDelegate(), 0,
gfx::Rect(0, 0, 10, 10))); gfx::Rect(0, 0, 10, 10)));
window->SetProperty(aura::client::kAppType, window->SetProperty(chromeos::kAppTypeKey, chromeos::AppType::BROWSER);
static_cast<int>(ash::AppType::BROWSER));
return window; return window;
} }
@@ -105,8 +104,7 @@ class DemoSessionMetricsRecorderTest : public AshTestBase {
std::unique_ptr<aura::Window> window(CreateTestWindowInShellWithDelegate( std::unique_ptr<aura::Window> window(CreateTestWindowInShellWithDelegate(
aura::test::TestWindowDelegate::CreateSelfDestroyingDelegate(), 0, aura::test::TestWindowDelegate::CreateSelfDestroyingDelegate(), 0,
gfx::Rect(0, 0, 10, 10))); gfx::Rect(0, 0, 10, 10)));
window->SetProperty(aura::client::kAppType, window->SetProperty(chromeos::kAppTypeKey, chromeos::AppType::BROWSER);
static_cast<int>(ash::AppType::BROWSER));
window->SetProperty( window->SetProperty(
kShelfIDKey, kShelfIDKey,
new std::string(ShelfID(app_id, std::string()).Serialize())); new std::string(ShelfID(app_id, std::string()).Serialize()));
@@ -119,8 +117,7 @@ class DemoSessionMetricsRecorderTest : public AshTestBase {
std::unique_ptr<aura::Window> window(CreateTestWindowInShellWithDelegate( std::unique_ptr<aura::Window> window(CreateTestWindowInShellWithDelegate(
aura::test::TestWindowDelegate::CreateSelfDestroyingDelegate(), 0, aura::test::TestWindowDelegate::CreateSelfDestroyingDelegate(), 0,
gfx::Rect(0, 0, 10, 10))); gfx::Rect(0, 0, 10, 10)));
window->SetProperty(aura::client::kAppType, window->SetProperty(chromeos::kAppTypeKey, chromeos::AppType::CHROME_APP);
static_cast<int>(ash::AppType::CHROME_APP));
window->SetProperty( window->SetProperty(
kShelfIDKey, kShelfIDKey,
new std::string(ShelfID(app_id, std::string()).Serialize())); new std::string(ShelfID(app_id, std::string()).Serialize()));
@@ -133,8 +130,7 @@ class DemoSessionMetricsRecorderTest : public AshTestBase {
std::unique_ptr<aura::Window> window(CreateTestWindowInShellWithDelegate( std::unique_ptr<aura::Window> window(CreateTestWindowInShellWithDelegate(
aura::test::TestWindowDelegate::CreateSelfDestroyingDelegate(), 0, aura::test::TestWindowDelegate::CreateSelfDestroyingDelegate(), 0,
gfx::Rect(0, 0, 10, 10))); gfx::Rect(0, 0, 10, 10)));
window->SetProperty(aura::client::kAppType, window->SetProperty(chromeos::kAppTypeKey, chromeos::AppType::ARC_APP);
static_cast<int>(ash::AppType::ARC_APP));
// ARC++ shelf app IDs are hashes of package_name#activity_name formatted as // ARC++ shelf app IDs are hashes of package_name#activity_name formatted as
// extension IDs. The point is that they are opaque to the metrics recorder. // extension IDs. The point is that they are opaque to the metrics recorder.

@@ -4,11 +4,11 @@
#include "ash/metrics/pointer_metrics_recorder.h" #include "ash/metrics/pointer_metrics_recorder.h"
#include "ash/constants/app_types.h"
#include "ash/display/screen_orientation_controller.h" #include "ash/display/screen_orientation_controller.h"
#include "ash/shell.h" #include "ash/shell.h"
#include "base/metrics/histogram_macros.h" #include "base/metrics/histogram_macros.h"
#include "ui/aura/client/aura_constants.h" #include "chromeos/ui/base/app_types.h"
#include "chromeos/ui/base/window_properties.h"
#include "ui/aura/window.h" #include "ui/aura/window.h"
#include "ui/display/screen.h" #include "ui/display/screen.h"
#include "ui/events/event_constants.h" #include "ui/events/event_constants.h"
@@ -19,26 +19,28 @@ namespace ash {
namespace { namespace {
int GetDestination(views::Widget* target) { chromeos::AppType GetDestination(views::Widget* target) {
if (!target) if (!target) {
return static_cast<int>(AppType::NON_APP); return chromeos::AppType::NON_APP;
}
aura::Window* window = target->GetNativeWindow(); aura::Window* window = target->GetNativeWindow();
DCHECK(window); DCHECK(window);
int app_type = window->GetProperty(aura::client::kAppType); chromeos::AppType app_type = window->GetProperty(chromeos::kAppTypeKey);
// Use "BROWSER" for Lacros Chrome's pointer metrics. // Use "BROWSER" for Lacros Chrome's pointer metrics.
if (app_type == static_cast<int>(AppType::LACROS)) if (app_type == chromeos::AppType::LACROS) {
return static_cast<int>(AppType::BROWSER); return chromeos::AppType::BROWSER;
}
return app_type; return app_type;
} }
DownEventMetric2 FindCombination(int destination, DownEventMetric2 FindCombination(chromeos::AppType destination,
DownEventSource input_type, DownEventSource input_type,
DownEventFormFactor form_factor) { DownEventFormFactor form_factor) {
constexpr int kNumCombinationPerDestination = constexpr int kNumCombinationPerDestination =
static_cast<int>(DownEventSource::kSourceCount) * static_cast<int>(DownEventSource::kSourceCount) *
static_cast<int>(DownEventFormFactor::kFormFactorCount); static_cast<int>(DownEventFormFactor::kFormFactorCount);
int result = destination * kNumCombinationPerDestination + int result = static_cast<int>(destination) * kNumCombinationPerDestination +
static_cast<int>(DownEventFormFactor::kFormFactorCount) * static_cast<int>(DownEventFormFactor::kFormFactorCount) *
static_cast<int>(input_type) + static_cast<int>(input_type) +
static_cast<int>(form_factor); static_cast<int>(form_factor);

@@ -6,13 +6,14 @@
#include <memory> #include <memory>
#include "ash/constants/app_types.h"
#include "ash/display/screen_orientation_controller_test_api.h" #include "ash/display/screen_orientation_controller_test_api.h"
#include "ash/public/cpp/shell_window_ids.h" #include "ash/public/cpp/shell_window_ids.h"
#include "ash/shell.h" #include "ash/shell.h"
#include "ash/test/ash_test_base.h" #include "ash/test/ash_test_base.h"
#include "ash/wm/tablet_mode/tablet_mode_controller.h" #include "ash/wm/tablet_mode/tablet_mode_controller.h"
#include "base/test/metrics/histogram_tester.h" #include "base/test/metrics/histogram_tester.h"
#include "chromeos/ui/base/app_types.h"
#include "chromeos/ui/base/window_properties.h"
#include "ui/aura/client/aura_constants.h" #include "ui/aura/client/aura_constants.h"
#include "ui/aura/window.h" #include "ui/aura/window.h"
#include "ui/display/test/display_manager_test_api.h" #include "ui/display/test/display_manager_test_api.h"
@@ -42,7 +43,7 @@ class PointerMetricsRecorderTest : public AshTestBase {
void CreateDownEvent(ui::EventPointerType pointer_type, void CreateDownEvent(ui::EventPointerType pointer_type,
DownEventFormFactor form_factor, DownEventFormFactor form_factor,
AppType destination); chromeos::AppType destination);
protected: protected:
// The test target. // The test target.
@@ -75,10 +76,10 @@ void PointerMetricsRecorderTest::TearDown() {
void PointerMetricsRecorderTest::CreateDownEvent( void PointerMetricsRecorderTest::CreateDownEvent(
ui::EventPointerType pointer_type, ui::EventPointerType pointer_type,
DownEventFormFactor form_factor, DownEventFormFactor form_factor,
AppType destination) { chromeos::AppType destination) {
aura::Window* window = widget_->GetNativeWindow(); aura::Window* window = widget_->GetNativeWindow();
CHECK(window); CHECK(window);
window->SetProperty(aura::client::kAppType, static_cast<int>(destination)); window->SetProperty(chromeos::kAppTypeKey, destination);
if (form_factor == DownEventFormFactor::kClamshell) { if (form_factor == DownEventFormFactor::kClamshell) {
Shell::Get()->tablet_mode_controller()->SetEnabledForTest(false); Shell::Get()->tablet_mode_controller()->SetEnabledForTest(false);
@@ -131,283 +132,301 @@ TEST_F(PointerMetricsRecorderTest, DownEventPerCombination) {
display_id); display_id);
CreateDownEvent(ui::EventPointerType::kMouse, DownEventFormFactor::kClamshell, CreateDownEvent(ui::EventPointerType::kMouse, DownEventFormFactor::kClamshell,
AppType::NON_APP); chromeos::AppType::NON_APP);
histogram_tester_->ExpectBucketCount( histogram_tester_->ExpectBucketCount(
kCombinationHistogramName, kCombinationHistogramName,
static_cast<int>(DownEventMetric2::kNonAppMouseClamshell), 1); static_cast<int>(DownEventMetric2::kNonAppMouseClamshell), 1);
CreateDownEvent(ui::EventPointerType::kMouse, CreateDownEvent(ui::EventPointerType::kMouse,
DownEventFormFactor::kTabletModeLandscape, AppType::NON_APP); DownEventFormFactor::kTabletModeLandscape,
chromeos::AppType::NON_APP);
histogram_tester_->ExpectBucketCount( histogram_tester_->ExpectBucketCount(
kCombinationHistogramName, kCombinationHistogramName,
static_cast<int>(DownEventMetric2::kNonAppMouseTabletLandscape), 1); static_cast<int>(DownEventMetric2::kNonAppMouseTabletLandscape), 1);
CreateDownEvent(ui::EventPointerType::kMouse, CreateDownEvent(ui::EventPointerType::kMouse,
DownEventFormFactor::kTabletModePortrait, AppType::NON_APP); DownEventFormFactor::kTabletModePortrait,
chromeos::AppType::NON_APP);
histogram_tester_->ExpectBucketCount( histogram_tester_->ExpectBucketCount(
kCombinationHistogramName, kCombinationHistogramName,
static_cast<int>(DownEventMetric2::kNonAppMouseTabletPortrait), 1); static_cast<int>(DownEventMetric2::kNonAppMouseTabletPortrait), 1);
CreateDownEvent(ui::EventPointerType::kPen, DownEventFormFactor::kClamshell, CreateDownEvent(ui::EventPointerType::kPen, DownEventFormFactor::kClamshell,
AppType::NON_APP); chromeos::AppType::NON_APP);
histogram_tester_->ExpectBucketCount( histogram_tester_->ExpectBucketCount(
kCombinationHistogramName, kCombinationHistogramName,
static_cast<int>(DownEventMetric2::kNonAppStylusClamshell), 1); static_cast<int>(DownEventMetric2::kNonAppStylusClamshell), 1);
CreateDownEvent(ui::EventPointerType::kPen, CreateDownEvent(ui::EventPointerType::kPen,
DownEventFormFactor::kTabletModeLandscape, AppType::NON_APP); DownEventFormFactor::kTabletModeLandscape,
chromeos::AppType::NON_APP);
histogram_tester_->ExpectBucketCount( histogram_tester_->ExpectBucketCount(
kCombinationHistogramName, kCombinationHistogramName,
static_cast<int>(DownEventMetric2::kNonAppStylusTabletLandscape), 1); static_cast<int>(DownEventMetric2::kNonAppStylusTabletLandscape), 1);
CreateDownEvent(ui::EventPointerType::kPen, CreateDownEvent(ui::EventPointerType::kPen,
DownEventFormFactor::kTabletModePortrait, AppType::NON_APP); DownEventFormFactor::kTabletModePortrait,
chromeos::AppType::NON_APP);
histogram_tester_->ExpectBucketCount( histogram_tester_->ExpectBucketCount(
kCombinationHistogramName, kCombinationHistogramName,
static_cast<int>(DownEventMetric2::kNonAppStylusTabletPortrait), 1); static_cast<int>(DownEventMetric2::kNonAppStylusTabletPortrait), 1);
CreateDownEvent(ui::EventPointerType::kTouch, DownEventFormFactor::kClamshell, CreateDownEvent(ui::EventPointerType::kTouch, DownEventFormFactor::kClamshell,
AppType::NON_APP); chromeos::AppType::NON_APP);
histogram_tester_->ExpectBucketCount( histogram_tester_->ExpectBucketCount(
kCombinationHistogramName, kCombinationHistogramName,
static_cast<int>(DownEventMetric2::kNonAppStylusClamshell), 1); static_cast<int>(DownEventMetric2::kNonAppStylusClamshell), 1);
CreateDownEvent(ui::EventPointerType::kTouch, CreateDownEvent(ui::EventPointerType::kTouch,
DownEventFormFactor::kTabletModeLandscape, AppType::NON_APP); DownEventFormFactor::kTabletModeLandscape,
chromeos::AppType::NON_APP);
histogram_tester_->ExpectBucketCount( histogram_tester_->ExpectBucketCount(
kCombinationHistogramName, kCombinationHistogramName,
static_cast<int>(DownEventMetric2::kNonAppStylusTabletLandscape), 1); static_cast<int>(DownEventMetric2::kNonAppStylusTabletLandscape), 1);
CreateDownEvent(ui::EventPointerType::kTouch, CreateDownEvent(ui::EventPointerType::kTouch,
DownEventFormFactor::kTabletModePortrait, AppType::NON_APP); DownEventFormFactor::kTabletModePortrait,
chromeos::AppType::NON_APP);
histogram_tester_->ExpectBucketCount( histogram_tester_->ExpectBucketCount(
kCombinationHistogramName, kCombinationHistogramName,
static_cast<int>(DownEventMetric2::kNonAppStylusTabletPortrait), 1); static_cast<int>(DownEventMetric2::kNonAppStylusTabletPortrait), 1);
CreateDownEvent(ui::EventPointerType::kMouse, DownEventFormFactor::kClamshell, CreateDownEvent(ui::EventPointerType::kMouse, DownEventFormFactor::kClamshell,
AppType::BROWSER); chromeos::AppType::BROWSER);
histogram_tester_->ExpectBucketCount( histogram_tester_->ExpectBucketCount(
kCombinationHistogramName, kCombinationHistogramName,
static_cast<int>(DownEventMetric2::kBrowserMouseClamshell), 1); static_cast<int>(DownEventMetric2::kBrowserMouseClamshell), 1);
CreateDownEvent(ui::EventPointerType::kMouse, CreateDownEvent(ui::EventPointerType::kMouse,
DownEventFormFactor::kTabletModeLandscape, AppType::BROWSER); DownEventFormFactor::kTabletModeLandscape,
chromeos::AppType::BROWSER);
histogram_tester_->ExpectBucketCount( histogram_tester_->ExpectBucketCount(
kCombinationHistogramName, kCombinationHistogramName,
static_cast<int>(DownEventMetric2::kBrowserMouseTabletLandscape), 1); static_cast<int>(DownEventMetric2::kBrowserMouseTabletLandscape), 1);
CreateDownEvent(ui::EventPointerType::kMouse, CreateDownEvent(ui::EventPointerType::kMouse,
DownEventFormFactor::kTabletModePortrait, AppType::BROWSER); DownEventFormFactor::kTabletModePortrait,
chromeos::AppType::BROWSER);
histogram_tester_->ExpectBucketCount( histogram_tester_->ExpectBucketCount(
kCombinationHistogramName, kCombinationHistogramName,
static_cast<int>(DownEventMetric2::kBrowserMouseTabletPortrait), 1); static_cast<int>(DownEventMetric2::kBrowserMouseTabletPortrait), 1);
CreateDownEvent(ui::EventPointerType::kPen, DownEventFormFactor::kClamshell, CreateDownEvent(ui::EventPointerType::kPen, DownEventFormFactor::kClamshell,
AppType::BROWSER); chromeos::AppType::BROWSER);
histogram_tester_->ExpectBucketCount( histogram_tester_->ExpectBucketCount(
kCombinationHistogramName, kCombinationHistogramName,
static_cast<int>(DownEventMetric2::kBrowserStylusClamshell), 1); static_cast<int>(DownEventMetric2::kBrowserStylusClamshell), 1);
CreateDownEvent(ui::EventPointerType::kPen, CreateDownEvent(ui::EventPointerType::kPen,
DownEventFormFactor::kTabletModeLandscape, AppType::BROWSER); DownEventFormFactor::kTabletModeLandscape,
chromeos::AppType::BROWSER);
histogram_tester_->ExpectBucketCount( histogram_tester_->ExpectBucketCount(
kCombinationHistogramName, kCombinationHistogramName,
static_cast<int>(DownEventMetric2::kBrowserStylusTabletLandscape), 1); static_cast<int>(DownEventMetric2::kBrowserStylusTabletLandscape), 1);
CreateDownEvent(ui::EventPointerType::kPen, CreateDownEvent(ui::EventPointerType::kPen,
DownEventFormFactor::kTabletModePortrait, AppType::BROWSER); DownEventFormFactor::kTabletModePortrait,
chromeos::AppType::BROWSER);
histogram_tester_->ExpectBucketCount( histogram_tester_->ExpectBucketCount(
kCombinationHistogramName, kCombinationHistogramName,
static_cast<int>(DownEventMetric2::kBrowserStylusTabletPortrait), 1); static_cast<int>(DownEventMetric2::kBrowserStylusTabletPortrait), 1);
CreateDownEvent(ui::EventPointerType::kTouch, DownEventFormFactor::kClamshell, CreateDownEvent(ui::EventPointerType::kTouch, DownEventFormFactor::kClamshell,
AppType::BROWSER); chromeos::AppType::BROWSER);
histogram_tester_->ExpectBucketCount( histogram_tester_->ExpectBucketCount(
kCombinationHistogramName, kCombinationHistogramName,
static_cast<int>(DownEventMetric2::kBrowserStylusClamshell), 1); static_cast<int>(DownEventMetric2::kBrowserStylusClamshell), 1);
CreateDownEvent(ui::EventPointerType::kTouch, CreateDownEvent(ui::EventPointerType::kTouch,
DownEventFormFactor::kTabletModeLandscape, AppType::BROWSER); DownEventFormFactor::kTabletModeLandscape,
chromeos::AppType::BROWSER);
histogram_tester_->ExpectBucketCount( histogram_tester_->ExpectBucketCount(
kCombinationHistogramName, kCombinationHistogramName,
static_cast<int>(DownEventMetric2::kBrowserStylusTabletLandscape), 1); static_cast<int>(DownEventMetric2::kBrowserStylusTabletLandscape), 1);
CreateDownEvent(ui::EventPointerType::kTouch, CreateDownEvent(ui::EventPointerType::kTouch,
DownEventFormFactor::kTabletModePortrait, AppType::BROWSER); DownEventFormFactor::kTabletModePortrait,
chromeos::AppType::BROWSER);
histogram_tester_->ExpectBucketCount( histogram_tester_->ExpectBucketCount(
kCombinationHistogramName, kCombinationHistogramName,
static_cast<int>(DownEventMetric2::kBrowserStylusTabletPortrait), 1); static_cast<int>(DownEventMetric2::kBrowserStylusTabletPortrait), 1);
CreateDownEvent(ui::EventPointerType::kMouse, DownEventFormFactor::kClamshell, CreateDownEvent(ui::EventPointerType::kMouse, DownEventFormFactor::kClamshell,
AppType::CHROME_APP); chromeos::AppType::CHROME_APP);
histogram_tester_->ExpectBucketCount( histogram_tester_->ExpectBucketCount(
kCombinationHistogramName, kCombinationHistogramName,
static_cast<int>(DownEventMetric2::kChromeAppMouseClamshell), 1); static_cast<int>(DownEventMetric2::kChromeAppMouseClamshell), 1);
CreateDownEvent(ui::EventPointerType::kMouse, CreateDownEvent(ui::EventPointerType::kMouse,
DownEventFormFactor::kTabletModeLandscape, DownEventFormFactor::kTabletModeLandscape,
AppType::CHROME_APP); chromeos::AppType::CHROME_APP);
histogram_tester_->ExpectBucketCount( histogram_tester_->ExpectBucketCount(
kCombinationHistogramName, kCombinationHistogramName,
static_cast<int>(DownEventMetric2::kChromeAppMouseTabletLandscape), 1); static_cast<int>(DownEventMetric2::kChromeAppMouseTabletLandscape), 1);
CreateDownEvent(ui::EventPointerType::kMouse, CreateDownEvent(ui::EventPointerType::kMouse,
DownEventFormFactor::kTabletModePortrait, DownEventFormFactor::kTabletModePortrait,
AppType::CHROME_APP); chromeos::AppType::CHROME_APP);
histogram_tester_->ExpectBucketCount( histogram_tester_->ExpectBucketCount(
kCombinationHistogramName, kCombinationHistogramName,
static_cast<int>(DownEventMetric2::kChromeAppMouseTabletPortrait), 1); static_cast<int>(DownEventMetric2::kChromeAppMouseTabletPortrait), 1);
CreateDownEvent(ui::EventPointerType::kPen, DownEventFormFactor::kClamshell, CreateDownEvent(ui::EventPointerType::kPen, DownEventFormFactor::kClamshell,
AppType::CHROME_APP); chromeos::AppType::CHROME_APP);
histogram_tester_->ExpectBucketCount( histogram_tester_->ExpectBucketCount(
kCombinationHistogramName, kCombinationHistogramName,
static_cast<int>(DownEventMetric2::kChromeAppStylusClamshell), 1); static_cast<int>(DownEventMetric2::kChromeAppStylusClamshell), 1);
CreateDownEvent(ui::EventPointerType::kPen, CreateDownEvent(ui::EventPointerType::kPen,
DownEventFormFactor::kTabletModeLandscape, DownEventFormFactor::kTabletModeLandscape,
AppType::CHROME_APP); chromeos::AppType::CHROME_APP);
histogram_tester_->ExpectBucketCount( histogram_tester_->ExpectBucketCount(
kCombinationHistogramName, kCombinationHistogramName,
static_cast<int>(DownEventMetric2::kChromeAppStylusTabletLandscape), 1); static_cast<int>(DownEventMetric2::kChromeAppStylusTabletLandscape), 1);
CreateDownEvent(ui::EventPointerType::kPen, CreateDownEvent(ui::EventPointerType::kPen,
DownEventFormFactor::kTabletModePortrait, DownEventFormFactor::kTabletModePortrait,
AppType::CHROME_APP); chromeos::AppType::CHROME_APP);
histogram_tester_->ExpectBucketCount( histogram_tester_->ExpectBucketCount(
kCombinationHistogramName, kCombinationHistogramName,
static_cast<int>(DownEventMetric2::kChromeAppStylusTabletPortrait), 1); static_cast<int>(DownEventMetric2::kChromeAppStylusTabletPortrait), 1);
CreateDownEvent(ui::EventPointerType::kTouch, DownEventFormFactor::kClamshell, CreateDownEvent(ui::EventPointerType::kTouch, DownEventFormFactor::kClamshell,
AppType::CHROME_APP); chromeos::AppType::CHROME_APP);
histogram_tester_->ExpectBucketCount( histogram_tester_->ExpectBucketCount(
kCombinationHistogramName, kCombinationHistogramName,
static_cast<int>(DownEventMetric2::kChromeAppStylusClamshell), 1); static_cast<int>(DownEventMetric2::kChromeAppStylusClamshell), 1);
CreateDownEvent(ui::EventPointerType::kTouch, CreateDownEvent(ui::EventPointerType::kTouch,
DownEventFormFactor::kTabletModeLandscape, DownEventFormFactor::kTabletModeLandscape,
AppType::CHROME_APP); chromeos::AppType::CHROME_APP);
histogram_tester_->ExpectBucketCount( histogram_tester_->ExpectBucketCount(
kCombinationHistogramName, kCombinationHistogramName,
static_cast<int>(DownEventMetric2::kChromeAppStylusTabletLandscape), 1); static_cast<int>(DownEventMetric2::kChromeAppStylusTabletLandscape), 1);
CreateDownEvent(ui::EventPointerType::kTouch, CreateDownEvent(ui::EventPointerType::kTouch,
DownEventFormFactor::kTabletModePortrait, DownEventFormFactor::kTabletModePortrait,
AppType::CHROME_APP); chromeos::AppType::CHROME_APP);
histogram_tester_->ExpectBucketCount( histogram_tester_->ExpectBucketCount(
kCombinationHistogramName, kCombinationHistogramName,
static_cast<int>(DownEventMetric2::kChromeAppStylusTabletPortrait), 1); static_cast<int>(DownEventMetric2::kChromeAppStylusTabletPortrait), 1);
CreateDownEvent(ui::EventPointerType::kMouse, DownEventFormFactor::kClamshell, CreateDownEvent(ui::EventPointerType::kMouse, DownEventFormFactor::kClamshell,
AppType::ARC_APP); chromeos::AppType::ARC_APP);
histogram_tester_->ExpectBucketCount( histogram_tester_->ExpectBucketCount(
kCombinationHistogramName, kCombinationHistogramName,
static_cast<int>(DownEventMetric2::kArcAppMouseClamshell), 1); static_cast<int>(DownEventMetric2::kArcAppMouseClamshell), 1);
CreateDownEvent(ui::EventPointerType::kMouse, CreateDownEvent(ui::EventPointerType::kMouse,
DownEventFormFactor::kTabletModeLandscape, AppType::ARC_APP); DownEventFormFactor::kTabletModeLandscape,
chromeos::AppType::ARC_APP);
histogram_tester_->ExpectBucketCount( histogram_tester_->ExpectBucketCount(
kCombinationHistogramName, kCombinationHistogramName,
static_cast<int>(DownEventMetric2::kArcAppMouseTabletLandscape), 1); static_cast<int>(DownEventMetric2::kArcAppMouseTabletLandscape), 1);
CreateDownEvent(ui::EventPointerType::kMouse, CreateDownEvent(ui::EventPointerType::kMouse,
DownEventFormFactor::kTabletModePortrait, AppType::ARC_APP); DownEventFormFactor::kTabletModePortrait,
chromeos::AppType::ARC_APP);
histogram_tester_->ExpectBucketCount( histogram_tester_->ExpectBucketCount(
kCombinationHistogramName, kCombinationHistogramName,
static_cast<int>(DownEventMetric2::kArcAppMouseTabletPortrait), 1); static_cast<int>(DownEventMetric2::kArcAppMouseTabletPortrait), 1);
CreateDownEvent(ui::EventPointerType::kPen, DownEventFormFactor::kClamshell, CreateDownEvent(ui::EventPointerType::kPen, DownEventFormFactor::kClamshell,
AppType::ARC_APP); chromeos::AppType::ARC_APP);
histogram_tester_->ExpectBucketCount( histogram_tester_->ExpectBucketCount(
kCombinationHistogramName, kCombinationHistogramName,
static_cast<int>(DownEventMetric2::kArcAppStylusClamshell), 1); static_cast<int>(DownEventMetric2::kArcAppStylusClamshell), 1);
CreateDownEvent(ui::EventPointerType::kPen, CreateDownEvent(ui::EventPointerType::kPen,
DownEventFormFactor::kTabletModeLandscape, AppType::ARC_APP); DownEventFormFactor::kTabletModeLandscape,
chromeos::AppType::ARC_APP);
histogram_tester_->ExpectBucketCount( histogram_tester_->ExpectBucketCount(
kCombinationHistogramName, kCombinationHistogramName,
static_cast<int>(DownEventMetric2::kArcAppStylusTabletLandscape), 1); static_cast<int>(DownEventMetric2::kArcAppStylusTabletLandscape), 1);
CreateDownEvent(ui::EventPointerType::kPen, CreateDownEvent(ui::EventPointerType::kPen,
DownEventFormFactor::kTabletModePortrait, AppType::ARC_APP); DownEventFormFactor::kTabletModePortrait,
chromeos::AppType::ARC_APP);
histogram_tester_->ExpectBucketCount( histogram_tester_->ExpectBucketCount(
kCombinationHistogramName, kCombinationHistogramName,
static_cast<int>(DownEventMetric2::kArcAppStylusTabletPortrait), 1); static_cast<int>(DownEventMetric2::kArcAppStylusTabletPortrait), 1);
CreateDownEvent(ui::EventPointerType::kTouch, DownEventFormFactor::kClamshell, CreateDownEvent(ui::EventPointerType::kTouch, DownEventFormFactor::kClamshell,
AppType::ARC_APP); chromeos::AppType::ARC_APP);
histogram_tester_->ExpectBucketCount( histogram_tester_->ExpectBucketCount(
kCombinationHistogramName, kCombinationHistogramName,
static_cast<int>(DownEventMetric2::kArcAppStylusClamshell), 1); static_cast<int>(DownEventMetric2::kArcAppStylusClamshell), 1);
CreateDownEvent(ui::EventPointerType::kTouch, CreateDownEvent(ui::EventPointerType::kTouch,
DownEventFormFactor::kTabletModeLandscape, AppType::ARC_APP); DownEventFormFactor::kTabletModeLandscape,
chromeos::AppType::ARC_APP);
histogram_tester_->ExpectBucketCount( histogram_tester_->ExpectBucketCount(
kCombinationHistogramName, kCombinationHistogramName,
static_cast<int>(DownEventMetric2::kArcAppStylusTabletLandscape), 1); static_cast<int>(DownEventMetric2::kArcAppStylusTabletLandscape), 1);
CreateDownEvent(ui::EventPointerType::kTouch, CreateDownEvent(ui::EventPointerType::kTouch,
DownEventFormFactor::kTabletModePortrait, AppType::ARC_APP); DownEventFormFactor::kTabletModePortrait,
chromeos::AppType::ARC_APP);
histogram_tester_->ExpectBucketCount( histogram_tester_->ExpectBucketCount(
kCombinationHistogramName, kCombinationHistogramName,
static_cast<int>(DownEventMetric2::kArcAppStylusTabletPortrait), 1); static_cast<int>(DownEventMetric2::kArcAppStylusTabletPortrait), 1);
CreateDownEvent(ui::EventPointerType::kMouse, DownEventFormFactor::kClamshell, CreateDownEvent(ui::EventPointerType::kMouse, DownEventFormFactor::kClamshell,
AppType::CROSTINI_APP); chromeos::AppType::CROSTINI_APP);
histogram_tester_->ExpectBucketCount( histogram_tester_->ExpectBucketCount(
kCombinationHistogramName, kCombinationHistogramName,
static_cast<int>(DownEventMetric2::kCrostiniAppMouseClamshell), 1); static_cast<int>(DownEventMetric2::kCrostiniAppMouseClamshell), 1);
CreateDownEvent(ui::EventPointerType::kMouse, CreateDownEvent(ui::EventPointerType::kMouse,
DownEventFormFactor::kTabletModeLandscape, DownEventFormFactor::kTabletModeLandscape,
AppType::CROSTINI_APP); chromeos::AppType::CROSTINI_APP);
histogram_tester_->ExpectBucketCount( histogram_tester_->ExpectBucketCount(
kCombinationHistogramName, kCombinationHistogramName,
static_cast<int>(DownEventMetric2::kCrostiniAppMouseTabletLandscape), 1); static_cast<int>(DownEventMetric2::kCrostiniAppMouseTabletLandscape), 1);
CreateDownEvent(ui::EventPointerType::kMouse, CreateDownEvent(ui::EventPointerType::kMouse,
DownEventFormFactor::kTabletModePortrait, DownEventFormFactor::kTabletModePortrait,
AppType::CROSTINI_APP); chromeos::AppType::CROSTINI_APP);
histogram_tester_->ExpectBucketCount( histogram_tester_->ExpectBucketCount(
kCombinationHistogramName, kCombinationHistogramName,
static_cast<int>(DownEventMetric2::kCrostiniAppMouseTabletPortrait), 1); static_cast<int>(DownEventMetric2::kCrostiniAppMouseTabletPortrait), 1);
CreateDownEvent(ui::EventPointerType::kPen, DownEventFormFactor::kClamshell, CreateDownEvent(ui::EventPointerType::kPen, DownEventFormFactor::kClamshell,
AppType::CROSTINI_APP); chromeos::AppType::CROSTINI_APP);
histogram_tester_->ExpectBucketCount( histogram_tester_->ExpectBucketCount(
kCombinationHistogramName, kCombinationHistogramName,
static_cast<int>(DownEventMetric2::kCrostiniAppStylusClamshell), 1); static_cast<int>(DownEventMetric2::kCrostiniAppStylusClamshell), 1);
CreateDownEvent(ui::EventPointerType::kPen, CreateDownEvent(ui::EventPointerType::kPen,
DownEventFormFactor::kTabletModeLandscape, DownEventFormFactor::kTabletModeLandscape,
AppType::CROSTINI_APP); chromeos::AppType::CROSTINI_APP);
histogram_tester_->ExpectBucketCount( histogram_tester_->ExpectBucketCount(
kCombinationHistogramName, kCombinationHistogramName,
static_cast<int>(DownEventMetric2::kCrostiniAppStylusTabletLandscape), 1); static_cast<int>(DownEventMetric2::kCrostiniAppStylusTabletLandscape), 1);
CreateDownEvent(ui::EventPointerType::kPen, CreateDownEvent(ui::EventPointerType::kPen,
DownEventFormFactor::kTabletModePortrait, DownEventFormFactor::kTabletModePortrait,
AppType::CROSTINI_APP); chromeos::AppType::CROSTINI_APP);
histogram_tester_->ExpectBucketCount( histogram_tester_->ExpectBucketCount(
kCombinationHistogramName, kCombinationHistogramName,
static_cast<int>(DownEventMetric2::kCrostiniAppStylusTabletPortrait), 1); static_cast<int>(DownEventMetric2::kCrostiniAppStylusTabletPortrait), 1);
CreateDownEvent(ui::EventPointerType::kTouch, DownEventFormFactor::kClamshell, CreateDownEvent(ui::EventPointerType::kTouch, DownEventFormFactor::kClamshell,
AppType::CROSTINI_APP); chromeos::AppType::CROSTINI_APP);
histogram_tester_->ExpectBucketCount( histogram_tester_->ExpectBucketCount(
kCombinationHistogramName, kCombinationHistogramName,
static_cast<int>(DownEventMetric2::kCrostiniAppStylusClamshell), 1); static_cast<int>(DownEventMetric2::kCrostiniAppStylusClamshell), 1);
CreateDownEvent(ui::EventPointerType::kTouch, CreateDownEvent(ui::EventPointerType::kTouch,
DownEventFormFactor::kTabletModeLandscape, DownEventFormFactor::kTabletModeLandscape,
AppType::CROSTINI_APP); chromeos::AppType::CROSTINI_APP);
histogram_tester_->ExpectBucketCount( histogram_tester_->ExpectBucketCount(
kCombinationHistogramName, kCombinationHistogramName,
static_cast<int>(DownEventMetric2::kCrostiniAppStylusTabletLandscape), 1); static_cast<int>(DownEventMetric2::kCrostiniAppStylusTabletLandscape), 1);
CreateDownEvent(ui::EventPointerType::kTouch, CreateDownEvent(ui::EventPointerType::kTouch,
DownEventFormFactor::kTabletModePortrait, DownEventFormFactor::kTabletModePortrait,
AppType::CROSTINI_APP); chromeos::AppType::CROSTINI_APP);
histogram_tester_->ExpectBucketCount( histogram_tester_->ExpectBucketCount(
kCombinationHistogramName, kCombinationHistogramName,
static_cast<int>(DownEventMetric2::kCrostiniAppStylusTabletPortrait), 1); static_cast<int>(DownEventMetric2::kCrostiniAppStylusTabletPortrait), 1);

@@ -4,7 +4,6 @@
#include "ash/metrics/wm_feature_metrics_recorder.h" #include "ash/metrics/wm_feature_metrics_recorder.h"
#include "ash/constants/app_types.h"
#include "ash/session/session_controller_impl.h" #include "ash/session/session_controller_impl.h"
#include "ash/shell.h" #include "ash/shell.h"
#include "ash/wm/mru_window_tracker.h" #include "ash/wm/mru_window_tracker.h"
@@ -12,7 +11,8 @@
#include "ash/wm/window_util.h" #include "ash/wm/window_util.h"
#include "base/metrics/histogram_functions.h" #include "base/metrics/histogram_functions.h"
#include "base/strings/strcat.h" #include "base/strings/strcat.h"
#include "ui/aura/client/aura_constants.h" #include "chromeos/ui/base/app_types.h"
#include "chromeos/ui/base/window_properties.h"
namespace ash { namespace ash {
@@ -93,9 +93,8 @@ void RecordWindowLayoutAndStatePeriodically() {
metrics_suffixes.push_back("ActiveWindowAppType"); metrics_suffixes.push_back("ActiveWindowAppType");
} }
for (const std::string& metrics_suffix : metrics_suffixes) { for (const std::string& metrics_suffix : metrics_suffixes) {
base::UmaHistogramEnumeration( base::UmaHistogramEnumeration(metrics_prefix + metrics_suffix,
metrics_prefix + metrics_suffix, window->GetProperty(chromeos::kAppTypeKey));
static_cast<AppType>(window->GetProperty(aura::client::kAppType)));
} }
// Report the sizes for all windows and the active window. // Report the sizes for all windows and the active window.

@@ -75,7 +75,7 @@ TEST_F(WMFeatureMetricsRecorderTests, WindowLayoutMetricsRecorder) {
BucketsAre(base::Bucket(chromeos::WindowStateType::kDefault, 1))); BucketsAre(base::Bucket(chromeos::WindowStateType::kDefault, 1)));
EXPECT_THAT( EXPECT_THAT(
histogram_tester.GetAllSamples(metrics_prefix + "ActiveWindowAppType"), histogram_tester.GetAllSamples(metrics_prefix + "ActiveWindowAppType"),
BucketsAre(base::Bucket(AppType::SYSTEM_APP, 1))); BucketsAre(base::Bucket(chromeos::AppType::SYSTEM_APP, 1)));
EXPECT_THAT( EXPECT_THAT(
histogram_tester.GetAllSamples(metrics_prefix + "ActiveWindowSize"), histogram_tester.GetAllSamples(metrics_prefix + "ActiveWindowSize"),
BucketsAre(base::Bucket(WindowSizeRange::kXSWidthXSHeight, 1))); BucketsAre(base::Bucket(WindowSizeRange::kXSWidthXSHeight, 1)));
@@ -101,7 +101,7 @@ TEST_F(WMFeatureMetricsRecorderTests, WindowLayoutMetricsRecorder) {
base::Bucket(chromeos::WindowStateType::kDefault, 1))); base::Bucket(chromeos::WindowStateType::kDefault, 1)));
EXPECT_THAT( EXPECT_THAT(
histogram_tester.GetAllSamples(metrics_prefix + "ActiveWindowAppType"), histogram_tester.GetAllSamples(metrics_prefix + "ActiveWindowAppType"),
BucketsAre(base::Bucket(AppType::SYSTEM_APP, 2))); BucketsAre(base::Bucket(chromeos::AppType::SYSTEM_APP, 2)));
EXPECT_THAT( EXPECT_THAT(
histogram_tester.GetAllSamples(metrics_prefix + "ActiveWindowSize"), histogram_tester.GetAllSamples(metrics_prefix + "ActiveWindowSize"),
BucketsAre(base::Bucket(WindowSizeRange::kLWidthLHeight, 1), BucketsAre(base::Bucket(WindowSizeRange::kLWidthLHeight, 1),

@@ -4,20 +4,20 @@
#include "ash/public/cpp/app_types_util.h" #include "ash/public/cpp/app_types_util.h"
#include "ash/constants/app_types.h" #include "chromeos/ui/base/app_types.h"
#include "ui/aura/client/aura_constants.h" #include "chromeos/ui/base/window_properties.h"
#include "ui/aura/window.h" #include "ui/aura/window.h"
namespace ash { namespace ash {
bool IsArcWindow(const aura::Window* window) { bool IsArcWindow(const aura::Window* window) {
return window && window->GetProperty(aura::client::kAppType) == return window && window->GetProperty(chromeos::kAppTypeKey) ==
static_cast<int>(ash::AppType::ARC_APP); chromeos::AppType::ARC_APP;
} }
bool IsLacrosWindow(const aura::Window* window) { bool IsLacrosWindow(const aura::Window* window) {
return window->GetProperty(aura::client::kAppType) == return window->GetProperty(chromeos::kAppTypeKey) ==
static_cast<int>(ash::AppType::LACROS); chromeos::AppType::LACROS;
} }
} // namespace ash } // namespace ash

@@ -4,15 +4,15 @@
#include "ash/public/cpp/desk_template.h" #include "ash/public/cpp/desk_template.h"
#include "ash/constants/app_types.h"
#include "ash/constants/ash_features.h" #include "ash/constants/ash_features.h"
#include "ash/public/cpp/window_properties.h" #include "ash/public/cpp/window_properties.h"
#include "base/i18n/time_formatting.h" #include "base/i18n/time_formatting.h"
#include "base/strings/utf_string_conversions.h" #include "base/strings/utf_string_conversions.h"
#include "base/values.h" #include "base/values.h"
#include "chromeos/ui/base/app_types.h"
#include "chromeos/ui/base/window_properties.h"
#include "components/sync_device_info/local_device_info_util.h" #include "components/sync_device_info/local_device_info_util.h"
#include "components/tab_groups/tab_group_info.h" #include "components/tab_groups/tab_group_info.h"
#include "ui/aura/client/aura_constants.h"
#include "ui/aura/window.h" #include "ui/aura/window.h"
namespace ash { namespace ash {
@@ -71,17 +71,16 @@ DeskTemplate::~DeskTemplate() = default;
// static // static
bool DeskTemplate::IsAppTypeSupported(aura::Window* window) { bool DeskTemplate::IsAppTypeSupported(aura::Window* window) {
// For now we'll ignore crostini windows in desk templates. // For now we'll ignore crostini windows in desk templates.
const AppType app_type = const chromeos::AppType app_type = window->GetProperty(chromeos::kAppTypeKey);
static_cast<AppType>(window->GetProperty(aura::client::kAppType));
switch (app_type) { switch (app_type) {
case AppType::NON_APP: case chromeos::AppType::NON_APP:
case AppType::CROSTINI_APP: case chromeos::AppType::CROSTINI_APP:
return false; return false;
case AppType::LACROS: case chromeos::AppType::LACROS:
case AppType::ARC_APP: case chromeos::AppType::ARC_APP:
case AppType::BROWSER: case chromeos::AppType::BROWSER:
case AppType::CHROME_APP: case chromeos::AppType::CHROME_APP:
case AppType::SYSTEM_APP: case chromeos::AppType::SYSTEM_APP:
return true; return true;
} }
} }

@@ -7,6 +7,8 @@
#include "ash/test/test_widget_builder.h" #include "ash/test/test_widget_builder.h"
#include "ash/wm/window_state.h" #include "ash/wm/window_state.h"
#include "base/memory/raw_ptr.h" #include "base/memory/raw_ptr.h"
#include "chromeos/ui/base/app_types.h"
#include "chromeos/ui/base/window_properties.h"
#include "components/exo/shell_surface.h" #include "components/exo/shell_surface.h"
#include "components/exo/test/exo_test_base.h" #include "components/exo/test/exo_test_base.h"
#include "components/exo/test/shell_surface_builder.h" #include "components/exo/test/shell_surface_builder.h"
@@ -33,8 +35,8 @@ class ArcOverlayManagerTest : public exo::test::ExoTestBase {
overlay_window_ = overlay_shell_surface_->GetWidget()->GetNativeWindow(); overlay_window_ = overlay_shell_surface_->GetWidget()->GetNativeWindow();
overlay_shell_surface_->root_surface()->SetClientSurfaceId( overlay_shell_surface_->root_surface()->SetClientSurfaceId(
kOverlayClientSurfaceId); kOverlayClientSurfaceId);
overlay_window_->SetProperty(aura::client::kAppType, overlay_window_->SetProperty(chromeos::kAppTypeKey,
static_cast<int>(ash::AppType::ARC_APP)); chromeos::AppType::ARC_APP);
manager_->OnWindowInitialized(overlay_window_); manager_->OnWindowInitialized(overlay_window_);
deregister_closure_ = manager_->RegisterHostWindow( deregister_closure_ = manager_->RegisterHostWindow(
kOverlayToken, host_widget_->GetNativeWindow()); kOverlayToken, host_widget_->GetNativeWindow());

@@ -6,7 +6,6 @@
#include <limits> #include <limits>
#include "ash/constants/app_types.h"
#include "ash/constants/ash_features.h" #include "ash/constants/ash_features.h"
#include "ash/constants/ash_pref_names.h" #include "ash/constants/ash_pref_names.h"
#include "ash/session/fullscreen_notification_bubble.h" #include "ash/session/fullscreen_notification_bubble.h"
@@ -20,11 +19,11 @@
#include "base/strings/string_util.h" #include "base/strings/string_util.h"
#include "chromeos/dbus/power_manager/backlight.pb.h" #include "chromeos/dbus/power_manager/backlight.pb.h"
#include "chromeos/dbus/power_manager/idle.pb.h" #include "chromeos/dbus/power_manager/idle.pb.h"
#include "chromeos/ui/base/app_types.h"
#include "chromeos/ui/base/window_properties.h" #include "chromeos/ui/base/window_properties.h"
#include "chromeos/ui/wm/fullscreen/keep_fullscreen_for_url_checker.h" #include "chromeos/ui/wm/fullscreen/keep_fullscreen_for_url_checker.h"
#include "components/prefs/pref_registry_simple.h" #include "components/prefs/pref_registry_simple.h"
#include "components/prefs/pref_service.h" #include "components/prefs/pref_service.h"
#include "ui/aura/client/aura_constants.h"
#include "url/gurl.h" #include "url/gurl.h"
namespace ash { namespace ash {
@@ -139,8 +138,8 @@ void FullscreenController::MaybeExitFullscreenBeforeLock(
// could be a Lacros window and it should check with Lacros whether the // could be a Lacros window and it should check with Lacros whether the
// FullscreenController should exit full screen mode. // FullscreenController should exit full screen mode.
if (url.is_empty() && if (url.is_empty() &&
active_window_state->window()->GetProperty(aura::client::kAppType) == active_window_state->window()->GetProperty(chromeos::kAppTypeKey) ==
static_cast<int>(AppType::LACROS)) { chromeos::AppType::LACROS) {
auto should_exit_fullscreen_callback = auto should_exit_fullscreen_callback =
base::BindOnce(&OnShouldExitFullscreenResult, std::move(callback)); base::BindOnce(&OnShouldExitFullscreenResult, std::move(callback));
Shell::Get()->shell_delegate()->ShouldExitFullscreenBeforeLock( Shell::Get()->shell_delegate()->ShouldExitFullscreenBeforeLock(

@@ -6,7 +6,6 @@
#include <memory> #include <memory>
#include "ash/constants/app_types.h"
#include "ash/session/session_controller_impl.h" #include "ash/session/session_controller_impl.h"
#include "ash/shell.h" #include "ash/shell.h"
#include "ash/test/ash_test_base.h" #include "ash/test/ash_test_base.h"
@@ -14,6 +13,7 @@
#include "ash/wm/window_state.h" #include "ash/wm/window_state.h"
#include "base/memory/raw_ptr.h" #include "base/memory/raw_ptr.h"
#include "base/run_loop.h" #include "base/run_loop.h"
#include "chromeos/ui/base/app_types.h"
#include "chromeos/ui/base/window_properties.h" #include "chromeos/ui/base/window_properties.h"
#include "chromeos/ui/wm/fullscreen/pref_names.h" #include "chromeos/ui/wm/fullscreen/pref_names.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
@@ -94,8 +94,7 @@ class FullscreenControllerTest : public FullscreenControllerTestBase,
protected: protected:
void SetPropertiesForNewFullscreenWindow(aura::Window* window) override { void SetPropertiesForNewFullscreenWindow(aura::Window* window) override {
if (is_lacros_window_) { if (is_lacros_window_) {
window->SetProperty(aura::client::kAppType, window->SetProperty(chromeos::kAppTypeKey, chromeos::AppType::LACROS);
static_cast<int>(AppType::LACROS));
} }
} }
@@ -235,8 +234,7 @@ TEST_F(FullscreenControllerNotLacrosRelatedTest,
KeepFullscreenIfNoExitPropertySet) { KeepFullscreenIfNoExitPropertySet) {
window_->SetProperty(chromeos::kUseOverviewToExitFullscreen, true); window_->SetProperty(chromeos::kUseOverviewToExitFullscreen, true);
window_->SetProperty(chromeos::kNoExitFullscreenOnLock, true); window_->SetProperty(chromeos::kNoExitFullscreenOnLock, true);
window_->SetProperty(aura::client::kAppType, window_->SetProperty(chromeos::kAppTypeKey, chromeos::AppType::CROSTINI_APP);
static_cast<int>(AppType::CROSTINI_APP));
ASSERT_TRUE(window_state_->IsFullscreen()); ASSERT_TRUE(window_state_->IsFullscreen());

@@ -5,7 +5,6 @@
#include <memory> #include <memory>
#include <string> #include <string>
#include "ash/constants/app_types.h"
#include "ash/constants/ash_features.h" #include "ash/constants/ash_features.h"
#include "ash/constants/ash_switches.h" #include "ash/constants/ash_switches.h"
#include "ash/style/icon_button.h" #include "ash/style/icon_button.h"

@@ -49,6 +49,8 @@
#include "base/task/thread_pool/thread_pool_instance.h" #include "base/task/thread_pool/thread_pool_instance.h"
#include "base/test/bind.h" #include "base/test/bind.h"
#include "chromeos/dbus/power/fake_power_manager_client.h" #include "chromeos/dbus/power/fake_power_manager_client.h"
#include "chromeos/ui/base/app_types.h"
#include "chromeos/ui/base/window_properties.h"
#include "components/account_id/account_id.h" #include "components/account_id/account_id.h"
#include "components/user_manager/user_names.h" #include "components/user_manager/user_names.h"
#include "components/user_manager/user_type.h" #include "components/user_manager/user_type.h"
@@ -291,14 +293,13 @@ std::unique_ptr<views::Widget> AshTestBase::CreateFramelessTestWidget() {
std::unique_ptr<aura::Window> AshTestBase::CreateAppWindow( std::unique_ptr<aura::Window> AshTestBase::CreateAppWindow(
const gfx::Rect& bounds_in_screen, const gfx::Rect& bounds_in_screen,
AppType app_type, chromeos::AppType app_type,
int shell_window_id, int shell_window_id,
views::WidgetDelegate* delegate) { views::WidgetDelegate* delegate) {
TestWidgetBuilder builder; TestWidgetBuilder builder;
builder.SetWindowTitle(u"Window " + base::NumberToString16(shell_window_id)); builder.SetWindowTitle(u"Window " + base::NumberToString16(shell_window_id));
if (app_type != AppType::NON_APP) { if (app_type != chromeos::AppType::NON_APP) {
builder.SetWindowProperty(aura::client::kAppType, builder.SetWindowProperty(chromeos::kAppTypeKey, app_type);
static_cast<int>(app_type));
} }
if (delegate) { if (delegate) {
@@ -327,7 +328,8 @@ std::unique_ptr<aura::Window> AshTestBase::CreateTestWindow(
nullptr, type, shell_window_id, bounds_in_screen)); nullptr, type, shell_window_id, bounds_in_screen));
} }
return CreateAppWindow(bounds_in_screen, AppType::NON_APP, shell_window_id); return CreateAppWindow(bounds_in_screen, chromeos::AppType::NON_APP,
shell_window_id);
} }
std::unique_ptr<aura::Window> AshTestBase::CreateToplevelTestWindow( std::unique_ptr<aura::Window> AshTestBase::CreateToplevelTestWindow(

@@ -11,7 +11,6 @@
#include <string> #include <string>
#include <utility> #include <utility>
#include "ash/constants/app_types.h"
#include "ash/public/cpp/shell_window_ids.h" #include "ash/public/cpp/shell_window_ids.h"
#include "ash/session/test_session_controller_client.h" #include "ash/session/test_session_controller_client.h"
#include "ash/system/privacy_hub/sensor_disabled_notification_delegate.h" #include "ash/system/privacy_hub/sensor_disabled_notification_delegate.h"
@@ -22,6 +21,7 @@
#include "base/test/task_environment.h" #include "base/test/task_environment.h"
#include "base/threading/thread.h" #include "base/threading/thread.h"
#include "base/traits_bag.h" #include "base/traits_bag.h"
#include "chromeos/ui/base/app_types.h"
#include "components/prefs/testing_pref_service.h" #include "components/prefs/testing_pref_service.h"
#include "components/user_manager/user_type.h" #include "components/user_manager/user_type.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
@@ -147,17 +147,15 @@ class AshTestBase : public testing::Test {
static std::unique_ptr<views::Widget> CreateFramelessTestWidget(); static std::unique_ptr<views::Widget> CreateFramelessTestWidget();
// Creates a widget with a visible WINDOW_TYPE_NORMAL window with the given // Creates a widget with a visible WINDOW_TYPE_NORMAL window with the given
// |app_type|. If |app_type| is AppType::NON_APP, this window is considered a // |app_type|. If |app_type| is chromeos::AppType::NON_APP, this window is
// non-app window. // considered a non-app window. If |bounds_in_screen| is empty the window is
// If |bounds_in_screen| is empty the window is added to the primary root // added to the primary root window, otherwise the window is added to the
// window, otherwise the window is added to the display matching // display matching |bounds_in_screen|. |shell_window_id| is the shell window
// |bounds_in_screen|. |shell_window_id| is the shell window id to give to // id to give to the new window. If |delegate| is empty, a new
// the new window. // |TestWidgetDelegate| instance will be set as this widget's delegate.
// If |delegate| is empty, a new |TestWidgetDelegate| instance will be set as
// this widget's delegate.
std::unique_ptr<aura::Window> CreateAppWindow( std::unique_ptr<aura::Window> CreateAppWindow(
const gfx::Rect& bounds_in_screen = gfx::Rect(), const gfx::Rect& bounds_in_screen = gfx::Rect(),
AppType app_type = AppType::SYSTEM_APP, chromeos::AppType app_type = chromeos::AppType::SYSTEM_APP,
int shell_window_id = kShellWindowId_Invalid, int shell_window_id = kShellWindowId_Invalid,
views::WidgetDelegate* delegate = nullptr); views::WidgetDelegate* delegate = nullptr);

@@ -40,7 +40,9 @@
#include "base/memory/raw_ptr.h" #include "base/memory/raw_ptr.h"
#include "base/test/bind.h" #include "base/test/bind.h"
#include "base/test/scoped_feature_list.h" #include "base/test/scoped_feature_list.h"
#include "chromeos/ui/base/app_types.h"
#include "chromeos/ui/base/display_util.h" #include "chromeos/ui/base/display_util.h"
#include "chromeos/ui/base/window_properties.h"
#include "chromeos/ui/base/window_state_type.h" #include "chromeos/ui/base/window_state_type.h"
#include "chromeos/ui/frame/caption_buttons/frame_caption_button_container_view.h" #include "chromeos/ui/frame/caption_buttons/frame_caption_button_container_view.h"
#include "chromeos/ui/frame/caption_buttons/snap_controller.h" #include "chromeos/ui/frame/caption_buttons/snap_controller.h"
@@ -765,8 +767,7 @@ TEST_F(ClientControlledStateTest, SnapInSecondaryDisplay) {
TEST_P(ClientControlledStateTestClamshellAndTablet, SnapMinimizeAndUnminimize) { TEST_P(ClientControlledStateTestClamshellAndTablet, SnapMinimizeAndUnminimize) {
UpdateDisplay("900x600"); UpdateDisplay("900x600");
window()->SetProperty(aura::client::kAppType, window()->SetProperty(chromeos::kAppTypeKey, chromeos::AppType::ARC_APP);
static_cast<int>(AppType::ARC_APP));
widget_delegate()->EnableSnap(); widget_delegate()->EnableSnap();
const WindowSnapWMEvent snap_left_event(WM_EVENT_SNAP_PRIMARY); const WindowSnapWMEvent snap_left_event(WM_EVENT_SNAP_PRIMARY);
@@ -1034,8 +1035,7 @@ TEST_P(ClientControlledStateTestClamshellAndTablet, SnapAndRotate) {
display::test::DisplayManagerTestApi(display_manager()) display::test::DisplayManagerTestApi(display_manager())
.SetFirstDisplayAsInternalDisplay(); .SetFirstDisplayAsInternalDisplay();
window()->SetProperty(aura::client::kAppType, window()->SetProperty(chromeos::kAppTypeKey, chromeos::AppType::ARC_APP);
static_cast<int>(AppType::ARC_APP));
ScreenOrientationControllerTestApi orientation_test_api( ScreenOrientationControllerTestApi orientation_test_api(
Shell::Get()->screen_orientation_controller()); Shell::Get()->screen_orientation_controller());
@@ -1093,8 +1093,7 @@ TEST_F(ClientControlledStateTest, ResizeToDismissSplitView) {
ASSERT_TRUE(display::Screen::GetScreen()->InTabletMode()); ASSERT_TRUE(display::Screen::GetScreen()->InTabletMode());
auto* const split_view_controller = SplitViewController::Get(window()); auto* const split_view_controller = SplitViewController::Get(window());
window()->SetProperty(aura::client::kAppType, window()->SetProperty(chromeos::kAppTypeKey, chromeos::AppType::ARC_APP);
static_cast<int>(AppType::ARC_APP));
widget_delegate()->EnableSnap(); widget_delegate()->EnableSnap();
ASSERT_TRUE(window_state()->CanResize()); ASSERT_TRUE(window_state()->CanResize());
ASSERT_TRUE(window_state()->CanSnap()); ASSERT_TRUE(window_state()->CanSnap());
@@ -1149,8 +1148,7 @@ TEST_F(ClientControlledStateTest, ResizeToDismissSplitView) {
TEST_F(ClientControlledStateTest, DragCaptionToSnap) { TEST_F(ClientControlledStateTest, DragCaptionToSnap) {
auto* const event_generator = GetEventGenerator(); auto* const event_generator = GetEventGenerator();
window()->SetProperty(aura::client::kAppType, window()->SetProperty(chromeos::kAppTypeKey, chromeos::AppType::ARC_APP);
static_cast<int>(AppType::ARC_APP));
widget_delegate()->EnableSnap(); widget_delegate()->EnableSnap();
ASSERT_TRUE(window_state()->CanResize()); ASSERT_TRUE(window_state()->CanResize());
ASSERT_TRUE(window_state()->CanSnap()); ASSERT_TRUE(window_state()->CanSnap());
@@ -1229,8 +1227,7 @@ TEST_F(ClientControlledStateTest, SwapSnappedWindows) {
UpdateDisplay("900x600"); UpdateDisplay("900x600");
auto* const split_view_controller = SplitViewController::Get(window()); auto* const split_view_controller = SplitViewController::Get(window());
window()->SetProperty(aura::client::kAppType, window()->SetProperty(chromeos::kAppTypeKey, chromeos::AppType::ARC_APP);
static_cast<int>(AppType::ARC_APP));
widget_delegate()->EnableSnap(); widget_delegate()->EnableSnap();
ASSERT_TRUE(window_state()->CanResize()); ASSERT_TRUE(window_state()->CanResize());
ASSERT_TRUE(window_state()->CanSnap()); ASSERT_TRUE(window_state()->CanSnap());
@@ -1280,8 +1277,7 @@ TEST_F(ClientControlledStateTest, ClamshellTabletConversionWithSnappedWindow) {
UpdateDisplay("900x600"); UpdateDisplay("900x600");
auto* const split_view_controller = SplitViewController::Get(window()); auto* const split_view_controller = SplitViewController::Get(window());
window()->SetProperty(aura::client::kAppType, window()->SetProperty(chromeos::kAppTypeKey, chromeos::AppType::ARC_APP);
static_cast<int>(AppType::ARC_APP));
widget_delegate()->EnableSnap(); widget_delegate()->EnableSnap();
ASSERT_TRUE(window_state()->CanResize()); ASSERT_TRUE(window_state()->CanResize());
ASSERT_TRUE(window_state()->CanSnap()); ASSERT_TRUE(window_state()->CanSnap());
@@ -1598,8 +1594,7 @@ TEST_P(ClientControlledStateTestClamshellAndTablet, ResizeSnappedWindow) {
// Set screen width. // Set screen width.
UpdateDisplay("1200x600"); UpdateDisplay("1200x600");
window()->SetProperty(aura::client::kAppType, window()->SetProperty(chromeos::kAppTypeKey, chromeos::AppType::ARC_APP);
static_cast<int>(AppType::ARC_APP));
ASSERT_EQ(chromeos::OrientationType::kLandscapePrimary, ASSERT_EQ(chromeos::OrientationType::kLandscapePrimary,
GetCurrentScreenOrientation()); GetCurrentScreenOrientation());
@@ -1670,8 +1665,7 @@ TEST_P(ClientControlledStateTestClamshellAndTablet, ResizeSnappedWindow) {
TEST_P(ClientControlledStateTestClamshellAndTablet, TEST_P(ClientControlledStateTestClamshellAndTablet,
LeaveSnappedStateByNewStateChange) { LeaveSnappedStateByNewStateChange) {
auto* const split_view_controller = SplitViewController::Get(window()); auto* const split_view_controller = SplitViewController::Get(window());
window()->SetProperty(aura::client::kAppType, window()->SetProperty(chromeos::kAppTypeKey, chromeos::AppType::ARC_APP);
static_cast<int>(AppType::ARC_APP));
widget_delegate()->EnableSnap(); widget_delegate()->EnableSnap();
for (const auto new_state_type : for (const auto new_state_type :
@@ -1697,10 +1691,9 @@ TEST_P(ClientControlledStateTestClamshellAndTablet,
} }
TEST_F(ClientControlledStateTest, FlingFloatedWindowInTabletMode) { TEST_F(ClientControlledStateTest, FlingFloatedWindowInTabletMode) {
// The AppType must be set to any except `AppType::NON_APP` (default value) to // The AppType must be set to any except `chromeos::AppType::NON_APP` (default
// make it floatable. // value) to make it floatable.
window()->SetProperty(aura::client::kAppType, window()->SetProperty(chromeos::kAppTypeKey, chromeos::AppType::ARC_APP);
static_cast<int>(AppType::ARC_APP));
widget_delegate()->EnableFloat(); widget_delegate()->EnableFloat();
ASSERT_TRUE(chromeos::wm::CanFloatWindow(window())); ASSERT_TRUE(chromeos::wm::CanFloatWindow(window()));
@@ -1753,10 +1746,9 @@ TEST_F(ClientControlledStateTest, TuckAndUntuckFloatedWindowInTabletMode) {
auto* const float_controller = Shell::Get()->float_controller(); auto* const float_controller = Shell::Get()->float_controller();
// The AppType must be set to any except `AppType::NON_APP` (default value) to // The AppType must be set to any except `chromeos::AppType::NON_APP` (default
// make it floatable. // value) to make it floatable.
window()->SetProperty(aura::client::kAppType, window()->SetProperty(chromeos::kAppTypeKey, chromeos::AppType::ARC_APP);
static_cast<int>(AppType::ARC_APP));
widget_delegate()->EnableFloat(); widget_delegate()->EnableFloat();
ASSERT_TRUE(chromeos::wm::CanFloatWindow(window())); ASSERT_TRUE(chromeos::wm::CanFloatWindow(window()));
@@ -1836,10 +1828,9 @@ TEST_F(ClientControlledStateTest, TuckAndUntuckFloatedWindowInTabletMode) {
} }
TEST_P(ClientControlledStateTestClamshellAndTablet, MoveFloatedWindow) { TEST_P(ClientControlledStateTestClamshellAndTablet, MoveFloatedWindow) {
// The AppType must be set to any except `AppType::NON_APP` (default value) to // The AppType must be set to any except `chromeos::AppType::NON_APP` (default
// make it floatable. // value) to make it floatable.
window()->SetProperty(aura::client::kAppType, window()->SetProperty(chromeos::kAppTypeKey, chromeos::AppType::ARC_APP);
static_cast<int>(AppType::ARC_APP));
if (InTabletMode()) { if (InTabletMode()) {
// Resizing must be enabled in tablet mode to float. // Resizing must be enabled in tablet mode to float.
widget_delegate()->EnableFloat(); widget_delegate()->EnableFloat();
@@ -1907,10 +1898,9 @@ TEST_P(ClientControlledStateTestClamshellAndTablet, MoveFloatedWindow) {
} }
TEST_P(ClientControlledStateTestClamshellAndTablet, FloatWindow) { TEST_P(ClientControlledStateTestClamshellAndTablet, FloatWindow) {
// The AppType must be set to any except `AppType::NON_APP` (default value) to // The AppType must be set to any except `chromeos::AppType::NON_APP` (default
// make it floatable. // value) to make it floatable.
window()->SetProperty(aura::client::kAppType, window()->SetProperty(chromeos::kAppTypeKey, chromeos::AppType::ARC_APP);
static_cast<int>(AppType::ARC_APP));
if (InTabletMode()) { if (InTabletMode()) {
// Resizing must be enabled in tablet mode to float. // Resizing must be enabled in tablet mode to float.
widget_delegate()->EnableFloat(); widget_delegate()->EnableFloat();
@@ -2183,10 +2173,9 @@ TEST_P(ClientControlledStateTestClamshellAndTablet,
} }
TEST_P(ClientControlledStateTestClamshellAndTablet, SnapFloatedWindow) { TEST_P(ClientControlledStateTestClamshellAndTablet, SnapFloatedWindow) {
// The AppType must be set to any except `AppType::NON_APP` (default value) to // The AppType must be set to any except `chromeos::AppType::NON_APP` (default
// make it floatable. // value) to make it floatable.
window()->SetProperty(aura::client::kAppType, window()->SetProperty(chromeos::kAppTypeKey, chromeos::AppType::ARC_APP);
static_cast<int>(AppType::ARC_APP));
widget_delegate()->EnableFloat(); widget_delegate()->EnableFloat();
ASSERT_TRUE(chromeos::wm::CanFloatWindow(window())); ASSERT_TRUE(chromeos::wm::CanFloatWindow(window()));
@@ -2222,10 +2211,9 @@ TEST_P(ClientControlledStateTestClamshellAndTablet, SnapFloatedWindow) {
// properly without any crash. Regression test for b/322374826. // properly without any crash. Regression test for b/322374826.
TEST_P(ClientControlledStateTestClamshellAndTablet, TEST_P(ClientControlledStateTestClamshellAndTablet,
ReplaceFloatedWindowWithFullscreenWindow) { ReplaceFloatedWindowWithFullscreenWindow) {
// The AppType must be set to any except `AppType::NON_APP` (default value) to // The AppType must be set to any except `chromeos::AppType::NON_APP` (default
// make it floatable. // value) to make it floatable.
window()->SetProperty(aura::client::kAppType, window()->SetProperty(chromeos::kAppTypeKey, chromeos::AppType::ARC_APP);
static_cast<int>(AppType::ARC_APP));
widget_delegate()->EnableFloat(); widget_delegate()->EnableFloat();
ASSERT_TRUE(chromeos::wm::CanFloatWindow(window())); ASSERT_TRUE(chromeos::wm::CanFloatWindow(window()));
@@ -2236,15 +2224,15 @@ TEST_P(ClientControlledStateTestClamshellAndTablet,
EXPECT_TRUE(widget()->IsFullscreen()); EXPECT_TRUE(widget()->IsFullscreen());
// Create another client-controlled window. // Create another client-controlled window.
auto widget2 = TestWidgetBuilder() auto widget2 =
.SetParent(Shell::GetPrimaryRootWindow()->GetChildById( TestWidgetBuilder()
desks_util::GetActiveDeskContainerId())) .SetParent(Shell::GetPrimaryRootWindow()->GetChildById(
.SetBounds(kInitialBounds) desks_util::GetActiveDeskContainerId()))
.SetTestWidgetDelegate() .SetBounds(kInitialBounds)
.SetWindowProperty(aura::client::kAppType, .SetTestWidgetDelegate()
static_cast<int>(AppType::ARC_APP)) .SetWindowProperty(chromeos::kAppTypeKey, chromeos::AppType::ARC_APP)
.SetShow(false) .SetShow(false)
.BuildOwnsNativeWidget(); .BuildOwnsNativeWidget();
auto* const window_state2 = WindowState::Get(widget2->GetNativeWindow()); auto* const window_state2 = WindowState::Get(widget2->GetNativeWindow());
window_state2->set_allow_set_bounds_direct(true); window_state2->set_allow_set_bounds_direct(true);
auto delegate2 = std::make_unique<TestClientControlledStateDelegate>(); auto delegate2 = std::make_unique<TestClientControlledStateDelegate>();

@@ -9,7 +9,6 @@
#include <utility> #include <utility>
#include <vector> #include <vector>
#include "ash/constants/app_types.h"
#include "ash/public/cpp/window_properties.h" #include "ash/public/cpp/window_properties.h"
#include "ash/shell.h" #include "ash/shell.h"
#include "ash/wm/desks/desks_controller.h" #include "ash/wm/desks/desks_controller.h"
@@ -33,6 +32,8 @@
#include "base/metrics/histogram_functions.h" #include "base/metrics/histogram_functions.h"
#include "base/ranges/algorithm.h" #include "base/ranges/algorithm.h"
#include "base/strings/stringprintf.h" #include "base/strings/stringprintf.h"
#include "chromeos/ui/base/app_types.h"
#include "chromeos/ui/base/window_properties.h"
#include "components/app_restore/full_restore_utils.h" #include "components/app_restore/full_restore_utils.h"
#include "ui/aura/client/aura_constants.h" #include "ui/aura/client/aura_constants.h"
#include "ui/aura/window_tracker.h" #include "ui/aura/window_tracker.h"
@@ -97,8 +98,8 @@ bool CanMoveWindowOutOfDeskContainer(aura::Window* window) {
return false; return false;
// Only allow app windows to move to other desks. // Only allow app windows to move to other desks.
return window->GetProperty(aura::client::kAppType) != return window->GetProperty(chromeos::kAppTypeKey) !=
static_cast<int>(AppType::NON_APP); chromeos::AppType::NON_APP;
} }
// Used to temporarily turn off the automatic window positioning while windows // Used to temporarily turn off the automatic window positioning while windows
@@ -833,8 +834,8 @@ std::vector<raw_ptr<aura::Window, VectorExperimental>> Desk::GetAllAppWindows()
std::vector<raw_ptr<aura::Window, VectorExperimental>> app_windows; std::vector<raw_ptr<aura::Window, VectorExperimental>> app_windows;
base::ranges::copy_if(windows_, std::back_inserter(app_windows), base::ranges::copy_if(windows_, std::back_inserter(app_windows),
[](aura::Window* window) { [](aura::Window* window) {
return window->GetProperty(aura::client::kAppType) != return window->GetProperty(chromeos::kAppTypeKey) !=
static_cast<int>(AppType::NON_APP); chromeos::AppType::NON_APP;
}); });
// Note that floated window is also app window but needs to be handled // Note that floated window is also app window but needs to be handled
// separately since it doesn't store in desk container. // separately since it doesn't store in desk container.
@@ -932,7 +933,7 @@ void Desk::RestackAllDeskWindows() {
// *not* on the current desk and we must not try to stack it. // *not* on the current desk and we must not try to stack it.
SCOPED_CRASH_KEY_NUMBER( SCOPED_CRASH_KEY_NUMBER(
"Restack", "adw_app_type", "Restack", "adw_app_type",
adw.window->GetProperty(aura::client::kAppType)); static_cast<int>(adw.window->GetProperty(chromeos::kAppTypeKey)));
SCOPED_CRASH_KEY_STRING32("Restack", "adw_app_id", SCOPED_CRASH_KEY_STRING32("Restack", "adw_app_id",
full_restore::GetAppId(adw.window)); full_restore::GetAppId(adw.window));

@@ -63,6 +63,8 @@
#include "base/strings/stringprintf.h" #include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h" #include "base/strings/utf_string_conversions.h"
#include "base/task/single_thread_task_runner.h" #include "base/task/single_thread_task_runner.h"
#include "chromeos/ui/base/app_types.h"
#include "chromeos/ui/base/window_properties.h"
#include "chromeos/utils/haptics_util.h" #include "chromeos/utils/haptics_util.h"
#include "components/app_restore/full_restore_utils.h" #include "components/app_restore/full_restore_utils.h"
#include "components/app_restore/window_properties.h" #include "components/app_restore/window_properties.h"
@@ -2324,7 +2326,8 @@ void DesksController::RestackVisibleOnAllDesksWindowsOnActiveDesk() {
// we'll log some info and skip the window. // we'll log some info and skip the window.
SCOPED_CRASH_KEY_NUMBER( SCOPED_CRASH_KEY_NUMBER(
"Restack", "adw_app_type", "Restack", "adw_app_type",
visible_on_all_desks_window->GetProperty(aura::client::kAppType)); static_cast<int>(
visible_on_all_desks_window->GetProperty(chromeos::kAppTypeKey)));
SCOPED_CRASH_KEY_STRING32( SCOPED_CRASH_KEY_STRING32(
"Restack", "adw_app_id", "Restack", "adw_app_id",
::full_restore::GetAppId(visible_on_all_desks_window)); ::full_restore::GetAppId(visible_on_all_desks_window));

@@ -5144,9 +5144,11 @@ TEST_F(DesksMultiUserTest, RemoveDesks) {
EXPECT_TRUE(win0->IsVisible()); EXPECT_TRUE(win0->IsVisible());
ActivateDesk(desk_2); ActivateDesk(desk_2);
auto win1 = CreateAppWindow(gfx::Rect(50, 50, 200, 200)); auto win1 = CreateAppWindow(gfx::Rect(50, 50, 200, 200));
auto win2 = CreateAppWindow(gfx::Rect(50, 50, 200, 200), AppType::ARC_APP); auto win2 =
CreateAppWindow(gfx::Rect(50, 50, 200, 200), chromeos::AppType::ARC_APP);
// Non-app window. // Non-app window.
auto win3 = CreateAppWindow(gfx::Rect(50, 50, 200, 200), AppType::NON_APP); auto win3 =
CreateAppWindow(gfx::Rect(50, 50, 200, 200), chromeos::AppType::NON_APP);
multi_user_window_manager()->SetWindowOwner(win2.get(), GetUser1AccountId()); multi_user_window_manager()->SetWindowOwner(win2.get(), GetUser1AccountId());
multi_user_window_manager()->SetWindowOwner(win1.get(), GetUser1AccountId()); multi_user_window_manager()->SetWindowOwner(win1.get(), GetUser1AccountId());
multi_user_window_manager()->SetWindowOwner(win3.get(), GetUser1AccountId()); multi_user_window_manager()->SetWindowOwner(win3.get(), GetUser1AccountId());
@@ -8694,9 +8696,9 @@ TEST_P(DesksCloseAllTest, CloseActiveDeskCloseWindows) {
TEST_P(DesksCloseAllTest, ForceCloseWindows) { TEST_P(DesksCloseAllTest, ForceCloseWindows) {
WindowHolder window1(CreateAppWindow()); WindowHolder window1(CreateAppWindow());
WindowHolder window2(CreateAppWindow(gfx::Rect(), AppType::SYSTEM_APP, WindowHolder window2(CreateAppWindow(
ShellWindowId::kShellWindowId_Invalid, gfx::Rect(), chromeos::AppType::SYSTEM_APP,
new StuckWidgetDelegate())); ShellWindowId::kShellWindowId_Invalid, new StuckWidgetDelegate()));
NewDesk(); NewDesk();
auto* controller = DesksController::Get(); auto* controller = DesksController::Get();
@@ -9101,9 +9103,9 @@ TEST_P(DesksCloseAllTest, CanAddLastDeskWhileUndoToastIsBeingDisplayed) {
// Tests that windows in CloseAll will not be unparented while they are closing // Tests that windows in CloseAll will not be unparented while they are closing
// asynchronously. // asynchronously.
TEST_P(DesksCloseAllTest, ClosingWindowsHaveParent) { TEST_P(DesksCloseAllTest, ClosingWindowsHaveParent) {
WindowHolder window(CreateAppWindow(gfx::Rect(), AppType::SYSTEM_APP, WindowHolder window(CreateAppWindow(
ShellWindowId::kShellWindowId_Invalid, gfx::Rect(), chromeos::AppType::SYSTEM_APP,
new StuckWidgetDelegate())); ShellWindowId::kShellWindowId_Invalid, new StuckWidgetDelegate()));
NewDesk(); NewDesk();
auto* controller = DesksController::Get(); auto* controller = DesksController::Get();

@@ -7,7 +7,6 @@
#include "ash/accessibility/accessibility_controller.h" #include "ash/accessibility/accessibility_controller.h"
#include "ash/accessibility/test_accessibility_controller_client.h" #include "ash/accessibility/test_accessibility_controller_client.h"
#include "ash/constants/app_types.h"
#include "ash/constants/ash_features.h" #include "ash/constants/ash_features.h"
#include "ash/public/cpp/desk_template.h" #include "ash/public/cpp/desk_template.h"
#include "ash/public/cpp/multi_user_window_manager.h" #include "ash/public/cpp/multi_user_window_manager.h"
@@ -69,6 +68,8 @@
#include "base/time/time.h" #include "base/time/time.h"
#include "base/uuid.h" #include "base/uuid.h"
#include "chromeos/constants/chromeos_features.h" #include "chromeos/constants/chromeos_features.h"
#include "chromeos/ui/base/app_types.h"
#include "chromeos/ui/base/window_properties.h"
#include "components/account_id/account_id.h" #include "components/account_id/account_id.h"
#include "components/app_constants/constants.h" #include "components/app_constants/constants.h"
#include "components/app_restore/app_launch_info.h" #include "components/app_restore/app_launch_info.h"
@@ -2075,8 +2076,8 @@ TEST_F(SavedDeskTest, DesksBarDoesNotReturnToZeroState) {
TEST_F(SavedDeskTest, UnsupportedAppsDialog) { TEST_F(SavedDeskTest, UnsupportedAppsDialog) {
// Create a crostini window. // Create a crostini window.
auto crostini_window = CreateAppWindow(); auto crostini_window = CreateAppWindow();
crostini_window->SetProperty(aura::client::kAppType, crostini_window->SetProperty(chromeos::kAppTypeKey,
static_cast<int>(AppType::CROSTINI_APP)); chromeos::AppType::CROSTINI_APP);
// Create a normal window. // Create a normal window.
auto test_window = CreateAppWindow(); auto test_window = CreateAppWindow();
@@ -3073,8 +3074,8 @@ TEST_F(SavedDeskTest, UnsupportedAppDialogRecordsMetric) {
// Create a crostini window. // Create a crostini window.
auto crostini_window = CreateAppWindow(); auto crostini_window = CreateAppWindow();
crostini_window->SetProperty(aura::client::kAppType, crostini_window->SetProperty(chromeos::kAppTypeKey,
static_cast<int>(AppType::CROSTINI_APP)); chromeos::AppType::CROSTINI_APP);
// Create a normal window. // Create a normal window.
auto test_window = CreateAppWindow(); auto test_window = CreateAppWindow();

@@ -8,7 +8,6 @@
#include <cstddef> #include <cstddef>
#include <vector> #include <vector>
#include "ash/constants/app_types.h"
#include "ash/constants/ash_features.h" #include "ash/constants/ash_features.h"
#include "ash/display/screen_orientation_controller.h" #include "ash/display/screen_orientation_controller.h"
#include "ash/public/cpp/shell_window_ids.h" #include "ash/public/cpp/shell_window_ids.h"
@@ -37,6 +36,7 @@
#include "base/memory/raw_ptr.h" #include "base/memory/raw_ptr.h"
#include "base/metrics/histogram_functions.h" #include "base/metrics/histogram_functions.h"
#include "base/metrics/histogram_macros.h" #include "base/metrics/histogram_macros.h"
#include "chromeos/ui/base/app_types.h"
#include "chromeos/ui/base/window_properties.h" #include "chromeos/ui/base/window_properties.h"
#include "chromeos/ui/wm/constants.h" #include "chromeos/ui/wm/constants.h"
#include "chromeos/ui/wm/window_util.h" #include "chromeos/ui/wm/window_util.h"
@@ -95,8 +95,8 @@ void UpdateWindowBoundsForTablet(
// `SetBoundsWMEvent` instead. Otherwise, the window bounds are updated only // `SetBoundsWMEvent` instead. Otherwise, the window bounds are updated only
// in Chrome-side whereas ARC++ doesnt know the changes. (See comments in // in Chrome-side whereas ARC++ doesnt know the changes. (See comments in
// `TabletModeWindowState::UpdateWindowPosition`.) // `TabletModeWindowState::UpdateWindowPosition`.)
if (window->GetProperty(aura::client::kAppType) == if (window->GetProperty(chromeos::kAppTypeKey) ==
static_cast<int>(AppType::ARC_APP)) { chromeos::AppType::ARC_APP) {
// If any animation is requested, it will directly animate the // If any animation is requested, it will directly animate the
// client-controlled windows for a rich animation. The client bounds change // client-controlled windows for a rich animation. The client bounds change
// will follow. // will follow.
@@ -591,8 +591,8 @@ gfx::Rect FloatController::GetFloatWindowTabletBounds(aura::Window* window) {
auto* floated_window_info = auto* floated_window_info =
Shell::Get()->float_controller()->MaybeGetFloatedWindowInfo(window); Shell::Get()->float_controller()->MaybeGetFloatedWindowInfo(window);
#if DCHECK_IS_ON() #if DCHECK_IS_ON()
if (window->GetProperty(aura::client::kAppType) != if (window->GetProperty(chromeos::kAppTypeKey) !=
static_cast<int>(AppType::ARC_APP)) { chromeos::AppType::ARC_APP) {
DCHECK(floated_window_info); DCHECK(floated_window_info);
} }
#endif #endif
@@ -964,8 +964,8 @@ void FloatController::OnScreenRotationAnimationFinished(
// TODO(b/278519956): Remove this workaround once ARC/Exo handle rotation // TODO(b/278519956): Remove this workaround once ARC/Exo handle rotation
// bounds better. // bounds better.
for (auto& [window, info] : floated_window_info_map_) { for (auto& [window, info] : floated_window_info_map_) {
if (window->GetProperty(aura::client::kAppType) == if (window->GetProperty(chromeos::kAppTypeKey) ==
static_cast<int>(AppType::ARC_APP)) { chromeos::AppType::ARC_APP) {
const gfx::Rect bounds = const gfx::Rect bounds =
display::Screen::GetScreen()->InTabletMode() display::Screen::GetScreen()->InTabletMode()
? GetFloatWindowTabletBounds(window) ? GetFloatWindowTabletBounds(window)

@@ -47,6 +47,8 @@
#include "base/test/metrics/user_action_tester.h" #include "base/test/metrics/user_action_tester.h"
#include "base/test/simple_test_clock.h" #include "base/test/simple_test_clock.h"
#include "base/time/clock.h" #include "base/time/clock.h"
#include "chromeos/ui/base/app_types.h"
#include "chromeos/ui/base/window_properties.h"
#include "chromeos/ui/base/window_state_type.h" #include "chromeos/ui/base/window_state_type.h"
#include "chromeos/ui/frame/caption_buttons/snap_controller.h" #include "chromeos/ui/frame/caption_buttons/snap_controller.h"
#include "chromeos/ui/frame/header_view.h" #include "chromeos/ui/frame/header_view.h"
@@ -1381,7 +1383,7 @@ TEST_F(TabletWindowFloatTest, MinimumSizeChangeOnTablet) {
// Create a window in clamshell mode without a minimum size, and larger than // Create a window in clamshell mode without a minimum size, and larger than
// its tablet minimum size. // its tablet minimum size.
auto window = auto window =
CreateAppWindow(gfx::Rect(500, 500), AppType::SYSTEM_APP, CreateAppWindow(gfx::Rect(500, 500), chromeos::AppType::SYSTEM_APP,
kShellWindowId_DeskContainerA, new TestWidgetDelegateAsh); kShellWindowId_DeskContainerA, new TestWidgetDelegateAsh);
auto* custom_frame = static_cast<TestNonClientFrameViewAsh*>( auto* custom_frame = static_cast<TestNonClientFrameViewAsh*>(
NonClientFrameViewAsh::Get(window.get())); NonClientFrameViewAsh::Get(window.get()));
@@ -1438,8 +1440,7 @@ TEST_F(TabletWindowFloatTest, CanBrowsersFloat) {
aura::test::TestWindowDelegate window_delegate; aura::test::TestWindowDelegate window_delegate;
std::unique_ptr<aura::Window> window(CreateTestWindowInShellWithDelegate( std::unique_ptr<aura::Window> window(CreateTestWindowInShellWithDelegate(
&window_delegate, /*id=*/-1, gfx::Rect(500, 500))); &window_delegate, /*id=*/-1, gfx::Rect(500, 500)));
window->SetProperty(aura::client::kAppType, window->SetProperty(chromeos::kAppTypeKey, chromeos::AppType::BROWSER);
static_cast<int>(AppType::BROWSER));
wm::ActivateWindow(window.get()); wm::ActivateWindow(window.get());
// Browser windows whose minimum size is greater than the maximum allowed // Browser windows whose minimum size is greater than the maximum allowed
@@ -1477,8 +1478,7 @@ TEST_F(TabletWindowFloatTest, TabletPositioningLandscape) {
aura::test::TestWindowDelegate window_delegate; aura::test::TestWindowDelegate window_delegate;
std::unique_ptr<aura::Window> window(CreateTestWindowInShellWithDelegate( std::unique_ptr<aura::Window> window(CreateTestWindowInShellWithDelegate(
&window_delegate, /*id=*/-1, gfx::Rect(300, 300))); &window_delegate, /*id=*/-1, gfx::Rect(300, 300)));
window->SetProperty(aura::client::kAppType, window->SetProperty(chromeos::kAppTypeKey, chromeos::AppType::BROWSER);
static_cast<int>(AppType::BROWSER));
wm::ActivateWindow(window.get()); wm::ActivateWindow(window.get());
Shell::Get()->tablet_mode_controller()->SetEnabledForTest(true); Shell::Get()->tablet_mode_controller()->SetEnabledForTest(true);
@@ -1503,8 +1503,7 @@ TEST_F(TabletWindowFloatTest, FloatWindowUnfloatsEnterTablet) {
std::unique_ptr<aura::Window> window(CreateTestWindowInShellWithDelegate( std::unique_ptr<aura::Window> window(CreateTestWindowInShellWithDelegate(
&window_delegate, /*id=*/-1, gfx::Rect(850, 850))); &window_delegate, /*id=*/-1, gfx::Rect(850, 850)));
window_delegate.set_minimum_size(gfx::Size(500, 500)); window_delegate.set_minimum_size(gfx::Size(500, 500));
window->SetProperty(aura::client::kAppType, window->SetProperty(chromeos::kAppTypeKey, chromeos::AppType::BROWSER);
static_cast<int>(ash::AppType::BROWSER));
wm::ActivateWindow(window.get()); wm::ActivateWindow(window.get());
PressAndReleaseKey(ui::VKEY_F, ui::EF_ALT_DOWN | ui::EF_COMMAND_DOWN); PressAndReleaseKey(ui::VKEY_F, ui::EF_ALT_DOWN | ui::EF_COMMAND_DOWN);
@@ -1523,8 +1522,7 @@ TEST_F(TabletWindowFloatTest, FloatWindowUnfloatsDisplayChange) {
std::unique_ptr<aura::Window> window(CreateTestWindowInShellWithDelegate( std::unique_ptr<aura::Window> window(CreateTestWindowInShellWithDelegate(
&window_delegate, /*id=*/-1, gfx::Rect(300, 300))); &window_delegate, /*id=*/-1, gfx::Rect(300, 300)));
window_delegate.set_minimum_size(gfx::Size(400, 400)); window_delegate.set_minimum_size(gfx::Size(400, 400));
window->SetProperty(aura::client::kAppType, window->SetProperty(chromeos::kAppTypeKey, chromeos::AppType::BROWSER);
static_cast<int>(ash::AppType::BROWSER));
wm::ActivateWindow(window.get()); wm::ActivateWindow(window.get());
// Enter tablet mode and float `window`. // Enter tablet mode and float `window`.

@@ -5,7 +5,6 @@
#include "ash/wm/gestures/back_gesture/back_gesture_event_handler.h" #include "ash/wm/gestures/back_gesture/back_gesture_event_handler.h"
#include "ash/app_list/app_list_controller_impl.h" #include "ash/app_list/app_list_controller_impl.h"
#include "ash/constants/app_types.h"
#include "ash/constants/ash_features.h" #include "ash/constants/ash_features.h"
#include "ash/controls/contextual_tooltip.h" #include "ash/controls/contextual_tooltip.h"
#include "ash/display/screen_orientation_controller.h" #include "ash/display/screen_orientation_controller.h"
@@ -31,8 +30,8 @@
#include "base/containers/contains.h" #include "base/containers/contains.h"
#include "base/i18n/rtl.h" #include "base/i18n/rtl.h"
#include "base/metrics/user_metrics.h" #include "base/metrics/user_metrics.h"
#include "chromeos/ui/base/app_types.h"
#include "chromeos/ui/base/window_properties.h" #include "chromeos/ui/base/window_properties.h"
#include "ui/aura/client/aura_constants.h"
#include "ui/aura/window.h" #include "ui/aura/window.h"
#include "ui/display/screen.h" #include "ui/display/screen.h"
#include "ui/wm/core/coordinate_conversion.h" #include "ui/wm/core/coordinate_conversion.h"
@@ -377,9 +376,9 @@ bool BackGestureEventHandler::MaybeHandleBackGesture(
// For fullscreen ARC apps, show the hotseat and shelf on the // For fullscreen ARC apps, show the hotseat and shelf on the
// first back swipe, and send a back event on the second back // first back swipe, and send a back event on the second back
// swipe. For other fullscreen apps, exit fullscreen. // swipe. For other fullscreen apps, exit fullscreen.
const bool arc_app = top_window_state->window()->GetProperty( const bool arc_app =
aura::client::kAppType) == top_window_state->window()->GetProperty(
static_cast<int>(AppType::ARC_APP); chromeos::kAppTypeKey) == chromeos::AppType::ARC_APP;
if (arc_app) { if (arc_app) {
// Go back to the previous page if the shelf was already shown, // Go back to the previous page if the shelf was already shown,
// otherwise record as showing shelf. // otherwise record as showing shelf.

@@ -32,6 +32,8 @@
#include "ash/wm/workspace/backdrop_controller.h" #include "ash/wm/workspace/backdrop_controller.h"
#include "ash/wm/workspace/workspace_layout_manager.h" #include "ash/wm/workspace/workspace_layout_manager.h"
#include "ash/wm/workspace_controller.h" #include "ash/wm/workspace_controller.h"
#include "chromeos/ui/base/app_types.h"
#include "chromeos/ui/base/window_properties.h"
#include "ui/aura/client/aura_constants.h" #include "ui/aura/client/aura_constants.h"
#include "ui/base/accelerators/accelerator.h" #include "ui/base/accelerators/accelerator.h"
#include "ui/base/accelerators/test_accelerator_target.h" #include "ui/base/accelerators/test_accelerator_target.h"
@@ -71,7 +73,7 @@ class BackGestureEventHandlerTest : public AshTestBase {
} }
AshTestBase::SetUp(std::move(delegate)); AshTestBase::SetUp(std::move(delegate));
RecreateTopWindow(AppType::BROWSER); RecreateTopWindow(chromeos::AppType::BROWSER);
TabletModeControllerTestApi().EnterTabletMode(); TabletModeControllerTestApi().EnterTabletMode();
} }
@@ -108,7 +110,7 @@ class BackGestureEventHandlerTest : public AshTestBase {
Shell::Get()->back_gesture_event_handler()->OnTouchEvent(&event); Shell::Get()->back_gesture_event_handler()->OnTouchEvent(&event);
} }
void RecreateTopWindow(AppType app_type) { void RecreateTopWindow(chromeos::AppType app_type) {
top_window_ = CreateAppWindow(gfx::Rect(), app_type); top_window_ = CreateAppWindow(gfx::Rect(), app_type);
} }
@@ -595,7 +597,7 @@ TEST_F(BackGestureEventHandlerTest, ARCFullscreenedWindow) {
ui::TestAcceleratorTarget target_back_press, target_back_release; ui::TestAcceleratorTarget target_back_press, target_back_release;
RegisterBackPressAndRelease(&target_back_press, &target_back_release); RegisterBackPressAndRelease(&target_back_press, &target_back_release);
RecreateTopWindow(AppType::ARC_APP); RecreateTopWindow(chromeos::AppType::ARC_APP);
WindowState* window_state = WindowState::Get(top_window()); WindowState* window_state = WindowState::Get(top_window());
SendFullscreenEvent(window_state); SendFullscreenEvent(window_state);
@@ -951,11 +953,11 @@ TEST_F(BackGestureEventHandlerTestCantGoBack, NonResizableApp) {
} }
TEST_F(BackGestureEventHandlerTestCantGoBack, NonAppAndSystemApps) { TEST_F(BackGestureEventHandlerTestCantGoBack, NonAppAndSystemApps) {
RecreateTopWindow(AppType::NON_APP); RecreateTopWindow(chromeos::AppType::NON_APP);
GenerateBackSequence(); GenerateBackSequence();
EXPECT_TRUE(WindowState::Get(top_window())->IsMinimized()); EXPECT_TRUE(WindowState::Get(top_window())->IsMinimized());
RecreateTopWindow(AppType::SYSTEM_APP); RecreateTopWindow(chromeos::AppType::SYSTEM_APP);
GenerateBackSequence(); GenerateBackSequence();
EXPECT_TRUE(WindowState::Get(top_window())->IsMinimized()); EXPECT_TRUE(WindowState::Get(top_window())->IsMinimized());
} }

@@ -4,7 +4,6 @@
#include "ash/wm/gestures/back_gesture/back_gesture_metrics.h" #include "ash/wm/gestures/back_gesture/back_gesture_metrics.h"
#include "ash/constants/app_types.h"
#include "ash/display/screen_orientation_controller.h" #include "ash/display/screen_orientation_controller.h"
#include "ash/shell.h" #include "ash/shell.h"
#include "ash/wm/overview/overview_controller.h" #include "ash/wm/overview/overview_controller.h"
@@ -12,7 +11,8 @@
#include "ash/wm/splitview/split_view_divider.h" #include "ash/wm/splitview/split_view_divider.h"
#include "ash/wm/window_util.h" #include "ash/wm/window_util.h"
#include "base/metrics/histogram_macros.h" #include "base/metrics/histogram_macros.h"
#include "ui/aura/client/aura_constants.h" #include "chromeos/ui/base/app_types.h"
#include "chromeos/ui/base/window_properties.h"
namespace ash { namespace ash {
@@ -148,13 +148,16 @@ BackGestureUnderneathWindowType GetUnderneathWindowType(
const auto* window = window_util::GetTopWindow(); const auto* window = window_util::GetTopWindow();
DCHECK(window); DCHECK(window);
const int app_type = window->GetProperty(aura::client::kAppType); const chromeos::AppType app_type = window->GetProperty(chromeos::kAppTypeKey);
if (app_type == static_cast<int>(AppType::BROWSER)) if (app_type == chromeos::AppType::BROWSER) {
return BackGestureUnderneathWindowType::kBrowser; return BackGestureUnderneathWindowType::kBrowser;
if (app_type == static_cast<int>(AppType::CHROME_APP)) }
if (app_type == chromeos::AppType::CHROME_APP) {
return BackGestureUnderneathWindowType::kChromeApp; return BackGestureUnderneathWindowType::kChromeApp;
if (app_type == static_cast<int>(AppType::ARC_APP)) }
if (app_type == chromeos::AppType::ARC_APP) {
return BackGestureUnderneathWindowType::kArcApp; return BackGestureUnderneathWindowType::kArcApp;
}
return BackGestureUnderneathWindowType::kOthers; return BackGestureUnderneathWindowType::kOthers;
} }

@@ -6,7 +6,6 @@
#include <vector> #include <vector>
#include "ash/constants/app_types.h"
#include "ash/public/cpp/window_properties.h" #include "ash/public/cpp/window_properties.h"
#include "ash/shell.h" #include "ash/shell.h"
#include "ash/wm/ash_focus_rules.h" #include "ash/wm/ash_focus_rules.h"
@@ -23,6 +22,8 @@
#include "base/containers/contains.h" #include "base/containers/contains.h"
#include "base/memory/raw_ptr.h" #include "base/memory/raw_ptr.h"
#include "base/ranges/algorithm.h" #include "base/ranges/algorithm.h"
#include "chromeos/ui/base/app_types.h"
#include "chromeos/ui/base/window_properties.h"
#include "components/app_restore/window_properties.h" #include "components/app_restore/window_properties.h"
#include "ui/aura/client/aura_constants.h" #include "ui/aura/client/aura_constants.h"
#include "ui/aura/window.h" #include "ui/aura/window.h"
@@ -245,8 +246,8 @@ WindowList MruWindowTracker::BuildAppWindowList(
DesksMruType desks_mru_type) const { DesksMruType desks_mru_type) const {
return BuildWindowListInternal( return BuildWindowListInternal(
&mru_windows_, desks_mru_type, [](aura::Window* w) { &mru_windows_, desks_mru_type, [](aura::Window* w) {
return w->GetProperty(aura::client::kAppType) != return w->GetProperty(chromeos::kAppTypeKey) !=
static_cast<int>(ash::AppType::NON_APP); chromeos::AppType::NON_APP;
}); });
} }

@@ -813,14 +813,15 @@ TEST_F(OverviewControllerTest, FrameThrottling) {
std::unique_ptr<aura::Window> std::unique_ptr<aura::Window>
created_windows[browser_window_count + arc_window_count]; created_windows[browser_window_count + arc_window_count];
for (int i = 0; i < browser_window_count; ++i) { for (int i = 0; i < browser_window_count; ++i) {
created_windows[i] = CreateAppWindow(gfx::Rect(), AppType::BROWSER); created_windows[i] =
CreateAppWindow(gfx::Rect(), chromeos::AppType::BROWSER);
created_windows[i]->SetEmbedFrameSinkId(ids[i]); created_windows[i]->SetEmbedFrameSinkId(ids[i]);
} }
std::vector<aura::Window*> arc_windows(arc_window_count, nullptr); std::vector<aura::Window*> arc_windows(arc_window_count, nullptr);
for (int i = 0; i < arc_window_count; ++i) { for (int i = 0; i < arc_window_count; ++i) {
created_windows[i + browser_window_count] = created_windows[i + browser_window_count] =
CreateAppWindow(gfx::Rect(), AppType::ARC_APP); CreateAppWindow(gfx::Rect(), chromeos::AppType::ARC_APP);
arc_windows[i] = created_windows[i + browser_window_count].get(); arc_windows[i] = created_windows[i + browser_window_count].get();
} }

@@ -11,7 +11,6 @@
#include <vector> #include <vector>
#include "ash/accessibility/accessibility_controller.h" #include "ash/accessibility/accessibility_controller.h"
#include "ash/constants/app_types.h"
#include "ash/constants/ash_features.h" #include "ash/constants/ash_features.h"
#include "ash/constants/notifier_catalogs.h" #include "ash/constants/notifier_catalogs.h"
#include "ash/metrics/histogram_macros.h" #include "ash/metrics/histogram_macros.h"
@@ -3264,15 +3263,17 @@ void OverviewGrid::UpdateNumSavedDeskUnsupportedWindows(
// its supported/incognito type and a proper fix is made. // its supported/incognito type and a proper fix is made.
if (num_unsupported_windows_ < 0) { if (num_unsupported_windows_ < 0) {
num_unsupported_windows_ = 0; num_unsupported_windows_ = 0;
SCOPED_CRASH_KEY_NUMBER("OG_UNSDUW", "unsupported_app_type", SCOPED_CRASH_KEY_NUMBER(
window->GetProperty(aura::client::kAppType)); "OG_UNSDUW", "unsupported_app_type",
static_cast<int>(window->GetProperty(chromeos::kAppTypeKey)));
SCOPED_CRASH_KEY_STRING32("OG_UNSDUW", "unsupported_app_id", SCOPED_CRASH_KEY_STRING32("OG_UNSDUW", "unsupported_app_id",
::full_restore::GetAppId(window)); ::full_restore::GetAppId(window));
base::debug::DumpWithoutCrashing(); base::debug::DumpWithoutCrashing();
} else if (num_incognito_windows_ < 0) { } else if (num_incognito_windows_ < 0) {
num_incognito_windows_ = 0; num_incognito_windows_ = 0;
SCOPED_CRASH_KEY_NUMBER("OG_UNSDUW", "incognito_app_type", SCOPED_CRASH_KEY_NUMBER(
window->GetProperty(aura::client::kAppType)); "OG_UNSDUW", "incognito_app_type",
static_cast<int>(window->GetProperty(chromeos::kAppTypeKey)));
SCOPED_CRASH_KEY_STRING32("OG_UNSDUW", "incognito_app_id", SCOPED_CRASH_KEY_STRING32("OG_UNSDUW", "incognito_app_id",
::full_restore::GetAppId(window)); ::full_restore::GetAppId(window));
base::debug::DumpWithoutCrashing(); base::debug::DumpWithoutCrashing();

@@ -47,6 +47,7 @@
#include "base/memory/raw_ptr.h" #include "base/memory/raw_ptr.h"
#include "base/metrics/user_metrics.h" #include "base/metrics/user_metrics.h"
#include "base/trace_event/trace_event.h" #include "base/trace_event/trace_event.h"
#include "chromeos/ui/base/window_properties.h"
#include "chromeos/ui/base/window_state_type.h" #include "chromeos/ui/base/window_state_type.h"
#include "third_party/abseil-cpp/absl/cleanup/cleanup.h" #include "third_party/abseil-cpp/absl/cleanup/cleanup.h"
#include "ui/aura/client/aura_constants.h" #include "ui/aura/client/aura_constants.h"
@@ -1242,7 +1243,7 @@ void OverviewItem::SetItemBounds(const gfx::RectF& target_bounds,
SCOPED_CRASH_KEY_NUMBER( SCOPED_CRASH_KEY_NUMBER(
"b/320479135", "win_type", "b/320479135", "win_type",
static_cast<int>(window->GetProperty(aura::client::kAppType))); static_cast<int>(window->GetProperty(chromeos::kAppTypeKey)));
SCOPED_CRASH_KEY_STRING32("b/320479135", "rw_bounds", SCOPED_CRASH_KEY_STRING32("b/320479135", "rw_bounds",
root_window_->GetBoundsInScreen().ToString()); root_window_->GetBoundsInScreen().ToString());

@@ -17,7 +17,6 @@
#include "ash/accessibility/test_accessibility_controller_client.h" #include "ash/accessibility/test_accessibility_controller_client.h"
#include "ash/app_list/app_list_controller_impl.h" #include "ash/app_list/app_list_controller_impl.h"
#include "ash/app_list/test/app_list_test_helper.h" #include "ash/app_list/test/app_list_test_helper.h"
#include "ash/constants/app_types.h"
#include "ash/constants/ash_features.h" #include "ash/constants/ash_features.h"
#include "ash/constants/ash_pref_names.h" #include "ash/constants/ash_pref_names.h"
#include "ash/display/screen_orientation_controller.h" #include "ash/display/screen_orientation_controller.h"
@@ -104,6 +103,8 @@
#include "base/test/metrics/user_action_tester.h" #include "base/test/metrics/user_action_tester.h"
#include "base/test/scoped_feature_list.h" #include "base/test/scoped_feature_list.h"
#include "base/time/time.h" #include "base/time/time.h"
#include "chromeos/ui/base/app_types.h"
#include "chromeos/ui/base/window_properties.h"
#include "chromeos/ui/base/window_state_type.h" #include "chromeos/ui/base/window_state_type.h"
#include "chromeos/ui/frame/caption_buttons/snap_controller.h" #include "chromeos/ui/frame/caption_buttons/snap_controller.h"
#include "ui/aura/client/aura_constants.h" #include "ui/aura/client/aura_constants.h"
@@ -3445,8 +3446,7 @@ TEST_P(OverviewSessionTest, FrameThrottlingBrowser) {
for (int i = 0; i < window_count; ++i) { for (int i = 0; i < window_count; ++i) {
windows.emplace_back( windows.emplace_back(
CreateTestWindowInShellWithDelegate(nullptr, -1, gfx::Rect())); CreateTestWindowInShellWithDelegate(nullptr, -1, gfx::Rect()));
windows[i]->SetProperty(aura::client::kAppType, windows[i]->SetProperty(chromeos::kAppTypeKey, chromeos::AppType::BROWSER);
static_cast<int>(AppType::BROWSER));
windows[i]->SetEmbedFrameSinkId(ids[i]); windows[i]->SetEmbedFrameSinkId(ids[i]);
} }
@@ -3459,8 +3459,7 @@ TEST_P(OverviewSessionTest, FrameThrottlingBrowser) {
CreateTestWindowInShellWithDelegate(nullptr, -1, gfx::Rect())); CreateTestWindowInShellWithDelegate(nullptr, -1, gfx::Rect()));
constexpr viz::FrameSinkId new_window_id{6u, 6u}; constexpr viz::FrameSinkId new_window_id{6u, 6u};
new_window->SetEmbedFrameSinkId(new_window_id); new_window->SetEmbedFrameSinkId(new_window_id);
new_window->SetProperty(aura::client::kAppType, new_window->SetProperty(chromeos::kAppTypeKey, chromeos::AppType::BROWSER);
static_cast<int>(AppType::BROWSER));
OverviewGrid* grid = GetOverviewSession()->grid_list()[0].get(); OverviewGrid* grid = GetOverviewSession()->grid_list()[0].get();
grid->AppendItem(new_window.get(), /*reposition=*/false, /*animate=*/false, grid->AppendItem(new_window.get(), /*reposition=*/false, /*animate=*/false,
/*use_spawn_animation=*/false); /*use_spawn_animation=*/false);
@@ -3491,8 +3490,7 @@ TEST_P(OverviewSessionTest, FrameThrottlingLacros) {
for (int i = 0; i < window_count; ++i) { for (int i = 0; i < window_count; ++i) {
windows.emplace_back( windows.emplace_back(
CreateTestWindowInShellWithDelegate(nullptr, -1, gfx::Rect())); CreateTestWindowInShellWithDelegate(nullptr, -1, gfx::Rect()));
windows[i]->SetProperty(aura::client::kAppType, windows[i]->SetProperty(chromeos::kAppTypeKey, chromeos::AppType::LACROS);
static_cast<int>(AppType::LACROS));
windows[i]->SetEmbedFrameSinkId(ids[i]); windows[i]->SetEmbedFrameSinkId(ids[i]);
} }
for (auto& w : windows) for (auto& w : windows)
@@ -3509,8 +3507,7 @@ TEST_P(OverviewSessionTest, FrameThrottlingLacros) {
CreateTestWindowInShellWithDelegate(nullptr, -1, gfx::Rect())); CreateTestWindowInShellWithDelegate(nullptr, -1, gfx::Rect()));
constexpr viz::FrameSinkId new_window_id{6u, 6u}; constexpr viz::FrameSinkId new_window_id{6u, 6u};
new_window->SetEmbedFrameSinkId(new_window_id); new_window->SetEmbedFrameSinkId(new_window_id);
new_window->SetProperty(aura::client::kAppType, new_window->SetProperty(chromeos::kAppTypeKey, chromeos::AppType::LACROS);
static_cast<int>(AppType::LACROS));
OverviewGrid* grid = GetOverviewSession()->grid_list()[0].get(); OverviewGrid* grid = GetOverviewSession()->grid_list()[0].get();
grid->AppendItem(new_window.get(), /*reposition=*/false, /*animate=*/false, grid->AppendItem(new_window.get(), /*reposition=*/false, /*animate=*/false,
/*use_spawn_animation=*/false); /*use_spawn_animation=*/false);
@@ -3545,8 +3542,7 @@ TEST_P(OverviewSessionTest, FrameThrottlingArc) {
for (int i = 0; i < window_count; ++i) { for (int i = 0; i < window_count; ++i) {
windows.emplace_back( windows.emplace_back(
CreateTestWindowInShellWithDelegate(nullptr, -1, gfx::Rect())); CreateTestWindowInShellWithDelegate(nullptr, -1, gfx::Rect()));
windows[i]->SetProperty(aura::client::kAppType, windows[i]->SetProperty(chromeos::kAppTypeKey, chromeos::AppType::ARC_APP);
static_cast<int>(AppType::ARC_APP));
} }
auto windows_to_throttle = auto windows_to_throttle =
@@ -3560,8 +3556,7 @@ TEST_P(OverviewSessionTest, FrameThrottlingArc) {
// Add a new window to overview. // Add a new window to overview.
std::unique_ptr<aura::Window> new_window( std::unique_ptr<aura::Window> new_window(
CreateTestWindowInShellWithDelegate(nullptr, -1, gfx::Rect())); CreateTestWindowInShellWithDelegate(nullptr, -1, gfx::Rect()));
new_window->SetProperty(aura::client::kAppType, new_window->SetProperty(chromeos::kAppTypeKey, chromeos::AppType::ARC_APP);
static_cast<int>(AppType::ARC_APP));
windows_to_throttle.push_back(new_window.get()); windows_to_throttle.push_back(new_window.get());
EXPECT_CALL(observer, OnThrottlingEnded()); EXPECT_CALL(observer, OnThrottlingEnded());
EXPECT_CALL(observer, EXPECT_CALL(observer,

@@ -48,9 +48,9 @@ class PipDoubleTapHandlerTest : public AshTestBase,
std::unique_ptr<aura::Window> CreateAppWindow( std::unique_ptr<aura::Window> CreateAppWindow(
const gfx::Rect& bounds, const gfx::Rect& bounds,
WindowStateType window_state_type) { WindowStateType window_state_type) {
auto window = AshTestBase::CreateAppWindow(bounds, AppType::SYSTEM_APP, auto window = AshTestBase::CreateAppWindow(
kShellWindowId_DeskContainerA, bounds, chromeos::AppType::SYSTEM_APP, kShellWindowId_DeskContainerA,
new TestWidgetDelegateAsh); new TestWidgetDelegateAsh);
auto* custom_frame = static_cast<TestNonClientFrameViewAsh*>( auto* custom_frame = static_cast<TestNonClientFrameViewAsh*>(
NonClientFrameViewAsh::Get(window.get())); NonClientFrameViewAsh::Get(window.get()));

@@ -209,7 +209,7 @@ TEST_F(ScreenPinningControllerTest, ExitUnifiedDisplay) {
TEST_F(ScreenPinningControllerTest, CleanUpObserversAndDimmer) { TEST_F(ScreenPinningControllerTest, CleanUpObserversAndDimmer) {
// Create a window with ClientControlledState. // Create a window with ClientControlledState.
auto w = CreateAppWindow(gfx::Rect(), AppType::CHROME_APP, 0); auto w = CreateAppWindow(gfx::Rect(), chromeos::AppType::CHROME_APP, 0);
ash::WindowState* ws = ash::WindowState::Get(w.get()); ash::WindowState* ws = ash::WindowState::Get(w.get());
auto delegate = std::make_unique<TestClientControlledStateDelegate>(); auto delegate = std::make_unique<TestClientControlledStateDelegate>();
auto state = std::make_unique<ClientControlledState>(std::move(delegate)); auto state = std::make_unique<ClientControlledState>(std::move(delegate));

@@ -2170,7 +2170,7 @@ class SnapGroupTest : public AshTestBase {
std::unique_ptr<aura::Window> CreateAppWindowWithMinSize(gfx::Size min_size) { std::unique_ptr<aura::Window> CreateAppWindowWithMinSize(gfx::Size min_size) {
std::unique_ptr<aura::Window> window = std::unique_ptr<aura::Window> window =
CreateAppWindow(gfx::Rect(800, 600), AppType::SYSTEM_APP, CreateAppWindow(gfx::Rect(800, 600), chromeos::AppType::SYSTEM_APP,
kShellWindowId_Invalid, new TestWidgetDelegateAsh); kShellWindowId_Invalid, new TestWidgetDelegateAsh);
auto* custom_frame = static_cast<TestNonClientFrameViewAsh*>( auto* custom_frame = static_cast<TestNonClientFrameViewAsh*>(
NonClientFrameViewAsh::Get(window.get())); NonClientFrameViewAsh::Get(window.get()));
@@ -4378,7 +4378,7 @@ TEST_F(SnapGroupOverviewTest, OverviewGroupItemForNonPrimaryScreenOrientation) {
EXPECT_TRUE(wm::IsActiveWindow(window1.get())); EXPECT_TRUE(wm::IsActiveWindow(window1.get()));
std::unique_ptr<aura::Window> window3 = std::unique_ptr<aura::Window> window3 =
CreateAppWindow(gfx::Rect(300, 300), AppType::CHROME_APP); CreateAppWindow(gfx::Rect(300, 300), chromeos::AppType::CHROME_APP);
EXPECT_TRUE(wm::IsActiveWindow(window3.get())); EXPECT_TRUE(wm::IsActiveWindow(window3.get()));
ToggleOverview(); ToggleOverview();
@@ -5292,13 +5292,13 @@ TEST_F(SnapGroupWindowCycleTest, WindowInSnapGroupDestructionInAltTab) {
// completion of window cycling. // completion of window cycling.
TEST_F(SnapGroupWindowCycleTest, SteppingInWindowCycleView) { TEST_F(SnapGroupWindowCycleTest, SteppingInWindowCycleView) {
std::unique_ptr<aura::Window> window3 = std::unique_ptr<aura::Window> window3 =
CreateAppWindow(gfx::Rect(300, 300), AppType::CHROME_APP); CreateAppWindow(gfx::Rect(300, 300), chromeos::AppType::CHROME_APP);
std::unique_ptr<aura::Window> window2 = std::unique_ptr<aura::Window> window2 =
CreateAppWindow(gfx::Rect(200, 200), AppType::CHROME_APP); CreateAppWindow(gfx::Rect(200, 200), chromeos::AppType::CHROME_APP);
std::unique_ptr<aura::Window> window1 = std::unique_ptr<aura::Window> window1 =
CreateAppWindow(gfx::Rect(100, 100), AppType::BROWSER); CreateAppWindow(gfx::Rect(100, 100), chromeos::AppType::BROWSER);
std::unique_ptr<aura::Window> window0 = std::unique_ptr<aura::Window> window0 =
CreateAppWindow(gfx::Rect(10, 10), AppType::BROWSER); CreateAppWindow(gfx::Rect(10, 10), chromeos::AppType::BROWSER);
SnapTwoTestWindows(window0.get(), window1.get()); SnapTwoTestWindows(window0.get(), window1.get());
EXPECT_TRUE(wm::IsActiveWindow(window1.get())); EXPECT_TRUE(wm::IsActiveWindow(window1.get()));
@@ -5335,11 +5335,11 @@ TEST_F(SnapGroupWindowCycleTest, SteppingInWindowCycleView) {
// a snap group. // a snap group.
TEST_F(SnapGroupWindowCycleTest, WindowCycleItemRoundedCorners) { TEST_F(SnapGroupWindowCycleTest, WindowCycleItemRoundedCorners) {
std::unique_ptr<aura::Window> window0 = std::unique_ptr<aura::Window> window0 =
CreateAppWindow(gfx::Rect(100, 200), AppType::BROWSER); CreateAppWindow(gfx::Rect(100, 200), chromeos::AppType::BROWSER);
std::unique_ptr<aura::Window> window1 = std::unique_ptr<aura::Window> window1 =
CreateAppWindow(gfx::Rect(200, 300), AppType::BROWSER); CreateAppWindow(gfx::Rect(200, 300), chromeos::AppType::BROWSER);
std::unique_ptr<aura::Window> window2 = std::unique_ptr<aura::Window> window2 =
CreateAppWindow(gfx::Rect(300, 400), AppType::BROWSER); CreateAppWindow(gfx::Rect(300, 400), chromeos::AppType::BROWSER);
SnapTwoTestWindows(window0.get(), window1.get()); SnapTwoTestWindows(window0.get(), window1.get());
WindowCycleController* window_cycle_controller = WindowCycleController* window_cycle_controller =
@@ -5373,11 +5373,11 @@ TEST_F(SnapGroupWindowCycleTest, WindowCycleItemRoundedCornersInPortait) {
UpdateDisplay("600x900"); UpdateDisplay("600x900");
std::unique_ptr<aura::Window> window0 = std::unique_ptr<aura::Window> window0 =
CreateAppWindow(gfx::Rect(100, 200), AppType::BROWSER); CreateAppWindow(gfx::Rect(100, 200), chromeos::AppType::BROWSER);
std::unique_ptr<aura::Window> window1 = std::unique_ptr<aura::Window> window1 =
CreateAppWindow(gfx::Rect(200, 300), AppType::BROWSER); CreateAppWindow(gfx::Rect(200, 300), chromeos::AppType::BROWSER);
std::unique_ptr<aura::Window> window2 = std::unique_ptr<aura::Window> window2 =
CreateAppWindow(gfx::Rect(300, 400), AppType::BROWSER); CreateAppWindow(gfx::Rect(300, 400), chromeos::AppType::BROWSER);
SnapTwoTestWindows(window0.get(), window1.get(), /*horizontal=*/false); SnapTwoTestWindows(window0.get(), window1.get(), /*horizontal=*/false);
WindowCycleController* window_cycle_controller = WindowCycleController* window_cycle_controller =
@@ -5410,11 +5410,11 @@ TEST_F(SnapGroupWindowCycleTest,
chromeos::GetDisplayCurrentOrientation(displays[0])); chromeos::GetDisplayCurrentOrientation(displays[0]));
std::unique_ptr<aura::Window> window2 = std::unique_ptr<aura::Window> window2 =
CreateAppWindow(gfx::Rect(200, 200), AppType::CHROME_APP); CreateAppWindow(gfx::Rect(200, 200), chromeos::AppType::CHROME_APP);
std::unique_ptr<aura::Window> window1 = std::unique_ptr<aura::Window> window1 =
CreateAppWindow(gfx::Rect(100, 100), AppType::BROWSER); CreateAppWindow(gfx::Rect(100, 100), chromeos::AppType::BROWSER);
std::unique_ptr<aura::Window> window0 = std::unique_ptr<aura::Window> window0 =
CreateAppWindow(gfx::Rect(10, 10), AppType::BROWSER); CreateAppWindow(gfx::Rect(10, 10), chromeos::AppType::BROWSER);
// Drag `window0` to the **top** of the screen to snap it into the // Drag `window0` to the **top** of the screen to snap it into the
// **secondary** position, as the display is currently oriented in secondary // **secondary** position, as the display is currently oriented in secondary
@@ -5456,7 +5456,7 @@ TEST_F(SnapGroupWindowCycleTest,
// Create `window3` and start testing the stepping. // Create `window3` and start testing the stepping.
std::unique_ptr<aura::Window> window3 = std::unique_ptr<aura::Window> window3 =
CreateAppWindow(gfx::Rect(300, 300), AppType::CHROME_APP); CreateAppWindow(gfx::Rect(300, 300), chromeos::AppType::CHROME_APP);
EXPECT_TRUE(wm::IsActiveWindow(window3.get())); EXPECT_TRUE(wm::IsActiveWindow(window3.get()));
// Window cycle list: // Window cycle list:

@@ -12,7 +12,6 @@
#include <vector> #include <vector>
#include "ash/accessibility/accessibility_controller.h" #include "ash/accessibility/accessibility_controller.h"
#include "ash/constants/app_types.h"
#include "ash/constants/ash_features.h" #include "ash/constants/ash_features.h"
#include "ash/display/screen_orientation_controller.h" #include "ash/display/screen_orientation_controller.h"
#include "ash/display/window_tree_host_manager.h" #include "ash/display/window_tree_host_manager.h"
@@ -64,6 +63,7 @@
#include "base/notreached.h" #include "base/notreached.h"
#include "base/ranges/algorithm.h" #include "base/ranges/algorithm.h"
#include "base/time/time.h" #include "base/time/time.h"
#include "chromeos/ui/base/app_types.h"
#include "chromeos/ui/base/window_properties.h" #include "chromeos/ui/base/window_properties.h"
#include "chromeos/ui/base/window_state_type.h" #include "chromeos/ui/base/window_state_type.h"
#include "chromeos/ui/frame/caption_buttons/snap_controller.h" #include "chromeos/ui/frame/caption_buttons/snap_controller.h"
@@ -1614,16 +1614,16 @@ void SplitViewController::StartResizeWithDivider(
SCOPED_CRASH_KEY_NUMBER("b337283677", "secondary_state_type", SCOPED_CRASH_KEY_NUMBER("b337283677", "secondary_state_type",
secondary_state_type); secondary_state_type);
auto primary_window_type = chromeos::AppType primary_window_type =
primary_window_ ? primary_window_->GetProperty(aura::client::kAppType) primary_window_ ? primary_window_->GetProperty(chromeos::kAppTypeKey)
: -1; : chromeos::AppType::NON_APP;
auto secondary_window_type = chromeos::AppType secondary_window_type =
secondary_window_ ? secondary_window_->GetProperty(aura::client::kAppType) secondary_window_ ? secondary_window_->GetProperty(chromeos::kAppTypeKey)
: -1; : chromeos::AppType::NON_APP;
SCOPED_CRASH_KEY_NUMBER("b337283677", "primary_window_type", SCOPED_CRASH_KEY_NUMBER("b337283677", "primary_window_type",
primary_window_type); static_cast<int>(primary_window_type));
SCOPED_CRASH_KEY_NUMBER("b337283677", "secondary_window_type", SCOPED_CRASH_KEY_NUMBER("b337283677", "secondary_window_type",
secondary_window_type); static_cast<int>(secondary_window_type));
CHECK(IsInOverviewSession()); CHECK(IsInOverviewSession());
if (GetOverviewSession()->GetGridWithRootWindow(root_window_)->empty()) { if (GetOverviewSession()->GetGridWithRootWindow(root_window_)->empty()) {
@@ -2021,8 +2021,8 @@ void SplitViewController::UpdateSnappedWindowBounds(aura::Window* window) {
DCHECK(IsWindowInSplitView(window)); DCHECK(IsWindowInSplitView(window));
WindowState* window_state = WindowState::Get(window); WindowState* window_state = WindowState::Get(window);
if (InTabletMode()) { if (InTabletMode()) {
if (window->GetProperty(aura::client::kAppType) == if (window->GetProperty(chromeos::kAppTypeKey) ==
static_cast<int>(AppType::ARC_APP)) { chromeos::AppType::ARC_APP) {
// TODO(b/264962634): Remove this workaround. Probably, we can rewrite // TODO(b/264962634): Remove this workaround. Probably, we can rewrite
// `TabletModeWindowState::UpdateWindowPosition` to include this logic. // `TabletModeWindowState::UpdateWindowPosition` to include this logic.
const gfx::Rect requested_bounds = const gfx::Rect requested_bounds =

@@ -11,7 +11,6 @@
#include <vector> #include <vector>
#include "ash/accessibility/magnifier/docked_magnifier_controller.h" #include "ash/accessibility/magnifier/docked_magnifier_controller.h"
#include "ash/constants/app_types.h"
#include "ash/constants/ash_features.h" #include "ash/constants/ash_features.h"
#include "ash/display/screen_orientation_controller.h" #include "ash/display/screen_orientation_controller.h"
#include "ash/display/screen_orientation_controller_test_api.h" #include "ash/display/screen_orientation_controller_test_api.h"
@@ -60,6 +59,7 @@
#include "base/memory/raw_ptr.h" #include "base/memory/raw_ptr.h"
#include "base/test/metrics/histogram_tester.h" #include "base/test/metrics/histogram_tester.h"
#include "base/test/scoped_feature_list.h" #include "base/test/scoped_feature_list.h"
#include "chromeos/ui/base/app_types.h"
#include "chromeos/ui/base/window_properties.h" #include "chromeos/ui/base/window_properties.h"
#include "chromeos/ui/frame/caption_buttons/snap_controller.h" #include "chromeos/ui/frame/caption_buttons/snap_controller.h"
#include "ui/aura/client/aura_constants.h" #include "ui/aura/client/aura_constants.h"
@@ -3529,8 +3529,7 @@ TEST_F(SplitViewControllerTest, SnapTwoThirdPartialWindow) {
std::unique_ptr<aura::Window> window(CreateTestWindowInShellWithDelegate( std::unique_ptr<aura::Window> window(CreateTestWindowInShellWithDelegate(
&window_delegate, /*id=*/-1, gfx::Rect(500, 500))); &window_delegate, /*id=*/-1, gfx::Rect(500, 500)));
window_delegate.set_minimum_size(gfx::Size(500, 500)); window_delegate.set_minimum_size(gfx::Size(500, 500));
window->SetProperty(aura::client::kAppType, window->SetProperty(chromeos::kAppTypeKey, chromeos::AppType::BROWSER);
static_cast<int>(AppType::BROWSER));
WindowSnapWMEvent snap_primary(WM_EVENT_SNAP_PRIMARY, WindowSnapWMEvent snap_primary(WM_EVENT_SNAP_PRIMARY,
chromeos::kTwoThirdSnapRatio); chromeos::kTwoThirdSnapRatio);
@@ -3548,16 +3547,14 @@ TEST_F(SplitViewControllerTest, SelectWindowCannotOneThirdSnap) {
std::unique_ptr<aura::Window> window1(CreateTestWindowInShellWithDelegate( std::unique_ptr<aura::Window> window1(CreateTestWindowInShellWithDelegate(
&window_delegate1, /*id=*/-1, gfx::Rect(500, 500))); &window_delegate1, /*id=*/-1, gfx::Rect(500, 500)));
window_delegate1.set_minimum_size(gfx::Size(500, 500)); window_delegate1.set_minimum_size(gfx::Size(500, 500));
window1->SetProperty(aura::client::kAppType, window1->SetProperty(chromeos::kAppTypeKey, chromeos::AppType::BROWSER);
static_cast<int>(AppType::BROWSER));
// The second window can be snapped 1/2 but not 1/3. // The second window can be snapped 1/2 but not 1/3.
aura::test::TestWindowDelegate window_delegate2; aura::test::TestWindowDelegate window_delegate2;
std::unique_ptr<aura::Window> window2(CreateTestWindowInShellWithDelegate( std::unique_ptr<aura::Window> window2(CreateTestWindowInShellWithDelegate(
&window_delegate2, /*id=*/-1, gfx::Rect(500, 500))); &window_delegate2, /*id=*/-1, gfx::Rect(500, 500)));
window_delegate2.set_minimum_size(gfx::Size(400, 400)); window_delegate2.set_minimum_size(gfx::Size(400, 400));
window2->SetProperty(aura::client::kAppType, window2->SetProperty(chromeos::kAppTypeKey, chromeos::AppType::BROWSER);
static_cast<int>(AppType::BROWSER));
// Snap `window1` 2/3 to the left. // Snap `window1` 2/3 to the left.
wm::ActivateWindow(window1.get()); wm::ActivateWindow(window1.get());

@@ -15,7 +15,6 @@
#include "ash/accelerometer/accelerometer_types.h" #include "ash/accelerometer/accelerometer_types.h"
#include "ash/accessibility/test_accessibility_controller_client.h" #include "ash/accessibility/test_accessibility_controller_client.h"
#include "ash/app_list/app_list_controller_impl.h" #include "ash/app_list/app_list_controller_impl.h"
#include "ash/constants/app_types.h"
#include "ash/constants/ash_switches.h" #include "ash/constants/ash_switches.h"
#include "ash/display/screen_orientation_controller.h" #include "ash/display/screen_orientation_controller.h"
#include "ash/public/cpp/shell_window_ids.h" #include "ash/public/cpp/shell_window_ids.h"

@@ -4,7 +4,6 @@
#include "ash/wm/tablet_mode/tablet_mode_multitask_cue_controller.h" #include "ash/wm/tablet_mode/tablet_mode_multitask_cue_controller.h"
#include "ash/constants/app_types.h"
#include "ash/constants/ash_switches.h" #include "ash/constants/ash_switches.h"
#include "ash/shell.h" #include "ash/shell.h"
#include "ash/wm/tablet_mode/tablet_mode_controller.h" #include "ash/wm/tablet_mode/tablet_mode_controller.h"
@@ -14,7 +13,8 @@
#include "ash/wm/window_state.h" #include "ash/wm/window_state.h"
#include "ash/wm/window_util.h" #include "ash/wm/window_util.h"
#include "base/command_line.h" #include "base/command_line.h"
#include "ui/aura/client/aura_constants.h" #include "chromeos/ui/base/app_types.h"
#include "chromeos/ui/base/window_properties.h"
#include "ui/display/tablet_state.h" #include "ui/display/tablet_state.h"
#include "ui/views/animation/animation_builder.h" #include "ui/views/animation/animation_builder.h"
#include "ui/wm/public/activation_client.h" #include "ui/wm/public/activation_client.h"
@@ -122,8 +122,8 @@ bool TabletModeMultitaskCueController::CanShowCue(aura::Window* window) const {
} }
// Only show or dismiss the cue when activating app windows. // Only show or dismiss the cue when activating app windows.
if (static_cast<AppType>(window->GetProperty(aura::client::kAppType)) == if (window->GetProperty(chromeos::kAppTypeKey) ==
AppType::NON_APP) { chromeos::AppType::NON_APP) {
return false; return false;
} }

@@ -4,7 +4,6 @@
#include "ash/wm/toplevel_window_event_handler.h" #include "ash/wm/toplevel_window_event_handler.h"
#include "ash/constants/app_types.h"
#include "ash/constants/ash_features.h" #include "ash/constants/ash_features.h"
#include "ash/public/cpp/window_properties.h" #include "ash/public/cpp/window_properties.h"
#include "ash/shell.h" #include "ash/shell.h"
@@ -18,6 +17,8 @@
#include "ash/wm/window_util.h" #include "ash/wm/window_util.h"
#include "base/functional/bind.h" #include "base/functional/bind.h"
#include "base/run_loop.h" #include "base/run_loop.h"
#include "chromeos/ui/base/app_types.h"
#include "chromeos/ui/base/window_properties.h"
#include "ui/aura/client/aura_constants.h" #include "ui/aura/client/aura_constants.h"
#include "ui/aura/env.h" #include "ui/aura/env.h"
#include "ui/aura/window.h" #include "ui/aura/window.h"
@@ -848,9 +849,9 @@ aura::Window* ToplevelWindowEventHandler::GetTargetForClientAreaGesture(
return nullptr; return nullptr;
} }
auto app_type = toplevel->GetProperty(aura::client::kAppType); auto app_type = toplevel->GetProperty(chromeos::kAppTypeKey);
if (app_type == static_cast<int>(AppType::BROWSER) || if (app_type == chromeos::AppType::BROWSER ||
app_type == static_cast<int>(AppType::LACROS)) { app_type == chromeos::AppType::LACROS) {
return nullptr; return nullptr;
} }

@@ -3,10 +3,8 @@
// found in the LICENSE file. // found in the LICENSE file.
#include "ash/wm/toplevel_window_event_handler.h" #include "ash/wm/toplevel_window_event_handler.h"
#include "base/memory/raw_ptr.h"
#include "ash/accelerators/accelerator_controller_impl.h" #include "ash/accelerators/accelerator_controller_impl.h"
#include "ash/constants/app_types.h"
#include "ash/display/screen_orientation_controller.h" #include "ash/display/screen_orientation_controller.h"
#include "ash/display/screen_orientation_controller_test_api.h" #include "ash/display/screen_orientation_controller_test_api.h"
#include "ash/public/cpp/shell_window_ids.h" #include "ash/public/cpp/shell_window_ids.h"
@@ -30,9 +28,12 @@
#include "ash/wm/workspace_controller.h" #include "ash/wm/workspace_controller.h"
#include "base/compiler_specific.h" #include "base/compiler_specific.h"
#include "base/functional/bind.h" #include "base/functional/bind.h"
#include "base/memory/raw_ptr.h"
#include "base/run_loop.h" #include "base/run_loop.h"
#include "base/task/single_thread_task_runner.h" #include "base/task/single_thread_task_runner.h"
#include "base/test/scoped_feature_list.h" #include "base/test/scoped_feature_list.h"
#include "chromeos/ui/base/app_types.h"
#include "chromeos/ui/base/window_properties.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
#include "ui/aura/client/aura_constants.h" #include "ui/aura/client/aura_constants.h"
#include "ui/aura/client/capture_client.h" #include "ui/aura/client/capture_client.h"
@@ -1223,8 +1224,8 @@ class ToplevelWindowEventHandlerDragTest : public AshTestBase {
dragged_window_ = CreateTestWindow(); dragged_window_ = CreateTestWindow();
non_dragged_window_ = CreateTestWindow(); non_dragged_window_ = CreateTestWindow();
dragged_window_->SetProperty(aura::client::kAppType, dragged_window_->SetProperty(chromeos::kAppTypeKey,
static_cast<int>(AppType::CHROME_APP)); chromeos::AppType::CHROME_APP);
} }
void TearDown() override { void TearDown() override {

@@ -916,7 +916,7 @@ TEST_F(WindowCycleControllerTest, FrameThrottling) {
{1u, 1u}, {2u, 2u}, {3u, 3u}, {4u, 4u}, {5u, 5u}}; {1u, 1u}, {2u, 2u}, {3u, 3u}, {4u, 4u}, {5u, 5u}};
std::unique_ptr<aura::Window> windows[window_count]; std::unique_ptr<aura::Window> windows[window_count];
for (int i = 0; i < window_count; ++i) { for (int i = 0; i < window_count; ++i) {
windows[i] = CreateAppWindow(gfx::Rect(), AppType::BROWSER); windows[i] = CreateAppWindow(gfx::Rect(), chromeos::AppType::BROWSER);
windows[i]->SetEmbedFrameSinkId(ids[i]); windows[i]->SetEmbedFrameSinkId(ids[i]);
} }

@@ -6,7 +6,6 @@
#include <string> #include <string>
#include "ash/constants/app_types.h"
#include "ash/public/cpp/shelf_config.h" #include "ash/public/cpp/shelf_config.h"
#include "ash/shell.h" #include "ash/shell.h"
#include "ash/test/ash_test_base.h" #include "ash/test/ash_test_base.h"
@@ -115,13 +114,13 @@ TEST_F(WindowPositionerTest, IgnoreFullscreenInAutoRearrange) {
// opened. // opened.
TEST_F(WindowPositionerTest, AutoRearrangeOnHideOrRemove) { TEST_F(WindowPositionerTest, AutoRearrangeOnHideOrRemove) {
// Create 2 browser windows. // Create 2 browser windows.
std::unique_ptr<aura::Window> window1 = std::unique_ptr<aura::Window> window1 = CreateAppWindow(
CreateAppWindow(gfx::Rect(200, 200, 330, 230), AppType::BROWSER); gfx::Rect(200, 200, 330, 230), chromeos::AppType::BROWSER);
std::unique_ptr<aura::Window> window2 = std::unique_ptr<aura::Window> window2 = CreateAppWindow(
CreateAppWindow(gfx::Rect(400, 600, 330, 230), AppType::BROWSER); gfx::Rect(400, 600, 330, 230), chromeos::AppType::BROWSER);
// Create 1 app window. // Create 1 app window.
std::unique_ptr<aura::Window> window3 = std::unique_ptr<aura::Window> window3 = CreateAppWindow(
CreateAppWindow(gfx::Rect(300, 200, 330, 230), AppType::SYSTEM_APP); gfx::Rect(300, 200, 330, 230), chromeos::AppType::SYSTEM_APP);
WindowState::Get(window1.get())->SetWindowPositionManaged(true); WindowState::Get(window1.get())->SetWindowPositionManaged(true);
WindowState::Get(window2.get())->SetWindowPositionManaged(true); WindowState::Get(window2.get())->SetWindowPositionManaged(true);

@@ -4,10 +4,11 @@
#include "ash/wm/window_preview_view.h" #include "ash/wm/window_preview_view.h"
#include "ash/constants/app_types.h"
#include "ash/test/ash_test_base.h" #include "ash/test/ash_test_base.h"
#include "ash/wm/window_preview_view_test_api.h" #include "ash/wm/window_preview_view_test_api.h"
#include "ash/wm/window_state.h" #include "ash/wm/window_state.h"
#include "chromeos/ui/base/app_types.h"
#include "chromeos/ui/base/window_properties.h"
#include "ui/aura/client/aura_constants.h" #include "ui/aura/client/aura_constants.h"
#include "ui/views/widget/widget.h" #include "ui/views/widget/widget.h"
#include "ui/wm/core/window_util.h" #include "ui/wm/core/window_util.h"
@@ -27,8 +28,8 @@ std::unique_ptr<views::Widget> CreateTransientChild(
params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
params.bounds = gfx::Rect{40, 50}; params.bounds = gfx::Rect{40, 50};
params.context = params.parent = parent_widget->GetNativeWindow(); params.context = params.parent = parent_widget->GetNativeWindow();
params.init_properties_container.SetProperty( params.init_properties_container.SetProperty(chromeos::kAppTypeKey,
aura::client::kAppType, static_cast<int>(AppType::ARC_APP)); chromeos::AppType::ARC_APP);
widget->Init(std::move(params)); widget->Init(std::move(params));
widget->Show(); widget->Show();
return widget; return widget;

@@ -5,7 +5,6 @@
#include "ash/wm/window_restore/pine_controller.h" #include "ash/wm/window_restore/pine_controller.h"
#include "ash/birch/birch_model.h" #include "ash/birch/birch_model.h"
#include "ash/constants/app_types.h"
#include "ash/constants/ash_pref_names.h" #include "ash/constants/ash_pref_names.h"
#include "ash/constants/ash_switches.h" #include "ash/constants/ash_switches.h"
#include "ash/constants/notifier_catalogs.h" #include "ash/constants/notifier_catalogs.h"
@@ -38,9 +37,10 @@
#include "base/functional/callback_helpers.h" #include "base/functional/callback_helpers.h"
#include "base/task/task_traits.h" #include "base/task/task_traits.h"
#include "base/task/thread_pool.h" #include "base/task/thread_pool.h"
#include "chromeos/ui/base/app_types.h"
#include "chromeos/ui/base/display_util.h" #include "chromeos/ui/base/display_util.h"
#include "chromeos/ui/base/window_properties.h"
#include "components/prefs/pref_service.h" #include "components/prefs/pref_service.h"
#include "ui/aura/client/aura_constants.h"
#include "ui/base/l10n/l10n_util.h" #include "ui/base/l10n/l10n_util.h"
#include "ui/base/ui_base_types.h" #include "ui/base/ui_base_types.h"
#include "ui/compositor/layer.h" #include "ui/compositor/layer.h"
@@ -318,8 +318,8 @@ void PineController::OnWindowActivated(ActivationReason reason,
aura::Window* gained_active, aura::Window* gained_active,
aura::Window* lost_active) { aura::Window* lost_active) {
if (gained_active && window_util::IsWindowUserPositionable(gained_active) && if (gained_active && window_util::IsWindowUserPositionable(gained_active) &&
static_cast<AppType>(gained_active->GetProperty( gained_active->GetProperty(chromeos::kAppTypeKey) !=
aura::client::kAppType)) != AppType::NON_APP) { chromeos::AppType::NON_APP) {
pine_contents_data_.reset(); pine_contents_data_.reset();
} }
} }

@@ -7,7 +7,6 @@
#include <cstdint> #include <cstdint>
#include "ash/app_list/app_list_controller_impl.h" #include "ash/app_list/app_list_controller_impl.h"
#include "ash/constants/app_types.h"
#include "ash/public/cpp/app_types_util.h" #include "ash/public/cpp/app_types_util.h"
#include "ash/public/cpp/shell_window_ids.h" #include "ash/public/cpp/shell_window_ids.h"
#include "ash/public/cpp/window_properties.h" #include "ash/public/cpp/window_properties.h"
@@ -30,6 +29,8 @@
#include "base/containers/contains.h" #include "base/containers/contains.h"
#include "base/functional/bind.h" #include "base/functional/bind.h"
#include "base/task/single_thread_task_runner.h" #include "base/task/single_thread_task_runner.h"
#include "chromeos/ui/base/app_types.h"
#include "chromeos/ui/base/window_properties.h"
#include "components/app_restore/full_restore_utils.h" #include "components/app_restore/full_restore_utils.h"
#include "components/app_restore/window_properties.h" #include "components/app_restore/window_properties.h"
#include "ui/aura/client/aura_constants.h" #include "ui/aura/client/aura_constants.h"
@@ -68,9 +69,10 @@ constexpr ShellWindowId kAppParentContainers[19] = {
// TODO(crbug.com/40163553): Checking app type is temporary solution until we // TODO(crbug.com/40163553): Checking app type is temporary solution until we
// can get windows which are allowed to window restore from the // can get windows which are allowed to window restore from the
// FullRestoreService. // FullRestoreService.
constexpr AppType kSupportedAppTypes[5] = { constexpr chromeos::AppType kSupportedAppTypes[5] = {
AppType::BROWSER, AppType::CHROME_APP, AppType::ARC_APP, chromeos::AppType::BROWSER, chromeos::AppType::CHROME_APP,
AppType::SYSTEM_APP, AppType::LACROS}; chromeos::AppType::ARC_APP, chromeos::AppType::SYSTEM_APP,
chromeos::AppType::LACROS};
// Delay for certain app types before activation is allowed. This is because // Delay for certain app types before activation is allowed. This is because
// some apps' client request activation after creation, which can break user // some apps' client request activation after creation, which can break user
@@ -173,12 +175,12 @@ bool WindowRestoreController::CanActivateRestoredWindow(
return false; return false;
// Ghost windows can be activated. // Ghost windows can be activated.
const AppType app_type = const chromeos::AppType app_type = window->GetProperty(chromeos::kAppTypeKey);
static_cast<AppType>(window->GetProperty(aura::client::kAppType));
const bool is_real_arc_window = const bool is_real_arc_window =
window->GetProperty(app_restore::kRealArcTaskWindow); window->GetProperty(app_restore::kRealArcTaskWindow);
if (app_type == AppType::ARC_APP && !is_real_arc_window) if (app_type == chromeos::AppType::ARC_APP && !is_real_arc_window) {
return true; return true;
}
auto* desk_container = window->parent(); auto* desk_container = window->parent();
if (!desk_container || !desks_util::IsDeskContainer(desk_container)) if (!desk_container || !desks_util::IsDeskContainer(desk_container))
@@ -511,9 +513,8 @@ void WindowRestoreController::SaveWindowImpl(
} }
// Only some app types can be saved. // Only some app types can be saved.
if (!base::Contains( if (!base::Contains(kSupportedAppTypes,
kSupportedAppTypes, window->GetProperty(chromeos::kAppTypeKey))) {
static_cast<AppType>(window->GetProperty(aura::client::kAppType)))) {
return; return;
} }
@@ -596,15 +597,14 @@ void WindowRestoreController::RestoreStateTypeAndClearLaunchedKey(
// showing. We cannot detect this, so we use a timeout to keep the window not // showing. We cannot detect this, so we use a timeout to keep the window not
// activatable for a while longer. Classic browser and lacros windows are // activatable for a while longer. Classic browser and lacros windows are
// expected to call `ShowInactive()` where the browser is created. // expected to call `ShowInactive()` where the browser is created.
const AppType app_type = const chromeos::AppType app_type = window->GetProperty(chromeos::kAppTypeKey);
static_cast<AppType>(window->GetProperty(aura::client::kAppType));
// Prevent apply activation delay on ARC ghost window. It should be only apply // Prevent apply activation delay on ARC ghost window. It should be only apply
// on real ARC window. Only ARC ghost window use this property. // on real ARC window. Only ARC ghost window use this property.
const bool is_real_arc_window = const bool is_real_arc_window =
window->GetProperty(app_restore::kRealArcTaskWindow); window->GetProperty(app_restore::kRealArcTaskWindow);
const base::TimeDelta delay = const base::TimeDelta delay =
app_type == AppType::CHROME_APP || app_type == chromeos::AppType::CHROME_APP ||
(app_type == AppType::ARC_APP && is_real_arc_window) (app_type == chromeos::AppType::ARC_APP && is_real_arc_window)
? kAllowActivationDelay ? kAllowActivationDelay
: base::TimeDelta(); : base::TimeDelta();
base::SingleThreadTaskRunner::GetCurrentDefault()->PostDelayedTask( base::SingleThreadTaskRunner::GetCurrentDefault()->PostDelayedTask(

@@ -6,7 +6,6 @@
#include "ash/accelerators/accelerator_controller_impl.h" #include "ash/accelerators/accelerator_controller_impl.h"
#include "ash/app_list/app_list_controller_impl.h" #include "ash/app_list/app_list_controller_impl.h"
#include "ash/constants/app_types.h"
#include "ash/screen_util.h" #include "ash/screen_util.h"
#include "ash/session/session_controller_impl.h" #include "ash/session/session_controller_impl.h"
#include "ash/shelf/hotseat_widget.h" #include "ash/shelf/hotseat_widget.h"
@@ -30,6 +29,8 @@
#include "base/memory/raw_ptr.h" #include "base/memory/raw_ptr.h"
#include "base/scoped_observation.h" #include "base/scoped_observation.h"
#include "base/test/scoped_feature_list.h" #include "base/test/scoped_feature_list.h"
#include "chromeos/ui/base/app_types.h"
#include "chromeos/ui/base/window_properties.h"
#include "components/account_id/account_id.h" #include "components/account_id/account_id.h"
#include "components/app_restore/app_restore_info.h" #include "components/app_restore/app_restore_info.h"
#include "components/app_restore/full_restore_utils.h" #include "components/app_restore/full_restore_utils.h"
@@ -145,7 +146,7 @@ class WindowRestoreControllerTest : public AshTestBase,
WindowTreeHostManager::GetPrimaryDisplayId(), WindowTreeHostManager::GetPrimaryDisplayId(),
/*desk_id=*/1); /*desk_id=*/1);
return CreateTestWindowRestoredWidgetFromRestoreId( return CreateTestWindowRestoredWidgetFromRestoreId(
restore_window_id, AppType::BROWSER, restore_window_id, chromeos::AppType::BROWSER,
/*is_taskless_arc_app=*/false); /*is_taskless_arc_app=*/false);
} }
@@ -154,7 +155,7 @@ class WindowRestoreControllerTest : public AshTestBase,
// matches `restore_window_id`. // matches `restore_window_id`.
views::Widget* CreateTestWindowRestoredWidgetFromRestoreId( views::Widget* CreateTestWindowRestoredWidgetFromRestoreId(
int32_t restore_window_id, int32_t restore_window_id,
AppType app_type, chromeos::AppType app_type,
bool is_taskless_arc_app) { bool is_taskless_arc_app) {
if (!fake_window_restore_file_.contains(restore_window_id)) if (!fake_window_restore_file_.contains(restore_window_id))
return nullptr; return nullptr;
@@ -187,7 +188,7 @@ class WindowRestoreControllerTest : public AshTestBase,
new int32_t(*info.activation_index)) new int32_t(*info.activation_index))
.SetWindowProperty(app_restore::kLaunchedFromAppRestoreKey, true) .SetWindowProperty(app_restore::kLaunchedFromAppRestoreKey, true)
.SetWindowProperty(app_restore::kRestoreWindowIdKey, restore_window_id) .SetWindowProperty(app_restore::kRestoreWindowIdKey, restore_window_id)
.SetWindowProperty(aura::client::kAppType, static_cast<int>(app_type)) .SetWindowProperty(chromeos::kAppTypeKey, app_type)
.SetWindowProperty(app_restore::kParentToHiddenContainerKey, .SetWindowProperty(app_restore::kParentToHiddenContainerKey,
is_taskless_arc_app); is_taskless_arc_app);
@@ -204,7 +205,7 @@ class WindowRestoreControllerTest : public AshTestBase,
views::Widget* CreateTestWindowRestoredWidgetFromRestoreId( views::Widget* CreateTestWindowRestoredWidgetFromRestoreId(
int32_t restore_window_id) { int32_t restore_window_id) {
return CreateTestWindowRestoredWidgetFromRestoreId( return CreateTestWindowRestoredWidgetFromRestoreId(
restore_window_id, AppType::BROWSER, restore_window_id, chromeos::AppType::BROWSER,
/*is_taskless_arc_app=*/false); /*is_taskless_arc_app=*/false);
} }
@@ -276,11 +277,11 @@ class WindowRestoreControllerTest : public AshTestBase,
// aura::EnvObserver: // aura::EnvObserver:
void OnWindowInitialized(aura::Window* window) override { void OnWindowInitialized(aura::Window* window) override {
std::vector<AppType> kSupportedAppTypes = { std::vector<chromeos::AppType> kSupportedAppTypes = {
AppType::BROWSER, AppType::CHROME_APP, AppType::ARC_APP}; chromeos::AppType::BROWSER, chromeos::AppType::CHROME_APP,
chromeos::AppType::ARC_APP};
if (!base::Contains(kSupportedAppTypes, if (!base::Contains(kSupportedAppTypes,
static_cast<AppType>( window->GetProperty(chromeos::kAppTypeKey))) {
window->GetProperty(aura::client::kAppType)))) {
return; return;
} }
@@ -322,8 +323,10 @@ class WindowRestoreControllerTest : public AshTestBase,
// Tests window save with setting on or off. // Tests window save with setting on or off.
TEST_F(WindowRestoreControllerTest, WindowSaveDisabled) { TEST_F(WindowRestoreControllerTest, WindowSaveDisabled) {
auto account_id = Shell::Get()->session_controller()->GetActiveAccountId(); auto account_id = Shell::Get()->session_controller()->GetActiveAccountId();
auto window1 = CreateAppWindow(gfx::Rect(600, 600), AppType::BROWSER); auto window1 =
auto window2 = CreateAppWindow(gfx::Rect(600, 600), AppType::BROWSER); CreateAppWindow(gfx::Rect(600, 600), chromeos::AppType::BROWSER);
auto window2 =
CreateAppWindow(gfx::Rect(600, 600), chromeos::AppType::BROWSER);
ResetSaveWindowsCount(); ResetSaveWindowsCount();
// Disable window restore. // Disable window restore.
@@ -350,7 +353,8 @@ TEST_F(WindowRestoreControllerTest, WindowSaveDisabled) {
// Tests that data gets saved when changing a window's window state. // Tests that data gets saved when changing a window's window state.
TEST_F(WindowRestoreControllerTest, WindowStateChanged) { TEST_F(WindowRestoreControllerTest, WindowStateChanged) {
auto window = CreateAppWindow(gfx::Rect(600, 600), AppType::BROWSER); auto window =
CreateAppWindow(gfx::Rect(600, 600), chromeos::AppType::BROWSER);
ResetSaveWindowsCount(); ResetSaveWindowsCount();
auto* window_state = WindowState::Get(window.get()); auto* window_state = WindowState::Get(window.get());
@@ -383,7 +387,8 @@ TEST_F(WindowRestoreControllerTest, WindowMovedDesks) {
ASSERT_EQ(0, desks_controller->GetDeskIndex( ASSERT_EQ(0, desks_controller->GetDeskIndex(
desks_controller->GetTargetActiveDesk())); desks_controller->GetTargetActiveDesk()));
auto window = CreateAppWindow(gfx::Rect(200, 200), AppType::BROWSER); auto window =
CreateAppWindow(gfx::Rect(200, 200), chromeos::AppType::BROWSER);
aura::Window* previous_parent = window->parent(); aura::Window* previous_parent = window->parent();
ResetSaveWindowsCount(); ResetSaveWindowsCount();
@@ -403,7 +408,8 @@ TEST_F(WindowRestoreControllerTest, AssignToAllDesks) {
ASSERT_EQ(0, desks_controller->GetDeskIndex( ASSERT_EQ(0, desks_controller->GetDeskIndex(
desks_controller->GetTargetActiveDesk())); desks_controller->GetTargetActiveDesk()));
auto window = CreateAppWindow(gfx::Rect(100, 100), AppType::BROWSER); auto window =
CreateAppWindow(gfx::Rect(100, 100), chromeos::AppType::BROWSER);
ResetSaveWindowsCount(); ResetSaveWindowsCount();
// Assign |window| to all desks. This should trigger a save. // Assign |window| to all desks. This should trigger a save.
@@ -436,7 +442,8 @@ TEST_F(WindowRestoreControllerTest, AssignToAllDesks) {
TEST_F(WindowRestoreControllerTest, WindowMovedDisplay) { TEST_F(WindowRestoreControllerTest, WindowMovedDisplay) {
UpdateDisplay("800x700,801+0-800x700"); UpdateDisplay("800x700,801+0-800x700");
auto window = CreateAppWindow(gfx::Rect(50, 50, 200, 200), AppType::BROWSER); auto window =
CreateAppWindow(gfx::Rect(50, 50, 200, 200), chromeos::AppType::BROWSER);
ResetSaveWindowsCount(); ResetSaveWindowsCount();
// Move the window to the next display. Test that we save the window in // Move the window to the next display. Test that we save the window in
@@ -450,7 +457,8 @@ TEST_F(WindowRestoreControllerTest, WindowMovedDisplay) {
// Tests that data gets saved when dragging a window. // Tests that data gets saved when dragging a window.
TEST_F(WindowRestoreControllerTest, WindowDragged) { TEST_F(WindowRestoreControllerTest, WindowDragged) {
auto window = CreateAppWindow(gfx::Rect(400, 400), AppType::BROWSER); auto window =
CreateAppWindow(gfx::Rect(400, 400), chromeos::AppType::BROWSER);
ResetSaveWindowsCount(); ResetSaveWindowsCount();
// Test that even if we move n times, we will only save to file once. // Test that even if we move n times, we will only save to file once.
@@ -474,8 +482,10 @@ TEST_F(WindowRestoreControllerTest, TabletModeChange) {
TabletModeControllerTestApi().LeaveTabletMode(); TabletModeControllerTestApi().LeaveTabletMode();
EXPECT_EQ(0, GetTotalSaveWindowsCount()); EXPECT_EQ(0, GetTotalSaveWindowsCount());
auto window1 = CreateAppWindow(gfx::Rect(400, 400), AppType::BROWSER); auto window1 =
auto window2 = CreateAppWindow(gfx::Rect(400, 400), AppType::BROWSER); CreateAppWindow(gfx::Rect(400, 400), chromeos::AppType::BROWSER);
auto window2 =
CreateAppWindow(gfx::Rect(400, 400), chromeos::AppType::BROWSER);
ResetSaveWindowsCount(); ResetSaveWindowsCount();
// Tests that we save each window when entering or exiting tablet mode. Due to // Tests that we save each window when entering or exiting tablet mode. Due to
@@ -495,7 +505,8 @@ TEST_F(WindowRestoreControllerTest, TabletModeChange) {
TEST_F(WindowRestoreControllerTest, DisplayAddRemove) { TEST_F(WindowRestoreControllerTest, DisplayAddRemove) {
UpdateDisplay("800x700, 800x700"); UpdateDisplay("800x700, 800x700");
auto window = CreateAppWindow(gfx::Rect(800, 0, 400, 400), AppType::BROWSER); auto window =
CreateAppWindow(gfx::Rect(800, 0, 400, 400), chromeos::AppType::BROWSER);
ResetSaveWindowsCount(); ResetSaveWindowsCount();
const int64_t primary_id = WindowTreeHostManager::GetPrimaryDisplayId(); const int64_t primary_id = WindowTreeHostManager::GetPrimaryDisplayId();
@@ -521,9 +532,12 @@ TEST_F(WindowRestoreControllerTest, DisplayAddRemove) {
} }
TEST_F(WindowRestoreControllerTest, Activation) { TEST_F(WindowRestoreControllerTest, Activation) {
auto window1 = CreateAppWindow(gfx::Rect(400, 400), AppType::BROWSER); auto window1 =
auto window2 = CreateAppWindow(gfx::Rect(400, 400), AppType::BROWSER); CreateAppWindow(gfx::Rect(400, 400), chromeos::AppType::BROWSER);
auto window3 = CreateAppWindow(gfx::Rect(400, 400), AppType::BROWSER); auto window2 =
CreateAppWindow(gfx::Rect(400, 400), chromeos::AppType::BROWSER);
auto window3 =
CreateAppWindow(gfx::Rect(400, 400), chromeos::AppType::BROWSER);
ResetSaveWindowsCount(); ResetSaveWindowsCount();
// Tests that an activation will save once for each window. // Tests that an activation will save once for each window.
@@ -745,7 +759,8 @@ TEST_F(WindowRestoreControllerTest, ClamshellFloatWindow) {
TEST_F(WindowRestoreControllerTest, TabletFloatWindow) { TEST_F(WindowRestoreControllerTest, TabletFloatWindow) {
TabletModeControllerTestApi().EnterTabletMode(); TabletModeControllerTestApi().EnterTabletMode();
auto floated_window = CreateAppWindow(gfx::Rect(600, 600), AppType::BROWSER); auto floated_window =
CreateAppWindow(gfx::Rect(600, 600), chromeos::AppType::BROWSER);
PressAndReleaseKey(ui::VKEY_F, ui::EF_ALT_DOWN | ui::EF_COMMAND_DOWN); PressAndReleaseKey(ui::VKEY_F, ui::EF_ALT_DOWN | ui::EF_COMMAND_DOWN);
ASSERT_TRUE(WindowState::Get(floated_window.get())->IsFloated()); ASSERT_TRUE(WindowState::Get(floated_window.get())->IsFloated());
@@ -839,8 +854,10 @@ TEST_F(WindowRestoreControllerTest, TabletSplitviewWindow) {
TabletModeControllerTestApi().EnterTabletMode(); TabletModeControllerTestApi().EnterTabletMode();
const gfx::Rect bounds(300, 300); const gfx::Rect bounds(300, 300);
auto window1 = CreateAppWindow(gfx::Rect(300, 300), AppType::BROWSER); auto window1 =
auto window2 = CreateAppWindow(gfx::Rect(300, 300), AppType::BROWSER); CreateAppWindow(gfx::Rect(300, 300), chromeos::AppType::BROWSER);
auto window2 =
CreateAppWindow(gfx::Rect(300, 300), chromeos::AppType::BROWSER);
auto* split_view_controller = auto* split_view_controller =
SplitViewController::Get(Shell::GetPrimaryRootWindow()); SplitViewController::Get(Shell::GetPrimaryRootWindow());
@@ -971,14 +988,13 @@ TEST_F(WindowRestoreControllerTest, TabletToClamshell) {
// show the window before we can make it resizable. // show the window before we can make it resizable.
const gfx::Rect expected_bounds(300, 300); const gfx::Rect expected_bounds(300, 300);
TestWidgetBuilder builder; TestWidgetBuilder builder;
views::Widget* widget = views::Widget* widget = builder.SetTestWidgetDelegate()
builder.SetTestWidgetDelegate() .SetBounds(expected_bounds)
.SetBounds(expected_bounds) .SetContext(Shell::GetPrimaryRootWindow())
.SetContext(Shell::GetPrimaryRootWindow()) .SetShow(false)
.SetShow(false) .SetWindowProperty(chromeos::kAppTypeKey,
.SetWindowProperty(aura::client::kAppType, chromeos::AppType::CHROME_APP)
static_cast<int>(AppType::CHROME_APP)) .BuildOwnedByNativeWidget();
.BuildOwnedByNativeWidget();
SetResizable(widget); SetResizable(widget);
widget->Show(); widget->Show();
@@ -1111,10 +1127,10 @@ TEST_F(WindowRestoreControllerTest, ArcAppWindowCreatedWithoutTask) {
// Restore the window, it should go to the invisible unparented container for // Restore the window, it should go to the invisible unparented container for
// now. // now.
auto* restored_window = auto* restored_window = CreateTestWindowRestoredWidgetFromRestoreId(
CreateTestWindowRestoredWidgetFromRestoreId(kRestoreId, AppType::ARC_APP, kRestoreId, chromeos::AppType::ARC_APP,
/*is_taskless_arc_app=*/true) /*is_taskless_arc_app=*/true)
->GetNativeWindow(); ->GetNativeWindow();
EXPECT_EQ( EXPECT_EQ(
Shell::GetContainer(root_window, kShellWindowId_UnparentedContainer), Shell::GetContainer(root_window, kShellWindowId_UnparentedContainer),
restored_window->parent()); restored_window->parent());
@@ -1159,10 +1175,10 @@ TEST_F(WindowRestoreControllerTest,
// Restore the first window, it should go to the invisible unparented // Restore the first window, it should go to the invisible unparented
// container for the secondary display until the ARC task is ready. // container for the secondary display until the ARC task is ready.
auto* restored_window1 = auto* restored_window1 = CreateTestWindowRestoredWidgetFromRestoreId(
CreateTestWindowRestoredWidgetFromRestoreId(kRestoreId1, AppType::ARC_APP, kRestoreId1, chromeos::AppType::ARC_APP,
/*is_taskless_arc_app=*/true) /*is_taskless_arc_app=*/true)
->GetNativeWindow(); ->GetNativeWindow();
EXPECT_EQ(Shell::GetContainer(secondary_root_window, EXPECT_EQ(Shell::GetContainer(secondary_root_window,
kShellWindowId_UnparentedContainer), kShellWindowId_UnparentedContainer),
restored_window1->parent()); restored_window1->parent());
@@ -1174,10 +1190,10 @@ TEST_F(WindowRestoreControllerTest,
// Restore the second window, it should also go to the invisible unparented // Restore the second window, it should also go to the invisible unparented
// container for the secondary display. // container for the secondary display.
auto* restored_window2 = auto* restored_window2 = CreateTestWindowRestoredWidgetFromRestoreId(
CreateTestWindowRestoredWidgetFromRestoreId(kRestoreId2, AppType::ARC_APP, kRestoreId2, chromeos::AppType::ARC_APP,
/*is_taskless_arc_app=*/true) /*is_taskless_arc_app=*/true)
->GetNativeWindow(); ->GetNativeWindow();
EXPECT_EQ(Shell::GetContainer(secondary_root_window, EXPECT_EQ(Shell::GetContainer(secondary_root_window,
kShellWindowId_UnparentedContainer), kShellWindowId_UnparentedContainer),
restored_window2->parent()); restored_window2->parent());
@@ -1249,7 +1265,8 @@ TEST_F(WindowRestoreControllerTest, TopmostWindowIsActivatable) {
// Create a window that is not restored and activate it. // Create a window that is not restored and activate it.
auto* desk_container = desks_util::GetActiveDeskContainerForRoot( auto* desk_container = desks_util::GetActiveDeskContainerForRoot(
Shell::Get()->GetPrimaryRootWindow()); Shell::Get()->GetPrimaryRootWindow());
auto window = CreateAppWindow(gfx::Rect(100, 100), AppType::BROWSER); auto window =
CreateAppWindow(gfx::Rect(100, 100), chromeos::AppType::BROWSER);
wm::ActivateWindow(window.get()); wm::ActivateWindow(window.get());
ASSERT_TRUE(wm::IsActiveWindow(window.get())); ASSERT_TRUE(wm::IsActiveWindow(window.get()));
@@ -1258,7 +1275,7 @@ TEST_F(WindowRestoreControllerTest, TopmostWindowIsActivatable) {
/*restore_id=*/2, gfx::Rect(200, 200), chromeos::WindowStateType::kNormal, /*restore_id=*/2, gfx::Rect(200, 200), chromeos::WindowStateType::kNormal,
/*activation_index=*/1, WindowTreeHostManager::GetPrimaryDisplayId()); /*activation_index=*/1, WindowTreeHostManager::GetPrimaryDisplayId());
auto* restored_window1 = CreateTestWindowRestoredWidgetFromRestoreId( auto* restored_window1 = CreateTestWindowRestoredWidgetFromRestoreId(
/*restore_id=*/2, AppType::CHROME_APP, /*restore_id=*/2, chromeos::AppType::CHROME_APP,
/*is_taskless_arc_app=*/false) /*is_taskless_arc_app=*/false)
->GetNativeWindow(); ->GetNativeWindow();
EXPECT_THAT(desk_container->children(), EXPECT_THAT(desk_container->children(),
@@ -1301,7 +1318,7 @@ TEST_F(WindowRestoreControllerTest, NextTopmostWindowIsActivatable) {
chromeos::WindowStateType::kMinimized, chromeos::WindowStateType::kMinimized,
/*activation_index=*/2, WindowTreeHostManager::GetPrimaryDisplayId()); /*activation_index=*/2, WindowTreeHostManager::GetPrimaryDisplayId());
auto* restored_window2 = CreateTestWindowRestoredWidgetFromRestoreId( auto* restored_window2 = CreateTestWindowRestoredWidgetFromRestoreId(
/*restore_id=*/2, AppType::BROWSER, /*restore_id=*/2, chromeos::AppType::BROWSER,
/*is_taskless_arc_app=*/false) /*is_taskless_arc_app=*/false)
->GetNativeWindow(); ->GetNativeWindow();
EXPECT_THAT(desk_container->children(), ElementsAre(restored_window2)); EXPECT_THAT(desk_container->children(), ElementsAre(restored_window2));
@@ -1315,7 +1332,7 @@ TEST_F(WindowRestoreControllerTest, NextTopmostWindowIsActivatable) {
chromeos::WindowStateType::kMinimized, chromeos::WindowStateType::kMinimized,
/*activation_index=*/3, WindowTreeHostManager::GetPrimaryDisplayId()); /*activation_index=*/3, WindowTreeHostManager::GetPrimaryDisplayId());
auto* restored_window3 = CreateTestWindowRestoredWidgetFromRestoreId( auto* restored_window3 = CreateTestWindowRestoredWidgetFromRestoreId(
/*restore_id=*/3, AppType::BROWSER, /*restore_id=*/3, chromeos::AppType::BROWSER,
/*is_taskless_arc_app=*/false) /*is_taskless_arc_app=*/false)
->GetNativeWindow(); ->GetNativeWindow();
EXPECT_THAT(desk_container->children(), EXPECT_THAT(desk_container->children(),
@@ -1331,7 +1348,7 @@ TEST_F(WindowRestoreControllerTest, NextTopmostWindowIsActivatable) {
/*restore_id=*/4, gfx::Rect(200, 200), chromeos::WindowStateType::kNormal, /*restore_id=*/4, gfx::Rect(200, 200), chromeos::WindowStateType::kNormal,
/*activation_index=*/4, WindowTreeHostManager::GetPrimaryDisplayId()); /*activation_index=*/4, WindowTreeHostManager::GetPrimaryDisplayId());
auto* restored_window4 = CreateTestWindowRestoredWidgetFromRestoreId( auto* restored_window4 = CreateTestWindowRestoredWidgetFromRestoreId(
/*restore_id=*/4, AppType::BROWSER, /*restore_id=*/4, chromeos::AppType::BROWSER,
/*is_taskless_arc_app=*/false) /*is_taskless_arc_app=*/false)
->GetNativeWindow(); ->GetNativeWindow();
EXPECT_THAT( EXPECT_THAT(
@@ -1364,7 +1381,7 @@ TEST_F(WindowRestoreControllerTest, WindowsOnInactiveDeskAreNotActivatable) {
/*activation_index=*/2, WindowTreeHostManager::GetPrimaryDisplayId(), /*activation_index=*/2, WindowTreeHostManager::GetPrimaryDisplayId(),
/*desk_id=*/2); /*desk_id=*/2);
auto* restored_window2 = CreateTestWindowRestoredWidgetFromRestoreId( auto* restored_window2 = CreateTestWindowRestoredWidgetFromRestoreId(
/*restore_id=*/2, AppType::BROWSER, /*restore_id=*/2, chromeos::AppType::BROWSER,
/*is_taskless_arc_app=*/false) /*is_taskless_arc_app=*/false)
->GetNativeWindow(); ->GetNativeWindow();
EXPECT_FALSE(wm::CanActivateWindow(restored_window2)); EXPECT_FALSE(wm::CanActivateWindow(restored_window2));
@@ -1374,8 +1391,9 @@ TEST_F(WindowRestoreControllerTest, WindowsOnInactiveDeskAreNotActivatable) {
// used. See https://crbug.com/1265750. // used. See https://crbug.com/1265750.
TEST_F(WindowRestoreControllerTest, WindowsSavedInOverview) { TEST_F(WindowRestoreControllerTest, WindowsSavedInOverview) {
const gfx::Rect window_bounds(300, 200); const gfx::Rect window_bounds(300, 200);
auto browser_window = CreateAppWindow(window_bounds, AppType::BROWSER); auto browser_window =
auto arc_window = CreateAppWindow(window_bounds, AppType::ARC_APP); CreateAppWindow(window_bounds, chromeos::AppType::BROWSER);
auto arc_window = CreateAppWindow(window_bounds, chromeos::AppType::ARC_APP);
ToggleOverview(); ToggleOverview();
EXPECT_NE(window_bounds, browser_window->GetBoundsInScreen()); EXPECT_NE(window_bounds, browser_window->GetBoundsInScreen());
@@ -1404,7 +1422,7 @@ TEST_F(WindowRestoreControllerTest, WindowsRestoredWhileInOverview) {
// Create a restored window. Test that we have exited overview. // Create a restored window. Test that we have exited overview.
CreateTestWindowRestoredWidgetFromRestoreId( CreateTestWindowRestoredWidgetFromRestoreId(
/*restore_id=*/1, AppType::BROWSER, /*restore_id=*/1, chromeos::AppType::BROWSER,
/*is_taskless_arc_app=*/false) /*is_taskless_arc_app=*/false)
->GetNativeWindow(); ->GetNativeWindow();
EXPECT_FALSE(OverviewController::Get()->InOverviewSession()); EXPECT_FALSE(OverviewController::Get()->InOverviewSession());
@@ -1422,7 +1440,7 @@ TEST_F(WindowRestoreControllerTest, WindowsMinimumVisibleArea) {
/*restore_id=*/1, gfx::Rect(900, 700, window_length, window_length), /*restore_id=*/1, gfx::Rect(900, 700, window_length, window_length),
chromeos::WindowStateType::kNormal); chromeos::WindowStateType::kNormal);
auto* restored_window = CreateTestWindowRestoredWidgetFromRestoreId( auto* restored_window = CreateTestWindowRestoredWidgetFromRestoreId(
/*restore_id=*/1, AppType::BROWSER, /*restore_id=*/1, chromeos::AppType::BROWSER,
/*is_taskless_arc_app=*/false) /*is_taskless_arc_app=*/false)
->GetNativeWindow(); ->GetNativeWindow();
const gfx::Rect& bounds_in_screen = restored_window->GetBoundsInScreen(); const gfx::Rect& bounds_in_screen = restored_window->GetBoundsInScreen();

@@ -6,7 +6,6 @@
#include <utility> #include <utility>
#include "ash/constants/app_types.h"
#include "ash/metrics/pip_uma.h" #include "ash/metrics/pip_uma.h"
#include "ash/public/cpp/accelerators.h" #include "ash/public/cpp/accelerators.h"
#include "ash/public/cpp/shelf_config.h" #include "ash/public/cpp/shelf_config.h"
@@ -33,6 +32,8 @@
#include "ash/wm/wm_metrics.h" #include "ash/wm/wm_metrics.h"
#include "base/test/metrics/histogram_tester.h" #include "base/test/metrics/histogram_tester.h"
#include "base/test/scoped_feature_list.h" #include "base/test/scoped_feature_list.h"
#include "chromeos/ui/base/app_types.h"
#include "chromeos/ui/base/window_properties.h"
#include "chromeos/ui/base/window_state_type.h" #include "chromeos/ui/base/window_state_type.h"
#include "chromeos/ui/frame/caption_buttons/snap_controller.h" #include "chromeos/ui/frame/caption_buttons/snap_controller.h"
#include "chromeos/ui/frame/multitask_menu/multitask_menu_metrics.h" #include "chromeos/ui/frame/multitask_menu/multitask_menu_metrics.h"
@@ -347,8 +348,7 @@ TEST_F(WindowStateTest, AndroidPipWindowUmaMetrics) {
base::HistogramTester histograms; base::HistogramTester histograms;
std::unique_ptr<aura::Window> window( std::unique_ptr<aura::Window> window(
CreateTestWindowInShellWithBounds(gfx::Rect(100, 100, 100, 100))); CreateTestWindowInShellWithBounds(gfx::Rect(100, 100, 100, 100)));
window->SetProperty(aura::client::kAppType, window->SetProperty(chromeos::kAppTypeKey, chromeos::AppType::ARC_APP);
static_cast<int>(ash::AppType::ARC_APP));
WindowState* window_state = WindowState::Get(window.get()); WindowState* window_state = WindowState::Get(window.get());
const WMEvent enter_pip(WM_EVENT_PIP); const WMEvent enter_pip(WM_EVENT_PIP);
@@ -398,8 +398,7 @@ TEST_F(WindowStateTest, AndroidPipWindowUmaMetricsCountsExitOnDestroy) {
base::HistogramTester histograms; base::HistogramTester histograms;
std::unique_ptr<aura::Window> window( std::unique_ptr<aura::Window> window(
CreateTestWindowInShellWithBounds(gfx::Rect(100, 100, 100, 100))); CreateTestWindowInShellWithBounds(gfx::Rect(100, 100, 100, 100)));
window->SetProperty(aura::client::kAppType, window->SetProperty(chromeos::kAppTypeKey, chromeos::AppType::ARC_APP);
static_cast<int>(ash::AppType::ARC_APP));
WindowState* window_state = WindowState::Get(window.get()); WindowState* window_state = WindowState::Get(window.get());
const WMEvent enter_pip(WM_EVENT_PIP); const WMEvent enter_pip(WM_EVENT_PIP);

@@ -7,7 +7,6 @@
#include <memory> #include <memory>
#include <tuple> #include <tuple>
#include "ash/constants/app_types.h"
#include "ash/constants/ash_features.h" #include "ash/constants/ash_features.h"
#include "ash/constants/ash_pref_names.h" #include "ash/constants/ash_pref_names.h"
#include "ash/multi_user/multi_user_window_manager_impl.h" #include "ash/multi_user/multi_user_window_manager_impl.h"
@@ -43,7 +42,9 @@
#include "base/memory/raw_ptr.h" #include "base/memory/raw_ptr.h"
#include "base/ranges/algorithm.h" #include "base/ranges/algorithm.h"
#include "chromeos/constants/chromeos_features.h" #include "chromeos/constants/chromeos_features.h"
#include "chromeos/ui/base/app_types.h"
#include "chromeos/ui/base/chromeos_ui_constants.h" #include "chromeos/ui/base/chromeos_ui_constants.h"
#include "chromeos/ui/base/window_properties.h"
#include "chromeos/ui/base/window_state_type.h" #include "chromeos/ui/base/window_state_type.h"
#include "chromeos/ui/frame/caption_buttons/snap_controller.h" #include "chromeos/ui/frame/caption_buttons/snap_controller.h"
#include "chromeos/ui/frame/interior_resize_handler_targeter.h" #include "chromeos/ui/frame/interior_resize_handler_targeter.h"
@@ -655,9 +656,9 @@ bool ShouldMinimizeTopWindowOnBack() {
// ARC and crostini apps will handle the back event that follows on the client // ARC and crostini apps will handle the back event that follows on the client
// side and will minimize/close the window there. // side and will minimize/close the window there.
const int app_type = window->GetProperty(aura::client::kAppType); const chromeos::AppType app_type = window->GetProperty(chromeos::kAppTypeKey);
if (app_type == static_cast<int>(AppType::ARC_APP) || if (app_type == chromeos::AppType::ARC_APP ||
app_type == static_cast<int>(AppType::CROSTINI_APP)) { app_type == chromeos::AppType::CROSTINI_APP) {
return false; return false;
} }

@@ -9,7 +9,6 @@
#include "ash/accessibility/accessibility_controller.h" #include "ash/accessibility/accessibility_controller.h"
#include "ash/accessibility/accessibility_delegate.h" #include "ash/accessibility/accessibility_delegate.h"
#include "ash/animation/animation_change_type.h" #include "ash/animation/animation_change_type.h"
#include "ash/constants/app_types.h"
#include "ash/public/cpp/shell_window_ids.h" #include "ash/public/cpp/shell_window_ids.h"
#include "ash/public/cpp/window_animation_types.h" #include "ash/public/cpp/window_animation_types.h"
#include "ash/screen_util.h" #include "ash/screen_util.h"

@@ -11,7 +11,6 @@
#include "ash/accessibility/accessibility_controller.h" #include "ash/accessibility/accessibility_controller.h"
#include "ash/accessibility/test_accessibility_controller_client.h" #include "ash/accessibility/test_accessibility_controller_client.h"
#include "ash/app_list/test/app_list_test_helper.h" #include "ash/app_list/test/app_list_test_helper.h"
#include "ash/constants/app_types.h"
#include "ash/frame/non_client_frame_view_ash.h" #include "ash/frame/non_client_frame_view_ash.h"
#include "ash/keyboard/ui/keyboard_ui.h" #include "ash/keyboard/ui/keyboard_ui.h"
#include "ash/keyboard/ui/keyboard_ui_controller.h" #include "ash/keyboard/ui/keyboard_ui_controller.h"

@@ -7,7 +7,6 @@
#include <cmath> #include <cmath>
#include <utility> #include <utility>
#include "ash/constants/app_types.h"
#include "ash/constants/ash_features.h" #include "ash/constants/ash_features.h"
#include "ash/metrics/pip_uma.h" #include "ash/metrics/pip_uma.h"
#include "ash/public/cpp/shell_window_ids.h" #include "ash/public/cpp/shell_window_ids.h"
@@ -39,10 +38,10 @@
#include "base/metrics/histogram_macros.h" #include "base/metrics/histogram_macros.h"
#include "base/metrics/user_metrics.h" #include "base/metrics/user_metrics.h"
#include "base/ranges/algorithm.h" #include "base/ranges/algorithm.h"
#include "chromeos/ui/base/app_types.h"
#include "chromeos/ui/base/window_properties.h" #include "chromeos/ui/base/window_properties.h"
#include "chromeos/ui/frame/caption_buttons/snap_controller.h" #include "chromeos/ui/frame/caption_buttons/snap_controller.h"
#include "chromeos/utils/haptics_util.h" #include "chromeos/utils/haptics_util.h"
#include "ui/aura/client/aura_constants.h"
#include "ui/aura/client/window_types.h" #include "ui/aura/client/window_types.h"
#include "ui/aura/window.h" #include "ui/aura/window.h"
#include "ui/aura/window_delegate.h" #include "ui/aura/window_delegate.h"
@@ -558,8 +557,8 @@ std::unique_ptr<WindowResizer> CreateWindowResizer(
// from the caption. This is because ARC does not currently handle setting // from the caption. This is because ARC does not currently handle setting
// bounds on a maximized window well. // bounds on a maximized window well.
if (maximized && if (maximized &&
window_state->window()->GetProperty(aura::client::kAppType) == window_state->window()->GetProperty(chromeos::kAppTypeKey) ==
static_cast<int>(AppType::ARC_APP) && chromeos::AppType::ARC_APP &&
window_component == HTCAPTION) { window_component == HTCAPTION) {
return nullptr; return nullptr;
} }

@@ -9,7 +9,6 @@
#include <utility> #include <utility>
#include <vector> #include <vector>
#include "ash/constants/app_types.h"
#include "ash/constants/ash_features.h" #include "ash/constants/ash_features.h"
#include "ash/test/ash_test_base.h" #include "ash/test/ash_test_base.h"
#include "ash/test/ash_test_helper.h" #include "ash/test/ash_test_helper.h"
@@ -53,6 +52,8 @@
#include "chromeos/dbus/power/fake_power_manager_client.h" #include "chromeos/dbus/power/fake_power_manager_client.h"
#include "chromeos/dbus/power_manager/idle.pb.h" #include "chromeos/dbus/power_manager/idle.pb.h"
#include "chromeos/dbus/power_manager/suspend.pb.h" #include "chromeos/dbus/power_manager/suspend.pb.h"
#include "chromeos/ui/base/app_types.h"
#include "chromeos/ui/base/window_properties.h"
#include "components/app_constants/constants.h" #include "components/app_constants/constants.h"
#include "components/metrics/structured/recorder.h" #include "components/metrics/structured/recorder.h"
#include "components/metrics/structured/structured_events.h" #include "components/metrics/structured/structured_events.h"
@@ -2728,8 +2729,7 @@ TEST_P(AppPlatformInputMetricsTest, LacrosWindowAndWebAppAndChromeApp) {
return; return;
} }
window()->SetProperty(aura::client::kAppType, window()->SetProperty(chromeos::kAppTypeKey, chromeos::AppType::LACROS);
static_cast<int>(ash::AppType::LACROS));
const base::UnguessableToken instance_id0 = base::UnguessableToken::Create(); const base::UnguessableToken instance_id0 = base::UnguessableToken::Create();
const base::UnguessableToken instance_id1 = base::UnguessableToken::Create(); const base::UnguessableToken instance_id1 = base::UnguessableToken::Create();

@@ -6,7 +6,6 @@
#include <string_view> #include <string_view>
#include "ash/constants/app_types.h"
#include "base/containers/fixed_flat_map.h" #include "base/containers/fixed_flat_map.h"
#include "base/metrics/histogram_functions.h" #include "base/metrics/histogram_functions.h"
#include "chrome/browser/apps/app_service/app_service_proxy.h" #include "chrome/browser/apps/app_service/app_service_proxy.h"
@@ -28,6 +27,8 @@
#include "chromeos/components/kiosk/kiosk_utils.h" #include "chromeos/components/kiosk/kiosk_utils.h"
#include "chromeos/components/mgs/managed_guest_session_utils.h" #include "chromeos/components/mgs/managed_guest_session_utils.h"
#include "chromeos/constants/chromeos_features.h" #include "chromeos/constants/chromeos_features.h"
#include "chromeos/ui/base/app_types.h"
#include "chromeos/ui/base/window_properties.h"
#include "components/app_constants/constants.h" #include "components/app_constants/constants.h"
#include "components/services/app_service/public/cpp/app_launch_util.h" #include "components/services/app_service/public/cpp/app_launch_util.h"
#include "components/services/app_service/public/cpp/app_registry_cache.h" #include "components/services/app_service/public/cpp/app_registry_cache.h"
@@ -265,8 +266,8 @@ bool IsLacrosBrowserWindow(Profile* profile, aura::Window* window) {
} }
bool IsLacrosWindow(aura::Window* window) { bool IsLacrosWindow(aura::Window* window) {
return window->GetProperty(aura::client::kAppType) == return window->GetProperty(chromeos::kAppTypeKey) ==
static_cast<int>(ash::AppType::LACROS); chromeos::AppType::LACROS;
} }
bool IsAppOpenedInTab(AppTypeName app_type_name, const std::string& app_id) { bool IsAppOpenedInTab(AppTypeName app_type_name, const std::string& app_id) {

@@ -4,7 +4,6 @@
#include "chrome/browser/ash/accessibility/accessibility_event_rewriter_delegate_impl.h" #include "chrome/browser/ash/accessibility/accessibility_event_rewriter_delegate_impl.h"
#include "ash/constants/app_types.h"
#include "ash/public/cpp/accessibility_controller_enums.h" #include "ash/public/cpp/accessibility_controller_enums.h"
#include "ash/public/cpp/event_rewriter_controller.h" #include "ash/public/cpp/event_rewriter_controller.h"
#include "chrome/browser/ash/accessibility/accessibility_manager.h" #include "chrome/browser/ash/accessibility/accessibility_manager.h"

@@ -13,7 +13,6 @@
#include "ash/components/arc/session/arc_service_manager.h" #include "ash/components/arc/session/arc_service_manager.h"
#include "ash/components/arc/test/arc_util_test_support.h" #include "ash/components/arc/test/arc_util_test_support.h"
#include "ash/components/arc/test/connection_holder_util.h" #include "ash/components/arc/test/connection_holder_util.h"
#include "ash/constants/app_types.h"
#include "ash/shell.h" #include "ash/shell.h"
#include "base/feature_list.h" #include "base/feature_list.h"
#include "base/metrics/histogram_base.h" #include "base/metrics/histogram_base.h"

@@ -11,7 +11,6 @@
#include "ash/components/arc/arc_util.h" #include "ash/components/arc/arc_util.h"
#include "ash/components/arc/session/arc_bridge_service.h" #include "ash/components/arc/session/arc_bridge_service.h"
#include "ash/constants/app_types.h"
#include "ash/public/cpp/app_types_util.h" #include "ash/public/cpp/app_types_util.h"
#include "ash/public/cpp/external_arc/message_center/arc_notification_content_view.h" #include "ash/public/cpp/external_arc/message_center/arc_notification_content_view.h"
#include "ash/public/cpp/external_arc/message_center/arc_notification_surface.h" #include "ash/public/cpp/external_arc/message_center/arc_notification_surface.h"

@@ -6,12 +6,13 @@
#include "ash/components/arc/arc_util.h" #include "ash/components/arc/arc_util.h"
#include "ash/components/arc/session/arc_bridge_service.h" #include "ash/components/arc/session/arc_bridge_service.h"
#include "ash/constants/app_types.h"
#include "ash/public/cpp/app_types_util.h" #include "ash/public/cpp/app_types_util.h"
#include "base/memory/raw_ptr.h" #include "base/memory/raw_ptr.h"
#include "chrome/browser/ash/arc/accessibility/accessibility_helper_instance_remote_proxy.h" #include "chrome/browser/ash/arc/accessibility/accessibility_helper_instance_remote_proxy.h"
#include "chrome/test/base/testing_profile.h" #include "chrome/test/base/testing_profile.h"
#include "chrome/test/views/chrome_views_test_base.h" #include "chrome/test/views/chrome_views_test_base.h"
#include "chromeos/ui/base/app_types.h"
#include "chromeos/ui/base/window_properties.h"
#include "components/exo/shell_surface_util.h" #include "components/exo/shell_surface_util.h"
#include "services/accessibility/android/android_accessibility_util.h" #include "services/accessibility/android/android_accessibility_util.h"
#include "services/accessibility/android/public/mojom/accessibility_helper.mojom.h" #include "services/accessibility/android/public/mojom/accessibility_helper.mojom.h"
@@ -63,10 +64,10 @@ class ArcAccessibilityTreeTrackerTest : public ChromeViewsTestBase {
} }
std::unique_ptr<aura::Window> CreateWindow( std::unique_ptr<aura::Window> CreateWindow(
ash::AppType app_type = ash::AppType::ARC_APP) { chromeos::AppType app_type = chromeos::AppType::ARC_APP) {
auto window = std::make_unique<aura::Window>(nullptr); auto window = std::make_unique<aura::Window>(nullptr);
window->Init(ui::LAYER_NOT_DRAWN); window->Init(ui::LAYER_NOT_DRAWN);
window->SetProperty(aura::client::kAppType, static_cast<int>(app_type)); window->SetProperty(chromeos::kAppTypeKey, app_type);
return window; return window;
} }
@@ -163,7 +164,7 @@ TEST_F(ArcAccessibilityTreeTrackerTest, WindowIdTaskIdMapping) {
exo::SetShellApplicationId(test_window.get(), "org.chromium.arc.1"); exo::SetShellApplicationId(test_window.get(), "org.chromium.arc.1");
std::unique_ptr<aura::Window> child_window1 = std::unique_ptr<aura::Window> child_window1 =
CreateWindow(ash::AppType::NON_APP); CreateWindow(chromeos::AppType::NON_APP);
exo::SetShellClientAccessibilityId(child_window1.get(), 10); exo::SetShellClientAccessibilityId(child_window1.get(), 10);
test_window->AddChild(child_window1.get()); test_window->AddChild(child_window1.get());
@@ -174,7 +175,7 @@ TEST_F(ArcAccessibilityTreeTrackerTest, WindowIdTaskIdMapping) {
// Add another child window with different id. (and call AddChild first.) // Add another child window with different id. (and call AddChild first.)
std::unique_ptr<aura::Window> child_window2 = std::unique_ptr<aura::Window> child_window2 =
CreateWindow(ash::AppType::NON_APP); CreateWindow(chromeos::AppType::NON_APP);
test_window->AddChild(child_window2.get()); test_window->AddChild(child_window2.get());
exo::SetShellClientAccessibilityId(child_window2.get(), 11); exo::SetShellClientAccessibilityId(child_window2.get(), 11);
@@ -205,7 +206,7 @@ TEST_F(ArcAccessibilityTreeTrackerTest, WindowIdTaskIdMapping) {
std::unique_ptr<aura::Window> another_window = CreateWindow(); std::unique_ptr<aura::Window> another_window = CreateWindow();
exo::SetShellApplicationId(another_window.get(), "org.chromium.arc.2"); exo::SetShellApplicationId(another_window.get(), "org.chromium.arc.2");
std::unique_ptr<aura::Window> another_child_window = std::unique_ptr<aura::Window> another_child_window =
CreateWindow(ash::AppType::NON_APP); CreateWindow(chromeos::AppType::NON_APP);
exo::SetShellClientAccessibilityId(another_child_window.get(), 20); exo::SetShellClientAccessibilityId(another_child_window.get(), 20);
another_window->AddChild(another_child_window.get()); another_window->AddChild(another_child_window.get());
@@ -226,7 +227,7 @@ TEST_F(ArcAccessibilityTreeTrackerTest, TrackArcGhostWindow) {
// Simulate a ghost window. Apply NON_APP type and session ID. // Simulate a ghost window. Apply NON_APP type and session ID.
std::unique_ptr<aura::Window> test_window = std::unique_ptr<aura::Window> test_window =
CreateWindow(ash::AppType::NON_APP); CreateWindow(chromeos::AppType::NON_APP);
exo::SetShellApplicationId(test_window.get(), "org.chromium.arc.session.1"); exo::SetShellApplicationId(test_window.get(), "org.chromium.arc.session.1");
tree_tracker.TrackWindow(test_window.get()); tree_tracker.TrackWindow(test_window.get());
@@ -244,11 +245,10 @@ TEST_F(ArcAccessibilityTreeTrackerTest, TrackArcGhostWindow) {
// A ghost window is replaced with an actual ARC window. // A ghost window is replaced with an actual ARC window.
exo::SetShellApplicationId(test_window.get(), "org.chromium.arc.1"); exo::SetShellApplicationId(test_window.get(), "org.chromium.arc.1");
test_window->SetProperty(aura::client::kAppType, test_window->SetProperty(chromeos::kAppTypeKey, chromeos::AppType::ARC_APP);
static_cast<int>(ash::AppType::ARC_APP));
std::unique_ptr<aura::Window> child_window = std::unique_ptr<aura::Window> child_window =
CreateWindow(ash::AppType::NON_APP); CreateWindow(chromeos::AppType::NON_APP);
exo::SetShellClientAccessibilityId(child_window.get(), 10); exo::SetShellClientAccessibilityId(child_window.get(), 10);
test_window->AddChild(child_window.get()); test_window->AddChild(child_window.get());
@@ -312,7 +312,7 @@ TEST_F(ArcAccessibilityTreeTrackerTest, ToggleTalkBack) {
ASSERT_TRUE(last_state.value()); ASSERT_TRUE(last_state.value());
std::unique_ptr<aura::Window> non_arc_window = std::unique_ptr<aura::Window> non_arc_window =
CreateWindow(ash::AppType::NON_APP); CreateWindow(chromeos::AppType::NON_APP);
// Switch to non-ARC window. // Switch to non-ARC window.
last_state.reset(); last_state.reset();

@@ -2,11 +2,12 @@
// 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.
#include "ash/constants/app_types.h"
#include "chrome/browser/ash/login/test/session_manager_state_waiter.h" #include "chrome/browser/ash/login/test/session_manager_state_waiter.h"
#include "chrome/test/base/chromeos/crosier/ash_integration_test.h" #include "chrome/test/base/chromeos/crosier/ash_integration_test.h"
#include "chrome/test/base/chromeos/crosier/chromeos_integration_arc_mixin.h" #include "chrome/test/base/chromeos/crosier/chromeos_integration_arc_mixin.h"
#include "chrome/test/base/chromeos/crosier/chromeos_integration_login_mixin.h" #include "chrome/test/base/chromeos/crosier/chromeos_integration_login_mixin.h"
#include "chromeos/ui/base/app_types.h"
#include "chromeos/ui/base/window_properties.h"
#include "ui/aura/client/aura_constants.h" #include "ui/aura/client/aura_constants.h"
#include "ui/aura/window.h" #include "ui/aura/window.h"
@@ -51,6 +52,6 @@ IN_PROC_BROWSER_TEST_F(ArcIntegrationTest, CreateWindow) {
arc_mixin().LaunchAndWaitForWindow(kPackage, kActivity); arc_mixin().LaunchAndWaitForWindow(kPackage, kActivity);
ASSERT_NE(window, nullptr); ASSERT_NE(window, nullptr);
int window_app_type = window->GetProperty(aura::client::kAppType); int window_app_type = window->GetProperty(chromeos::kAppTypeKey);
EXPECT_EQ(window_app_type, static_cast<int>(ash::AppType::ARC_APP)); EXPECT_EQ(window_app_type, chromeos::AppType::ARC_APP);
} }

@@ -10,7 +10,6 @@
#include <vector> #include <vector>
#include "ash/components/arc/session/arc_service_manager.h" #include "ash/components/arc/session/arc_service_manager.h"
#include "ash/constants/app_types.h"
#include "ash/constants/ash_pref_names.h" #include "ash/constants/ash_pref_names.h"
#include "ash/public/cpp/keyboard/arc/arc_input_method_bounds_tracker.h" #include "ash/public/cpp/keyboard/arc/arc_input_method_bounds_tracker.h"
#include "ash/public/cpp/keyboard/keyboard_switches.h" #include "ash/public/cpp/keyboard/keyboard_switches.h"
@@ -27,6 +26,8 @@
#include "chrome/browser/ui/ash/keyboard/chrome_keyboard_controller_client_test_helper.h" #include "chrome/browser/ui/ash/keyboard/chrome_keyboard_controller_client_test_helper.h"
#include "chrome/common/pref_names.h" #include "chrome/common/pref_names.h"
#include "chrome/test/base/testing_profile.h" #include "chrome/test/base/testing_profile.h"
#include "chromeos/ui/base/app_types.h"
#include "chromeos/ui/base/window_properties.h"
#include "components/crx_file/id_util.h" #include "components/crx_file/id_util.h"
#include "components/prefs/pref_service.h" #include "components/prefs/pref_service.h"
#include "content/public/test/browser_task_environment.h" #include "content/public/test/browser_task_environment.h"
@@ -272,8 +273,7 @@ class ArcInputMethodManagerServiceTest : public testing::Test {
aura::Window* CreateTestArcWindow() { aura::Window* CreateTestArcWindow() {
auto* window = aura::test::CreateTestWindowWithId(1, nullptr); auto* window = aura::test::CreateTestWindowWithId(1, nullptr);
window->SetProperty(aura::client::kSkipImeProcessing, true); window->SetProperty(aura::client::kSkipImeProcessing, true);
window->SetProperty(aura::client::kAppType, window->SetProperty(chromeos::kAppTypeKey, chromeos::AppType::ARC_APP);
static_cast<int>(ash::AppType::ARC_APP));
return window; return window;
} }

@@ -192,7 +192,7 @@ void ArcInputOverlayManager::EnsureFactoryBuilt() {
} }
void ArcInputOverlayManager::OnWindowInitialized(aura::Window* new_window) { void ArcInputOverlayManager::OnWindowInitialized(aura::Window* new_window) {
// `aura::client::kAppType` property is set in // `chromeos::kAppTypeKey` property is set in
// `AppServiceAppWindowShelfController::OnWindowInitialized()`. // `AppServiceAppWindowShelfController::OnWindowInitialized()`.
// `AppServiceAppWindowShelfController::OnWindowInitialized()` is called // `AppServiceAppWindowShelfController::OnWindowInitialized()` is called
// before `ArcInputOverlayManager::OnWindowInitialized()`, so we can filter // before `ArcInputOverlayManager::OnWindowInitialized()`, so we can filter

@@ -3,7 +3,7 @@
// found in the LICENSE file. // found in the LICENSE file.
#include "chrome/browser/ash/arc/input_overlay/test/arc_test_window.h" #include "chrome/browser/ash/arc/input_overlay/test/arc_test_window.h"
#include "ash/constants/app_types.h"
#include "ash/public/cpp/window_properties.h" #include "ash/public/cpp/window_properties.h"
#include "components/exo/test/shell_surface_builder.h" #include "components/exo/test/shell_surface_builder.h"
#include "ui/aura/client/aura_constants.h" #include "ui/aura/client/aura_constants.h"

@@ -5,13 +5,14 @@
#include "chrome/browser/ash/arc/input_overlay/test/test_utils.h" #include "chrome/browser/ash/arc/input_overlay/test/test_utils.h"
#include "ash/components/arc/test/fake_app_instance.h" #include "ash/components/arc/test/fake_app_instance.h"
#include "ash/constants/app_types.h"
#include "ash/public/cpp/window_properties.h" #include "ash/public/cpp/window_properties.h"
#include "base/test/task_environment.h" #include "base/test/task_environment.h"
#include "chrome/browser/ash/app_list/arc/arc_app_test.h" #include "chrome/browser/ash/app_list/arc/arc_app_test.h"
#include "chrome/browser/ash/arc/input_overlay/actions/action.h" #include "chrome/browser/ash/arc/input_overlay/actions/action.h"
#include "chrome/browser/ash/arc/input_overlay/touch_injector.h" #include "chrome/browser/ash/arc/input_overlay/touch_injector.h"
#include "chromeos/strings/grit/chromeos_strings.h" #include "chromeos/strings/grit/chromeos_strings.h"
#include "chromeos/ui/base/app_types.h"
#include "chromeos/ui/base/window_properties.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
#include "ui/aura/client/aura_constants.h" #include "ui/aura/client/aura_constants.h"
#include "ui/aura/window.h" #include "ui/aura/window.h"
@@ -29,12 +30,12 @@ std::unique_ptr<views::Widget> CreateArcWindow(
params.bounds = bounds; params.bounds = bounds;
params.context = root_window; params.context = root_window;
params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
// `aura::client::kAppType` property should be assigned before widget init. // `chromeos::kAppTypeKey` property should be assigned before widget init.
// It simulates the situation that // It simulates the situation that
// `AppServiceAppWindowShelfController::OnWindowInitialized()` is called // `AppServiceAppWindowShelfController::OnWindowInitialized()` is called
// before `ArcInputOverlayManager::OnWindowInitialized()`; // before `ArcInputOverlayManager::OnWindowInitialized()`;
params.init_properties_container.SetProperty( params.init_properties_container.SetProperty(chromeos::kAppTypeKey,
aura::client::kAppType, static_cast<int>(ash::AppType::ARC_APP)); chromeos::AppType::ARC_APP);
auto widget = std::make_unique<views::Widget>(); auto widget = std::make_unique<views::Widget>();
widget->Init(std::move(params)); widget->Init(std::move(params));
widget->widget_delegate()->SetCanResize(true); widget->widget_delegate()->SetCanResize(true);

@@ -6,7 +6,6 @@
#include <optional> #include <optional>
#include "ash/constants/app_types.h"
#include "ash/constants/ash_features.h" #include "ash/constants/ash_features.h"
#include "ash/public/cpp/window_properties.h" #include "ash/public/cpp/window_properties.h"
#include "base/json/json_reader.h" #include "base/json/json_reader.h"

@@ -4,9 +4,10 @@
#include "chrome/browser/ash/arc/instance_throttle/arc_active_window_throttle_observer.h" #include "chrome/browser/ash/arc/instance_throttle/arc_active_window_throttle_observer.h"
#include "ash/constants/app_types.h"
#include "base/functional/bind.h" #include "base/functional/bind.h"
#include "base/test/task_environment.h" #include "base/test/task_environment.h"
#include "chromeos/ui/base/app_types.h"
#include "chromeos/ui/base/window_properties.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
#include "ui/aura/client/aura_constants.h" #include "ui/aura/client/aura_constants.h"
#include "ui/aura/test/test_window_delegate.h" #include "ui/aura/test/test_window_delegate.h"
@@ -44,10 +45,8 @@ TEST_F(ArcActiveWindowThrottleObserverTest, TestOnWindowActivated) {
std::unique_ptr<aura::Window> chrome_window( std::unique_ptr<aura::Window> chrome_window(
aura::test::CreateTestWindowWithDelegate(&dummy_delegate, 2, gfx::Rect(), aura::test::CreateTestWindowWithDelegate(&dummy_delegate, 2, gfx::Rect(),
nullptr)); nullptr));
arc_window->SetProperty(aura::client::kAppType, arc_window->SetProperty(chromeos::kAppTypeKey, chromeos::AppType::ARC_APP);
static_cast<int>(ash::AppType::ARC_APP)); chrome_window->SetProperty(chromeos::kAppTypeKey, chromeos::AppType::BROWSER);
chrome_window->SetProperty(aura::client::kAppType,
static_cast<int>(ash::AppType::BROWSER));
EXPECT_FALSE(window_observer()->active()); EXPECT_FALSE(window_observer()->active());

@@ -6,11 +6,12 @@
#include <map> #include <map>
#include "ash/constants/app_types.h"
#include "ash/public/cpp/shell_window_ids.h" #include "ash/public/cpp/shell_window_ids.h"
#include "ash/public/cpp/window_properties.h" #include "ash/public/cpp/window_properties.h"
#include "base/test/task_environment.h" #include "base/test/task_environment.h"
#include "chrome/test/base/testing_profile.h" #include "chrome/test/base/testing_profile.h"
#include "chromeos/ui/base/app_types.h"
#include "chromeos/ui/base/window_properties.h"
#include "components/exo/wm_helper.h" #include "components/exo/wm_helper.h"
#include "content/public/test/browser_task_environment.h" #include "content/public/test/browser_task_environment.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
@@ -65,10 +66,9 @@ class ArcPipWindowThrottleObserverTest : public testing::Test {
&dummy_delegate_, 1, gfx::Rect(), nullptr)); &dummy_delegate_, 1, gfx::Rect(), nullptr));
chrome_window_.reset(aura::test::CreateTestWindowWithDelegate( chrome_window_.reset(aura::test::CreateTestWindowWithDelegate(
&dummy_delegate_, 2, gfx::Rect(), nullptr)); &dummy_delegate_, 2, gfx::Rect(), nullptr));
arc_window_->SetProperty(aura::client::kAppType, arc_window_->SetProperty(chromeos::kAppTypeKey, chromeos::AppType::ARC_APP);
static_cast<int>(ash::AppType::ARC_APP)); chrome_window_->SetProperty(chromeos::kAppTypeKey,
chrome_window_->SetProperty(aura::client::kAppType, chromeos::AppType::BROWSER);
static_cast<int>(ash::AppType::BROWSER));
} }
void TearDown() override { wm_helper_.reset(); } void TearDown() override { wm_helper_.reset(); }

@@ -10,7 +10,6 @@
#include "ash/components/arc/mojom/nearby_share.mojom.h" #include "ash/components/arc/mojom/nearby_share.mojom.h"
#include "ash/components/arc/session/arc_service_manager.h" #include "ash/components/arc/session/arc_service_manager.h"
#include "ash/components/arc/test/arc_util_test_support.h" #include "ash/components/arc/test/arc_util_test_support.h"
#include "ash/constants/app_types.h"
#include "ash/public/cpp/shelf_model.h" #include "ash/public/cpp/shelf_model.h"
#include "base/command_line.h" #include "base/command_line.h"
#include "base/containers/flat_map.h" #include "base/containers/flat_map.h"
@@ -24,6 +23,8 @@
#include "chrome/browser/nearby_sharing/nearby_sharing_service_factory.h" #include "chrome/browser/nearby_sharing/nearby_sharing_service_factory.h"
#include "chrome/browser/ui/ash/shelf/chrome_shelf_controller.h" #include "chrome/browser/ui/ash/shelf/chrome_shelf_controller.h"
#include "chrome/test/base/testing_profile.h" #include "chrome/test/base/testing_profile.h"
#include "chromeos/ui/base/app_types.h"
#include "chromeos/ui/base/window_properties.h"
#include "components/exo/shell_surface_util.h" #include "components/exo/shell_surface_util.h"
#include "content/public/test/browser_task_environment.h" #include "content/public/test/browser_task_environment.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
@@ -59,8 +60,7 @@ class NearbyShareSessionImplTest : public testing::Test {
base::WrapUnique(aura::test::CreateTestWindowWithId(kTaskId, nullptr)); base::WrapUnique(aura::test::CreateTestWindowWithId(kTaskId, nullptr));
exo::SetShellApplicationId( exo::SetShellApplicationId(
window_.get(), "org.chromium.arc." + base::NumberToString(kTaskId)); window_.get(), "org.chromium.arc." + base::NumberToString(kTaskId));
window_->SetProperty(aura::client::kAppType, window_->SetProperty(chromeos::kAppTypeKey, chromeos::AppType::ARC_APP);
static_cast<int>(ash::AppType::ARC_APP));
session_->OnWindowVisibilityChanged(window_.get(), /*visible=*/true); session_->OnWindowVisibilityChanged(window_.get(), /*visible=*/true);
} }

@@ -3,19 +3,19 @@
// found in the LICENSE file. // found in the LICENSE file.
#include "chrome/browser/ash/arc/util/arc_window_watcher.h" #include "chrome/browser/ash/arc/util/arc_window_watcher.h"
#include "base/memory/raw_ptr.h"
#include "ash/constants/app_types.h"
#include "ash/public/cpp/app_types_util.h"
#include "ash/public/cpp/window_properties.h"
#include "chrome/browser/ash/crosapi/browser_util.h"
#include "chrome/browser/ui/browser_finder.h"
#include "ui/aura/client/aura_constants.h"
#include "ui/aura/window.h"
#include "ui/views/widget/widget.h"
#include <algorithm> #include <algorithm>
#include "ash/public/cpp/app_types_util.h"
#include "ash/public/cpp/window_properties.h"
#include "base/memory/raw_ptr.h"
#include "chrome/browser/ash/crosapi/browser_util.h"
#include "chrome/browser/ui/browser_finder.h"
#include "chromeos/ui/base/app_types.h"
#include "chromeos/ui/base/window_properties.h"
#include "ui/aura/window.h"
#include "ui/views/widget/widget.h"
namespace ash { namespace ash {
namespace { namespace {
@@ -89,7 +89,7 @@ class Tracker : public aura::WindowObserver {
return; return;
} }
if (key == aura::client::kAppType) { if (key == chromeos::kAppTypeKey) {
// Maybe it just became an ARC window. // Maybe it just became an ARC window.
MaybeTagArcWindow(); MaybeTagArcWindow();
} }

@@ -6,7 +6,6 @@
#include <utility> #include <utility>
#include "ash/constants/app_types.h"
#include "ash/constants/ash_features.h" #include "ash/constants/ash_features.h"
#include "ash/constants/notifier_catalogs.h" #include "ash/constants/notifier_catalogs.h"
#include "ash/public/cpp/keyboard/keyboard_controller.h" #include "ash/public/cpp/keyboard/keyboard_controller.h"
@@ -16,8 +15,9 @@
#include "base/strings/utf_string_conversions.h" #include "base/strings/utf_string_conversions.h"
#include "chrome/browser/ash/accessibility/magnification_manager.h" #include "chrome/browser/ash/accessibility/magnification_manager.h"
#include "chrome/grit/generated_resources.h" #include "chrome/grit/generated_resources.h"
#include "chromeos/ui/base/app_types.h"
#include "chromeos/ui/base/window_properties.h"
#include "components/exo/wm_helper.h" #include "components/exo/wm_helper.h"
#include "ui/aura/client/aura_constants.h"
#include "ui/base/ime/ash/input_method_util.h" #include "ui/base/ime/ash/input_method_util.h"
#include "ui/base/l10n/l10n_util.h" #include "ui/base/l10n/l10n_util.h"
#include "ui/display/screen.h" #include "ui/display/screen.h"
@@ -127,8 +127,8 @@ bool CrostiniUnsupportedActionNotifier::Delegate::IsFocusedWindowCrostini() {
} }
auto* focused_window = exo::WMHelper::GetInstance()->GetFocusedWindow(); auto* focused_window = exo::WMHelper::GetInstance()->GetFocusedWindow();
return focused_window && return focused_window &&
(focused_window->GetProperty(aura::client::kAppType) == (focused_window->GetProperty(chromeos::kAppTypeKey) ==
static_cast<int>(ash::AppType::CROSTINI_APP)); chromeos::AppType::CROSTINI_APP);
} }
bool CrostiniUnsupportedActionNotifier::Delegate::IsVirtualKeyboardVisible() { bool CrostiniUnsupportedActionNotifier::Delegate::IsVirtualKeyboardVisible() {

@@ -6,7 +6,6 @@
#include <utility> #include <utility>
#include "ash/constants/app_types.h"
#include "ash/constants/ash_features.h" #include "ash/constants/ash_features.h"
#include "base/feature_list.h" #include "base/feature_list.h"
#include "base/files/file_path.h" #include "base/files/file_path.h"
@@ -41,6 +40,8 @@
#include "chrome/browser/ui/webui/ash/crostini_upgrader/crostini_upgrader_dialog.h" #include "chrome/browser/ui/webui/ash/crostini_upgrader/crostini_upgrader_dialog.h"
#include "chrome/common/chrome_features.h" #include "chrome/common/chrome_features.h"
#include "chrome/grit/generated_resources.h" #include "chrome/grit/generated_resources.h"
#include "chromeos/ui/base/app_types.h"
#include "chromeos/ui/base/window_properties.h"
#include "components/prefs/pref_service.h" #include "components/prefs/pref_service.h"
#include "components/user_manager/user.h" #include "components/user_manager/user.h"
#include "ui/aura/client/aura_constants.h" #include "ui/aura/client/aura_constants.h"
@@ -456,8 +457,8 @@ bool IsCrostiniWindow(const aura::Window* window) {
// more productionised they get their own app type (e.g. lacros), but at some // more productionised they get their own app type (e.g. lacros), but at some
// point we'll want to untangle these different types to e.g. avoid double // point we'll want to untangle these different types to e.g. avoid double
// counting in usage metrics. // counting in usage metrics.
return window->GetProperty(aura::client::kAppType) == return window->GetProperty(chromeos::kAppTypeKey) ==
static_cast<int>(ash::AppType::CROSTINI_APP); chromeos::AppType::CROSTINI_APP;
} }
void RecordAppLaunchHistogram(CrostiniAppLaunchAppType app_type) { void RecordAppLaunchHistogram(CrostiniAppLaunchAppType app_type) {

@@ -4,10 +4,10 @@
#include "chrome/browser/ash/crostini/throttle/crostini_active_window_throttle_observer.h" #include "chrome/browser/ash/crostini/throttle/crostini_active_window_throttle_observer.h"
#include "ash/constants/app_types.h"
#include "ash/public/cpp/window_properties.h" #include "ash/public/cpp/window_properties.h"
#include "chrome/browser/ash/guest_os/guest_os_terminal.h" #include "chrome/browser/ash/guest_os/guest_os_terminal.h"
#include "ui/aura/client/aura_constants.h" #include "chromeos/ui/base/app_types.h"
#include "chromeos/ui/base/window_properties.h"
#include "ui/aura/window.h" #include "ui/aura/window.h"
namespace crostini { namespace crostini {
@@ -24,14 +24,14 @@ bool CrostiniActiveWindowThrottleObserver::ProcessWindowActivation(
} }
// Return true if the gained_active window is a Crostini app. // Return true if the gained_active window is a Crostini app.
if (gained_active->GetProperty(aura::client::kAppType) == if (gained_active->GetProperty(chromeos::kAppTypeKey) ==
static_cast<int>(ash::AppType::CROSTINI_APP)) { chromeos::AppType::CROSTINI_APP) {
return true; return true;
} }
// Return false if the window is not a Chrome app (e.g. the browser, ARC app.) // Return false if the window is not a Chrome app (e.g. the browser, ARC app.)
if (gained_active->GetProperty(aura::client::kAppType) != if (gained_active->GetProperty(chromeos::kAppTypeKey) !=
static_cast<int>(ash::AppType::CHROME_APP)) { chromeos::AppType::CHROME_APP) {
return false; return false;
} }

@@ -4,10 +4,11 @@
#include "chrome/browser/ash/crostini/throttle/crostini_active_window_throttle_observer.h" #include "chrome/browser/ash/crostini/throttle/crostini_active_window_throttle_observer.h"
#include "ash/constants/app_types.h"
#include "ash/public/cpp/window_properties.h" #include "ash/public/cpp/window_properties.h"
#include "base/test/task_environment.h" #include "base/test/task_environment.h"
#include "chrome/browser/ash/guest_os/guest_os_terminal.h" #include "chrome/browser/ash/guest_os/guest_os_terminal.h"
#include "chromeos/ui/base/app_types.h"
#include "chromeos/ui/base/window_properties.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
#include "ui/aura/client/aura_constants.h" #include "ui/aura/client/aura_constants.h"
#include "ui/aura/test/test_window_delegate.h" #include "ui/aura/test/test_window_delegate.h"
@@ -49,16 +50,15 @@ TEST_F(CrostiniActiveWindowThrottleObserverTest, TestOnWindowActivated) {
std::unique_ptr<aura::Window> chrome_app_window( std::unique_ptr<aura::Window> chrome_app_window(
aura::test::CreateTestWindowWithDelegate(&dummy_delegate, 4, gfx::Rect(), aura::test::CreateTestWindowWithDelegate(&dummy_delegate, 4, gfx::Rect(),
nullptr)); nullptr));
crostini_window->SetProperty(aura::client::kAppType, crostini_window->SetProperty(chromeos::kAppTypeKey,
static_cast<int>(ash::AppType::CROSTINI_APP)); chromeos::AppType::CROSTINI_APP);
chrome_window->SetProperty(aura::client::kAppType, chrome_window->SetProperty(chromeos::kAppTypeKey, chromeos::AppType::BROWSER);
static_cast<int>(ash::AppType::BROWSER)); terminal_window->SetProperty(chromeos::kAppTypeKey,
terminal_window->SetProperty(aura::client::kAppType, chromeos::AppType::CHROME_APP);
static_cast<int>(ash::AppType::CHROME_APP));
terminal_window->SetProperty<std::string>(ash::kAppIDKey, terminal_window->SetProperty<std::string>(ash::kAppIDKey,
guest_os::kTerminalSystemAppId); guest_os::kTerminalSystemAppId);
chrome_app_window->SetProperty(aura::client::kAppType, chrome_app_window->SetProperty(chromeos::kAppTypeKey,
static_cast<int>(ash::AppType::CHROME_APP)); chromeos::AppType::CHROME_APP);
chrome_app_window->SetProperty<std::string>(ash::kAppIDKey, chrome_app_window->SetProperty<std::string>(ash::kAppIDKey,
"this_is_another_chrome_app"); "this_is_another_chrome_app");

@@ -4,7 +4,6 @@
#include "chrome/browser/ash/exo/chrome_data_exchange_delegate.h" #include "chrome/browser/ash/exo/chrome_data_exchange_delegate.h"
#include "ash/constants/app_types.h"
#include "ash/public/cpp/app_types_util.h" #include "ash/public/cpp/app_types_util.h"
#include "base/memory/raw_ptr.h" #include "base/memory/raw_ptr.h"
#include "base/pickle.h" #include "base/pickle.h"
@@ -14,6 +13,8 @@
#include "chrome/browser/ash/file_manager/path_util.h" #include "chrome/browser/ash/file_manager/path_util.h"
#include "chrome/browser/ash/plugin_vm/plugin_vm_util.h" #include "chrome/browser/ash/plugin_vm/plugin_vm_util.h"
#include "chrome/test/base/testing_profile.h" #include "chrome/test/base/testing_profile.h"
#include "chromeos/ui/base/app_types.h"
#include "chromeos/ui/base/window_properties.h"
#include "components/exo/shell_surface_util.h" #include "components/exo/shell_surface_util.h"
#include "content/public/common/drop_data.h" #include "content/public/common/drop_data.h"
#include "content/public/test/browser_task_environment.h" #include "content/public/test/browser_task_environment.h"
@@ -81,8 +82,7 @@ TEST_F(ChromeDataExchangeDelegateTest, GetDataTransferEndpointType) {
// delegate and app type set, but use the child window in tests. Arc: // delegate and app type set, but use the child window in tests. Arc:
aura::Window* arc_toplevel = aura::test::CreateTestWindowWithDelegate( aura::Window* arc_toplevel = aura::test::CreateTestWindowWithDelegate(
&delegate_, 0, gfx::Rect(), &container_window); &delegate_, 0, gfx::Rect(), &container_window);
arc_toplevel->SetProperty(aura::client::kAppType, arc_toplevel->SetProperty(chromeos::kAppTypeKey, chromeos::AppType::ARC_APP);
static_cast<int>(AppType::ARC_APP));
ASSERT_TRUE(IsArcWindow(arc_toplevel)); ASSERT_TRUE(IsArcWindow(arc_toplevel));
aura::Window* arc_window = aura::Window* arc_window =
aura::test::CreateTestWindowWithBounds(gfx::Rect(), arc_toplevel); aura::test::CreateTestWindowWithBounds(gfx::Rect(), arc_toplevel);
@@ -91,8 +91,8 @@ TEST_F(ChromeDataExchangeDelegateTest, GetDataTransferEndpointType) {
// Crostini: // Crostini:
aura::Window* crostini_toplevel = aura::test::CreateTestWindowWithDelegate( aura::Window* crostini_toplevel = aura::test::CreateTestWindowWithDelegate(
&delegate_, 0, gfx::Rect(), &container_window); &delegate_, 0, gfx::Rect(), &container_window);
crostini_toplevel->SetProperty(aura::client::kAppType, crostini_toplevel->SetProperty(chromeos::kAppTypeKey,
static_cast<int>(AppType::CROSTINI_APP)); chromeos::AppType::CROSTINI_APP);
ASSERT_TRUE(crostini::IsCrostiniWindow(crostini_toplevel)); ASSERT_TRUE(crostini::IsCrostiniWindow(crostini_toplevel));
aura::Window* crostini_window = aura::Window* crostini_window =
aura::test::CreateTestWindowWithBounds(gfx::Rect(), crostini_toplevel); aura::test::CreateTestWindowWithBounds(gfx::Rect(), crostini_toplevel);

@@ -7,7 +7,6 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include "ash/constants/app_types.h"
#include "base/memory/ref_counted_memory.h" #include "base/memory/ref_counted_memory.h"
#include "base/memory/scoped_refptr.h" #include "base/memory/scoped_refptr.h"
#include "base/strings/utf_string_conversions.h" #include "base/strings/utf_string_conversions.h"
@@ -27,6 +26,8 @@
#include "chromeos/ash/components/dbus/concierge/concierge_client.h" #include "chromeos/ash/components/dbus/concierge/concierge_client.h"
#include "chromeos/ash/components/dbus/seneschal/fake_seneschal_client.h" #include "chromeos/ash/components/dbus/seneschal/fake_seneschal_client.h"
#include "chromeos/ash/components/dbus/seneschal/seneschal_client.h" #include "chromeos/ash/components/dbus/seneschal/seneschal_client.h"
#include "chromeos/ui/base/app_types.h"
#include "chromeos/ui/base/window_properties.h"
#include "content/public/test/browser_task_environment.h" #include "content/public/test/browser_task_environment.h"
#include "storage/browser/file_system/external_mount_points.h" #include "storage/browser/file_system/external_mount_points.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
@@ -141,22 +142,21 @@ TEST_F(ChromeSecurityDelegateTest, CanLockPointer) {
std::unique_ptr<aura::Window> arc_toplevel( std::unique_ptr<aura::Window> arc_toplevel(
aura::test::CreateTestWindowWithDelegate(&delegate, 0, gfx::Rect(), aura::test::CreateTestWindowWithDelegate(&delegate, 0, gfx::Rect(),
&container_window)); &container_window));
arc_toplevel->SetProperty(aura::client::kAppType, arc_toplevel->SetProperty(chromeos::kAppTypeKey, chromeos::AppType::ARC_APP);
static_cast<int>(AppType::ARC_APP));
EXPECT_TRUE(security_delegate->CanLockPointer(arc_toplevel.get())); EXPECT_TRUE(security_delegate->CanLockPointer(arc_toplevel.get()));
std::unique_ptr<aura::Window> lacros_toplevel( std::unique_ptr<aura::Window> lacros_toplevel(
aura::test::CreateTestWindowWithDelegate(&delegate, 0, gfx::Rect(), aura::test::CreateTestWindowWithDelegate(&delegate, 0, gfx::Rect(),
&container_window)); &container_window));
lacros_toplevel->SetProperty(aura::client::kAppType, lacros_toplevel->SetProperty(chromeos::kAppTypeKey,
static_cast<int>(AppType::LACROS)); chromeos::AppType::LACROS);
EXPECT_TRUE(security_delegate->CanLockPointer(lacros_toplevel.get())); EXPECT_TRUE(security_delegate->CanLockPointer(lacros_toplevel.get()));
std::unique_ptr<aura::Window> crostini_toplevel( std::unique_ptr<aura::Window> crostini_toplevel(
aura::test::CreateTestWindowWithDelegate(&delegate, 0, gfx::Rect(), aura::test::CreateTestWindowWithDelegate(&delegate, 0, gfx::Rect(),
&container_window)); &container_window));
crostini_toplevel->SetProperty(aura::client::kAppType, crostini_toplevel->SetProperty(chromeos::kAppTypeKey,
static_cast<int>(AppType::CROSTINI_APP)); chromeos::AppType::CROSTINI_APP);
EXPECT_FALSE(security_delegate->CanLockPointer(crostini_toplevel.get())); EXPECT_FALSE(security_delegate->CanLockPointer(crostini_toplevel.get()));
} }

@@ -22,7 +22,6 @@
#include "ash/components/arc/session/arc_bridge_service.h" #include "ash/components/arc/session/arc_bridge_service.h"
#include "ash/components/arc/session/arc_service_manager.h" #include "ash/components/arc/session/arc_service_manager.h"
#include "ash/components/arc/system_ui/arc_system_ui_bridge.h" #include "ash/components/arc/system_ui/arc_system_ui_bridge.h"
#include "ash/constants/app_types.h"
#include "ash/constants/ash_features.h" #include "ash/constants/ash_features.h"
#include "ash/constants/ash_pref_names.h" #include "ash/constants/ash_pref_names.h"
#include "ash/constants/ash_switches.h" #include "ash/constants/ash_switches.h"
@@ -176,6 +175,7 @@
#include "chromeos/constants/chromeos_features.h" #include "chromeos/constants/chromeos_features.h"
#include "chromeos/printing/printer_configuration.h" #include "chromeos/printing/printer_configuration.h"
#include "chromeos/services/machine_learning/public/cpp/service_connection.h" #include "chromeos/services/machine_learning/public/cpp/service_connection.h"
#include "chromeos/ui/base/app_types.h"
#include "chromeos/ui/base/window_properties.h" #include "chromeos/ui/base/window_properties.h"
#include "chromeos/ui/frame/caption_buttons/caption_button_model.h" #include "chromeos/ui/frame/caption_buttons/caption_button_model.h"
#include "chromeos/ui/frame/default_frame_header.h" #include "chromeos/ui/frame/default_frame_header.h"
@@ -456,21 +456,21 @@ api::autotest_private::AppInstallSource GetAppInstallSource(
return api::autotest_private::AppInstallSource::kNone; return api::autotest_private::AppInstallSource::kNone;
} }
api::autotest_private::AppWindowType GetAppWindowType(ash::AppType type) { api::autotest_private::AppWindowType GetAppWindowType(chromeos::AppType type) {
switch (type) { switch (type) {
case ash::AppType::ARC_APP: case chromeos::AppType::ARC_APP:
return api::autotest_private::AppWindowType::kArcApp; return api::autotest_private::AppWindowType::kArcApp;
case ash::AppType::SYSTEM_APP: case chromeos::AppType::SYSTEM_APP:
return api::autotest_private::AppWindowType::kSystemApp; return api::autotest_private::AppWindowType::kSystemApp;
case ash::AppType::CROSTINI_APP: case chromeos::AppType::CROSTINI_APP:
return api::autotest_private::AppWindowType::kCrostiniApp; return api::autotest_private::AppWindowType::kCrostiniApp;
case ash::AppType::CHROME_APP: case chromeos::AppType::CHROME_APP:
return api::autotest_private::AppWindowType::kExtensionApp; return api::autotest_private::AppWindowType::kExtensionApp;
case ash::AppType::BROWSER: case chromeos::AppType::BROWSER:
return api::autotest_private::AppWindowType::kBrowser; return api::autotest_private::AppWindowType::kBrowser;
case ash::AppType::LACROS: case chromeos::AppType::LACROS:
return api::autotest_private::AppWindowType::kLacros; return api::autotest_private::AppWindowType::kLacros;
case ash::AppType::NON_APP: case chromeos::AppType::NON_APP:
return api::autotest_private::AppWindowType::kNone; return api::autotest_private::AppWindowType::kNone;
// TODO(oshima): Investigate if we want to have "extension" type. // TODO(oshima): Investigate if we want to have "extension" type.
} }
@@ -4566,8 +4566,8 @@ AutotestPrivateGetAppWindowListFunction::Run() {
api::autotest_private::AppWindowInfo window_info; api::autotest_private::AppWindowInfo window_info;
window_info.id = window->GetId(); window_info.id = window->GetId();
window_info.name = window->GetName(); window_info.name = window->GetName();
window_info.window_type = GetAppWindowType( window_info.window_type =
static_cast<ash::AppType>(window->GetProperty(aura::client::kAppType))); GetAppWindowType(window->GetProperty(chromeos::kAppTypeKey));
window_info.state_type = window_info.state_type =
ToWindowStateType(window->GetProperty(chromeos::kWindowStateTypeKey)); ToWindowStateType(window->GetProperty(chromeos::kWindowStateTypeKey));
window_info.bounds_in_root = window_info.bounds_in_root =
@@ -4603,8 +4603,8 @@ AutotestPrivateGetAppWindowListFunction::Run() {
} }
} }
if (window->GetProperty(aura::client::kAppType) == if (window->GetProperty(chromeos::kAppTypeKey) ==
static_cast<int>(ash::AppType::ARC_APP)) { chromeos::AppType::ARC_APP) {
std::string* package_name = window->GetProperty(ash::kArcPackageNameKey); std::string* package_name = window->GetProperty(ash::kArcPackageNameKey);
if (package_name) { if (package_name) {
window_info.arc_package_name = *package_name; window_info.arc_package_name = *package_name;

@@ -4,7 +4,6 @@
#include "chrome/browser/ash/input_method/assistive_input_denylist.h" #include "chrome/browser/ash/input_method/assistive_input_denylist.h"
#include "ash/constants/app_types.h"
#include "chrome/browser/ash/input_method/field_trial.h" #include "chrome/browser/ash/input_method/field_trial.h"
#include "testing/gmock/include/gmock/gmock.h" #include "testing/gmock/include/gmock/gmock.h"

Some files were not shown because too many files have changed in this diff Show More