| 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 "chrome/browser/ui/views/confirm_bubble_views.h" | 5 #include "chrome/browser/ui/views/confirm_bubble_views.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "chrome/browser/ui/confirm_bubble.h" | 9 #include "chrome/browser/ui/confirm_bubble.h" |
| 10 #include "chrome/browser/ui/confirm_bubble_model.h" | 10 #include "chrome/browser/ui/confirm_bubble_model.h" |
| 11 #include "components/constrained_window/constrained_window_views.h" | 11 #include "components/constrained_window/constrained_window_views.h" |
| 12 #include "ui/base/ui_features.h" | 12 #include "ui/base/ui_features.h" |
| 13 #include "ui/views/controls/label.h" | 13 #include "ui/views/controls/label.h" |
| 14 #include "ui/views/controls/link.h" | 14 #include "ui/views/controls/link.h" |
| 15 #include "ui/views/layout/grid_layout.h" | 15 #include "ui/views/layout/grid_layout.h" |
| 16 #include "ui/views/layout/layout_constants.h" | 16 #include "ui/views/layout/layout_constants.h" |
| 17 #include "ui/views/widget/widget.h" | 17 #include "ui/views/widget/widget.h" |
| 18 | 18 |
| 19 ConfirmBubbleViews::ConfirmBubbleViews( | 19 ConfirmBubbleViews::ConfirmBubbleViews( |
| 20 std::unique_ptr<ConfirmBubbleModel> model) | 20 std::unique_ptr<ConfirmBubbleModel> model) |
| 21 : model_(std::move(model)), link_(NULL) { | 21 : model_(std::move(model)), link_(NULL) { |
| 22 views::GridLayout* layout = views::GridLayout::CreatePanel(this); | 22 views::GridLayout* layout = views::GridLayout::CreatePanel(this); |
| 23 SetLayoutManager(layout); | |
| 24 | 23 |
| 25 // Use a fixed maximum message width, so longer messages will wrap. | 24 // Use a fixed maximum message width, so longer messages will wrap. |
| 26 const int kMaxMessageWidth = 400; | 25 const int kMaxMessageWidth = 400; |
| 27 views::ColumnSet* cs = layout->AddColumnSet(0); | 26 views::ColumnSet* cs = layout->AddColumnSet(0); |
| 28 cs->AddColumn(views::GridLayout::LEADING, views::GridLayout::CENTER, 0, | 27 cs->AddColumn(views::GridLayout::LEADING, views::GridLayout::CENTER, 0, |
| 29 views::GridLayout::FIXED, kMaxMessageWidth, false); | 28 views::GridLayout::FIXED, kMaxMessageWidth, false); |
| 30 | 29 |
| 31 // Add the message label. | 30 // Add the message label. |
| 32 views::Label* label = new views::Label(model_->GetMessageText()); | 31 views::Label* label = new views::Label(model_->GetMessageText()); |
| 33 DCHECK(!label->text().empty()); | 32 DCHECK(!label->text().empty()); |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 gfx::NativeView anchor_view, | 106 gfx::NativeView anchor_view, |
| 108 const gfx::Point& origin, | 107 const gfx::Point& origin, |
| 109 std::unique_ptr<ConfirmBubbleModel> model) { | 108 std::unique_ptr<ConfirmBubbleModel> model) { |
| 110 constrained_window::CreateBrowserModalDialogViews( | 109 constrained_window::CreateBrowserModalDialogViews( |
| 111 new ConfirmBubbleViews(std::move(model)), window) | 110 new ConfirmBubbleViews(std::move(model)), window) |
| 112 ->Show(); | 111 ->Show(); |
| 113 } | 112 } |
| 114 #endif // !OS_MACOSX || MAC_VIEWS_BROWSER | 113 #endif // !OS_MACOSX || MAC_VIEWS_BROWSER |
| 115 | 114 |
| 116 } // namespace chrome | 115 } // namespace chrome |
| OLD | NEW |