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

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

Issue 6019007: Remove win_util::FormatMessage and FormatLastWin32Error. These were only used... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 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 | « views/controls/native_control.cc ('k') | views/controls/scrollbar/native_scroll_bar_win.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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/native_control_win.h" 5 #include "views/controls/native_control_win.h"
6 6
7 #include <windowsx.h> 7 #include <windowsx.h>
8 8
9 #include "app/l10n_util_win.h" 9 #include "app/l10n_util_win.h"
10 #include "app/win/hwnd_util.h"
10 #include "app/view_prop.h" 11 #include "app/view_prop.h"
11 #include "base/logging.h" 12 #include "base/logging.h"
12 #include "base/win_util.h"
13 #include "views/focus/focus_manager.h" 13 #include "views/focus/focus_manager.h"
14 14
15 using app::ViewProp; 15 using app::ViewProp;
16 16
17 namespace views { 17 namespace views {
18 18
19 static const char* const kNativeControlWinKey = "__NATIVE_CONTROL_WIN__"; 19 static const char* const kNativeControlWinKey = "__NATIVE_CONTROL_WIN__";
20 20
21 //////////////////////////////////////////////////////////////////////////////// 21 ////////////////////////////////////////////////////////////////////////////////
22 // NativeControlWin, public: 22 // NativeControlWin, public:
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 View::ShowContextMenu(location, true); 129 View::ShowContextMenu(location, true);
130 } 130 }
131 131
132 void NativeControlWin::NativeControlCreated(HWND native_control) { 132 void NativeControlWin::NativeControlCreated(HWND native_control) {
133 // Associate this object with the control's HWND so that WidgetWin can find 133 // Associate this object with the control's HWND so that WidgetWin can find
134 // this object when it receives messages from it. 134 // this object when it receives messages from it.
135 props_.push_back(new ViewProp(native_control, kNativeControlWinKey, this)); 135 props_.push_back(new ViewProp(native_control, kNativeControlWinKey, this));
136 props_.push_back(ChildWindowMessageProcessor::Register(native_control, this)); 136 props_.push_back(ChildWindowMessageProcessor::Register(native_control, this));
137 137
138 // Subclass so we get WM_KEYDOWN and WM_SETFOCUS messages. 138 // Subclass so we get WM_KEYDOWN and WM_SETFOCUS messages.
139 original_wndproc_ = 139 original_wndproc_ = app::win::SetWindowProc(
140 win_util::SetWindowProc(native_control, 140 native_control, &NativeControlWin::NativeControlWndProc);
141 &NativeControlWin::NativeControlWndProc);
142 141
143 Attach(native_control); 142 Attach(native_control);
144 // native_view() is now valid. 143 // native_view() is now valid.
145 144
146 // Update the newly created HWND with any resident enabled state. 145 // Update the newly created HWND with any resident enabled state.
147 EnableWindow(native_view(), IsEnabled()); 146 EnableWindow(native_view(), IsEnabled());
148 147
149 // This message ensures that the focus border is shown. 148 // This message ensures that the focus border is shown.
150 SendMessage(native_view(), WM_CHANGEUISTATE, 149 SendMessage(native_view(), WM_CHANGEUISTATE,
151 MAKEWPARAM(UIS_CLEAR, UISF_HIDEFOCUS), 0); 150 MAKEWPARAM(UIS_CLEAR, UISF_HIDEFOCUS), 0);
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 } else if (message == WM_SETFOCUS) { 206 } else if (message == WM_SETFOCUS) {
208 // Let the focus manager know that the focus changed. 207 // Let the focus manager know that the focus changed.
209 FocusManager* focus_manager = native_control->GetFocusManager(); 208 FocusManager* focus_manager = native_control->GetFocusManager();
210 if (focus_manager) { 209 if (focus_manager) {
211 focus_manager->SetFocusedView(native_control->focus_view()); 210 focus_manager->SetFocusedView(native_control->focus_view());
212 } else { 211 } else {
213 NOTREACHED(); 212 NOTREACHED();
214 } 213 }
215 } else if (message == WM_DESTROY) { 214 } else if (message == WM_DESTROY) {
216 native_control->props_.reset(); 215 native_control->props_.reset();
217 win_util::SetWindowProc(window, native_control->original_wndproc_); 216 app::win::SetWindowProc(window, native_control->original_wndproc_);
218 } 217 }
219 218
220 return CallWindowProc(native_control->original_wndproc_, window, message, 219 return CallWindowProc(native_control->original_wndproc_, window, message,
221 w_param, l_param); 220 w_param, l_param);
222 } 221 }
223 222
224 } // namespace views 223 } // namespace views
OLDNEW
« no previous file with comments | « views/controls/native_control.cc ('k') | views/controls/scrollbar/native_scroll_bar_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698