Commit 1b600061 authored by Felix Ekblom's avatar Felix Ekblom Committed by Commit Bot

Listen to changes to touch input devices

In https://codereview.chromium.org/2964823002 the OobeDisplayChooser
started using the DeviceDataManager to look for touchscreen devices when
searching for a good primary display to use during OOBE.

On device cold boot the DeviceDataManager has not yet found any
touchscreen devices at the time OobeUi::ShowOobeUI() is called (likely
due to lower level systems not being fully initialized).

This CL make LoginDisplayHostImpl an observer of changes to connected
touchscreen devices, re-triggering the OobeDisplayChooser when the
DeviceDataManager is notified of the connected touchscreens. This
overcomes the timing issues on cold boot.

Bug: 738885
Change-Id: Iae488ddc9428b7c5e74d36cf18e35ba3d1235bbd
Reviewed-on: https://chromium-review.googlesource.com/569958Reviewed-by: default avatarJacob Dufault <jdufault@chromium.org>
Commit-Queue: Felix Ekblom <felixe@chromium.org>
Cr-Commit-Position: refs/heads/master@{#487007}
parent cdd829b1
...@@ -99,6 +99,7 @@ ...@@ -99,6 +99,7 @@
#include "ui/compositor/scoped_layer_animation_settings.h" #include "ui/compositor/scoped_layer_animation_settings.h"
#include "ui/display/display.h" #include "ui/display/display.h"
#include "ui/display/screen.h" #include "ui/display/screen.h"
#include "ui/events/devices/device_data_manager.h"
#include "ui/events/event_handler.h" #include "ui/events/event_handler.h"
#include "ui/events/event_utils.h" #include "ui/events/event_utils.h"
#include "ui/gfx/geometry/rect.h" #include "ui/gfx/geometry/rect.h"
...@@ -384,6 +385,8 @@ LoginDisplayHostImpl::LoginDisplayHostImpl(const gfx::Rect& wallpaper_bounds) ...@@ -384,6 +385,8 @@ LoginDisplayHostImpl::LoginDisplayHostImpl(const gfx::Rect& wallpaper_bounds)
display::Screen::GetScreen()->AddObserver(this); display::Screen::GetScreen()->AddObserver(this);
ui::DeviceDataManager::GetInstance()->AddObserver(this);
// We need to listen to CLOSE_ALL_BROWSERS_REQUEST but not APP_TERMINATING // We need to listen to CLOSE_ALL_BROWSERS_REQUEST but not APP_TERMINATING
// because/ APP_TERMINATING will never be fired as long as this keeps // because/ APP_TERMINATING will never be fired as long as this keeps
// ref-count. CLOSE_ALL_BROWSERS_REQUEST is safe here because there will be no // ref-count. CLOSE_ALL_BROWSERS_REQUEST is safe here because there will be no
...@@ -493,6 +496,7 @@ LoginDisplayHostImpl::~LoginDisplayHostImpl() { ...@@ -493,6 +496,7 @@ LoginDisplayHostImpl::~LoginDisplayHostImpl() {
DBusThreadManager::Get()->GetSessionManagerClient()->RemoveObserver(this); DBusThreadManager::Get()->GetSessionManagerClient()->RemoveObserver(this);
CrasAudioHandler::Get()->RemoveAudioObserver(this); CrasAudioHandler::Get()->RemoveAudioObserver(this);
display::Screen::GetScreen()->RemoveObserver(this); display::Screen::GetScreen()->RemoveObserver(this);
ui::DeviceDataManager::GetInstance()->RemoveObserver(this);
if (login_view_ && login_window_) if (login_view_ && login_window_)
login_window_->RemoveRemovalsObserver(this); login_window_->RemoveRemovalsObserver(this);
...@@ -1017,6 +1021,13 @@ void LoginDisplayHostImpl::OnDisplayMetricsChanged( ...@@ -1017,6 +1021,13 @@ void LoginDisplayHostImpl::OnDisplayMetricsChanged(
} }
} }
////////////////////////////////////////////////////////////////////////////////
// LoginDisplayHostImpl, ui::InputDeviceEventObserver
void LoginDisplayHostImpl::OnTouchscreenDeviceConfigurationChanged() {
if (GetOobeUI())
GetOobeUI()->OnDisplayConfigurationChanged();
}
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// LoginDisplayHostImpl, views::WidgetRemovalsObserver: // LoginDisplayHostImpl, views::WidgetRemovalsObserver:
void LoginDisplayHostImpl::OnWillRemoveView(views::Widget* widget, void LoginDisplayHostImpl::OnWillRemoveView(views::Widget* widget,
......
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include "content/public/browser/notification_registrar.h" #include "content/public/browser/notification_registrar.h"
#include "content/public/browser/web_contents_observer.h" #include "content/public/browser/web_contents_observer.h"
#include "ui/display/display_observer.h" #include "ui/display/display_observer.h"
#include "ui/events/devices/input_device_event_observer.h"
#include "ui/gfx/geometry/rect.h" #include "ui/gfx/geometry/rect.h"
#include "ui/views/widget/widget_removals_observer.h" #include "ui/views/widget/widget_removals_observer.h"
#include "ui/wm/public/scoped_drag_drop_disabler.h" #include "ui/wm/public/scoped_drag_drop_disabler.h"
...@@ -51,6 +52,7 @@ class LoginDisplayHostImpl : public LoginDisplayHost, ...@@ -51,6 +52,7 @@ class LoginDisplayHostImpl : public LoginDisplayHost,
public chromeos::SessionManagerClient::Observer, public chromeos::SessionManagerClient::Observer,
public chromeos::CrasAudioHandler::AudioObserver, public chromeos::CrasAudioHandler::AudioObserver,
public display::DisplayObserver, public display::DisplayObserver,
public ui::InputDeviceEventObserver,
public views::WidgetRemovalsObserver, public views::WidgetRemovalsObserver,
public chrome::MultiUserWindowManager::Observer { public chrome::MultiUserWindowManager::Observer {
public: public:
...@@ -122,6 +124,9 @@ class LoginDisplayHostImpl : public LoginDisplayHost, ...@@ -122,6 +124,9 @@ class LoginDisplayHostImpl : public LoginDisplayHost,
void OnDisplayMetricsChanged(const display::Display& display, void OnDisplayMetricsChanged(const display::Display& display,
uint32_t changed_metrics) override; uint32_t changed_metrics) override;
// Overridden from ui::InputDeviceEventObserver
void OnTouchscreenDeviceConfigurationChanged() override;
// Overriden from views::WidgetRemovalsObserver: // Overriden from views::WidgetRemovalsObserver:
void OnWillRemoveView(views::Widget* widget, views::View* view) override; void OnWillRemoveView(views::Widget* widget, views::View* view) override;
......
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