Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 #include "chrome_frame/chrome_frame_ready_prompt.h" | |
| 2 | |
| 3 ReadyPromptContent::ReadyPromptContent() | |
| 4 : frame_(NULL) { | |
| 5 } | |
|
grt (UTC plus 2)
2010/11/10 17:59:29
newline after this
| |
| 6 HRESULT ReadyPromptContent::InstallInFrame(ContentFrame* frame) { | |
| 7 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.
| |
| 8 Reset(); | |
| 9 } | |
| 10 | |
| 11 frame_ = frame; | |
| 12 Create(frame_->GetFrameWindow()); | |
| 13 if (!IsWindow()) | |
| 14 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.
| |
| 15 | |
| 16 return S_OK; | |
| 17 } | |
| 18 | |
| 19 void ReadyPromptContent::Reset() { | |
| 20 if (IsWindow()) { | |
| 21 DestroyWindow(); | |
| 22 frame_ = NULL; | |
| 23 // Deletion will occur in OnFinalMessage | |
| 24 } else { | |
| 25 delete this; | |
| 26 } | |
| 27 | |
| 28 } | |
| 29 | |
| 30 void ReadyPromptContent::OnShow() { | |
| 31 if (IsWindow()) | |
| 32 ShowWindow(SW_SHOW); | |
| 33 } | |
| 34 void ReadyPromptContent::OnHide() { | |
| 35 if (IsWindow()) | |
| 36 ShowWindow(SW_HIDE); | |
| 37 } | |
| 38 | |
| 39 void ReadyPromptContent::SetDimensions(const RECT& dimensions) { | |
| 40 if (IsWindow()) { | |
| 41 MoveWindow(&dimensions, TRUE); | |
| 42 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
| |
| 43 } | |
| 44 } | |
| 45 | |
| 46 LRESULT ReadyPromptContent::OnInitDialog(UINT uMsg, | |
| 47 WPARAM wParam, | |
| 48 LPARAM lParam, | |
| 49 BOOL& bHandled) | |
| 50 { | |
| 51 DlgResize_Init(false); // 'no gripper' | |
| 52 return 1; | |
| 53 } | |
| 54 | |
| 55 LRESULT ReadyPromptContent::OnYes(WORD /*wNotifyCode*/, | |
| 56 WORD /*wID*/, | |
| 57 HWND /*hWndCtl*/, | |
| 58 BOOL& bHandled) | |
| 59 { | |
| 60 frame_->CloseInfobar(); | |
| 61 bHandled = true; | |
| 62 return 0; | |
| 63 } | |
| 64 | |
| 65 LRESULT ReadyPromptContent::OnRemindMeLater(WORD /*wNotifyCode*/, | |
| 66 WORD /*wID*/, | |
| 67 HWND /*hWndCtl*/, | |
| 68 BOOL& bHandled) | |
| 69 { | |
| 70 frame_->CloseInfobar(); | |
| 71 bHandled = true; | |
| 72 return 0; | |
| 73 } | |
| 74 | |
| 75 LRESULT ReadyPromptContent::OnNo(WORD /*wNotifyCode*/, | |
| 76 WORD /*wID*/, | |
| 77 HWND /*hWndCtl*/, | |
| 78 BOOL& bHandled) | |
| 79 { | |
| 80 frame_->CloseInfobar(); | |
| 81 bHandled = true; | |
| 82 return 0; | |
| 83 } | |
| 84 | |
| 85 void ReadyPromptContent::OnFinalMessage(HWND) { | |
| 86 // If we are still installed in a frame, we will delete in Reset | |
| 87 if (!frame_) { | |
| 88 delete this; | |
| 89 } | |
| 90 } | |
| OLD | NEW |