OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_view.h" | 5 #include "chrome/browser/ui/views/confirm_bubble_view.h" |
6 | 6 |
7 #include "chrome/browser/ui/confirm_bubble_model.h" | 7 #include "chrome/browser/ui/confirm_bubble_model.h" |
8 #include "grit/theme_resources.h" | 8 #include "grit/theme_resources.h" |
9 #include "ui/base/resource/resource_bundle.h" | 9 #include "ui/base/resource/resource_bundle.h" |
10 #include "ui/gfx/image/image.h" | 10 #include "ui/gfx/image/image.h" |
11 #include "ui/views/controls/button/image_button.h" | 11 #include "ui/views/controls/button/image_button.h" |
12 #include "ui/views/controls/button/text_button.h" | 12 #include "ui/views/controls/button/text_button.h" |
13 #include "ui/views/controls/image_view.h" | 13 #include "ui/views/controls/image_view.h" |
14 #include "ui/views/controls/label.h" | 14 #include "ui/views/controls/label.h" |
15 #include "ui/views/controls/link.h" | 15 #include "ui/views/controls/link.h" |
16 #include "ui/views/layout/grid_layout.h" | 16 #include "ui/views/layout/grid_layout.h" |
17 #include "ui/views/layout/layout_constants.h" | 17 #include "ui/views/layout/layout_constants.h" |
18 | 18 |
19 namespace { | 19 namespace { |
20 | 20 |
21 // Maximum width for the message field. We will wrap the message text when its | 21 // Maximum width for the message field. We will wrap the message text when its |
22 // width is wider than this. | 22 // width is wider than this. |
23 const int kMaxMessageWidth = 400; | 23 const int kMaxMessageWidth = 400; |
24 | 24 |
25 } // namespace | 25 } // namespace |
26 | 26 |
27 ConfirmBubbleView::ConfirmBubbleView(const gfx::Point& anchor_point, | 27 ConfirmBubbleView::ConfirmBubbleView(const gfx::Point& anchor_point, |
28 ConfirmBubbleModel* model) | 28 ConfirmBubbleModel* model) |
29 : BubbleDelegateView(NULL, views::BubbleBorder::NONE, SK_ColorWHITE), | 29 : BubbleDelegateView(NULL, views::BubbleBorder::NONE), |
30 anchor_point_(anchor_point), | 30 anchor_point_(anchor_point), |
31 model_(model) { | 31 model_(model) { |
32 DCHECK(model); | 32 DCHECK(model); |
33 } | 33 } |
34 | 34 |
35 ConfirmBubbleView::~ConfirmBubbleView() { | 35 ConfirmBubbleView::~ConfirmBubbleView() { |
36 } | 36 } |
37 | 37 |
38 void ConfirmBubbleView::ButtonPressed(views::Button* sender, | 38 void ConfirmBubbleView::ButtonPressed(views::Button* sender, |
39 const views::Event& event) { | 39 const views::Event& event) { |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 layout->AddView(ok_button); | 141 layout->AddView(ok_button); |
142 } | 142 } |
143 if (has_cancel_button) { | 143 if (has_cancel_button) { |
144 views::TextButton* cancel_button = new views::NativeTextButton( | 144 views::TextButton* cancel_button = new views::NativeTextButton( |
145 this, model_->GetButtonLabel(ConfirmBubbleModel::BUTTON_CANCEL)); | 145 this, model_->GetButtonLabel(ConfirmBubbleModel::BUTTON_CANCEL)); |
146 cancel_button->set_tag(ConfirmBubbleModel::BUTTON_CANCEL); | 146 cancel_button->set_tag(ConfirmBubbleModel::BUTTON_CANCEL); |
147 layout->AddView(cancel_button); | 147 layout->AddView(cancel_button); |
148 } | 148 } |
149 } | 149 } |
150 } | 150 } |
OLD | NEW |