Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/touchui/touch_editing_menu.h" | 5 #include "ui/views/touchui/touch_editing_menu.h" |
| 6 | 6 |
| 7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
| 8 #include "grit/ui_strings.h" | 8 #include "grit/ui_strings.h" |
| 9 #include "ui/aura/window.h" | |
| 9 #include "ui/base/l10n/l10n_util.h" | 10 #include "ui/base/l10n/l10n_util.h" |
| 10 #include "ui/base/resource/resource_bundle.h" | 11 #include "ui/base/resource/resource_bundle.h" |
| 11 #include "ui/gfx/canvas.h" | 12 #include "ui/gfx/canvas.h" |
| 12 #include "ui/gfx/font_list.h" | 13 #include "ui/gfx/font_list.h" |
| 13 #include "ui/gfx/insets.h" | 14 #include "ui/gfx/insets.h" |
| 14 #include "ui/gfx/text_utils.h" | 15 #include "ui/gfx/text_utils.h" |
| 15 #include "ui/views/bubble/bubble_border.h" | 16 #include "ui/views/bubble/bubble_border.h" |
| 16 #include "ui/views/bubble/bubble_frame_view.h" | 17 #include "ui/views/bubble/bubble_frame_view.h" |
| 17 #include "ui/views/controls/button/custom_button.h" | 18 #include "ui/views/controls/button/custom_button.h" |
| 18 #include "ui/views/controls/button/label_button.h" | 19 #include "ui/views/controls/button/label_button.h" |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 47 set_shadow(views::BubbleBorder::SMALL_SHADOW); | 48 set_shadow(views::BubbleBorder::SMALL_SHADOW); |
| 48 set_parent_window(context); | 49 set_parent_window(context); |
| 49 set_margins(gfx::Insets(kMenuMargin, kMenuMargin, kMenuMargin, kMenuMargin)); | 50 set_margins(gfx::Insets(kMenuMargin, kMenuMargin, kMenuMargin, kMenuMargin)); |
| 50 set_use_focusless(true); | 51 set_use_focusless(true); |
| 51 set_adjust_if_offscreen(true); | 52 set_adjust_if_offscreen(true); |
| 52 | 53 |
| 53 SetLayoutManager(new BoxLayout(BoxLayout::kHorizontal, 0, 0, | 54 SetLayoutManager(new BoxLayout(BoxLayout::kHorizontal, 0, 0, |
| 54 kSpacingBetweenButtons)); | 55 kSpacingBetweenButtons)); |
| 55 CreateButtons(); | 56 CreateButtons(); |
| 56 views::BubbleDelegateView::CreateBubble(this); | 57 views::BubbleDelegateView::CreateBubble(this); |
| 58 // A transient child is not stacked above its parent upon creation; so, we | |
| 59 // do it manually here. | |
| 60 // TODO(mohsen): Remove after the above bug is fixed in the transient window | |
| 61 // management: crbug.com/352371. | |
| 62 GetWidget()->GetNativeView()->parent()->StackChildAbove( | |
| 63 GetWidget()->GetNativeView(), context); | |
|
sadrul
2014/03/14 18:30:07
What does the fix for this look like? Can we land
mohsen
2014/03/14 19:15:25
2014/03/14 18:30:07, sadrul wrote:
| |
| 57 GetWidget()->Show(); | 64 GetWidget()->Show(); |
| 58 } | 65 } |
| 59 | 66 |
| 60 TouchEditingMenuView::~TouchEditingMenuView() { | 67 TouchEditingMenuView::~TouchEditingMenuView() { |
| 61 } | 68 } |
| 62 | 69 |
| 63 // static | 70 // static |
| 64 TouchEditingMenuView* TouchEditingMenuView::Create( | 71 TouchEditingMenuView* TouchEditingMenuView::Create( |
| 65 TouchEditingMenuController* controller, | 72 TouchEditingMenuController* controller, |
| 66 gfx::Rect anchor_rect, | 73 gfx::Rect anchor_rect, |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 141 int h_border = (kMenuButtonWidth - gfx::GetStringWidth(label, font_list)) / 2; | 148 int h_border = (kMenuButtonWidth - gfx::GetStringWidth(label, font_list)) / 2; |
| 142 button_border->set_insets( | 149 button_border->set_insets( |
| 143 gfx::Insets(v_border, h_border, v_border, h_border)); | 150 gfx::Insets(v_border, h_border, v_border, h_border)); |
| 144 button->SetBorder(button_border.PassAs<Border>()); | 151 button->SetBorder(button_border.PassAs<Border>()); |
| 145 button->SetFontList(font_list); | 152 button->SetFontList(font_list); |
| 146 button->set_tag(tag); | 153 button->set_tag(tag); |
| 147 return button; | 154 return button; |
| 148 } | 155 } |
| 149 | 156 |
| 150 } // namespace views | 157 } // namespace views |
| OLD | NEW |