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
3// found in the LICENSE file.
4
5#include "chrome/test/remoting/page_load_notification_observer.h"
6
7#include "content/public/browser/navigation_controller.h"
8#include "content/public/browser/notification_types.h"
9#include "content/public/browser/web_contents.h"
10
11namespace remoting {
12
13PageLoadNotificationObserver::PageLoadNotificationObserver(const GURL& target)
14    : WindowedNotificationObserver(
15          content::NOTIFICATION_LOAD_STOP,
16          base::Bind(&PageLoadNotificationObserver::IsTargetLoaded,
17                     base::Unretained(this))),
18      target_(target) {
19}
20
21PageLoadNotificationObserver::~PageLoadNotificationObserver() {}
22
23bool PageLoadNotificationObserver::IsTargetLoaded() {
24  content::NavigationController* controller =
25      content::Source<content::NavigationController>(source()).ptr();
26  return controller->GetWebContents()->GetURL() == target_;
27}
28
29}  // namespace remoting
30