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