Chromium Code Reviews| Index: chrome_frame/ready_prompt.cc |
| =================================================================== |
| --- chrome_frame/ready_prompt.cc (revision 0) |
| +++ chrome_frame/ready_prompt.cc (revision 0) |
| @@ -0,0 +1,90 @@ |
| +#include "chrome_frame/chrome_frame_ready_prompt.h" |
| + |
| +ReadyPromptContent::ReadyPromptContent() |
| + : frame_(NULL) { |
| +} |
|
grt (UTC plus 2)
2010/11/10 17:59:29
newline after this
|
| +HRESULT ReadyPromptContent::InstallInFrame(ContentFrame* frame) { |
| + if (frame_ && frame_ != frame) { |
|
grt (UTC plus 2)
2010/11/10 17:59:29
Some single-statement ifs in the CL have braces, s
erikwright (departed)
2010/11/24 06:24:56
Agreed. Planning a sweep at the end.
|
| + Reset(); |
| + } |
| + |
| + frame_ = frame; |
| + Create(frame_->GetFrameWindow()); |
| + if (!IsWindow()) |
| + return E_UNEXPECTED; |
|
grt (UTC plus 2)
2010/11/10 17:59:29
Is expected that frame_ == frame upon E_UNEXPECTED
erikwright (departed)
2010/11/24 06:24:56
No. already fixed in working copy.
|
| + |
| + return S_OK; |
| +} |
| + |
| +void ReadyPromptContent::Reset() { |
| + if (IsWindow()) { |
| + DestroyWindow(); |
| + frame_ = NULL; |
| + // Deletion will occur in OnFinalMessage |
| + } else { |
| + delete this; |
| + } |
| + |
| +} |
| + |
| +void ReadyPromptContent::OnShow() { |
| + if (IsWindow()) |
| + ShowWindow(SW_SHOW); |
| +} |
| +void ReadyPromptContent::OnHide() { |
| + if (IsWindow()) |
| + ShowWindow(SW_HIDE); |
| +} |
| + |
| +void ReadyPromptContent::SetDimensions(const RECT& dimensions) { |
| + if (IsWindow()) { |
| + MoveWindow(&dimensions, TRUE); |
| + SetWindowPos(HWND_TOP, &dimensions, SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW); |
|
amit
2010/11/12 00:04:49
nit: I think you can combine move here if you remo
|
| + } |
| +} |
| + |
| +LRESULT ReadyPromptContent::OnInitDialog(UINT uMsg, |
| + WPARAM wParam, |
| + LPARAM lParam, |
| + BOOL& bHandled) |
| +{ |
| + DlgResize_Init(false); // 'no gripper' |
| + return 1; |
| +} |
| + |
| +LRESULT ReadyPromptContent::OnYes(WORD /*wNotifyCode*/, |
| + WORD /*wID*/, |
| + HWND /*hWndCtl*/, |
| + BOOL& bHandled) |
| +{ |
| + frame_->CloseInfobar(); |
| + bHandled = true; |
| + return 0; |
| +} |
| + |
| +LRESULT ReadyPromptContent::OnRemindMeLater(WORD /*wNotifyCode*/, |
| + WORD /*wID*/, |
| + HWND /*hWndCtl*/, |
| + BOOL& bHandled) |
| +{ |
| + frame_->CloseInfobar(); |
| + bHandled = true; |
| + return 0; |
| +} |
| + |
| +LRESULT ReadyPromptContent::OnNo(WORD /*wNotifyCode*/, |
| + WORD /*wID*/, |
| + HWND /*hWndCtl*/, |
| + BOOL& bHandled) |
| +{ |
| + frame_->CloseInfobar(); |
| + bHandled = true; |
| + return 0; |
| +} |
| + |
| +void ReadyPromptContent::OnFinalMessage(HWND) { |
| + // If we are still installed in a frame, we will delete in Reset |
| + if (!frame_) { |
| + delete this; |
| + } |
| +} |