Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9)

Side by Side Diff: chrome/browser/google/google_url_tracker.h

Issue 22694006: Infobar system refactor. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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_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 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
11 11
12 #include "base/callback_forward.h" 12 #include "base/callback_forward.h"
13 #include "base/gtest_prod_util.h" 13 #include "base/gtest_prod_util.h"
14 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
15 #include "base/memory/weak_ptr.h" 15 #include "base/memory/weak_ptr.h"
16 #include "chrome/browser/google/google_url_tracker_map_entry.h" 16 #include "chrome/browser/google/google_url_tracker_map_entry.h"
17 #include "components/browser_context_keyed_service/browser_context_keyed_service .h" 17 #include "components/browser_context_keyed_service/browser_context_keyed_service .h"
18 #include "net/base/network_change_notifier.h" 18 #include "net/base/network_change_notifier.h"
19 #include "net/url_request/url_fetcher.h" 19 #include "net/url_request/url_fetcher.h"
20 #include "net/url_request/url_fetcher_delegate.h" 20 #include "net/url_request/url_fetcher_delegate.h"
21 #include "url/gurl.h" 21 #include "url/gurl.h"
22 22
23 class GoogleURLTrackerNavigationHelper; 23 class GoogleURLTrackerNavigationHelper;
24 class InfoBar;
24 class PrefService; 25 class PrefService;
25 class Profile; 26 class Profile;
26 27
27 namespace content { 28 namespace content {
28 class NavigationController; 29 class NavigationController;
29 } 30 }
30 31
31 // This object is responsible for checking the Google URL once per network 32 // This object is responsible for checking the Google URL once per network
32 // change, and if necessary prompting the user to see if they want to change to 33 // change, and if necessary prompting the user to see if they want to change to
33 // using it. The current and last prompted values are saved to prefs. 34 // using it. The current and last prompted values are saved to prefs.
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 // listener if there are no remaining listeners for navigation commits, as we 169 // listener if there are no remaining listeners for navigation commits, as we
169 // no longer need them until another search is committed. 170 // no longer need them until another search is committed.
170 void UnregisterForEntrySpecificNotifications( 171 void UnregisterForEntrySpecificNotifications(
171 const GoogleURLTrackerMapEntry& map_entry, 172 const GoogleURLTrackerMapEntry& map_entry,
172 bool must_be_listening_for_commit); 173 bool must_be_listening_for_commit);
173 174
174 Profile* profile_; 175 Profile* profile_;
175 176
176 scoped_ptr<GoogleURLTrackerNavigationHelper> nav_helper_; 177 scoped_ptr<GoogleURLTrackerNavigationHelper> nav_helper_;
177 178
178 // Creates an infobar delegate and adds it to the provided InfoBarService. 179 // Creates an infobar and adds it to the provided InfoBarService. Returns the
179 // Returns the delegate pointer on success or NULL on failure. The caller 180 // infobar on success or NULL on failure. The caller does not own the
180 // does not own the returned object, the InfoBarService does. 181 // returned object, the InfoBarService does.
181 base::Callback<GoogleURLTrackerInfoBarDelegate*( 182 base::Callback<InfoBar*(InfoBarService*, GoogleURLTracker*, const GURL&)>
182 InfoBarService*, 183 infobar_creator_;
183 GoogleURLTracker*,
184 const GURL&)> infobar_creator_;
185 184
186 GURL google_url_; 185 GURL google_url_;
187 GURL fetched_google_url_; 186 GURL fetched_google_url_;
188 base::WeakPtrFactory<GoogleURLTracker> weak_ptr_factory_; 187 base::WeakPtrFactory<GoogleURLTracker> weak_ptr_factory_;
189 scoped_ptr<net::URLFetcher> fetcher_; 188 scoped_ptr<net::URLFetcher> fetcher_;
190 int fetcher_id_; 189 int fetcher_id_;
191 bool in_startup_sleep_; // True if we're in the five-second "no fetching" 190 bool in_startup_sleep_; // True if we're in the five-second "no fetching"
192 // period that begins at browser start. 191 // period that begins at browser start.
193 bool already_fetched_; // True if we've already fetched a URL once this run; 192 bool already_fetched_; // True if we've already fetched a URL once this run;
194 // we won't fetch again until after a restart. 193 // we won't fetch again until after a restart.
195 bool need_to_fetch_; // True if a consumer actually wants us to fetch an 194 bool need_to_fetch_; // True if a consumer actually wants us to fetch an
196 // updated URL. If this is never set, we won't 195 // updated URL. If this is never set, we won't
197 // bother to fetch anything. 196 // bother to fetch anything.
198 // Consumers should observe 197 // Consumers should observe
199 // chrome::NOTIFICATION_GOOGLE_URL_UPDATED. 198 // chrome::NOTIFICATION_GOOGLE_URL_UPDATED.
200 bool need_to_prompt_; // True if the last fetched Google URL is not 199 bool need_to_prompt_; // True if the last fetched Google URL is not
201 // matched with current user's default Google URL 200 // matched with current user's default Google URL
202 // nor the last prompted Google URL. 201 // nor the last prompted Google URL.
203 bool search_committed_; // True when we're expecting a notification of a new 202 bool search_committed_; // True when we're expecting a notification of a new
204 // pending search navigation. 203 // pending search navigation.
205 EntryMap entry_map_; 204 EntryMap entry_map_;
206 205
207 DISALLOW_COPY_AND_ASSIGN(GoogleURLTracker); 206 DISALLOW_COPY_AND_ASSIGN(GoogleURLTracker);
208 }; 207 };
209 208
210 #endif // CHROME_BROWSER_GOOGLE_GOOGLE_URL_TRACKER_H_ 209 #endif // CHROME_BROWSER_GOOGLE_GOOGLE_URL_TRACKER_H_
OLDNEW
« no previous file with comments | « chrome/browser/geolocation/geolocation_infobar_delegate_android.cc ('k') | chrome/browser/google/google_url_tracker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698