Skip to content

Commit

Permalink
[mus+ash] Removes WmWindow from ash (app_list, frame, metrics, etc.)
Browse files Browse the repository at this point in the history
Removes WmWindow from ash (app_list, frame, metrics, session, shared,
system, ash/test, wallpaper, ash/wm/maximize_mode, c/b/ui/ash)

With this CL the last places where WmWindow / wm_window.h are used are:
  ash/aura/shell_port_classic.*
  ash/mus/bridge/shell_port_mash.*
  ash/root_window_controller.*
  ash/shell.cc
  ash/shell_port.*
  ash/wm_transient_window_observer.h
  ash/wm_window.*

BUG=687656
TEST=None (refactoring)
TBR=reveman@chromium.org (for trivial changes to components/exo files)

Review-Url: https://codereview.chromium.org/2908333003
Cr-Commit-Position: refs/heads/master@{#475972}
  • Loading branch information
varkha authored and Commit Bot committed May 31, 2017
1 parent 2046b09 commit c8621dd
Show file tree
Hide file tree
Showing 76 changed files with 140 additions and 182 deletions.
1 change: 0 additions & 1 deletion ash/accelerators/accelerator_controller_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
#include "ash/wm/window_state.h"
#include "ash/wm/window_util.h"
#include "ash/wm/wm_event.h"
#include "ash/wm_window.h"
#include "base/command_line.h"
#include "base/test/user_action_tester.h"
#include "services/ui/public/interfaces/window_manager_constants.mojom.h"
Expand Down
1 change: 0 additions & 1 deletion ash/accelerators/exit_warning_handler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#include "ash/shell_delegate.h"
#include "ash/shell_port.h"
#include "ash/strings/grit/ash_strings.h"
#include "ash/wm_window.h"
#include "base/strings/utf_string_conversions.h"
#include "base/time/time.h"
#include "base/timer/timer.h"
Expand Down
1 change: 0 additions & 1 deletion ash/app_list/app_list_delegate_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#include "ash/shelf/shelf_widget.h"
#include "ash/shell.h"
#include "ash/shell_port.h"
#include "ash/wm_window.h"
#include "ui/app_list/presenter/app_list.h"

namespace ash {
Expand Down
18 changes: 9 additions & 9 deletions ash/app_list/app_list_presenter_delegate.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
#include "ash/shell.h"
#include "ash/shell_port.h"
#include "ash/wm/maximize_mode/maximize_mode_controller.h"
#include "ash/wm_window.h"
#include "base/command_line.h"
#include "ui/app_list/app_list_constants.h"
#include "ui/app_list/app_list_features.h"
Expand All @@ -28,6 +27,7 @@
#include "ui/events/event.h"
#include "ui/keyboard/keyboard_controller.h"
#include "ui/views/widget/widget.h"
#include "ui/wm/core/coordinate_conversion.h"

namespace ash {
namespace {
Expand All @@ -36,11 +36,11 @@ namespace {
// This calculation excludes the virtual keyboard area. If the height of the
// display area is less than |minimum_height|, its bottom will be extended to
// that height (so that the app list never starts above the top of the screen).
gfx::Point GetCenterOfDisplayForWindow(WmWindow* window, int minimum_height) {
gfx::Point GetCenterOfDisplayForWindow(aura::Window* window,
int minimum_height) {
DCHECK(window);
gfx::Rect bounds =
ScreenUtil::GetDisplayBoundsWithShelf(window->aura_window());
bounds = window->GetRootWindow()->ConvertRectToScreen(bounds);
gfx::Rect bounds = ScreenUtil::GetDisplayBoundsWithShelf(window);
::wm::ConvertRectToScreen(window->GetRootWindow(), &bounds);

// If the virtual keyboard is active, subtract it from the display bounds, so
// that the app list is centered in the non-keyboard area of the display.
Expand Down Expand Up @@ -102,7 +102,7 @@ void AppListPresenterDelegate::Init(app_list::AppListView* view,

if (!app_list::features::IsFullscreenAppListEnabled()) {
view->MaybeSetAnchorPoint(GetCenterOfDisplayForWindow(
WmWindow::Get(root_window), GetMinimumBoundsHeightForAppList(view)));
root_window, GetMinimumBoundsHeightForAppList(view)));
}
keyboard::KeyboardController* keyboard_controller =
keyboard::KeyboardController::GetInstance();
Expand Down Expand Up @@ -146,9 +146,9 @@ void AppListPresenterDelegate::UpdateBounds() {
return;

view_->UpdateBounds();
view_->MaybeSetAnchorPoint(GetCenterOfDisplayForWindow(
WmWindow::Get(view_->GetWidget()->GetNativeWindow()),
GetMinimumBoundsHeightForAppList(view_)));
view_->MaybeSetAnchorPoint(
GetCenterOfDisplayForWindow(view_->GetWidget()->GetNativeWindow(),
GetMinimumBoundsHeightForAppList(view_)));
}

gfx::Vector2d AppListPresenterDelegate::GetVisibilityAnimationOffset(
Expand Down
1 change: 0 additions & 1 deletion ash/app_list/app_list_presenter_delegate_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#include "ash/test/ash_test_base.h"
#include "ash/test/test_app_list_view_presenter_impl.h"
#include "ash/wm/window_util.h"
#include "ash/wm_window.h"
#include "base/command_line.h"
#include "base/macros.h"
#include "base/test/scoped_feature_list.h"
Expand Down
14 changes: 8 additions & 6 deletions ash/ash_touch_exploration_manager_chromeos.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#include "ash/shell.h"
#include "ash/system/tray/system_tray_notifier.h"
#include "ash/wm/window_util.h"
#include "ash/wm_window.h"
#include "base/command_line.h"
#include "base/memory/ptr_util.h"
#include "chromeos/audio/chromeos_sounds.h"
Expand Down Expand Up @@ -104,8 +103,10 @@ void AshTouchExplorationManager::HandleAccessibilityGesture(
void AshTouchExplorationManager::OnDisplayMetricsChanged(
const display::Display& display,
uint32_t changed_metrics) {
if (root_window_controller_->GetWindow()->GetDisplayNearestWindow().id() ==
display.id())
const display::Display this_display =
display::Screen::GetScreen()->GetDisplayNearestWindow(
root_window_controller_->GetRootWindow());
if (this_display.id() == display.id())
UpdateTouchExplorationState();
}

Expand Down Expand Up @@ -190,9 +191,10 @@ void AshTouchExplorationManager::UpdateTouchExplorationState() {
touch_accessibility_enabler_.get());
}
if (pass_through_surface) {
const gfx::Rect work_area = root_window_controller_->GetWindow()
->GetDisplayNearestWindow()
.work_area();
const display::Display display =
display::Screen::GetScreen()->GetDisplayNearestWindow(
root_window_controller_->GetRootWindow());
const gfx::Rect work_area = display.work_area();
touch_exploration_controller_->SetExcludeBounds(work_area);
SilenceSpokenFeedback();
Shell::Get()->accessibility_delegate()->ClearFocusHighlight();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@
#include "ash/test/test_system_tray_delegate.h"
#include "ash/wm/maximize_mode/maximize_mode_controller.h"
#include "ash/wm/window_state.h"
#include "ash/wm_window.h"
#include "base/command_line.h"
#include "chromeos/accelerometer/accelerometer_reader.h"
#include "chromeos/accelerometer/accelerometer_types.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/web_contents.h"
#include "content/public/test/test_browser_context.h"
#include "third_party/WebKit/public/platform/modules/screen_orientation/WebScreenOrientationLockType.h"
#include "ui/aura/client/aura_constants.h"
#include "ui/aura/window.h"
#include "ui/display/display.h"
#include "ui/display/display_switches.h"
Expand Down Expand Up @@ -132,7 +132,8 @@ class ScreenOrientationControllerTest : public test::AshTestBase {
protected:
aura::Window* CreateAppWindowInShellWithId(int id) {
aura::Window* window = CreateTestWindowInShellWithId(id);
WmWindow::Get(window)->SetAppType(static_cast<int>(AppType::CHROME_APP));
window->SetProperty(aura::client::kAppType,
static_cast<int>(AppType::CHROME_APP));
return window;
}

Expand Down
7 changes: 2 additions & 5 deletions ash/display/screen_position_controller.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,9 @@

#include "ash/public/cpp/shell_window_ids.h"
#include "ash/shell.h"
#include "ash/shell_port.h"
#include "ash/wm/window_positioning_utils.h"
#include "ash/wm/window_properties.h"
#include "ash/wm/window_state.h"
#include "ash/wm_window.h"
#include "ui/aura/window.h"
#include "ui/aura/window_tree_host.h"
#include "ui/compositor/dip_util.h"
Expand Down Expand Up @@ -103,9 +101,8 @@ void ScreenPositionController::ConvertHostPointToScreen(
gfx::Point* point) {
aura::Window* root = root_window->GetRootWindow();
aura::Window* target_root = nullptr;
ConvertHostPointToRelativeToRootWindow(
root, WmWindow::ToAuraWindows(ShellPort::Get()->GetAllRootWindows()),
point, &target_root);
ConvertHostPointToRelativeToRootWindow(root, Shell::GetAllRootWindows(),
point, &target_root);
ConvertPointToScreen(target_root, point);
}

Expand Down
1 change: 0 additions & 1 deletion ash/drag_drop/drag_drop_controller.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#include "ash/drag_drop/drag_image_view.h"
#include "ash/shell.h"
#include "ash/shell_port.h"
#include "ash/wm_window.h"
#include "base/bind.h"
#include "base/memory/ptr_util.h"
#include "base/message_loop/message_loop.h"
Expand Down
1 change: 0 additions & 1 deletion ash/drag_drop/drag_drop_tracker_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#include "ash/scoped_root_window_for_new_windows.h"
#include "ash/shell.h"
#include "ash/test/ash_test_base.h"
#include "ash/wm_window.h"
#include "ui/aura/test/test_windows.h"
#include "ui/aura/window.h"
#include "ui/aura/window_event_dispatcher.h"
Expand Down
1 change: 0 additions & 1 deletion ash/first_run/first_run_helper_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#include "ash/shelf/shelf_widget.h"
#include "ash/shell.h"
#include "ash/system/tray/system_tray.h"
#include "ash/wm_window.h"
#include "base/logging.h"
#include "ui/app_list/views/app_list_view.h"
#include "ui/aura/window.h"
Expand Down
25 changes: 13 additions & 12 deletions ash/frame/custom_frame_view_ash.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@
#include "ash/shared/immersive_fullscreen_controller.h"
#include "ash/shared/immersive_fullscreen_controller_delegate.h"
#include "ash/shell_port.h"
#include "ash/wm/resize_handle_window_targeter.h"
#include "ash/wm/window_state.h"
#include "ash/wm/window_state_delegate.h"
#include "ash/wm/window_state_observer.h"
#include "ash/wm_window.h"
#include "ash/wm/window_util.h"
#include "base/memory/ptr_util.h"
#include "ui/aura/client/aura_constants.h"
#include "ui/aura/window.h"
Expand Down Expand Up @@ -261,17 +262,17 @@ CustomFrameViewAsh::CustomFrameViewAsh(
immersive_delegate_(immersive_delegate ? immersive_delegate
: header_view_),
avatar_observer_(base::MakeUnique<AvatarObserver>(frame_, header_view_)) {
WmWindow* frame_window = WmWindow::Get(frame->GetNativeWindow());
frame_window->InstallResizeHandleWindowTargeter(nullptr);
aura::Window* frame_window = frame->GetNativeWindow();
wm::InstallResizeHandleWindowTargeterForWindow(frame_window, nullptr);
// |header_view_| is set as the non client view's overlay view so that it can
// overlay the web contents in immersive fullscreen.
frame->non_client_view()->SetOverlayView(overlay_view_);
frame_window->aura_window()->SetProperty(
aura::client::kTopViewColor, header_view_->GetInactiveFrameColor());
frame_window->SetProperty(aura::client::kTopViewColor,
header_view_->GetInactiveFrameColor());

// A delegate for a more complex way of fullscreening the window may already
// be set. This is the case for packaged apps.
wm::WindowState* window_state = frame_window->GetWindowState();
wm::WindowState* window_state = wm::GetWindowState(frame_window);
if (!window_state->HasDelegate()) {
window_state->SetDelegate(std::unique_ptr<wm::WindowStateDelegate>(
new CustomFrameViewAshWindowStateDelegate(window_state, this,
Expand All @@ -290,9 +291,9 @@ void CustomFrameViewAsh::InitImmersiveFullscreenControllerForView(
void CustomFrameViewAsh::SetFrameColors(SkColor active_frame_color,
SkColor inactive_frame_color) {
header_view_->SetFrameColors(active_frame_color, inactive_frame_color);
WmWindow* frame_window = WmWindow::Get(frame_->GetNativeWindow());
frame_window->aura_window()->SetProperty(
aura::client::kTopViewColor, header_view_->GetInactiveFrameColor());
aura::Window* frame_window = frame_->GetNativeWindow();
frame_window->SetProperty(aura::client::kTopViewColor,
header_view_->GetInactiveFrameColor());
}

void CustomFrameViewAsh::SetHeaderHeight(base::Optional<int> height) {
Expand Down Expand Up @@ -361,9 +362,9 @@ gfx::Size CustomFrameViewAsh::CalculatePreferredSize() const {

void CustomFrameViewAsh::Layout() {
views::NonClientFrameView::Layout();
WmWindow* frame_window = WmWindow::Get(frame_->GetNativeWindow());
frame_window->aura_window()->SetProperty(aura::client::kTopViewInset,
NonClientTopBorderHeight());
aura::Window* frame_window = frame_->GetNativeWindow();
frame_window->SetProperty(aura::client::kTopViewInset,
NonClientTopBorderHeight());
}

const char* CustomFrameViewAsh::GetClassName() const {
Expand Down
10 changes: 5 additions & 5 deletions ash/frame/header_painter_util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

#include <algorithm>

#include "ash/wm_window.h"
#include "ui/aura/window.h"
#include "ui/compositor/layer.h"
#include "ui/compositor/layer_animator.h"
#include "ui/gfx/font_list.h"
Expand Down Expand Up @@ -82,13 +82,13 @@ bool HeaderPainterUtil::CanAnimateActivation(views::Widget* widget) {
// rate.
// TODO(sky): Expose a better way to determine this rather than assuming the
// parent is a toplevel container.
WmWindow* window = WmWindow::Get(widget->GetNativeWindow());
// TODO(sky): GetParent()->GetLayer() is for mash until animations ported.
if (!window || !window->GetParent() || !window->GetParent()->GetLayer())
aura::Window* window = widget->GetNativeWindow();
// TODO(sky): parent()->layer() is for mash until animations ported.
if (!window || !window->parent() || !window->parent()->layer())
return true;

ui::LayerAnimator* parent_layer_animator =
window->GetParent()->GetLayer()->GetAnimator();
window->parent()->layer()->GetAnimator();
return !parent_layer_animator->IsAnimatingProperty(
ui::LayerAnimationElement::OPACITY) &&
!parent_layer_animator->IsAnimatingProperty(
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 @@ -7,7 +7,6 @@
#include "ash/frame/caption_buttons/frame_caption_button_container_view.h"
#include "ash/frame/default_header_painter.h"
#include "ash/shell.h"
#include "ash/wm_window.h"
#include "ui/views/controls/image_view.h"
#include "ui/views/widget/widget.h"

Expand Down
1 change: 0 additions & 1 deletion ash/high_contrast/high_contrast_controller.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
#include "ash/high_contrast/high_contrast_controller.h"

#include "ash/shell.h"
#include "ash/wm_window.h"
#include "ui/aura/window_event_dispatcher.h"
#include "ui/compositor/layer.h"

Expand Down
7 changes: 4 additions & 3 deletions ash/metrics/pointer_metrics_recorder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@
#include "ash/shell.h"
#include "ash/shell_port.h"
#include "ash/wm/maximize_mode/maximize_mode_controller.h"
#include "ash/wm_window.h"
#include "base/metrics/histogram_macros.h"
#include "ui/aura/client/aura_constants.h"
#include "ui/aura/window.h"
#include "ui/events/event_constants.h"
#include "ui/views/widget/widget.h"

Expand Down Expand Up @@ -39,9 +40,9 @@ int GetDestination(views::Widget* target) {
if (!target)
return static_cast<int>(AppType::OTHERS);

WmWindow* window = WmWindow::Get(target->GetNativeWindow());
aura::Window* window = target->GetNativeWindow();
DCHECK(window);
return window->GetAppType();
return window->GetProperty(aura::client::kAppType);
}

void RecordUMA(ui::EventPointerType type, views::Widget* target) {
Expand Down
17 changes: 11 additions & 6 deletions ash/metrics/pointer_metrics_recorder_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@
#include "ash/shell.h"
#include "ash/test/ash_test_base.h"
#include "ash/wm/maximize_mode/maximize_mode_controller.h"
#include "ash/wm_window.h"
#include "base/test/histogram_tester.h"
#include "ui/aura/client/aura_constants.h"
#include "ui/aura/window.h"
#include "ui/events/event.h"
#include "ui/views/pointer_watcher.h"
#include "ui/views/widget/widget.h"
Expand Down Expand Up @@ -158,25 +159,29 @@ TEST_F(PointerMetricsRecorderTest, DownEventPerDestination) {
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_MOUSE, 0),
base::TimeTicks());

WmWindow* window = WmWindow::Get(target->GetNativeWindow());
aura::Window* window = target->GetNativeWindow();
CHECK(window);

window->SetAppType(static_cast<int>(AppType::OTHERS));
window->SetProperty(aura::client::kAppType,
static_cast<int>(AppType::OTHERS));
pointer_metrics_recorder_->OnPointerEventObserved(pointer_event, gfx::Point(),
target.get());
histogram_tester_->ExpectBucketCount(kDestinationHistogramName, 0, 1);

window->SetAppType(static_cast<int>(AppType::BROWSER));
window->SetProperty(aura::client::kAppType,
static_cast<int>(AppType::BROWSER));
pointer_metrics_recorder_->OnPointerEventObserved(pointer_event, gfx::Point(),
target.get());
histogram_tester_->ExpectBucketCount(kDestinationHistogramName, 1, 1);

window->SetAppType(static_cast<int>(AppType::CHROME_APP));
window->SetProperty(aura::client::kAppType,
static_cast<int>(AppType::CHROME_APP));
pointer_metrics_recorder_->OnPointerEventObserved(pointer_event, gfx::Point(),
target.get());
histogram_tester_->ExpectBucketCount(kDestinationHistogramName, 2, 1);

window->SetAppType(static_cast<int>(AppType::ARC_APP));
window->SetProperty(aura::client::kAppType,
static_cast<int>(AppType::ARC_APP));
pointer_metrics_recorder_->OnPointerEventObserved(pointer_event, gfx::Point(),
target.get());
histogram_tester_->ExpectBucketCount(kDestinationHistogramName, 3, 1);
Expand Down
1 change: 0 additions & 1 deletion ash/metrics/user_metrics_recorder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
#include "ash/shelf/shelf_view.h"
#include "ash/shell.h"
#include "ash/wm/window_state.h"
#include "ash/wm_window.h"
#include "base/memory/ptr_util.h"
#include "base/metrics/histogram_macros.h"
#include "base/metrics/user_metrics.h"
Expand Down
1 change: 0 additions & 1 deletion ash/metrics/user_metrics_recorder_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
#include "ash/test/ash_test_base.h"
#include "ash/test/test_session_controller_client.h"
#include "ash/test/user_metrics_recorder_test_api.h"
#include "ash/wm_window.h"
#include "base/test/histogram_tester.h"

using session_manager::SessionState;
Expand Down
1 change: 0 additions & 1 deletion ash/mus/disconnected_app_handler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
#include "ash/mus/disconnected_app_handler.h"

#include "ash/public/cpp/shell_window_ids.h"
#include "ash/wm_window.h"
#include "ui/aura/window.h"
#include "ui/base/class_property.h"

Expand Down
Loading

0 comments on commit c8621dd

Please sign in to comment.