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