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)#include "chrome/test/remoting/page_load_notification_observer.h" 68bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) 78bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)#include "content/public/browser/navigation_controller.h" 88bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)#include "content/public/browser/notification_types.h" 98bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)#include "content/public/browser/web_contents.h" 108bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) 118bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)namespace remoting { 128bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) 138bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)PageLoadNotificationObserver::PageLoadNotificationObserver(const GURL& target) 148bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) : WindowedNotificationObserver( 158bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) content::NOTIFICATION_LOAD_STOP, 168bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) base::Bind(&PageLoadNotificationObserver::IsTargetLoaded, 178bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) base::Unretained(this))), 188bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) target_(target) { 198bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)} 208bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) 218bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)PageLoadNotificationObserver::~PageLoadNotificationObserver() {} 228bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) 238bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)bool PageLoadNotificationObserver::IsTargetLoaded() { 248bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) content::NavigationController* controller = 258bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) content::Source<content::NavigationController>(source()).ptr(); 268bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) return controller->GetWebContents()->GetURL() == target_; 278bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)} 288bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) 298bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)} // namespace remoting 30