diff options
author | dtseng <dtseng@chromium.org> | 2015-09-16 15:54:14 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-09-16 22:54:43 +0000 |
commit | 8d79eb8530c150ec56350ee9ce95407b3f0ac3e5 (patch) | |
tree | 6974a606d3bdeb5990124bc582ab54afd0e1c772 | |
parent | cb6a15f2fde7e830e0a957dd58b9177f01647f32 (diff) | |
download | chromium_src-8d79eb8530c150ec56350ee9ce95407b3f0ac3e5.zip chromium_src-8d79eb8530c150ec56350ee9ce95407b3f0ac3e5.tar.gz chromium_src-8d79eb8530c150ec56350ee9ce95407b3f0ac3e5.tar.bz2 |
Fix profile resolution in AutomationEventRouter
BUG=532602
Review URL: https://codereview.chromium.org/1348833002
Cr-Commit-Position: refs/heads/master@{#349264}
3 files changed, 9 insertions, 34 deletions
diff --git a/chrome/browser/chromeos/accessibility/spoken_feedback_event_rewriter.cc b/chrome/browser/chromeos/accessibility/spoken_feedback_event_rewriter.cc index ba7dc7d..601cfeb 100644 --- a/chrome/browser/chromeos/accessibility/spoken_feedback_event_rewriter.cc +++ b/chrome/browser/chromeos/accessibility/spoken_feedback_event_rewriter.cc @@ -30,8 +30,7 @@ bool SpokenFeedbackEventRewriterDelegate::DispatchKeyEventToChromeVox( if (!chromeos::AccessibilityManager::Get()) return false; - content::BrowserContext* context = - chromeos::AccessibilityManager::Get()->profile(); + content::BrowserContext* context = ProfileManager::GetActiveUserProfile(); if (!context) return false; diff --git a/chrome/browser/extensions/api/automation_internal/automation_event_router.cc b/chrome/browser/extensions/api/automation_internal/automation_event_router.cc index 8ac1fdb..d3af41d 100644 --- a/chrome/browser/extensions/api/automation_internal/automation_event_router.cc +++ b/chrome/browser/extensions/api/automation_internal/automation_event_router.cc @@ -30,16 +30,12 @@ AutomationEventRouter* AutomationEventRouter::GetInstance() { base::LeakySingletonTraits<AutomationEventRouter>>::get(); } -AutomationEventRouter::AutomationEventRouter() { +AutomationEventRouter::AutomationEventRouter() + : active_profile_(ProfileManager::GetActiveUserProfile()) { registrar_.Add(this, content::NOTIFICATION_RENDERER_PROCESS_TERMINATED, content::NotificationService::AllBrowserContextsAndSources()); registrar_.Add(this, content::NOTIFICATION_RENDERER_PROCESS_CLOSED, content::NotificationService::AllBrowserContextsAndSources()); - active_profile_ = ProfileManager::GetLastUsedProfile(); - -#if defined(OS_CHROMEOS) - session_state_observer_.reset(new ash::ScopedSessionStateObserver(this)); -#endif } AutomationEventRouter::~AutomationEventRouter() { @@ -70,6 +66,11 @@ void AutomationEventRouter::RegisterListenerWithDesktopPermission( void AutomationEventRouter::DispatchAccessibilityEvent( const ExtensionMsg_AccessibilityEventParams& params) { + if (active_profile_ != ProfileManager::GetActiveUserProfile()) { + active_profile_ = ProfileManager::GetActiveUserProfile(); + UpdateActiveProfile(); + } + for (const auto& listener : listeners_) { // Skip listeners that don't want to listen to this tree. if (!listener.desktop && @@ -163,13 +164,6 @@ void AutomationEventRouter::Observe( UpdateActiveProfile(); } -#if defined(OS_CHROMEOS) -void AutomationEventRouter::ActiveUserChanged(const std::string& user_id) { - active_profile_ = ProfileManager::GetLastUsedProfile(); - UpdateActiveProfile(); -} -#endif - void AutomationEventRouter::UpdateActiveProfile() { for (auto& listener : listeners_) { #if defined(OS_CHROMEOS) diff --git a/chrome/browser/extensions/api/automation_internal/automation_event_router.h b/chrome/browser/extensions/api/automation_internal/automation_event_router.h index 2b38eb6..ff3ac1f3 100644 --- a/chrome/browser/extensions/api/automation_internal/automation_event_router.h +++ b/chrome/browser/extensions/api/automation_internal/automation_event_router.h @@ -14,10 +14,6 @@ #include "content/public/browser/notification_registrar.h" #include "extensions/common/extension.h" -#if defined(OS_CHROMEOS) -#include "ash/session/session_state_observer.h" -#endif - class Profile; namespace content { @@ -30,12 +26,7 @@ namespace extensions { struct AutomationListener; -class AutomationEventRouter - : public content::NotificationObserver -#if defined(OS_CHROMEOS) - , public ash::SessionStateObserver -#endif -{ +class AutomationEventRouter : public content::NotificationObserver { public: static AutomationEventRouter* GetInstance(); @@ -92,11 +83,6 @@ class AutomationEventRouter const content::NotificationSource& source, const content::NotificationDetails& details) override; -#if defined(OS_CHROMEOS) - // SessionStateObserver overrides: - void ActiveUserChanged(const std::string& user_id) override; -#endif - // Called when the user switches profiles or when a listener is added // or removed. The purpose is to ensure that multiple instances of the // same extension running in different profiles don't interfere with one @@ -114,10 +100,6 @@ class AutomationEventRouter Profile* active_profile_; -#if defined(OS_CHROMEOS) - scoped_ptr<ash::ScopedSessionStateObserver> session_state_observer_; -#endif - friend struct base::DefaultSingletonTraits<AutomationEventRouter>; DISALLOW_COPY_AND_ASSIGN(AutomationEventRouter); |