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

Side by Side Diff: content/browser/accessibility/browser_accessibility_manager.cc

Issue 1893213004: Merge to M51: Prevent child frames from sending bad accessibility events. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2704
Patch Set: Created 4 years, 8 months 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 unified diff | Download patch
« no previous file with comments | « no previous file | content/browser/accessibility/browser_accessibility_manager_win.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/accessibility/browser_accessibility_manager.h" 5 #include "content/browser/accessibility/browser_accessibility_manager.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "build/build_config.h" 10 #include "build/build_config.h"
(...skipping 835 matching lines...) Expand 10 before | Expand all | Expand 10 after
846 846
847 // When the root changes and this is the root manager, we may need to 847 // When the root changes and this is the root manager, we may need to
848 // fire a new focus event. 848 // fire a new focus event.
849 if (root_changed && last_focused_manager_ == this) { 849 if (root_changed && last_focused_manager_ == this) {
850 last_focused_node_ = nullptr; 850 last_focused_node_ = nullptr;
851 last_focused_manager_ = nullptr; 851 last_focused_manager_ = nullptr;
852 } 852 }
853 } 853 }
854 854
855 BrowserAccessibilityManager* BrowserAccessibilityManager::GetRootManager() { 855 BrowserAccessibilityManager* BrowserAccessibilityManager::GetRootManager() {
856 if (!GetRoot()) 856 BrowserAccessibility* parent = GetParentNodeFromParentTree();
857 return nullptr; 857 if (!parent)
858 int parent_tree_id = GetTreeData().parent_tree_id; 858 return this;
859 BrowserAccessibilityManager* parent_manager = 859
860 BrowserAccessibilityManager::FromID(parent_tree_id); 860 return parent->manager()->GetRootManager();
861 if (parent_manager)
862 return parent_manager->GetRootManager();
863 return this;
864 } 861 }
865 862
866 BrowserAccessibilityDelegate* 863 BrowserAccessibilityDelegate*
867 BrowserAccessibilityManager::GetDelegateFromRootManager() { 864 BrowserAccessibilityManager::GetDelegateFromRootManager() {
868 BrowserAccessibilityManager* root_manager = GetRootManager(); 865 BrowserAccessibilityManager* root_manager = GetRootManager();
869 if (root_manager) 866 if (root_manager)
870 return root_manager->delegate(); 867 return root_manager->delegate();
871 return nullptr; 868 return nullptr;
872 } 869 }
873 870
874 ui::AXTreeUpdate 871 ui::AXTreeUpdate
875 BrowserAccessibilityManager::SnapshotAXTreeForTesting() { 872 BrowserAccessibilityManager::SnapshotAXTreeForTesting() {
876 scoped_ptr<ui::AXTreeSource<const ui::AXNode*, 873 scoped_ptr<ui::AXTreeSource<const ui::AXNode*,
877 ui::AXNodeData, 874 ui::AXNodeData,
878 ui::AXTreeData> > tree_source( 875 ui::AXTreeData> > tree_source(
879 tree_->CreateTreeSource()); 876 tree_->CreateTreeSource());
880 ui::AXTreeSerializer<const ui::AXNode*, 877 ui::AXTreeSerializer<const ui::AXNode*,
881 ui::AXNodeData, 878 ui::AXNodeData,
882 ui::AXTreeData> serializer(tree_source.get()); 879 ui::AXTreeData> serializer(tree_source.get());
883 ui::AXTreeUpdate update; 880 ui::AXTreeUpdate update;
884 serializer.SerializeChanges(tree_->root(), &update); 881 serializer.SerializeChanges(tree_->root(), &update);
885 return update; 882 return update;
886 } 883 }
887 884
888 } // namespace content 885 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/browser/accessibility/browser_accessibility_manager_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698