summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/app/nibs/Preferences.xib67
-rw-r--r--chrome/app/policy/policy_templates.json12
-rw-r--r--chrome/browser/dom_ui/options/advanced_options_handler.cc25
-rw-r--r--chrome/browser/dom_ui/options/advanced_options_handler.h8
-rw-r--r--chrome/browser/download/download_manager.cc2
-rw-r--r--chrome/browser/download/download_prefs.cc4
-rw-r--r--chrome/browser/download/download_prefs.h6
-rw-r--r--chrome/browser/policy/configuration_policy_pref_store.cc4
-rw-r--r--chrome/browser/policy/managed_prefs_banner_base.cc1
-rw-r--r--chrome/browser/prefs/pref_member.h2
-rw-r--r--chrome/browser/resources/options/advanced_options.html7
-rw-r--r--chrome/browser/resources/options/advanced_options.js17
-rw-r--r--chrome/browser/ui/cocoa/options/preferences_window_controller.h2
-rw-r--r--chrome/browser/ui/cocoa/options/preferences_window_controller.mm3
-rw-r--r--chrome/browser/ui/gtk/options/advanced_contents_gtk.cc10
-rw-r--r--chrome/browser/ui/views/options/advanced_contents_view.cc11
16 files changed, 163 insertions, 18 deletions
diff --git a/chrome/app/nibs/Preferences.xib b/chrome/app/nibs/Preferences.xib
index eff2805..b91a7b4 100644
--- a/chrome/app/nibs/Preferences.xib
+++ b/chrome/app/nibs/Preferences.xib
@@ -2,7 +2,7 @@
<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.10">
<data>
<int key="IBDocument.SystemTarget">1050</int>
- <string key="IBDocument.SystemVersion">10F2108</string>
+ <string key="IBDocument.SystemVersion">10F569</string>
<string key="IBDocument.InterfaceBuilderVersion">823</string>
<string key="IBDocument.AppKitVersion">1038.29</string>
<string key="IBDocument.HIToolboxVersion">461.00</string>
@@ -12,11 +12,11 @@
</object>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
- <integer value="481"/>
- <integer value="74"/>
+ <integer value="482"/>
<integer value="692"/>
<integer value="159"/>
- <integer value="482"/>
+ <integer value="481"/>
+ <integer value="74"/>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -745,6 +745,7 @@
<string>customPagesSource.customHomePages</string>
<string>URL</string>
<string>isPasswordManagerEnabled</string>
+ <string>downloadLocationEnabled</string>
</object>
<string key="NSObjectClassName">CustomHomePageEntry</string>
<bool key="NSEditable">YES</bool>
@@ -4033,6 +4034,54 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
</object>
<int key="connectionID">800</int>
</object>
+ <object class="IBConnectionRecord">
+ <object class="IBBindingConnection" key="connection">
+ <string key="label">enabled: selection.downloadLocationEnabled</string>
+ <reference key="source" ref="602116533"/>
+ <reference key="destination" ref="495015235"/>
+ <object class="NSNibBindingConnector" key="connector">
+ <reference key="NSSource" ref="602116533"/>
+ <reference key="NSDestination" ref="495015235"/>
+ <string key="NSLabel">enabled: selection.downloadLocationEnabled</string>
+ <string key="NSBinding">enabled</string>
+ <string key="NSKeyPath">selection.downloadLocationEnabled</string>
+ <int key="NSNibBindingConnectorVersion">2</int>
+ </object>
+ </object>
+ <int key="connectionID">801</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBBindingConnection" key="connection">
+ <string key="label">enabled: downloadLocationEnabled</string>
+ <reference key="source" ref="484273049"/>
+ <reference key="destination" ref="1001"/>
+ <object class="NSNibBindingConnector" key="connector">
+ <reference key="NSSource" ref="484273049"/>
+ <reference key="NSDestination" ref="1001"/>
+ <string key="NSLabel">enabled: downloadLocationEnabled</string>
+ <string key="NSBinding">enabled</string>
+ <string key="NSKeyPath">downloadLocationEnabled</string>
+ <int key="NSNibBindingConnectorVersion">2</int>
+ </object>
+ </object>
+ <int key="connectionID">803</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBBindingConnection" key="connection">
+ <string key="label">enabled: downloadLocationEnabled</string>
+ <reference key="source" ref="928184762"/>
+ <reference key="destination" ref="1001"/>
+ <object class="NSNibBindingConnector" key="connector">
+ <reference key="NSSource" ref="928184762"/>
+ <reference key="NSDestination" ref="1001"/>
+ <string key="NSLabel">enabled: downloadLocationEnabled</string>
+ <string key="NSBinding">enabled</string>
+ <string key="NSKeyPath">downloadLocationEnabled</string>
+ <int key="NSNibBindingConnectorVersion">2</int>
+ </object>
+ </object>
+ <int key="connectionID">805</int>
+ </object>
</object>
<object class="IBMutableOrderedSet" key="objectRecords">
<object class="NSArray" key="orderedObjects">
@@ -5696,9 +5745,9 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
<object class="NSMutableArray">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
- <string>{{329, 497}, {540, 359}}</string>
+ <string>{{901, 797}, {540, 359}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>{{329, 393}, {540, 463}}</string>
+ <string>{{1078, 324}, {540, 463}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>{{682, 562}, {616, 0}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
@@ -5778,7 +5827,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>{{329, 829}, {540, 27}}</string>
+ <string>{{385, 829}, {540, 27}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
@@ -5791,7 +5840,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>{{389, 162}, {443, 754}}</string>
+ <string>{{384, 314}, {443, 754}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<object class="NSAffineTransform">
@@ -5842,7 +5891,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes>
</object>
</object>
<nil key="sourceID"/>
- <int key="maxID">800</int>
+ <int key="maxID">805</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
diff --git a/chrome/app/policy/policy_templates.json b/chrome/app/policy/policy_templates.json
index c971bea..be24e97 100644
--- a/chrome/app/policy/policy_templates.json
+++ b/chrome/app/policy/policy_templates.json
@@ -391,6 +391,18 @@
'label': '''Set user data directory''',
},
{
+ 'name': 'DownloadDirectory',
+ 'type': 'string',
+ 'supported_on': ['chrome.*:11-'],
+ 'features': {'dynamic_refresh': 1},
+ 'example_value': '${user_home}\Chrome',
+ 'caption': '''Set download directory''',
+ 'desc': '''Configures the directory that <ph name="PRODUCT_NAME">$1<ex>Google Chrome</ex></ph> will use for downloading files.
+
+ If you set this policy, <ph name="PRODUCT_NAME">$1<ex>Google Chrome</ex></ph> will use the provided directory regardless whether the user has specified one or enabled the flag to be prompted for download location every time.''',
+ 'label': '''Set download directory''',
+ },
+ {
'name': 'Proxy',
'type': 'group',
'caption': '''Proxy server''',
diff --git a/chrome/browser/dom_ui/options/advanced_options_handler.cc b/chrome/browser/dom_ui/options/advanced_options_handler.cc
index a5b841b..79c687b 100644
--- a/chrome/browser/dom_ui/options/advanced_options_handler.cc
+++ b/chrome/browser/dom_ui/options/advanced_options_handler.cc
@@ -198,6 +198,7 @@ void AdvancedOptionsHandler::Initialize() {
SetupMetricsReportingSettingVisibility();
SetupFontSizeLabel();
SetupDownloadLocationPath();
+ SetupPromptForDownload();
SetupAutoOpenFileTypesDisabledAttribute();
SetupProxySettingsSection();
#if defined(OS_WIN)
@@ -241,6 +242,7 @@ WebUIMessageHandler* AdvancedOptionsHandler::Attach(WebUI* web_ui) {
#endif
default_download_location_.Init(prefs::kDownloadDefaultDirectory,
prefs, this);
+ ask_for_save_location_.Init(prefs::kPromptForDownload, prefs, this);
auto_open_files_.Init(prefs::kDownloadExtensionsToOpen, prefs, this);
default_font_size_.Init(prefs::kWebKitDefaultFontSize, prefs, this);
default_fixed_font_size_.Init(prefs::kWebKitDefaultFixedFontSize, prefs,
@@ -258,6 +260,9 @@ void AdvancedOptionsHandler::RegisterMessages() {
web_ui_->RegisterMessageCallback("selectDownloadLocation",
NewCallback(this,
&AdvancedOptionsHandler::HandleSelectDownloadLocation));
+ web_ui_->RegisterMessageCallback("promptForDownloadAction",
+ NewCallback(this,
+ &AdvancedOptionsHandler::HandlePromptForDownload));
web_ui_->RegisterMessageCallback("autoOpenFileTypesAction",
NewCallback(this,
&AdvancedOptionsHandler::HandleAutoOpenButton));
@@ -319,8 +324,10 @@ void AdvancedOptionsHandler::Observe(NotificationType type,
const NotificationDetails& details) {
if (type == NotificationType::PREF_CHANGED) {
std::string* pref_name = Details<std::string>(details).ptr();
- if (*pref_name == prefs::kDownloadDefaultDirectory) {
+ if ((*pref_name == prefs::kDownloadDefaultDirectory) ||
+ (*pref_name == prefs::kPromptForDownload)) {
SetupDownloadLocationPath();
+ SetupPromptForDownload();
} else if (*pref_name == prefs::kDownloadExtensionsToOpen) {
SetupAutoOpenFileTypesDisabledAttribute();
} else if (proxy_prefs_->IsObserved(*pref_name)) {
@@ -350,6 +357,12 @@ void AdvancedOptionsHandler::HandleSelectDownloadLocation(
web_ui_->tab_contents()->view()->GetTopLevelNativeWindow(), NULL);
}
+void AdvancedOptionsHandler::HandlePromptForDownload(
+ const ListValue* args) {
+ std::string checked_str = WideToUTF8(ExtractStringValue(args));
+ ask_for_save_location_.SetValue(checked_str == "true");
+}
+
void AdvancedOptionsHandler::FileSelected(const FilePath& path, int index,
void* params) {
UserMetricsRecordAction(UserMetricsAction("Options_SetDownloadDirectory"));
@@ -572,8 +585,16 @@ void AdvancedOptionsHandler::SetupFontSizeLabel() {
void AdvancedOptionsHandler::SetupDownloadLocationPath() {
StringValue value(default_download_location_.GetValue().value());
+ FundamentalValue disabled(default_download_location_.IsManaged());
+ web_ui_->CallJavascriptFunction(
+ L"options.AdvancedOptions.SetDownloadLocationPath", value, disabled);
+}
+
+void AdvancedOptionsHandler::SetupPromptForDownload() {
+ FundamentalValue checked(ask_for_save_location_.GetValue());
+ FundamentalValue disabled(default_download_location_.IsManaged());
web_ui_->CallJavascriptFunction(
- L"options.AdvancedOptions.SetDownloadLocationPath", value);
+ L"options.AdvancedOptions.SetPromptForDownload", checked, disabled);
}
void AdvancedOptionsHandler::SetupAutoOpenFileTypesDisabledAttribute() {
diff --git a/chrome/browser/dom_ui/options/advanced_options_handler.h b/chrome/browser/dom_ui/options/advanced_options_handler.h
index d5fdda5..22ceebe 100644
--- a/chrome/browser/dom_ui/options/advanced_options_handler.h
+++ b/chrome/browser/dom_ui/options/advanced_options_handler.h
@@ -48,6 +48,10 @@ class AdvancedOptionsHandler
// the user for a destination folder using platform-specific APIs.
void HandleSelectDownloadLocation(const ListValue* args);
+ // Callback for the "promptForDownloadAction" message. This will set
+ // the ask for save location pref accordingly.
+ void HandlePromptForDownload(const ListValue* args);
+
// Callback for the "autoOpenFileTypesResetToDefault" message. This will
// remove all auto-open file-type settings.
void HandleAutoOpenButton(const ListValue* args);
@@ -138,6 +142,9 @@ class AdvancedOptionsHandler
// Setup the download path based on user preferences.
void SetupDownloadLocationPath();
+ // Setup the pref whether to prompt for download location every time.
+ void SetupPromptForDownload();
+
// Setup the enabled state of the reset button.
void SetupAutoOpenFileTypesDisabledAttribute();
@@ -163,6 +170,7 @@ class AdvancedOptionsHandler
#endif
FilePathPrefMember default_download_location_;
+ BooleanPrefMember ask_for_save_location_;
StringPrefMember auto_open_files_;
IntegerPrefMember default_font_size_;
IntegerPrefMember default_fixed_font_size_;
diff --git a/chrome/browser/download/download_manager.cc b/chrome/browser/download/download_manager.cc
index 63c9ecd..d8f7f75 100644
--- a/chrome/browser/download/download_manager.cc
+++ b/chrome/browser/download/download_manager.cc
@@ -263,7 +263,7 @@ void DownloadManager::StartDownload(DownloadCreateInfo* info) {
// Freeze the user's preference for showing a Save As dialog. We're going
// to bounce around a bunch of threads and we don't want to worry about race
// conditions where the user changes this pref out from under us.
- if (download_prefs_->prompt_for_download()) {
+ if (download_prefs_->PromptForDownload()) {
// But ignore the user's preference for the following scenarios:
// 1) Extension installation. Note that we only care here about the case
// where an extension is installed, not when one is downloaded with
diff --git a/chrome/browser/download/download_prefs.cc b/chrome/browser/download/download_prefs.cc
index ec36422..7e74e8a 100644
--- a/chrome/browser/download/download_prefs.cc
+++ b/chrome/browser/download/download_prefs.cc
@@ -78,6 +78,10 @@ void DownloadPrefs::RegisterUserPrefs(PrefService* prefs) {
}
}
+bool DownloadPrefs::PromptForDownload() const {
+ return *prompt_for_download_ && !download_path_.IsManaged();
+}
+
bool DownloadPrefs::IsAutoOpenUsed() const {
return !auto_open_.empty();
}
diff --git a/chrome/browser/download/download_prefs.h b/chrome/browser/download/download_prefs.h
index b65bb29..a52bd58 100644
--- a/chrome/browser/download/download_prefs.h
+++ b/chrome/browser/download/download_prefs.h
@@ -21,10 +21,14 @@ class DownloadPrefs {
static void RegisterUserPrefs(PrefService* prefs);
- bool prompt_for_download() const { return *prompt_for_download_; }
FilePath download_path() const { return *download_path_; }
int save_file_type() const { return *save_file_type_; }
+ // Returns true if the prompt_for_download preference has been set and the
+ // download location is not managed (which means the user shouldn't be able
+ // to choose another download location).
+ bool PromptForDownload() const;
+
// Returns true if there is at least one file extension registered
// for auto-open.
bool IsAutoOpenUsed() const;
diff --git a/chrome/browser/policy/configuration_policy_pref_store.cc b/chrome/browser/policy/configuration_policy_pref_store.cc
index 2f37588..9312a4d 100644
--- a/chrome/browser/policy/configuration_policy_pref_store.cc
+++ b/chrome/browser/policy/configuration_policy_pref_store.cc
@@ -232,6 +232,8 @@ const ConfigurationPolicyPrefKeeper::PolicyToPreferenceMapEntry
prefs::kDefaultBrowserSettingEnabled },
{ Value::TYPE_BOOLEAN, kPolicyCloudPrintProxyEnabled,
prefs::kCloudPrintProxyEnabled },
+ { Value::TYPE_STRING, kPolicyDownloadDirectory,
+ prefs::kDownloadDefaultDirectory },
#if defined(OS_CHROMEOS)
{ Value::TYPE_BOOLEAN, kPolicyChromeOsLockOnIdleSuspend,
@@ -866,6 +868,8 @@ ConfigurationPolicyPrefStore::GetChromePolicyDefinitionList() {
key::kDefaultBrowserSettingEnabled },
{ kPolicyCloudPrintProxyEnabled, Value::TYPE_BOOLEAN,
key::kCloudPrintProxyEnabled },
+ { kPolicyDownloadDirectory, Value::TYPE_STRING,
+ key::kDownloadDirectory },
#if defined(OS_CHROMEOS)
{ kPolicyChromeOsLockOnIdleSuspend, Value::TYPE_BOOLEAN,
diff --git a/chrome/browser/policy/managed_prefs_banner_base.cc b/chrome/browser/policy/managed_prefs_banner_base.cc
index 39fdf73..6a32d3f 100644
--- a/chrome/browser/policy/managed_prefs_banner_base.cc
+++ b/chrome/browser/policy/managed_prefs_banner_base.cc
@@ -89,6 +89,7 @@ void ManagedPrefsBannerBase::Init(PrefService* local_state,
#endif
AddUserPref(prefs::kProxy);
AddUserPref(prefs::kCloudPrintProxyEnabled);
+ AddUserPref(prefs::kDownloadDefaultDirectory);
break;
default:
NOTREACHED();
diff --git a/chrome/browser/prefs/pref_member.h b/chrome/browser/prefs/pref_member.h
index 082ec6e..facaa1b 100644
--- a/chrome/browser/prefs/pref_member.h
+++ b/chrome/browser/prefs/pref_member.h
@@ -104,7 +104,7 @@ class PrefMember : public subtle::PrefMemberBase {
// Check whether the pref is managed, i.e. controlled externally through
// enterprise configuration management (e.g. windows group policy). Returns
// false for unknown prefs.
- bool IsManaged() {
+ bool IsManaged() const {
return subtle::PrefMemberBase::IsManaged();
}
diff --git a/chrome/browser/resources/options/advanced_options.html b/chrome/browser/resources/options/advanced_options.html
index 1f096b9..a8e8694 100644
--- a/chrome/browser/resources/options/advanced_options.html
+++ b/chrome/browser/resources/options/advanced_options.html
@@ -144,9 +144,10 @@
i18n-content="downloadLocationChangeButton"></button>
</div>
<label class="checkbox">
- <input id="promptForDownload" pref="download.prompt_for_download"
- metric="Options_AskForSaveLocation" type="checkbox">
- <span i18n-content="downloadLocationAskForSaveLocation"></span>
+ <input id="promptForDownload" metric="Options_AskForSaveLocation"
+ type="checkbox">
+ <span id="promptForDownloadLabel"
+ i18n-content="downloadLocationAskForSaveLocation"></span>
</label>
<div id="auto-open-file-types-label"
i18n-content="autoOpenFileTypesInfo"></div>
diff --git a/chrome/browser/resources/options/advanced_options.js b/chrome/browser/resources/options/advanced_options.js
index 996f651..cefd902 100644
--- a/chrome/browser/resources/options/advanced_options.js
+++ b/chrome/browser/resources/options/advanced_options.js
@@ -89,6 +89,10 @@ var OptionsPage = options.OptionsPage;
$('downloadLocationChangeButton').onclick = function(event) {
chrome.send('selectDownloadLocation');
};
+ $('promptForDownload').onclick = function(event) {
+ chrome.send('promptForDownloadAction',
+ [String($('promptForDownload').checked)]);
+ };
// Remove Windows-style accelerators from the Browse button label.
// TODO(csilv): Remove this after the accelerator has been removed from
@@ -200,9 +204,20 @@ var OptionsPage = options.OptionsPage;
};
// Set the download path.
- AdvancedOptions.SetDownloadLocationPath = function(path) {
+ AdvancedOptions.SetDownloadLocationPath = function(path, disabled) {
if (!cr.isChromeOS)
$('downloadLocationPath').value = path;
+ $('downloadLocationChangeButton').disabled = disabled;
+ };
+
+ // Set the prompt for download checkbox.
+ AdvancedOptions.SetPromptForDownload = function(checked, disabled) {
+ $('promptForDownload').checked = checked;
+ $('promptForDownload').disabled = disabled;
+ if (disabled)
+ $('promptForDownloadLabel').className = 'informational-text';
+ else
+ $('promptForDownloadLabel').className = '';
};
// Set the enabled state for the autoOpenFileTypesResetToDefault button.
diff --git a/chrome/browser/ui/cocoa/options/preferences_window_controller.h b/chrome/browser/ui/cocoa/options/preferences_window_controller.h
index 3815beb..a962cea 100644
--- a/chrome/browser/ui/cocoa/options/preferences_window_controller.h
+++ b/chrome/browser/ui/cocoa/options/preferences_window_controller.h
@@ -143,6 +143,7 @@ class ProfileSyncService;
BOOL dnsPrefetchEnabled_;
BOOL safeBrowsingEnabled_;
BOOL metricsReportingEnabled_;
+ BOOL downloadLocationEnabled_;
BOOL proxiesConfigureButtonEnabled_;
}
@@ -163,6 +164,7 @@ class ProfileSyncService;
@property(nonatomic) BOOL dnsPrefetchEnabled;
@property(nonatomic) BOOL safeBrowsingEnabled;
@property(nonatomic) BOOL metricsReportingEnabled;
+@property(nonatomic) BOOL downloadLocationEnabled;
@property(nonatomic) BOOL proxiesConfigureButtonEnabled;
// Designated initializer. |profile| should not be NULL.
diff --git a/chrome/browser/ui/cocoa/options/preferences_window_controller.mm b/chrome/browser/ui/cocoa/options/preferences_window_controller.mm
index 1de5ada..4926576 100644
--- a/chrome/browser/ui/cocoa/options/preferences_window_controller.mm
+++ b/chrome/browser/ui/cocoa/options/preferences_window_controller.mm
@@ -483,6 +483,7 @@ class ManagedPrefsBannerState : public policy::ManagedPrefsBannerBase {
@synthesize dnsPrefetchEnabled = dnsPrefetchEnabled_;
@synthesize safeBrowsingEnabled = safeBrowsingEnabled_;
@synthesize metricsReportingEnabled = metricsReportingEnabled_;
+@synthesize downloadLocationEnabled = downloadLocationEnabled_;
@synthesize proxiesConfigureButtonEnabled = proxiesConfigureButtonEnabled_;
- (id)initWithProfile:(Profile*)profile initialPage:(OptionsPage)initialPage {
@@ -570,6 +571,7 @@ class ManagedPrefsBannerState : public policy::ManagedPrefsBannerBase {
[self setDnsPrefetchEnabled:!dnsPrefetch_.IsManaged()];
[self setSafeBrowsingEnabled:!safeBrowsing_.IsManaged()];
[self setMetricsReportingEnabled:!metricsReporting_.IsManaged()];
+ [self setDownloadLocationEnabled:!defaultDownloadLocation_.IsManaged()];
proxyPrefs_.reset(
PrefSetObserver::CreateProxyPrefSetObserver(prefs_, observer_.get()));
[self setProxiesConfigureButtonEnabled:!proxyPrefs_->IsManaged()];
@@ -1504,6 +1506,7 @@ const int kDisabledIndex = 1;
[self setMetricsReportingEnabled:!metricsReporting_.IsManaged()];
}
else if (*prefName == prefs::kDownloadDefaultDirectory) {
+ [self setDownloadLocationEnabled:!defaultDownloadLocation_.IsManaged()];
// Poke KVO.
[self willChangeValueForKey:@"defaultDownloadLocation"];
[self didChangeValueForKey:@"defaultDownloadLocation"];
diff --git a/chrome/browser/ui/gtk/options/advanced_contents_gtk.cc b/chrome/browser/ui/gtk/options/advanced_contents_gtk.cc
index 1b35b44..bb9cb19 100644
--- a/chrome/browser/ui/gtk/options/advanced_contents_gtk.cc
+++ b/chrome/browser/ui/gtk/options/advanced_contents_gtk.cc
@@ -157,6 +157,9 @@ class DownloadSection : public OptionsPageBase {
// Overridden from OptionsPageBase.
virtual void NotifyPrefChanged(const std::string* pref_name);
+ // Helper function for reacting to managed prefs.
+ void UpdateWidgetsForManagedPrefs();
+
// Callbacks for the widgets.
static void OnDownloadLocationChanged(GtkFileChooser* widget,
DownloadSection* section);
@@ -290,9 +293,16 @@ void DownloadSection::NotifyPrefChanged(const std::string* pref_name) {
gtk_widget_set_sensitive(reset_file_handlers_label_, enabled);
gtk_widget_set_sensitive(reset_file_handlers_button_, enabled);
}
+ UpdateWidgetsForManagedPrefs();
pref_changing_ = false;
}
+void DownloadSection::UpdateWidgetsForManagedPrefs() {
+ const bool enabled = !default_download_location_.IsManaged();
+ gtk_widget_set_sensitive(download_location_button_, enabled);
+ gtk_widget_set_sensitive(download_ask_for_save_location_checkbox_, enabled);
+}
+
// static
void DownloadSection::OnDownloadLocationChanged(GtkFileChooser* widget,
DownloadSection* section) {
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