[email protected] | f781782 | 2009-09-24 05:11:58 | [diff] [blame] | 1 | // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #ifndef CHROME_FRAME_FIND_DIALOG_H_ |
| 6 | #define CHROME_FRAME_FIND_DIALOG_H_ |
| 7 | |
| 8 | #include <atlbase.h> |
| 9 | #include <atlwin.h> |
| 10 | |
| 11 | #include "base/ref_counted.h" |
| 12 | #include "resource.h" |
[email protected] | 3c6f8e1 | 2010-03-24 21:58:21 | [diff] [blame] | 13 | #include "grit/generated_resources.h" |
[email protected] | f781782 | 2009-09-24 05:11:58 | [diff] [blame] | 14 | |
| 15 | class ChromeFrameAutomationClient; |
| 16 | |
| 17 | class CFFindDialog : public CDialogImpl<CFFindDialog> { |
| 18 | public: |
[email protected] | 3c6f8e1 | 2010-03-24 21:58:21 | [diff] [blame] | 19 | enum { IDD = IDD_CHROME_FRAME_FIND_DIALOG }; |
[email protected] | f781782 | 2009-09-24 05:11:58 | [diff] [blame] | 20 | |
| 21 | BEGIN_MSG_MAP(CFFindDialog) |
| 22 | MESSAGE_HANDLER(WM_DESTROY, OnDestroy) |
| 23 | MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog) |
| 24 | COMMAND_ID_HANDLER(IDOK, OnFind) |
| 25 | COMMAND_ID_HANDLER(IDCANCEL, OnCancel) |
| 26 | END_MSG_MAP() |
| 27 | |
| 28 | CFFindDialog(); |
| 29 | void Init(ChromeFrameAutomationClient* automation_client); |
| 30 | |
| 31 | LRESULT OnDestroy(UINT msg, WPARAM wparam, |
| 32 | LPARAM lparam, BOOL& handled); // NOLINT |
| 33 | LRESULT OnFind(WORD wNotifyCode, WORD wID, |
| 34 | HWND hWndCtl, BOOL& bHandled); // NOLINT |
| 35 | LRESULT OnCancel(WORD wNotifyCode, WORD wID, |
| 36 | HWND hWndCtl, BOOL& bHandled); // NOLINT |
| 37 | LRESULT OnInitDialog(UINT msg, WPARAM wparam, |
| 38 | LPARAM lparam, BOOL& handled); // NOLINT |
| 39 | |
| 40 | private: |
| 41 | |
| 42 | // Since the message loop we expect to run in isn't going to be nicely |
| 43 | // calling IsDialogMessage(), we need to hook the wnd proc and call it |
| 44 | // ourselves. See http://support.microsoft.com/kb/q187988/ |
| 45 | bool InstallMessageHook(); |
| 46 | bool UninstallMessageHook(); |
| 47 | static LRESULT CALLBACK GetMsgProc(int code, WPARAM wparam, LPARAM lparam); |
| 48 | static HHOOK msg_hook_; |
| 49 | |
| 50 | // We don't own these, and they must exist at least as long as we do. |
[email protected] | b0febbf | 2009-11-12 17:49:35 | [diff] [blame] | 51 | scoped_refptr<ChromeFrameAutomationClient> automation_client_; |
[email protected] | f781782 | 2009-09-24 05:11:58 | [diff] [blame] | 52 | }; |
| 53 | |
| 54 | #endif // CHROME_FRAME_FIND_DIALOG_H_ |