Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 "ash/common/system/tray/tray_utils.h" | 5 #include "ash/common/system/tray/tray_utils.h" |
| 6 | 6 |
| 7 #include "ash/common/material_design/material_design_controller.h" | 7 #include "ash/common/material_design/material_design_controller.h" |
| 8 #include "ash/common/shelf/wm_shelf_util.h" | 8 #include "ash/common/shelf/wm_shelf_util.h" |
| 9 #include "ash/common/system/tray/tray_constants.h" | 9 #include "ash/common/system/tray/tray_constants.h" |
| 10 #include "ash/common/system/tray/tray_item_view.h" | 10 #include "ash/common/system/tray/tray_item_view.h" |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 67 int horizontal_padding = | 67 int horizontal_padding = |
| 68 std::max(0, (tray_view->GetPreferredSize().width() - | 68 std::max(0, (tray_view->GetPreferredSize().width() - |
| 69 tray_view->label()->GetPreferredSize().width()) / | 69 tray_view->label()->GetPreferredSize().width()) / |
| 70 2); | 70 2); |
| 71 tray_view->SetBorder(views::CreateEmptyBorder( | 71 tray_view->SetBorder(views::CreateEmptyBorder( |
| 72 kTrayLabelItemVerticalPaddingVerticalAlignment, horizontal_padding, | 72 kTrayLabelItemVerticalPaddingVerticalAlignment, horizontal_padding, |
| 73 kTrayLabelItemVerticalPaddingVerticalAlignment, horizontal_padding)); | 73 kTrayLabelItemVerticalPaddingVerticalAlignment, horizontal_padding)); |
| 74 } | 74 } |
| 75 } | 75 } |
| 76 | 76 |
| 77 void GetAccessibleLabelFromDescendantViews( | |
| 78 views::View* view, | |
| 79 std::vector<base::string16>& out_labels) { | |
| 80 ui::AXNodeData temp_node_data; | |
| 81 view->GetAccessibleNodeData(&temp_node_data); | |
| 82 if (!temp_node_data.GetStringAttribute(ui::AX_ATTR_NAME).empty()) | |
| 83 out_labels.push_back(temp_node_data.GetString16Attribute(ui::AX_ATTR_NAME)); | |
| 84 | |
| 85 // Do not descend into static text labels which may compute their own labels | |
| 86 // recursively. | |
| 87 if (temp_node_data.role == ui::AX_ROLE_STATIC_TEXT) | |
| 88 return; | |
| 89 | |
| 90 for (int i = 0; i < view->child_count(); ++i) | |
| 91 GetAccessibleLabelFromDescendantViews(view->child_at(i), out_labels); | |
|
Evan Stade
2017/02/09 17:45:07
recursion really bothers me
| |
| 92 } | |
| 93 | |
| 94 } // namespace ash | 77 } // namespace ash |
| OLD | NEW |