Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8)

Unified Diff: chrome/browser/chromeos/system/ash_system_tray_delegate.cc

Issue 11280287: Magnifier: Prevent useless operation in enabling/disabling magnifier. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: fix test failure (MagnificationManagerTest.ChangeMagnifierType) Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/chromeos/chrome_browser_main_chromeos.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/system/ash_system_tray_delegate.cc
diff --git a/chrome/browser/chromeos/system/ash_system_tray_delegate.cc b/chrome/browser/chromeos/system/ash_system_tray_delegate.cc
index 7a739e6fd723e845331a460be9bc9ccd0de07182..cd4afa56aac54032c00cb963f178286794f64e22 100644
--- a/chrome/browser/chromeos/system/ash_system_tray_delegate.cc
+++ b/chrome/browser/chromeos/system/ash_system_tray_delegate.cc
@@ -32,6 +32,7 @@
#include "base/utf_string_conversions.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/chromeos/accessibility/accessibility_util.h"
+#include "chrome/browser/chromeos/accessibility/magnification_manager.h"
#include "chrome/browser/chromeos/audio/audio_handler.h"
#include "chrome/browser/chromeos/cros/cros_library.h"
#include "chrome/browser/chromeos/cros/network_library.h"
@@ -163,7 +164,8 @@ class SystemTrayDelegate : public ash::SystemTrayDelegate,
public system::TimezoneSettings::Observer,
public device::BluetoothAdapter::Observer,
public SystemKeyEventListener::CapsLockObserver,
- public ash::NetworkTrayDelegate {
+ public ash::NetworkTrayDelegate,
+ public MagnificationObserver {
public:
SystemTrayDelegate()
: ui_weak_ptr_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(
@@ -219,6 +221,9 @@ class SystemTrayDelegate : public ash::SystemTrayDelegate,
if (SystemKeyEventListener::GetInstance())
SystemKeyEventListener::GetInstance()->AddCapsLockObserver(this);
+ if (chromeos::MagnificationManager::Get())
+ chromeos::MagnificationManager::Get()->AddObserver(this);
+
spoken_feedback_enabled_.Init(
prefs::kSpokenFeedbackEnabled,
g_browser_process->local_state(),
@@ -254,6 +259,9 @@ class SystemTrayDelegate : public ash::SystemTrayDelegate,
SystemKeyEventListener::GetInstance()->RemoveCapsLockObserver(this);
bluetooth_adapter_->RemoveObserver(this);
+ if (chromeos::MagnificationManager::Get())
+ chromeos::MagnificationManager::Get()->RemoveObserver(this);
+
// Stop observing gdata operations.
DriveSystemService* system_service = FindDriveSystemService();
if (system_service) {
@@ -788,10 +796,6 @@ class SystemTrayDelegate : public ash::SystemTrayDelegate,
base::Bind(&SystemTrayDelegate::UpdateShowLogoutButtonInTray,
base::Unretained(this)));
pref_registrar_->Add(
- prefs::kMagnifierType,
- base::Bind(&SystemTrayDelegate::OnAccessibilityModeChanged,
- base::Unretained(this)));
- pref_registrar_->Add(
prefs::kShouldAlwaysShowAccessibilityMenu,
base::Bind(&SystemTrayDelegate::OnAccessibilityModeChanged,
base::Unretained(this)));
@@ -1269,6 +1273,11 @@ class SystemTrayDelegate : public ash::SystemTrayDelegate,
}
}
+ // Overridden from MagnificationObserver
+ void OnMagnifierTypeChanged(ash::MagnifierType new_type) {
+ OnAccessibilityModeChanged();
+ }
+
scoped_ptr<base::WeakPtrFactory<SystemTrayDelegate> > ui_weak_ptr_factory_;
scoped_ptr<NetworkMenuIcon> network_icon_;
scoped_ptr<NetworkMenuIcon> network_icon_dark_;
« no previous file with comments | « chrome/browser/chromeos/chrome_browser_main_chromeos.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698