Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(275)

Unified Diff: ui/views/bubble/bubble_frame_view.cc

Issue 2305933002: Update dialog close buttons to use vector icons and ripples. (Closed)
Patch Set: always good to compile Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/views/bubble/bubble_frame_view.h ('k') | ui/views/controls/button/vector_icon_button.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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)
+ // 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 {
« no previous file with comments | « ui/views/bubble/bubble_frame_view.h ('k') | ui/views/controls/button/vector_icon_button.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698