Skip to content

Commit 67b4ab1

Browse files
author
Eain Chen
committed
update spec with api experimental promotion
1 parent 0a3ac02 commit 67b4ab1

File tree

1 file changed

+46
-47
lines changed

1 file changed

+46
-47
lines changed

specs/ProgrammaticSaveAs.md

Lines changed: 46 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,11 @@ The sample code will register a handler and trigger programmaic save as once.
4343
```c++
4444
bool ScenarioSaveAs::ProgrammaticSaveAs()
4545
{
46-
if (!m_webView2_20)
46+
if (!m_webView2_24)
4747
return false;
4848

4949
// Register a handler for the `SaveAsUIShowing` event.
50-
m_webView2_20->add_SaveAsUIShowing(
50+
m_webView2_24->add_SaveAsUIShowing(
5151
Callback<ICoreWebView2SaveAsUIShowingEventHandler>(
5252
[this](
5353
ICoreWebView2* sender,
@@ -60,7 +60,7 @@ bool ScenarioSaveAs::ProgrammaticSaveAs()
6060
{
6161
// As an end developer, you can design your own dialog UI, or no UI at all.
6262
// You can ask the user to provide information like file name, file extension,
63-
// and so on. Finally, and set them on the event args
63+
// and so on. Finally, and set them on the event args.
6464
//
6565
// This is a customized dialog example, the constructor returns after the
6666
// dialog interaction is completed by the end user.
@@ -80,7 +80,7 @@ bool ScenarioSaveAs::ProgrammaticSaveAs()
8080
}
8181
else
8282
{
83-
// Save As cancelled from this customized dialog
83+
// Save As cancelled from this customized dialog.
8484
CHECK_FAILURE(args->put_Cancel(TRUE));
8585
}
8686
};
@@ -100,7 +100,7 @@ bool ScenarioSaveAs::ProgrammaticSaveAs()
100100
&m_SaveAsUIShowingToken);
101101

102102
// Call method ShowSaveAsUI to trigger the programmatic save as once.
103-
m_webView2_20->ShowSaveAsUI(
103+
m_webView2_24->ShowSaveAsUI(
104104
Callback<ICoreWebView2ShowSaveAsUICompletedHandler>(
105105
[this](HRESULT errorCode, COREWEBVIEW2_SAVE_AS_UI_RESULT result) -> HRESULT
106106
{
@@ -158,17 +158,17 @@ async void ProgrammaticSaveAsExecuted(object target, ExecutedRoutedEventArgs e)
158158
}
159159
else
160160
{
161-
// Save As cancelled from this customized dialog
161+
// Save As cancelled from this customized dialog.
162162
args.Cancel = true;
163163
}
164164
}
165165
}, null);
166166
};
167167

168168
// Call ShowSaveAsUIAsync method to trigger the programmatic save as once.
169-
CoreWebView2SaveAsUIResults result = await webView.CoreWebView2.ShowSaveAsUIAsync();
169+
CoreWebView2SaveAsUIResult result = await webView.CoreWebView2.ShowSaveAsUIAsync();
170170
// Show ShowSaveAsUIAsync returned result, optional. See
171-
// CoreWebView2SaveAsUIResults for more details.
171+
// CoreWebView2SaveAsUIResult for more details.
172172
MessageBox.Show(result.ToString(), "Info");
173173
}
174174
```
@@ -184,7 +184,7 @@ async void ProgrammaticSaveAsExecuted(object target, ExecutedRoutedEventArgs e)
184184
/// `application/xhtml+xml` are considered as HTML documents.
185185
[v1_enum] typedef enum COREWEBVIEW2_SAVE_AS_KIND {
186186
/// Default to save for a non-html content. If it is selected for a html
187-
/// page, its same as HTML_ONLY option.
187+
/// page, it's same as HTML_ONLY option.
188188
COREWEBVIEW2_SAVE_AS_KIND_DEFAULT,
189189
/// Save the page as html. It only saves top-level document, excludes
190190
/// subresource.
@@ -199,51 +199,49 @@ async void ProgrammaticSaveAsExecuted(object target, ExecutedRoutedEventArgs e)
199199
} COREWEBVIEW2_SAVE_AS_KIND;
200200

201201
/// Status of a programmatic save as call, indicates the result
202-
/// for method `ShowSaveAsUI`
202+
/// for method `ShowSaveAsUI`.
203203
[v1_enum] typedef enum COREWEBVIEW2_SAVE_AS_UI_RESULT {
204204
/// The ShowSaveAsUI method call completed successfully. By defaut the the system
205205
/// save as dialog will open. If `SuppressDefaultDialog` is set to TRUE, will skip
206206
/// the system dialog, and start the download.
207-
COREWEBVIEW2_SAVE_AS_UI_SUCCESS,
207+
COREWEBVIEW2_SAVE_AS_UI_RESULT_SUCCESS,
208208
/// Could not perform Save As because the destination file path is an invalid path.
209209
///
210210
/// It is considered as invalid when the path is empty, a relative path, a directory,
211-
/// or the parent path doesn't exist
212-
COREWEBVIEW2_SAVE_AS_UI_INVALID_PATH,
211+
/// or the parent path doesn't exist.
212+
COREWEBVIEW2_SAVE_AS_UI_RESULT_INVALID_PATH,
213213
/// Could not perform Save As because the destination file path already exists and
214214
/// replacing files was not allowed by the `AllowReplace` property.
215-
COREWEBVIEW2_SAVE_AS_UI_FILE_ALREADY_EXISTS,
215+
COREWEBVIEW2_SAVE_AS_UI_RESULT_FILE_ALREADY_EXISTS,
216216
/// Could not perform Save As when the `Kind` property selection not
217-
/// supported because of the content MIME type or system limits
217+
/// supported because of the content MIME type or system limits.
218218
///
219-
/// MIME type limits please see the emun `COREWEBVIEW2_SAVE_AS_KIND`
219+
/// MIME type limits please see the emun `COREWEBVIEW2_SAVE_AS_KIND`.
220220
///
221-
/// System limits might happen when select `HTML_ONLY` for an error page,
222-
/// select `COMPLETE` and WebView running in an App Container, etc.
223-
COREWEBVIEW2_SAVE_AS_UI_KIND_NOT_SUPPORTED,
221+
/// System limits might happen when select `HTML_ONLY` for an error page at child
222+
/// mode, select `COMPLETE` and WebView running in an App Container, etc.
223+
COREWEBVIEW2_SAVE_AS_UI_RESULT_KIND_NOT_SUPPORTED,
224224
/// Did not perform Save As because the end user cancelled or the
225225
/// CoreWebView2SaveAsUIShowingEventArgs.Cancel property was set to TRUE.
226-
COREWEBVIEW2_SAVE_AS_UI_CANCELLED,
226+
COREWEBVIEW2_SAVE_AS_UI_RESULT_CANCELLED,
227227
} COREWEBVIEW2_SAVE_AS_UI_RESULT;
228228

229229
[uuid(15e1c6a3-c72a-4df3-91d7-d097fbec3bfd), object, pointer_default(unique)]
230-
interface ICoreWebView2_20 : IUnknown {
230+
interface ICoreWebView2_24 : IUnknown {
231231
/// Programmatically trigger a save as action for the currently loaded document.
232232
/// The `SaveAsUIShowing` event will be raised.
233233
///
234234
/// Opens a system modal dialog by default. If the `SuppressDefaultDialog` is TRUE,
235235
/// won't open the system dialog.
236236
///
237237
/// The method can return a detailed info to indicate the call's result.
238-
/// Please see COREWEBVIEW2_SAVE_AS_UI_RESULT
238+
/// Please see COREWEBVIEW2_SAVE_AS_UI_RESULT.
239239
///
240240
/// \snippet ScenarioSaveAs.cpp ProgrammaticSaveAs
241241
HRESULT ShowSaveAsUI([in] ICoreWebView2ShowSaveAsUICompletedHandler* handler);
242242

243243
/// Add an event handler for the `SaveAsUIShowing` event. This event is raised
244244
/// when save as is triggered, programmatically or manually.
245-
///
246-
/// \snippet ScenarioSaveAs.cpp AddEventHandler
247245
HRESULT add_SaveAsUIShowing(
248246
[in] ICoreWebView2SaveAsUIShowingEventHandler* eventHanlder,
249247
[out] EventRegistrationToken* token);
@@ -261,21 +259,21 @@ interface ICoreWebView2SaveAsUIShowingEventHandler : IUnknown {
261259
[in] ICoreWebView2SaveAsUIShowingEventArgs* args);
262260
}
263261

264-
/// The event args for `SaveAsUIShowing` event
262+
/// The event args for `SaveAsUIShowing` event.
265263
[uuid(80101027-b8c3-49a1-a052-9ea4bd63ba47), object, pointer_default(unique)]
266264
interface ICoreWebView2SaveAsUIShowingEventArgs : IUnknown {
267-
/// Get the Mime type of content to be saved
265+
/// Get the Mime type of content to be saved.
268266
[propget] HRESULT ContentMimeType([out, retval] LPWSTR* value);
269267

270268
/// You can set this to TRUE to cancel the Save As. Then the download won't start.
271-
/// A programmatic call will return COREWEBVIEW2_SAVE_AS_CANCELLED as well.
269+
/// A programmatic call will return COREWEBVIEW2_SAVE_AS_UI_RESULT_CANCELLED as well.
272270
///
273271
/// The default value is FALSE.
274272
///
275-
/// Set the `Cancel` for save as
273+
/// Set the `Cancel` for save as.
276274
[propput] HRESULT Cancel ([in] BOOL value);
277275

278-
/// Get the `Cancel` for save as
276+
/// Get the `Cancel` for save as.
279277
[propget] HRESULT Cancel ([out, retval] BOOL* value);
280278

281279
/// Indicates if the system default dialog will be suppressed, FALSE means
@@ -284,10 +282,10 @@ interface ICoreWebView2SaveAsUIShowingEventArgs : IUnknown {
284282
///
285283
/// The default value is FALSE.
286284
///
287-
/// Set the `SuppressDefaultDialog`
285+
/// Set the `SuppressDefaultDialog`.
288286
[propput] HRESULT SuppressDefaultDialog([in] BOOL value);
289287

290-
/// Get the `SuppressDefaultDialog`
288+
/// Get the `SuppressDefaultDialog`.
291289
[propget] HRESULT SuppressDefaultDialog([out, retval] BOOL* value);
292290

293291
/// Returns an `ICoreWebView2Deferral` object. This will defer showing the
@@ -296,49 +294,50 @@ interface ICoreWebView2SaveAsUIShowingEventArgs : IUnknown {
296294

297295
/// `SaveAsFilePath` is absolute full path of the location. It includes the file name
298296
/// and extension. If `SaveAsFilePath` is not valid, for example the root drive does
299-
/// not exist, save as will be denied and return COREWEBVIEW2_SAVE_AS_INVALID_PATH.
297+
/// not exist, save as will be denied and return COREWEBVIEW2_SAVE_AS_UI_RESULT_INVALID_PATH.
300298
///
301299
/// If the associated download completes successfully, a target file will be saved at
302300
/// this location. If the Kind property is `COREWEBVIEW2_SAVE_AS_KIND_COMPLETE`,
303301
/// there will be an additional directory with resources files.
304302
///
305303
/// The default value is a system suggested path, based on users' local environment.
306304
///
307-
/// Set the `SaveAsFilePath` for save as
305+
/// Set the `SaveAsFilePath` for save as.
308306
[propput] HRESULT SaveAsFilePath ([in] LPCWSTR value);
309307

310-
/// Get the `SaveAsFilePath` for save as
308+
/// Get the `SaveAsFilePath` for save as.
311309
[propget] HRESULT SaveAsFilePath ([out, retval] LPWSTR* value);
312310

313311
/// `AllowReplace` allows you to control what happens when a file already
314312
/// exists in the file path to which the Save As operation is saving.
315313
/// Setting this TRUE allows existing files to be replaced.
316-
/// Settings this FALSE will not replace existing files and will return
317-
/// COREWEBVIEW2_SAVE_AS_FILE_ALREADY_EXISTS.
314+
/// Setting this FALSE will not replace existing files and will return
315+
/// COREWEBVIEW2_SAVE_AS_UI_RESULT_FILE_ALREADY_EXISTS.
318316
///
319-
/// The default value is FALSE
317+
/// The default value is FALSE.
320318
///
321-
/// Set if allowed to replace the old file if duplicate happens in the save as
319+
/// Set if allowed to replace the old file if duplicate happens in the save as.
322320
[propput] HRESULT AllowReplace ([in] BOOL value);
323321

324-
/// Get the duplicates replace rule for save as
322+
/// Get the duplicates replace rule for save as.
325323
[propget] HRESULT AllowReplace ([out, retval] BOOL* value);
326324

327325
/// How to save documents with different kind. See the enum
328326
/// COREWEBVIEW2_SAVE_AS_KIND for a description of the different options.
329327
/// If the kind isn't allowed for the current document,
330-
/// COREWEBVIEW2_SAVE_AS_UI_KIND_NOT_SUPPORTED will be returned from ShowSaveAsUI.
328+
/// COREWEBVIEW2_SAVE_AS_UI_RESULT_KIND_NOT_SUPPORTED will be returned from
329+
/// ShowSaveAsUI.
331330
///
332-
/// The default value is COREWEBVIEW2_SAVE_AS_KIND_DEFAULT
331+
/// The default value is COREWEBVIEW2_SAVE_AS_KIND_DEFAULT.
333332
///
334-
/// Set the kind for save as
333+
/// Set the kind for save as.
335334
[propput] HRESULT Kind ([in] COREWEBVIEW2_SAVE_AS_KIND value);
336335

337-
/// Get the kind for save as
336+
/// Get the kind for save as.
338337
[propget] HRESULT Kind ([out, retval] COREWEBVIEW2_SAVE_AS_KIND* value);
339338
}
340339

341-
/// Receive the result for `ShowSaveAsUI` method
340+
/// Receive the result for `ShowSaveAsUI` method.
342341
[uuid(1a02e9d9-14d3-41c6-9581-8d6e1e6f50fe), object, pointer_default(unique)]
343342
interface ICoreWebView2ShowSaveAsUICompletedHandler : IUnknown {
344343
HRESULT Invoke([in] HRESULT errorCode, [in] COREWEBVIEW2_SAVE_AS_UI_RESULT result);
@@ -353,7 +352,7 @@ namespace Microsoft.Web.WebView2.Core
353352
runtimeclass CoreWebView2SaveAsUIShowingEventArgs;
354353
runtimeclass CoreWebView2;
355354

356-
enum CoreWebView2SaveAsUIResults
355+
enum CoreWebView2SaveAsUIResult
357356
{
358357
Success = 0,
359358
InvalidPath = 1,
@@ -385,11 +384,11 @@ namespace Microsoft.Web.WebView2.Core
385384
{
386385
// ...
387386
388-
[interface_name("Microsoft.Web.WebView2.Core.ICoreWebView2_20")]
387+
[interface_name("Microsoft.Web.WebView2.Core.ICoreWebView2_24")]
389388
{
390389
event Windows.Foundation.TypedEventHandler
391390
<CoreWebView2, CoreWebView2SaveAsUIShowingEventArgs> SaveAsUIShowing;
392-
Windows.Foundation.IAsyncOperation<CoreWebView2SaveAsUIResults >
391+
Windows.Foundation.IAsyncOperation<CoreWebView2SaveAsUIResult >
393392
ShowSaveAsUIAsync();
394393
}
395394
};

0 commit comments

Comments
 (0)