| 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 "ui/views/controls/menu/menu_scroll_view_container.h" | 5 #include "ui/views/controls/menu/menu_scroll_view_container.h" |
| 6 | 6 |
| 7 #include "base/macros.h" | 7 #include "base/macros.h" |
| 8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
| 9 #include "third_party/skia/include/core/SkPaint.h" | 9 #include "third_party/skia/include/core/SkPaint.h" |
| 10 #include "third_party/skia/include/core/SkPath.h" | 10 #include "third_party/skia/include/core/SkPath.h" |
| 11 #include "ui/accessibility/ax_view_state.h" | 11 #include "ui/accessibility/ax_node_data.h" |
| 12 #include "ui/gfx/canvas.h" | 12 #include "ui/gfx/canvas.h" |
| 13 #include "ui/gfx/color_palette.h" | 13 #include "ui/gfx/color_palette.h" |
| 14 #include "ui/views/border.h" | 14 #include "ui/views/border.h" |
| 15 #include "ui/views/bubble/bubble_border.h" | 15 #include "ui/views/bubble/bubble_border.h" |
| 16 #include "ui/views/controls/menu/menu_config.h" | 16 #include "ui/views/controls/menu/menu_config.h" |
| 17 #include "ui/views/controls/menu/menu_controller.h" | 17 #include "ui/views/controls/menu/menu_controller.h" |
| 18 #include "ui/views/controls/menu/menu_item_view.h" | 18 #include "ui/views/controls/menu/menu_item_view.h" |
| 19 #include "ui/views/controls/menu/submenu_view.h" | 19 #include "ui/views/controls/menu/submenu_view.h" |
| 20 #include "ui/views/round_rect_painter.h" | 20 #include "ui/views/round_rect_painter.h" |
| 21 | 21 |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 } | 249 } |
| 250 | 250 |
| 251 gfx::Rect bounds(0, 0, width(), height()); | 251 gfx::Rect bounds(0, 0, width(), height()); |
| 252 NativeTheme::ExtraParams extra; | 252 NativeTheme::ExtraParams extra; |
| 253 const MenuConfig& menu_config = MenuConfig::instance(); | 253 const MenuConfig& menu_config = MenuConfig::instance(); |
| 254 extra.menu_background.corner_radius = menu_config.corner_radius; | 254 extra.menu_background.corner_radius = menu_config.corner_radius; |
| 255 GetNativeTheme()->Paint(canvas->sk_canvas(), | 255 GetNativeTheme()->Paint(canvas->sk_canvas(), |
| 256 NativeTheme::kMenuPopupBackground, NativeTheme::kNormal, bounds, extra); | 256 NativeTheme::kMenuPopupBackground, NativeTheme::kNormal, bounds, extra); |
| 257 } | 257 } |
| 258 | 258 |
| 259 void MenuScrollViewContainer::GetAccessibleState( | 259 void MenuScrollViewContainer::GetAccessibleNodeData(ui::AXNodeData* node_data) { |
| 260 ui::AXViewState* state) { | |
| 261 // Get the name from the submenu view. | 260 // Get the name from the submenu view. |
| 262 content_view_->GetAccessibleState(state); | 261 content_view_->GetAccessibleNodeData(node_data); |
| 263 state->role = ui::AX_ROLE_MENU_BAR; | 262 node_data->role = ui::AX_ROLE_MENU_BAR; |
| 264 } | 263 } |
| 265 | 264 |
| 266 void MenuScrollViewContainer::OnBoundsChanged( | 265 void MenuScrollViewContainer::OnBoundsChanged( |
| 267 const gfx::Rect& previous_bounds) { | 266 const gfx::Rect& previous_bounds) { |
| 268 gfx::Size content_pref = scroll_view_->GetContents()->GetPreferredSize(); | 267 gfx::Size content_pref = scroll_view_->GetContents()->GetPreferredSize(); |
| 269 scroll_up_button_->SetVisible(content_pref.height() > height()); | 268 scroll_up_button_->SetVisible(content_pref.height() > height()); |
| 270 scroll_down_button_->SetVisible(content_pref.height() > height()); | 269 scroll_down_button_->SetVisible(content_pref.height() > height()); |
| 271 Layout(); | 270 Layout(); |
| 272 } | 271 } |
| 273 | 272 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 318 case MENU_ANCHOR_BUBBLE_ABOVE: | 317 case MENU_ANCHOR_BUBBLE_ABOVE: |
| 319 return BubbleBorder::BOTTOM_CENTER; | 318 return BubbleBorder::BOTTOM_CENTER; |
| 320 case MENU_ANCHOR_BUBBLE_BELOW: | 319 case MENU_ANCHOR_BUBBLE_BELOW: |
| 321 return BubbleBorder::TOP_CENTER; | 320 return BubbleBorder::TOP_CENTER; |
| 322 default: | 321 default: |
| 323 return BubbleBorder::NONE; | 322 return BubbleBorder::NONE; |
| 324 } | 323 } |
| 325 } | 324 } |
| 326 | 325 |
| 327 } // namespace views | 326 } // namespace views |
| OLD | NEW |