| 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 #include "base/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/bind_helpers.h" | 6 #include "base/bind_helpers.h" |
| 7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "base/format_macros.h" | 8 #include "base/format_macros.h" |
| 9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
| 10 #include "base/scoped_temp_dir.h" | 10 #include "base/scoped_temp_dir.h" |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 233 // message loop. | 233 // message loop. |
| 234 void QuitCallback(TopSitesBackend::Handle handle) { | 234 void QuitCallback(TopSitesBackend::Handle handle) { |
| 235 MessageLoop::current()->Quit(); | 235 MessageLoop::current()->Quit(); |
| 236 } | 236 } |
| 237 | 237 |
| 238 // Adds a page to history. | 238 // Adds a page to history. |
| 239 void AddPageToHistory(const GURL& url) { | 239 void AddPageToHistory(const GURL& url) { |
| 240 RedirectList redirects; | 240 RedirectList redirects; |
| 241 redirects.push_back(url); | 241 redirects.push_back(url); |
| 242 history_service()->AddPage( | 242 history_service()->AddPage( |
| 243 url, static_cast<void*>(this), 0, GURL(), | 243 url, base::Time::Now(), static_cast<void*>(this), 0, GURL(), |
| 244 content::PAGE_TRANSITION_TYPED, | 244 redirects, content::PAGE_TRANSITION_TYPED, history::SOURCE_BROWSED, |
| 245 redirects, history::SOURCE_BROWSED, false); | 245 false); |
| 246 } | 246 } |
| 247 | 247 |
| 248 // Adds a page to history. | 248 // Adds a page to history. |
| 249 void AddPageToHistory(const GURL& url, const string16& title) { | 249 void AddPageToHistory(const GURL& url, const string16& title) { |
| 250 RedirectList redirects; | 250 RedirectList redirects; |
| 251 redirects.push_back(url); | 251 redirects.push_back(url); |
| 252 history_service()->AddPage( | 252 history_service()->AddPage( |
| 253 url, static_cast<void*>(this), 0, GURL(), | 253 url, base::Time::Now(), static_cast<void*>(this), 0, GURL(), |
| 254 content::PAGE_TRANSITION_TYPED, | 254 redirects, content::PAGE_TRANSITION_TYPED, history::SOURCE_BROWSED, |
| 255 redirects, history::SOURCE_BROWSED, false); | 255 false); |
| 256 history_service()->SetPageTitle(url, title); | 256 history_service()->SetPageTitle(url, title); |
| 257 } | 257 } |
| 258 | 258 |
| 259 // Adds a page to history. | 259 // Adds a page to history. |
| 260 void AddPageToHistory(const GURL& url, | 260 void AddPageToHistory(const GURL& url, |
| 261 const string16& title, | 261 const string16& title, |
| 262 const history::RedirectList& redirects, | 262 const history::RedirectList& redirects, |
| 263 base::Time time) { | 263 base::Time time) { |
| 264 history_service()->AddPage( | 264 history_service()->AddPage( |
| 265 url, time, static_cast<void*>(this), 0, GURL(), | 265 url, time, static_cast<void*>(this), 0, GURL(), |
| 266 content::PAGE_TRANSITION_TYPED, | 266 redirects, content::PAGE_TRANSITION_TYPED, history::SOURCE_BROWSED, |
| 267 redirects, history::SOURCE_BROWSED, false); | 267 false); |
| 268 history_service()->SetPageTitle(url, title); | 268 history_service()->SetPageTitle(url, title); |
| 269 } | 269 } |
| 270 | 270 |
| 271 // Delets a url. | 271 // Delets a url. |
| 272 void DeleteURL(const GURL& url) { | 272 void DeleteURL(const GURL& url) { |
| 273 history_service()->DeleteURL(url); | 273 history_service()->DeleteURL(url); |
| 274 } | 274 } |
| 275 | 275 |
| 276 // Returns true if the thumbnail equals the specified bytes. | 276 // Returns true if the thumbnail equals the specified bytes. |
| 277 bool ThumbnailEqualsBytes(const gfx::Image& image, | 277 bool ThumbnailEqualsBytes(const gfx::Image& image, |
| (...skipping 964 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1242 chrome::NOTIFICATION_TOP_SITES_LOADED, | 1242 chrome::NOTIFICATION_TOP_SITES_LOADED, |
| 1243 content::Source<Profile>(profile())); | 1243 content::Source<Profile>(profile())); |
| 1244 profile()->CreateTopSites(); | 1244 profile()->CreateTopSites(); |
| 1245 HistoryServiceFactory::GetForProfile( | 1245 HistoryServiceFactory::GetForProfile( |
| 1246 profile(), Profile::EXPLICIT_ACCESS)->UnloadBackend(); | 1246 profile(), Profile::EXPLICIT_ACCESS)->UnloadBackend(); |
| 1247 profile()->BlockUntilHistoryProcessesPendingRequests(); | 1247 profile()->BlockUntilHistoryProcessesPendingRequests(); |
| 1248 observer.Wait(); | 1248 observer.Wait(); |
| 1249 } | 1249 } |
| 1250 | 1250 |
| 1251 } // namespace history | 1251 } // namespace history |
| OLD | NEW |