diff options
author | aa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-27 06:03:35 +0000 |
---|---|---|
committer | aa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-27 06:03:35 +0000 |
commit | 33bb14c339d53c34ca1da327f983d7abb8b6fd5a (patch) | |
tree | 4eeb904bd850373387ba36ec700fb2d98c8e70d7 /chrome/browser/dom_ui | |
parent | efc593a5fa03e12f555164e8670d8af028b686fc (diff) | |
download | chromium_src-33bb14c339d53c34ca1da327f983d7abb8b6fd5a.zip chromium_src-33bb14c339d53c34ca1da327f983d7abb8b6fd5a.tar.gz chromium_src-33bb14c339d53c34ca1da327f983d7abb8b6fd5a.tar.bz2 |
Make the 'recently closed' section uncollapseable by adding a
'nocollapse' feature to the sections.
screencap:
http://aaronboodman.com/z_dropbox/cr3141046/ntp5.png
BUG=53248
Review URL: http://codereview.chromium.org/3141046
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@57640 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/dom_ui')
-rw-r--r-- | chrome/browser/dom_ui/ntp_resource_cache.cc | 5 | ||||
-rw-r--r-- | chrome/browser/dom_ui/shown_sections_handler.cc | 13 | ||||
-rw-r--r-- | chrome/browser/dom_ui/shown_sections_handler.h | 3 |
3 files changed, 18 insertions, 3 deletions
diff --git a/chrome/browser/dom_ui/ntp_resource_cache.cc b/chrome/browser/dom_ui/ntp_resource_cache.cc index 05868b7..9be3548 100644 --- a/chrome/browser/dom_ui/ntp_resource_cache.cc +++ b/chrome/browser/dom_ui/ntp_resource_cache.cc @@ -20,6 +20,7 @@ #include "base/values.h" #include "chrome/browser/chrome_thread.h" #include "chrome/browser/dom_ui/chrome_url_data_manager.h" +#include "chrome/browser/dom_ui/shown_sections_handler.h" #include "chrome/browser/google_util.h" #include "chrome/browser/prefs/pref_service.h" #include "chrome/browser/profile.h" @@ -309,8 +310,8 @@ void NTPResourceCache::CreateNewTabHTML() { localized_strings.SetString("has_3d", has_3d ? "true" : "false"); // Pass the shown_sections pref early so that we can prevent flicker. - const int shown_sections = profile_->GetPrefs()->GetInteger( - prefs::kNTPShownSections); + const int shown_sections = ShownSectionsHandler::GetShownSections( + profile_->GetPrefs()); localized_strings.SetInteger("shown_sections", shown_sections); base::StringPiece new_tab_html(ResourceBundle::GetSharedInstance(). diff --git a/chrome/browser/dom_ui/shown_sections_handler.cc b/chrome/browser/dom_ui/shown_sections_handler.cc index c46724d..deb4d01 100644 --- a/chrome/browser/dom_ui/shown_sections_handler.cc +++ b/chrome/browser/dom_ui/shown_sections_handler.cc @@ -41,6 +41,17 @@ void NotifySectionDisabled(int new_mode, int old_mode, Profile *profile) { } // namespace +// static +int ShownSectionsHandler::GetShownSections(PrefService* prefs) { + int sections = prefs->GetInteger(prefs::kNTPShownSections); + + DCHECK(!(sections & RECENT)) << "Should be impossible to ever end up with " + << "recent section visible."; + sections &= ~RECENT; + + return sections; +} + ShownSectionsHandler::ShownSectionsHandler(PrefService* pref_service) : pref_service_(pref_service) { pref_service_->AddPrefObserver(prefs::kNTPShownSections, this); @@ -70,7 +81,7 @@ void ShownSectionsHandler::Observe(NotificationType type, } void ShownSectionsHandler::HandleGetShownSections(const ListValue* args) { - int sections = pref_service_->GetInteger(prefs::kNTPShownSections); + int sections = GetShownSections(pref_service_); FundamentalValue sections_value(sections); dom_ui_->CallJavascriptFunction(L"onShownSections", sections_value); } diff --git a/chrome/browser/dom_ui/shown_sections_handler.h b/chrome/browser/dom_ui/shown_sections_handler.h index e097c71..8821d640 100644 --- a/chrome/browser/dom_ui/shown_sections_handler.h +++ b/chrome/browser/dom_ui/shown_sections_handler.h @@ -30,6 +30,9 @@ class ShownSectionsHandler : public DOMMessageHandler, explicit ShownSectionsHandler(PrefService* pref_service); virtual ~ShownSectionsHandler(); + // Helper to get the current shown sections. + static int GetShownSections(PrefService* pref_service); + // DOMMessageHandler implementation. virtual void RegisterMessages(); |