OLD | NEW |
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 // CeeeExecutor implementation | 5 // CeeeExecutor implementation |
6 // | 6 // |
7 // We use interfaces named ITabWindowManager and ITabWindow | 7 // We use interfaces named ITabWindowManager and ITabWindow |
8 // (documented at | 8 // (documented at |
9 // http://www.geoffchappell.com/viewer.htm?doc=studies/windows/ie/ieframe/interf
aces/itabwindowmanager.htm | 9 // http://www.geoffchappell.com/viewer.htm?doc=studies/windows/ie/ieframe/interf
aces/itabwindowmanager.htm |
10 // and | 10 // and |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 | 94 |
95 hook_ = ::SetWindowsHookEx(WH_GETMESSAGE, GetMsgProc, | 95 hook_ = ::SetWindowsHookEx(WH_GETMESSAGE, GetMsgProc, |
96 static_cast<HINSTANCE>(_AtlBaseModule.GetModuleInstance()), thread_id); | 96 static_cast<HINSTANCE>(_AtlBaseModule.GetModuleInstance()), thread_id); |
97 if (hook_ == NULL) { | 97 if (hook_ == NULL) { |
98 LOG(ERROR) << "Couldn't hook into thread: " << thread_id << " " << | 98 LOG(ERROR) << "Couldn't hook into thread: " << thread_id << " " << |
99 com::LogWe(); | 99 com::LogWe(); |
100 current_thread_id_ = 0; | 100 current_thread_id_ = 0; |
101 return E_FAIL; | 101 return E_FAIL; |
102 } | 102 } |
103 | 103 |
| 104 // We have seen a case where a hook may call us in the Broker process |
| 105 // but the DLL is not loaded anymore... This is weird... But to make sure |
| 106 // this doesn't cause a crash when it happens, we pin ourselves here to make |
| 107 // sure we won't be called when unloaded. |
| 108 PinModule(); |
| 109 |
104 // We unfortunately can't Send a synchronous message here. | 110 // We unfortunately can't Send a synchronous message here. |
105 // If we do, any calls back to the broker fail with the following error: | 111 // If we do, any calls back to the broker fail with the following error: |
106 // "An outgoing call cannot be made since the application is dispatching an | 112 // "An outgoing call cannot be made since the application is dispatching an |
107 // input synchronous call." | 113 // input synchronous call." |
108 BOOL success = ::PostThreadMessage(thread_id, kCreateWindowExecutorMessage, | 114 BOOL success = ::PostThreadMessage(thread_id, kCreateWindowExecutorMessage, |
109 0, static_cast<LPARAM>(window)); | 115 0, static_cast<LPARAM>(window)); |
110 if (success) | 116 if (success) |
111 return S_OK; | 117 return S_OK; |
112 else | 118 else |
113 return HRESULT_FROM_WIN32(::GetLastError()); | 119 return HRESULT_FROM_WIN32(::GetLastError()); |
(...skipping 905 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1019 | 1025 |
1020 STDMETHODIMP CeeeExecutor::OnTopFrameBeforeNavigate(BSTR url) { | 1026 STDMETHODIMP CeeeExecutor::OnTopFrameBeforeNavigate(BSTR url) { |
1021 DCHECK(infobar_manager_ != NULL) << "infobar_manager_ is not initialized"; | 1027 DCHECK(infobar_manager_ != NULL) << "infobar_manager_ is not initialized"; |
1022 if (infobar_manager_ == NULL) | 1028 if (infobar_manager_ == NULL) |
1023 return E_FAIL; | 1029 return E_FAIL; |
1024 | 1030 |
1025 // According to the specification, tab navigation closes the infobar. | 1031 // According to the specification, tab navigation closes the infobar. |
1026 infobar_manager_->HideAll(); | 1032 infobar_manager_->HideAll(); |
1027 return S_OK; | 1033 return S_OK; |
1028 } | 1034 } |
OLD | NEW |