summaryrefslogtreecommitdiffstats
path: root/chrome/browser/extensions/api/automation_internal/automation_event_router.cc
diff options
context:
space:
mode:
authordtseng <dtseng@chromium.org>2015-09-16 15:54:14 -0700
committerCommit bot <commit-bot@chromium.org>2015-09-16 22:54:43 +0000
commit8d79eb8530c150ec56350ee9ce95407b3f0ac3e5 (patch)
tree6974a606d3bdeb5990124bc582ab54afd0e1c772 /chrome/browser/extensions/api/automation_internal/automation_event_router.cc
parentcb6a15f2fde7e830e0a957dd58b9177f01647f32 (diff)
downloadchromium_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}
Diffstat (limited to 'chrome/browser/extensions/api/automation_internal/automation_event_router.cc')
-rw-r--r--chrome/browser/extensions/api/automation_internal/automation_event_router.cc20
1 files changed, 7 insertions, 13 deletions
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)