Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / ui / views / controls / menu / menu_scroll_view_container.cc
index 7b8edbe..a69b6f0 100644 (file)
@@ -6,8 +6,9 @@
 
 #include "third_party/skia/include/core/SkPaint.h"
 #include "third_party/skia/include/core/SkPath.h"
-#include "ui/base/accessibility/accessible_view_state.h"
+#include "ui/accessibility/ax_view_state.h"
 #include "ui/gfx/canvas.h"
+#include "ui/native_theme/native_theme_aura.h"
 #include "ui/views/border.h"
 #include "ui/views/bubble/bubble_border.h"
 #include "ui/views/controls/menu/menu_config.h"
 #include "ui/views/controls/menu/submenu_view.h"
 #include "ui/views/round_rect_painter.h"
 
-#if defined(USE_AURA)
-#include "ui/native_theme/native_theme_aura.h"
-#endif
-
 using ui::NativeTheme;
 
 namespace views {
@@ -43,37 +40,37 @@ class MenuScrollButton : public View {
         pref_height_(MenuItemView::pref_menu_height()) {
   }
 
-  virtual gfx::Size GetPreferredSize() OVERRIDE {
+  gfx::Size GetPreferredSize() const override {
     return gfx::Size(
         host_->GetMenuItem()->GetMenuConfig().scroll_arrow_height * 2 - 1,
         pref_height_);
   }
 
-  virtual bool CanDrop(const OSExchangeData& data) OVERRIDE {
+  bool CanDrop(const OSExchangeData& data) override {
     DCHECK(host_->GetMenuItem()->GetMenuController());
     return true;  // Always return true so that drop events are targeted to us.
   }
 
-  virtual void OnDragEntered(const ui::DropTargetEvent& event) OVERRIDE {
+  void OnDragEntered(const ui::DropTargetEvent& event) override {
     DCHECK(host_->GetMenuItem()->GetMenuController());
     host_->GetMenuItem()->GetMenuController()->OnDragEnteredScrollButton(
         host_, is_up_);
   }
 
-  virtual int OnDragUpdated(const ui::DropTargetEvent& event) OVERRIDE {
+  int OnDragUpdated(const ui::DropTargetEvent& event) override {
     return ui::DragDropTypes::DRAG_NONE;
   }
 
-  virtual void OnDragExited() OVERRIDE {
+  void OnDragExited() override {
     DCHECK(host_->GetMenuItem()->GetMenuController());
     host_->GetMenuItem()->GetMenuController()->OnDragExitedScrollButton(host_);
   }
 
-  virtual int OnPerformDrop(const ui::DropTargetEvent& event) OVERRIDE {
+  int OnPerformDrop(const ui::DropTargetEvent& event) override {
     return ui::DragDropTypes::DRAG_NONE;
   }
 
-  virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE {
+  void OnPaint(gfx::Canvas* canvas) override {
     const MenuConfig& config = host_->GetMenuItem()->GetMenuConfig();
 
     // The background.
@@ -142,7 +139,7 @@ class MenuScrollViewContainer::MenuScrollView : public View {
     AddChildView(child);
   }
 
-  virtual void ScrollRectToVisible(const gfx::Rect& rect) OVERRIDE {
+  void ScrollRectToVisible(const gfx::Rect& rect) override {
     // NOTE: this assumes we only want to scroll in the y direction.
 
     // If the rect is already visible, do not scroll.
@@ -246,7 +243,7 @@ void MenuScrollViewContainer::Layout() {
   scroll_view_->Layout();
 }
 
-gfx::Size MenuScrollViewContainer::GetPreferredSize() {
+gfx::Size MenuScrollViewContainer::GetPreferredSize() const {
   gfx::Size prefsize = scroll_view_->GetContents()->GetPreferredSize();
   gfx::Insets insets = GetInsets();
   prefsize.Enlarge(insets.width(), insets.height());
@@ -254,15 +251,15 @@ gfx::Size MenuScrollViewContainer::GetPreferredSize() {
 }
 
 void MenuScrollViewContainer::GetAccessibleState(
-    ui::AccessibleViewState* state) {
+    ui::AXViewState* state) {
   // Get the name from the submenu view.
   content_view_->GetAccessibleState(state);
 
   // Now change the role.
-  state->role = ui::AccessibilityTypes::ROLE_MENUBAR;
+  state->role = ui::AX_ROLE_MENU_BAR;
   // Some AT (like NVDA) will not process focus events on menu item children
   // unless a parent claims to be focused.
-  state->state = ui::AccessibilityTypes::STATE_FOCUSED;
+  state->AddStateFlag(ui::AX_STATE_FOCUSED);
 }
 
 void MenuScrollViewContainer::OnBoundsChanged(
@@ -284,7 +281,7 @@ void MenuScrollViewContainer::CreateDefaultBorder() {
   int padding = menu_config.corner_radius > 0 ?
         kBorderPaddingDueToRoundedCorners : 0;
 
-#if defined(USE_AURA)
+#if defined(USE_AURA) && !(defined(OS_LINUX) && !defined(OS_CHROMEOS))
   if (menu_config.native_theme == ui::NativeThemeAura::instance()) {
     // In case of NativeThemeAura the border gets drawn with the shadow.
     // Furthermore no additional padding is wanted.
@@ -299,13 +296,14 @@ void MenuScrollViewContainer::CreateDefaultBorder() {
   int right = menu_config.menu_horizontal_border_size + padding;
 
   if (use_border) {
-    set_border(views::Border::CreateBorderPainter(
-        new views::RoundRectPainter(menu_config.native_theme->GetSystemColor(
+    SetBorder(views::Border::CreateBorderPainter(
+        new views::RoundRectPainter(
+            menu_config.native_theme->GetSystemColor(
                 ui::NativeTheme::kColorId_MenuBorderColor),
             menu_config.corner_radius),
-            gfx::Insets(top, left, bottom, right)));
+        gfx::Insets(top, left, bottom, right)));
   } else {
-    set_border(Border::CreateEmptyBorder(top, left, bottom, right));
+    SetBorder(Border::CreateEmptyBorder(top, left, bottom, right));
   }
 }
 
@@ -313,21 +311,20 @@ void MenuScrollViewContainer::CreateBubbleBorder() {
   bubble_border_ = new BubbleBorder(arrow_,
                                     BubbleBorder::SMALL_SHADOW,
                                     SK_ColorWHITE);
-  set_border(bubble_border_);
+  SetBorder(scoped_ptr<Border>(bubble_border_));
   set_background(new BubbleBackground(bubble_border_));
 }
 
-BubbleBorder::Arrow
-MenuScrollViewContainer::BubbleBorderTypeFromAnchor(
-    MenuItemView::AnchorPosition anchor) {
+BubbleBorder::Arrow MenuScrollViewContainer::BubbleBorderTypeFromAnchor(
+    MenuAnchorPosition anchor) {
   switch (anchor) {
-    case views::MenuItemView::BUBBLE_LEFT:
+    case MENU_ANCHOR_BUBBLE_LEFT:
       return BubbleBorder::RIGHT_CENTER;
-    case views::MenuItemView::BUBBLE_RIGHT:
+    case MENU_ANCHOR_BUBBLE_RIGHT:
       return BubbleBorder::LEFT_CENTER;
-    case views::MenuItemView::BUBBLE_ABOVE:
+    case MENU_ANCHOR_BUBBLE_ABOVE:
       return BubbleBorder::BOTTOM_CENTER;
-    case views::MenuItemView::BUBBLE_BELOW:
+    case MENU_ANCHOR_BUBBLE_BELOW:
       return BubbleBorder::TOP_CENTER;
     default:
       return BubbleBorder::NONE;