diff options
author | mirandac@chromium.org <mirandac@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-21 01:00:34 +0000 |
---|---|---|
committer | mirandac@chromium.org <mirandac@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-21 01:00:34 +0000 |
commit | 0ef69c756f644654452dd9ce94ab95f14b6c998c (patch) | |
tree | cca6d5a31f07791216185e0a49cd5d271891a2c4 /chrome/browser/dom_ui | |
parent | 2e3e1908a954a3e23ddc08ff7f2023b0d3b92a21 (diff) | |
download | chromium_src-0ef69c756f644654452dd9ce94ab95f14b6c998c.zip chromium_src-0ef69c756f644654452dd9ce94ab95f14b6c998c.tar.gz chromium_src-0ef69c756f644654452dd9ce94ab95f14b6c998c.tar.bz2 |
Add the ability to change NTP logos using a command from the web resource server.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/3418020
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@60001 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/dom_ui')
-rw-r--r-- | chrome/browser/dom_ui/new_tab_ui.cc | 3 | ||||
-rw-r--r-- | chrome/browser/dom_ui/ntp_resource_cache.cc | 4 | ||||
-rw-r--r-- | chrome/browser/dom_ui/tips_handler.cc | 10 |
3 files changed, 12 insertions, 5 deletions
diff --git a/chrome/browser/dom_ui/new_tab_ui.cc b/chrome/browser/dom_ui/new_tab_ui.cc index 2545845..7438d80 100644 --- a/chrome/browser/dom_ui/new_tab_ui.cc +++ b/chrome/browser/dom_ui/new_tab_ui.cc @@ -26,6 +26,7 @@ #include "chrome/browser/dom_ui/new_tab_page_sync_handler.h" #include "chrome/browser/dom_ui/ntp_resource_cache.h" #include "chrome/browser/dom_ui/shown_sections_handler.h" +#include "chrome/browser/dom_ui/tips_handler.h" #include "chrome/browser/metrics/user_metrics.h" #include "chrome/browser/themes/browser_theme_provider.h" #include "chrome/browser/prefs/pref_service.h" @@ -518,6 +519,8 @@ void NewTabUI::RegisterUserPrefs(PrefService* prefs) { MostVisitedHandler::RegisterUserPrefs(prefs); ShownSectionsHandler::RegisterUserPrefs(prefs); + if (NewTabUI::WebResourcesEnabled()) + TipsHandler::RegisterUserPrefs(prefs); UpdateUserPrefsVersion(prefs); } diff --git a/chrome/browser/dom_ui/ntp_resource_cache.cc b/chrome/browser/dom_ui/ntp_resource_cache.cc index a3e5020..169aea0 100644 --- a/chrome/browser/dom_ui/ntp_resource_cache.cc +++ b/chrome/browser/dom_ui/ntp_resource_cache.cc @@ -288,6 +288,10 @@ void NTPResourceCache::CreateNewTabHTML() { l10n_util::GetStringUTF16(IDS_EXTENSION_WEB_STORE_TITLE)); localized_strings.SetString("web_store_url", GetUrlWithLang(GURL(Extension::ChromeStoreURL()))); + localized_strings.SetString("customlogo", + profile_->GetPrefs()->FindPreference(prefs::kNTPCustomLogo) && + profile_->GetPrefs()->GetBoolean(prefs::kNTPCustomLogo) ? + "true" : "false"); // Don't initiate the sync related message passing with the page if the sync // code is not present. diff --git a/chrome/browser/dom_ui/tips_handler.cc b/chrome/browser/dom_ui/tips_handler.cc index be4ab75..4858b61 100644 --- a/chrome/browser/dom_ui/tips_handler.cc +++ b/chrome/browser/dom_ui/tips_handler.cc @@ -21,7 +21,7 @@ DOMMessageHandler* TipsHandler::Attach(DOMUI* dom_ui) { dom_ui_ = dom_ui; tips_cache_ = dom_ui_->GetProfile()->GetPrefs()-> - GetMutableDictionary(prefs::kNTPTipsCache); + GetMutableDictionary(prefs::kNTPWebResourceCache); return DOMMessageHandler::Attach(dom_ui); } @@ -45,8 +45,8 @@ void TipsHandler::HandleGetTips(const ListValue* args) { // We need to check here because the new tab page calls for tips before // the tip service starts up. PrefService* current_prefs = dom_ui_->GetProfile()->GetPrefs(); - if (current_prefs->HasPrefPath(prefs::kNTPTipsServer)) { - std::string server = current_prefs->GetString(prefs::kNTPTipsServer); + if (current_prefs->HasPrefPath(prefs::kNTPWebResourceServer)) { + std::string server = current_prefs->GetString(prefs::kNTPWebResourceServer); std::string locale = g_browser_process->GetApplicationLocale(); if (!EndsWith(server, locale, false)) { dom_ui_->CallJavascriptFunction(L"tips", list_value); @@ -97,8 +97,8 @@ void TipsHandler::SendTip(const std::string& tip, const std::string& tip_type, // static void TipsHandler::RegisterUserPrefs(PrefService* prefs) { - prefs->RegisterDictionaryPref(prefs::kNTPTipsCache); - prefs->RegisterStringPref(prefs::kNTPTipsServer, + prefs->RegisterDictionaryPref(prefs::kNTPWebResourceCache); + prefs->RegisterStringPref(prefs::kNTPWebResourceServer, WebResourceService::kDefaultResourceServer); } |