Chromium Code Reviews| Index: chrome_frame/ready_mode/internal/ready_prompt_window.h |
| =================================================================== |
| --- chrome_frame/ready_mode/internal/ready_prompt_window.h (revision 72310) |
| +++ chrome_frame/ready_mode/internal/ready_prompt_window.h (working copy) |
| @@ -14,12 +14,18 @@ |
| #include "base/weak_ptr.h" |
| #include "base/scoped_ptr.h" |
| +#include "base/win/scoped_comptr.h" |
| #include "chrome_frame/infobars/infobar_content.h" |
| #include "chrome_frame/resource.h" |
| #include "grit/generated_resources.h" |
| class ReadyModeState; |
| +class UrlLauncher; |
| +namespace WTL { |
| +class CHyperLink; |
| +} // namespace WTL |
| + |
| // Implements a dialog with text and buttons inviting the user to permanently |
| // activate the product or temporarily/permanently disable Ready Mode. |
| class ReadyPromptWindow |
| @@ -28,39 +34,49 @@ |
| public: |
| enum { IDD = IDD_CHROME_FRAME_READY_PROMPT }; |
| - ReadyPromptWindow(); |
| - ~ReadyPromptWindow() {} |
| - |
| - // Initializes the dialog for display in the provided frame. The |
| + // Creates and initializes a dialog for display in the provided frame. The |
| // ReadyModeState will be invoked to capture the user's response, if any. |
| + // The UrlLauncher may be used to launch a new tab containing a |
| + // knowledge-base article about Ready Mode. |
| // |
| // Upon success, takes ownership of itself (to be deleted upon WM_DESTROY) and |
| // returns a weak pointer to this dialog. Upon failure, returns a null weak |
| // pointer and deletes self. |
| // |
| - // In either case, takes ownership of the ReadyModeState, but not the frame. |
| - base::WeakPtr<ReadyPromptWindow> Initialize(InfobarContent::Frame* frame, |
| - ReadyModeState* ready_mode_state); |
| + // In either case, takes ownership of the ReadyModeState and UrlLauncher, but |
| + // not the frame. |
| + static base::WeakPtr<ReadyPromptWindow> CreateInstance( |
| + InfobarContent::Frame* frame, |
| + ReadyModeState* ready_mode_state, |
| + UrlLauncher* url_launcher); |
| BEGIN_MSG_MAP(InfobarWindow) |
| MSG_WM_INITDIALOG(OnInitDialog) |
| MSG_WM_DESTROY(OnDestroy) |
| + NOTIFY_HANDLER(IDC_PROMPT_LINK, NM_CLICK, OnLearnMore) |
| COMMAND_HANDLER(IDACTIVATE, BN_CLICKED, OnYes) |
| - COMMAND_HANDLER(IDLATER, BN_CLICKED, OnRemindMeLater) |
| COMMAND_HANDLER(IDNEVER, BN_CLICKED, OnNo) |
| CHAIN_MSG_MAP(CDialogResize<ReadyPromptWindow>) |
| END_MSG_MAP() |
| BEGIN_DLGRESIZE_MAP(InfobarWindow) |
| DLGRESIZE_CONTROL(IDACTIVATE, DLSZ_CENTER_Y | DLSZ_MOVE_X) |
| - DLGRESIZE_CONTROL(IDLATER, DLSZ_CENTER_Y | DLSZ_MOVE_X) |
| DLGRESIZE_CONTROL(IDNEVER, DLSZ_CENTER_Y | DLSZ_MOVE_X) |
| DLGRESIZE_CONTROL(IDC_PROMPT_MESSAGE, DLSZ_SIZE_Y | DLSZ_SIZE_X) |
| + DLGRESIZE_CONTROL(IDC_PROMPT_LINK, DLSZ_CENTER_Y | DLSZ_MOVE_X) |
| END_DLGRESIZE_MAP() |
| virtual void OnFinalMessage(HWND); |
| private: |
| + // Call CreateInstance() to get an initialized ReadyPromptWindow. |
| + ReadyPromptWindow(InfobarContent::Frame* frame, |
| + ReadyModeState* ready_mode_state, |
| + UrlLauncher* url_launcher); |
| + |
| + // The ReadyPromptWindow manages its own destruction. |
| + virtual ~ReadyPromptWindow(); |
| + |
| // Event handlers. |
| void OnDestroy(); |
| BOOL OnInitDialog(CWindow wndFocus, LPARAM lInitParam); |
| @@ -72,6 +88,7 @@ |
| WORD wID, |
| HWND hWndCtl, |
| BOOL& bHandled); |
| + LRESULT OnLearnMore(WORD wParam, LPNMHDR lParam, BOOL& bHandled); // NOLINT |
|
tommi (sloooow) - chröme
2011/01/24 17:54:23
remove all hungarian
erikwright (departed)
2011/01/24 18:55:19
See comment in the implementation file.
|
| LRESULT OnNo(WORD wNotifyCode, |
| WORD wID, |
| HWND hWndCtl, |
| @@ -79,6 +96,8 @@ |
| InfobarContent::Frame* frame_; // Not owned by this instance |
| scoped_ptr<ReadyModeState> ready_mode_state_; |
| + scoped_ptr<WTL::CHyperLink> link_; |
| + scoped_ptr<UrlLauncher> url_launcher_; |
| base::WeakPtrFactory<ReadyPromptWindow> weak_ptr_factory_; |
| DISALLOW_COPY_AND_ASSIGN(ReadyPromptWindow); |