Chromium Code Reviews| OLD | NEW |
|---|---|
| 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_window_obj_wrapper.h" | 5 #include "ui/views/accessibility/ax_window_obj_wrapper.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "ui/accessibility/ax_node_data.h" | 10 #include "ui/accessibility/ax_node_data.h" |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 50 void AXWindowObjWrapper::Serialize(ui::AXNodeData* out_node_data) { | 50 void AXWindowObjWrapper::Serialize(ui::AXNodeData* out_node_data) { |
| 51 out_node_data->id = GetID(); | 51 out_node_data->id = GetID(); |
| 52 out_node_data->role = is_alert_ ? ui::AX_ROLE_ALERT : ui::AX_ROLE_WINDOW; | 52 out_node_data->role = is_alert_ ? ui::AX_ROLE_ALERT : ui::AX_ROLE_WINDOW; |
| 53 // TODO(dtseng): Set better states. | 53 // TODO(dtseng): Set better states. |
| 54 out_node_data->state = 0; | 54 out_node_data->state = 0; |
| 55 out_node_data->location = window_->bounds(); | 55 out_node_data->location = window_->bounds(); |
| 56 | 56 |
| 57 // Root windows currently have a non readable name (e.g. Display1234...); | 57 // Root windows currently have a non readable name (e.g. Display1234...); |
| 58 // ignore them unless the window is the only node in the tree. | 58 // ignore them unless the window is the only node in the tree. |
| 59 if (window_->parent() || window_->children().size() == 0) { | 59 if (window_->parent() || window_->children().size() == 0) { |
| 60 out_node_data->AddStringAttribute(ui::AX_ATTR_NAME, | 60 out_node_data->AddStringAttribute(ui::AX_ATTR_NAME, window_->name()); |
| 61 base::UTF16ToUTF8(window_->title())); | |
| 62 } | 61 } |
| 63 } | 62 } |
| 64 | 63 |
| 65 int32_t AXWindowObjWrapper::GetID() { | 64 int32_t AXWindowObjWrapper::GetID() { |
| 66 return AXAuraObjCache::GetInstance()->GetID(window_); | 65 return AXAuraObjCache::GetInstance()->GetID(window_); |
| 67 } | 66 } |
| 68 | 67 |
| 68 void AXWindowObjWrapper::OnWindowTitleChanged(aura::Window* window) { | |
| 69 AXAuraObjCache::GetInstance()->Remove(window); | |
|
dmazzoni
2016/05/25 15:18:00
Does it get re-added? Why delete it rather than tr
David Tseng
2016/05/25 16:08:23
Removed this; went with adding the name on the wid
| |
| 70 } | |
| 71 | |
| 69 void AXWindowObjWrapper::OnWindowDestroyed(aura::Window* window) { | 72 void AXWindowObjWrapper::OnWindowDestroyed(aura::Window* window) { |
| 70 AXAuraObjCache::GetInstance()->Remove(window); | 73 AXAuraObjCache::GetInstance()->Remove(window); |
| 71 } | 74 } |
| 72 | 75 |
| 73 } // namespace views | 76 } // namespace views |
| OLD | NEW |