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

Side by Side Diff: ui/views/accessibility/ax_aura_obj_cache.cc

Issue 1003283002: Enable chrome.automation.getDesktop on all aura platforms. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Actions. Created 5 years, 9 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 | « ui/views/accessibility/ax_aura_obj_cache.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "ui/views/accessibility/ax_aura_obj_cache.h" 5 #include "ui/views/accessibility/ax_aura_obj_cache.h"
6 6
7 #include "base/memory/singleton.h" 7 #include "base/memory/singleton.h"
8 #include "base/stl_util.h" 8 #include "base/stl_util.h"
9 #include "ui/aura/window.h" 9 #include "ui/aura/window.h"
10 #include "ui/views/accessibility/ax_aura_obj_wrapper.h" 10 #include "ui/views/accessibility/ax_aura_obj_wrapper.h"
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 void AXAuraObjCache::Remove(int32 id) { 69 void AXAuraObjCache::Remove(int32 id) {
70 AXAuraObjWrapper* obj = Get(id); 70 AXAuraObjWrapper* obj = Get(id);
71 71
72 if (id == -1 || !obj) 72 if (id == -1 || !obj)
73 return; 73 return;
74 74
75 cache_.erase(id); 75 cache_.erase(id);
76 delete obj; 76 delete obj;
77 } 77 }
78 78
79 void AXAuraObjCache::GetTopLevelWindows(
80 std::vector<AXAuraObjWrapper*>* children) {
81 for (std::map<aura::Window*, int32>::iterator it = window_to_id_map_.begin();
82 it != window_to_id_map_.end(); ++it) {
83 if (!it->first->parent())
84 children->push_back(GetOrCreate(it->first));
85 }
86 }
87
79 AXAuraObjCache::AXAuraObjCache() : current_id_(1), is_destroying_(false) { 88 AXAuraObjCache::AXAuraObjCache() : current_id_(1), is_destroying_(false) {
80 } 89 }
81 90
82 AXAuraObjCache::~AXAuraObjCache() { 91 AXAuraObjCache::~AXAuraObjCache() {
83 is_destroying_ = true; 92 is_destroying_ = true;
84 STLDeleteContainerPairSecondPointers(cache_.begin(), cache_.end()); 93 STLDeleteContainerPairSecondPointers(cache_.begin(), cache_.end());
85 cache_.clear(); 94 cache_.clear();
86 } 95 }
87 96
88 template <typename AuraViewWrapper, typename AuraView> 97 template <typename AuraViewWrapper, typename AuraView>
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 void AXAuraObjCache::RemoveInternal( 131 void AXAuraObjCache::RemoveInternal(
123 AuraView* aura_view, std::map<AuraView*, int32>& aura_view_to_id_map) { 132 AuraView* aura_view, std::map<AuraView*, int32>& aura_view_to_id_map) {
124 int32 id = GetID(aura_view); 133 int32 id = GetID(aura_view);
125 if (id == -1) 134 if (id == -1)
126 return; 135 return;
127 aura_view_to_id_map.erase(aura_view); 136 aura_view_to_id_map.erase(aura_view);
128 Remove(id); 137 Remove(id);
129 } 138 }
130 139
131 } // namespace views 140 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/accessibility/ax_aura_obj_cache.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698