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 "ui/views/controls/message_box_view.h" | 5 #include "ui/views/controls/message_box_view.h" |
6 | 6 |
7 #include "base/i18n/rtl.h" | 7 #include "base/i18n/rtl.h" |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 #include "base/strings/string_split.h" | 9 #include "base/strings/string_split.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 } | 143 } |
144 | 144 |
145 bool MessageBoxView::AcceleratorPressed(const ui::Accelerator& accelerator) { | 145 bool MessageBoxView::AcceleratorPressed(const ui::Accelerator& accelerator) { |
146 // We only accepts Ctrl-C. | 146 // We only accepts Ctrl-C. |
147 DCHECK(accelerator.key_code() == 'C' && accelerator.IsCtrlDown()); | 147 DCHECK(accelerator.key_code() == 'C' && accelerator.IsCtrlDown()); |
148 | 148 |
149 // We must not intercept Ctrl-C when we have a text box and it's focused. | 149 // We must not intercept Ctrl-C when we have a text box and it's focused. |
150 if (prompt_field_ && prompt_field_->HasFocus()) | 150 if (prompt_field_ && prompt_field_->HasFocus()) |
151 return false; | 151 return false; |
152 | 152 |
153 ui::Clipboard* clipboard = ui::Clipboard::GetForCurrentThread(); | 153 ui::ScopedClipboardWriter scw(ui::CLIPBOARD_TYPE_COPY_PASTE); |
154 if (!clipboard) | |
155 return false; | |
156 | |
157 ui::ScopedClipboardWriter scw(clipboard, ui::CLIPBOARD_TYPE_COPY_PASTE); | |
158 base::string16 text = message_labels_[0]->text(); | 154 base::string16 text = message_labels_[0]->text(); |
159 for (size_t i = 1; i < message_labels_.size(); ++i) | 155 for (size_t i = 1; i < message_labels_.size(); ++i) |
160 text += message_labels_[i]->text(); | 156 text += message_labels_[i]->text(); |
161 scw.WriteText(text); | 157 scw.WriteText(text); |
162 return true; | 158 return true; |
163 } | 159 } |
164 | 160 |
165 /////////////////////////////////////////////////////////////////////////////// | 161 /////////////////////////////////////////////////////////////////////////////// |
166 // MessageBoxView, private: | 162 // MessageBoxView, private: |
167 | 163 |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 } | 235 } |
240 | 236 |
241 if (link_) { | 237 if (link_) { |
242 layout->AddPaddingRow(0, inter_row_vertical_spacing_); | 238 layout->AddPaddingRow(0, inter_row_vertical_spacing_); |
243 layout->StartRow(0, extra_column_view_set_id); | 239 layout->StartRow(0, extra_column_view_set_id); |
244 layout->AddView(link_); | 240 layout->AddView(link_); |
245 } | 241 } |
246 } | 242 } |
247 | 243 |
248 } // namespace views | 244 } // namespace views |
OLD | NEW |