Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(230)

Unified Diff: chrome_frame/ready_prompt.cc

Issue 4766003: Preview CL for adding an Infobar facility to Google Chrome Frame.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 10 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« chrome_frame/infobar_window.cc ('K') | « chrome_frame/ready_prompt.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
+ }
+}
« chrome_frame/infobar_window.cc ('K') | « chrome_frame/ready_prompt.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698