OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/views/message_box_view.h" | 5 #include "chrome/views/message_box_view.h" |
6 | 6 |
7 #include "base/message_loop.h" | 7 #include "base/message_loop.h" |
8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
9 #include "chrome/browser/controller.h" | 9 #include "chrome/browser/controller.h" |
10 #include "chrome/browser/views/standard_layout.h" | 10 #include "chrome/browser/views/standard_layout.h" |
11 #include "chrome/common/l10n_util.h" | 11 #include "chrome/common/l10n_util.h" |
| 12 #include "chrome/views/checkbox.h" |
12 #include "chrome/views/client_view.h" | 13 #include "chrome/views/client_view.h" |
13 | 14 |
14 #include "generated_resources.h" | 15 #include "generated_resources.h" |
15 | 16 |
16 static const int kDefaultMessageWidth = 320; | 17 static const int kDefaultMessageWidth = 320; |
17 | 18 |
18 /////////////////////////////////////////////////////////////////////////////// | 19 /////////////////////////////////////////////////////////////////////////////// |
19 // MessageBoxView, public: | 20 // MessageBoxView, public: |
20 | 21 |
21 MessageBoxView::MessageBoxView(int dialog_flags, | 22 MessageBoxView::MessageBoxView(int dialog_flags, |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 } | 65 } |
65 | 66 |
66 void MessageBoxView::SetCheckBoxLabel(const std::wstring& label) { | 67 void MessageBoxView::SetCheckBoxLabel(const std::wstring& label) { |
67 if (!check_box_) | 68 if (!check_box_) |
68 check_box_ = new views::CheckBox(label); | 69 check_box_ = new views::CheckBox(label); |
69 else | 70 else |
70 check_box_->SetLabel(label); | 71 check_box_->SetLabel(label); |
71 ResetLayoutManager(); | 72 ResetLayoutManager(); |
72 } | 73 } |
73 | 74 |
| 75 void MessageBoxView::SetCheckBoxSelected(bool selected) { |
| 76 if (!check_box_) |
| 77 return; |
| 78 check_box_->SetIsSelected(selected); |
| 79 } |
| 80 |
74 /////////////////////////////////////////////////////////////////////////////// | 81 /////////////////////////////////////////////////////////////////////////////// |
75 // MessageBoxView, views::View overrides: | 82 // MessageBoxView, views::View overrides: |
76 | 83 |
77 void MessageBoxView::ViewHierarchyChanged(bool is_add, | 84 void MessageBoxView::ViewHierarchyChanged(bool is_add, |
78 views::View* parent, | 85 views::View* parent, |
79 views::View* child) { | 86 views::View* child) { |
80 if (child == this && is_add) { | 87 if (child == this && is_add) { |
81 if (prompt_field_) | 88 if (prompt_field_) |
82 prompt_field_->SelectAll(); | 89 prompt_field_->SelectAll(); |
83 } | 90 } |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 | 169 |
163 if (check_box_) { | 170 if (check_box_) { |
164 layout->AddPaddingRow(0, kRelatedControlVerticalSpacing); | 171 layout->AddPaddingRow(0, kRelatedControlVerticalSpacing); |
165 layout->StartRow(0, checkbox_column_view_set_id); | 172 layout->StartRow(0, checkbox_column_view_set_id); |
166 layout->AddView(check_box_); | 173 layout->AddView(check_box_); |
167 } | 174 } |
168 | 175 |
169 layout->AddPaddingRow(0, kRelatedControlVerticalSpacing); | 176 layout->AddPaddingRow(0, kRelatedControlVerticalSpacing); |
170 } | 177 } |
171 | 178 |
OLD | NEW |