|
9 | 9 | #include "brave/grit/brave_generated_resources.h"
|
10 | 10 | #include "chrome/app/vector_icons/vector_icons.h"
|
11 | 11 | #include "chrome/browser/profiles/profile_manager.h"
|
| 12 | +#include "chrome/browser/profiles/profiles_state.h" |
12 | 13 | #include "chrome/browser/profiles/profile_window.h"
|
| 14 | +#include "chrome/browser/ui/views/chrome_layout_provider.h" |
13 | 15 | #include "chrome/browser/ui/views/hover_button.h"
|
| 16 | +#include "chrome/browser/ui/views/profiles/badged_profile_photo.h" |
| 17 | +#include "chrome/grit/generated_resources.h" |
14 | 18 | #include "ui/base/l10n/l10n_util.h"
|
15 | 19 | #include "ui/gfx/paint_vector_icon.h"
|
16 | 20 | #include "ui/views/controls/button/label_button.h"
|
| 21 | +#include "ui/views/layout/box_layout.h" |
17 | 22 | #include "ui/views/layout/grid_layout.h"
|
18 | 23 |
|
19 | 24 | namespace {
|
@@ -63,3 +68,35 @@ void BraveProfileChooserView::ResetView() {
|
63 | 68 | ProfileChooserView::ResetView();
|
64 | 69 | tor_profile_button_ = nullptr;
|
65 | 70 | }
|
| 71 | + |
| 72 | +views::View* BraveProfileChooserView::CreateDiceSyncErrorView( |
| 73 | + const AvatarMenu::Item& avatar_item, |
| 74 | + sync_ui_util::AvatarSyncErrorType error, |
| 75 | + int button_string_id) { |
| 76 | + ChromeLayoutProvider* provider = ChromeLayoutProvider::Get(); |
| 77 | + |
| 78 | + views::View* view = new views::View(); |
| 79 | + int content_list_vert_spacing = |
| 80 | + provider->GetDistanceMetric(DISTANCE_CONTENT_LIST_VERTICAL_SINGLE); |
| 81 | + view->SetLayoutManager(std::make_unique<views::BoxLayout>( |
| 82 | + views::BoxLayout::kVertical, gfx::Insets(content_list_vert_spacing, 0), |
| 83 | + 0)); |
| 84 | + |
| 85 | + Profile* profile = browser_->profile(); |
| 86 | + auto current_profile_photo = std::make_unique<BadgedProfilePhoto>( |
| 87 | + BadgedProfilePhoto::BADGE_TYPE_NONE, avatar_item.icon); |
| 88 | + base::string16 profile_name = avatar_item.name; |
| 89 | + if (profile_name.empty()) |
| 90 | + profile_name = profiles::GetAvatarNameForProfile(profile->GetPath()); |
| 91 | + |
| 92 | + HoverButton* profile_card = new HoverButton( |
| 93 | + this, std::move(current_profile_photo), profile_name, base::string16()); |
| 94 | + current_profile_card_ = profile_card; |
| 95 | + view->AddChildView(current_profile_card_); |
| 96 | + |
| 97 | + current_profile_card_->SetAccessibleName( |
| 98 | + l10n_util::GetStringFUTF16( |
| 99 | + IDS_PROFILES_EDIT_PROFILE_ACCESSIBLE_NAME, profile_name)); |
| 100 | + |
| 101 | + return view; |
| 102 | +} |
0 commit comments