Commit 7a4406b3 authored by David Tseng's avatar David Tseng Committed by Commit Bot

Revert "Makes magnifier observe AXEventManager for focus changes"

This reverts commit 217c3a78.

Reason for revert: <INSERT REASONING HERE>
crbug.com/1016132

Original change's description:
> Makes magnifier observe AXEventManager for focus changes
> 
> Bug: 865575
> Change-Id: I8d8328a459d7621d6fc0a0d65e0f24f788b9767f
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1852414
> Commit-Queue: David Tseng <dtseng@chromium.org>
> Reviewed-by: Dominic Mazzoni <dmazzoni@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#704854}

TBR=dmazzoni@chromium.org,dtseng@chromium.org

# Not skipping CQ checks because original CL landed > 1 day ago.

Bug: 865575,1016132
Change-Id: Id77035499da1e2b36c1216b622eb8f341449406b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1875449Reviewed-by: default avatarDavid Tseng <dtseng@chromium.org>
Commit-Queue: David Tseng <dtseng@chromium.org>
Cr-Commit-Position: refs/heads/master@{#708525}
parent 2f4a30aa
......@@ -25,7 +25,6 @@
#include "content/public/browser/notification_source.h"
#include "content/public/common/service_manager_connection.h"
#include "services/service_manager/public/cpp/connector.h"
#include "ui/views/accessibility/ax_event_manager.h"
namespace chromeos {
......@@ -99,18 +98,6 @@ void MagnificationManager::OnProfileWillBeDestroyed(Profile* profile) {
SetProfile(nullptr);
}
void MagnificationManager::OnViewEvent(views::View* view,
ax::mojom::Event event_type) {
if (!fullscreen_magnifier_enabled_ && !IsDockedMagnifierEnabled())
return;
if (event_type != ax::mojom::Event::kFocus &&
event_type != ax::mojom::Event::kSelection)
return;
HandleFocusChanged(view->GetBoundsInScreen(), false);
}
void MagnificationManager::SetProfileForTest(Profile* profile) {
SetProfile(profile);
}
......@@ -123,12 +110,10 @@ MagnificationManager::MagnificationManager() {
registrar_.Add(this, content::NOTIFICATION_FOCUS_CHANGED_IN_PAGE,
content::NotificationService::AllSources());
user_manager::UserManager::Get()->AddSessionStateObserver(this);
views::AXEventManager::Get()->AddObserver(this);
}
MagnificationManager::~MagnificationManager() {
CHECK(this == g_magnification_manager);
views::AXEventManager::Get()->RemoveObserver(this);
user_manager::UserManager::Get()->RemoveSessionStateObserver(this);
}
......@@ -296,22 +281,17 @@ void MagnificationManager::HandleFocusChangedInPage(
if (node_details->is_editable_node)
return;
HandleFocusChanged(node_details->node_bounds_in_screen,
node_details->is_editable_node);
}
void MagnificationManager::HandleFocusChanged(const gfx::Rect& bounds_in_screen,
bool is_editable) {
const gfx::Rect& bounds_in_screen = node_details->node_bounds_in_screen;
if (bounds_in_screen.IsEmpty())
return;
// Fullscreen magnifier and docked magnifier are mutually exclusive.
if (fullscreen_magnifier_enabled_) {
ash::Shell::Get()->magnification_controller()->HandleFocusedNodeChanged(
is_editable, bounds_in_screen);
node_details->is_editable_node, node_details->node_bounds_in_screen);
return;
}
DCHECK(IsDockedMagnifierEnabled());
DCHECK(docked_magnifier_enabled);
ash::DockedMagnifierController::Get()->CenterOnPoint(
bounds_in_screen.CenterPoint());
}
......
......@@ -13,7 +13,6 @@
#include "components/user_manager/user_manager.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
#include "ui/views/accessibility/ax_event_observer.h"
class PrefChangeRegistrar;
......@@ -34,8 +33,7 @@ namespace chromeos {
class MagnificationManager
: public content::NotificationObserver,
public user_manager::UserManager::UserSessionStateObserver,
public ProfileObserver,
public views::AXEventObserver {
public ProfileObserver {
public:
// Creates an instance of MagnificationManager. This should be called once.
static void Initialize();
......@@ -67,9 +65,6 @@ class MagnificationManager
// ProfileObserver:
void OnProfileWillBeDestroyed(Profile* profile) override;
// views::AXEventObserver:
void OnViewEvent(views::View* view, ax::mojom::Event event_type) override;
void SetProfileForTest(Profile* profile);
private:
......@@ -96,9 +91,6 @@ class MagnificationManager
// Called when received content::NOTIFICATION_FOCUS_CHANGED_IN_PAGE.
void HandleFocusChangedInPage(const content::NotificationDetails& details);
// Called in response to AXEventObserver.
void HandleFocusChanged(const gfx::Rect& bounds_in_screen, bool is_editable);
Profile* profile_ = nullptr;
ScopedObserver<Profile, ProfileObserver> profile_observer_{this};
......
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