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

Side by Side Diff: chrome/browser/dom_ui/new_tab_ui.h

Issue 12418: Implement History as HTML and add/change a bunch of stuff to make it easier t... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 12 years 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
« no previous file with comments | « chrome/browser/dom_ui/history_ui.cc ('k') | chrome/browser/dom_ui/new_tab_ui.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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_DOM_UI_NEW_TAB_UI_H__ 5 #ifndef CHROME_BROWSER_DOM_UI_NEW_TAB_UI_H__
6 #define CHROME_BROWSER_DOM_UI_NEW_TAB_UI_H__ 6 #define CHROME_BROWSER_DOM_UI_NEW_TAB_UI_H__
7 7
8 #include "chrome/browser/bookmarks/bookmark_model.h" 8 #include "chrome/browser/bookmarks/bookmark_model.h"
9 #include "chrome/browser/dom_ui/dom_ui_host.h" 9 #include "chrome/browser/dom_ui/dom_ui_host.h"
10 #include "chrome/browser/dom_ui/chrome_url_data_manager.h" 10 #include "chrome/browser/dom_ui/chrome_url_data_manager.h"
11 #include "chrome/browser/history/history.h" 11 #include "chrome/browser/history/history.h"
12 #include "chrome/browser/tab_restore_service.h" 12 #include "chrome/browser/tab_restore_service.h"
13 #include "chrome/browser/template_url_model.h" 13 #include "chrome/browser/template_url_model.h"
14 14
15 class GURL; 15 class GURL;
16 class Profile; 16 class Profile;
17 class Value; 17 class Value;
18 enum TabContentsType; 18 enum TabContentsType;
19 19
20 // Return the URL for the new tab page. 20 // Return the URL for the new tab page.
21 GURL NewTabUIURL(); 21 GURL NewTabUIURL();
22 22
23 // If a |url| is a chrome: URL, this method sets up |url|, and |result_type| 23 // If a |url| is a chrome-internal: URL, this method sets up |url|, and
24 // to the appropriate values for displaying the new tab page and returns true. 24 // |result_type| to the appropriate values for displaying the new tab page
25 // Exposed for use by BrowserURLHandler. 25 // and returns true. Exposed for use by BrowserURLHandler.
26 bool NewTabUIHandleURL(GURL* url, TabContentsType* result_type); 26 bool NewTabUIHandleURL(GURL* url, TabContentsType* result_type);
27 27
28 // The following classes aren't used outside of new_tab_ui.cc but are 28 // The following classes aren't used outside of new_tab_ui.cc but are
29 // put here for clarity. 29 // put here for clarity.
30 30
31 class NewTabHTMLSource : public ChromeURLDataManager::DataSource { 31 class NewTabHTMLSource : public ChromeURLDataManager::DataSource {
32 public: 32 public:
33 NewTabHTMLSource(); 33 NewTabHTMLSource();
34 34
35 // Called when the network layer has requested a resource underneath 35 // Called when the network layer has requested a resource underneath
(...skipping 26 matching lines...) Expand all
62 virtual void StartDataRequest(const std::string& path, int request_id); 62 virtual void StartDataRequest(const std::string& path, int request_id);
63 63
64 virtual std::string GetMimeType(const std::string&) const { 64 virtual std::string GetMimeType(const std::string&) const {
65 return "text/html"; 65 return "text/html";
66 } 66 }
67 67
68 private: 68 private:
69 DISALLOW_EVIL_CONSTRUCTORS(IncognitoTabHTMLSource); 69 DISALLOW_EVIL_CONSTRUCTORS(IncognitoTabHTMLSource);
70 }; 70 };
71 71
72 // ThumbnailSource is the gateway between network-level chrome-resource:
73 // requests for thumbnails and the history backend that serves these.
74 class ThumbnailSource : public ChromeURLDataManager::DataSource {
75 public:
76 explicit ThumbnailSource(Profile* profile);
77
78 // Called when the network layer has requested a resource underneath
79 // the path we registered.
80 virtual void StartDataRequest(const std::string& path, int request_id);
81
82 virtual std::string GetMimeType(const std::string&) const {
83 // Rely on image decoder inferring the correct type.
84 return std::string();
85 }
86
87 // Called when thumbnail data is available from the history backend.
88 void OnThumbnailDataAvailable(
89 HistoryService::Handle request_handle,
90 scoped_refptr<RefCountedBytes> data);
91
92 private:
93 Profile* profile_;
94 CancelableRequestConsumerT<int, 0> cancelable_consumer_;
95
96 // Raw PNG representation of the thumbnail to show when the thumbnail
97 // database doesn't have a thumbnail for a webpage.
98 scoped_refptr<RefCountedBytes> default_thumbnail_;
99
100 DISALLOW_EVIL_CONSTRUCTORS(ThumbnailSource);
101 };
102
103 // ThumbnailSource is the gateway between network-level chrome-resource:
104 // requests for favicons and the history backend that serves these.
105 class FavIconSource : public ChromeURLDataManager::DataSource {
106 public:
107 explicit FavIconSource(Profile* profile);
108
109 // Called when the network layer has requested a resource underneath
110 // the path we registered.
111 virtual void StartDataRequest(const std::string& path, int request_id);
112
113 virtual std::string GetMimeType(const std::string&) const {
114 // Rely on image decoder inferring the correct type.
115 return std::string();
116 }
117
118 // Called when favicon data is available from the history backend.
119 void OnFavIconDataAvailable(
120 HistoryService::Handle request_handle,
121 bool know_favicon,
122 scoped_refptr<RefCountedBytes> data,
123 bool expired,
124 GURL url);
125
126 private:
127 Profile* profile_;
128 CancelableRequestConsumerT<int, 0> cancelable_consumer_;
129
130 // Raw PNG representation of the favicon to show when the favicon
131 // database doesn't have a favicon for a webpage.
132 scoped_refptr<RefCountedBytes> default_favicon_;
133
134 DISALLOW_EVIL_CONSTRUCTORS(FavIconSource);
135 };
136
137 // The handler for Javascript messages related to the "most visited" view. 72 // The handler for Javascript messages related to the "most visited" view.
138 class MostVisitedHandler : public DOMMessageHandler, 73 class MostVisitedHandler : public DOMMessageHandler,
139 public NotificationObserver { 74 public NotificationObserver {
140 public: 75 public:
141 explicit MostVisitedHandler(DOMUIHost* dom_ui_host); 76 explicit MostVisitedHandler(DOMUIHost* dom_ui_host);
142 virtual ~MostVisitedHandler(); 77 virtual ~MostVisitedHandler();
143 78
144 // Callback for the "getMostVisited" message. 79 // Callback for the "getMostVisited" message.
145 void HandleGetMostVisited(const Value* value); 80 void HandleGetMostVisited(const Value* value);
146 81
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 298
364 // A pointer to the handler for most visited. 299 // A pointer to the handler for most visited.
365 // Owned by the DOMUIHost. 300 // Owned by the DOMUIHost.
366 MostVisitedHandler* most_visited_handler_; 301 MostVisitedHandler* most_visited_handler_;
367 302
368 DISALLOW_EVIL_CONSTRUCTORS(NewTabUIContents); 303 DISALLOW_EVIL_CONSTRUCTORS(NewTabUIContents);
369 }; 304 };
370 305
371 #endif // CHROME_BROWSER_DOM_UI_NEW_TAB_UI_H__ 306 #endif // CHROME_BROWSER_DOM_UI_NEW_TAB_UI_H__
372 307
OLDNEW
« no previous file with comments | « chrome/browser/dom_ui/history_ui.cc ('k') | chrome/browser/dom_ui/new_tab_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698