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

Side by Side Diff: ui/views/controls/textfield/native_textfield_views.cc

Issue 10911074: Change how ui::Clipboard is accessed so there's only one per thread. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix various windows compile failures. Created 8 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 | Annotate | Revision Log
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/textfield/native_textfield_views.h" 5 #include "ui/views/controls/textfield/native_textfield_views.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <set> 8 #include <set>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 568 matching lines...) Expand 10 before | Expand all | Expand 10 after
579 579
580 bool NativeTextfieldViews::IsCommandIdEnabled(int command_id) const { 580 bool NativeTextfieldViews::IsCommandIdEnabled(int command_id) const {
581 bool editable = !textfield_->read_only(); 581 bool editable = !textfield_->read_only();
582 string16 result; 582 string16 result;
583 switch (command_id) { 583 switch (command_id) {
584 case IDS_APP_CUT: 584 case IDS_APP_CUT:
585 return editable && model_->HasSelection() && !textfield_->IsObscured(); 585 return editable && model_->HasSelection() && !textfield_->IsObscured();
586 case IDS_APP_COPY: 586 case IDS_APP_COPY:
587 return model_->HasSelection() && !textfield_->IsObscured(); 587 return model_->HasSelection() && !textfield_->IsObscured();
588 case IDS_APP_PASTE: 588 case IDS_APP_PASTE:
589 ViewsDelegate::views_delegate->GetClipboard() 589 ui::Clipboard::GetForCurrentThread()
Ben Goodger (Google) 2012/09/05 18:25:50 -> up a line while you're here
590 ->ReadText(ui::Clipboard::BUFFER_STANDARD, &result); 590 ->ReadText(ui::Clipboard::BUFFER_STANDARD, &result);
591 return editable && !result.empty(); 591 return editable && !result.empty();
592 case IDS_APP_DELETE: 592 case IDS_APP_DELETE:
593 return editable && model_->HasSelection(); 593 return editable && model_->HasSelection();
594 case IDS_APP_SELECT_ALL: 594 case IDS_APP_SELECT_ALL:
595 return true; 595 return true;
596 default: 596 default:
597 return textfield_->GetController()->IsCommandIdEnabled(command_id); 597 return textfield_->GetController()->IsCommandIdEnabled(command_id);
598 } 598 }
599 } 599 }
(...skipping 619 matching lines...) Expand 10 before | Expand all | Expand 10 after
1219 // Filter out all control characters, including tab and new line characters, 1219 // Filter out all control characters, including tab and new line characters,
1220 // and all characters with Alt modifier. But we need to allow characters with 1220 // and all characters with Alt modifier. But we need to allow characters with
1221 // AltGr modifier. 1221 // AltGr modifier.
1222 // On Windows AltGr is represented by Alt+Ctrl, and on Linux it's a different 1222 // On Windows AltGr is represented by Alt+Ctrl, and on Linux it's a different
1223 // flag that we don't care about. 1223 // flag that we don't care about.
1224 return ((ch >= 0x20 && ch < 0x7F) || ch > 0x9F) && 1224 return ((ch >= 0x20 && ch < 0x7F) || ch > 0x9F) &&
1225 (flags & ~(ui::EF_SHIFT_DOWN | ui::EF_CAPS_LOCK_DOWN)) != ui::EF_ALT_DOWN; 1225 (flags & ~(ui::EF_SHIFT_DOWN | ui::EF_CAPS_LOCK_DOWN)) != ui::EF_ALT_DOWN;
1226 } 1226 }
1227 1227
1228 } // namespace views 1228 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698