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

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

Issue 149083: Validates links which are to be passed on to the NTP by ensuring that they st... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 6 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
« no previous file with comments | « no previous file | chrome/browser/dom_ui/tips_handler.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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 // This class pulls data from a web resource (such as a JSON feed) which 5 // This class pulls data from a web resource (such as a JSON feed) which
6 // has been stored in the user's preferences file. Used mainly 6 // has been stored in the user's preferences file. Used mainly
7 // by the suggestions and tips area of the new tab page. 7 // by the suggestions and tips area of the new tab page.
8 8
9 // Current sketch of tip cache format, hardcoded for popgadget data in 9 // Current sketch of tip cache format, hardcoded for popgadget data in
10 // basic text form: 10 // basic text form:
11 11
12 // "tip_cache": { 12 // "tip_cache": {
13 // "0": { 13 // "0": {
14 // "index": should become time field (or not)
15 // "snippet": the text of the item
16 // "source": text describing source (i.e., "New York Post")
17 // "thumbnail": URL of thumbnail on popgadget server
18 // "title": text giving title of item 14 // "title": text giving title of item
19 // "url": link to item's page 15 // "url": link to item's page
20 // }, 16 // },
21 // [up to number of items in kMaxWebResourceCacheSize] 17 // [up to number of items in kMaxWebResourceCacheSize]
22 18
23 #ifndef CHROME_BROWSER_DOM_UI_TIPS_HANDLER_H_ 19 #ifndef CHROME_BROWSER_DOM_UI_TIPS_HANDLER_H_
24 #define CHROME_BROWSER_DOM_UI_TIPS_HANDLER_H_ 20 #define CHROME_BROWSER_DOM_UI_TIPS_HANDLER_H_
25 21
26 #include "chrome/browser/dom_ui/dom_ui.h" 22 #include "chrome/browser/dom_ui/dom_ui.h"
27 23
28 class DictionaryValue; 24 class DictionaryValue;
29 class DOMUI; 25 class DOMUI;
30 class PrefService; 26 class PrefService;
31 class Value; 27 class Value;
32 28
33 class TipsHandler : public DOMMessageHandler { 29 class TipsHandler : public DOMMessageHandler {
34 public: 30 public:
35 explicit TipsHandler(DOMUI* dom_ui); 31 explicit TipsHandler(DOMUI* dom_ui);
36 32
37 TipsHandler(); 33 TipsHandler();
38 34
39 // Callback which pulls tips data from the preferences. 35 // Callback which pulls tips data from the preferences.
40 void HandleGetTips(const Value* content); 36 void HandleGetTips(const Value* content);
41 37
42 // Register tips cache with pref service. 38 // Register tips cache with pref service.
43 static void RegisterUserPrefs(PrefService* prefs); 39 static void RegisterUserPrefs(PrefService* prefs);
44 40
45 private: 41 private:
42 // Make sure the string we are pushing to the NTP is a valid URL.
43 bool IsValidURL(const std::wstring& url_string);
44
46 // So we can push data out to the page that has called this handler. 45 // So we can push data out to the page that has called this handler.
47 DOMUI* dom_ui_; 46 DOMUI* dom_ui_;
48 47
49 // Filled with data from cache in preferences. 48 // Filled with data from cache in preferences.
50 const DictionaryValue* tips_cache_; 49 const DictionaryValue* tips_cache_;
51 50
52 DISALLOW_COPY_AND_ASSIGN(TipsHandler); 51 DISALLOW_COPY_AND_ASSIGN(TipsHandler);
53 }; 52 };
54 53
55 #endif // CHROME_BROWSER_DOM_UI_TIPS_HANDLER_H_ 54 #endif // CHROME_BROWSER_DOM_UI_TIPS_HANDLER_H_
56 55
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/dom_ui/tips_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698