| 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/material_design/material_design_controller.h" |
| 15 #include "ui/base/resource/resource_bundle.h" | 15 #include "ui/base/resource/resource_bundle.h" |
| 16 #include "ui/compositor/paint_context.h" | 16 #include "ui/compositor/paint_context.h" |
| 17 #include "ui/compositor/paint_recorder.h" | 17 #include "ui/compositor/paint_recorder.h" |
| 18 #include "ui/display/display.h" | 18 #include "ui/display/display.h" |
| 19 #include "ui/display/screen.h" | 19 #include "ui/display/screen.h" |
| 20 #include "ui/gfx/geometry/vector2d.h" | 20 #include "ui/gfx/geometry/vector2d.h" |
| 21 #include "ui/gfx/path.h" | 21 #include "ui/gfx/path.h" |
| 22 #include "ui/gfx/skia_util.h" | 22 #include "ui/gfx/skia_util.h" |
| 23 #include "ui/gfx/vector_icons_public.h" | |
| 24 #include "ui/native_theme/native_theme.h" | 23 #include "ui/native_theme/native_theme.h" |
| 25 #include "ui/resources/grit/ui_resources.h" | 24 #include "ui/resources/grit/ui_resources.h" |
| 26 #include "ui/strings/grit/ui_strings.h" | 25 #include "ui/strings/grit/ui_strings.h" |
| 26 #include "ui/vector_icons/vector_icons.h" |
| 27 #include "ui/views/bubble/bubble_border.h" | 27 #include "ui/views/bubble/bubble_border.h" |
| 28 #include "ui/views/controls/button/vector_icon_button.h" | 28 #include "ui/views/controls/button/vector_icon_button.h" |
| 29 #include "ui/views/controls/image_view.h" | 29 #include "ui/views/controls/image_view.h" |
| 30 #include "ui/views/controls/label.h" | 30 #include "ui/views/controls/label.h" |
| 31 #include "ui/views/layout/box_layout.h" | 31 #include "ui/views/layout/box_layout.h" |
| 32 #include "ui/views/layout/layout_constants.h" | 32 #include "ui/views/layout/layout_constants.h" |
| 33 #include "ui/views/resources/grit/views_resources.h" | 33 #include "ui/views/resources/grit/views_resources.h" |
| 34 #include "ui/views/widget/widget.h" | 34 #include "ui/views/widget/widget.h" |
| 35 #include "ui/views/widget/widget_delegate.h" | 35 #include "ui/views/widget/widget_delegate.h" |
| 36 #include "ui/views/window/client_view.h" | 36 #include "ui/views/window/client_view.h" |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 AddChildView(close_); | 112 AddChildView(close_); |
| 113 } | 113 } |
| 114 | 114 |
| 115 BubbleFrameView::~BubbleFrameView() {} | 115 BubbleFrameView::~BubbleFrameView() {} |
| 116 | 116 |
| 117 // static | 117 // static |
| 118 Button* BubbleFrameView::CreateCloseButton(VectorIconButtonDelegate* delegate) { | 118 Button* BubbleFrameView::CreateCloseButton(VectorIconButtonDelegate* delegate) { |
| 119 ImageButton* close_button = nullptr; | 119 ImageButton* close_button = nullptr; |
| 120 if (ui::MaterialDesignController::IsSecondaryUiMaterial()) { | 120 if (ui::MaterialDesignController::IsSecondaryUiMaterial()) { |
| 121 VectorIconButton* close = new VectorIconButton(delegate); | 121 VectorIconButton* close = new VectorIconButton(delegate); |
| 122 close->SetIcon(gfx::VectorIconId::BAR_CLOSE); | 122 close->SetIcon(ui::kCloseIcon); |
| 123 close_button = close; | 123 close_button = close; |
| 124 } else { | 124 } else { |
| 125 ui::ResourceBundle* rb = &ui::ResourceBundle::GetSharedInstance(); | 125 ui::ResourceBundle* rb = &ui::ResourceBundle::GetSharedInstance(); |
| 126 close_button = new ImageButton(delegate); | 126 close_button = new ImageButton(delegate); |
| 127 close_button->SetImage(CustomButton::STATE_NORMAL, | 127 close_button->SetImage(CustomButton::STATE_NORMAL, |
| 128 *rb->GetImageNamed(IDR_CLOSE_DIALOG).ToImageSkia()); | 128 *rb->GetImageNamed(IDR_CLOSE_DIALOG).ToImageSkia()); |
| 129 close_button->SetImage( | 129 close_button->SetImage( |
| 130 CustomButton::STATE_HOVERED, | 130 CustomButton::STATE_HOVERED, |
| 131 *rb->GetImageNamed(IDR_CLOSE_DIALOG_H).ToImageSkia()); | 131 *rb->GetImageNamed(IDR_CLOSE_DIALOG_H).ToImageSkia()); |
| 132 close_button->SetImage( | 132 close_button->SetImage( |
| (...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 541 size.Enlarge(client_insets.width(), client_insets.height()); | 541 size.Enlarge(client_insets.width(), client_insets.height()); |
| 542 size.SetToMax(gfx::Size(title_bar_width, 0)); | 542 size.SetToMax(gfx::Size(title_bar_width, 0)); |
| 543 | 543 |
| 544 if (footnote_container_) | 544 if (footnote_container_) |
| 545 size.Enlarge(0, footnote_container_->GetHeightForWidth(size.width())); | 545 size.Enlarge(0, footnote_container_->GetHeightForWidth(size.width())); |
| 546 | 546 |
| 547 return size; | 547 return size; |
| 548 } | 548 } |
| 549 | 549 |
| 550 } // namespace views | 550 } // namespace views |
| OLD | NEW |