summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoroshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-14 19:49:35 +0000
committeroshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-14 19:49:35 +0000
commit6b20726e46624d4b7d30bb2f698e0447476ab2eb (patch)
tree558736314ad7e04356f6c695ca4c6c9d8034a42c
parent73caf78055fd3f23930cc51c88232e206ce26c11 (diff)
downloadchromium_src-6b20726e46624d4b7d30bb2f698e0447476ab2eb.zip
chromium_src-6b20726e46624d4b7d30bb2f698e0447476ab2eb.tar.gz
chromium_src-6b20726e46624d4b7d30bb2f698e0447476ab2eb.tar.bz2
Keep the size regardless of the image size.
BUG=none TEST=none Review URL: http://codereview.chromium.org/2722011 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@49710 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/chromeos/login/screen_lock_view.cc8
1 files changed, 8 insertions, 0 deletions
diff --git a/chrome/browser/chromeos/login/screen_lock_view.cc b/chrome/browser/chromeos/login/screen_lock_view.cc
index 2c59cf0..c94c9b8 100644
--- a/chrome/browser/chromeos/login/screen_lock_view.cc
+++ b/chrome/browser/chromeos/login/screen_lock_view.cc
@@ -13,6 +13,7 @@
#include "grit/generated_resources.h"
#include "grit/theme_resources.h"
#include "views/background.h"
+#include "views/border.h"
#include "views/controls/image_view.h"
#include "views/controls/label.h"
#include "views/grid_layout.h"
@@ -276,6 +277,13 @@ void ScreenLockView::SetImage(const SkBitmap& image,
image_view_->SetImage(image);
image_view_->SetImageSize(gfx::Size(std::min(desired_width, kMaxImageSize),
std::min(desired_height, kMaxImageSize)));
+ gfx::Size size = image_view_->GetPreferredSize();
+ int h = std::max((kMaxImageSize - size.height()) / 2, 0);
+ int w = std::max((kMaxImageSize - size.width()) / 2, 0);
+ if (h != 0 || w != 0)
+ image_view_->set_border(views::Border::CreateEmptyBorder(h, w, h, w));
+ else
+ image_view_->set_border(NULL);
}
} // namespace chromeos