| 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_HISTORY_HISTORY_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_HISTORY_HISTORY_SERVICE_H_ |
| 6 #define CHROME_BROWSER_HISTORY_HISTORY_SERVICE_H_ | 6 #define CHROME_BROWSER_HISTORY_HISTORY_SERVICE_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 // will release pointers to it. No other functions should be called once | 120 // will release pointers to it. No other functions should be called once |
| 121 // cleanup has happened that may dispatch to the history thread (because it | 121 // cleanup has happened that may dispatch to the history thread (because it |
| 122 // will be NULL). | 122 // will be NULL). |
| 123 // | 123 // |
| 124 // In practice, this will be called by the service manager (BrowserProcess) | 124 // In practice, this will be called by the service manager (BrowserProcess) |
| 125 // when it is being destroyed. Because that reference is being destroyed, it | 125 // when it is being destroyed. Because that reference is being destroyed, it |
| 126 // should be impossible for anybody else to call the service, even if it is | 126 // should be impossible for anybody else to call the service, even if it is |
| 127 // still in memory (pending requests may be holding a reference to us). | 127 // still in memory (pending requests may be holding a reference to us). |
| 128 void Cleanup(); | 128 void Cleanup(); |
| 129 | 129 |
| 130 // RenderProcessHost pointers are used to scope page IDs (see AddPage). These | 130 // Context ids are used to scope page IDs (see AddPage). These contexts |
| 131 // objects must tell us when they are being destroyed so that we can clear | 131 // must tell us when they are being invalidated so that we can clear |
| 132 // out any cached data associated with that scope. | 132 // out any cached data associated with that context. |
| 133 // | 133 void ClearCachedDataForContextID(history::ContextID context_id); |
| 134 // The given pointer will not be dereferenced, it is only used for | |
| 135 // identification purposes, hence it is a void*. | |
| 136 void NotifyRenderProcessHostDestruction(const void* host); | |
| 137 | 134 |
| 138 // Triggers the backend to load if it hasn't already, and then returns the | 135 // Triggers the backend to load if it hasn't already, and then returns the |
| 139 // in-memory URL database. The returned pointer MAY BE NULL if the in-memory | 136 // in-memory URL database. The returned pointer MAY BE NULL if the in-memory |
| 140 // database has not been loaded yet. This pointer is owned by the history | 137 // database has not been loaded yet. This pointer is owned by the history |
| 141 // system. Callers should not store or cache this value. | 138 // system. Callers should not store or cache this value. |
| 142 // | 139 // |
| 143 // TODO(brettw) this should return the InMemoryHistoryBackend. | 140 // TODO(brettw) this should return the InMemoryHistoryBackend. |
| 144 history::URLDatabase* InMemoryDatabase(); | 141 history::URLDatabase* InMemoryDatabase(); |
| 145 | 142 |
| 146 // Following functions get URL information from in-memory database. | 143 // Following functions get URL information from in-memory database. |
| (...skipping 20 matching lines...) Expand all Loading... |
| 167 } | 164 } |
| 168 | 165 |
| 169 // KeyedService: | 166 // KeyedService: |
| 170 virtual void Shutdown() OVERRIDE; | 167 virtual void Shutdown() OVERRIDE; |
| 171 | 168 |
| 172 // Navigation ---------------------------------------------------------------- | 169 // Navigation ---------------------------------------------------------------- |
| 173 | 170 |
| 174 // Adds the given canonical URL to history with the given time as the visit | 171 // Adds the given canonical URL to history with the given time as the visit |
| 175 // time. Referrer may be the empty string. | 172 // time. Referrer may be the empty string. |
| 176 // | 173 // |
| 177 // The supplied render process host is used to scope the given page ID. Page | 174 // The supplied context id is used to scope the given page ID. Page IDs |
| 178 // IDs are only unique inside a given render process, so we need that to | 175 // are only unique inside a given context, so we need that to differentiate |
| 179 // differentiate them. This pointer should not be dereferenced by the history | 176 // them. |
| 180 // system. | |
| 181 // | 177 // |
| 182 // The scope/ids can be NULL if there is no meaningful tracking information | 178 // The context/page ids can be NULL if there is no meaningful tracking |
| 183 // that can be performed on the given URL. The 'page_id' should be the ID of | 179 // information that can be performed on the given URL. The 'page_id' should |
| 184 // the current session history entry in the given process. | 180 // be the ID of the current session history entry in the given process. |
| 185 // | 181 // |
| 186 // 'redirects' is an array of redirect URLs leading to this page, with the | 182 // 'redirects' is an array of redirect URLs leading to this page, with the |
| 187 // page itself as the last item (so when there is no redirect, it will have | 183 // page itself as the last item (so when there is no redirect, it will have |
| 188 // one entry). If there are no redirects, this array may also be empty for | 184 // one entry). If there are no redirects, this array may also be empty for |
| 189 // the convenience of callers. | 185 // the convenience of callers. |
| 190 // | 186 // |
| 191 // 'did_replace_entry' is true when the navigation entry for this page has | 187 // 'did_replace_entry' is true when the navigation entry for this page has |
| 192 // replaced the existing entry. A non-user initiated redirect causes such | 188 // replaced the existing entry. A non-user initiated redirect causes such |
| 193 // replacement. | 189 // replacement. |
| 194 // | 190 // |
| 195 // All "Add Page" functions will update the visited link database. | 191 // All "Add Page" functions will update the visited link database. |
| 196 void AddPage(const GURL& url, | 192 void AddPage(const GURL& url, |
| 197 base::Time time, | 193 base::Time time, |
| 198 const void* id_scope, | 194 history::ContextID context_id, |
| 199 int32 page_id, | 195 int32 page_id, |
| 200 const GURL& referrer, | 196 const GURL& referrer, |
| 201 const history::RedirectList& redirects, | 197 const history::RedirectList& redirects, |
| 202 content::PageTransition transition, | 198 content::PageTransition transition, |
| 203 history::VisitSource visit_source, | 199 history::VisitSource visit_source, |
| 204 bool did_replace_entry); | 200 bool did_replace_entry); |
| 205 | 201 |
| 206 // For adding pages to history where no tracking information can be done. | 202 // For adding pages to history where no tracking information can be done. |
| 207 void AddPage(const GURL& url, | 203 void AddPage(const GURL& url, |
| 208 base::Time time, | 204 base::Time time, |
| 209 history::VisitSource visit_source); | 205 history::VisitSource visit_source); |
| 210 | 206 |
| 211 // All AddPage variants end up here. | 207 // All AddPage variants end up here. |
| 212 void AddPage(const history::HistoryAddPageArgs& add_page_args); | 208 void AddPage(const history::HistoryAddPageArgs& add_page_args); |
| 213 | 209 |
| 214 // Adds an entry for the specified url without creating a visit. This should | 210 // Adds an entry for the specified url without creating a visit. This should |
| 215 // only be used when bookmarking a page, otherwise the row leaks in the | 211 // only be used when bookmarking a page, otherwise the row leaks in the |
| 216 // history db (it never gets cleaned). | 212 // history db (it never gets cleaned). |
| 217 void AddPageNoVisitForBookmark(const GURL& url, const base::string16& title); | 213 void AddPageNoVisitForBookmark(const GURL& url, const base::string16& title); |
| 218 | 214 |
| 219 // Sets the title for the given page. The page should be in history. If it | 215 // Sets the title for the given page. The page should be in history. If it |
| 220 // is not, this operation is ignored. | 216 // is not, this operation is ignored. |
| 221 void SetPageTitle(const GURL& url, const base::string16& title); | 217 void SetPageTitle(const GURL& url, const base::string16& title); |
| 222 | 218 |
| 223 // Updates the history database with a page's ending time stamp information. | 219 // Updates the history database with a page's ending time stamp information. |
| 224 // The page can be identified by the combination of the pointer to | 220 // The page can be identified by the combination of the context id, the page |
| 225 // a RenderProcessHost, the page id and the url. | 221 // id and the url. |
| 226 // | 222 void UpdateWithPageEndTime(history::ContextID context_id, |
| 227 // The given pointer will not be dereferenced, it is only used for | |
| 228 // identification purposes, hence it is a void*. | |
| 229 void UpdateWithPageEndTime(const void* host, | |
| 230 int32 page_id, | 223 int32 page_id, |
| 231 const GURL& url, | 224 const GURL& url, |
| 232 base::Time end_ts); | 225 base::Time end_ts); |
| 233 | 226 |
| 234 // Querying ------------------------------------------------------------------ | 227 // Querying ------------------------------------------------------------------ |
| 235 | 228 |
| 236 // Returns the information about the requested URL. If the URL is found, | 229 // Returns the information about the requested URL. If the URL is found, |
| 237 // success will be true and the information will be in the URLRow parameter. | 230 // success will be true and the information will be in the URLRow parameter. |
| 238 // On success, the visits, if requested, will be sorted by date. If they have | 231 // On success, the visits, if requested, will be sorted by date. If they have |
| 239 // not been requested, the pointer will be valid, but the vector will be | 232 // not been requested, the pointer will be valid, but the vector will be |
| (...skipping 807 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1047 scoped_ptr<history::InMemoryURLIndex> in_memory_url_index_; | 1040 scoped_ptr<history::InMemoryURLIndex> in_memory_url_index_; |
| 1048 | 1041 |
| 1049 ObserverList<history::VisitDatabaseObserver> visit_database_observers_; | 1042 ObserverList<history::VisitDatabaseObserver> visit_database_observers_; |
| 1050 | 1043 |
| 1051 history::DeleteDirectiveHandler delete_directive_handler_; | 1044 history::DeleteDirectiveHandler delete_directive_handler_; |
| 1052 | 1045 |
| 1053 DISALLOW_COPY_AND_ASSIGN(HistoryService); | 1046 DISALLOW_COPY_AND_ASSIGN(HistoryService); |
| 1054 }; | 1047 }; |
| 1055 | 1048 |
| 1056 #endif // CHROME_BROWSER_HISTORY_HISTORY_SERVICE_H_ | 1049 #endif // CHROME_BROWSER_HISTORY_HISTORY_SERVICE_H_ |
| OLD | NEW |