1 // Copyright 2014 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 CHROME_BROWSER_CHROMEOS_LOGIN_TEST_APP_WINDOW_WAITER_H_
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_TEST_APP_WINDOW_WAITER_H_
10 #include "base/basictypes.h"
11 #include "base/compiler_specific.h"
12 #include "base/run_loop.h"
13 #include "extensions/browser/app_window/app_window_registry.h"
15 namespace extensions
{
21 // Helper class that monitors app windows to wait for a window to appear.
22 // Use a new instance for each use, one instance will only work for one Wait.
23 class AppWindowWaiter
: public extensions::AppWindowRegistry::Observer
{
25 AppWindowWaiter(extensions::AppWindowRegistry
* registry
,
26 const std::string
& app_id
);
27 ~AppWindowWaiter() override
;
29 extensions::AppWindow
* Wait();
31 // AppWindowRegistry::Observer:
32 void OnAppWindowAdded(extensions::AppWindow
* app_window
) override
;
35 extensions::AppWindowRegistry
* registry_
;
37 base::RunLoop run_loop_
;
38 extensions::AppWindow
* window_
;
40 DISALLOW_COPY_AND_ASSIGN(AppWindowWaiter
);
43 } // namespace chromeos
45 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_TEST_APP_WINDOW_WAITER_H_