| 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 "chrome/browser/thumbnails/thumbnail_service_impl.h" | 5 #include "chrome/browser/thumbnails/thumbnail_service_impl.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/memory/ref_counted_memory.h" | 8 #include "base/memory/ref_counted_memory.h" |
| 9 #include "base/time/time.h" | 9 #include "base/time/time.h" |
| 10 #include "chrome/browser/history/history_service.h" | 10 #include "chrome/browser/history/history_service.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 | 22 |
| 23 // The thumbnail size in DIP. | 23 // The thumbnail size in DIP. |
| 24 const int kThumbnailWidth = 212; | 24 const int kThumbnailWidth = 212; |
| 25 const int kThumbnailHeight = 142; | 25 const int kThumbnailHeight = 142; |
| 26 | 26 |
| 27 // True if thumbnail retargeting feature is enabled (Finch/flags). | 27 // True if thumbnail retargeting feature is enabled (Finch/flags). |
| 28 bool IsThumbnailRetargetingEnabled() { | 28 bool IsThumbnailRetargetingEnabled() { |
| 29 if (!chrome::IsInstantExtendedAPIEnabled()) | 29 if (!chrome::IsInstantExtendedAPIEnabled()) |
| 30 return false; | 30 return false; |
| 31 | 31 |
| 32 return CommandLine::ForCurrentProcess()->HasSwitch( | 32 return base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 33 switches::kEnableThumbnailRetargeting); | 33 switches::kEnableThumbnailRetargeting); |
| 34 } | 34 } |
| 35 | 35 |
| 36 void AddForcedURLOnUIThread(scoped_refptr<history::TopSites> top_sites, | 36 void AddForcedURLOnUIThread(scoped_refptr<history::TopSites> top_sites, |
| 37 const GURL& url) { | 37 const GURL& url) { |
| 38 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 38 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 39 | 39 |
| 40 if (top_sites.get() != NULL) | 40 if (top_sites.get() != NULL) |
| 41 top_sites->AddForcedURL(url, base::Time::Now()); | 41 top_sites->AddForcedURL(url, base::Time::Now()); |
| 42 } | 42 } |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 } | 119 } |
| 120 | 120 |
| 121 void ThumbnailServiceImpl::ShutdownOnUIThread() { | 121 void ThumbnailServiceImpl::ShutdownOnUIThread() { |
| 122 // Since each call uses its own scoped_refptr, we can just clear the reference | 122 // Since each call uses its own scoped_refptr, we can just clear the reference |
| 123 // here by assigning null. If another call is completed, it added its own | 123 // here by assigning null. If another call is completed, it added its own |
| 124 // reference. | 124 // reference. |
| 125 top_sites_ = NULL; | 125 top_sites_ = NULL; |
| 126 } | 126 } |
| 127 | 127 |
| 128 } // namespace thumbnails | 128 } // namespace thumbnails |
| OLD | NEW |