Commit bd0c79c3 authored by Qiang Xu's avatar Qiang Xu Committed by Commit Bot

cros: remove MagnificationManagerImpl

Changes:
This is a preparation CL. MagnificationManager could just be a concrete
class.

Bug: 817157
Test: compiles
Change-Id: If2d1e94e2679d220df142d115eaf36c93d456b6b
Reviewed-on: https://chromium-review.googlesource.com/1016321Reviewed-by: default avatarJames Cook <jamescook@chromium.org>
Commit-Queue: Qiang Xu <warx@google.com>
Cr-Commit-Position: refs/heads/master@{#551779}
parent f9bcb1e7
......@@ -5,8 +5,12 @@
#ifndef CHROME_BROWSER_CHROMEOS_ACCESSIBILITY_MAGNIFICATION_MANAGER_H_
#define CHROME_BROWSER_CHROMEOS_ACCESSIBILITY_MAGNIFICATION_MANAGER_H_
#include "chrome/browser/chromeos/accessibility/accessibility_manager.h"
#include "base/macros.h"
#include "components/user_manager/user_manager.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
class PrefChangeRegistrar;
class Profile;
namespace chromeos {
......@@ -19,7 +23,9 @@ namespace chromeos {
// desktop.
// - Watch change of the pref. When the pref changes, the setting of the
// magnifier will interlock with it.
class MagnificationManager {
class MagnificationManager
: public content::NotificationObserver,
public user_manager::UserManager::UserSessionStateObserver {
public:
// Creates an instance of MagnificationManager. This should be called once.
static void Initialize();
......@@ -31,21 +37,53 @@ class MagnificationManager {
static MagnificationManager* Get();
// Returns if the screen magnifier is enabled.
virtual bool IsMagnifierEnabled() const = 0;
bool IsMagnifierEnabled() const;
// Enables the screen magnifier.
virtual void SetMagnifierEnabled(bool enabled) = 0;
void SetMagnifierEnabled(bool enabled);
// Saves the magnifier scale to the pref.
virtual void SaveScreenMagnifierScale(double scale) = 0;
void SaveScreenMagnifierScale(double scale);
// Loads the magnifier scale from the pref.
virtual double GetSavedScreenMagnifierScale() const = 0;
double GetSavedScreenMagnifierScale() const;
virtual void SetProfileForTest(Profile* profile) = 0;
void SetProfileForTest(Profile* profile);
protected:
virtual ~MagnificationManager() {}
private:
MagnificationManager();
~MagnificationManager() override;
// content::NotificationObserver overrides:
void Observe(int type,
const content::NotificationSource& source,
const content::NotificationDetails& details) override;
// user_manager::UserManager::UserSessionStateObserver overrides:
void ActiveUserChanged(const user_manager::User* active_user) override;
void SetProfile(Profile* profile);
void SetMagnifierEnabledInternal(bool enabled);
void SetMagnifierKeepFocusCenteredInternal(bool keep_focus_centered);
void SetMagnifierScaleInternal(double scale);
void UpdateMagnifierFromPrefs();
void MonitorFocusInPageChange();
Profile* profile_ = nullptr;
bool enabled_ = false;
bool keep_focus_centered_ = false;
double scale_ = 0.0;
bool observing_focus_change_in_page_ = false;
content::NotificationRegistrar registrar_;
std::unique_ptr<PrefChangeRegistrar> pref_change_registrar_;
std::unique_ptr<user_manager::ScopedUserSessionStateObserver>
session_state_observer_;
DISALLOW_COPY_AND_ASSIGN(MagnificationManager);
};
} // namespace chromeos
......
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