diff options
author | mirandac@chromium.org <mirandac@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-18 23:02:54 +0000 |
---|---|---|
committer | mirandac@chromium.org <mirandac@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-18 23:02:54 +0000 |
commit | ea0c98cfa2849f95bf40238c9f476c9cebb22244 (patch) | |
tree | ec81fe0c664cb6c0adddbd5d392313e8fbb93ec5 /chrome/browser/dom_ui/web_resource_handler.h | |
parent | 1f70f0ca51d1c61d3a775507b2b69dcdf60e77df (diff) | |
download | chromium_src-ea0c98cfa2849f95bf40238c9f476c9cebb22244.zip chromium_src-ea0c98cfa2849f95bf40238c9f476c9cebb22244.tar.gz chromium_src-ea0c98cfa2849f95bf40238c9f476c9cebb22244.tar.bz2 |
First draft of web resource service; fetches data from a JSON feed
and stores it in user prefs, where it can be used by the new tab page.
BUG = http://crbug.com/13363
Review URL: http://codereview.chromium.org/125052
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@18766 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/dom_ui/web_resource_handler.h')
-rw-r--r-- | chrome/browser/dom_ui/web_resource_handler.h | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/chrome/browser/dom_ui/web_resource_handler.h b/chrome/browser/dom_ui/web_resource_handler.h new file mode 100644 index 0000000..01157f9 --- /dev/null +++ b/chrome/browser/dom_ui/web_resource_handler.h @@ -0,0 +1,56 @@ +// 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. + +// This class pulls data from a web resource (such as a JSON feed) which +// has been stored in the user's preferences file. Used mainly +// by the suggestions and tips area of the new tab page. + +// Current sketch of tip cache format, hardcoded for poptart data in +// basic text form: + +// "web_resource_cache": { +// "0": { +// "index": should become time field (or not) +// "snippet": the text of the item +// "source": text describing source (i.e., "New York Post") +// "thumbnail": URL of thumbnail on popgadget server +// "title": text giving title of item +// "url": link to item's page +// }, +// [up to number of items in kMaxWebResourceCacheSize] + +#ifndef CHROME_BROWSER_DOM_UI_WEB_RESOURCE_HANDLER_H_ +#define CHROME_BROWSER_DOM_UI_WEB_RESOURCE_HANDLER_H_ + +#include "chrome/browser/dom_ui/dom_ui.h" + +class DictionaryValue; +class DOMUI; +class PrefService; +class Value; + +class WebResourceHandler : public DOMMessageHandler { + public: + explicit WebResourceHandler(DOMUI* dom_ui); + + WebResourceHandler(); + + // Callback which pulls web resource data from the preferences. + void HandleGetCachedWebResource(const Value* content); + + // Register web resource cache with pref service. + static void RegisterUserPrefs(PrefService* prefs); + + private: + // So we can push data out to the page that has called this handler. + DOMUI* dom_ui_; + + // Filled with data from cache in preferences. + const DictionaryValue* web_resource_cache_; + + DISALLOW_COPY_AND_ASSIGN(WebResourceHandler); +}; + +#endif // CHROME_BROWSER_DOM_UI_WEB_RESOURCE_HANDLER_H_ + |