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 "win8/metro_driver/ime/ime_popup_monitor.h" | 5 #include "win8/metro_driver/ime/ime_popup_monitor.h" |
6 | 6 |
7 #include <windows.h> | 7 #include <windows.h> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
11 #include "win8/metro_driver/ime/ime_popup_observer.h" | 11 #include "win8/metro_driver/ime/ime_popup_observer.h" |
12 | 12 |
13 namespace metro_driver { | 13 namespace metro_driver { |
14 namespace { | 14 namespace { |
15 | 15 |
16 ImePopupObserver* g_observer_ = NULL; | 16 ImePopupObserver* g_observer_ = NULL; |
17 HWINEVENTHOOK g_hook_handle_ = NULL; | 17 HWINEVENTHOOK g_hook_handle_ = NULL; |
18 | 18 |
19 void CALLBACK ImeEventCallback(HWINEVENTHOOK win_event_hook_handle, | 19 void CALLBACK ImeEventCallback(HWINEVENTHOOK win_event_hook_handle, |
20 DWORD event, | 20 DWORD event, |
21 HWND window_handle, | 21 HWND window_handle, |
22 LONG object_id, | 22 LONG object_id, |
23 LONG child_id, | 23 LONG child_id, |
24 DWORD event_thread, | 24 DWORD event_thread, |
25 DWORD event_time) { | 25 DWORD event_time) { |
26 // This function is registered to SetWinEventHook to be called back on the UI | 26 // This function is registered to SetWinEventHook to be called back on the UI |
27 // thread. | 27 // thread. |
28 DCHECK(base::MessageLoop::current()->IsType(base::MessageLoop::TYPE_UI)); | 28 DCHECK(base::MessageLoopForUI::IsCurrent()); |
29 | 29 |
30 if (!g_observer_) | 30 if (!g_observer_) |
31 return; | 31 return; |
32 switch (event) { | 32 switch (event) { |
33 case EVENT_OBJECT_IME_SHOW: | 33 case EVENT_OBJECT_IME_SHOW: |
34 g_observer_->OnImePopupChanged(ImePopupObserver::kPopupShown); | 34 g_observer_->OnImePopupChanged(ImePopupObserver::kPopupShown); |
35 return; | 35 return; |
36 case EVENT_OBJECT_IME_HIDE: | 36 case EVENT_OBJECT_IME_HIDE: |
37 g_observer_->OnImePopupChanged(ImePopupObserver::kPopupHidden); | 37 g_observer_->OnImePopupChanged(ImePopupObserver::kPopupHidden); |
38 return; | 38 return; |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 return; | 73 return; |
74 g_observer_ = NULL; | 74 g_observer_ = NULL; |
75 if (!g_hook_handle_) | 75 if (!g_hook_handle_) |
76 return; | 76 return; |
77 const bool unhook_succeeded = !!UnhookWinEvent(g_hook_handle_); | 77 const bool unhook_succeeded = !!UnhookWinEvent(g_hook_handle_); |
78 LOG_IF(ERROR, !unhook_succeeded) << "UnhookWinEvent failed."; | 78 LOG_IF(ERROR, !unhook_succeeded) << "UnhookWinEvent failed."; |
79 g_hook_handle_ = NULL; | 79 g_hook_handle_ = NULL; |
80 } | 80 } |
81 | 81 |
82 } // namespace metro_driver | 82 } // namespace metro_driver |
OLD | NEW |