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

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

Issue 115768: On MessageBoxView, do not intercept Ctrl-C by an Accelerator when the... (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: Created 11 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | 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) 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 "views/controls/message_box_view.h" 5 #include "views/controls/message_box_view.h"
6 6
7 #include "app/l10n_util.h" 7 #include "app/l10n_util.h"
8 #include "app/message_box_flags.h" 8 #include "app/message_box_flags.h"
9 #include "base/clipboard.h" 9 #include "base/clipboard.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 if (prompt_field_) 87 if (prompt_field_)
88 prompt_field_->SelectAll(); 88 prompt_field_->SelectAll();
89 } 89 }
90 } 90 }
91 91
92 bool MessageBoxView::AcceleratorPressed( 92 bool MessageBoxView::AcceleratorPressed(
93 const views::Accelerator& accelerator) { 93 const views::Accelerator& accelerator) {
94 // We only accepts Ctrl-C. 94 // We only accepts Ctrl-C.
95 DCHECK(accelerator.GetKeyCode() == 'C' && accelerator.IsCtrlDown()); 95 DCHECK(accelerator.GetKeyCode() == 'C' && accelerator.IsCtrlDown());
96 96
97 // We must not intercept Ctrl-C when we have a text box and it's focused.
98 if (prompt_field_ && prompt_field_->HasFocus())
99 return false;
100
97 if (!views::ViewsDelegate::views_delegate) 101 if (!views::ViewsDelegate::views_delegate)
98 return false; 102 return false;
99 103
100 Clipboard* clipboard = views::ViewsDelegate::views_delegate->GetClipboard(); 104 Clipboard* clipboard = views::ViewsDelegate::views_delegate->GetClipboard();
101 if (!clipboard) 105 if (!clipboard)
102 return false; 106 return false;
103 107
104 ScopedClipboardWriter scw(clipboard); 108 ScopedClipboardWriter scw(clipboard);
105 scw.WriteText(message_label_->GetText()); 109 scw.WriteText(message_label_->GetText());
106 return true; 110 return true;
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 } 206 }
203 207
204 if (checkbox_) { 208 if (checkbox_) {
205 layout->AddPaddingRow(0, kRelatedControlVerticalSpacing); 209 layout->AddPaddingRow(0, kRelatedControlVerticalSpacing);
206 layout->StartRow(0, checkbox_column_view_set_id); 210 layout->StartRow(0, checkbox_column_view_set_id);
207 layout->AddView(checkbox_); 211 layout->AddView(checkbox_);
208 } 212 }
209 213
210 layout->AddPaddingRow(0, kRelatedControlVerticalSpacing); 214 layout->AddPaddingRow(0, kRelatedControlVerticalSpacing);
211 } 215 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698