| 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/bubble/bubble_frame_view.h" | 5 #include "ui/views/bubble/bubble_frame_view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| 11 #include "ui/base/default_style.h" | 11 #include "ui/base/default_style.h" |
| 12 #include "ui/base/hit_test.h" | 12 #include "ui/base/hit_test.h" |
| 13 #include "ui/base/l10n/l10n_util.h" | 13 #include "ui/base/l10n/l10n_util.h" |
| 14 #include "ui/base/material_design/material_design_controller.h" |
| 14 #include "ui/base/resource/resource_bundle.h" | 15 #include "ui/base/resource/resource_bundle.h" |
| 15 #include "ui/compositor/paint_context.h" | 16 #include "ui/compositor/paint_context.h" |
| 16 #include "ui/compositor/paint_recorder.h" | 17 #include "ui/compositor/paint_recorder.h" |
| 17 #include "ui/display/display.h" | 18 #include "ui/display/display.h" |
| 18 #include "ui/display/screen.h" | 19 #include "ui/display/screen.h" |
| 19 #include "ui/gfx/geometry/vector2d.h" | 20 #include "ui/gfx/geometry/vector2d.h" |
| 20 #include "ui/gfx/path.h" | 21 #include "ui/gfx/path.h" |
| 21 #include "ui/gfx/skia_util.h" | 22 #include "ui/gfx/skia_util.h" |
| 23 #include "ui/gfx/vector_icons_public.h" |
| 22 #include "ui/native_theme/native_theme.h" | 24 #include "ui/native_theme/native_theme.h" |
| 23 #include "ui/resources/grit/ui_resources.h" | 25 #include "ui/resources/grit/ui_resources.h" |
| 24 #include "ui/strings/grit/ui_strings.h" | 26 #include "ui/strings/grit/ui_strings.h" |
| 25 #include "ui/views/bubble/bubble_border.h" | 27 #include "ui/views/bubble/bubble_border.h" |
| 26 #include "ui/views/controls/button/label_button.h" | 28 #include "ui/views/controls/button/label_button.h" |
| 29 #include "ui/views/controls/button/vector_icon_button.h" |
| 27 #include "ui/views/controls/image_view.h" | 30 #include "ui/views/controls/image_view.h" |
| 28 #include "ui/views/layout/box_layout.h" | 31 #include "ui/views/layout/box_layout.h" |
| 29 #include "ui/views/layout/layout_constants.h" | 32 #include "ui/views/layout/layout_constants.h" |
| 30 #include "ui/views/resources/grit/views_resources.h" | 33 #include "ui/views/resources/grit/views_resources.h" |
| 31 #include "ui/views/widget/widget.h" | 34 #include "ui/views/widget/widget.h" |
| 32 #include "ui/views/widget/widget_delegate.h" | 35 #include "ui/views/widget/widget_delegate.h" |
| 33 #include "ui/views/window/client_view.h" | 36 #include "ui/views/window/client_view.h" |
| 34 | 37 |
| 35 namespace views { | 38 namespace views { |
| 36 | 39 |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 AddChildView(title_); | 95 AddChildView(title_); |
| 93 | 96 |
| 94 close_ = CreateCloseButton(this); | 97 close_ = CreateCloseButton(this); |
| 95 close_->SetVisible(false); | 98 close_->SetVisible(false); |
| 96 AddChildView(close_); | 99 AddChildView(close_); |
| 97 } | 100 } |
| 98 | 101 |
| 99 BubbleFrameView::~BubbleFrameView() {} | 102 BubbleFrameView::~BubbleFrameView() {} |
| 100 | 103 |
| 101 // static | 104 // static |
| 102 LabelButton* BubbleFrameView::CreateCloseButton(ButtonListener* listener) { | 105 Button* BubbleFrameView::CreateCloseButton(ButtonListener* listener) { |
| 106 if (ui::MaterialDesignController::IsSecondaryUiMaterial()) { |
| 107 VectorIconButton* close = new VectorIconButton(listener); |
| 108 close->SetIcon(gfx::VectorIconId::BAR_CLOSE, |
| 109 base::Callback<SkColor(void)>()); |
| 110 close->SetSize(close->GetPreferredSize()); |
| 111 return close; |
| 112 } |
| 103 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 113 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
| 104 LabelButton* close = new LabelButton(listener, base::string16()); | 114 LabelButton* close = new LabelButton(listener, base::string16()); |
| 105 close->SetImage(CustomButton::STATE_NORMAL, | 115 close->SetImage(CustomButton::STATE_NORMAL, |
| 106 *rb.GetImageNamed(IDR_CLOSE_DIALOG).ToImageSkia()); | 116 *rb.GetImageNamed(IDR_CLOSE_DIALOG).ToImageSkia()); |
| 107 close->SetImage(CustomButton::STATE_HOVERED, | 117 close->SetImage(CustomButton::STATE_HOVERED, |
| 108 *rb.GetImageNamed(IDR_CLOSE_DIALOG_H).ToImageSkia()); | 118 *rb.GetImageNamed(IDR_CLOSE_DIALOG_H).ToImageSkia()); |
| 109 close->SetImage(CustomButton::STATE_PRESSED, | 119 close->SetImage(CustomButton::STATE_PRESSED, |
| 110 *rb.GetImageNamed(IDR_CLOSE_DIALOG_P).ToImageSkia()); | 120 *rb.GetImageNamed(IDR_CLOSE_DIALOG_P).ToImageSkia()); |
| 111 close->SetBorder(nullptr); | 121 close->SetBorder(nullptr); |
| 112 close->SetSize(close->GetPreferredSize()); | 122 close->SetSize(close->GetPreferredSize()); |
| (...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 515 size.Enlarge(client_insets.width(), client_insets.height()); | 525 size.Enlarge(client_insets.width(), client_insets.height()); |
| 516 size.SetToMax(gfx::Size(title_bar_width, 0)); | 526 size.SetToMax(gfx::Size(title_bar_width, 0)); |
| 517 | 527 |
| 518 if (footnote_container_) | 528 if (footnote_container_) |
| 519 size.Enlarge(0, footnote_container_->GetHeightForWidth(size.width())); | 529 size.Enlarge(0, footnote_container_->GetHeightForWidth(size.width())); |
| 520 | 530 |
| 521 return size; | 531 return size; |
| 522 } | 532 } |
| 523 | 533 |
| 524 } // namespace views | 534 } // namespace views |
| OLD | NEW |