OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_H_ | 5 #ifndef CHROME_BROWSER_GOOGLE_GOOGLE_URL_TRACKER_H_ |
6 #define CHROME_BROWSER_GOOGLE_GOOGLE_URL_TRACKER_H_ | 6 #define CHROME_BROWSER_GOOGLE_GOOGLE_URL_TRACKER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 19 matching lines...) Expand all Loading... |
30 // synchronously return a value at all times (even during startup or in unittest | 30 // synchronously return a value at all times (even during startup or in unittest |
31 // mode). Consumers who need to be notified when things change should listen to | 31 // mode). Consumers who need to be notified when things change should listen to |
32 // the notification service for NOTIFY_GOOGLE_URL_UPDATED, and call GoogleURL() | 32 // the notification service for NOTIFY_GOOGLE_URL_UPDATED, and call GoogleURL() |
33 // again after receiving it, in order to get the updated value. | 33 // again after receiving it, in order to get the updated value. |
34 // | 34 // |
35 // To protect users' privacy and reduce server load, no updates will be | 35 // To protect users' privacy and reduce server load, no updates will be |
36 // performed (ever) unless at least one consumer registers interest by calling | 36 // performed (ever) unless at least one consumer registers interest by calling |
37 // RequestServerCheck(). | 37 // RequestServerCheck(). |
38 class GoogleURLTracker : public URLFetcher::Delegate, | 38 class GoogleURLTracker : public URLFetcher::Delegate, |
39 public NotificationObserver, | 39 public NotificationObserver, |
40 public net::NetworkChangeNotifier::Observer { | 40 public net::NetworkChangeNotifier::IPAddressObserver { |
41 public: | 41 public: |
42 // Only the main browser process loop should call this, when setting up | 42 // Only the main browser process loop should call this, when setting up |
43 // g_browser_process->google_url_tracker_. No code other than the | 43 // g_browser_process->google_url_tracker_. No code other than the |
44 // GoogleURLTracker itself should actually use | 44 // GoogleURLTracker itself should actually use |
45 // g_browser_process->google_url_tracker() (which shouldn't be hard, since | 45 // g_browser_process->google_url_tracker() (which shouldn't be hard, since |
46 // there aren't useful public functions on this object for consumers to access | 46 // there aren't useful public functions on this object for consumers to access |
47 // anyway). | 47 // anyway). |
48 GoogleURLTracker(); | 48 GoogleURLTracker(); |
49 | 49 |
50 virtual ~GoogleURLTracker(); | 50 virtual ~GoogleURLTracker(); |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 const net::URLRequestStatus& status, | 111 const net::URLRequestStatus& status, |
112 int response_code, | 112 int response_code, |
113 const ResponseCookies& cookies, | 113 const ResponseCookies& cookies, |
114 const std::string& data); | 114 const std::string& data); |
115 | 115 |
116 // NotificationObserver | 116 // NotificationObserver |
117 virtual void Observe(NotificationType type, | 117 virtual void Observe(NotificationType type, |
118 const NotificationSource& source, | 118 const NotificationSource& source, |
119 const NotificationDetails& details); | 119 const NotificationDetails& details); |
120 | 120 |
121 // NetworkChangeNotifier::Observer | 121 // NetworkChangeNotifier::IPAddressObserver |
122 virtual void OnIPAddressChanged(); | 122 virtual void OnIPAddressChanged(); |
123 | 123 |
124 void SearchCommitted(); | 124 void SearchCommitted(); |
125 void OnNavigationPending(const NotificationSource& source, | 125 void OnNavigationPending(const NotificationSource& source, |
126 const GURL& pending_url); | 126 const GURL& pending_url); |
127 void OnNavigationCommittedOrTabClosed(TabContents* tab_contents, | 127 void OnNavigationCommittedOrTabClosed(TabContents* tab_contents, |
128 NotificationType::Type type); | 128 NotificationType::Type type); |
129 void ShowGoogleURLInfoBarIfNecessary(TabContents* tab_contents); | 129 void ShowGoogleURLInfoBarIfNecessary(TabContents* tab_contents); |
130 | 130 |
131 NotificationRegistrar registrar_; | 131 NotificationRegistrar registrar_; |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 | 184 |
185 private: | 185 private: |
186 // ConfirmInfoBarDelegate: | 186 // ConfirmInfoBarDelegate: |
187 virtual string16 GetMessageText() const; | 187 virtual string16 GetMessageText() const; |
188 virtual string16 GetButtonLabel(InfoBarButton button) const; | 188 virtual string16 GetButtonLabel(InfoBarButton button) const; |
189 | 189 |
190 DISALLOW_COPY_AND_ASSIGN(GoogleURLTrackerInfoBarDelegate); | 190 DISALLOW_COPY_AND_ASSIGN(GoogleURLTrackerInfoBarDelegate); |
191 }; | 191 }; |
192 | 192 |
193 #endif // CHROME_BROWSER_GOOGLE_GOOGLE_URL_TRACKER_H_ | 193 #endif // CHROME_BROWSER_GOOGLE_GOOGLE_URL_TRACKER_H_ |
OLD | NEW |