| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_TEST_REMOTING_PAGE_LOAD_NOTIFICATION_OBSERVER_H_ | 5 #ifndef CHROME_TEST_REMOTING_PAGE_LOAD_NOTIFICATION_OBSERVER_H_ |
| 6 #define CHROME_TEST_REMOTING_PAGE_LOAD_NOTIFICATION_OBSERVER_H_ | 6 #define CHROME_TEST_REMOTING_PAGE_LOAD_NOTIFICATION_OBSERVER_H_ |
| 7 | 7 |
| 8 #include "content/public/test/test_utils.h" | 8 #include "content/public/test/test_utils.h" |
| 9 #include "url/gurl.h" | 9 #include "url/gurl.h" |
| 10 | 10 |
| 11 namespace remoting { | 11 namespace remoting { |
| 12 | 12 |
| 13 // A PageLoadNotificationObserver allows code to wait until a give URL is loaded | 13 // A PageLoadNotificationObserver allows code to wait until a give URL is loaded |
| 14 // in any tab in any browser window, i.e. NotificationService::AllSources(). | 14 // in any tab in any browser window, i.e. NotificationService::AllSources(). |
| 15 // This simple pattern is not easy to implement using | 15 // This simple pattern is not easy to implement using |
| 16 // WindowedNotificationObserver because we need to bind the observer object | 16 // WindowedNotificationObserver because we need to bind the observer object |
| 17 // in the callback but we also need to provide the callback when constructing | 17 // in the callback but we also need to provide the callback when constructing |
| 18 // the observer object. | 18 // the observer object. |
| 19 class PageLoadNotificationObserver | 19 class PageLoadNotificationObserver |
| 20 : public content::WindowedNotificationObserver { | 20 : public content::WindowedNotificationObserver { |
| 21 public: | 21 public: |
| 22 explicit PageLoadNotificationObserver(const GURL& target); | 22 explicit PageLoadNotificationObserver(const GURL& target); |
| 23 | 23 |
| 24 virtual ~PageLoadNotificationObserver(); | 24 ~PageLoadNotificationObserver() override; |
| 25 | 25 |
| 26 private: | 26 private: |
| 27 bool IsTargetLoaded(); | 27 bool IsTargetLoaded(); |
| 28 GURL target_; | 28 GURL target_; |
| 29 DISALLOW_COPY_AND_ASSIGN(PageLoadNotificationObserver); | 29 DISALLOW_COPY_AND_ASSIGN(PageLoadNotificationObserver); |
| 30 }; | 30 }; |
| 31 | 31 |
| 32 } // namespace remoting | 32 } // namespace remoting |
| 33 | 33 |
| 34 #endif // CHROME_TEST_REMOTING_PAGE_LOAD_NOTIFICATION_OBSERVER_H_ | 34 #endif // CHROME_TEST_REMOTING_PAGE_LOAD_NOTIFICATION_OBSERVER_H_ |
| OLD | NEW |