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