| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_INSTALLER_UTIL_HTML_DIALOG_H_ | 5 #ifndef CHROME_INSTALLER_UTIL_HTML_DIALOG_H_ |
| 6 #define CHROME_INSTALLER_UTIL_HTML_DIALOG_H_ | 6 #define CHROME_INSTALLER_UTIL_HTML_DIALOG_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 | 31 |
| 32 // Callbacks that allow to tweak the appearance of the dialog. | 32 // Callbacks that allow to tweak the appearance of the dialog. |
| 33 class CustomizationCallback { | 33 class CustomizationCallback { |
| 34 public: | 34 public: |
| 35 // Called before the native window is created. Use it to pass arbitrary | 35 // Called before the native window is created. Use it to pass arbitrary |
| 36 // parameters in |extra| to the rendering engine. | 36 // parameters in |extra| to the rendering engine. |
| 37 virtual void OnBeforeCreation(void** extra) = 0; | 37 virtual void OnBeforeCreation(void** extra) = 0; |
| 38 // The native window has been created and is about to be visible. Use it | 38 // The native window has been created and is about to be visible. Use it |
| 39 // to customize the native |window| appearance. | 39 // to customize the native |window| appearance. |
| 40 virtual void OnBeforeDisplay(void* window) = 0; | 40 virtual void OnBeforeDisplay(void* window) = 0; |
| 41 |
| 42 protected: |
| 43 virtual ~CustomizationCallback() {} |
| 41 }; | 44 }; |
| 42 | 45 |
| 46 virtual ~HTMLDialog() {} |
| 47 |
| 43 // Shows the HTML in a modal dialog. The buttons and other UI are also done | 48 // Shows the HTML in a modal dialog. The buttons and other UI are also done |
| 44 // in HTML so each native implementation needs to map the user action into | 49 // in HTML so each native implementation needs to map the user action into |
| 45 // one of the 6 possible results of DialogResult. Important, call this | 50 // one of the 6 possible results of DialogResult. Important, call this |
| 46 // method only from the main (or UI) thread. | 51 // method only from the main (or UI) thread. |
| 47 virtual DialogResult ShowModal(void* parent_window, | 52 virtual DialogResult ShowModal(void* parent_window, |
| 48 CustomizationCallback* callback) = 0; | 53 CustomizationCallback* callback) = 0; |
| 49 | 54 |
| 50 // If the result of ShowModal() was EXTRA, the information is available | 55 // If the result of ShowModal() was EXTRA, the information is available |
| 51 // as a string using this method. | 56 // as a string using this method. |
| 52 virtual std::wstring GetExtraResult() = 0; | 57 virtual std::wstring GetExtraResult() = 0; |
| 53 | |
| 54 }; | 58 }; |
| 55 | 59 |
| 56 // Factory method for the native HTML Dialog. When done with the object use | 60 // Factory method for the native HTML Dialog. When done with the object use |
| 57 // regular 'delete' operator to destroy the object. It might choose a | 61 // regular 'delete' operator to destroy the object. It might choose a |
| 58 // different underlying implementation according to the url protocol. | 62 // different underlying implementation according to the url protocol. |
| 59 HTMLDialog* CreateNativeHTMLDialog(const std::wstring& url); | 63 HTMLDialog* CreateNativeHTMLDialog(const std::wstring& url); |
| 60 | 64 |
| 61 // This class leverages HTMLDialog to create a dialog that is suitable | 65 // This class leverages HTMLDialog to create a dialog that is suitable |
| 62 // for a end-user-agreement modal dialog. The html shows a fairly standard | 66 // for a end-user-agreement modal dialog. The html shows a fairly standard |
| 63 // EULA form with the accept and cancel buttons and an optional check box | 67 // EULA form with the accept and cancel buttons and an optional check box |
| (...skipping 21 matching lines...) Expand all Loading... |
| 85 virtual void OnBeforeDisplay(void* window); | 89 virtual void OnBeforeDisplay(void* window); |
| 86 }; | 90 }; |
| 87 | 91 |
| 88 HTMLDialog* dialog_; | 92 HTMLDialog* dialog_; |
| 89 DISALLOW_COPY_AND_ASSIGN(EulaHTMLDialog); | 93 DISALLOW_COPY_AND_ASSIGN(EulaHTMLDialog); |
| 90 }; | 94 }; |
| 91 | 95 |
| 92 } // namespace installer | 96 } // namespace installer |
| 93 | 97 |
| 94 #endif // CHROME_INSTALLER_UTIL_HTML_DIALOG_H_ | 98 #endif // CHROME_INSTALLER_UTIL_HTML_DIALOG_H_ |
| OLD | NEW |