OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 // different underlying implementation according to the url protocol. | 63 // different underlying implementation according to the url protocol. |
64 HTMLDialog* CreateNativeHTMLDialog(const std::wstring& url); | 64 HTMLDialog* CreateNativeHTMLDialog(const std::wstring& url); |
65 | 65 |
66 // This class leverages HTMLDialog to create a dialog that is suitable | 66 // This class leverages HTMLDialog to create a dialog that is suitable |
67 // for a end-user-agreement modal dialog. The html shows a fairly standard | 67 // for a end-user-agreement modal dialog. The html shows a fairly standard |
68 // EULA form with the accept and cancel buttons and an optional check box | 68 // EULA form with the accept and cancel buttons and an optional check box |
69 // to opt-in for sending usage stats and crash reports. | 69 // to opt-in for sending usage stats and crash reports. |
70 class EulaHTMLDialog { | 70 class EulaHTMLDialog { |
71 public: | 71 public: |
72 // |file| points to an html file on disk or to a resource via res:// spec. | 72 // |file| points to an html file on disk or to a resource via res:// spec. |
73 explicit EulaHTMLDialog(const std::wstring& file); | 73 // |param| is a string that will be passed to the dialog as a parameter via |
| 74 // the window.dialogArguments property. |
| 75 EulaHTMLDialog(const std::wstring& file, const std::wstring& param); |
74 ~EulaHTMLDialog(); | 76 ~EulaHTMLDialog(); |
75 | 77 |
76 enum Outcome { | 78 enum Outcome { |
77 REJECTED, // Declined EULA, mapped from HTML_DLG_ACCEPT (1). | 79 REJECTED, // Declined EULA, mapped from HTML_DLG_ACCEPT (1). |
78 ACCEPTED, // Accepted EULA no opt-in, from HTML_DLG_DECLINE (2). | 80 ACCEPTED, // Accepted EULA no opt-in, from HTML_DLG_DECLINE (2). |
79 ACCEPTED_OPT_IN, // Accepted EULA and opt-in, from HTML_DLG_EXTRA (6). | 81 ACCEPTED_OPT_IN, // Accepted EULA and opt-in, from HTML_DLG_EXTRA (6). |
80 }; | 82 }; |
81 | 83 |
82 // Shows the dialog and blocks for user input. The return value is one of | 84 // Shows the dialog and blocks for user input. The return value is one of |
83 // the |Outcome| values and any form of failure maps to REJECTED. | 85 // the |Outcome| values and any form of failure maps to REJECTED. |
84 Outcome ShowModal(); | 86 Outcome ShowModal(); |
85 | 87 |
86 private: | 88 private: |
87 class Customizer : public HTMLDialog::CustomizationCallback { | 89 class Customizer : public HTMLDialog::CustomizationCallback { |
88 public: | 90 public: |
89 virtual void OnBeforeCreation(void** extra); | 91 virtual void OnBeforeCreation(void** extra); |
90 virtual void OnBeforeDisplay(void* window); | 92 virtual void OnBeforeDisplay(void* window); |
91 }; | 93 }; |
92 | 94 |
93 HTMLDialog* dialog_; | 95 HTMLDialog* dialog_; |
94 DISALLOW_COPY_AND_ASSIGN(EulaHTMLDialog); | 96 DISALLOW_COPY_AND_ASSIGN(EulaHTMLDialog); |
95 }; | 97 }; |
96 | 98 |
97 } // namespace installer | 99 } // namespace installer |
98 | 100 |
99 #endif // CHROME_INSTALLER_UTIL_HTML_DIALOG_H_ | 101 #endif // CHROME_INSTALLER_UTIL_HTML_DIALOG_H_ |
OLD | NEW |