OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_UI_WEBUI_NTP_THUMBNAIL_SOURCE_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_NTP_THUMBNAIL_SOURCE_H_ |
6 #define CHROME_BROWSER_UI_WEBUI_NTP_THUMBNAIL_SOURCE_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_NTP_THUMBNAIL_SOURCE_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
13 #include "base/memory/ref_counted_memory.h" | |
14 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" | 13 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" |
15 | 14 |
16 class Profile; | 15 class Profile; |
17 | 16 |
| 17 namespace base { |
| 18 class RefCountedMemory; |
| 19 } |
| 20 |
18 namespace history { | 21 namespace history { |
19 class TopSites; | 22 class TopSites; |
20 } | 23 } |
21 | 24 |
22 // ThumbnailSource is the gateway between network-level chrome: requests for | 25 // ThumbnailSource is the gateway between network-level chrome: requests for |
23 // thumbnails and the history/top-sites backend that serves these. | 26 // thumbnails and the history/top-sites backend that serves these. |
24 class ThumbnailSource : public ChromeURLDataManager::DataSource { | 27 class ThumbnailSource : public ChromeURLDataManager::DataSource { |
25 public: | 28 public: |
26 explicit ThumbnailSource(Profile* profile); | 29 explicit ThumbnailSource(Profile* profile); |
27 | 30 |
28 // Called when the network layer has requested a resource underneath | 31 // Called when the network layer has requested a resource underneath |
29 // the path we registered. | 32 // the path we registered. |
30 virtual void StartDataRequest(const std::string& path, | 33 virtual void StartDataRequest(const std::string& path, |
31 bool is_incognito, | 34 bool is_incognito, |
32 int request_id) OVERRIDE; | 35 int request_id) OVERRIDE; |
33 | 36 |
34 virtual std::string GetMimeType(const std::string& path) const OVERRIDE; | 37 virtual std::string GetMimeType(const std::string& path) const OVERRIDE; |
35 | 38 |
36 virtual MessageLoop* MessageLoopForRequestPath( | 39 virtual MessageLoop* MessageLoopForRequestPath( |
37 const std::string& path) const OVERRIDE; | 40 const std::string& path) const OVERRIDE; |
38 | 41 |
39 private: | 42 private: |
40 virtual ~ThumbnailSource(); | 43 virtual ~ThumbnailSource(); |
41 | 44 |
42 // Send the default thumbnail when we are missing a real one. | 45 // Send the default thumbnail when we are missing a real one. |
43 void SendDefaultThumbnail(int request_id); | 46 void SendDefaultThumbnail(int request_id); |
44 | 47 |
45 // Raw PNG representation of the thumbnail to show when the thumbnail | 48 // Raw PNG representation of the thumbnail to show when the thumbnail |
46 // database doesn't have a thumbnail for a webpage. | 49 // database doesn't have a thumbnail for a webpage. |
47 scoped_refptr<RefCountedMemory> default_thumbnail_; | 50 scoped_refptr<base::RefCountedMemory> default_thumbnail_; |
48 | 51 |
49 // TopSites. | 52 // TopSites. |
50 scoped_refptr<history::TopSites> top_sites_; | 53 scoped_refptr<history::TopSites> top_sites_; |
51 | 54 |
52 DISALLOW_COPY_AND_ASSIGN(ThumbnailSource); | 55 DISALLOW_COPY_AND_ASSIGN(ThumbnailSource); |
53 }; | 56 }; |
54 | 57 |
55 #endif // CHROME_BROWSER_UI_WEBUI_NTP_THUMBNAIL_SOURCE_H_ | 58 #endif // CHROME_BROWSER_UI_WEBUI_NTP_THUMBNAIL_SOURCE_H_ |
OLD | NEW |