| 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 #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 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 public: | 28 public: |
| 29 explicit ThumbnailSource(Profile* profile); | 29 explicit ThumbnailSource(Profile* profile); |
| 30 | 30 |
| 31 // content::URLDataSource implementation. | 31 // content::URLDataSource implementation. |
| 32 virtual std::string GetSource() OVERRIDE; | 32 virtual std::string GetSource() OVERRIDE; |
| 33 virtual void StartDataRequest( | 33 virtual void StartDataRequest( |
| 34 const std::string& path, | 34 const std::string& path, |
| 35 bool is_incognito, | 35 bool is_incognito, |
| 36 const content::URLDataSource::GotDataCallback& callback) OVERRIDE; | 36 const content::URLDataSource::GotDataCallback& callback) OVERRIDE; |
| 37 virtual std::string GetMimeType(const std::string& path) const OVERRIDE; | 37 virtual std::string GetMimeType(const std::string& path) const OVERRIDE; |
| 38 virtual MessageLoop* MessageLoopForRequestPath( | 38 virtual base::MessageLoop* MessageLoopForRequestPath( |
| 39 const std::string& path) const OVERRIDE; | 39 const std::string& path) const OVERRIDE; |
| 40 virtual bool ShouldServiceRequest( | 40 virtual bool ShouldServiceRequest( |
| 41 const net::URLRequest* request) const OVERRIDE; | 41 const net::URLRequest* request) const OVERRIDE; |
| 42 | 42 |
| 43 private: | 43 private: |
| 44 virtual ~ThumbnailSource(); | 44 virtual ~ThumbnailSource(); |
| 45 | 45 |
| 46 // Raw PNG representation of the thumbnail to show when the thumbnail | 46 // Raw PNG representation of the thumbnail to show when the thumbnail |
| 47 // database doesn't have a thumbnail for a webpage. | 47 // database doesn't have a thumbnail for a webpage. |
| 48 scoped_refptr<base::RefCountedMemory> default_thumbnail_; | 48 scoped_refptr<base::RefCountedMemory> default_thumbnail_; |
| 49 | 49 |
| 50 // ThumbnailService. | 50 // ThumbnailService. |
| 51 scoped_refptr<thumbnails::ThumbnailService> thumbnail_service_; | 51 scoped_refptr<thumbnails::ThumbnailService> thumbnail_service_; |
| 52 | 52 |
| 53 // Transient mappings from an ID-based path to an URL-based path. | 53 // Transient mappings from an ID-based path to an URL-based path. |
| 54 // The key is an ID-string, the value is a URL string. | 54 // The key is an ID-string, the value is a URL string. |
| 55 // Mappings are added in ShouldServiceRequest() and erased once | 55 // Mappings are added in ShouldServiceRequest() and erased once |
| 56 // the request is serviced in StartDataRequest(). | 56 // the request is serviced in StartDataRequest(). |
| 57 // TODO(dhollowa): Consider passing the |request| object through | 57 // TODO(dhollowa): Consider passing the |request| object through |
| 58 // to the StartDataRequest() call. | 58 // to the StartDataRequest() call. |
| 59 mutable std::map<std::string, std::string> id_to_url_map_; | 59 mutable std::map<std::string, std::string> id_to_url_map_; |
| 60 | 60 |
| 61 // Only used when servicing requests on the UI thread. | 61 // Only used when servicing requests on the UI thread. |
| 62 Profile* const profile_; | 62 Profile* const profile_; |
| 63 | 63 |
| 64 DISALLOW_COPY_AND_ASSIGN(ThumbnailSource); | 64 DISALLOW_COPY_AND_ASSIGN(ThumbnailSource); |
| 65 }; | 65 }; |
| 66 | 66 |
| 67 #endif // CHROME_BROWSER_UI_WEBUI_NTP_THUMBNAIL_SOURCE_H_ | 67 #endif // CHROME_BROWSER_UI_WEBUI_NTP_THUMBNAIL_SOURCE_H_ |
| OLD | NEW |