| 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 "third_party/skia/include/core/SkPaint.h" | 7 #include "third_party/skia/include/core/SkPaint.h" |
| 8 #include "third_party/skia/include/core/SkPath.h" | 8 #include "third_party/skia/include/core/SkPath.h" |
| 9 #include "ui/accessibility/ax_view_state.h" | 9 #include "ui/accessibility/ax_view_state.h" |
| 10 #include "ui/gfx/canvas.h" | 10 #include "ui/gfx/canvas.h" |
| 11 #include "ui/native_theme/native_theme_aura.h" |
| 11 #include "ui/views/border.h" | 12 #include "ui/views/border.h" |
| 12 #include "ui/views/bubble/bubble_border.h" | 13 #include "ui/views/bubble/bubble_border.h" |
| 13 #include "ui/views/controls/menu/menu_config.h" | 14 #include "ui/views/controls/menu/menu_config.h" |
| 14 #include "ui/views/controls/menu/menu_controller.h" | 15 #include "ui/views/controls/menu/menu_controller.h" |
| 15 #include "ui/views/controls/menu/menu_item_view.h" | 16 #include "ui/views/controls/menu/menu_item_view.h" |
| 16 #include "ui/views/controls/menu/submenu_view.h" | 17 #include "ui/views/controls/menu/submenu_view.h" |
| 17 #include "ui/views/round_rect_painter.h" | 18 #include "ui/views/round_rect_painter.h" |
| 18 | 19 |
| 19 #if defined(USE_AURA) | |
| 20 #include "ui/native_theme/native_theme_aura.h" | |
| 21 #endif | |
| 22 | |
| 23 using ui::NativeTheme; | 20 using ui::NativeTheme; |
| 24 | 21 |
| 25 namespace views { | 22 namespace views { |
| 26 | 23 |
| 27 namespace { | 24 namespace { |
| 28 | 25 |
| 29 static const int kBorderPaddingDueToRoundedCorners = 1; | 26 static const int kBorderPaddingDueToRoundedCorners = 1; |
| 30 | 27 |
| 31 // MenuScrollButton ------------------------------------------------------------ | 28 // MenuScrollButton ------------------------------------------------------------ |
| 32 | 29 |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 277 arrow_ = BubbleBorder::NONE; | 274 arrow_ = BubbleBorder::NONE; |
| 278 bubble_border_ = NULL; | 275 bubble_border_ = NULL; |
| 279 | 276 |
| 280 const MenuConfig& menu_config = | 277 const MenuConfig& menu_config = |
| 281 content_view_->GetMenuItem()->GetMenuConfig(); | 278 content_view_->GetMenuItem()->GetMenuConfig(); |
| 282 | 279 |
| 283 bool use_border = true; | 280 bool use_border = true; |
| 284 int padding = menu_config.corner_radius > 0 ? | 281 int padding = menu_config.corner_radius > 0 ? |
| 285 kBorderPaddingDueToRoundedCorners : 0; | 282 kBorderPaddingDueToRoundedCorners : 0; |
| 286 | 283 |
| 287 #if defined(USE_AURA) | |
| 288 if (menu_config.native_theme == ui::NativeThemeAura::instance()) { | 284 if (menu_config.native_theme == ui::NativeThemeAura::instance()) { |
| 289 // In case of NativeThemeAura the border gets drawn with the shadow. | 285 // In case of NativeThemeAura the border gets drawn with the shadow. |
| 290 // Furthermore no additional padding is wanted. | 286 // Furthermore no additional padding is wanted. |
| 291 use_border = false; | 287 use_border = false; |
| 292 padding = 0; | 288 padding = 0; |
| 293 } | 289 } |
| 294 #endif | |
| 295 | 290 |
| 296 int top = menu_config.menu_vertical_border_size + padding; | 291 int top = menu_config.menu_vertical_border_size + padding; |
| 297 int left = menu_config.menu_horizontal_border_size + padding; | 292 int left = menu_config.menu_horizontal_border_size + padding; |
| 298 int bottom = menu_config.menu_vertical_border_size + padding; | 293 int bottom = menu_config.menu_vertical_border_size + padding; |
| 299 int right = menu_config.menu_horizontal_border_size + padding; | 294 int right = menu_config.menu_horizontal_border_size + padding; |
| 300 | 295 |
| 301 if (use_border) { | 296 if (use_border) { |
| 302 SetBorder(views::Border::CreateBorderPainter( | 297 SetBorder(views::Border::CreateBorderPainter( |
| 303 new views::RoundRectPainter( | 298 new views::RoundRectPainter( |
| 304 menu_config.native_theme->GetSystemColor( | 299 menu_config.native_theme->GetSystemColor( |
| (...skipping 24 matching lines...) Expand all Loading... |
| 329 case views::MenuItemView::BUBBLE_ABOVE: | 324 case views::MenuItemView::BUBBLE_ABOVE: |
| 330 return BubbleBorder::BOTTOM_CENTER; | 325 return BubbleBorder::BOTTOM_CENTER; |
| 331 case views::MenuItemView::BUBBLE_BELOW: | 326 case views::MenuItemView::BUBBLE_BELOW: |
| 332 return BubbleBorder::TOP_CENTER; | 327 return BubbleBorder::TOP_CENTER; |
| 333 default: | 328 default: |
| 334 return BubbleBorder::NONE; | 329 return BubbleBorder::NONE; |
| 335 } | 330 } |
| 336 } | 331 } |
| 337 | 332 |
| 338 } // namespace views | 333 } // namespace views |
| OLD | NEW |