KeyboardController: OnKeyboardDisabled -> OnKeyboardEnabledChanged
ChromeKeyboardControllerClient is going to need to keep track of when the KeyboardController is (actually) enabled and disabled. This CL: * Replaces the KeyboardControllerObserver::OnKeyboardDisabled with a more generalized OnKeyboardEnabledChanged. * Replaces the (poorly named) mojom::KeyboardControllerObserver:: OnKeyboardWindowDestroyed with OnKeyboardEnabledChanged. * Eliminates the now redundant VirtualKeyboardControllerObserver with KeyboardControllerObservers, reducing overall complexity. * Modifies exo/keyboard.cc to directly observe keyboard::KeyboardController instead of ash::VirtualKeyboardController and ash::AccessibilityController. For minor change to test_suites.pyl: TBR=bpastene@chromium.org Bug: 843332 Change-Id: I808c1f4ca3e732aa9b606810caa12533b9da8158 Reviewed-on: https://chromium-review.googlesource.com/c/1285329 Reviewed-by: Steven Bennetts <stevenjb@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org> Reviewed-by: Yuichiro Hanada <yhanada@chromium.org> Reviewed-by: Mitsuru Oshima <oshima@chromium.org> Reviewed-by: Darren Shen <shend@chromium.org> Reviewed-by: James Cook <jamescook@chromium.org> Commit-Queue: Steven Bennetts <stevenjb@chromium.org> Cr-Commit-Position: refs/heads/master@{#600783}
This commit is contained in:

committed by
Commit Bot

parent
cccd8b081b
commit
b4634b3b5f
ash
BUILD.gn
accessibility
keyboard
ash_keyboard_controller.ccash_keyboard_controller.hash_keyboard_controller_unittest.ccvirtual_keyboard_controller.ccvirtual_keyboard_controller.hvirtual_keyboard_controller_observer.h
public
interfaces
chrome/browser/ui/ash
components/exo
testing/buildbot
ui/keyboard
@ -393,7 +393,6 @@ component("ash") {
|
||||
"keyboard/virtual_keyboard_container_layout_manager.h",
|
||||
"keyboard/virtual_keyboard_controller.cc",
|
||||
"keyboard/virtual_keyboard_controller.h",
|
||||
"keyboard/virtual_keyboard_controller_observer.h",
|
||||
"laser/laser_pointer_controller.cc",
|
||||
"laser/laser_pointer_controller.h",
|
||||
"laser/laser_pointer_view.cc",
|
||||
|
@ -193,7 +193,7 @@ void TouchExplorationManager::OnKeyboardVisibleBoundsChanged(
|
||||
UpdateTouchExplorationState();
|
||||
}
|
||||
|
||||
void TouchExplorationManager::OnKeyboardDisabled() {
|
||||
void TouchExplorationManager::OnKeyboardEnabledChanged(bool is_enabled) {
|
||||
UpdateTouchExplorationState();
|
||||
}
|
||||
|
||||
|
@ -87,7 +87,7 @@ class ASH_EXPORT TouchExplorationManager
|
||||
private:
|
||||
// keyboard::KeyboardControllerObserver overrides:
|
||||
void OnKeyboardVisibleBoundsChanged(const gfx::Rect& new_bounds) override;
|
||||
void OnKeyboardDisabled() override;
|
||||
void OnKeyboardEnabledChanged(bool is_enabled) override;
|
||||
|
||||
void UpdateTouchExplorationState();
|
||||
bool VolumeAdjustSoundEnabled();
|
||||
|
@ -150,10 +150,11 @@ void AshKeyboardController::OnKeyboardVisibleBoundsChanged(
|
||||
});
|
||||
}
|
||||
|
||||
void AshKeyboardController::OnKeyboardDisabled() {
|
||||
observers_.ForAllPtrs([](mojom::KeyboardControllerObserver* observer) {
|
||||
observer->OnKeyboardWindowDestroyed();
|
||||
});
|
||||
void AshKeyboardController::OnKeyboardEnabledChanged(bool is_enabled) {
|
||||
observers_.ForAllPtrs(
|
||||
[is_enabled](mojom::KeyboardControllerObserver* observer) {
|
||||
observer->OnKeyboardEnabledChanged(is_enabled);
|
||||
});
|
||||
}
|
||||
|
||||
} // namespace ash
|
||||
|
@ -71,7 +71,7 @@ class ASH_EXPORT AshKeyboardController
|
||||
void OnKeyboardConfigChanged() override;
|
||||
void OnKeyboardVisibilityStateChanged(bool is_visible) override;
|
||||
void OnKeyboardVisibleBoundsChanged(const gfx::Rect& bounds) override;
|
||||
void OnKeyboardDisabled() override;
|
||||
void OnKeyboardEnabledChanged(bool is_enabled) override;
|
||||
|
||||
SessionController* session_controller_; // unowned
|
||||
std::unique_ptr<keyboard::KeyboardController> keyboard_controller_;
|
||||
|
@ -32,7 +32,7 @@ class TestObserver : public mojom::KeyboardControllerObserver {
|
||||
~TestObserver() override = default;
|
||||
|
||||
// mojom::KeyboardControllerObserver:
|
||||
void OnKeyboardWindowDestroyed() override {}
|
||||
void OnKeyboardEnabledChanged(bool enabled) override {}
|
||||
void OnKeyboardVisibilityChanged(bool visible) override {}
|
||||
void OnKeyboardVisibleBoundsChanged(const gfx::Rect& bounds) override {}
|
||||
void OnKeyboardConfigChanged(KeyboardConfigPtr config) override {
|
||||
|
@ -257,8 +257,6 @@ void VirtualKeyboardController::SetKeyboardEnabled(bool enabled) {
|
||||
} else {
|
||||
Shell::Get()->DisableKeyboard();
|
||||
}
|
||||
for (VirtualKeyboardControllerObserver& observer : observers_)
|
||||
observer.OnVirtualKeyboardStateChanged(is_enabled);
|
||||
}
|
||||
|
||||
void VirtualKeyboardController::ForceShowKeyboard() {
|
||||
@ -276,9 +274,13 @@ void VirtualKeyboardController::ForceShowKeyboard() {
|
||||
keyboard_controller->ShowKeyboard(false);
|
||||
}
|
||||
|
||||
void VirtualKeyboardController::OnKeyboardDisabled() {
|
||||
Shell::Get()->ime_controller()->OverrideKeyboardKeyset(
|
||||
chromeos::input_method::mojom::ImeKeyset::kNone);
|
||||
void VirtualKeyboardController::OnKeyboardEnabledChanged(bool is_enabled) {
|
||||
if (!is_enabled) {
|
||||
// TODO(shend/shuchen): Consider moving this logic to ImeController.
|
||||
// https://crbug.com/896284.
|
||||
Shell::Get()->ime_controller()->OverrideKeyboardKeyset(
|
||||
chromeos::input_method::mojom::ImeKeyset::kNone);
|
||||
}
|
||||
}
|
||||
|
||||
void VirtualKeyboardController::OnKeyboardHidden(bool is_temporary_hide) {
|
||||
@ -299,16 +301,6 @@ void VirtualKeyboardController::OnActiveUserSessionChanged(
|
||||
Shell::Get()->EnableKeyboard();
|
||||
}
|
||||
|
||||
void VirtualKeyboardController::AddObserver(
|
||||
VirtualKeyboardControllerObserver* observer) {
|
||||
observers_.AddObserver(observer);
|
||||
}
|
||||
|
||||
void VirtualKeyboardController::RemoveObserver(
|
||||
VirtualKeyboardControllerObserver* observer) {
|
||||
observers_.RemoveObserver(observer);
|
||||
}
|
||||
|
||||
void VirtualKeyboardController::UpdateBluetoothDevice(
|
||||
device::BluetoothDevice* device) {
|
||||
// We only care about keyboard type bluetooth device change.
|
||||
|
@ -9,11 +9,9 @@
|
||||
|
||||
#include "ash/ash_export.h"
|
||||
#include "ash/bluetooth_devices_observer.h"
|
||||
#include "ash/keyboard/virtual_keyboard_controller_observer.h"
|
||||
#include "ash/session/session_observer.h"
|
||||
#include "ash/wm/tablet_mode/tablet_mode_observer.h"
|
||||
#include "base/macros.h"
|
||||
#include "base/observer_list.h"
|
||||
#include "ui/base/ime/chromeos/public/interfaces/ime_keyset.mojom.h"
|
||||
#include "ui/events/devices/input_device_event_observer.h"
|
||||
#include "ui/keyboard/keyboard_controller_observer.h"
|
||||
@ -56,16 +54,12 @@ class ASH_EXPORT VirtualKeyboardController
|
||||
void MoveKeyboardToTouchableDisplay() override;
|
||||
|
||||
// keyboard::KeyboardControllerObserver:
|
||||
void OnKeyboardDisabled() override;
|
||||
void OnKeyboardEnabledChanged(bool is_enabled) override;
|
||||
void OnKeyboardHidden(bool is_temporary_hide) override;
|
||||
|
||||
// SessionObserver:
|
||||
void OnActiveUserSessionChanged(const AccountId& account_id) override;
|
||||
|
||||
// Management of the observer list.
|
||||
void AddObserver(VirtualKeyboardControllerObserver* observer);
|
||||
void RemoveObserver(VirtualKeyboardControllerObserver* observer);
|
||||
|
||||
private:
|
||||
// Updates the list of active input devices.
|
||||
void UpdateDevices();
|
||||
@ -95,8 +89,6 @@ class ASH_EXPORT VirtualKeyboardController
|
||||
// Observer to observe the bluetooth devices.
|
||||
std::unique_ptr<BluetoothDevicesObserver> bluetooth_devices_observer_;
|
||||
|
||||
base::ObserverList<VirtualKeyboardControllerObserver> observers_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(VirtualKeyboardController);
|
||||
};
|
||||
|
||||
|
@ -1,22 +0,0 @@
|
||||
// Copyright 2018 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef ASH_KEYBOARD_VIRTUAL_KEYBOARD_CONTROLLER_OBSERVER_H_
|
||||
#define ASH_KEYBOARD_VIRTUAL_KEYBOARD_CONTROLLER_OBSERVER_H_
|
||||
|
||||
#include "base/observer_list.h"
|
||||
|
||||
namespace ash {
|
||||
|
||||
class VirtualKeyboardControllerObserver : public base::CheckedObserver {
|
||||
public:
|
||||
virtual void OnVirtualKeyboardStateChanged(bool enabled) = 0;
|
||||
|
||||
protected:
|
||||
~VirtualKeyboardControllerObserver() override = default;
|
||||
};
|
||||
|
||||
} // namespace ash
|
||||
|
||||
#endif // ASH_KEYBOARD_VIRTUAL_KEYBOARD_CONTROLLER_OBSERVER_H_
|
@ -8,17 +8,18 @@ import "ui/gfx/geometry/mojo/geometry.mojom";
|
||||
import "ui/keyboard/public/keyboard_config.mojom";
|
||||
|
||||
interface KeyboardControllerObserver {
|
||||
// Called when the virtual keyboard window is destroyed, e.g. a change from
|
||||
// tablet mode to laptop mode. This is not called when the keyboard is hidden.
|
||||
OnKeyboardWindowDestroyed();
|
||||
// Called when the keyboard is enabled or disabled. If the keyboard is enabled
|
||||
// while already enabled, this will be called twice, once when the keyboard is
|
||||
// disabled and again when it is re-enabled.
|
||||
OnKeyboardEnabledChanged(bool is_enabled);
|
||||
|
||||
// Called when the virtual keyboard configuration changes.
|
||||
OnKeyboardConfigChanged(keyboard.mojom.KeyboardConfig config);
|
||||
|
||||
// Called when the visibility of the virtual keyboard changes, e.g. an input
|
||||
// field is focused or blurred, or the user hides the keyboard.
|
||||
OnKeyboardVisibilityChanged(bool visible);
|
||||
|
||||
// Called when the virtual keyboard configuration changes.
|
||||
OnKeyboardConfigChanged(keyboard.mojom.KeyboardConfig config);
|
||||
|
||||
// Called when the keyboard bounds change.
|
||||
OnKeyboardVisibleBoundsChanged(gfx.mojom.Rect new_bounds);
|
||||
};
|
||||
|
@ -100,32 +100,12 @@ void ChromeKeyboardControllerClient::OnGetInitialKeyboardConfig(
|
||||
keyboard_controller_ptr_->AddObserver(std::move(ptr_info));
|
||||
}
|
||||
|
||||
void ChromeKeyboardControllerClient::OnKeyboardVisibleBoundsChanged(
|
||||
const gfx::Rect& bounds) {
|
||||
Profile* profile = GetProfile();
|
||||
extensions::EventRouter* router = extensions::EventRouter::Get(profile);
|
||||
|
||||
if (!router->HasEventListener(
|
||||
virtual_keyboard_private::OnBoundsChanged::kEventName)) {
|
||||
void ChromeKeyboardControllerClient::OnKeyboardEnabledChanged(bool enabled) {
|
||||
if (enabled)
|
||||
return;
|
||||
}
|
||||
|
||||
auto event_args = std::make_unique<base::ListValue>();
|
||||
auto new_bounds = std::make_unique<base::DictionaryValue>();
|
||||
new_bounds->SetInteger("left", bounds.x());
|
||||
new_bounds->SetInteger("top", bounds.y());
|
||||
new_bounds->SetInteger("width", bounds.width());
|
||||
new_bounds->SetInteger("height", bounds.height());
|
||||
event_args->Append(std::move(new_bounds));
|
||||
// When the keyboard becomes disabled, send the onKeyboardClosed event.
|
||||
|
||||
auto event = std::make_unique<extensions::Event>(
|
||||
extensions::events::VIRTUAL_KEYBOARD_PRIVATE_ON_BOUNDS_CHANGED,
|
||||
virtual_keyboard_private::OnBoundsChanged::kEventName,
|
||||
std::move(event_args), profile);
|
||||
router->BroadcastEvent(std::move(event));
|
||||
}
|
||||
|
||||
void ChromeKeyboardControllerClient::OnKeyboardWindowDestroyed() {
|
||||
Profile* profile = GetProfile();
|
||||
extensions::EventRouter* router = extensions::EventRouter::Get(profile);
|
||||
|
||||
@ -154,3 +134,28 @@ void ChromeKeyboardControllerClient::OnKeyboardVisibilityChanged(bool visible) {
|
||||
for (auto& observer : observers_)
|
||||
observer.OnKeyboardVisibilityChanged(visible);
|
||||
}
|
||||
|
||||
void ChromeKeyboardControllerClient::OnKeyboardVisibleBoundsChanged(
|
||||
const gfx::Rect& bounds) {
|
||||
Profile* profile = GetProfile();
|
||||
extensions::EventRouter* router = extensions::EventRouter::Get(profile);
|
||||
|
||||
if (!router->HasEventListener(
|
||||
virtual_keyboard_private::OnBoundsChanged::kEventName)) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto event_args = std::make_unique<base::ListValue>();
|
||||
auto new_bounds = std::make_unique<base::DictionaryValue>();
|
||||
new_bounds->SetInteger("left", bounds.x());
|
||||
new_bounds->SetInteger("top", bounds.y());
|
||||
new_bounds->SetInteger("width", bounds.width());
|
||||
new_bounds->SetInteger("height", bounds.height());
|
||||
event_args->Append(std::move(new_bounds));
|
||||
|
||||
auto event = std::make_unique<extensions::Event>(
|
||||
extensions::events::VIRTUAL_KEYBOARD_PRIVATE_ON_BOUNDS_CHANGED,
|
||||
virtual_keyboard_private::OnBoundsChanged::kEventName,
|
||||
std::move(event_args), profile);
|
||||
router->BroadcastEvent(std::move(event));
|
||||
}
|
||||
|
@ -48,11 +48,11 @@ class ChromeKeyboardControllerClient
|
||||
void OnGetInitialKeyboardConfig(keyboard::mojom::KeyboardConfigPtr config);
|
||||
|
||||
// keyboard::mojom::KeyboardControllerObserver:
|
||||
void OnKeyboardWindowDestroyed() override;
|
||||
void OnKeyboardVisibilityChanged(bool visible) override;
|
||||
void OnKeyboardVisibleBoundsChanged(const gfx::Rect& bounds) override;
|
||||
void OnKeyboardEnabledChanged(bool enabled) override;
|
||||
void OnKeyboardConfigChanged(
|
||||
keyboard::mojom::KeyboardConfigPtr config) override;
|
||||
void OnKeyboardVisibilityChanged(bool visible) override;
|
||||
void OnKeyboardVisibleBoundsChanged(const gfx::Rect& bounds) override;
|
||||
|
||||
ash::mojom::KeyboardControllerPtr keyboard_controller_ptr_;
|
||||
mojo::AssociatedBinding<ash::mojom::KeyboardControllerObserver>
|
||||
|
@ -227,6 +227,7 @@ test("exo_unittests") {
|
||||
"//ash/strings:ash_test_strings",
|
||||
"//ash/resources:ash_test_resources_100_percent",
|
||||
"//ash/resources:ash_test_resources_200_percent",
|
||||
"//testing/buildbot/filters:exo_unittests_filters",
|
||||
]
|
||||
|
||||
if (is_linux) {
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include "ui/base/ime/input_method.h"
|
||||
#include "ui/events/base_event_utils.h"
|
||||
#include "ui/events/event.h"
|
||||
#include "ui/keyboard/keyboard_controller.h"
|
||||
#include "ui/keyboard/keyboard_util.h"
|
||||
#include "ui/views/widget/widget.h"
|
||||
|
||||
@ -112,7 +113,7 @@ bool ConsumedByIme(Surface* focus, const ui::KeyEvent* event) {
|
||||
}
|
||||
|
||||
bool IsVirtualKeyboardEnabled() {
|
||||
return WMHelper::GetInstance()->IsAccessibilityKeyboardEnabled() ||
|
||||
return keyboard::GetAccessibilityKeyboardEnabled() ||
|
||||
keyboard::GetTouchKeyboardEnabled();
|
||||
}
|
||||
|
||||
@ -156,11 +157,9 @@ Keyboard::Keyboard(KeyboardDelegate* delegate, Seat* seat)
|
||||
expiration_delay_for_pending_key_acks_(base::TimeDelta::FromMilliseconds(
|
||||
kExpirationDelayForPendingKeyAcksMs)),
|
||||
weak_ptr_factory_(this) {
|
||||
auto* helper = WMHelper::GetInstance();
|
||||
AddEventHandler();
|
||||
seat_->AddObserver(this);
|
||||
helper->AddAccessibilityObserver(this);
|
||||
helper->AddVirtualKeyboardControllerObserver(this);
|
||||
keyboard::KeyboardController::Get()->AddObserver(this);
|
||||
OnSurfaceFocused(seat_->GetFocusedSurface());
|
||||
}
|
||||
|
||||
@ -169,11 +168,9 @@ Keyboard::~Keyboard() {
|
||||
observer.OnKeyboardDestroying(this);
|
||||
if (focus_)
|
||||
focus_->RemoveSurfaceObserver(this);
|
||||
auto* helper = WMHelper::GetInstance();
|
||||
RemoveEventHandler();
|
||||
seat_->RemoveObserver(this);
|
||||
helper->RemoveVirtualKeyboardControllerObserver(this);
|
||||
helper->RemoveAccessibilityObserver(this);
|
||||
keyboard::KeyboardController::Get()->RemoveObserver(this);
|
||||
}
|
||||
|
||||
bool Keyboard::HasDeviceConfigurationDelegate() const {
|
||||
@ -183,7 +180,7 @@ bool Keyboard::HasDeviceConfigurationDelegate() const {
|
||||
void Keyboard::SetDeviceConfigurationDelegate(
|
||||
KeyboardDeviceConfigurationDelegate* delegate) {
|
||||
device_configuration_delegate_ = delegate;
|
||||
OnAccessibilityStatusChanged();
|
||||
OnKeyboardEnabledChanged(IsVirtualKeyboardEnabled());
|
||||
}
|
||||
|
||||
void Keyboard::AddObserver(KeyboardObserver* observer) {
|
||||
@ -336,19 +333,9 @@ void Keyboard::OnSurfaceFocused(Surface* gained_focus) {
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// AccessibilityObserver overrides:
|
||||
// keyboard::KeyboardControllerObserver overrides:
|
||||
|
||||
void Keyboard::OnAccessibilityStatusChanged() {
|
||||
if (device_configuration_delegate_) {
|
||||
device_configuration_delegate_->OnKeyboardTypeChanged(
|
||||
!IsVirtualKeyboardEnabled());
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// VirtualKeyboardController::Observer overrides:
|
||||
|
||||
void Keyboard::OnVirtualKeyboardStateChanged(bool enabled) {
|
||||
void Keyboard::OnKeyboardEnabledChanged(bool enabled) {
|
||||
if (device_configuration_delegate_)
|
||||
device_configuration_delegate_->OnKeyboardTypeChanged(!enabled);
|
||||
}
|
||||
|
@ -7,8 +7,6 @@
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "ash/accessibility/accessibility_observer.h"
|
||||
#include "ash/keyboard/virtual_keyboard_controller_observer.h"
|
||||
#include "base/containers/flat_map.h"
|
||||
#include "base/containers/flat_set.h"
|
||||
#include "base/macros.h"
|
||||
@ -18,6 +16,7 @@
|
||||
#include "components/exo/surface_observer.h"
|
||||
#include "ui/events/event.h"
|
||||
#include "ui/events/event_handler.h"
|
||||
#include "ui/keyboard/keyboard_controller_observer.h"
|
||||
|
||||
namespace ui {
|
||||
enum class DomCode;
|
||||
@ -35,8 +34,7 @@ class Surface;
|
||||
class Keyboard : public ui::EventHandler,
|
||||
public SurfaceObserver,
|
||||
public SeatObserver,
|
||||
public ash::AccessibilityObserver,
|
||||
public ash::VirtualKeyboardControllerObserver {
|
||||
public keyboard::KeyboardControllerObserver {
|
||||
public:
|
||||
Keyboard(KeyboardDelegate* delegate, Seat* seat);
|
||||
~Keyboard() override;
|
||||
@ -67,11 +65,8 @@ class Keyboard : public ui::EventHandler,
|
||||
void OnSurfaceFocusing(Surface* gaining_focus) override;
|
||||
void OnSurfaceFocused(Surface* gained_focus) override;
|
||||
|
||||
// Overridden from AccessibilityObserver:
|
||||
void OnAccessibilityStatusChanged() override;
|
||||
|
||||
// Overridden from VirtualKeyboardController::Observer
|
||||
void OnVirtualKeyboardStateChanged(bool enabled) override;
|
||||
// Overridden from keyboard::KeyboardControllerObserver
|
||||
void OnKeyboardEnabledChanged(bool is_enabled) override;
|
||||
|
||||
private:
|
||||
// Change keyboard focus to |surface|.
|
||||
|
@ -4,8 +4,6 @@
|
||||
|
||||
#include "components/exo/wm_helper.h"
|
||||
|
||||
#include "ash/accessibility/accessibility_controller.h"
|
||||
#include "ash/keyboard/virtual_keyboard_controller.h"
|
||||
#include "ash/shell.h"
|
||||
#include "ash/wm/tablet_mode/tablet_mode_controller.h"
|
||||
#include "base/memory/singleton.h"
|
||||
@ -54,15 +52,6 @@ bool WMHelper::HasInstance() {
|
||||
return !!g_instance;
|
||||
}
|
||||
|
||||
void WMHelper::AddAccessibilityObserver(ash::AccessibilityObserver* observer) {
|
||||
ash::Shell::Get()->accessibility_controller()->AddObserver(observer);
|
||||
}
|
||||
|
||||
void WMHelper::RemoveAccessibilityObserver(
|
||||
ash::AccessibilityObserver* observer) {
|
||||
ash::Shell::Get()->accessibility_controller()->RemoveObserver(observer);
|
||||
}
|
||||
|
||||
void WMHelper::AddActivationObserver(wm::ActivationChangeObserver* observer) {
|
||||
ash::Shell::Get()->activation_client()->AddObserver(observer);
|
||||
}
|
||||
@ -89,16 +78,6 @@ void WMHelper::RemoveTabletModeObserver(ash::TabletModeObserver* observer) {
|
||||
ash::Shell::Get()->tablet_mode_controller()->RemoveObserver(observer);
|
||||
}
|
||||
|
||||
void WMHelper::AddVirtualKeyboardControllerObserver(
|
||||
ash::VirtualKeyboardControllerObserver* observer) {
|
||||
ash::Shell::Get()->virtual_keyboard_controller()->AddObserver(observer);
|
||||
}
|
||||
|
||||
void WMHelper::RemoveVirtualKeyboardControllerObserver(
|
||||
ash::VirtualKeyboardControllerObserver* observer) {
|
||||
ash::Shell::Get()->virtual_keyboard_controller()->RemoveObserver(observer);
|
||||
}
|
||||
|
||||
void WMHelper::AddDisplayConfigurationObserver(
|
||||
ash::WindowTreeHostManager::Observer* observer) {
|
||||
ash::Shell::Get()->window_tree_host_manager()->AddObserver(observer);
|
||||
@ -241,10 +220,4 @@ double WMHelper::GetDefaultDeviceScaleFactor() const {
|
||||
return display_info.display_modes()[0].device_scale_factor();
|
||||
}
|
||||
|
||||
bool WMHelper::IsAccessibilityKeyboardEnabled() const {
|
||||
return ash::Shell::Get()
|
||||
->accessibility_controller()
|
||||
->IsVirtualKeyboardEnabled();
|
||||
}
|
||||
|
||||
} // namespace exo
|
||||
|
@ -15,9 +15,7 @@
|
||||
#include "ui/compositor/compositor_vsync_manager.h"
|
||||
|
||||
namespace ash {
|
||||
class AccessibilityObserver;
|
||||
class TabletModeObserver;
|
||||
class VirtualKeyboardControllerObserver;
|
||||
}
|
||||
|
||||
namespace aura {
|
||||
@ -71,18 +69,12 @@ class WMHelper : public aura::client::DragDropDelegate {
|
||||
|
||||
aura::Env* env() { return env_; }
|
||||
|
||||
void AddAccessibilityObserver(ash::AccessibilityObserver* observer);
|
||||
void RemoveAccessibilityObserver(ash::AccessibilityObserver* observer);
|
||||
void AddActivationObserver(wm::ActivationChangeObserver* observer);
|
||||
void RemoveActivationObserver(wm::ActivationChangeObserver* observer);
|
||||
void AddFocusObserver(aura::client::FocusChangeObserver* observer);
|
||||
void RemoveFocusObserver(aura::client::FocusChangeObserver* observer);
|
||||
void AddTabletModeObserver(ash::TabletModeObserver* observer);
|
||||
void RemoveTabletModeObserver(ash::TabletModeObserver* observer);
|
||||
void AddVirtualKeyboardControllerObserver(
|
||||
ash::VirtualKeyboardControllerObserver* observer);
|
||||
void RemoveVirtualKeyboardControllerObserver(
|
||||
ash::VirtualKeyboardControllerObserver* observer);
|
||||
|
||||
void AddDisplayConfigurationObserver(
|
||||
ash::WindowTreeHostManager::Observer* observer);
|
||||
@ -110,7 +102,6 @@ class WMHelper : public aura::client::DragDropDelegate {
|
||||
void RemovePostTargetHandler(ui::EventHandler* handler);
|
||||
bool IsTabletModeWindowManagerEnabled() const;
|
||||
double GetDefaultDeviceScaleFactor() const;
|
||||
bool IsAccessibilityKeyboardEnabled() const;
|
||||
|
||||
// Overridden from aura::client::DragDropDelegate:
|
||||
void OnDragEntered(const ui::DropTargetEvent& event) override;
|
||||
|
@ -751,7 +751,8 @@
|
||||
},
|
||||
{
|
||||
"args": [
|
||||
"--enable-features=SingleProcessMash"
|
||||
"--enable-features=SingleProcessMash",
|
||||
"--test-launcher-filter-file=../../testing/buildbot/filters/chromeos.single_process_mash.exo_unittests.filter"
|
||||
],
|
||||
"name": "single_process_mash_exo_unittests",
|
||||
"swarming": {
|
||||
@ -1456,7 +1457,8 @@
|
||||
},
|
||||
{
|
||||
"args": [
|
||||
"--enable-features=SingleProcessMash"
|
||||
"--enable-features=SingleProcessMash",
|
||||
"--test-launcher-filter-file=../../testing/buildbot/filters/chromeos.single_process_mash.exo_unittests.filter"
|
||||
],
|
||||
"name": "single_process_mash_exo_unittests",
|
||||
"swarming": {
|
||||
|
@ -4549,6 +4549,7 @@
|
||||
{
|
||||
"args": [
|
||||
"--enable-features=SingleProcessMash",
|
||||
"--test-launcher-filter-file=../../testing/buildbot/filters/chromeos.single_process_mash.exo_unittests.filter",
|
||||
"--test-launcher-print-test-stdio=always"
|
||||
],
|
||||
"name": "single_process_mash_exo_unittests",
|
||||
@ -5807,6 +5808,7 @@
|
||||
{
|
||||
"args": [
|
||||
"--enable-features=SingleProcessMash",
|
||||
"--test-launcher-filter-file=../../testing/buildbot/filters/chromeos.single_process_mash.exo_unittests.filter",
|
||||
"--test-launcher-print-test-stdio=always"
|
||||
],
|
||||
"name": "single_process_mash_exo_unittests",
|
||||
|
@ -72,6 +72,14 @@ source_set("content_browsertests_filters") {
|
||||
]
|
||||
}
|
||||
|
||||
source_set("exo_unittests_filters") {
|
||||
testonly = true
|
||||
|
||||
data = [
|
||||
"//testing/buildbot/filters/chromeos.single_process_mash.exo_unittests.filter",
|
||||
]
|
||||
}
|
||||
|
||||
source_set("fuchsia_filters") {
|
||||
data = [
|
||||
"//testing/buildbot/filters/fuchsia.content_unittests.filter",
|
||||
|
@ -87,6 +87,11 @@ Please use the following conventions when naming the new file:
|
||||
- Feel free to add other relevant things into the file name (e.g. the mode the
|
||||
file applies to - for example `site-per-process`).
|
||||
|
||||
When adding a new file, please update `//testing/buildbot/filters/BUILD.gn`.
|
||||
When adding a new filter file, you will need to:
|
||||
- Update `//testing/buildbot/filters/BUILD.gn`.
|
||||
- Add `//testing/buildbot/filters:foo_filters` to the appropriate test target.
|
||||
- Add `'--test-launcher-filter-file=../../testing/buildbot/filters/foo.filter'`
|
||||
to the desired test suite(s) in `test_suites.pyl`.
|
||||
- Run `testing/buildbot/generate_buildbot_json.py` to update .json files.
|
||||
|
||||
[gtest_filter]: https://github.com/google/googletest/blob/master/googletest/docs/advanced.md#running-a-subset-of-the-tests
|
||||
|
@ -0,0 +1,3 @@
|
||||
# These will fail until KeyboardController is enabled on SingleProcessMash.
|
||||
# https://crbug.com/843332
|
||||
-KeyboardTest.OnKeyboardTypeChanged*
|
@ -1754,6 +1754,7 @@
|
||||
'test': 'exo_unittests',
|
||||
'args': [
|
||||
'--enable-features=SingleProcessMash',
|
||||
'--test-launcher-filter-file=../../testing/buildbot/filters/chromeos.single_process_mash.exo_unittests.filter',
|
||||
],
|
||||
},
|
||||
'ui_chromeos_unittests': {},
|
||||
|
@ -221,6 +221,9 @@ void KeyboardController::EnableKeyboard(std::unique_ptr<KeyboardUI> ui,
|
||||
visual_bounds_in_screen_ = gfx::Rect();
|
||||
time_of_last_blur_ = base::Time::UnixEpoch();
|
||||
UpdateInputMethodObserver();
|
||||
|
||||
for (KeyboardControllerObserver& observer : observer_list_)
|
||||
observer.OnKeyboardEnabledChanged(true);
|
||||
}
|
||||
|
||||
void KeyboardController::DisableKeyboard() {
|
||||
@ -244,7 +247,7 @@ void KeyboardController::DisableKeyboard() {
|
||||
|
||||
ime_observer_.RemoveAll();
|
||||
for (KeyboardControllerObserver& observer : observer_list_)
|
||||
observer.OnKeyboardDisabled();
|
||||
observer.OnKeyboardEnabledChanged(false);
|
||||
ui_->SetController(nullptr);
|
||||
ui_.reset();
|
||||
}
|
||||
|
@ -67,10 +67,10 @@ class KEYBOARD_EXPORT KeyboardControllerObserver {
|
||||
virtual void OnKeyboardAppearanceChanged(
|
||||
const KeyboardStateDescriptor& state) {}
|
||||
|
||||
// Called when the keyboard is effectively disabled (i.e. when the UI / window
|
||||
// is destroyed, not when keyboard::IsKeyboardEnabled() changes), e.g. when
|
||||
// user switches convertible to laptop mode or the active user changes.
|
||||
virtual void OnKeyboardDisabled() {}
|
||||
// Called when the keyboard is enabled or disabled. NOTE: This is called
|
||||
// when Enabled() or Disabled() is called, not when the requested enabled
|
||||
// state (IsEnableRequested) changes.
|
||||
virtual void OnKeyboardEnabledChanged(bool is_enabled) {}
|
||||
|
||||
// Called when the keyboard has been hidden and the hiding animation finished
|
||||
// successfully. This is same as |state| == HIDDEN on OnStateChanged.
|
||||
|
@ -215,7 +215,9 @@ class KeyboardControllerTest : public aura::test::AuraTestBase,
|
||||
is_visible_ = is_visible;
|
||||
is_visible_number_of_calls_++;
|
||||
}
|
||||
void OnKeyboardDisabled() override { keyboard_disabled_ = true; }
|
||||
void OnKeyboardEnabledChanged(bool is_enabled) override {
|
||||
keyboard_disabled_ = !is_enabled;
|
||||
}
|
||||
void ClearKeyboardDisabled() { keyboard_disabled_ = false; }
|
||||
|
||||
int visible_bounds_number_of_calls() const {
|
||||
|
Reference in New Issue
Block a user