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

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

Issue 23477033: Implementing URL prefix match for history thumbnail cache. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Replacing ASSERT_TRUE() << ... to NOTREACHED() << ... Created 7 years, 3 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.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::URLDataSource { 26 class ThumbnailSource : public content::URLDataSource {
27 public: 27 public:
28 explicit ThumbnailSource(Profile* profile); 28 ThumbnailSource(Profile* profile, bool prefix_match);
29 29
30 // content::URLDataSource implementation. 30 // content::URLDataSource implementation.
31 virtual std::string GetSource() const OVERRIDE; 31 virtual std::string GetSource() const OVERRIDE;
32 virtual void StartDataRequest( 32 virtual void StartDataRequest(
33 const std::string& path, 33 const std::string& path,
34 int render_process_id, 34 int render_process_id,
35 int render_view_id, 35 int render_view_id,
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 base::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 // Only used when servicing requests on the UI thread. 53 // Only used when servicing requests on the UI thread.
54 Profile* const profile_; 54 Profile* const profile_;
55 55
56 // If an exact thumbnail URL match fails, specifies whether or not to try
57 // harder by matching the query thumbnail URL as URL prefix. This affects
58 // GetSource().
59 const bool prefix_match_;
60
56 DISALLOW_COPY_AND_ASSIGN(ThumbnailSource); 61 DISALLOW_COPY_AND_ASSIGN(ThumbnailSource);
57 }; 62 };
58 63
59 #endif // CHROME_BROWSER_UI_WEBUI_NTP_THUMBNAIL_SOURCE_H_ 64 #endif // CHROME_BROWSER_UI_WEBUI_NTP_THUMBNAIL_SOURCE_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/ntp/suggestions_page_handler.cc ('k') | chrome/browser/ui/webui/ntp/thumbnail_source.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698