summaryrefslogtreecommitdiffstats
path: root/win8/test/open_with_dialog_async.h
diff options
context:
space:
mode:
Diffstat (limited to 'win8/test/open_with_dialog_async.h')
-rw-r--r--win8/test/open_with_dialog_async.h35
1 files changed, 35 insertions, 0 deletions
diff --git a/win8/test/open_with_dialog_async.h b/win8/test/open_with_dialog_async.h
new file mode 100644
index 0000000..dadc9ca
--- /dev/null
+++ b/win8/test/open_with_dialog_async.h
@@ -0,0 +1,35 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef WIN8_TEST_OPEN_WITH_DIALOG_ASYNC_H_
+#define WIN8_TEST_OPEN_WITH_DIALOG_ASYNC_H_
+
+#include <windows.h>
+
+#include "base/callback_forward.h"
+#include "base/string16.h"
+
+namespace win8 {
+
+// Expected HRESULTS:
+// S_OK - A choice was made.
+// HRESULT_FROM_WIN32(ERROR_CANCELLED) - The dialog was dismissed.
+// HRESULT_FROM_WIN32(RPC_S_CALL_FAILED) - OpenWith.exe died.
+typedef base::Callback<void(HRESULT)> OpenWithDialogCallback;
+
+// Calls SHOpenWithDialog on a dedicated thread, returning the result to the
+// caller via |callback| on the current thread. The Windows SHOpenWithDialog
+// function blocks until the user makes a choice or dismisses the dialog (there
+// is no natural timeout nor a means by which it can be cancelled). Note that
+// the dedicated thread will be leaked if the calling thread's message loop goes
+// away before the interaction completes.
+void OpenWithDialogAsync(HWND parent_window,
+ const string16& file_name,
+ const string16& file_type_class,
+ int open_as_info_flags,
+ const OpenWithDialogCallback& callback);
+
+} // namespace win8
+
+#endif // WIN8_TEST_OPEN_WITH_DIALOG_ASYNC_H_