| OLD | NEW |
| 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: |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 | 25 |
| 26 #include "chrome/browser/dom_ui/dom_ui.h" | 26 #include "chrome/browser/dom_ui/dom_ui.h" |
| 27 | 27 |
| 28 class DictionaryValue; | 28 class DictionaryValue; |
| 29 class DOMUI; | 29 class DOMUI; |
| 30 class PrefService; | 30 class PrefService; |
| 31 class Value; | 31 class Value; |
| 32 | 32 |
| 33 class TipsHandler : public DOMMessageHandler { | 33 class TipsHandler : public DOMMessageHandler { |
| 34 public: | 34 public: |
| 35 explicit TipsHandler(DOMUI* dom_ui); | 35 TipsHandler() : tips_cache_(NULL) { } |
| 36 virtual ~TipsHandler() { } |
| 36 | 37 |
| 37 TipsHandler(); | 38 // DOMMessageHandler implementation and overrides. |
| 39 virtual DOMMessageHandler* Attach(DOMUI* dom_ui); |
| 40 virtual void RegisterMessages(); |
| 38 | 41 |
| 39 // Callback which pulls tips data from the preferences. | 42 // Callback which pulls tips data from the preferences. |
| 40 void HandleGetTips(const Value* content); | 43 void HandleGetTips(const Value* content); |
| 41 | 44 |
| 42 // Register tips cache with pref service. | 45 // Register tips cache with pref service. |
| 43 static void RegisterUserPrefs(PrefService* prefs); | 46 static void RegisterUserPrefs(PrefService* prefs); |
| 44 | 47 |
| 45 private: | 48 private: |
| 46 // So we can push data out to the page that has called this handler. | |
| 47 DOMUI* dom_ui_; | |
| 48 | |
| 49 // Filled with data from cache in preferences. | 49 // Filled with data from cache in preferences. |
| 50 const DictionaryValue* tips_cache_; | 50 const DictionaryValue* tips_cache_; |
| 51 | 51 |
| 52 DISALLOW_COPY_AND_ASSIGN(TipsHandler); | 52 DISALLOW_COPY_AND_ASSIGN(TipsHandler); |
| 53 }; | 53 }; |
| 54 | 54 |
| 55 #endif // CHROME_BROWSER_DOM_UI_TIPS_HANDLER_H_ | 55 #endif // CHROME_BROWSER_DOM_UI_TIPS_HANDLER_H_ |
| 56 | 56 |
| OLD | NEW |