Chromium Code Reviews| Index: ui/views/bubble/bubble_frame_view.cc |
| diff --git a/ui/views/bubble/bubble_frame_view.cc b/ui/views/bubble/bubble_frame_view.cc |
| index f03f984ef6e3d4854188cde0953b2cbff28353a0..b61cb89cef19e353cde473813dce31b07f12cd16 100644 |
| --- a/ui/views/bubble/bubble_frame_view.cc |
| +++ b/ui/views/bubble/bubble_frame_view.cc |
| @@ -11,6 +11,7 @@ |
| #include "ui/base/default_style.h" |
| #include "ui/base/hit_test.h" |
| #include "ui/base/l10n/l10n_util.h" |
| +#include "ui/base/material_design/material_design_controller.h" |
| #include "ui/base/resource/resource_bundle.h" |
| #include "ui/compositor/paint_context.h" |
| #include "ui/compositor/paint_recorder.h" |
| @@ -19,11 +20,13 @@ |
| #include "ui/gfx/geometry/vector2d.h" |
| #include "ui/gfx/path.h" |
| #include "ui/gfx/skia_util.h" |
| +#include "ui/gfx/vector_icons_public.h" |
| #include "ui/native_theme/native_theme.h" |
| #include "ui/resources/grit/ui_resources.h" |
| #include "ui/strings/grit/ui_strings.h" |
| #include "ui/views/bubble/bubble_border.h" |
| #include "ui/views/controls/button/label_button.h" |
| +#include "ui/views/controls/button/vector_icon_button.h" |
| #include "ui/views/controls/image_view.h" |
| #include "ui/views/layout/box_layout.h" |
| #include "ui/views/layout/layout_constants.h" |
| @@ -93,29 +96,39 @@ BubbleFrameView::BubbleFrameView(const gfx::Insets& title_margins, |
| close_ = CreateCloseButton(this); |
| close_->SetVisible(false); |
| +#if defined(OS_WIN) |
|
sky
2016/09/07 03:42:18
Why do you prefer this here and not in the CreateC
Evan Stade
2016/09/07 16:17:37
because the HTCLOSE exception only makes sense in
|
| + // Windows will automatically create a tooltip for the close button based on |
| + // the HTCLOSE result from NonClientHitTest(). |
| + close_->SetTooltipText(base::string16()); |
| +#endif |
| AddChildView(close_); |
| } |
| BubbleFrameView::~BubbleFrameView() {} |
| // static |
| -LabelButton* BubbleFrameView::CreateCloseButton(ButtonListener* listener) { |
| - ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
| - LabelButton* close = new LabelButton(listener, base::string16()); |
| - close->SetImage(CustomButton::STATE_NORMAL, |
| - *rb.GetImageNamed(IDR_CLOSE_DIALOG).ToImageSkia()); |
| - close->SetImage(CustomButton::STATE_HOVERED, |
| - *rb.GetImageNamed(IDR_CLOSE_DIALOG_H).ToImageSkia()); |
| - close->SetImage(CustomButton::STATE_PRESSED, |
| - *rb.GetImageNamed(IDR_CLOSE_DIALOG_P).ToImageSkia()); |
| - close->SetBorder(nullptr); |
| - close->SetSize(close->GetPreferredSize()); |
| -#if !defined(OS_WIN) |
| - // Windows will automatically create a tooltip for the close button based on |
| - // the HTCLOSE result from NonClientHitTest(). |
| - close->SetTooltipText(l10n_util::GetStringUTF16(IDS_APP_CLOSE)); |
| -#endif |
| - return close; |
| +Button* BubbleFrameView::CreateCloseButton(VectorIconButtonDelegate* delegate) { |
| + Button* close_button = nullptr; |
| + if (ui::MaterialDesignController::IsSecondaryUiMaterial()) { |
| + VectorIconButton* close = new VectorIconButton(delegate); |
| + close->SetIcon(gfx::VectorIconId::BAR_CLOSE); |
| + close->SetSize(close->GetPreferredSize()); |
| + close_button = close; |
| + } else { |
| + ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
| + LabelButton* close = new LabelButton(delegate, base::string16()); |
| + close->SetImage(CustomButton::STATE_NORMAL, |
| + *rb.GetImageNamed(IDR_CLOSE_DIALOG).ToImageSkia()); |
| + close->SetImage(CustomButton::STATE_HOVERED, |
| + *rb.GetImageNamed(IDR_CLOSE_DIALOG_H).ToImageSkia()); |
| + close->SetImage(CustomButton::STATE_PRESSED, |
| + *rb.GetImageNamed(IDR_CLOSE_DIALOG_P).ToImageSkia()); |
| + close->SetBorder(nullptr); |
| + close->SetSize(close->GetPreferredSize()); |
| + close_button = close; |
| + } |
| + close_button->SetTooltipText(l10n_util::GetStringUTF16(IDS_APP_CLOSE)); |
| + return close_button; |
| } |
| gfx::Rect BubbleFrameView::GetBoundsForClientView() const { |