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 "grit/theme_resources.h" | 9 #include "grit/theme_resources.h" |
10 #include "ui/base/resource/resource_bundle.h" | 10 #include "ui/base/resource/resource_bundle.h" |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 // Add the message label to the second row. | 94 // Add the message label to the second row. |
95 cs = layout->AddColumnSet(1); | 95 cs = layout->AddColumnSet(1); |
96 const string16 message_text = model_->GetMessageText(); | 96 const string16 message_text = model_->GetMessageText(); |
97 DCHECK(!message_text.empty()); | 97 DCHECK(!message_text.empty()); |
98 views::Label* message_label = new views::Label(message_text); | 98 views::Label* message_label = new views::Label(message_text); |
99 int message_width = | 99 int message_width = |
100 std::min(kMaxMessageWidth, message_label->GetPreferredSize().width()); | 100 std::min(kMaxMessageWidth, message_label->GetPreferredSize().width()); |
101 cs->AddColumn(views::GridLayout::LEADING, views::GridLayout::CENTER, 0, | 101 cs->AddColumn(views::GridLayout::LEADING, views::GridLayout::CENTER, 0, |
102 views::GridLayout::FIXED, message_width, false); | 102 views::GridLayout::FIXED, message_width, false); |
103 message_label->SetBounds(0, 0, message_width, 0); | 103 message_label->SetBounds(0, 0, message_width, 0); |
104 message_label->SetHorizontalAlignment(views::Label::ALIGN_LEFT); | 104 message_label->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
105 message_label->SetMultiLine(true); | 105 message_label->SetMultiLine(true); |
106 layout->StartRow(0, 1); | 106 layout->StartRow(0, 1); |
107 layout->AddView(message_label); | 107 layout->AddView(message_label); |
108 | 108 |
109 // Add the the link label to the third row if it exists. | 109 // Add the the link label to the third row if it exists. |
110 const string16 link_text = model_->GetLinkText(); | 110 const string16 link_text = model_->GetLinkText(); |
111 if (!link_text.empty()) { | 111 if (!link_text.empty()) { |
112 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); | 112 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); |
113 layout->StartRow(0, 1); | 113 layout->StartRow(0, 1); |
114 views::Link* link_label = new views::Link(link_text); | 114 views::Link* link_label = new views::Link(link_text); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 | 155 |
156 void ShowConfirmBubble(gfx::NativeView view, | 156 void ShowConfirmBubble(gfx::NativeView view, |
157 const gfx::Point& origin, | 157 const gfx::Point& origin, |
158 ConfirmBubbleModel* model) { | 158 ConfirmBubbleModel* model) { |
159 ConfirmBubbleViews* bubble = new ConfirmBubbleViews(origin, model); | 159 ConfirmBubbleViews* bubble = new ConfirmBubbleViews(origin, model); |
160 views::BubbleDelegateView::CreateBubble(bubble); | 160 views::BubbleDelegateView::CreateBubble(bubble); |
161 bubble->Show(); | 161 bubble->Show(); |
162 } | 162 } |
163 | 163 |
164 } // namespace chrome | 164 } // namespace chrome |
OLD | NEW |