summaryrefslogtreecommitdiffstats
path: root/chrome/browser/ui/views/accessibility
diff options
context:
space:
mode:
authordtseng@chromium.org <dtseng@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-04-30 19:26:34 +0000
committerdtseng@chromium.org <dtseng@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-04-30 19:26:34 +0000
commit1d01dab1d63f5c7c23f2683f5f3783c087313f1d (patch)
tree703c4819fd18746cb714471e882608f139237294 /chrome/browser/ui/views/accessibility
parent67382c7a173ad65ca69e09da0cc28ec5adf368c0 (diff)
downloadchromium_src-1d01dab1d63f5c7c23f2683f5f3783c087313f1d.zip
chromium_src-1d01dab1d63f5c7c23f2683f5f3783c087313f1d.tar.gz
chromium_src-1d01dab1d63f5c7c23f2683f5f3783c087313f1d.tar.bz2
Extend AXTreeSourceViews to handle aura::Window and views::Widget.
initial patch BUG= Review URL: https://codereview.chromium.org/246433012 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@267297 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/ui/views/accessibility')
-rw-r--r--chrome/browser/ui/views/accessibility/automation_manager_views.cc76
-rw-r--r--chrome/browser/ui/views/accessibility/automation_manager_views.h49
2 files changed, 0 insertions, 125 deletions
diff --git a/chrome/browser/ui/views/accessibility/automation_manager_views.cc b/chrome/browser/ui/views/accessibility/automation_manager_views.cc
deleted file mode 100644
index 9b4812e..0000000
--- a/chrome/browser/ui/views/accessibility/automation_manager_views.cc
+++ /dev/null
@@ -1,76 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/browser/ui/views/accessibility/automation_manager_views.h"
-
-#include <vector>
-
-#include "base/command_line.h"
-#include "base/memory/singleton.h"
-#include "chrome/browser/browser_process.h"
-#include "chrome/browser/extensions/api/automation_internal/automation_util.h"
-#include "chrome/browser/profiles/profile.h"
-#include "chrome/browser/profiles/profile_manager.h"
-#include "chrome/common/chrome_switches.h"
-#include "content/public/browser/ax_event_notification_details.h"
-#include "ui/views/view.h"
-#include "ui/views/widget/widget.h"
-
-// static
-AutomationManagerViews* AutomationManagerViews::GetInstance() {
- return Singleton<AutomationManagerViews>::get();
-}
-
-void AutomationManagerViews::HandleEvent(Profile* profile,
- views::View* view,
- ui::AXEvent event_type) {
- if (!CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kEnableAutomationAPI)) {
- return;
- }
-
- // TODO(dtseng): Events should only be delivered to extensions with the
- // desktop permission.
- views::Widget* widget = view->GetWidget();
- if (!widget)
- return;
-
- if (!profile && g_browser_process->profile_manager()) {
- profile = g_browser_process->profile_manager()->GetLastUsedProfile();
- }
- if (!profile) {
- LOG(WARNING) << "Accessibility notification but no profile";
- return;
- }
-
- if (!current_tree_.get() ||
- current_tree_->GetRoot()->GetWidget() != widget) {
- current_tree_.reset(new views::AXTreeSourceViews(widget));
- current_tree_serializer_.reset(
- new ui::AXTreeSerializer<views::View*>(current_tree_.get()));
- // TODO(dtseng): Need to send a load complete and clear any previous desktop
- // trees.
- }
-
- ui::AXTreeUpdate out_update;
- current_tree_serializer_->SerializeChanges(view, &out_update);
-
- // Route this event to special process/routing ids recognized by the
- // Automation API as the desktop tree.
-
- // TODO(dtseng): Would idealy define these special desktop constants in idl.
- content::AXEventNotificationDetails detail(out_update.nodes,
- event_type,
- current_tree_->GetId(view),
- 0, /* process_id */
- 0 /* routing_id */);
- std::vector<content::AXEventNotificationDetails> details;
- details.push_back(detail);
- extensions::automation_util::DispatchAccessibilityEventsToAutomation(
- details, profile);
-}
-
-AutomationManagerViews::AutomationManagerViews() {}
-
-AutomationManagerViews:: ~AutomationManagerViews() {}
diff --git a/chrome/browser/ui/views/accessibility/automation_manager_views.h b/chrome/browser/ui/views/accessibility/automation_manager_views.h
deleted file mode 100644
index d2592ae..0000000
--- a/chrome/browser/ui/views/accessibility/automation_manager_views.h
+++ /dev/null
@@ -1,49 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CHROME_BROWSER_UI_VIEWS_ACCESSIBILITY_AUTOMATION_MANAGER_VIEWS_H_
-#define CHROME_BROWSER_UI_VIEWS_ACCESSIBILITY_AUTOMATION_MANAGER_VIEWS_H_
-
-#include "base/basictypes.h"
-#include "base/memory/scoped_ptr.h"
-
-#include "ui/accessibility/ax_tree_serializer.h"
-#include "ui/views/accessibility/ax_tree_source_views.h"
-
-template <typename T> struct DefaultSingletonTraits;
-
-class Profile;
-
-namespace views {
-class View;
-} // namespace views
-
-// Manages a tree of automation nodes.
-class AutomationManagerViews {
- public:
- // Get the single instance of this class.
- static AutomationManagerViews* GetInstance();
-
- // Handle an event fired upon a |View|.
- void HandleEvent(Profile* profile, views::View* view, ui::AXEvent event_type);
-
- private:
- friend struct DefaultSingletonTraits<AutomationManagerViews>;
-
- AutomationManagerViews();
- ~AutomationManagerViews();
-
- // Holds the active views-based accessibility tree. A tree currently consists
- // of all views descendant to a |Widget| (see |AXTreeSourceViews|).
- // A tree becomes active when an event is fired on a descendant view.
- scoped_ptr <views::AXTreeSourceViews> current_tree_;
-
- // Serializes incremental updates on the currently active tree
- // |current_tree_|.
- scoped_ptr<ui::AXTreeSerializer<views::View*> > current_tree_serializer_;
-
- DISALLOW_COPY_AND_ASSIGN(AutomationManagerViews);
-};
-
-#endif // CHROME_BROWSER_UI_VIEWS_ACCESSIBILITY_AUTOMATION_MANAGER_VIEWS_H_