18bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)// Copyright 2013 The Chromium Authors. All rights reserved.
28bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be
38bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)// found in the LICENSE file.
48bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)
58bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)#ifndef CHROME_TEST_REMOTING_PAGE_LOAD_NOTIFICATION_OBSERVER_H_
68bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)#define CHROME_TEST_REMOTING_PAGE_LOAD_NOTIFICATION_OBSERVER_H_
78bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)
88bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)#include "content/public/test/test_utils.h"
98bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)#include "url/gurl.h"
108bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)
118bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)namespace remoting {
128bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)
138bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)// A PageLoadNotificationObserver allows code to wait until a give URL is loaded
148bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)// in any tab in any browser window, i.e. NotificationService::AllSources().
158bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)// This simple pattern is not easy to implement using
168bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)// WindowedNotificationObserver because we need to bind the observer object
178bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)// in the callback but we also need to provide the callback when constructing
188bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)// the observer object.
198bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)class PageLoadNotificationObserver
208bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)    : public content::WindowedNotificationObserver {
218bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) public:
228bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)  explicit PageLoadNotificationObserver(const GURL& target);
238bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)
248bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)  virtual ~PageLoadNotificationObserver();
258bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)
268bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) private:
278bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)  bool IsTargetLoaded();
288bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)  GURL target_;
298bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)  DISALLOW_COPY_AND_ASSIGN(PageLoadNotificationObserver);
308bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)};
318bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)
328bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)}  // namespace remoting
338bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)
348bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)#endif  // CHROME_TEST_REMOTING_PAGE_LOAD_NOTIFICATION_OBSERVER_H_
35