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" |
(...skipping 18 matching lines...) Expand all Loading... | |
29 #include "ui/views/controls/button/image_button_factory.h" | 29 #include "ui/views/controls/button/image_button_factory.h" |
30 #include "ui/views/controls/image_view.h" | 30 #include "ui/views/controls/image_view.h" |
31 #include "ui/views/controls/label.h" | 31 #include "ui/views/controls/label.h" |
32 #include "ui/views/layout/box_layout.h" | 32 #include "ui/views/layout/box_layout.h" |
33 #include "ui/views/layout/layout_constants.h" | 33 #include "ui/views/layout/layout_constants.h" |
34 #include "ui/views/resources/grit/views_resources.h" | 34 #include "ui/views/resources/grit/views_resources.h" |
35 #include "ui/views/views_delegate.h" | 35 #include "ui/views/views_delegate.h" |
36 #include "ui/views/widget/widget.h" | 36 #include "ui/views/widget/widget.h" |
37 #include "ui/views/widget/widget_delegate.h" | 37 #include "ui/views/widget/widget_delegate.h" |
38 #include "ui/views/window/client_view.h" | 38 #include "ui/views/window/client_view.h" |
39 #include "ui/views/window/dialog_delegate.h" | |
39 | 40 |
40 namespace views { | 41 namespace views { |
41 | 42 |
42 namespace { | 43 namespace { |
43 | 44 |
44 // Background color of the footnote view. | 45 // Background color of the footnote view. |
45 const SkColor kFootnoteBackgroundColor = SkColorSetRGB(245, 245, 245); | 46 const SkColor kFootnoteBackgroundColor = SkColorSetRGB(245, 245, 245); |
46 | 47 |
47 // Color of the top border of the footnote. | 48 // Color of the top border of the footnote. |
48 const SkColor kFootnoteBorderColor = SkColorSetRGB(229, 229, 229); | 49 const SkColor kFootnoteBorderColor = SkColorSetRGB(229, 229, 229); |
(...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
523 if (close_->visible()) | 524 if (close_->visible()) |
524 title_bar_width += close_->width() + 1; | 525 title_bar_width += close_->width() + 1; |
525 | 526 |
526 gfx::Size size(client_size); | 527 gfx::Size size(client_size); |
527 gfx::Insets client_insets = GetInsets(); | 528 gfx::Insets client_insets = GetInsets(); |
528 size.Enlarge(client_insets.width(), client_insets.height()); | 529 size.Enlarge(client_insets.width(), client_insets.height()); |
529 size.SetToMax(gfx::Size(title_bar_width, 0)); | 530 size.SetToMax(gfx::Size(title_bar_width, 0)); |
530 | 531 |
531 if (footnote_container_) | 532 if (footnote_container_) |
532 size.Enlarge(0, footnote_container_->GetHeightForWidth(size.width())); | 533 size.Enlarge(0, footnote_container_->GetHeightForWidth(size.width())); |
534 DialogDelegate* as_dialog = | |
Peter Kasting
2017/04/06 06:32:16
Nit: I'd name this |dialog| or |dialog_delegate|
| |
535 GetWidget()->widget_delegate()->AsDialogDelegate(); | |
Peter Kasting
2017/04/06 06:32:16
Nit: Move this line below the next comment since i
| |
536 | |
537 // Only apply width snapping to bubbles that are also dialogs, and let dialogs | |
538 // opt out of width snapping if they handle it themselves or are otherwise | |
539 // incompatible with it. | |
540 if (as_dialog && as_dialog->ShouldSnapFrameWidth()) { | |
541 size.set_width( | |
542 ViewsDelegate::GetInstance()->GetSnappedDialogWidth(size.width())); | |
543 } | |
533 | 544 |
534 return size; | 545 return size; |
535 } | 546 } |
536 | 547 |
537 } // namespace views | 548 } // namespace views |
OLD | NEW |