Home | History | Annotate | Download | only in test
      1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
      2 // Use of this source code is governed by a BSD-style license that can be
      3 // found in the LICENSE file.
      4 
      5 #ifndef WIN8_TEST_OPEN_WITH_DIALOG_ASYNC_H_
      6 #define WIN8_TEST_OPEN_WITH_DIALOG_ASYNC_H_
      7 
      8 #include <windows.h>
      9 
     10 #include "base/callback_forward.h"
     11 #include "base/strings/string16.h"
     12 
     13 namespace win8 {
     14 
     15 // Expected HRESULTS:
     16 //   S_OK - A choice was made.
     17 //   HRESULT_FROM_WIN32(ERROR_CANCELLED) - The dialog was dismissed.
     18 //   HRESULT_FROM_WIN32(RPC_S_CALL_FAILED) - OpenWith.exe died.
     19 typedef base::Callback<void(HRESULT)> OpenWithDialogCallback;
     20 
     21 // Calls SHOpenWithDialog on a dedicated thread, returning the result to the
     22 // caller via |callback| on the current thread.  The Windows SHOpenWithDialog
     23 // function blocks until the user makes a choice or dismisses the dialog (there
     24 // is no natural timeout nor a means by which it can be cancelled).  Note that
     25 // the dedicated thread will be leaked if the calling thread's message loop goes
     26 // away before the interaction completes.
     27 void OpenWithDialogAsync(HWND parent_window,
     28                          const string16& file_name,
     29                          const string16& file_type_class,
     30                          int open_as_info_flags,
     31                          const OpenWithDialogCallback& callback);
     32 
     33 }  // namespace win8
     34 
     35 #endif  // WIN8_TEST_OPEN_WITH_DIALOG_ASYNC_H_
     36