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" |
11 #include "chrome/browser/history/top_sites_service_factory.h" | |
11 #include "chrome/browser/thumbnails/content_based_thumbnailing_algorithm.h" | 12 #include "chrome/browser/thumbnails/content_based_thumbnailing_algorithm.h" |
12 #include "chrome/browser/thumbnails/simple_thumbnail_crop.h" | 13 #include "chrome/browser/thumbnails/simple_thumbnail_crop.h" |
13 #include "chrome/browser/thumbnails/thumbnailing_context.h" | 14 #include "chrome/browser/thumbnails/thumbnailing_context.h" |
14 #include "chrome/common/chrome_switches.h" | 15 #include "chrome/common/chrome_switches.h" |
15 #include "components/search/search.h" | 16 #include "components/search/search.h" |
16 #include "content/public/browser/browser_thread.h" | 17 #include "content/public/browser/browser_thread.h" |
17 #include "url/gurl.h" | 18 #include "url/gurl.h" |
18 | 19 |
19 using content::BrowserThread; | 20 using content::BrowserThread; |
20 | 21 |
(...skipping 17 matching lines...) Expand all Loading... | |
38 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 39 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
39 | 40 |
40 if (top_sites.get() != NULL) | 41 if (top_sites.get() != NULL) |
41 top_sites->AddForcedURL(url, base::Time::Now()); | 42 top_sites->AddForcedURL(url, base::Time::Now()); |
42 } | 43 } |
43 | 44 |
44 } // namespace | 45 } // namespace |
45 | 46 |
46 namespace thumbnails { | 47 namespace thumbnails { |
47 | 48 |
48 ThumbnailServiceImpl::ThumbnailServiceImpl(Profile* profile) | 49 ThumbnailServiceImpl::ThumbnailServiceImpl(Profile* profile) |
sdefresne
2014/12/29 09:48:14
You need to add the dependency on TopSitesServiceF
Jitu( very slow this week)
2014/12/30 10:09:03
Done.
| |
49 : top_sites_(profile->GetTopSites()), | 50 : top_sites_(TopSitesServiceFactory::GetForProfile(profile).get()), |
50 use_thumbnail_retargeting_(IsThumbnailRetargetingEnabled()) { | 51 use_thumbnail_retargeting_(IsThumbnailRetargetingEnabled()) { |
51 } | 52 } |
52 | 53 |
53 ThumbnailServiceImpl::~ThumbnailServiceImpl() { | 54 ThumbnailServiceImpl::~ThumbnailServiceImpl() { |
54 } | 55 } |
55 | 56 |
56 bool ThumbnailServiceImpl::SetPageThumbnail(const ThumbnailingContext& context, | 57 bool ThumbnailServiceImpl::SetPageThumbnail(const ThumbnailingContext& context, |
57 const gfx::Image& thumbnail) { | 58 const gfx::Image& thumbnail) { |
58 scoped_refptr<history::TopSites> local_ptr(top_sites_); | 59 scoped_refptr<history::TopSites> local_ptr(top_sites_); |
59 if (local_ptr.get() == NULL) | 60 if (local_ptr.get() == NULL) |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
119 } | 120 } |
120 | 121 |
121 void ThumbnailServiceImpl::ShutdownOnUIThread() { | 122 void ThumbnailServiceImpl::ShutdownOnUIThread() { |
122 // Since each call uses its own scoped_refptr, we can just clear the reference | 123 // 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 | 124 // here by assigning null. If another call is completed, it added its own |
124 // reference. | 125 // reference. |
125 top_sites_ = NULL; | 126 top_sites_ = NULL; |
126 } | 127 } |
127 | 128 |
128 } // namespace thumbnails | 129 } // namespace thumbnails |
OLD | NEW |