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/files/scoped_temp_dir.h" | 8 #include "base/files/scoped_temp_dir.h" |
9 #include "base/format_macros.h" | 9 #include "base/format_macros.h" |
10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
278 // Delets a url. | 278 // Delets a url. |
279 void DeleteURL(const GURL& url) { | 279 void DeleteURL(const GURL& url) { |
280 history_service()->DeleteURL(url); | 280 history_service()->DeleteURL(url); |
281 } | 281 } |
282 | 282 |
283 // Returns true if the thumbnail equals the specified bytes. | 283 // Returns true if the thumbnail equals the specified bytes. |
284 bool ThumbnailEqualsBytes(const gfx::Image& image, | 284 bool ThumbnailEqualsBytes(const gfx::Image& image, |
285 base::RefCountedMemory* bytes) { | 285 base::RefCountedMemory* bytes) { |
286 scoped_refptr<base::RefCountedBytes> encoded_image; | 286 scoped_refptr<base::RefCountedBytes> encoded_image; |
287 TopSitesImpl::EncodeBitmap(image, &encoded_image); | 287 TopSitesImpl::EncodeBitmap(image, &encoded_image); |
288 return ThumbnailsAreEqual(encoded_image, bytes); | 288 return ThumbnailsAreEqual(encoded_image.get(), bytes); |
289 } | 289 } |
290 | 290 |
291 // Recreates top sites. This forces top sites to reread from the db. | 291 // Recreates top sites. This forces top sites to reread from the db. |
292 void RecreateTopSitesAndBlock() { | 292 void RecreateTopSitesAndBlock() { |
293 // Recreate TopSites and wait for it to load. | 293 // Recreate TopSites and wait for it to load. |
294 profile()->CreateTopSites(); | 294 profile()->CreateTopSites(); |
295 // As history already loaded we have to fake this call. | 295 // As history already loaded we have to fake this call. |
296 profile()->BlockUntilTopSitesLoaded(); | 296 profile()->BlockUntilTopSitesLoaded(); |
297 } | 297 } |
298 | 298 |
(...skipping 959 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1258 chrome::NOTIFICATION_TOP_SITES_LOADED, | 1258 chrome::NOTIFICATION_TOP_SITES_LOADED, |
1259 content::Source<Profile>(profile())); | 1259 content::Source<Profile>(profile())); |
1260 profile()->CreateTopSites(); | 1260 profile()->CreateTopSites(); |
1261 HistoryServiceFactory::GetForProfile( | 1261 HistoryServiceFactory::GetForProfile( |
1262 profile(), Profile::EXPLICIT_ACCESS)->UnloadBackend(); | 1262 profile(), Profile::EXPLICIT_ACCESS)->UnloadBackend(); |
1263 profile()->BlockUntilHistoryProcessesPendingRequests(); | 1263 profile()->BlockUntilHistoryProcessesPendingRequests(); |
1264 observer.Wait(); | 1264 observer.Wait(); |
1265 } | 1265 } |
1266 | 1266 |
1267 } // namespace history | 1267 } // namespace history |
OLD | NEW |