Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4300)

Unified Diff: chrome/browser/ui/passwords/manage_passwords_view_utils.cc

Issue 901493003: Extract some account chooser views things for cross-platform use. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/passwords/manage_passwords_view_utils.cc
diff --git a/chrome/browser/ui/passwords/manage_passwords_view_utils.cc b/chrome/browser/ui/passwords/manage_passwords_view_utils.cc
index 9b2425d44f89f0d77a98e9caaf3a4f5979e65f38..122c12e931dcf97e98e89f36f9c9e02085a2071b 100644
--- a/chrome/browser/ui/passwords/manage_passwords_view_utils.cc
+++ b/chrome/browser/ui/passwords/manage_passwords_view_utils.cc
@@ -8,8 +8,28 @@
#include "components/autofill/core/common/password_form.h"
#include "components/password_manager/core/browser/affiliation_utils.h"
#include "net/base/net_util.h"
+#include "ui/gfx/geometry/rect.h"
+#include "ui/gfx/geometry/size.h"
+#include "ui/gfx/image/image_skia.h"
+#include "ui/gfx/image/image_skia_operations.h"
#include "url/gurl.h"
+const int kAvatarImageSize = 50;
+
+gfx::ImageSkia ScaleImageForAccountAvatar(gfx::ImageSkia skia_image) {
+ gfx::Size size = skia_image.size();
+ if (size.height() != size.width()) {
+ gfx::Rect target(size);
+ int side = std::min(size.height(), size.width());
+ target.ClampToCenteredSize(gfx::Size(side, side));
+ skia_image = gfx::ImageSkiaOperations::ExtractSubset(skia_image, target);
+ }
+ return gfx::ImageSkiaOperations::CreateResizedImage(
+ skia_image,
+ skia::ImageOperations::RESIZE_BEST,
+ gfx::Size(kAvatarImageSize, kAvatarImageSize));
+}
+
std::string GetHumanReadableOrigin(const autofill::PasswordForm& password_form,
const std::string& languages) {
password_manager::FacetURI facet_uri =
« no previous file with comments | « chrome/browser/ui/passwords/manage_passwords_view_utils.h ('k') | chrome/browser/ui/views/passwords/credentials_item_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698