Skip to content

Commit

Permalink
chromeos: removes usage of ui/aura/mus from a number of places
Browse files Browse the repository at this point in the history
With mash/window-service going away none of this code is used anymore.

BUG=958245
TEST=covered by tests

Change-Id: Iadafa0685571986c04c38aa9f6fea8c21bd6b2f7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1612332
Reviewed-by: Jun Mukai <mukai@chromium.org>
Commit-Queue: Scott Violet <sky@chromium.org>
Cr-Commit-Position: refs/heads/master@{#660007}
  • Loading branch information
Scott Violet authored and Commit Bot committed May 15, 2019
1 parent f782451 commit 12d34fa
Show file tree
Hide file tree
Showing 25 changed files with 53 additions and 656 deletions.
17 changes: 0 additions & 17 deletions ash/display/screen_ash.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,8 @@
#include "base/logging.h"
#include "ui/aura/client/screen_position_client.h"
#include "ui/aura/env.h"
#include "ui/aura/mus/window_tree_host_mus.h"
#include "ui/aura/window.h"
#include "ui/aura/window_event_dispatcher.h"
#include "ui/base/ui_base_features.h"
#include "ui/display/display.h"
#include "ui/display/display_finder.h"
#include "ui/display/manager/display_manager.h"
Expand Down Expand Up @@ -124,21 +122,6 @@ display::Display ScreenAsh::GetDisplayNearestWindow(
if (!window)
return GetPrimaryDisplay();

if (::features::IsSingleProcessMash()) {
// In IsSingleProcessMash() ScreenAsh is also called from non-ash code.
// Non-ash code creates aura Windows that are not parented to Ash's root
// Windows. Check for this first.
aura::WindowTreeHostMus* window_tree_host_mus =
aura::WindowTreeHostMus::ForWindow(window);
if (window_tree_host_mus) {
// WindowTreeHostMus::GetDisplay() can return an invalid display (i.e.
// with ID == |kInvalidDisplayID|) if that display is being removed. Use
// the primary display instead.
const auto display = window_tree_host_mus->GetDisplay();
return display.is_valid() ? display : GetPrimaryDisplay();
}
}

const aura::Window* root_window = window->GetRootWindow();
if (!root_window)
return GetPrimaryDisplay();
Expand Down
1 change: 0 additions & 1 deletion ash/frame/header_view.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
#include "ash/wm/tablet_mode/tablet_mode_controller.h"
#include "ash/wm/window_state.h"
#include "ui/aura/client/aura_constants.h"
#include "ui/aura/mus/window_tree_host_mus.h"
#include "ui/aura/window.h"
#include "ui/base/ui_base_features.h"
#include "ui/views/controls/image_view.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,43 +6,10 @@

#include "ash/public/cpp/immersive/immersive_fullscreen_controller.h"
#include "ash/public/cpp/immersive/immersive_fullscreen_controller_delegate.h"
#include "base/run_loop.h"
#include "ui/aura/env.h"
#include "ui/aura/event_injector.h"
#include "ui/aura/window.h"
#include "ui/events/base_event_utils.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/views/widget/widget.h"

namespace {

// Update mouse location for |window|. For local window, update its aura::Env
// directly. For remote window, update aura::Env by injecting a mouse move
// event. EventInjector is used so that the Window Service side code under mash
// sees the updated mouse location as well.
void UpdateMouseLocation(aura::Window* window,
const gfx::Point& screen_location,
bool wait) {
if (window->env()->mode() == aura::Env::Mode::LOCAL) {
window->env()->SetLastMouseLocation(screen_location);
return;
}

ui::MouseEvent event(ui::ET_MOUSE_MOVED, screen_location, screen_location,
ui::EventTimeForNow(), ui::EF_NONE, 0);
if (!wait) {
aura::EventInjector().Inject(window->GetHost(), &event);
return;
}

// Ensure the mouse event goes through when |wait| is set.
aura::EventInjector event_injector;
base::RunLoop run_loop;
event_injector.Inject(window->GetHost(), &event, run_loop.QuitClosure());
run_loop.Run();
}

} // namespace

namespace ash {

Expand All @@ -53,8 +20,7 @@ ImmersiveFullscreenControllerTestApi::ImmersiveFullscreenControllerTestApi(
ImmersiveFullscreenControllerTestApi::~ImmersiveFullscreenControllerTestApi() =
default;

void ImmersiveFullscreenControllerTestApi::SetupForTest(
bool wait_for_mouse_event) {
void ImmersiveFullscreenControllerTestApi::SetupForTest() {
immersive_fullscreen_controller_->animations_disabled_for_test_ = true;

// Move the mouse off of the top-of-window views so that it does not keep the
Expand All @@ -68,9 +34,7 @@ void ImmersiveFullscreenControllerTestApi::SetupForTest(
bottommost_in_screen = bounds_in_screen[i].bottom();
}
gfx::Point cursor_pos(0, bottommost_in_screen + 10);
UpdateMouseLocation(
immersive_fullscreen_controller_->widget()->GetNativeView(), cursor_pos,
wait_for_mouse_event);
aura::Env::GetInstance()->SetLastMouseLocation(cursor_pos);
immersive_fullscreen_controller_->UpdateLocatedEventRevealedLock();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,8 @@ class ImmersiveFullscreenControllerTestApi {
};

// Disables animations and moves the mouse so that it is not over the
// top-of-window views for the sake of testing. |wait_for_mouse_move| should
// normally be true to wait for the generated mouse events to go through under
// mash. It is provided for tests that call SetupForTest under the scope of
// TestMockTimeTaskRunner::ScopedContext that does not allow RunLoop::Run().
void SetupForTest(bool wait_for_mouse_event = true);
// top-of-window views for the sake of testing.
void SetupForTest();

bool IsTopEdgeHoverTimerRunning() const;

Expand Down
126 changes: 0 additions & 126 deletions ash/public/cpp/window_properties.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,7 @@
#include "ash/public/cpp/window_state_type.h"
#include "ash/public/interfaces/window_pin_type.mojom.h"
#include "ash/public/interfaces/window_properties.mojom.h"
#include "base/bind.h"
#include "base/unguessable_token.h"
#include "services/ws/public/mojom/window_manager.mojom.h"
#include "ui/accessibility/platform/aura_window_properties.h"
#include "ui/aura/client/aura_constants.h"
#include "ui/aura/mus/property_converter.h"
#include "ui/aura/window.h"
#include "ui/gfx/color_palette.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/image/image_skia.h"
#include "ui/wm/core/window_properties.h"

DEFINE_EXPORTED_UI_CLASS_PROPERTY_TYPE(ASH_PUBLIC_EXPORT,
Expand All @@ -29,123 +20,6 @@ DEFINE_EXPORTED_UI_CLASS_PROPERTY_TYPE(ASH_PUBLIC_EXPORT,
ash::BackdropWindowMode)

namespace ash {
namespace {

bool IsValidWindowVisibilityAnimationTransition(int64_t value) {
return value == wm::ANIMATE_SHOW || value == wm::ANIMATE_HIDE ||
value == wm::ANIMATE_BOTH || value == wm::ANIMATE_NONE;
}

bool IsValidWindowPinType(int64_t value) {
return value == static_cast<int64_t>(mojom::WindowPinType::NONE) ||
value == static_cast<int64_t>(mojom::WindowPinType::PINNED) ||
value == static_cast<int64_t>(mojom::WindowPinType::TRUSTED_PINNED);
}

} // namespace

void RegisterWindowProperties(aura::PropertyConverter* property_converter) {
property_converter->RegisterStringProperty(
kArcPackageNameKey, ws::mojom::WindowManager::kArcPackageName_Property);
property_converter->RegisterPrimitiveProperty(
aura::client::kAppType, mojom::kAppType_Property,
aura::PropertyConverter::CreateAcceptAnyValueCallback());
property_converter->RegisterPrimitiveProperty(
kBlockedForAssistantSnapshotKey,
mojom::kBlockedForAssistantSnapshot_Property,
aura::PropertyConverter::CreateAcceptAnyValueCallback());
property_converter->RegisterPrimitiveProperty(
kCanAttachToAnotherWindowKey, mojom::kCanAttachToAnotherWindow_Property,
aura::PropertyConverter::CreateAcceptAnyValueCallback());
property_converter->RegisterPrimitiveProperty(
kCanConsumeSystemKeysKey, mojom::kCanConsumeSystemKeys_Property,
aura::PropertyConverter::CreateAcceptAnyValueCallback());
property_converter->RegisterStringProperty(
ui::kChildAXTreeID, ws::mojom::WindowManager::kChildAXTreeID_Property);
property_converter->RegisterPrimitiveProperty(
kFrameActiveColorKey,
ws::mojom::WindowManager::kFrameActiveColor_Property,
aura::PropertyConverter::CreateAcceptAnyValueCallback());
property_converter->RegisterPrimitiveProperty(
kFrameInactiveColorKey,
ws::mojom::WindowManager::kFrameInactiveColor_Property,
aura::PropertyConverter::CreateAcceptAnyValueCallback());
property_converter->RegisterPrimitiveProperty(
kHideInOverviewKey, mojom::kHideInOverview_Property,
aura::PropertyConverter::CreateAcceptAnyValueCallback());
property_converter->RegisterPrimitiveProperty(
kHideShelfWhenFullscreenKey, mojom::kHideShelfWhenFullscreen_Property,
aura::PropertyConverter::CreateAcceptAnyValueCallback());
property_converter->RegisterPrimitiveProperty(
kImmersiveImpliedByFullscreen,
mojom::kImmersiveImpliedByFullscreen_Property,
aura::PropertyConverter::CreateAcceptAnyValueCallback());
property_converter->RegisterPrimitiveProperty(
kImmersiveIsActive, mojom::kImmersiveIsActive_Property,
aura::PropertyConverter::CreateAcceptAnyValueCallback());
property_converter->RegisterRectProperty(
kImmersiveTopContainerBoundsInScreen,
mojom::kImmersiveTopContainerBoundsInScreen_Property);
property_converter->RegisterPrimitiveProperty(
kIsDeferredTabDraggingTargetWindowKey,
mojom::kIsDeferredTabDraggingTargetWindow_Property,
aura::PropertyConverter::CreateAcceptAnyValueCallback());
property_converter->RegisterPrimitiveProperty(
kIsDraggingTabsKey, mojom::kIsDraggingTabs_Property,
aura::PropertyConverter::CreateAcceptAnyValueCallback());
property_converter->RegisterPrimitiveProperty(
kIsShowingInOverviewKey, mojom::kIsShowingInOverview_Property,
aura::PropertyConverter::CreateAcceptAnyValueCallback());
property_converter->RegisterPrimitiveProperty(
kRenderTitleAreaProperty,
ws::mojom::WindowManager::kRenderParentTitleArea_Property,
aura::PropertyConverter::CreateAcceptAnyValueCallback());
property_converter->RegisterPrimitiveProperty(
kShelfItemTypeKey, ws::mojom::WindowManager::kShelfItemType_Property,
base::BindRepeating(&IsValidShelfItemType));
property_converter->RegisterPrimitiveProperty(
aura::client::kTopViewInset, mojom::kTopViewInset_Property,
aura::PropertyConverter::CreateAcceptAnyValueCallback());
property_converter->RegisterPrimitiveProperty(
kWindowPinTypeKey, mojom::kWindowPinType_Property,
base::BindRepeating(&IsValidWindowPinType));
property_converter->RegisterPrimitiveProperty(
kWindowPositionManagedTypeKey, mojom::kWindowPositionManaged_Property,
aura::PropertyConverter::CreateAcceptAnyValueCallback());
property_converter->RegisterStringProperty(
kShelfIDKey, ws::mojom::WindowManager::kShelfID_Property);
property_converter->RegisterRectProperty(
kRestoreBoundsOverrideKey, mojom::kRestoreBoundsOverride_Property);
property_converter->RegisterPrimitiveProperty(
kRestoreWindowStateTypeOverrideKey,
mojom::kRestoreWindowStateTypeOverride_Property,
base::BindRepeating(&IsValidWindowStateType));
property_converter->RegisterPrimitiveProperty(
aura::client::kTitleShownKey,
ws::mojom::WindowManager::kWindowTitleShown_Property,
aura::PropertyConverter::CreateAcceptAnyValueCallback());
property_converter->RegisterWindowPtrProperty(
kTabDraggingSourceWindowKey, mojom::kTabDraggingSourceWindow_Property);
property_converter->RegisterPrimitiveProperty(
kWindowPipTypeKey, mojom::kIsWindowPip_Property,
aura::PropertyConverter::CreateAcceptAnyValueCallback());
property_converter->RegisterTimeDeltaProperty(
wm::kWindowVisibilityAnimationDurationKey,
ws::mojom::WindowManager::kWindowVisibilityAnimationDuration_Property);
property_converter->RegisterPrimitiveProperty(
wm::kWindowVisibilityAnimationTransitionKey,
ws::mojom::WindowManager::kWindowVisibilityAnimationTransition_Property,
base::BindRepeating(&IsValidWindowVisibilityAnimationTransition));
property_converter->RegisterPrimitiveProperty(
wm::kWindowVisibilityAnimationTypeKey,
ws::mojom::WindowManager::kWindowVisibilityAnimationType_Property,
aura::PropertyConverter::CreateAcceptAnyValueCallback());
property_converter->RegisterPrimitiveProperty(
wm::kWindowVisibilityAnimationVerticalPositionKey,
ws::mojom::WindowManager::
kWindowVisibilityAnimationVerticalPosition_Property,
aura::PropertyConverter::CreateAcceptAnyValueCallback());
}

DEFINE_OWNED_UI_CLASS_PROPERTY_KEY(std::string, kArcPackageNameKey, nullptr)
DEFINE_UI_CLASS_PROPERTY_KEY(BackdropWindowMode,
Expand Down
6 changes: 0 additions & 6 deletions ash/public/cpp/window_properties.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
#include "ui/base/class_property.h"

namespace aura {
class PropertyConverter;
class Window;
template <typename T>
using WindowProperty = ui::ClassProperty<T>;
Expand All @@ -37,11 +36,6 @@ enum class BackdropWindowMode {
kAuto, // The window manager decides if the window should have a backdrop.
};

// Registers Ash's properties with the given PropertyConverter. This allows Ash
// and other services (eg. Chrome) to exchange Ash window property values.
ASH_PUBLIC_EXPORT void RegisterWindowProperties(
aura::PropertyConverter* property_converter);

// Shell-specific window property keys for use by ash and its clients.

// Alphabetical sort.
Expand Down
1 change: 0 additions & 1 deletion ash/wm/collision_detection/collision_detection_utils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
#include "ash/shell.h"
#include "ash/wm/work_area_insets.h"
#include "base/macros.h"
#include "ui/aura/mus/property_converter.h"
#include "ui/base/class_property.h"
#include "ui/wm/core/coordinate_conversion.h"

Expand Down
2 changes: 0 additions & 2 deletions chrome/browser/ui/ash/chrome_browser_main_extra_parts_ash.cc
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,6 @@
#include "services/network/public/cpp/shared_url_loader_factory.h"
#include "services/service_manager/public/cpp/connector.h"
#include "services/ws/public/mojom/user_activity_monitor.mojom.h"
#include "ui/aura/mus/property_converter.h"
#include "ui/aura/mus/window_tree_client.h"
#include "ui/base/ime/chromeos/input_method_manager.h"
#include "ui/base/ui_base_features.h"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,6 @@
#include "ui/accessibility/ax_node_data.h"
#include "ui/aura/client/aura_constants.h"
#include "ui/aura/env.h"
#include "ui/aura/mus/window_mus.h"
#include "ui/aura/mus/window_tree_client.h"
#include "ui/aura/window.h"
#include "ui/base/hit_test.h"
#include "ui/base/layout.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,6 @@
#include "services/ws/public/cpp/property_type_converters.h"
#include "services/ws/public/mojom/window_manager.mojom.h"
#include "ui/aura/client/aura_constants.h"
#include "ui/aura/mus/mus_types.h"
#include "ui/aura/mus/property_converter.h"
#include "ui/aura/mus/window_port_mus.h"
#include "ui/aura/mus/window_tree_host_mus.h"
#include "ui/aura/window.h"
#include "ui/aura/window_targeter.h"
#include "ui/compositor/layer.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class ImmersiveModeControllerAshHostedAppBrowserTest
// which triggers an animation.
ash::ImmersiveFullscreenControllerTestApi(
static_cast<ImmersiveModeControllerAsh*>(controller_)->controller())
.SetupForTest(/*wait_for_mouse_event=*/wait);
.SetupForTest();

browser_->window()->Show();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@
#include "services/service_manager/public/cpp/connector.h"
#include "ui/aura/client/cursor_client.h"
#include "ui/aura/client/screen_position_client.h"
#include "ui/aura/mus/window_mus.h"
#include "ui/aura/test/mus/change_completion_waiter.h"
#include "ui/aura/window_event_dispatcher.h"
#include "ui/base/ui_base_features.h"
Expand Down
Loading

0 comments on commit 12d34fa

Please sign in to comment.