OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #ifndef CHROME_BROWSER_THUMBNAILS_THUMBNAIL_LIST_SOURCE_H_ | 5 #ifndef CHROME_BROWSER_THUMBNAILS_THUMBNAIL_LIST_SOURCE_H_ |
6 #define CHROME_BROWSER_THUMBNAILS_THUMBNAIL_LIST_SOURCE_H_ | 6 #define CHROME_BROWSER_THUMBNAILS_THUMBNAIL_LIST_SOURCE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
13 #include "components/history/core/browser/history_types.h" | 13 #include "components/history/core/browser/history_types.h" |
14 #include "content/public/browser/url_data_source.h" | 14 #include "content/public/browser/url_data_source.h" |
15 | 15 |
16 class Profile; | 16 class Profile; |
17 | 17 |
18 namespace base { | 18 namespace base { |
19 class RefCountedMemory; | 19 class RefCountedMemory; |
20 } | 20 } // namespace base |
Lei Zhang
2015/03/19 22:22:07
There's no need to comment when the namespace is t
huangs
2015/03/20 00:10:25
Done.
| |
21 | |
22 namespace history { | |
23 class TopSites; | |
24 } // namespace history | |
21 | 25 |
22 namespace thumbnails { | 26 namespace thumbnails { |
23 class ThumbnailService; | 27 class ThumbnailService; |
24 } | 28 } // namespace thumbnails |
25 | 29 |
26 // ThumbnailListSource renders a webpage to list all thumbnails stored in | 30 // ThumbnailListSource renders a webpage to list all thumbnails stored in |
27 // TopSites, along with all associated URLs. The thumbnail images are embedded | 31 // TopSites, along with all associated URLs. The thumbnail images are embedded |
28 // into the HTML via Base64, so we can easily produce a dump of TopSites and | 32 // into the HTML via Base64, so we can easily produce a dump of TopSites and |
29 // the thumbnails it stores. | 33 // the thumbnails it stores. |
30 class ThumbnailListSource : public content::URLDataSource { | 34 class ThumbnailListSource : public content::URLDataSource { |
31 public: | 35 public: |
32 explicit ThumbnailListSource(Profile* profile); | 36 explicit ThumbnailListSource(Profile* profile); |
33 | 37 |
34 // content::URLDataSource implementation. | 38 // content::URLDataSource implementation. |
(...skipping 12 matching lines...) Expand all Loading... | |
47 private: | 51 private: |
48 ~ThumbnailListSource() override; | 52 ~ThumbnailListSource() override; |
49 | 53 |
50 void OnMostVisitedURLsAvailable( | 54 void OnMostVisitedURLsAvailable( |
51 const content::URLDataSource::GotDataCallback& callback, | 55 const content::URLDataSource::GotDataCallback& callback, |
52 const history::MostVisitedURLList& mvurl_list); | 56 const history::MostVisitedURLList& mvurl_list); |
53 | 57 |
54 // ThumbnailService. | 58 // ThumbnailService. |
55 scoped_refptr<thumbnails::ThumbnailService> thumbnail_service_; | 59 scoped_refptr<thumbnails::ThumbnailService> thumbnail_service_; |
56 | 60 |
57 // Only used when servicing requests on the UI thread. | 61 scoped_refptr<history::TopSites> top_sites_; |
58 Profile* const profile_; | |
59 | 62 |
60 // For callbacks may be run after destruction. | 63 // For callbacks may be run after destruction. |
61 base::WeakPtrFactory<ThumbnailListSource> weak_ptr_factory_; | 64 base::WeakPtrFactory<ThumbnailListSource> weak_ptr_factory_; |
62 | 65 |
63 DISALLOW_COPY_AND_ASSIGN(ThumbnailListSource); | 66 DISALLOW_COPY_AND_ASSIGN(ThumbnailListSource); |
64 }; | 67 }; |
65 | 68 |
66 | 69 |
67 #endif // CHROME_BROWSER_THUMBNAILS_THUMBNAIL_LIST_SOURCE_H_ | 70 #endif // CHROME_BROWSER_THUMBNAILS_THUMBNAIL_LIST_SOURCE_H_ |
OLD | NEW |