| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "base/win/message_window.h" | 5 #include "base/win/message_window.h" |
| 6 | 6 |
| 7 #include "base/lazy_instance.h" | 7 #include "base/lazy_instance.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/process/memory.h" | 9 #include "base/process/memory.h" |
| 10 #include "base/profiler/scoped_tracker.h" |
| 10 #include "base/win/wrapped_window_proc.h" | 11 #include "base/win/wrapped_window_proc.h" |
| 11 | 12 |
| 12 const wchar_t kMessageWindowClassName[] = L"Chrome_MessageWindow"; | 13 const wchar_t kMessageWindowClassName[] = L"Chrome_MessageWindow"; |
| 13 | 14 |
| 14 namespace base { | 15 namespace base { |
| 15 namespace win { | 16 namespace win { |
| 16 | 17 |
| 17 // Used along with LazyInstance to register a window class for message-only | 18 // Used along with LazyInstance to register a window class for message-only |
| 18 // windows created by MessageWindow. | 19 // windows created by MessageWindow. |
| 19 class MessageWindow::WindowClass { | 20 class MessageWindow::WindowClass { |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 } | 114 } |
| 114 | 115 |
| 115 return true; | 116 return true; |
| 116 } | 117 } |
| 117 | 118 |
| 118 // static | 119 // static |
| 119 LRESULT CALLBACK MessageWindow::WindowProc(HWND hwnd, | 120 LRESULT CALLBACK MessageWindow::WindowProc(HWND hwnd, |
| 120 UINT message, | 121 UINT message, |
| 121 WPARAM wparam, | 122 WPARAM wparam, |
| 122 LPARAM lparam) { | 123 LPARAM lparam) { |
| 124 // TODO(vadimt): Remove ScopedTracker below once crbug.com/440919 is fixed. |
| 125 tracked_objects::ScopedTracker tracking_profile( |
| 126 FROM_HERE_WITH_EXPLICIT_FUNCTION("440919 MessageWindow::WindowProc")); |
| 127 |
| 123 MessageWindow* self = reinterpret_cast<MessageWindow*>( | 128 MessageWindow* self = reinterpret_cast<MessageWindow*>( |
| 124 GetWindowLongPtr(hwnd, GWLP_USERDATA)); | 129 GetWindowLongPtr(hwnd, GWLP_USERDATA)); |
| 125 | 130 |
| 126 switch (message) { | 131 switch (message) { |
| 127 // Set up the self before handling WM_CREATE. | 132 // Set up the self before handling WM_CREATE. |
| 128 case WM_CREATE: { | 133 case WM_CREATE: { |
| 129 CREATESTRUCT* cs = reinterpret_cast<CREATESTRUCT*>(lparam); | 134 CREATESTRUCT* cs = reinterpret_cast<CREATESTRUCT*>(lparam); |
| 130 self = reinterpret_cast<MessageWindow*>(cs->lpCreateParams); | 135 self = reinterpret_cast<MessageWindow*>(cs->lpCreateParams); |
| 131 | 136 |
| 132 // Make |hwnd| available to the message handler. At this point the control | 137 // Make |hwnd| available to the message handler. At this point the control |
| (...skipping 23 matching lines...) Expand all Loading... |
| 156 LRESULT message_result; | 161 LRESULT message_result; |
| 157 if (self->message_callback_.Run(message, wparam, lparam, &message_result)) | 162 if (self->message_callback_.Run(message, wparam, lparam, &message_result)) |
| 158 return message_result; | 163 return message_result; |
| 159 } | 164 } |
| 160 | 165 |
| 161 return DefWindowProc(hwnd, message, wparam, lparam); | 166 return DefWindowProc(hwnd, message, wparam, lparam); |
| 162 } | 167 } |
| 163 | 168 |
| 164 } // namespace win | 169 } // namespace win |
| 165 } // namespace base | 170 } // namespace base |
| OLD | NEW |