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

Side by Side Diff: chrome/installer/util/html_dialog.h

Issue 1115063002: win: wstring->string16 in chrome/installer/util/html_dialog (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years, 7 months 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 unified diff | Download patch
« no previous file with comments | « no previous file | chrome/installer/util/html_dialog_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 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 7
8 #include <string> 8 #include <string>
grt (UTC plus 2) 2015/04/30 02:58:29 remove
Nico 2015/04/30 02:59:20 string16.h includes <string>, but yeah I guess it'
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/strings/string16.h"
11 12
12 // This is the interface for creating HTML-based Dialogs *before* Chrome has 13 // This is the interface for creating HTML-based Dialogs *before* Chrome has
13 // been installed or when there is a suspicion chrome is not working. In 14 // been installed or when there is a suspicion chrome is not working. In
14 // other words, the dialogs use another native html rendering engine. In the 15 // other words, the dialogs use another native html rendering engine. In the
15 // case of Windows it is the the Internet Explorer control. 16 // case of Windows it is the the Internet Explorer control.
16 17
17 namespace installer { 18 namespace installer {
18 19
19 // Interface for implementing a native HTML dialog. 20 // Interface for implementing a native HTML dialog.
20 class HTMLDialog { 21 class HTMLDialog {
(...skipping 26 matching lines...) Expand all
47 48
48 // Shows the HTML in a modal dialog. The buttons and other UI are also done 49 // Shows the HTML in a modal dialog. The buttons and other UI are also done
49 // in HTML so each native implementation needs to map the user action into 50 // in HTML so each native implementation needs to map the user action into
50 // one of the 6 possible results of DialogResult. Important, call this 51 // one of the 6 possible results of DialogResult. Important, call this
51 // method only from the main (or UI) thread. 52 // method only from the main (or UI) thread.
52 virtual DialogResult ShowModal(void* parent_window, 53 virtual DialogResult ShowModal(void* parent_window,
53 CustomizationCallback* callback) = 0; 54 CustomizationCallback* callback) = 0;
54 55
55 // If the result of ShowModal() was EXTRA, the information is available 56 // If the result of ShowModal() was EXTRA, the information is available
56 // as a string using this method. 57 // as a string using this method.
57 virtual std::wstring GetExtraResult() = 0; 58 virtual base::string16 GetExtraResult() = 0;
58 }; 59 };
59 60
60 // Factory method for the native HTML Dialog. When done with the object use 61 // Factory method for the native HTML Dialog. When done with the object use
61 // regular 'delete' operator to destroy the object. It might choose a 62 // regular 'delete' operator to destroy the object. It might choose a
62 // different underlying implementation according to the url protocol. 63 // different underlying implementation according to the url protocol.
63 HTMLDialog* CreateNativeHTMLDialog(const std::wstring& url, 64 HTMLDialog* CreateNativeHTMLDialog(const base::string16& url,
64 const std::wstring& param); 65 const base::string16& param);
65 66
66 // This class leverages HTMLDialog to create a dialog that is suitable 67 // 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 68 // 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 69 // EULA form with the accept and cancel buttons and an optional check box
69 // to opt-in for sending usage stats and crash reports. 70 // to opt-in for sending usage stats and crash reports.
70 class EulaHTMLDialog { 71 class EulaHTMLDialog {
71 public: 72 public:
72 // |file| points to an html file on disk or to a resource via res:// spec. 73 // |file| points to an html file on disk or to a resource via res:// spec.
73 // |param| is a string that will be passed to the dialog as a parameter via 74 // |param| is a string that will be passed to the dialog as a parameter via
74 // the window.dialogArguments property. 75 // the window.dialogArguments property.
75 EulaHTMLDialog(const std::wstring& file, const std::wstring& param); 76 EulaHTMLDialog(const base::string16& file, const base::string16& param);
76 ~EulaHTMLDialog(); 77 ~EulaHTMLDialog();
77 78
78 enum Outcome { 79 enum Outcome {
79 REJECTED, // Declined EULA, mapped from HTML_DLG_ACCEPT (1). 80 REJECTED, // Declined EULA, mapped from HTML_DLG_ACCEPT (1).
80 ACCEPTED, // Accepted EULA no opt-in, from HTML_DLG_DECLINE (2). 81 ACCEPTED, // Accepted EULA no opt-in, from HTML_DLG_DECLINE (2).
81 ACCEPTED_OPT_IN, // Accepted EULA and opt-in, from HTML_DLG_EXTRA (6). 82 ACCEPTED_OPT_IN, // Accepted EULA and opt-in, from HTML_DLG_EXTRA (6).
82 }; 83 };
83 84
84 // Shows the dialog and blocks for user input. The return value is one of 85 // Shows the dialog and blocks for user input. The return value is one of
85 // the |Outcome| values and any form of failure maps to REJECTED. 86 // the |Outcome| values and any form of failure maps to REJECTED.
86 Outcome ShowModal(); 87 Outcome ShowModal();
87 88
88 private: 89 private:
89 class Customizer : public HTMLDialog::CustomizationCallback { 90 class Customizer : public HTMLDialog::CustomizationCallback {
90 public: 91 public:
91 void OnBeforeCreation(wchar_t** extra) override; 92 void OnBeforeCreation(wchar_t** extra) override;
92 void OnBeforeDisplay(void* window) override; 93 void OnBeforeDisplay(void* window) override;
93 }; 94 };
94 95
95 HTMLDialog* dialog_; 96 HTMLDialog* dialog_;
96 DISALLOW_COPY_AND_ASSIGN(EulaHTMLDialog); 97 DISALLOW_COPY_AND_ASSIGN(EulaHTMLDialog);
97 }; 98 };
98 99
99 } // namespace installer 100 } // namespace installer
100 101
101 #endif // CHROME_INSTALLER_UTIL_HTML_DIALOG_H_ 102 #endif // CHROME_INSTALLER_UTIL_HTML_DIALOG_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/installer/util/html_dialog_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698