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

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

Issue 11973011: Fixes leak of NativeTextfieldWin. The underlying HWND was getting (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 11 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 | « ui/views/controls/textfield/native_textfield_win.h ('k') | 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) 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_win.h" 5 #include "ui/views/controls/textfield/native_textfield_win.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/i18n/case_conversion.h" 9 #include "base/i18n/case_conversion.h"
10 #include "base/i18n/rtl.h" 10 #include "base/i18n/rtl.h"
(...skipping 1066 matching lines...) Expand 10 before | Expand all | Expand 10 after
1077 // useful, so we discard most. Exceptions: 1077 // useful, so we discard most. Exceptions:
1078 // * ctrl-alt-<xxx>, which is sometimes important, generates WM_CHAR instead 1078 // * ctrl-alt-<xxx>, which is sometimes important, generates WM_CHAR instead
1079 // of WM_SYSCHAR, so it doesn't need to be handled here. 1079 // of WM_SYSCHAR, so it doesn't need to be handled here.
1080 // * alt-space gets translated by the default WM_SYSCHAR handler to a 1080 // * alt-space gets translated by the default WM_SYSCHAR handler to a
1081 // WM_SYSCOMMAND to open the application context menu, so we need to allow 1081 // WM_SYSCOMMAND to open the application context menu, so we need to allow
1082 // it through. 1082 // it through.
1083 if (ch == VK_SPACE) 1083 if (ch == VK_SPACE)
1084 SetMsgHandled(false); 1084 SetMsgHandled(false);
1085 } 1085 }
1086 1086
1087 void NativeTextfieldWin::OnFinalMessage(HWND hwnd) {
1088 delete this;
1089 }
1090
1087 void NativeTextfieldWin::HandleKeystroke() { 1091 void NativeTextfieldWin::HandleKeystroke() {
1088 const MSG* msg = GetCurrentMessage(); 1092 const MSG* msg = GetCurrentMessage();
1089 ScopedFreeze freeze(this, GetTextObjectModel()); 1093 ScopedFreeze freeze(this, GetTextObjectModel());
1090 1094
1091 TextfieldController* controller = textfield_->GetController(); 1095 TextfieldController* controller = textfield_->GetController();
1092 bool handled = false; 1096 bool handled = false;
1093 if (controller) { 1097 if (controller) {
1094 ui::KeyEvent event(*msg, msg->message == WM_CHAR); 1098 ui::KeyEvent event(*msg, msg->message == WM_CHAR);
1095 handled = controller->HandleKeyEvent(textfield_, event); 1099 handled = controller->HandleKeyEvent(textfield_, event);
1096 } 1100 }
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
1275 context_menu_contents_->AddSeparator(ui::NORMAL_SEPARATOR); 1279 context_menu_contents_->AddSeparator(ui::NORMAL_SEPARATOR);
1276 context_menu_contents_->AddItemWithStringId(IDS_APP_CUT, IDS_APP_CUT); 1280 context_menu_contents_->AddItemWithStringId(IDS_APP_CUT, IDS_APP_CUT);
1277 context_menu_contents_->AddItemWithStringId(IDS_APP_COPY, IDS_APP_COPY); 1281 context_menu_contents_->AddItemWithStringId(IDS_APP_COPY, IDS_APP_COPY);
1278 context_menu_contents_->AddItemWithStringId(IDS_APP_PASTE, IDS_APP_PASTE); 1282 context_menu_contents_->AddItemWithStringId(IDS_APP_PASTE, IDS_APP_PASTE);
1279 context_menu_contents_->AddSeparator(ui::NORMAL_SEPARATOR); 1283 context_menu_contents_->AddSeparator(ui::NORMAL_SEPARATOR);
1280 context_menu_contents_->AddItemWithStringId(IDS_APP_SELECT_ALL, 1284 context_menu_contents_->AddItemWithStringId(IDS_APP_SELECT_ALL,
1281 IDS_APP_SELECT_ALL); 1285 IDS_APP_SELECT_ALL);
1282 } 1286 }
1283 1287
1284 } // namespace views 1288 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/controls/textfield/native_textfield_win.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698