Commit e8aab791 authored by Scott Violet's avatar Scott Violet Committed by Commit Bot

chromeos: use Env from Widget in TabStripDragController

This ensures the right Env is obtained.

BUG=847992
TEST=none

Change-Id: I5119cc7187c27fc6b5a38911777c974f12e3c093
Reviewed-on: https://chromium-review.googlesource.com/1181536Reviewed-by: default avatarJun Mukai <mukai@chromium.org>
Commit-Queue: Scott Violet <sky@chromium.org>
Cr-Commit-Position: refs/heads/master@{#584505}
parent 421aed3e
......@@ -432,6 +432,10 @@ void TabDragController::Init(TabStrip* source_tabstrip,
if (event_source == EVENT_SOURCE_TOUCH)
source_tabstrip_->GetWidget()->SetCapture(source_tabstrip_);
#if defined(USE_AURA)
env_ = source_tabstrip_->GetWidget()->GetNativeWindow()->env();
#endif
#if defined(OS_CHROMEOS)
if (TabletModeClient::Get()->tablet_mode_enabled() &&
!base::FeatureList::IsEnabled(ash::features::kDragTabsInTabletMode)) {
......@@ -2003,8 +2007,7 @@ gfx::Point TabDragController::GetCursorScreenPoint() {
// recognizer in mash until the mus side/window manager side RunMoveLoop() is
// fixed to understand routing touch events. crbug.com/769507
if (features::IsAshInBrowserProcess() &&
event_source_ == EVENT_SOURCE_TOUCH &&
aura::Env::GetInstance()->is_touch_down()) {
event_source_ == EVENT_SOURCE_TOUCH && env_->is_touch_down()) {
views::Widget* widget = GetAttachedBrowserWidget();
DCHECK(widget);
aura::Window* widget_window = widget->GetNativeWindow();
......
......@@ -20,6 +20,12 @@
#include "ui/gfx/native_widget_types.h"
#include "ui/views/widget/widget_observer.h"
#if defined(USE_AURA)
namespace aura {
class Env;
}
#endif
namespace ui {
class EventHandler;
class ListSelectionModel;
......@@ -497,10 +503,11 @@ class TabDragController : public views::WidgetObserver,
EventSource event_source_;
// The TabStrip the drag originated from.
// The TabStrip the drag originated from. This is set to null if destroyed
// during the drag.
TabStrip* source_tabstrip_;
// The TabStrip the dragged Tab is currently attached to, or NULL if the
// The TabStrip the dragged Tab is currently attached to, or null if the
// dragged Tab is detached.
TabStrip* attached_tabstrip_;
......@@ -647,6 +654,10 @@ class TabDragController : public views::WidgetObserver,
std::unique_ptr<WindowFinder> window_finder_;
#if defined(USE_AURA)
aura::Env* env_ = nullptr;
#endif
base::WeakPtrFactory<TabDragController> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(TabDragController);
......
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