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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 | 100 |
101 // Called when the five second startup sleep has finished. Runs any pending | 101 // Called when the five second startup sleep has finished. Runs any pending |
102 // fetch. | 102 // fetch. |
103 void FinishSleep(); | 103 void FinishSleep(); |
104 | 104 |
105 // Starts the fetch of the up-to-date Google URL if we actually want to fetch | 105 // Starts the fetch of the up-to-date Google URL if we actually want to fetch |
106 // it and can currently do so. | 106 // it and can currently do so. |
107 void StartFetchIfDesirable(); | 107 void StartFetchIfDesirable(); |
108 | 108 |
109 // content::URLFetcherDelegate | 109 // content::URLFetcherDelegate |
110 virtual void OnURLFetchComplete(const URLFetcher *source); | 110 virtual void OnURLFetchComplete(const content::URLFetcher* source); |
111 | 111 |
112 // content::NotificationObserver | 112 // content::NotificationObserver |
113 virtual void Observe(int type, | 113 virtual void Observe(int type, |
114 const content::NotificationSource& source, | 114 const content::NotificationSource& source, |
115 const content::NotificationDetails& details); | 115 const content::NotificationDetails& details); |
116 | 116 |
117 // NetworkChangeNotifier::IPAddressObserver | 117 // NetworkChangeNotifier::IPAddressObserver |
118 virtual void OnIPAddressChanged(); | 118 virtual void OnIPAddressChanged(); |
119 | 119 |
120 void SearchCommitted(); | 120 void SearchCommitted(); |
121 void OnNavigationPending(const content::NotificationSource& source, | 121 void OnNavigationPending(const content::NotificationSource& source, |
122 const GURL& pending_url); | 122 const GURL& pending_url); |
123 void OnNavigationCommittedOrTabClosed(TabContents* tab_contents, | 123 void OnNavigationCommittedOrTabClosed(TabContents* tab_contents, |
124 int type); | 124 int type); |
125 void ShowGoogleURLInfoBarIfNecessary(TabContents* tab_contents); | 125 void ShowGoogleURLInfoBarIfNecessary(TabContents* tab_contents); |
126 | 126 |
127 content::NotificationRegistrar registrar_; | 127 content::NotificationRegistrar registrar_; |
128 InfobarCreator infobar_creator_; | 128 InfobarCreator infobar_creator_; |
129 // TODO(ukai): GoogleURLTracker should track google domain (e.g. google.co.uk) | 129 // TODO(ukai): GoogleURLTracker should track google domain (e.g. google.co.uk) |
130 // rather than URL (e.g. http://www.google.co.uk/), so that user could | 130 // rather than URL (e.g. http://www.google.co.uk/), so that user could |
131 // configure to use https in search engine templates. | 131 // configure to use https in search engine templates. |
132 GURL google_url_; | 132 GURL google_url_; |
133 GURL fetched_google_url_; | 133 GURL fetched_google_url_; |
134 base::WeakPtrFactory<GoogleURLTracker> weak_ptr_factory_; | 134 base::WeakPtrFactory<GoogleURLTracker> weak_ptr_factory_; |
135 scoped_ptr<URLFetcher> fetcher_; | 135 scoped_ptr<content::URLFetcher> fetcher_; |
136 int fetcher_id_; | 136 int fetcher_id_; |
137 bool queue_wakeup_task_; | 137 bool queue_wakeup_task_; |
138 bool in_startup_sleep_; // True if we're in the five-second "no fetching" | 138 bool in_startup_sleep_; // True if we're in the five-second "no fetching" |
139 // period that begins at browser start. | 139 // period that begins at browser start. |
140 bool already_fetched_; // True if we've already fetched a URL once this run; | 140 bool already_fetched_; // True if we've already fetched a URL once this run; |
141 // we won't fetch again until after a restart. | 141 // we won't fetch again until after a restart. |
142 bool need_to_fetch_; // True if a consumer actually wants us to fetch an | 142 bool need_to_fetch_; // True if a consumer actually wants us to fetch an |
143 // updated URL. If this is never set, we won't | 143 // updated URL. If this is never set, we won't |
144 // bother to fetch anything. | 144 // bother to fetch anything. |
145 // Consumers should observe | 145 // Consumers should observe |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 virtual string16 GetMessageText() const OVERRIDE; | 180 virtual string16 GetMessageText() const OVERRIDE; |
181 virtual string16 GetButtonLabel(InfoBarButton button) const OVERRIDE; | 181 virtual string16 GetButtonLabel(InfoBarButton button) const OVERRIDE; |
182 | 182 |
183 // Returns the portion of the appropriate hostname to display. | 183 // Returns the portion of the appropriate hostname to display. |
184 string16 GetHost(bool new_host) const; | 184 string16 GetHost(bool new_host) const; |
185 | 185 |
186 DISALLOW_COPY_AND_ASSIGN(GoogleURLTrackerInfoBarDelegate); | 186 DISALLOW_COPY_AND_ASSIGN(GoogleURLTrackerInfoBarDelegate); |
187 }; | 187 }; |
188 | 188 |
189 #endif // CHROME_BROWSER_GOOGLE_GOOGLE_URL_TRACKER_H_ | 189 #endif // CHROME_BROWSER_GOOGLE_GOOGLE_URL_TRACKER_H_ |
OLD | NEW |