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_H_ 6 #define CHROME_BROWSER_GOOGLE_GOOGLE_URL_TRACKER_NAVIGATION_HELPER_H_ 7 8 class GoogleURLTracker; 9 class InfoBarService; 10 class Profile; 11 12 namespace content { 13 class NavigationController; 14 } 15 16 // A helper class for GoogleURLTracker that abstracts the details of listening 17 // for various navigation events. 18 class GoogleURLTrackerNavigationHelper { 19 public: 20 virtual ~GoogleURLTrackerNavigationHelper() {} 21 22 // Sets the GoogleURLTracker that should receive callbacks from this observer. 23 virtual void SetGoogleURLTracker(GoogleURLTracker* tracker) = 0; 24 25 // Enables or disables listening for navigation starts. OnNavigationPending 26 // will be called for each navigation start if listening is enabled. 27 virtual void SetListeningForNavigationStart(bool listen) = 0; 28 29 // Returns whether or not the observer is currently listening for navigation 30 // starts. 31 virtual bool IsListeningForNavigationStart() = 0; 32 33 // Enables or disables listening for navigation commits for the given 34 // NavigationController. OnNavigationCommitted will be called for each 35 // navigation commit if listening is enabled. 36 virtual void SetListeningForNavigationCommit( 37 const content::NavigationController* nav_controller, 38 bool listen) = 0; 39 40 // Returns whether or not the observer is currently listening for navigation 41 // commits for the given NavigationController. 42 virtual bool IsListeningForNavigationCommit( 43 const content::NavigationController* nav_controller) = 0; 44 45 // Enables or disables listening for tab destruction for the given 46 // NavigationController. OnTabClosed will be called on tab destruction if 47 // listening is enabled. 48 virtual void SetListeningForTabDestruction( 49 const content::NavigationController* nav_controller, 50 bool listen) = 0; 51 52 // Returns whether or not the observer is currently listening for tab 53 // destruction for the given NavigationController. 54 virtual bool IsListeningForTabDestruction( 55 const content::NavigationController* nav_controller) = 0; 56 }; 57 58 #endif // CHROME_BROWSER_GOOGLE_GOOGLE_URL_TRACKER_NAVIGATION_HELPER_H_ 59