1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76
|
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_UI_VIEWS_PASSWORDS_CREDENTIALS_ITEM_VIEW_H_
#define CHROME_BROWSER_UI_VIEWS_PASSWORDS_CREDENTIALS_ITEM_VIEW_H_
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
#include "chrome/browser/ui/passwords/account_avatar_fetcher.h"
#include "ui/views/controls/button/button.h"
namespace autofill {
struct PasswordForm;
}
namespace gfx {
class ImageSkia;
}
namespace network {
namespace mojom {
class URLLoaderFactory;
}
}
namespace views {
class ImageView;
class Label;
}
// CredentialsItemView represents a credential view in the account chooser
// bubble.
class CredentialsItemView : public AccountAvatarFetcherDelegate,
public views::Button {
public:
CredentialsItemView(views::ButtonListener* button_listener,
const base::string16& upper_text,
const base::string16& lower_text,
SkColor hover_color,
const autofill::PasswordForm* form,
network::mojom::URLLoaderFactory* loader_factory);
~CredentialsItemView() override;
const autofill::PasswordForm* form() const { return form_; }
// AccountAvatarFetcherDelegate:
void UpdateAvatar(const gfx::ImageSkia& image) override;
void SetLowerLabelColor(SkColor color);
void SetHoverColor(SkColor color);
int GetPreferredHeight() const;
private:
// views::View:
gfx::Size CalculatePreferredSize() const override;
int GetHeightForWidth(int w) const override;
void Layout() override;
void OnPaintBackground(gfx::Canvas* canvas) override;
const autofill::PasswordForm* form_;
views::ImageView* image_view_;
views::Label* upper_label_;
views::Label* lower_label_;
views::ImageView* info_icon_;
SkColor hover_color_;
base::WeakPtrFactory<CredentialsItemView> weak_ptr_factory_;
DISALLOW_COPY_AND_ASSIGN(CredentialsItemView);
};
#endif // CHROME_BROWSER_UI_VIEWS_PASSWORDS_CREDENTIALS_ITEM_VIEW_H_
|