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

Unified Diff: chrome/browser/dom_ui/dom_ui_contents.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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/dom_ui/dom_ui.cc ('k') | chrome/browser/dom_ui/dom_ui_contents.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/dom_ui/dom_ui_contents.h
===================================================================
--- chrome/browser/dom_ui/dom_ui_contents.h (revision 0)
+++ chrome/browser/dom_ui/dom_ui_contents.h (revision 0)
@@ -0,0 +1,123 @@
+// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Contains code for managing local HTML UI at chrome:// URLs.
+
+#ifndef CHROME_BROWSER_DOM_UI_CONTENTS_H__
+#define CHROME_BROWSER_DOM_UI_CONTENTS_H__
+
+#include "chrome/browser/dom_ui/chrome_url_data_manager.h"
+#include "chrome/browser/web_contents.h"
+#include "webkit/glue/webpreferences.h"
+
+class DOMUI;
+class render_view_host;
+
+// FavIconSource is the gateway between network-level chrome:
+// requests for favicons and the history backend that serves these.
+class FavIconSource : public ChromeURLDataManager::DataSource {
+ public:
+ explicit FavIconSource(Profile* profile);
+
+ // Called when the network layer has requested a resource underneath
+ // the path we registered.
+ virtual void StartDataRequest(const std::string& path, int request_id);
+
+ virtual std::string GetMimeType(const std::string&) const {
+ // Rely on image decoder inferring the correct type.
+ return std::string();
+ }
+
+ // Called when favicon data is available from the history backend.
+ void OnFavIconDataAvailable(
+ HistoryService::Handle request_handle,
+ bool know_favicon,
+ scoped_refptr<RefCountedBytes> data,
+ bool expired,
+ GURL url);
+
+ private:
+ Profile* const profile_;
+ CancelableRequestConsumerT<int, 0> cancelable_consumer_;
+
+ // Raw PNG representation of the favicon to show when the favicon
+ // database doesn't have a favicon for a webpage.
+ scoped_refptr<RefCountedBytes> default_favicon_;
+
+ DISALLOW_COPY_AND_ASSIGN(FavIconSource);
+};
+
+// ThumbnailSource is the gateway between network-level chrome:
+// requests for thumbnails and the history backend that serves these.
+class ThumbnailSource : public ChromeURLDataManager::DataSource {
+ public:
+ explicit ThumbnailSource(Profile* profile);
+
+ // Called when the network layer has requested a resource underneath
+ // the path we registered.
+ virtual void StartDataRequest(const std::string& path, int request_id);
+
+ virtual std::string GetMimeType(const std::string&) const {
+ // Rely on image decoder inferring the correct type.
+ return std::string();
+ }
+
+ // Called when thumbnail data is available from the history backend.
+ void OnThumbnailDataAvailable(
+ HistoryService::Handle request_handle,
+ scoped_refptr<RefCountedBytes> data);
+
+ private:
+ Profile* const profile_;
+ CancelableRequestConsumerT<int, 0> cancelable_consumer_;
+
+ // Raw PNG representation of the thumbnail to show when the thumbnail
+ // database doesn't have a thumbnail for a webpage.
+ scoped_refptr<RefCountedBytes> default_thumbnail_;
+
+ DISALLOW_COPY_AND_ASSIGN(ThumbnailSource);
+};
+
+// Exposed for use by BrowserURLHandler.
+bool DOMUIContentsCanHandleURL(GURL* url, TabContentsType* result_type);
+
+class DOMUIContents : public WebContents {
+ public:
+ DOMUIContents(Profile* profile,
+ SiteInstance* instance,
+ RenderViewHostFactory* render_view_factory);
+ ~DOMUIContents();
+
+ //
+ // WebContents overrides
+ //
+ virtual void ProcessDOMUIMessage(const std::string& message,
+ const std::string& content);
+ virtual bool CreateRenderViewForRenderManager(
+ RenderViewHost* render_view_host);
+ // Override this method so we can ensure that javascript and image loading
+ // are always on even for DOMUIHost tabs.
+ virtual WebPreferences GetWebkitPrefs();
+
+ //
+ // TabContents overrides
+ //
+ virtual void UpdateHistoryForNavigation(const GURL& url,
+ const ViewHostMsg_FrameNavigate_Params& params) { }
+ virtual bool NavigateToPendingEntry(bool reload);
+
+ // Return the scheme used. We currently use chrome:
+ static const std::string GetScheme();
+
+ private:
+ // Return a DOM UI for the provided URL.
+ DOMUI* GetDOMUIForURL(const GURL& url);
+
+ // The DOMUI we own and show.
+ DOMUI* current_ui_;
+
+ DISALLOW_COPY_AND_ASSIGN(DOMUIContents);
+};
+
+#endif // CHROME_BROWSER_DOM_UI_CONTENTS_H__
Property changes on: chrome\browser\dom_ui\dom_ui_contents.h
___________________________________________________________________
Added: svn:eol-style
+ LF
« no previous file with comments | « chrome/browser/dom_ui/dom_ui.cc ('k') | chrome/browser/dom_ui/dom_ui_contents.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698