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

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

Issue 449073: Put "make this my home page" link into the tip section.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 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/ntp_resource_cache.cc ('k') | 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 #ifndef CHROME_BROWSER_DOM_UI_TIPS_HANDLER_H_ 9 #ifndef CHROME_BROWSER_DOM_UI_TIPS_HANDLER_H_
10 #define CHROME_BROWSER_DOM_UI_TIPS_HANDLER_H_ 10 #define CHROME_BROWSER_DOM_UI_TIPS_HANDLER_H_
11 11
12 #include <string>
13
12 #include "chrome/browser/dom_ui/dom_ui.h" 14 #include "chrome/browser/dom_ui/dom_ui.h"
13 15
14 class DictionaryValue; 16 class DictionaryValue;
15 class DOMUI; 17 class DOMUI;
16 class PrefService; 18 class PrefService;
17 class Value; 19 class Value;
18 20
19 class TipsHandler : public DOMMessageHandler { 21 class TipsHandler : public DOMMessageHandler {
20 public: 22 public:
21 TipsHandler() : tips_cache_(NULL) {} 23 TipsHandler() : tips_cache_(NULL) {}
22 virtual ~TipsHandler() {} 24 virtual ~TipsHandler() {}
23 25
24 // DOMMessageHandler implementation and overrides. 26 // DOMMessageHandler implementation and overrides.
25 virtual DOMMessageHandler* Attach(DOMUI* dom_ui); 27 virtual DOMMessageHandler* Attach(DOMUI* dom_ui);
26 virtual void RegisterMessages(); 28 virtual void RegisterMessages();
27 29
28 // Callback which pulls tips data from the preferences. 30 // Callback which pulls tips data from the preferences.
29 void HandleGetTips(const Value* content); 31 void HandleGetTips(const Value* content);
30 32
31 // Register tips cache with pref service. 33 // Register tips cache with pref service.
32 static void RegisterUserPrefs(PrefService* prefs); 34 static void RegisterUserPrefs(PrefService* prefs);
33 35
34 private: 36 private:
35 // Make sure the string we are pushing to the NTP is a valid URL. 37 // Make sure the string we are pushing to the NTP is a valid URL.
36 bool IsValidURL(const std::wstring& url_string); 38 bool IsValidURL(const std::wstring& url_string);
37 39
40 // Send a tip to the NTP. tip_type is "tip_html_text" if the tip is from
41 // the tip server, and "set_homepage_tip" if it's the tip to set the NTP
42 // as home page.
43 void SendTip(std::string tip, std::wstring tip_type, int tip_index);
44
38 // 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.
39 DOMUI* dom_ui_; 46 DOMUI* dom_ui_;
40 47
41 // Filled with data from cache in preferences. 48 // Filled with data from cache in preferences.
42 DictionaryValue* tips_cache_; 49 DictionaryValue* tips_cache_;
43 50
44 DISALLOW_COPY_AND_ASSIGN(TipsHandler); 51 DISALLOW_COPY_AND_ASSIGN(TipsHandler);
45 }; 52 };
46 53
47 #endif // CHROME_BROWSER_DOM_UI_TIPS_HANDLER_H_ 54 #endif // CHROME_BROWSER_DOM_UI_TIPS_HANDLER_H_
48 55
OLDNEW
« no previous file with comments | « chrome/browser/dom_ui/ntp_resource_cache.cc ('k') | chrome/browser/dom_ui/tips_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698