Commit 56f2089b authored by Mike Wasserman's avatar Mike Wasserman Committed by Commit Bot

ash: Remove *LimitedPreTargetHandlerForWindow helper functions

These were added for deprecated Mash architecture plans.
Inline calls to [Add/Remove]PreTargetHandler instead.

Bug: 866529
Test: No shelf tooltip nor double-click-to-resize-window changes.
Change-Id: Ic4d376652e1e128c979cfdb6f5f219a2ed76f6ad
Reviewed-on: https://chromium-review.googlesource.com/1240212Reviewed-by: default avatarJames Cook <jamescook@chromium.org>
Commit-Queue: Michael Wasserman <msw@chromium.org>
Cr-Commit-Position: refs/heads/master@{#593628}
parent 6292b60f
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
#include "ash/shelf/shelf_tooltip_preview_bubble.h" #include "ash/shelf/shelf_tooltip_preview_bubble.h"
#include "ash/shelf/shelf_view.h" #include "ash/shelf/shelf_view.h"
#include "ash/shell.h" #include "ash/shell.h"
#include "ash/wm/window_util.h"
#include "base/bind.h" #include "base/bind.h"
#include "base/strings/string16.h" #include "base/strings/string16.h"
#include "base/threading/thread_task_runner_handle.h" #include "base/threading/thread_task_runner_handle.h"
...@@ -41,16 +40,12 @@ ShelfTooltipManager::ShelfTooltipManager(ShelfView* shelf_view) ...@@ -41,16 +40,12 @@ ShelfTooltipManager::ShelfTooltipManager(ShelfView* shelf_view)
ShelfTooltipManager::~ShelfTooltipManager() { ShelfTooltipManager::~ShelfTooltipManager() {
Shell::Get()->RemovePointerWatcher(this); Shell::Get()->RemovePointerWatcher(this);
shelf_view_->shelf()->RemoveObserver(this); shelf_view_->shelf()->RemoveObserver(this);
aura::Window* window = nullptr; if (shelf_view_->GetWidget() && shelf_view_->GetWidget()->GetNativeWindow())
if (shelf_view_->GetWidget()) shelf_view_->GetWidget()->GetNativeWindow()->RemovePreTargetHandler(this);
window = shelf_view_->GetWidget()->GetNativeWindow();
if (window)
wm::RemoveLimitedPreTargetHandlerForWindow(this, window);
} }
void ShelfTooltipManager::Init() { void ShelfTooltipManager::Init() {
wm::AddLimitedPreTargetHandlerForWindow( shelf_view_->GetWidget()->GetNativeWindow()->AddPreTargetHandler(this);
this, shelf_view_->GetWidget()->GetNativeWindow());
} }
void ShelfTooltipManager::Close() { void ShelfTooltipManager::Close() {
......
...@@ -247,17 +247,6 @@ void CloseWidgetForWindow(aura::Window* window) { ...@@ -247,17 +247,6 @@ void CloseWidgetForWindow(aura::Window* window) {
widget->Close(); widget->Close();
} }
// TODO(sky): investigate removing this entirely. https://crbug.com/842365
void AddLimitedPreTargetHandlerForWindow(ui::EventHandler* handler,
aura::Window* window) {
window->AddPreTargetHandler(handler);
}
void RemoveLimitedPreTargetHandlerForWindow(ui::EventHandler* handler,
aura::Window* window) {
window->RemovePreTargetHandler(handler);
}
void InstallResizeHandleWindowTargeterForWindow(aura::Window* window) { void InstallResizeHandleWindowTargeterForWindow(aura::Window* window) {
window->SetEventTargeter(std::make_unique<InteriorResizeHandleTargeter>()); window->SetEventTargeter(std::make_unique<InteriorResizeHandleTargeter>());
} }
......
...@@ -20,7 +20,6 @@ class Point; ...@@ -20,7 +20,6 @@ class Point;
namespace ui { namespace ui {
class Event; class Event;
class EventHandler;
} }
namespace ash { namespace ash {
...@@ -95,19 +94,6 @@ ASH_EXPORT void SetChildrenUseExtendedHitRegionForWindow(aura::Window* window); ...@@ -95,19 +94,6 @@ ASH_EXPORT void SetChildrenUseExtendedHitRegionForWindow(aura::Window* window);
// forward to an associated widget. // forward to an associated widget.
ASH_EXPORT void CloseWidgetForWindow(aura::Window* window); ASH_EXPORT void CloseWidgetForWindow(aura::Window* window);
// Adds or removes a handler to receive events targeted at this window, before
// this window handles the events itself; the handler does not receive events
// from embedded windows. This only supports windows with internal widgets;
// see ash::GetInternalWidgetForWindow(). Ownership of the handler is not
// transferred.
//
// Also note that the target of these events is always an aura::Window.
ASH_EXPORT void AddLimitedPreTargetHandlerForWindow(ui::EventHandler* handler,
aura::Window* window);
ASH_EXPORT void RemoveLimitedPreTargetHandlerForWindow(
ui::EventHandler* handler,
aura::Window* window);
// Installs a resize handler on the window that makes it easier to resize // Installs a resize handler on the window that makes it easier to resize
// the window. // the window.
ASH_EXPORT void InstallResizeHandleWindowTargeterForWindow( ASH_EXPORT void InstallResizeHandleWindowTargeterForWindow(
......
...@@ -18,12 +18,11 @@ namespace ash { ...@@ -18,12 +18,11 @@ namespace ash {
WorkspaceEventHandler::WorkspaceEventHandler(aura::Window* workspace_window) WorkspaceEventHandler::WorkspaceEventHandler(aura::Window* workspace_window)
: workspace_window_(workspace_window), click_component_(HTNOWHERE) { : workspace_window_(workspace_window), click_component_(HTNOWHERE) {
// TODO(crbug.com/866529): Convert to AddPreTargetHandler. workspace_window_->AddPreTargetHandler(this);
wm::AddLimitedPreTargetHandlerForWindow(this, workspace_window_);
} }
WorkspaceEventHandler::~WorkspaceEventHandler() { WorkspaceEventHandler::~WorkspaceEventHandler() {
wm::RemoveLimitedPreTargetHandlerForWindow(this, workspace_window_); workspace_window_->RemovePreTargetHandler(this);
} }
void WorkspaceEventHandler::OnMouseEvent(ui::MouseEvent* event) { void WorkspaceEventHandler::OnMouseEvent(ui::MouseEvent* event) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment