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

Unified Diff: chrome/browser/dom_ui/tips_handler.cc

Issue 6542003: Refactor WebResourceService class, making it more generic. Move all the prom... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: For the records Created 9 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/dom_ui/ntp_resource_cache.cc ('k') | chrome/browser/profiles/profile.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/dom_ui/tips_handler.cc
===================================================================
--- chrome/browser/dom_ui/tips_handler.cc (revision 74703)
+++ chrome/browser/dom_ui/tips_handler.cc (working copy)
@@ -10,8 +10,9 @@
#include "base/utf_string_conversions.h"
#include "base/values.h"
#include "chrome/browser/browser_process.h"
+#include "chrome/browser/prefs/pref_service.h"
#include "chrome/browser/profiles/profile.h"
-#include "chrome/browser/web_resource/web_resource_service.h"
+#include "chrome/browser/web_resource/promo_resource_service.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/web_resource/web_resource_unpacker.h"
#include "chrome/common/url_constants.h"
@@ -22,7 +23,7 @@
WebUIMessageHandler* TipsHandler::Attach(WebUI* web_ui) {
web_ui_ = web_ui;
tips_cache_ = web_ui_->GetProfile()->GetPrefs()->
- GetMutableDictionary(prefs::kNTPWebResourceCache);
+ GetMutableDictionary(prefs::kNTPPromoResourceCache);
return WebUIMessageHandler::Attach(web_ui);
}
@@ -58,9 +59,9 @@
if (tips_cache_ != NULL && !tips_cache_->empty()) {
if (tips_cache_->GetInteger(
- WebResourceService::kCurrentTipPrefName, &current_tip_index) &&
+ PromoResourceService::kCurrentTipPrefName, &current_tip_index) &&
tips_cache_->GetList(
- WebResourceService::kTipCachePrefName, &wr_list) &&
+ PromoResourceService::kTipCachePrefName, &wr_list) &&
wr_list && wr_list->GetSize() > 0) {
if (wr_list->GetSize() <= static_cast<size_t>(current_tip_index)) {
// Check to see whether the home page is set to NTP; if not, add tip
@@ -91,7 +92,7 @@
DictionaryValue* tip_dict = new DictionaryValue();
tip_dict->SetString(tip_type, tip);
list_value.Append(tip_dict);
- tips_cache_->SetInteger(WebResourceService::kCurrentTipPrefName,
+ tips_cache_->SetInteger(PromoResourceService::kCurrentTipPrefName,
tip_index);
// Send list of web resource items back out to the DOM.
web_ui_->CallJavascriptFunction(L"tips", list_value);
@@ -99,9 +100,9 @@
// static
void TipsHandler::RegisterUserPrefs(PrefService* prefs) {
- prefs->RegisterDictionaryPref(prefs::kNTPWebResourceCache);
- prefs->RegisterStringPref(prefs::kNTPWebResourceServer,
- WebResourceService::kDefaultWebResourceServer);
+ prefs->RegisterDictionaryPref(prefs::kNTPPromoResourceCache);
+ prefs->RegisterStringPref(prefs::kNTPPromoResourceServer,
+ PromoResourceService::kDefaultPromoResourceServer);
}
bool TipsHandler::IsValidURL(const std::wstring& url_string) {
« no previous file with comments | « chrome/browser/dom_ui/ntp_resource_cache.cc ('k') | chrome/browser/profiles/profile.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698