cc: Added inline to Tile::IsReadyToDraw
[chromium-blink-merge.git] / win8 / test / ui_automation_client.h
blob7e9832968aac90dc8276e2e6ace09b50eca453f3
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.
5 #ifndef WIN8_TEST_UI_AUTOMATION_CLIENT_H_
6 #define WIN8_TEST_UI_AUTOMATION_CLIENT_H_
8 // This file contains UI automation implementation details for the
9 // OpenWithDialogController. See that class for consumable entrypoints.
11 #include <windows.h>
12 #include <vector>
14 #include "base/basictypes.h"
15 #include "base/callback_forward.h"
16 #include "base/memory/weak_ptr.h"
17 #include "base/strings/string16.h"
18 #include "base/threading/thread.h"
19 #include "base/threading/thread_checker.h"
21 namespace win8 {
22 namespace internal {
24 // An asynchronous UI automation client that waits for the appearance of a
25 // Window of a particular class and then invokes one of its children identified
26 // by name. An instance may be destroyed at any time after Begin() is invoked.
27 // Any pending operation is cancelled.
28 class UIAutomationClient {
29 public:
30 // If the HRESULT argument indicates success, the automation client has been
31 // initialized, has installed its Window observer, and is ready to process
32 // the named window. Otherwise, initialization has failed and ResultCallback
33 // will not be invoked.
34 typedef base::Callback<void(HRESULT)> InitializedCallback;
36 // If the HRESULT argument indicates success, the desired item in the window
37 // was invoked. Otherwise, the string vector (if not empty) contains the list
38 // of possible items in the window.
39 typedef base::Callback<void(HRESULT, std::vector<string16>)> ResultCallback;
41 UIAutomationClient();
42 ~UIAutomationClient();
44 // Starts the client. Invokes |callback| once the client is ready or upon
45 // failure to start, in which case |result_callback| will never be called.
46 // Otherwise, |result_callback| will be invoked once |item_name| has been
47 // invoked.
48 void Begin(const wchar_t* class_name,
49 const string16& item_name,
50 const InitializedCallback& init_callback,
51 const ResultCallback& result_callback);
53 private:
54 class Context;
56 base::ThreadChecker thread_checker_;
58 // A thread in the COM MTA in which automation calls are made.
59 base::Thread automation_thread_;
61 // A pointer to the context object that lives on the automation thread.
62 base::WeakPtr<Context> context_;
64 DISALLOW_COPY_AND_ASSIGN(UIAutomationClient);
67 } // namespace internal
68 } // namespace win8
70 #endif // WIN8_TEST_UI_AUTOMATION_CLIENT_H_