OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_GOOGLE_GOOGLE_URL_TRACKER_NAVIGATION_HELPER_H_ | 5 #ifndef CHROME_BROWSER_GOOGLE_GOOGLE_URL_TRACKER_NAVIGATION_HELPER_H_ |
6 #define CHROME_BROWSER_GOOGLE_GOOGLE_URL_TRACKER_NAVIGATION_HELPER_H_ | 6 #define CHROME_BROWSER_GOOGLE_GOOGLE_URL_TRACKER_NAVIGATION_HELPER_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 class GoogleURLTracker; |
| 9 class InfoBarService; |
| 10 class Profile; |
9 | 11 |
10 class GoogleURLTracker; | 12 namespace content { |
| 13 class NavigationController; |
| 14 } |
11 | 15 |
12 // A helper class for GoogleURLTracker that abstracts the details of listening | 16 // A helper class for GoogleURLTracker that abstracts the details of listening |
13 // for various navigation events. | 17 // for various navigation events. |
14 class GoogleURLTrackerNavigationHelper { | 18 class GoogleURLTrackerNavigationHelper { |
15 public: | 19 public: |
16 explicit GoogleURLTrackerNavigationHelper( | 20 virtual ~GoogleURLTrackerNavigationHelper() {} |
17 GoogleURLTracker* google_url_tracker); | |
18 virtual ~GoogleURLTrackerNavigationHelper(); | |
19 | 21 |
20 // Enables or disables listening for navigation commits. | 22 // Sets the GoogleURLTracker that is associated with this object. |
21 // OnNavigationCommitted will be called for each navigation commit if | 23 virtual void SetGoogleURLTracker(GoogleURLTracker* tracker) = 0; |
| 24 |
| 25 // Enables or disables listening for navigation commits for the given |
| 26 // NavigationController. OnNavigationCommitted will be called for each |
| 27 // navigation commit if listening is enabled. |
| 28 virtual void SetListeningForNavigationCommit( |
| 29 const content::NavigationController* nav_controller, |
| 30 bool listen) = 0; |
| 31 |
| 32 // Returns whether or not the observer is currently listening for navigation |
| 33 // commits for the given NavigationController. |
| 34 virtual bool IsListeningForNavigationCommit( |
| 35 const content::NavigationController* nav_controller) = 0; |
| 36 |
| 37 // Enables or disables listening for tab destruction for the given |
| 38 // NavigationController. OnTabClosed will be called on tab destruction if |
22 // listening is enabled. | 39 // listening is enabled. |
23 virtual void SetListeningForNavigationCommit(bool listen) = 0; | 40 virtual void SetListeningForTabDestruction( |
| 41 const content::NavigationController* nav_controller, |
| 42 bool listen) = 0; |
24 | 43 |
25 // Returns whether or not this object is currently listening for navigation | 44 // Returns whether or not the observer is currently listening for tab |
26 // commits. | 45 // destruction for the given NavigationController. |
27 virtual bool IsListeningForNavigationCommit() = 0; | 46 virtual bool IsListeningForTabDestruction( |
28 | 47 const content::NavigationController* nav_controller) = 0; |
29 // Enables or disables listening for tab destruction. OnTabClosed will be | |
30 // called on tab destruction if listening is enabled. | |
31 virtual void SetListeningForTabDestruction(bool listen) = 0; | |
32 | |
33 // Returns whether or not this object is currently listening for tab | |
34 // destruction. | |
35 virtual bool IsListeningForTabDestruction() = 0; | |
36 | |
37 protected: | |
38 GoogleURLTracker* google_url_tracker() { return google_url_tracker_; } | |
39 | |
40 private: | |
41 GoogleURLTracker* google_url_tracker_; | |
42 | |
43 DISALLOW_COPY_AND_ASSIGN(GoogleURLTrackerNavigationHelper); | |
44 }; | 48 }; |
45 | 49 |
46 #endif // CHROME_BROWSER_GOOGLE_GOOGLE_URL_TRACKER_NAVIGATION_HELPER_H_ | 50 #endif // CHROME_BROWSER_GOOGLE_GOOGLE_URL_TRACKER_NAVIGATION_HELPER_H_ |
OLD | NEW |