| 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> |
| 8 |
| 7 #include "chrome/browser/ui/confirm_bubble.h" | 9 #include "chrome/browser/ui/confirm_bubble.h" |
| 8 #include "chrome/browser/ui/confirm_bubble_model.h" | 10 #include "chrome/browser/ui/confirm_bubble_model.h" |
| 9 #include "components/constrained_window/constrained_window_views.h" | 11 #include "components/constrained_window/constrained_window_views.h" |
| 10 #include "ui/views/controls/label.h" | 12 #include "ui/views/controls/label.h" |
| 11 #include "ui/views/controls/link.h" | 13 #include "ui/views/controls/link.h" |
| 12 #include "ui/views/layout/grid_layout.h" | 14 #include "ui/views/layout/grid_layout.h" |
| 13 #include "ui/views/layout/layout_constants.h" | 15 #include "ui/views/layout/layout_constants.h" |
| 14 #include "ui/views/widget/widget.h" | 16 #include "ui/views/widget/widget.h" |
| 15 | 17 |
| 16 ConfirmBubbleViews::ConfirmBubbleViews(scoped_ptr<ConfirmBubbleModel> model) | 18 ConfirmBubbleViews::ConfirmBubbleViews(scoped_ptr<ConfirmBubbleModel> model) |
| 17 : model_(model.Pass()), | 19 : model_(std::move(model)), link_(NULL) { |
| 18 link_(NULL) { | |
| 19 views::GridLayout* layout = views::GridLayout::CreatePanel(this); | 20 views::GridLayout* layout = views::GridLayout::CreatePanel(this); |
| 20 SetLayoutManager(layout); | 21 SetLayoutManager(layout); |
| 21 | 22 |
| 22 // Use a fixed maximum message width, so longer messages will wrap. | 23 // Use a fixed maximum message width, so longer messages will wrap. |
| 23 const int kMaxMessageWidth = 400; | 24 const int kMaxMessageWidth = 400; |
| 24 views::ColumnSet* cs = layout->AddColumnSet(0); | 25 views::ColumnSet* cs = layout->AddColumnSet(0); |
| 25 cs->AddColumn(views::GridLayout::LEADING, views::GridLayout::CENTER, 0, | 26 cs->AddColumn(views::GridLayout::LEADING, views::GridLayout::CENTER, 0, |
| 26 views::GridLayout::FIXED, kMaxMessageWidth, false); | 27 views::GridLayout::FIXED, kMaxMessageWidth, false); |
| 27 | 28 |
| 28 // Add the message label. | 29 // Add the message label. |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 } | 98 } |
| 98 } | 99 } |
| 99 | 100 |
| 100 namespace chrome { | 101 namespace chrome { |
| 101 | 102 |
| 102 void ShowConfirmBubble(gfx::NativeWindow window, | 103 void ShowConfirmBubble(gfx::NativeWindow window, |
| 103 gfx::NativeView anchor_view, | 104 gfx::NativeView anchor_view, |
| 104 const gfx::Point& origin, | 105 const gfx::Point& origin, |
| 105 scoped_ptr<ConfirmBubbleModel> model) { | 106 scoped_ptr<ConfirmBubbleModel> model) { |
| 106 constrained_window::CreateBrowserModalDialogViews( | 107 constrained_window::CreateBrowserModalDialogViews( |
| 107 new ConfirmBubbleViews(model.Pass()), window)->Show(); | 108 new ConfirmBubbleViews(std::move(model)), window) |
| 109 ->Show(); |
| 108 } | 110 } |
| 109 | 111 |
| 110 } // namespace chrome | 112 } // namespace chrome |
| OLD | NEW |