| OLD | NEW |
| (Empty) |
| 1 // Copyright 2008-2009 Google Inc. | |
| 2 // | |
| 3 // Licensed under the Apache License, Version 2.0 (the "License"); | |
| 4 // you may not use this file except in compliance with the License. | |
| 5 // You may obtain a copy of the License at | |
| 6 // | |
| 7 // http://www.apache.org/licenses/LICENSE-2.0 | |
| 8 // | |
| 9 // Unless required by applicable law or agreed to in writing, software | |
| 10 // distributed under the License is distributed on an "AS IS" BASIS, | |
| 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| 12 // See the License for the specific language governing permissions and | |
| 13 // limitations under the License. | |
| 14 // ======================================================================== | |
| 15 | |
| 16 #ifndef OMAHA_UI_COMPLETE_WND_H_ | |
| 17 #define OMAHA_UI_COMPLETE_WND_H_ | |
| 18 | |
| 19 #include "base/scoped_ptr.h" | |
| 20 #include "omaha/ui/ui.h" | |
| 21 #include "omaha/ui/uilib/static_ex.h" | |
| 22 | |
| 23 namespace omaha { | |
| 24 | |
| 25 class CompleteWndEvents : public OmahaWndEvents { | |
| 26 public: | |
| 27 // Launches the browser non-privileged and returns whether the browser was | |
| 28 // successfully launched. | |
| 29 virtual bool DoLaunchBrowser(const CString& url) = 0; | |
| 30 }; | |
| 31 | |
| 32 class CompleteWnd : public OmahaWnd { | |
| 33 public: | |
| 34 CompleteWnd(CMessageLoop* message_loop, HWND parent); | |
| 35 | |
| 36 virtual HRESULT Initialize(); | |
| 37 | |
| 38 void SetEventSink(CompleteWndEvents* ev); | |
| 39 | |
| 40 void DisplayCompletionDialog(bool is_success, | |
| 41 const CString& text, | |
| 42 const CString& help_url); | |
| 43 | |
| 44 BEGIN_MSG_MAP(ErrorWnd) | |
| 45 MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog) | |
| 46 NOTIFY_CODE_HANDLER(NM_STATICEX, OnUrlClicked) | |
| 47 COMMAND_HANDLER(IDC_CLOSE, BN_CLICKED, OnClickedButton) | |
| 48 CHAIN_MSG_MAP(OmahaWnd) | |
| 49 END_MSG_MAP() | |
| 50 | |
| 51 protected: | |
| 52 // Constructor to override the default dialog resource ID and control classes. | |
| 53 CompleteWnd(int dialog_id, | |
| 54 DWORD control_classes, | |
| 55 CMessageLoop* message_loop, | |
| 56 HWND parent); | |
| 57 | |
| 58 // Message and command handlers. | |
| 59 LRESULT OnInitDialog(UINT msg, | |
| 60 WPARAM wparam, | |
| 61 LPARAM lparam, | |
| 62 BOOL& handled); // NOLINT | |
| 63 LRESULT OnClickedButton(WORD notify_code, | |
| 64 WORD id, | |
| 65 HWND wnd_ctl, | |
| 66 BOOL& handled); // NOLINT | |
| 67 LRESULT OnUrlClicked(int idCtrl, LPNMHDR pnmh, BOOL& bHandled); // NOLINT | |
| 68 | |
| 69 private: | |
| 70 // Handles requests to close the window. Returns true if the window is closed. | |
| 71 virtual bool MaybeCloseWindow(); | |
| 72 | |
| 73 HRESULT SetControlState(bool is_success); | |
| 74 | |
| 75 HRESULT ShowGetHelpLink(const CString& help_url); | |
| 76 | |
| 77 // Due to a repaint issue in StaticEx we prefer to manage their lifetime | |
| 78 // very aggressively so we contain them by reference instead of value. | |
| 79 scoped_ptr<StaticEx> complete_text_; | |
| 80 scoped_ptr<StaticEx> get_help_text_; | |
| 81 | |
| 82 CompleteWndEvents* events_sink_; | |
| 83 const DWORD control_classes_; | |
| 84 | |
| 85 DISALLOW_EVIL_CONSTRUCTORS(CompleteWnd); | |
| 86 }; | |
| 87 | |
| 88 } // namespace omaha | |
| 89 | |
| 90 #endif // OMAHA_UI_COMPLETE_WND_H_ | |
| 91 | |
| OLD | NEW |