Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Side by Side Diff: ui/views/controls/message_box_view.cc

Issue 558913003: Remove clipboard argument from ScopedClipboardWriter constructor. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Don't leak a clipboard on Windows Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/base/clipboard/scoped_clipboard_writer.cc ('k') | ui/views/controls/textfield/textfield.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « ui/base/clipboard/scoped_clipboard_writer.cc ('k') | ui/views/controls/textfield/textfield.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698