Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 #ifndef UI_VIEWS_WIN_HWND_MESSAGE_HANDLER_H_ | 5 #ifndef UI_VIEWS_WIN_HWND_MESSAGE_HANDLER_H_ |
| 6 #define UI_VIEWS_WIN_HWND_MESSAGE_HANDLER_H_ | 6 #define UI_VIEWS_WIN_HWND_MESSAGE_HANDLER_H_ |
| 7 | 7 |
| 8 #include <windows.h> | 8 #include <windows.h> |
| 9 #include <atlbase.h> | 9 #include <atlbase.h> |
| 10 #include <atlapp.h> | 10 #include <atlapp.h> |
| 11 #include <atlmisc.h> | 11 #include <atlmisc.h> |
| 12 | 12 |
| 13 #include <set> | 13 #include <set> |
| 14 #include <vector> | 14 #include <vector> |
| 15 | 15 |
| 16 #include "base/basictypes.h" | 16 #include "base/basictypes.h" |
| 17 #include "base/compiler_specific.h" | 17 #include "base/compiler_specific.h" |
| 18 #include "base/memory/scoped_ptr.h" | 18 #include "base/memory/scoped_ptr.h" |
| 19 #include "base/memory/weak_ptr.h" | 19 #include "base/memory/weak_ptr.h" |
| 20 #include "base/message_loop/message_loop.h" | 20 #include "base/message_loop/message_loop.h" |
|
sky
2014/01/29 04:06:20
I suspect you can remove this include now.
scottmg
2014/01/29 06:27:53
Done.
| |
| 21 #include "base/strings/string16.h" | 21 #include "base/strings/string16.h" |
| 22 #include "base/win/scoped_gdi_object.h" | 22 #include "base/win/scoped_gdi_object.h" |
| 23 #include "base/win/win_util.h" | 23 #include "base/win/win_util.h" |
| 24 #include "ui/base/accessibility/accessibility_types.h" | 24 #include "ui/base/accessibility/accessibility_types.h" |
| 25 #include "ui/base/ui_base_types.h" | 25 #include "ui/base/ui_base_types.h" |
| 26 #include "ui/events/event.h" | 26 #include "ui/events/event.h" |
| 27 #include "ui/gfx/rect.h" | 27 #include "ui/gfx/rect.h" |
| 28 #include "ui/gfx/sequential_id_generator.h" | 28 #include "ui/gfx/sequential_id_generator.h" |
| 29 #include "ui/gfx/win/window_impl.h" | 29 #include "ui/gfx/win/window_impl.h" |
| 30 #include "ui/views/ime/input_method_delegate.h" | 30 #include "ui/views/ime/input_method_delegate.h" |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 101 case 0: | 101 case 0: |
| 102 | 102 |
| 103 // An object that handles messages for a HWND that implements the views | 103 // An object that handles messages for a HWND that implements the views |
| 104 // "Custom Frame" look. The purpose of this class is to isolate the windows- | 104 // "Custom Frame" look. The purpose of this class is to isolate the windows- |
| 105 // specific message handling from the code that wraps it. It is intended to be | 105 // specific message handling from the code that wraps it. It is intended to be |
| 106 // used by both a views::NativeWidget and an aura::WindowTreeHost | 106 // used by both a views::NativeWidget and an aura::WindowTreeHost |
| 107 // implementation. | 107 // implementation. |
| 108 // TODO(beng): This object should eventually *become* the WindowImpl. | 108 // TODO(beng): This object should eventually *become* the WindowImpl. |
| 109 class VIEWS_EXPORT HWNDMessageHandler : | 109 class VIEWS_EXPORT HWNDMessageHandler : |
| 110 public gfx::WindowImpl, | 110 public gfx::WindowImpl, |
| 111 public internal::InputMethodDelegate, | 111 public internal::InputMethodDelegate { |
| 112 public base::MessageLoopForUI::Observer { | |
| 113 public: | 112 public: |
| 114 explicit HWNDMessageHandler(HWNDMessageHandlerDelegate* delegate); | 113 explicit HWNDMessageHandler(HWNDMessageHandlerDelegate* delegate); |
| 115 ~HWNDMessageHandler(); | 114 ~HWNDMessageHandler(); |
| 116 | 115 |
| 117 void Init(HWND parent, const gfx::Rect& bounds); | 116 void Init(HWND parent, const gfx::Rect& bounds); |
| 118 void InitModalType(ui::ModalType modal_type); | 117 void InitModalType(ui::ModalType modal_type); |
| 119 | 118 |
| 120 void Close(); | 119 void Close(); |
| 121 void CloseNow(); | 120 void CloseNow(); |
| 122 | 121 |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 202 | 201 |
| 203 // Overridden from internal::InputMethodDelegate: | 202 // Overridden from internal::InputMethodDelegate: |
| 204 virtual void DispatchKeyEventPostIME(const ui::KeyEvent& key) OVERRIDE; | 203 virtual void DispatchKeyEventPostIME(const ui::KeyEvent& key) OVERRIDE; |
| 205 | 204 |
| 206 // Overridden from WindowImpl: | 205 // Overridden from WindowImpl: |
| 207 virtual HICON GetDefaultWindowIcon() const OVERRIDE; | 206 virtual HICON GetDefaultWindowIcon() const OVERRIDE; |
| 208 virtual LRESULT OnWndProc(UINT message, | 207 virtual LRESULT OnWndProc(UINT message, |
| 209 WPARAM w_param, | 208 WPARAM w_param, |
| 210 LPARAM l_param) OVERRIDE; | 209 LPARAM l_param) OVERRIDE; |
| 211 | 210 |
| 212 // Overridden from MessageLoopForUI::Observer: | |
| 213 virtual base::EventStatus WillProcessEvent( | |
| 214 const base::NativeEvent& event) OVERRIDE; | |
| 215 virtual void DidProcessEvent(const base::NativeEvent& event) OVERRIDE; | |
| 216 | |
| 217 // Returns the auto-hide edges of the appbar. See Appbar::GetAutohideEdges() | 211 // Returns the auto-hide edges of the appbar. See Appbar::GetAutohideEdges() |
| 218 // for details. If the edges change OnAppbarAutohideEdgesChanged() is called. | 212 // for details. If the edges change OnAppbarAutohideEdgesChanged() is called. |
| 219 int GetAppbarAutohideEdges(HMONITOR monitor); | 213 int GetAppbarAutohideEdges(HMONITOR monitor); |
| 220 | 214 |
| 221 // Callback if the autohide edges have changed. See Appbar for details. | 215 // Callback if the autohide edges have changed. See Appbar for details. |
| 222 void OnAppbarAutohideEdgesChanged(); | 216 void OnAppbarAutohideEdgesChanged(); |
| 223 | 217 |
| 224 // Can be called after the delegate has had the opportunity to set focus and | 218 // Can be called after the delegate has had the opportunity to set focus and |
| 225 // did not do so. | 219 // did not do so. |
| 226 void SetInitialFocus(); | 220 void SetInitialFocus(); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 270 | 264 |
| 271 // Lock or unlock the window from being able to redraw itself in response to | 265 // Lock or unlock the window from being able to redraw itself in response to |
| 272 // updates to its invalid region. | 266 // updates to its invalid region. |
| 273 class ScopedRedrawLock; | 267 class ScopedRedrawLock; |
| 274 void LockUpdates(bool force); | 268 void LockUpdates(bool force); |
| 275 void UnlockUpdates(bool force); | 269 void UnlockUpdates(bool force); |
| 276 | 270 |
| 277 // Stops ignoring SetWindowPos() requests (see below). | 271 // Stops ignoring SetWindowPos() requests (see below). |
| 278 void StopIgnoringPosChanges() { ignore_window_pos_changes_ = false; } | 272 void StopIgnoringPosChanges() { ignore_window_pos_changes_ = false; } |
| 279 | 273 |
| 280 // Synchronously paints the invalid contents of the Widget. | |
| 281 void RedrawInvalidRect(); | |
| 282 | |
| 283 // Synchronously updates the invalid contents of the Widget. Valid for | 274 // Synchronously updates the invalid contents of the Widget. Valid for |
| 284 // layered windows only. | 275 // layered windows only. |
| 285 void RedrawLayeredWindowContents(); | 276 void RedrawLayeredWindowContents(); |
| 286 | 277 |
| 287 // Attempts to force the window to be redrawn, ensuring that it gets | 278 // Attempts to force the window to be redrawn, ensuring that it gets |
| 288 // onscreen. | 279 // onscreen. |
| 289 void ForceRedrawWindow(int attempts); | 280 void ForceRedrawWindow(int attempts); |
| 290 | 281 |
| 291 // Message Handlers ---------------------------------------------------------- | 282 // Message Handlers ---------------------------------------------------------- |
| 292 | 283 |
| (...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 556 }; | 547 }; |
| 557 | 548 |
| 558 // This window property if set on the window does not activate the window for a | 549 // This window property if set on the window does not activate the window for a |
| 559 // touch based WM_MOUSEACTIVATE message. | 550 // touch based WM_MOUSEACTIVATE message. |
| 560 const wchar_t kIgnoreTouchMouseActivateForWindow[] = | 551 const wchar_t kIgnoreTouchMouseActivateForWindow[] = |
| 561 L"Chrome.IgnoreMouseActivate"; | 552 L"Chrome.IgnoreMouseActivate"; |
| 562 | 553 |
| 563 } // namespace views | 554 } // namespace views |
| 564 | 555 |
| 565 #endif // UI_VIEWS_WIN_HWND_MESSAGE_HANDLER_H_ | 556 #endif // UI_VIEWS_WIN_HWND_MESSAGE_HANDLER_H_ |
| OLD | NEW |