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

Side by Side Diff: components/google/core/browser/google_url_tracker.h

Issue 316203003: Componentize GoogleURLTracker(InfoBarDelegate,MapEntry,NavHelper) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Nits Created 6 years, 6 months 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 COMPONENTS_GOOGLE_CORE_BROWSER_GOOGLE_URL_TRACKER_H_
6 #define CHROME_BROWSER_GOOGLE_GOOGLE_URL_TRACKER_H_ 6 #define COMPONENTS_GOOGLE_CORE_BROWSER_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/callback_list.h" 13 #include "base/callback_list.h"
14 #include "base/gtest_prod_util.h" 14 #include "base/gtest_prod_util.h"
15 #include "base/memory/scoped_ptr.h" 15 #include "base/memory/scoped_ptr.h"
16 #include "base/memory/weak_ptr.h" 16 #include "base/memory/weak_ptr.h"
17 #include "chrome/browser/google/google_url_tracker_map_entry.h" 17 #include "components/google/core/browser/google_url_tracker_client.h"
18 #include "components/google/core/browser/google_url_tracker_map_entry.h"
18 #include "components/keyed_service/core/keyed_service.h" 19 #include "components/keyed_service/core/keyed_service.h"
19 #include "net/base/network_change_notifier.h" 20 #include "net/base/network_change_notifier.h"
20 #include "net/url_request/url_fetcher.h" 21 #include "net/url_request/url_fetcher.h"
21 #include "net/url_request/url_fetcher_delegate.h" 22 #include "net/url_request/url_fetcher_delegate.h"
22 #include "url/gurl.h" 23 #include "url/gurl.h"
23 24
24 class GoogleURLTrackerClient;
25 class GoogleURLTrackerNavigationHelper; 25 class GoogleURLTrackerNavigationHelper;
26 class PrefService; 26 class PrefService;
27 27
28 namespace infobars { 28 namespace infobars {
29 class InfoBar; 29 class InfoBar;
30 } 30 }
31 31
32 // 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
33 // 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
34 // 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 // Notifies the tracker that the user has started a Google search. 79 // Notifies the tracker that the user has started a Google search.
80 // If prompting is necessary, we then listen for the subsequent pending 80 // If prompting is necessary, we then listen for the subsequent pending
81 // navigation to get the appropriate NavigationHelper. When the load 81 // navigation to get the appropriate NavigationHelper. When the load
82 // commits, we'll show the infobar. 82 // commits, we'll show the infobar.
83 void SearchCommitted(); 83 void SearchCommitted();
84 84
85 // No one but GoogleURLTrackerInfoBarDelegate or test code should call these. 85 // No one but GoogleURLTrackerInfoBarDelegate or test code should call these.
86 void AcceptGoogleURL(bool redo_searches); 86 void AcceptGoogleURL(bool redo_searches);
87 void CancelGoogleURL(); 87 void CancelGoogleURL();
88 const GURL& fetched_google_url() const { return fetched_google_url_; } 88 const GURL& fetched_google_url() const { return fetched_google_url_; }
89 GoogleURLTrackerClient* client() { return client_.get(); }
89 90
90 // No one but GoogleURLTrackerMapEntry should call this. 91 // No one but GoogleURLTrackerMapEntry should call this.
91 void DeleteMapEntryForManager( 92 void DeleteMapEntryForManager(
92 const infobars::InfoBarManager* infobar_manager); 93 const infobars::InfoBarManager* infobar_manager);
93 94
94 // Called by the client after SearchCommitted() registers listeners, 95 // Called by the client after SearchCommitted() registers listeners,
95 // to indicate that we've received the "load now pending" notification. 96 // to indicate that we've received the "load now pending" notification.
96 // |nav_helper| is the GoogleURLTrackerNavigationHelper associated with this 97 // |nav_helper| is the GoogleURLTrackerNavigationHelper associated with this
97 // navigation; |infobar_manager| is the InfoBarManager of the associated tab; 98 // navigation; |infobar_manager| is the InfoBarManager of the associated tab;
98 // and |pending_id| is the unique ID of the newly pending NavigationEntry. 99 // and |pending_id| is the unique ID of the newly pending NavigationEntry.
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 // matched with current user's default Google URL 186 // matched with current user's default Google URL
186 // nor the last prompted Google URL. 187 // nor the last prompted Google URL.
187 bool search_committed_; // True when we're expecting a notification of a new 188 bool search_committed_; // True when we're expecting a notification of a new
188 // pending search navigation. 189 // pending search navigation.
189 EntryMap entry_map_; 190 EntryMap entry_map_;
190 base::WeakPtrFactory<GoogleURLTracker> weak_ptr_factory_; 191 base::WeakPtrFactory<GoogleURLTracker> weak_ptr_factory_;
191 192
192 DISALLOW_COPY_AND_ASSIGN(GoogleURLTracker); 193 DISALLOW_COPY_AND_ASSIGN(GoogleURLTracker);
193 }; 194 };
194 195
195 #endif // CHROME_BROWSER_GOOGLE_GOOGLE_URL_TRACKER_H_ 196 #endif // COMPONENTS_GOOGLE_CORE_BROWSER_GOOGLE_URL_TRACKER_H_
OLDNEW
« no previous file with comments | « components/google/core/browser/DEPS ('k') | components/google/core/browser/google_url_tracker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698