diff options
author | jcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-10-10 18:50:32 +0000 |
---|---|---|
committer | jcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-10-10 18:50:32 +0000 |
commit | 9ccbb370aa45f477941e0599d4ce7c89fac64101 (patch) | |
tree | 8b21818fa95d05ff00dfe5b9986d1d39eb4be722 /chrome/views/native_button.cc | |
parent | a9acde54584ff37bcc5fad73cf25dce5d85348bc (diff) | |
download | chromium_src-9ccbb370aa45f477941e0599d4ce7c89fac64101.zip chromium_src-9ccbb370aa45f477941e0599d4ce7c89fac64101.tar.gz chromium_src-9ccbb370aa45f477941e0599d4ce7c89fac64101.tar.bz2 |
This CL adds prompting for dangerous types of files (executable) when they are automatically downloaded.
The file is saved with a temporary name (dangerous_download_xxxx.download) in the download directory and the user is presented (in the download shelf and the download tab if opened) with a warning message and buttons to save/discard the download.
If discarded the download is removed (and its file deleted).
If saved, download goes as usual.
Dangerous downloads not confirmed by the user are deleted on shutdown.
TEST=Download a small exe file, try using the save/discard button from the download shelf and from the download tab (the intent is that the file has been entirely downloaded by the time you take action). Try again with a slow/big download (that time the download is expected not to be finished when approved/discarded).
Review URL: http://codereview.chromium.org/6043
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@3228 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/views/native_button.cc')
-rw-r--r-- | chrome/views/native_button.cc | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/chrome/views/native_button.cc b/chrome/views/native_button.cc index 2db380b..55323c6 100644 --- a/chrome/views/native_button.cc +++ b/chrome/views/native_button.cc @@ -5,17 +5,20 @@ #include "chrome/views/native_button.h" #include "base/logging.h" +#include "chrome/common/gfx/chrome_canvas.h" #include "chrome/common/l10n_util.h" #include "chrome/common/resource_bundle.h" #include "chrome/views/background.h" namespace ChromeViews { -NativeButton::NativeButton(const std::wstring& label) { +NativeButton::NativeButton(const std::wstring& label) + : enforce_dlu_min_size_(true) { Init(label, false); } -NativeButton::NativeButton(const std::wstring& label, bool is_default) { +NativeButton::NativeButton(const std::wstring& label, bool is_default) + : enforce_dlu_min_size_(true) { Init(label, is_default); } @@ -41,13 +44,16 @@ void NativeButton::GetPreferredSize(CSize *out) { sz.cx += 2 * padding_.cx; sz.cy += 2 * padding_.cy; - if (min_dlu_size_.width()) - sz.cx = std::max(static_cast<int>(sz.cx), - font_.horizontal_dlus_to_pixels(min_dlu_size_.width())); - if (min_dlu_size_.height()) - sz.cy = std::max(static_cast<int>(sz.cy), - font_.vertical_dlus_to_pixels(min_dlu_size_.height())); - + if (enforce_dlu_min_size_) { + if (min_dlu_size_.width()) { + sz.cx = + std::max(static_cast<int>(sz.cx), + font_.horizontal_dlus_to_pixels(min_dlu_size_.width())); + } + if (min_dlu_size_.height()) + sz.cy = std::max(static_cast<int>(sz.cy), + font_.vertical_dlus_to_pixels(min_dlu_size_.height())); + } *out = sz; } } @@ -186,4 +192,3 @@ bool NativeButton::OnKeyDown(int virtual_key_code) { } } - |