1 // Copyright (c) 2012 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 #ifndef CHROME_BROWSER_GOOGLE_GOOGLE_URL_TRACKER_NAVIGATION_HELPER_IMPL_H_ 6 #define CHROME_BROWSER_GOOGLE_GOOGLE_URL_TRACKER_NAVIGATION_HELPER_IMPL_H_ 7 8 #include "chrome/browser/google/google_url_tracker_navigation_helper.h" 9 #include "content/public/browser/notification_observer.h" 10 #include "content/public/browser/notification_registrar.h" 11 #include "url/gurl.h" 12 13 class GoogleURLTrackerNavigationHelperImpl 14 : public GoogleURLTrackerNavigationHelper, 15 public content::NotificationObserver { 16 public: 17 explicit GoogleURLTrackerNavigationHelperImpl(); 18 virtual ~GoogleURLTrackerNavigationHelperImpl(); 19 20 // GoogleURLTrackerNavigationHelper. 21 virtual void SetGoogleURLTracker(GoogleURLTracker* tracker) OVERRIDE; 22 virtual void SetListeningForNavigationStart(bool listen) OVERRIDE; 23 virtual bool IsListeningForNavigationStart() OVERRIDE; 24 virtual void SetListeningForNavigationCommit( 25 const content::NavigationController* nav_controller, 26 bool listen) OVERRIDE; 27 virtual bool IsListeningForNavigationCommit( 28 const content::NavigationController* nav_controller) OVERRIDE; 29 virtual void SetListeningForTabDestruction( 30 const content::NavigationController* nav_controller, 31 bool listen) OVERRIDE; 32 virtual bool IsListeningForTabDestruction( 33 const content::NavigationController* nav_controller) OVERRIDE; 34 35 private: 36 friend class GoogleURLTrackerNavigationHelperTest; 37 38 // content::NotificationObserver: 39 virtual void Observe(int type, 40 const content::NotificationSource& source, 41 const content::NotificationDetails& details) OVERRIDE; 42 43 // Returns a WebContents NavigationSource for the WebContents corresponding to 44 // the given NavigationController NotificationSource. 45 virtual content::NotificationSource GetWebContentsSource( 46 const content::NotificationSource& nav_controller_source); 47 48 GoogleURLTracker* tracker_; 49 content::NotificationRegistrar registrar_; 50 }; 51 52 #endif // CHROME_BROWSER_GOOGLE_GOOGLE_URL_TRACKER_NAVIGATION_HELPER_IMPL_H_ 53