diff options
author | pastarmovj@chromium.org <pastarmovj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-17 12:42:05 +0000 |
---|---|---|
committer | pastarmovj@chromium.org <pastarmovj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-17 12:42:05 +0000 |
commit | 0e9b60784cae677eab6e207260c2268f4ab55245 (patch) | |
tree | 07503a93dc5024137b728ad7ec87bc6b58d8df2f /chrome/browser/ui/views/options/advanced_contents_view.cc | |
parent | efb1a423ddec13af4268c7d0fa7f984e9e9c6a8e (diff) | |
download | chromium_src-0e9b60784cae677eab6e207260c2268f4ab55245.zip chromium_src-0e9b60784cae677eab6e207260c2268f4ab55245.tar.gz chromium_src-0e9b60784cae677eab6e207260c2268f4ab55245.tar.bz2 |
Implement the DownloadDirectory policy.
This policy allows for locking the user to download files only to the specified location.
When the policy is set the UI elements should be inactive and the save dialog should never appear.
Changes in the Preferences.xib file only wire the enabled status of the download location and save prompt checkbox elements to a variable that tracks the managed state of the DefaultDownloadDir pref. No UI elements were harmed in this change.
BUG=59768
TEST=All old download manager tests shouldn't break. UI should behave correctly when policy is set.
Review URL: http://codereview.chromium.org/6525054
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@75255 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/ui/views/options/advanced_contents_view.cc')
-rw-r--r-- | chrome/browser/ui/views/options/advanced_contents_view.cc | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/chrome/browser/ui/views/options/advanced_contents_view.cc b/chrome/browser/ui/views/options/advanced_contents_view.cc index d192269..6efee3a 100644 --- a/chrome/browser/ui/views/options/advanced_contents_view.cc +++ b/chrome/browser/ui/views/options/advanced_contents_view.cc @@ -1078,6 +1078,9 @@ class DownloadSection : public AdvancedSection, // the current value of the pref. void UpdateDownloadDirectoryDisplay(); + // Helper function for reacting to managed prefs. + void DownloadSection::UpdateWidgetsForManagedPrefs(); + StringPrefMember auto_open_files_; DISALLOW_COPY_AND_ASSIGN(DownloadSection); @@ -1227,6 +1230,7 @@ void DownloadSection::NotifyPrefChanged(const std::string* pref_name) { reset_file_handlers_label_->SetEnabled(enabled); reset_file_handlers_button_->SetEnabled(enabled); } + UpdateWidgetsForManagedPrefs(); } void DownloadSection::UpdateDownloadDirectoryDisplay() { @@ -1234,6 +1238,13 @@ void DownloadSection::UpdateDownloadDirectoryDisplay() { default_download_location_.GetValue()); } +void DownloadSection::UpdateWidgetsForManagedPrefs() { + const bool enabled = !default_download_location_.IsManaged(); + download_default_download_location_display_->SetEnabled(enabled); + download_browse_button_->SetEnabled(enabled); + download_ask_for_save_location_checkbox_->SetEnabled(enabled); +} + //////////////////////////////////////////////////////////////////////////////// // TranslateSection |