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_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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
109 // |search_url| is guaranteed to be valid. | 109 // |search_url| is guaranteed to be valid. |
110 virtual void OnNavigationCommitted(infobars::InfoBarManager* infobar_manager, | 110 virtual void OnNavigationCommitted(infobars::InfoBarManager* infobar_manager, |
111 const GURL& search_url); | 111 const GURL& search_url); |
112 | 112 |
113 // Called by the navigation observer when a tab closes. | 113 // Called by the navigation observer when a tab closes. |
114 virtual void OnTabClosed(GoogleURLTrackerNavigationHelper* nav_helper); | 114 virtual void OnTabClosed(GoogleURLTrackerNavigationHelper* nav_helper); |
115 | 115 |
116 scoped_ptr<Subscription> RegisterCallback( | 116 scoped_ptr<Subscription> RegisterCallback( |
117 const OnGoogleURLUpdatedCallback& cb); | 117 const OnGoogleURLUpdatedCallback& cb); |
118 | 118 |
119 GoogleURLTrackerClient* client() { return client_.get(); } | |
Peter Kasting
2014/06/06 18:05:39
Nit: I'd probably put this up by the fetched_googl
blundell
2014/06/06 18:49:02
Done.
| |
120 | |
119 private: | 121 private: |
120 friend class GoogleURLTrackerTest; | 122 friend class GoogleURLTrackerTest; |
121 friend class SyncTest; | 123 friend class SyncTest; |
122 | 124 |
123 typedef std::map<const infobars::InfoBarManager*, GoogleURLTrackerMapEntry*> | 125 typedef std::map<const infobars::InfoBarManager*, GoogleURLTrackerMapEntry*> |
124 EntryMap; | 126 EntryMap; |
125 | 127 |
126 static const char kSearchDomainCheckURL[]; | 128 static const char kSearchDomainCheckURL[]; |
127 | 129 |
128 // net::URLFetcherDelegate: | 130 // net::URLFetcherDelegate: |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
185 // matched with current user's default Google URL | 187 // matched with current user's default Google URL |
186 // nor the last prompted Google URL. | 188 // nor the last prompted Google URL. |
187 bool search_committed_; // True when we're expecting a notification of a new | 189 bool search_committed_; // True when we're expecting a notification of a new |
188 // pending search navigation. | 190 // pending search navigation. |
189 EntryMap entry_map_; | 191 EntryMap entry_map_; |
190 base::WeakPtrFactory<GoogleURLTracker> weak_ptr_factory_; | 192 base::WeakPtrFactory<GoogleURLTracker> weak_ptr_factory_; |
191 | 193 |
192 DISALLOW_COPY_AND_ASSIGN(GoogleURLTracker); | 194 DISALLOW_COPY_AND_ASSIGN(GoogleURLTracker); |
193 }; | 195 }; |
194 | 196 |
195 #endif // CHROME_BROWSER_GOOGLE_GOOGLE_URL_TRACKER_H_ | 197 #endif // COMPONENTS_GOOGLE_CORE_BROWSER_GOOGLE_URL_TRACKER_H_ |
OLD | NEW |