diff options
author | pastarmovj@chromium.org <pastarmovj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-22 14:04:01 +0000 |
---|---|---|
committer | pastarmovj@chromium.org <pastarmovj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-22 14:04:01 +0000 |
commit | 14e0a105d9d8d21321345d0825026baab487c8f4 (patch) | |
tree | d84aaf06008e42ad65a0286ee8d00839a3ee436a | |
parent | 986a40a7d57589c7e8db787751fbf822e3a6f0db (diff) | |
download | chromium_src-14e0a105d9d8d21321345d0825026baab487c8f4.zip chromium_src-14e0a105d9d8d21321345d0825026baab487c8f4.tar.gz chromium_src-14e0a105d9d8d21321345d0825026baab487c8f4.tar.bz2 |
Fixes the context menu "save as" when policy is effective.
Added a solution for the save as link still trying to open "Save As"
dialog instead of using the policy location when set. We still have to
keep this option in the menu enabled so that people can work around automatic
open which is not dependent on this policy.
BUG=59768
TEST=Set the policy. Right click a download link and "save as" should save without prompting.
Review URL: http://codereview.chromium.org/6546047
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@75587 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/download/download_manager.cc | 3 | ||||
-rw-r--r-- | chrome/browser/download/download_prefs.cc | 4 | ||||
-rw-r--r-- | chrome/browser/download/download_prefs.h | 3 |
3 files changed, 10 insertions, 0 deletions
diff --git a/chrome/browser/download/download_manager.cc b/chrome/browser/download/download_manager.cc index d8f7f75..af8670d8 100644 --- a/chrome/browser/download/download_manager.cc +++ b/chrome/browser/download/download_manager.cc @@ -274,6 +274,9 @@ void DownloadManager::StartDownload(DownloadCreateInfo* info) { !ShouldOpenFileBasedOnExtension(generated_name)) info->prompt_user_for_save_location = true; } + if (download_prefs_->IsDownloadPathManaged()) { + info->prompt_user_for_save_location = false; + } // Determine the proper path for a download, by either one of the following: // 1) using the default download directory. diff --git a/chrome/browser/download/download_prefs.cc b/chrome/browser/download/download_prefs.cc index 7e74e8a..14d26e1 100644 --- a/chrome/browser/download/download_prefs.cc +++ b/chrome/browser/download/download_prefs.cc @@ -82,6 +82,10 @@ bool DownloadPrefs::PromptForDownload() const { return *prompt_for_download_ && !download_path_.IsManaged(); } +bool DownloadPrefs::IsDownloadPathManaged() const { + return 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 a52bd58..8bcebfe 100644 --- a/chrome/browser/download/download_prefs.h +++ b/chrome/browser/download/download_prefs.h @@ -29,6 +29,9 @@ class DownloadPrefs { // to choose another download location). bool PromptForDownload() const; + // Returns true if the download path preference is managed. + bool IsDownloadPathManaged() const; + // Returns true if there is at least one file extension registered // for auto-open. bool IsAutoOpenUsed() const; |