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

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

Issue 10837317: Setting the touch wrench menu as default menu for ChromeOS (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: And another merge! 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 1051 matching lines...) Expand 10 before | Expand all | Expand 10 after
1062 } 1062 }
1063 } 1063 }
1064 1064
1065 void NativeTextfieldViews::UpdateContextMenu() { 1065 void NativeTextfieldViews::UpdateContextMenu() {
1066 if (!context_menu_contents_.get()) { 1066 if (!context_menu_contents_.get()) {
1067 context_menu_contents_.reset(new ui::SimpleMenuModel(this)); 1067 context_menu_contents_.reset(new ui::SimpleMenuModel(this));
1068 context_menu_contents_->AddItemWithStringId(IDS_APP_CUT, IDS_APP_CUT); 1068 context_menu_contents_->AddItemWithStringId(IDS_APP_CUT, IDS_APP_CUT);
1069 context_menu_contents_->AddItemWithStringId(IDS_APP_COPY, IDS_APP_COPY); 1069 context_menu_contents_->AddItemWithStringId(IDS_APP_COPY, IDS_APP_COPY);
1070 context_menu_contents_->AddItemWithStringId(IDS_APP_PASTE, IDS_APP_PASTE); 1070 context_menu_contents_->AddItemWithStringId(IDS_APP_PASTE, IDS_APP_PASTE);
1071 context_menu_contents_->AddItemWithStringId(IDS_APP_DELETE, IDS_APP_DELETE); 1071 context_menu_contents_->AddItemWithStringId(IDS_APP_DELETE, IDS_APP_DELETE);
1072 context_menu_contents_->AddSeparator(); 1072 context_menu_contents_->AddSeparator(ui::NORMAL_SEPARATOR);
1073 context_menu_contents_->AddItemWithStringId(IDS_APP_SELECT_ALL, 1073 context_menu_contents_->AddItemWithStringId(IDS_APP_SELECT_ALL,
1074 IDS_APP_SELECT_ALL); 1074 IDS_APP_SELECT_ALL);
1075 TextfieldController* controller = textfield_->GetController(); 1075 TextfieldController* controller = textfield_->GetController();
1076 if (controller) 1076 if (controller)
1077 controller->UpdateContextMenu(context_menu_contents_.get()); 1077 controller->UpdateContextMenu(context_menu_contents_.get());
1078 1078
1079 context_menu_delegate_.reset( 1079 context_menu_delegate_.reset(
1080 new views::MenuModelAdapter(context_menu_contents_.get())); 1080 new views::MenuModelAdapter(context_menu_contents_.get()));
1081 context_menu_runner_.reset( 1081 context_menu_runner_.reset(
1082 new MenuRunner(new views::MenuItemView(context_menu_delegate_.get()))); 1082 new MenuRunner(new views::MenuItemView(context_menu_delegate_.get())));
(...skipping 136 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
« no previous file with comments | « ui/views/controls/menu/menu_separator_views.cc ('k') | ui/views/controls/textfield/native_textfield_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698