Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(542)

Side by Side Diff: chrome/browser/ui/webui/ntp/thumbnail_source.h

Issue 11881055: Simplify WebUI data sources. Currently WebUI data sources implement a URLDataSourceDelegate interfa… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: fix issue in about_ui exposed by cros tests Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 <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 "content/public/browser/url_data_source_delegate.h" 12 #include "content/public/browser/url_data_source.h"
13 13
14 class Profile; 14 class Profile;
15 15
16 namespace base { 16 namespace base {
17 class RefCountedMemory; 17 class RefCountedMemory;
18 } 18 }
19 19
20 namespace thumbnails { 20 namespace thumbnails {
21 class ThumbnailService; 21 class ThumbnailService;
22 } 22 }
23 23
24 // ThumbnailSource is the gateway between network-level chrome: requests for 24 // ThumbnailSource is the gateway between network-level chrome: requests for
25 // thumbnails and the history/top-sites backend that serves these. 25 // thumbnails and the history/top-sites backend that serves these.
26 class ThumbnailSource : public content::URLDataSourceDelegate { 26 class ThumbnailSource : public content::URLDataSource {
27 public: 27 public:
28 explicit ThumbnailSource(Profile* profile); 28 explicit ThumbnailSource(Profile* profile);
29 29
30 // content::URLDataSourceDelegate implementation. 30 // content::URLDataSource implementation.
31 virtual std::string GetSource() OVERRIDE; 31 virtual std::string GetSource() OVERRIDE;
32 virtual void StartDataRequest(const std::string& path, 32 virtual void StartDataRequest(
33 bool is_incognito, 33 const std::string& path,
34 int request_id) OVERRIDE; 34 bool is_incognito,
35 const content::URLDataSource::GotDataCallback& callback) OVERRIDE;
35 virtual std::string GetMimeType(const std::string& path) const OVERRIDE; 36 virtual std::string GetMimeType(const std::string& path) const OVERRIDE;
36 virtual MessageLoop* MessageLoopForRequestPath( 37 virtual MessageLoop* MessageLoopForRequestPath(
37 const std::string& path) const OVERRIDE; 38 const std::string& path) const OVERRIDE;
38 39
39 private: 40 private:
40 virtual ~ThumbnailSource(); 41 virtual ~ThumbnailSource();
41 42
42 // Send the default thumbnail when we are missing a real one.
43 void SendDefaultThumbnail(int request_id);
44
45 // Raw PNG representation of the thumbnail to show when the thumbnail 43 // Raw PNG representation of the thumbnail to show when the thumbnail
46 // database doesn't have a thumbnail for a webpage. 44 // database doesn't have a thumbnail for a webpage.
47 scoped_refptr<base::RefCountedMemory> default_thumbnail_; 45 scoped_refptr<base::RefCountedMemory> default_thumbnail_;
48 46
49 // ThumbnailService. 47 // ThumbnailService.
50 scoped_refptr<thumbnails::ThumbnailService> thumbnail_service_; 48 scoped_refptr<thumbnails::ThumbnailService> thumbnail_service_;
51 49
52 DISALLOW_COPY_AND_ASSIGN(ThumbnailSource); 50 DISALLOW_COPY_AND_ASSIGN(ThumbnailSource);
53 }; 51 };
54 52
55 #endif // CHROME_BROWSER_UI_WEBUI_NTP_THUMBNAIL_SOURCE_H_ 53 #endif // CHROME_BROWSER_UI_WEBUI_NTP_THUMBNAIL_SOURCE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698