| 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 COMPONENTS_HISTORY_CORE_BROWSER_HISTORY_SERVICE_H_ | 5 #ifndef COMPONENTS_HISTORY_CORE_BROWSER_HISTORY_SERVICE_H_ |
| 6 #define COMPONENTS_HISTORY_CORE_BROWSER_HISTORY_SERVICE_H_ | 6 #define COMPONENTS_HISTORY_CORE_BROWSER_HISTORY_SERVICE_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 bool GetVisitCountForURL(const GURL& url, int* visit_count); | 145 bool GetVisitCountForURL(const GURL& url, int* visit_count); |
| 146 | 146 |
| 147 // Returns a pointer to the TypedUrlSyncableService owned by HistoryBackend. | 147 // Returns a pointer to the TypedUrlSyncableService owned by HistoryBackend. |
| 148 // This method should only be called from the history thread, because the | 148 // This method should only be called from the history thread, because the |
| 149 // returned service is intended to be accessed only via the history thread. | 149 // returned service is intended to be accessed only via the history thread. |
| 150 TypedUrlSyncableService* GetTypedUrlSyncableService() const; | 150 TypedUrlSyncableService* GetTypedUrlSyncableService() const; |
| 151 | 151 |
| 152 // KeyedService: | 152 // KeyedService: |
| 153 void Shutdown() override; | 153 void Shutdown() override; |
| 154 | 154 |
| 155 // Callback for value asynchronously returned by GetCountsForOrigins(). | 155 // Callback for value asynchronously returned by |
| 156 typedef base::Callback<void(const OriginCountMap&)> | 156 // GetCountsAndLastVisitForOrigins(). |
| 157 GetCountsForOriginsCallback; | 157 typedef base::Callback<void(const OriginCountAndLastVisitMap&)> |
| 158 GetCountsAndLastVisitForOriginsCallback; |
| 158 | 159 |
| 159 // Computes the |num_hosts| most-visited hostnames in the past 30 days and | 160 // Computes the |num_hosts| most-visited hostnames in the past 30 days and |
| 160 // returns a list of those hosts paired with their visit counts. The following | 161 // returns a list of those hosts paired with their visit counts. The following |
| 161 // caveats apply: | 162 // caveats apply: |
| 162 // 1. Hostnames are stripped of their 'www.' prefix. Visits to foo.com and | 163 // 1. Hostnames are stripped of their 'www.' prefix. Visits to foo.com and |
| 163 // www.foo.com are summed into the resultant foo.com entry. | 164 // www.foo.com are summed into the resultant foo.com entry. |
| 164 // 2. Ports and schemes are ignored. Visits to http://foo.com/ and | 165 // 2. Ports and schemes are ignored. Visits to http://foo.com/ and |
| 165 // https://foo.com:567/ are summed into the resultant foo.com entry. | 166 // https://foo.com:567/ are summed into the resultant foo.com entry. |
| 166 // 3. If the history is abnormally large and diverse, the function will give | 167 // 3. If the history is abnormally large and diverse, the function will give |
| 167 // up early and return an approximate list. | 168 // up early and return an approximate list. |
| 168 // 4. Only http://, https://, and ftp:// URLs are counted. | 169 // 4. Only http://, https://, and ftp:// URLs are counted. |
| 169 // | 170 // |
| 170 // Note: Virtual needed for mocking. | 171 // Note: Virtual needed for mocking. |
| 171 virtual void TopHosts(size_t num_hosts, | 172 virtual void TopHosts(size_t num_hosts, |
| 172 const TopHostsCallback& callback) const; | 173 const TopHostsCallback& callback) const; |
| 173 | 174 |
| 174 // Gets the counts of URLs that belong to |origins| in the history database. | 175 // Gets the counts and most recent visit date of URLs that belong to |origins| |
| 175 void GetCountsForOrigins(const std::set<GURL>& origins, | 176 // in the history database. |
| 176 const GetCountsForOriginsCallback& callback) const; | 177 void GetCountsAndLastVisitForOrigins( |
| 178 const std::set<GURL>& origins, |
| 179 const GetCountsAndLastVisitForOriginsCallback& callback) const; |
| 177 | 180 |
| 178 // Returns, for the given URL, a 0-based index into the list produced by | 181 // Returns, for the given URL, a 0-based index into the list produced by |
| 179 // TopHosts(), corresponding to that URL's host. If TopHosts() has not | 182 // TopHosts(), corresponding to that URL's host. If TopHosts() has not |
| 180 // previously been run, or the host is not in the top kMaxTopHosts, returns | 183 // previously been run, or the host is not in the top kMaxTopHosts, returns |
| 181 // kMaxTopHosts. | 184 // kMaxTopHosts. |
| 182 // | 185 // |
| 183 // Note: Virtual needed for mocking. | 186 // Note: Virtual needed for mocking. |
| 184 virtual void HostRankIfAvailable( | 187 virtual void HostRankIfAvailable( |
| 185 const GURL& url, | 188 const GURL& url, |
| 186 const base::Callback<void(int)>& callback) const; | 189 const base::Callback<void(int)>& callback) const; |
| (...skipping 657 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 844 | 847 |
| 845 // All vended weak pointers are invalidated in Cleanup(). | 848 // All vended weak pointers are invalidated in Cleanup(). |
| 846 base::WeakPtrFactory<HistoryService> weak_ptr_factory_; | 849 base::WeakPtrFactory<HistoryService> weak_ptr_factory_; |
| 847 | 850 |
| 848 DISALLOW_COPY_AND_ASSIGN(HistoryService); | 851 DISALLOW_COPY_AND_ASSIGN(HistoryService); |
| 849 }; | 852 }; |
| 850 | 853 |
| 851 } // namespace history | 854 } // namespace history |
| 852 | 855 |
| 853 #endif // COMPONENTS_HISTORY_CORE_BROWSER_HISTORY_SERVICE_H_ | 856 #endif // COMPONENTS_HISTORY_CORE_BROWSER_HISTORY_SERVICE_H_ |
| OLD | NEW |