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" |
| 9 |
8 class GoogleURLTracker; | 10 class GoogleURLTracker; |
9 class InfoBarService; | |
10 class Profile; | |
11 | |
12 namespace content { | |
13 class NavigationController; | |
14 } | |
15 | 11 |
16 // A helper class for GoogleURLTracker that abstracts the details of listening | 12 // A helper class for GoogleURLTracker that abstracts the details of listening |
17 // for various navigation events. | 13 // for various navigation events. |
18 class GoogleURLTrackerNavigationHelper { | 14 class GoogleURLTrackerNavigationHelper { |
19 public: | 15 public: |
20 virtual ~GoogleURLTrackerNavigationHelper() {} | 16 explicit GoogleURLTrackerNavigationHelper( |
| 17 GoogleURLTracker* google_url_tracker); |
| 18 virtual ~GoogleURLTrackerNavigationHelper(); |
21 | 19 |
22 // Sets the GoogleURLTracker that is associated with this object. | 20 // Enables or disables listening for navigation commits. |
23 virtual void SetGoogleURLTracker(GoogleURLTracker* tracker) = 0; | 21 // OnNavigationCommitted will be called for each navigation commit if |
| 22 // listening is enabled. |
| 23 virtual void SetListeningForNavigationCommit(bool listen) = 0; |
24 | 24 |
25 // Enables or disables listening for navigation commits for the given | 25 // Returns whether or not this object is currently listening for navigation |
26 // NavigationController. OnNavigationCommitted will be called for each | 26 // commits. |
27 // navigation commit if listening is enabled. | 27 virtual bool IsListeningForNavigationCommit() = 0; |
28 virtual void SetListeningForNavigationCommit( | |
29 const content::NavigationController* nav_controller, | |
30 bool listen) = 0; | |
31 | 28 |
32 // Returns whether or not the observer is currently listening for navigation | 29 // Enables or disables listening for tab destruction. OnTabClosed will be |
33 // commits for the given NavigationController. | 30 // called on tab destruction if listening is enabled. |
34 virtual bool IsListeningForNavigationCommit( | 31 virtual void SetListeningForTabDestruction(bool listen) = 0; |
35 const content::NavigationController* nav_controller) = 0; | |
36 | 32 |
37 // Enables or disables listening for tab destruction for the given | 33 // Returns whether or not this object is currently listening for tab |
38 // NavigationController. OnTabClosed will be called on tab destruction if | 34 // destruction. |
39 // listening is enabled. | 35 virtual bool IsListeningForTabDestruction() = 0; |
40 virtual void SetListeningForTabDestruction( | |
41 const content::NavigationController* nav_controller, | |
42 bool listen) = 0; | |
43 | 36 |
44 // Returns whether or not the observer is currently listening for tab | 37 protected: |
45 // destruction for the given NavigationController. | 38 GoogleURLTracker* google_url_tracker() { return google_url_tracker_; } |
46 virtual bool IsListeningForTabDestruction( | 39 |
47 const content::NavigationController* nav_controller) = 0; | 40 private: |
| 41 GoogleURLTracker* google_url_tracker_; |
| 42 |
| 43 DISALLOW_COPY_AND_ASSIGN(GoogleURLTrackerNavigationHelper); |
48 }; | 44 }; |
49 | 45 |
50 #endif // CHROME_BROWSER_GOOGLE_GOOGLE_URL_TRACKER_NAVIGATION_HELPER_H_ | 46 #endif // CHROME_BROWSER_GOOGLE_GOOGLE_URL_TRACKER_NAVIGATION_HELPER_H_ |
OLD | NEW |