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 "chrome/browser/ui/confirm_bubble.h" | 7 #include "chrome/browser/ui/confirm_bubble.h" |
8 #include "chrome/browser/ui/confirm_bubble_model.h" | 8 #include "chrome/browser/ui/confirm_bubble_model.h" |
9 #include "ui/views/controls/label.h" | 9 #include "ui/views/controls/label.h" |
10 #include "ui/views/controls/link.h" | 10 #include "ui/views/controls/link.h" |
11 #include "ui/views/layout/grid_layout.h" | 11 #include "ui/views/layout/grid_layout.h" |
12 #include "ui/views/layout/layout_constants.h" | 12 #include "ui/views/layout/layout_constants.h" |
13 #include "ui/views/widget/widget.h" | 13 #include "ui/views/widget/widget.h" |
14 | 14 |
15 ConfirmBubbleViews::ConfirmBubbleViews(ConfirmBubbleModel* model) | 15 ConfirmBubbleViews::ConfirmBubbleViews(ConfirmBubbleModel* model) |
16 : model_(model), | 16 : model_(model), |
17 link_(NULL) { | 17 link_(NULL) { |
18 views::GridLayout* layout = new views::GridLayout(this); | 18 views::GridLayout* layout = views::GridLayout::CreatePanel(this); |
Evan Stade
2013/04/16 01:39:39
this is a behavioral change, but I think it's an i
msw
2013/04/16 01:58:24
A screenshot would help :)
Evan Stade
2013/04/16 19:58:25
Done.
| |
19 // TODO(msw): Use layout constants and fix the new-style sizing. | |
20 layout->SetInsets(UseNewStyle() ? gfx::Insets(0, 0, 40, 0) : | |
21 gfx::Insets(views::kUnrelatedControlVerticalSpacing, | |
22 views::kUnrelatedControlHorizontalSpacing, | |
23 views::kUnrelatedControlVerticalSpacing, | |
24 views::kUnrelatedControlHorizontalSpacing)); | |
25 SetLayoutManager(layout); | 19 SetLayoutManager(layout); |
26 | 20 |
27 // Use a fixed maximum message width, so longer messages will wrap. | 21 // Use a fixed maximum message width, so longer messages will wrap. |
28 const int kMaxMessageWidth = 400; | 22 const int kMaxMessageWidth = 400; |
29 views::ColumnSet* cs = layout->AddColumnSet(0); | 23 views::ColumnSet* cs = layout->AddColumnSet(0); |
30 cs->AddColumn(views::GridLayout::LEADING, views::GridLayout::CENTER, 0, | 24 cs->AddColumn(views::GridLayout::LEADING, views::GridLayout::CENTER, 0, |
31 views::GridLayout::FIXED, kMaxMessageWidth, false); | 25 views::GridLayout::FIXED, kMaxMessageWidth, false); |
32 | 26 |
33 // Add the message label. | 27 // Add the message label. |
34 views::Label* label = new views::Label(model_->GetMessageText()); | 28 views::Label* label = new views::Label(model_->GetMessageText()); |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
105 namespace chrome { | 99 namespace chrome { |
106 | 100 |
107 void ShowConfirmBubble(gfx::NativeView view, | 101 void ShowConfirmBubble(gfx::NativeView view, |
108 const gfx::Point& origin, | 102 const gfx::Point& origin, |
109 ConfirmBubbleModel* model) { | 103 ConfirmBubbleModel* model) { |
110 views::DialogDelegateView::CreateDialogWidget( | 104 views::DialogDelegateView::CreateDialogWidget( |
111 new ConfirmBubbleViews(model), NULL, view)->Show(); | 105 new ConfirmBubbleViews(model), NULL, view)->Show(); |
112 } | 106 } |
113 | 107 |
114 } // namespace chrome | 108 } // namespace chrome |
OLD | NEW |