blob: a0cb4fd555300ad68b36ba5a0d3e979c48d3f613 (
plain)
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
|
// 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/label_button.h"
namespace autofill {
struct PasswordForm;
}
namespace gfx {
class ImageSkia;
}
namespace net {
class URLRequestContextGetter;
}
namespace views {
class ImageView;
class Label;
}
// CredentialsItemView represents a credential view in the account chooser
// bubble.
class CredentialsItemView : public AccountAvatarFetcherDelegate,
public views::LabelButton {
public:
CredentialsItemView(views::ButtonListener* button_listener,
const base::string16& upper_text,
const base::string16& lower_text,
SkColor hover_color,
const autofill::PasswordForm* form,
net::URLRequestContextGetter* request_context);
~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);
private:
// views::LabelButton:
gfx::Size GetPreferredSize() const override;
int GetHeightForWidth(int w) const override;
void Layout() override;
void OnPaint(gfx::Canvas* canvas) override;
const autofill::PasswordForm* form_;
views::ImageView* image_view_;
views::Label* upper_label_;
views::Label* lower_label_;
SkColor hover_color_;
base::WeakPtrFactory<CredentialsItemView> weak_ptr_factory_;
DISALLOW_COPY_AND_ASSIGN(CredentialsItemView);
};
#endif // CHROME_BROWSER_UI_VIEWS_PASSWORDS_CREDENTIALS_ITEM_VIEW_H_
|