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

Side by Side Diff: chrome/browser/ui/views/profiles/profile_chooser_view.cc

Issue 2023093002: Reflow of the profile items in desktop user menu (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@move-profile-icon
Patch Set: Minor comments Created 4 years, 5 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/views/profiles/profile_chooser_view.h" 5 #include "chrome/browser/ui/views/profiles/profile_chooser_view.h"
6 6
7 #include "base/macros.h" 7 #include "base/macros.h"
8 #include "base/metrics/user_metrics.h" 8 #include "base/metrics/user_metrics.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "chrome/browser/browser_process.h" 10 #include "chrome/browser/browser_process.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 #include "components/signin/core/browser/signin_manager.h" 43 #include "components/signin/core/browser/signin_manager.h"
44 #include "components/signin/core/common/profile_management_switches.h" 44 #include "components/signin/core/common/profile_management_switches.h"
45 #include "content/public/browser/render_widget_host_view.h" 45 #include "content/public/browser/render_widget_host_view.h"
46 #include "content/public/browser/user_metrics.h" 46 #include "content/public/browser/user_metrics.h"
47 #include "grit/theme_resources.h" 47 #include "grit/theme_resources.h"
48 #include "third_party/skia/include/core/SkColor.h" 48 #include "third_party/skia/include/core/SkColor.h"
49 #include "ui/base/l10n/l10n_util.h" 49 #include "ui/base/l10n/l10n_util.h"
50 #include "ui/base/material_design/material_design_controller.h" 50 #include "ui/base/material_design/material_design_controller.h"
51 #include "ui/base/resource/resource_bundle.h" 51 #include "ui/base/resource/resource_bundle.h"
52 #include "ui/compositor/clip_recorder.h" 52 #include "ui/compositor/clip_recorder.h"
53 #include "ui/compositor/paint_recorder.h"
53 #include "ui/gfx/canvas.h" 54 #include "ui/gfx/canvas.h"
54 #include "ui/gfx/color_palette.h" 55 #include "ui/gfx/color_palette.h"
55 #include "ui/gfx/image/canvas_image_source.h" 56 #include "ui/gfx/image/canvas_image_source.h"
56 #include "ui/gfx/image/image.h" 57 #include "ui/gfx/image/image.h"
57 #include "ui/gfx/image/image_skia.h" 58 #include "ui/gfx/image/image_skia.h"
58 #include "ui/gfx/paint_vector_icon.h" 59 #include "ui/gfx/paint_vector_icon.h"
59 #include "ui/gfx/path.h" 60 #include "ui/gfx/path.h"
60 #include "ui/gfx/skia_util.h" 61 #include "ui/gfx/skia_util.h"
61 #include "ui/gfx/text_elider.h" 62 #include "ui/gfx/text_elider.h"
62 #include "ui/gfx/vector_icons_public.h" 63 #include "ui/gfx/vector_icons_public.h"
(...skipping 14 matching lines...) Expand all
77 #include "ui/views/layout/box_layout.h" 78 #include "ui/views/layout/box_layout.h"
78 #include "ui/views/layout/fill_layout.h" 79 #include "ui/views/layout/fill_layout.h"
79 #include "ui/views/layout/grid_layout.h" 80 #include "ui/views/layout/grid_layout.h"
80 #include "ui/views/layout/layout_constants.h" 81 #include "ui/views/layout/layout_constants.h"
81 #include "ui/views/widget/widget.h" 82 #include "ui/views/widget/widget.h"
82 83
83 namespace { 84 namespace {
84 85
85 // Helpers -------------------------------------------------------------------- 86 // Helpers --------------------------------------------------------------------
86 87
87 const int kFixedMenuWidth = 250;
88 const int kButtonHeight = 32; 88 const int kButtonHeight = 32;
89 const int kPasswordCombinedFixedGaiaViewWidth = 360; 89 const int kPasswordCombinedFixedGaiaViewWidth = 360;
90 const int kFixedGaiaViewWidth = 448; 90 const int kFixedGaiaViewWidth = 448;
91 const int kFixedAccountRemovalViewWidth = 280; 91 const int kFixedAccountRemovalViewWidth = 280;
92 const int kFixedSwitchUserViewWidth = 320; 92 const int kFixedSwitchUserViewWidth = 320;
93 const int kLargeImageSide = 88; 93 const int kLargeImageSide = 88;
94 const int kMdImageSide = 40;
95
96 // Spacing between the edge of the material design user menu and the
97 // top/bottom or left/right of the menu items.
98 const int kMaterialMenuEdgeMargin = 16;
94 99
95 const int kVerticalSpacing = 16; 100 const int kVerticalSpacing = 16;
96 101
97 const int kTitleViewNativeWidgetOffset = 8; 102 const int kTitleViewNativeWidgetOffset = 8;
98 103
99 bool IsProfileChooser(profiles::BubbleViewMode mode) { 104 bool IsProfileChooser(profiles::BubbleViewMode mode) {
100 return mode == profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER || 105 return mode == profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER ||
101 mode == profiles::BUBBLE_VIEW_MODE_FAST_PROFILE_CHOOSER; 106 mode == profiles::BUBBLE_VIEW_MODE_FAST_PROFILE_CHOOSER;
102 } 107 }
103 108
109 int GetProfileBadgeSize() {
110 return switches::IsMaterialDesignUserMenu() ? 24 : 30;
111 }
112
113 // DEPRECATED: New user menu components should use views::BoxLayout instead.
104 // Creates a GridLayout with a single column. This ensures that all the child 114 // Creates a GridLayout with a single column. This ensures that all the child
105 // views added get auto-expanded to fill the full width of the bubble. 115 // views added get auto-expanded to fill the full width of the bubble.
106 views::GridLayout* CreateSingleColumnLayout(views::View* view, int width) { 116 views::GridLayout* CreateSingleColumnLayout(views::View* view, int width) {
107 views::GridLayout* layout = new views::GridLayout(view); 117 views::GridLayout* layout = new views::GridLayout(view);
108 view->SetLayoutManager(layout); 118 view->SetLayoutManager(layout);
109 119
110 views::ColumnSet* columns = layout->AddColumnSet(0); 120 views::ColumnSet* columns = layout->AddColumnSet(0);
111 columns->AddColumn(views::GridLayout::FILL, views::GridLayout::FILL, 0, 121 columns->AddColumn(views::GridLayout::FILL, views::GridLayout::FILL, 0,
112 views::GridLayout::FIXED, width, width); 122 views::GridLayout::FIXED, width, width);
113 return layout; 123 return layout;
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 gfx::Rect bounds(title_view_->GetPreferredSize()); 267 gfx::Rect bounds(title_view_->GetPreferredSize());
258 title_view_->SetBoundsRect(bounds); 268 title_view_->SetBoundsRect(bounds);
259 bounds.Offset(kTitleViewNativeWidgetOffset, kTitleViewNativeWidgetOffset); 269 bounds.Offset(kTitleViewNativeWidgetOffset, kTitleViewNativeWidgetOffset);
260 title_widget_->SetBounds(bounds); 270 title_widget_->SetBounds(bounds);
261 } 271 }
262 272
263 } // namespace 273 } // namespace
264 274
265 // RightAlignedIconLabelButton ------------------------------------------------- 275 // RightAlignedIconLabelButton -------------------------------------------------
266 276
267 // A custom LabelButton that has a centered text and right aligned icon. 277 // A custom LabelButton that has a left-aligned text and right aligned icon.
278 // For non-material-design user menu, it has centered text instead.
268 class RightAlignedIconLabelButton : public views::LabelButton { 279 class RightAlignedIconLabelButton : public views::LabelButton {
269 public: 280 public:
270 RightAlignedIconLabelButton(views::ButtonListener* listener, 281 RightAlignedIconLabelButton(views::ButtonListener* listener,
271 const base::string16& text) 282 const base::string16& text)
272 : views::LabelButton(listener, text) { 283 : views::LabelButton(listener, text) {
273 SetHorizontalAlignment(gfx::ALIGN_RIGHT); 284 SetHorizontalAlignment(gfx::ALIGN_RIGHT);
274 label()->SetHorizontalAlignment(gfx::ALIGN_CENTER); 285 label()->SetHorizontalAlignment(switches::IsMaterialDesignUserMenu()
286 ? gfx::ALIGN_LEFT
287 : gfx::ALIGN_CENTER);
275 } 288 }
276 289
277 protected: 290 protected:
278 void Layout() override { 291 void Layout() override {
279 views::LabelButton::Layout(); 292 views::LabelButton::Layout();
280 293
281 // Keep the text centered and the icon right-aligned by stretching the label 294 // Keep the text centered and the icon right-aligned by stretching the label
282 // to take up more of the content area and centering its contents. 295 // to take up more of the content area and centering its contents.
283 gfx::Rect content_bounds = GetContentsBounds(); 296 gfx::Rect content_bounds = GetContentsBounds();
284 gfx::Rect label_bounds = label()->bounds(); 297 gfx::Rect label_bounds = label()->bounds();
285 label_bounds.Inset(content_bounds.x() - label_bounds.x(), 0, 0, 0); 298 label_bounds.Inset(content_bounds.x() - label_bounds.x(), 0, 0, 0);
286 label()->SetBoundsRect(label_bounds); 299 label()->SetBoundsRect(label_bounds);
287 } 300 }
288 301
289 private: 302 private:
290 void OnFocus() override { 303 void OnFocus() override {
291 SetState(STATE_HOVERED); 304 SetState(STATE_HOVERED);
292 } 305 }
293 306
294 void OnBlur() override { 307 void OnBlur() override {
295 SetState(STATE_NORMAL); 308 SetState(STATE_NORMAL);
296 } 309 }
297 310
298 DISALLOW_COPY_AND_ASSIGN(RightAlignedIconLabelButton); 311 DISALLOW_COPY_AND_ASSIGN(RightAlignedIconLabelButton);
299 }; 312 };
300 313
301 // EditableProfilePhoto ------------------------------------------------- 314 // EditableProfilePhoto -------------------------------------------------
302 315
316 const size_t kProfileBadgeWhitePadding = 2;
317
303 // A custom Image control that shows a "change" button when moused over. 318 // A custom Image control that shows a "change" button when moused over.
304 class EditableProfilePhoto : public views::LabelButton { 319 class EditableProfilePhoto : public views::LabelButton {
305 public: 320 public:
306 EditableProfilePhoto(views::ButtonListener* listener, 321 EditableProfilePhoto(views::ButtonListener* listener,
307 const gfx::Image& icon, 322 const gfx::Image& icon,
308 bool is_editing_allowed, 323 bool is_editing_allowed,
309 const gfx::Rect& bounds) 324 Profile* profile)
310 : views::LabelButton(listener, base::string16()), 325 : views::LabelButton(listener, base::string16()),
311 photo_overlay_(NULL) { 326 photo_overlay_(nullptr),
327 profile_(profile) {
312 gfx::Image image = profiles::GetSizedAvatarIcon( 328 gfx::Image image = profiles::GetSizedAvatarIcon(
313 icon, true, kLargeImageSide, kLargeImageSide); 329 icon, true, icon_image_side(), icon_image_side());
314 SetImage(views::LabelButton::STATE_NORMAL, *image.ToImageSkia()); 330 SetImage(views::LabelButton::STATE_NORMAL, *image.ToImageSkia());
315 SetBorder(views::Border::NullBorder()); 331 SetBorder(views::Border::NullBorder());
316 SetBoundsRect(bounds); 332 if (switches::IsMaterialDesignUserMenu()) {
333 SetMinSize(gfx::Size(GetPreferredSize().width() + badge_spacing(),
334 GetPreferredSize().height() + badge_spacing() +
335 views::kRelatedControlSmallVerticalSpacing));
336 } else {
337 SetSize(GetPreferredSize());
338 }
317 339
318 // Calculate the circular mask that will be used to display the photo. 340 // Calculate the circular mask that will be used to display the photo.
319 circular_mask_.addCircle(SkIntToScalar(bounds.width() / 2), 341 circular_mask_.addCircle(
320 SkIntToScalar(bounds.height() / 2), 342 SkIntToScalar(icon_image_side() / 2),
321 SkIntToScalar(bounds.width() / 2)); 343 SkIntToScalar(icon_image_side() / 2) + badge_spacing(),
344 SkIntToScalar(icon_image_side() / 2));
322 345
323 if (!is_editing_allowed) { 346 if (!is_editing_allowed) {
324 SetEnabled(false); 347 SetEnabled(false);
325 return; 348 return;
326 } 349 }
327 350
328 set_notify_enter_exit_on_child(true); 351 set_notify_enter_exit_on_child(true);
329 352
330 // Photo overlay that appears when hovering over the button. 353 // Photo overlay that appears when hovering over the button.
331 photo_overlay_ = new views::ImageView(); 354 photo_overlay_ = new views::ImageView();
332 355
333 const SkColor kBackgroundColor = SkColorSetARGB(65, 255, 255, 255); 356 const SkColor kBackgroundColor = SkColorSetARGB(65, 255, 255, 255);
334 photo_overlay_->set_background( 357 photo_overlay_->set_background(
335 views::Background::CreateSolidBackground(kBackgroundColor)); 358 views::Background::CreateSolidBackground(kBackgroundColor));
336 photo_overlay_->SetImage(gfx::CreateVectorIcon( 359 photo_overlay_->SetImage(
337 gfx::VectorIconId::PHOTO_CAMERA, 48u, SkColorSetRGB(0x33, 0x33, 0x33))); 360 gfx::CreateVectorIcon(gfx::VectorIconId::PHOTO_CAMERA,
361 switches::IsMaterialDesignUserMenu() ? 22u : 48u,
362 SkColorSetRGB(0x33, 0x33, 0x33)));
338 363
339 photo_overlay_->SetSize(bounds.size()); 364 photo_overlay_->SetSize(gfx::Size(icon_image_side(), icon_image_side()));
365 photo_overlay_->SetY(badge_spacing());
340 photo_overlay_->SetVisible(false); 366 photo_overlay_->SetVisible(false);
341 AddChildView(photo_overlay_); 367 AddChildView(photo_overlay_);
342 } 368 }
343 369
344 void OnPaint(gfx::Canvas* canvas) override { 370 void OnPaint(gfx::Canvas* canvas) override {
371 canvas->Save();
345 // Display the profile picture as a circle. 372 // Display the profile picture as a circle.
346 canvas->ClipPath(circular_mask_, true); 373 canvas->ClipPath(circular_mask_, true);
347 views::LabelButton::OnPaint(canvas); 374 views::LabelButton::OnPaint(canvas);
375 canvas->Restore();
348 } 376 }
349 377
350 void PaintChildren(const ui::PaintContext& context) override { 378 void PaintChildren(const ui::PaintContext& context) override {
351 // Display any children (the "change photo" overlay) as a circle. 379 // Display any children (the "change photo" overlay) as a circle.
352 ui::ClipRecorder clip_recorder(context); 380 {
353 clip_recorder.ClipPathWithAntiAliasing(circular_mask_); 381 ui::ClipRecorder clip_recorder(context);
354 View::PaintChildren(context); 382 clip_recorder.ClipPathWithAntiAliasing(circular_mask_);
383 View::PaintChildren(context);
384 }
385
386 ui::PaintRecorder paint_recorder(
387 context, gfx::Size(GetProfileBadgeSize(), GetProfileBadgeSize()));
388 gfx::Canvas* canvas = paint_recorder.canvas();
389 if (profile_->IsSupervised()) {
390 gfx::VectorIconId icon_id;
391 size_t icon_size;
392 // TODO(janeliulwq): Replace the following two profile badge icons when
393 // new versions of them are ready, which be inverted as silhouettes. Also,
394 // remove the code below for painting the background for the badges as
395 // they won't be necessary.
396 if (profile_->IsChild()) {
397 icon_id = gfx::VectorIconId::ACCOUNT_CHILD_INVERT;
398 icon_size = switches::IsMaterialDesignUserMenu() ? 21 : 26;
399 } else {
400 icon_id = gfx::VectorIconId::SUPERVISOR_ACCOUNT;
401 icon_size = switches::IsMaterialDesignUserMenu() ? 16 : 20;
402 }
403 gfx::Rect bounds(0, 0, GetProfileBadgeSize(), GetProfileBadgeSize());
404
405 int badge_offset =
406 icon_image_side() + badge_spacing() - GetProfileBadgeSize();
407 gfx::Vector2d badge_offset_vector = gfx::Vector2d(
408 badge_offset,
409 badge_offset + (switches::IsMaterialDesignUserMenu()
410 ? views::kRelatedControlSmallVerticalSpacing
411 : 0));
412 gfx::Point center_point = bounds.CenterPoint() + badge_offset_vector;
413
414 SkPaint paint;
415 paint.setAntiAlias(true);
416 paint.setColor(GetNativeTheme()->GetSystemColor(
417 ui::NativeTheme::kColorId_BubbleBackground));
418 canvas->DrawCircle(center_point, GetProfileBadgeSize() / 2, paint);
419
420 if (!switches::IsMaterialDesignUserMenu()) {
421 paint.setColor(SkColorSetRGB(0xaf, 0xd9, 0xfc));
422 canvas->DrawCircle(
423 center_point, GetProfileBadgeSize() / 2 - kProfileBadgeWhitePadding,
424 paint);
425 }
426
427 int offset = (GetProfileBadgeSize() - icon_size) / 2;
428 canvas->Translate(badge_offset_vector + gfx::Vector2d(offset, offset));
429 const SkColor badge_color = switches::IsMaterialDesignUserMenu()
430 ? gfx::kChromeIconGrey
431 : SkColorSetRGB(0, 0x66, 0xff);
432 gfx::PaintVectorIcon(canvas, icon_id, icon_size, badge_color);
433 }
434 }
435
436 static int icon_image_side() {
437 return switches::IsMaterialDesignUserMenu() ? kMdImageSide
438 : kLargeImageSide;
439 }
440
441 static int badge_spacing() {
Evan Stade 2016/06/30 14:36:45 can you document the meaning of this one?
Jane 2016/06/30 14:47:34 Done.
442 return switches::IsMaterialDesignUserMenu() ? 4 : 0;
355 } 443 }
356 444
357 private: 445 private:
358 // views::CustomButton: 446 // views::CustomButton:
359 void StateChanged() override { 447 void StateChanged() override {
360 bool show_overlay = 448 bool show_overlay =
361 (state() == STATE_PRESSED || state() == STATE_HOVERED || HasFocus()); 449 (state() == STATE_PRESSED || state() == STATE_HOVERED || HasFocus());
362 if (photo_overlay_) 450 if (photo_overlay_)
363 photo_overlay_->SetVisible(show_overlay); 451 photo_overlay_->SetVisible(show_overlay);
364 } 452 }
(...skipping 10 matching lines...) Expand all
375 if (photo_overlay_ && state() != STATE_HOVERED) 463 if (photo_overlay_ && state() != STATE_HOVERED)
376 photo_overlay_->SetVisible(false); 464 photo_overlay_->SetVisible(false);
377 } 465 }
378 466
379 gfx::Path circular_mask_; 467 gfx::Path circular_mask_;
380 468
381 // Image that is shown when hovering over the image button. Can be NULL if 469 // Image that is shown when hovering over the image button. Can be NULL if
382 // the photo isn't allowed to be edited (e.g. for guest profiles). 470 // the photo isn't allowed to be edited (e.g. for guest profiles).
383 views::ImageView* photo_overlay_; 471 views::ImageView* photo_overlay_;
384 472
473 Profile* profile_;
474
385 DISALLOW_COPY_AND_ASSIGN(EditableProfilePhoto); 475 DISALLOW_COPY_AND_ASSIGN(EditableProfilePhoto);
386 }; 476 };
387 477
388 // EditableProfileName ------------------------------------------------- 478 // EditableProfileName -------------------------------------------------
389 479
390 // A custom text control that turns into a textfield for editing when clicked. 480 // A custom text control that turns into a textfield for editing when clicked.
391 class EditableProfileName : public views::View, 481 class EditableProfileName : public views::View,
392 public views::ButtonListener { 482 public views::ButtonListener {
393 public: 483 public:
394 EditableProfileName(views::TextfieldController* controller, 484 EditableProfileName(views::TextfieldController* controller,
395 const base::string16& text, 485 const base::string16& text,
396 bool is_editing_allowed) 486 bool is_editing_allowed)
397 : button_(nullptr), label_(nullptr), profile_name_textfield_(nullptr) { 487 : button_(nullptr), profile_name_textfield_(nullptr) {
398 SetLayoutManager( 488 SetLayoutManager(
399 new views::BoxLayout(views::BoxLayout::kVertical, 0, 0, 0)); 489 new views::BoxLayout(views::BoxLayout::kVertical, 0, 0, 0));
400 490
401 ui::ResourceBundle* rb = &ui::ResourceBundle::GetSharedInstance(); 491 ui::ResourceBundle* rb = &ui::ResourceBundle::GetSharedInstance();
402 const gfx::FontList& medium_font_list = 492 const gfx::FontList& medium_font_list =
403 rb->GetFontList(ui::ResourceBundle::MediumFont); 493 rb->GetFontList(ui::ResourceBundle::MediumFont);
494 const gfx::Insets textfield_border_insets =
495 views::Textfield().border()->GetInsets();
404 496
405 if (!is_editing_allowed) { 497 if (!is_editing_allowed) {
406 label_ = new views::Label(text); 498 views::Label* name_label = new views::Label(text);
407 label_->SetBorder(views::Border::CreateEmptyBorder(2, 0, 2, 0)); 499 name_label->SetBorder(
408 label_->SetFontList(medium_font_list); 500 views::Border::CreateEmptyBorder(textfield_border_insets));
409 AddChildView(label_); 501 name_label->SetFontList(medium_font_list);
502 if (switches::IsMaterialDesignUserMenu())
503 name_label->SetHorizontalAlignment(gfx::ALIGN_LEFT);
504 AddChildView(name_label);
410 return; 505 return;
411 } 506 }
412 507
508 profile_name_textfield_ = new views::Textfield();
509 // Textfield that overlaps the button.
510 profile_name_textfield_->set_controller(controller);
511 profile_name_textfield_->SetFontList(medium_font_list);
512 profile_name_textfield_->SetHorizontalAlignment(
513 switches::IsMaterialDesignUserMenu() ? gfx::ALIGN_LEFT
514 : gfx::ALIGN_CENTER);
515 profile_name_textfield_->SetVisible(false);
516 AddChildView(profile_name_textfield_);
517
413 button_ = new RightAlignedIconLabelButton(this, text); 518 button_ = new RightAlignedIconLabelButton(this, text);
414 button_->SetFontList(medium_font_list); 519 button_->SetFontList(medium_font_list);
415 // Show an "edit" pencil icon when hovering over. In the default state, 520 // Show an "edit" pencil icon when hovering over. In the default state,
416 // we need to create an empty placeholder of the correct size, so that 521 // we need to create an empty placeholder of the correct size, so that
417 // the text doesn't jump around when the hovered icon appears. 522 // the text doesn't jump around when the hovered icon appears.
418 // TODO(estade): revisit colors and press effect. 523 // TODO(estade): revisit colors and press effect.
419 const int kIconSize = 16; 524 const int kIconSize = 16;
420 button_->SetImage(views::LabelButton::STATE_NORMAL, 525 button_->SetImage(views::LabelButton::STATE_NORMAL,
421 CreateSquarePlaceholderImage(kIconSize)); 526 CreateSquarePlaceholderImage(kIconSize));
422 button_->SetImage(views::LabelButton::STATE_HOVERED, 527 button_->SetImage(views::LabelButton::STATE_HOVERED,
423 gfx::CreateVectorIcon( 528 gfx::CreateVectorIcon(
424 gfx::VectorIconId::MODE_EDIT, kIconSize, 529 gfx::VectorIconId::MODE_EDIT, kIconSize,
425 SkColorSetRGB(0x33, 0x33, 0x33))); 530 SkColorSetRGB(0x33, 0x33, 0x33)));
426 button_->SetImage(views::LabelButton::STATE_PRESSED, 531 button_->SetImage(views::LabelButton::STATE_PRESSED,
427 gfx::CreateVectorIcon( 532 gfx::CreateVectorIcon(
428 gfx::VectorIconId::MODE_EDIT, kIconSize, 533 gfx::VectorIconId::MODE_EDIT, kIconSize,
429 SkColorSetRGB(0x20, 0x20, 0x20))); 534 SkColorSetRGB(0x20, 0x20, 0x20)));
430 // To center the text, we need to offest it by the width of the icon we 535 // We need to add a left padding as well as a small top/bottom padding
431 // are adding and its padding. We need to also add a small top/bottom 536 // to the text to account for the textfield's border.
432 // padding to account for the textfield's border. 537 if (switches::IsMaterialDesignUserMenu()) {
433 const int kIconTextLabelButtonSpacing = 5; 538 button_->SetBorder(views::Border::CreateEmptyBorder(
434 button_->SetBorder(views::Border::CreateEmptyBorder( 539 textfield_border_insets +
435 2, kIconSize + kIconTextLabelButtonSpacing, 2, 0)); 540 gfx::Insets(0, profile_name_textfield_->GetInsets().left(), 0, 0)));
541 } else {
542 const int kIconTextLabelButtonSpacing = 5;
543 button_->SetBorder(views::Border::CreateEmptyBorder(
544 textfield_border_insets +
545 gfx::Insets(0, kIconSize + kIconTextLabelButtonSpacing, 0, 0)));
546 }
436 AddChildView(button_); 547 AddChildView(button_);
437
438 profile_name_textfield_ = new views::Textfield();
439 // Textfield that overlaps the button.
440 profile_name_textfield_->set_controller(controller);
441 profile_name_textfield_->SetFontList(medium_font_list);
442 profile_name_textfield_->SetHorizontalAlignment(gfx::ALIGN_CENTER);
443 profile_name_textfield_->SetVisible(false);
444 AddChildView(profile_name_textfield_);
445 } 548 }
446 549
447 views::Textfield* profile_name_textfield() { 550 views::Textfield* profile_name_textfield() {
448 return profile_name_textfield_; 551 return profile_name_textfield_;
449 } 552 }
450 553
451 // Hide the editable textfield to show the profile name button instead. 554 // Hide the editable textfield to show the profile name button instead.
452 void ShowReadOnlyView() { 555 void ShowReadOnlyView() {
453 button_->SetVisible(true); 556 button_->SetVisible(true);
454 profile_name_textfield_->SetVisible(false); 557 profile_name_textfield_->SetVisible(false);
(...skipping 17 matching lines...) Expand all
472 // you press space and clicks it when you release space, as the space can be 575 // you press space and clicks it when you release space, as the space can be
473 // part of the new profile name typed in the textfield. 576 // part of the new profile name typed in the textfield.
474 return false; 577 return false;
475 } 578 }
476 579
477 // The label button which shows the profile name, and can handle the event to 580 // The label button which shows the profile name, and can handle the event to
478 // make it editable. Can be NULL if the profile name isn't allowed to be 581 // make it editable. Can be NULL if the profile name isn't allowed to be
479 // edited. 582 // edited.
480 RightAlignedIconLabelButton* button_; 583 RightAlignedIconLabelButton* button_;
481 584
482 // The label which shows when the profile name cannot be edited (e.g. for
483 // supervised user). Can be NULL if the profile name is allowed to be edited.
484 views::Label* label_;
485
486 // Textfield that is shown when editing the profile name. Can be NULL if 585 // Textfield that is shown when editing the profile name. Can be NULL if
487 // the profile name isn't allowed to be edited (e.g. for guest profiles). 586 // the profile name isn't allowed to be edited (e.g. for guest profiles).
488 views::Textfield* profile_name_textfield_; 587 views::Textfield* profile_name_textfield_;
489 588
490 DISALLOW_COPY_AND_ASSIGN(EditableProfileName); 589 DISALLOW_COPY_AND_ASSIGN(EditableProfileName);
491 }; 590 };
492 591
493 // A title card with one back button right aligned and one label center aligned. 592 // A title card with one back button right aligned and one label center aligned.
494 class TitleCard : public views::View { 593 class TitleCard : public views::View {
495 public: 594 public:
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
556 back_button_->GetPreferredSize().height()); 655 back_button_->GetPreferredSize().height());
557 return gfx::Size(width(), height); 656 return gfx::Size(width(), height);
558 } 657 }
559 658
560 views::ImageButton* back_button_; 659 views::ImageButton* back_button_;
561 views::Label* title_label_; 660 views::Label* title_label_;
562 661
563 DISALLOW_COPY_AND_ASSIGN(TitleCard); 662 DISALLOW_COPY_AND_ASSIGN(TitleCard);
564 }; 663 };
565 664
566 // ProfileBadge --------------------------------------------------------
567
568 const size_t kProfileBadgeSize = 30;
569 const size_t kProfileBadgeWhitePadding = 2;
570
571 // Draws a white circle, then a light blue circle, then a dark blue icon.
572 class ProfileBadge : public gfx::CanvasImageSource {
573 public:
574 ProfileBadge(gfx::VectorIconId id, size_t icon_size)
575 : CanvasImageSource(gfx::Size(kProfileBadgeSize, kProfileBadgeSize),
576 false),
577 id_(id),
578 icon_size_(icon_size) {}
579
580 ~ProfileBadge() override {}
581
582 // CanvasImageSource:
583 void Draw(gfx::Canvas* canvas) override {
584 const SkISize size = canvas->sk_canvas()->getBaseLayerSize();
585 gfx::Rect bounds(0, 0, size.width(), size.height());
586
587 SkPaint paint;
588 paint.setAntiAlias(true);
589 paint.setColor(SK_ColorWHITE);
590 canvas->DrawCircle(bounds.CenterPoint(), size.width() / 2, paint);
591
592 paint.setColor(SkColorSetRGB(0xAF, 0xD9, 0xFC));
593 canvas->DrawCircle(bounds.CenterPoint(),
594 size.width() / 2 - kProfileBadgeWhitePadding, paint);
595
596 int offset = (kProfileBadgeSize - icon_size_) / 2;
597 canvas->Translate(gfx::Vector2d(offset, offset));
598 gfx::PaintVectorIcon(canvas, id_, icon_size_, SkColorSetRGB(0, 0x66, 0xff));
599 }
600
601 private:
602 const gfx::VectorIconId id_;
603 const size_t icon_size_;
604
605 DISALLOW_COPY_AND_ASSIGN(ProfileBadge);
606 };
607
608 gfx::ImageSkia CreateBadgeForProfile(Profile* profile) {
609 ProfileBadge* badge =
610 profile->IsChild()
611 ? new ProfileBadge(gfx::VectorIconId::ACCOUNT_CHILD_INVERT, 26)
612 : new ProfileBadge(gfx::VectorIconId::SUPERVISOR_ACCOUNT, 20);
613
614 return gfx::ImageSkia(badge, badge->size());
615 }
616
617 // ProfileChooserView --------------------------------------------------------- 665 // ProfileChooserView ---------------------------------------------------------
618 666
619 // static 667 // static
620 ProfileChooserView* ProfileChooserView::profile_bubble_ = nullptr; 668 ProfileChooserView* ProfileChooserView::profile_bubble_ = nullptr;
621 bool ProfileChooserView::close_on_deactivate_for_testing_ = true; 669 bool ProfileChooserView::close_on_deactivate_for_testing_ = true;
622 670
623 // static 671 // static
624 void ProfileChooserView::ShowBubble( 672 void ProfileChooserView::ShowBubble(
625 profiles::BubbleViewMode view_mode, 673 profiles::BubbleViewMode view_mode,
626 profiles::TutorialMode tutorial_mode, 674 profiles::TutorialMode tutorial_mode,
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
661 bool ProfileChooserView::IsShowing() { 709 bool ProfileChooserView::IsShowing() {
662 return profile_bubble_ != NULL; 710 return profile_bubble_ != NULL;
663 } 711 }
664 712
665 // static 713 // static
666 void ProfileChooserView::Hide() { 714 void ProfileChooserView::Hide() {
667 if (IsShowing()) 715 if (IsShowing())
668 profile_bubble_->GetWidget()->Close(); 716 profile_bubble_->GetWidget()->Close();
669 } 717 }
670 718
719 // static
720 int ProfileChooserView::GetFixedMenuWidth() {
721 return switches::IsMaterialDesignUserMenu() ? 240 : 250;
722 }
723
671 ProfileChooserView::ProfileChooserView(views::View* anchor_view, 724 ProfileChooserView::ProfileChooserView(views::View* anchor_view,
672 Browser* browser, 725 Browser* browser,
673 profiles::BubbleViewMode view_mode, 726 profiles::BubbleViewMode view_mode,
674 profiles::TutorialMode tutorial_mode, 727 profiles::TutorialMode tutorial_mode,
675 signin::GAIAServiceType service_type, 728 signin::GAIAServiceType service_type,
676 signin_metrics::AccessPoint access_point) 729 signin_metrics::AccessPoint access_point)
677 : BubbleDialogDelegateView(anchor_view, views::BubbleBorder::TOP_RIGHT), 730 : BubbleDialogDelegateView(anchor_view, views::BubbleBorder::TOP_RIGHT),
678 browser_(browser), 731 browser_(browser),
679 view_mode_(view_mode), 732 view_mode_(view_mode),
680 tutorial_mode_(tutorial_mode), 733 tutorial_mode_(tutorial_mode),
(...skipping 10 matching lines...) Expand all
691 ProfileOAuth2TokenServiceFactory::GetForProfile(browser_->profile()); 744 ProfileOAuth2TokenServiceFactory::GetForProfile(browser_->profile());
692 if (oauth2_token_service) 745 if (oauth2_token_service)
693 oauth2_token_service->RemoveObserver(this); 746 oauth2_token_service->RemoveObserver(this);
694 } 747 }
695 748
696 void ProfileChooserView::ResetView() { 749 void ProfileChooserView::ResetView() {
697 open_other_profile_indexes_map_.clear(); 750 open_other_profile_indexes_map_.clear();
698 delete_account_button_map_.clear(); 751 delete_account_button_map_.clear();
699 reauth_account_button_map_.clear(); 752 reauth_account_button_map_.clear();
700 manage_accounts_link_ = nullptr; 753 manage_accounts_link_ = nullptr;
701 signin_current_profile_link_ = nullptr; 754 signin_current_profile_button_ = nullptr;
702 auth_error_email_button_ = nullptr; 755 auth_error_email_button_ = nullptr;
703 current_profile_photo_ = nullptr; 756 current_profile_photo_ = nullptr;
704 current_profile_name_ = nullptr; 757 current_profile_name_ = nullptr;
705 guest_profile_button_ = nullptr; 758 guest_profile_button_ = nullptr;
706 users_button_ = nullptr; 759 users_button_ = nullptr;
707 go_incognito_button_ = nullptr; 760 go_incognito_button_ = nullptr;
708 lock_button_ = nullptr; 761 lock_button_ = nullptr;
709 close_all_windows_button_ = nullptr; 762 close_all_windows_button_ = nullptr;
710 add_account_link_ = nullptr; 763 add_account_link_ = nullptr;
711 gaia_signin_cancel_button_ = nullptr; 764 gaia_signin_cancel_button_ = nullptr;
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
838 break; 891 break;
839 case profiles::BUBBLE_VIEW_MODE_SWITCH_USER: 892 case profiles::BUBBLE_VIEW_MODE_SWITCH_USER:
840 layout = CreateSingleColumnLayout(this, kFixedSwitchUserViewWidth); 893 layout = CreateSingleColumnLayout(this, kFixedSwitchUserViewWidth);
841 sub_view = CreateSwitchUserView(); 894 sub_view = CreateSwitchUserView();
842 ProfileMetrics::LogProfileNewAvatarMenuNotYou( 895 ProfileMetrics::LogProfileNewAvatarMenuNotYou(
843 ProfileMetrics::PROFILE_AVATAR_MENU_NOT_YOU_VIEW); 896 ProfileMetrics::PROFILE_AVATAR_MENU_NOT_YOU_VIEW);
844 break; 897 break;
845 case profiles::BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT: 898 case profiles::BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT:
846 case profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER: 899 case profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER:
847 case profiles::BUBBLE_VIEW_MODE_FAST_PROFILE_CHOOSER: 900 case profiles::BUBBLE_VIEW_MODE_FAST_PROFILE_CHOOSER:
848 layout = CreateSingleColumnLayout(this, kFixedMenuWidth); 901 layout = CreateSingleColumnLayout(this, GetFixedMenuWidth());
849 sub_view = CreateProfileChooserView(avatar_menu); 902 sub_view = CreateProfileChooserView(avatar_menu);
850 break; 903 break;
851 } 904 }
852 // Clears tutorial mode for all non-profile-chooser views. 905 // Clears tutorial mode for all non-profile-chooser views.
853 if (view_mode_ != profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER) 906 if (view_mode_ != profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER)
854 tutorial_mode_ = profiles::TUTORIAL_MODE_NONE; 907 tutorial_mode_ = profiles::TUTORIAL_MODE_NONE;
855 908
856 layout->StartRow(1, 0); 909 layout->StartRow(1, 0);
857 layout->AddView(sub_view); 910 layout->AddView(sub_view);
858 Layout(); 911 Layout();
(...skipping 26 matching lines...) Expand all
885 if (accelerator.key_code() != ui::VKEY_DOWN && 938 if (accelerator.key_code() != ui::VKEY_DOWN &&
886 accelerator.key_code() != ui::VKEY_UP) 939 accelerator.key_code() != ui::VKEY_UP)
887 return BubbleDialogDelegateView::AcceleratorPressed(accelerator); 940 return BubbleDialogDelegateView::AcceleratorPressed(accelerator);
888 941
889 // Move the focus up or down. 942 // Move the focus up or down.
890 GetFocusManager()->AdvanceFocus(accelerator.key_code() != ui::VKEY_DOWN); 943 GetFocusManager()->AdvanceFocus(accelerator.key_code() != ui::VKEY_DOWN);
891 return true; 944 return true;
892 } 945 }
893 946
894 views::View* ProfileChooserView::GetInitiallyFocusedView() { 947 views::View* ProfileChooserView::GetInitiallyFocusedView() {
895 return signin_current_profile_link_; 948 return signin_current_profile_button_;
896 } 949 }
897 950
898 int ProfileChooserView::GetDialogButtons() const { 951 int ProfileChooserView::GetDialogButtons() const {
899 return ui::DIALOG_BUTTON_NONE; 952 return ui::DIALOG_BUTTON_NONE;
900 } 953 }
901 954
902 bool ProfileChooserView::HandleContextMenu( 955 bool ProfileChooserView::HandleContextMenu(
903 const content::ContextMenuParams& params) { 956 const content::ContextMenuParams& params) {
904 // Suppresses the context menu because some features, such as inspecting 957 // Suppresses the context menu because some features, such as inspecting
905 // elements, are not appropriate in a bubble. 958 // elements, are not appropriate in a bubble.
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
961 bool account_management_available = 1014 bool account_management_available =
962 SigninManagerFactory::GetForProfile(browser_->profile())-> 1015 SigninManagerFactory::GetForProfile(browser_->profile())->
963 IsAuthenticated() && 1016 IsAuthenticated() &&
964 switches::IsEnableAccountConsistency(); 1017 switches::IsEnableAccountConsistency();
965 ShowViewFromMode(account_management_available ? 1018 ShowViewFromMode(account_management_available ?
966 profiles::BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT : 1019 profiles::BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT :
967 profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER); 1020 profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER);
968 } else if (sender == current_profile_photo_) { 1021 } else if (sender == current_profile_photo_) {
969 avatar_menu_->EditProfile(avatar_menu_->GetActiveProfileIndex()); 1022 avatar_menu_->EditProfile(avatar_menu_->GetActiveProfileIndex());
970 PostActionPerformed(ProfileMetrics::PROFILE_DESKTOP_MENU_EDIT_IMAGE); 1023 PostActionPerformed(ProfileMetrics::PROFILE_DESKTOP_MENU_EDIT_IMAGE);
971 } else if (sender == signin_current_profile_link_) { 1024 } else if (sender == signin_current_profile_button_) {
972 ShowViewFromMode(profiles::BUBBLE_VIEW_MODE_GAIA_SIGNIN); 1025 ShowViewFromMode(profiles::BUBBLE_VIEW_MODE_GAIA_SIGNIN);
973 } else if (sender == add_person_button_) { 1026 } else if (sender == add_person_button_) {
974 ProfileMetrics::LogProfileNewAvatarMenuNotYou( 1027 ProfileMetrics::LogProfileNewAvatarMenuNotYou(
975 ProfileMetrics::PROFILE_AVATAR_MENU_NOT_YOU_ADD_PERSON); 1028 ProfileMetrics::PROFILE_AVATAR_MENU_NOT_YOU_ADD_PERSON);
976 UserManager::Show(base::FilePath(), 1029 UserManager::Show(base::FilePath(),
977 profiles::USER_MANAGER_NO_TUTORIAL, 1030 profiles::USER_MANAGER_NO_TUTORIAL,
978 profiles::USER_MANAGER_SELECT_PROFILE_NO_ACTION); 1031 profiles::USER_MANAGER_SELECT_PROFILE_NO_ACTION);
979 } else if (sender == disconnect_button_) { 1032 } else if (sender == disconnect_button_) {
980 ProfileMetrics::LogProfileNewAvatarMenuNotYou( 1033 ProfileMetrics::LogProfileNewAvatarMenuNotYou(
981 ProfileMetrics::PROFILE_AVATAR_MENU_NOT_YOU_DISCONNECT); 1034 ProfileMetrics::PROFILE_AVATAR_MENU_NOT_YOU_DISCONNECT);
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
1099 views::View* tutorial_view = NULL; 1152 views::View* tutorial_view = NULL;
1100 views::View* current_profile_view = NULL; 1153 views::View* current_profile_view = NULL;
1101 views::View* current_profile_accounts = NULL; 1154 views::View* current_profile_accounts = NULL;
1102 views::View* option_buttons_view = NULL; 1155 views::View* option_buttons_view = NULL;
1103 for (size_t i = 0; i < avatar_menu->GetNumberOfItems(); ++i) { 1156 for (size_t i = 0; i < avatar_menu->GetNumberOfItems(); ++i) {
1104 const AvatarMenu::Item& item = avatar_menu->GetItemAt(i); 1157 const AvatarMenu::Item& item = avatar_menu->GetItemAt(i);
1105 if (item.active) { 1158 if (item.active) {
1106 option_buttons_view = CreateOptionsView( 1159 option_buttons_view = CreateOptionsView(
1107 item.signed_in && profiles::IsLockAvailable(browser_->profile()), 1160 item.signed_in && profiles::IsLockAvailable(browser_->profile()),
1108 avatar_menu); 1161 avatar_menu);
1109 current_profile_view = CreateCurrentProfileView(item, false); 1162 current_profile_view =
1163 switches::IsMaterialDesignUserMenu()
1164 ? CreateMaterialDesignCurrentProfileView(item, false)
1165 : CreateCurrentProfileView(item, false);
1110 if (IsProfileChooser(view_mode_)) { 1166 if (IsProfileChooser(view_mode_)) {
1111 tutorial_view = CreateTutorialViewIfNeeded(item); 1167 tutorial_view = CreateTutorialViewIfNeeded(item);
1112 } else { 1168 } else {
1113 current_profile_accounts = CreateCurrentProfileAccountsView(item); 1169 current_profile_accounts = CreateCurrentProfileAccountsView(item);
1114 } 1170 }
1115 } else { 1171 } else {
1116 other_profiles.push_back(i); 1172 other_profiles.push_back(i);
1117 } 1173 }
1118 } 1174 }
1119 1175
(...skipping 16 matching lines...) Expand all
1136 1192
1137 if (!IsProfileChooser(view_mode_)) { 1193 if (!IsProfileChooser(view_mode_)) {
1138 DCHECK(current_profile_accounts); 1194 DCHECK(current_profile_accounts);
1139 layout->StartRow(0, 0); 1195 layout->StartRow(0, 0);
1140 layout->AddView(new views::Separator(views::Separator::HORIZONTAL)); 1196 layout->AddView(new views::Separator(views::Separator::HORIZONTAL));
1141 layout->StartRow(1, 0); 1197 layout->StartRow(1, 0);
1142 layout->AddView(current_profile_accounts); 1198 layout->AddView(current_profile_accounts);
1143 } 1199 }
1144 1200
1145 if (browser_->profile()->IsSupervised()) { 1201 if (browser_->profile()->IsSupervised()) {
1146 layout->StartRow(0, 0); 1202 if (!switches::IsMaterialDesignUserMenu()) {
1147 layout->AddView(new views::Separator(views::Separator::HORIZONTAL)); 1203 layout->StartRow(0, 0);
1204 layout->AddView(new views::Separator(views::Separator::HORIZONTAL));
1205 }
1148 layout->StartRow(1, 0); 1206 layout->StartRow(1, 0);
1149 layout->AddView(CreateSupervisedUserDisclaimerView()); 1207 layout->AddView(CreateSupervisedUserDisclaimerView());
1150 } 1208 }
1151 1209
1152 layout->StartRow(0, 0); 1210 layout->StartRow(0, 0);
1153 layout->AddView(new views::Separator(views::Separator::HORIZONTAL)); 1211 layout->AddView(new views::Separator(views::Separator::HORIZONTAL));
1154 1212
1155 if (option_buttons_view) { 1213 if (option_buttons_view) {
1156 layout->StartRow(0, 0); 1214 layout->StartRow(0, 0);
1157 layout->AddView(option_buttons_view); 1215 layout->AddView(option_buttons_view);
(...skipping 11 matching lines...) Expand all
1169 } 1227 }
1170 } 1228 }
1171 1229
1172 layout->StartRow(1, 0); 1230 layout->StartRow(1, 0);
1173 layout->AddView(CreateOtherProfilesView(other_profiles)); 1231 layout->AddView(CreateOtherProfilesView(other_profiles));
1174 } 1232 }
1175 1233
1176 views::View* ProfileChooserView::CreateProfileChooserView( 1234 views::View* ProfileChooserView::CreateProfileChooserView(
1177 AvatarMenu* avatar_menu) { 1235 AvatarMenu* avatar_menu) {
1178 views::View* view = new views::View(); 1236 views::View* view = new views::View();
1179 views::GridLayout* layout = CreateSingleColumnLayout(view, kFixedMenuWidth); 1237 views::GridLayout* layout =
1238 CreateSingleColumnLayout(view, GetFixedMenuWidth());
1180 1239
1181 if (view_mode_ == profiles::BUBBLE_VIEW_MODE_FAST_PROFILE_CHOOSER) { 1240 if (view_mode_ == profiles::BUBBLE_VIEW_MODE_FAST_PROFILE_CHOOSER) {
1182 PopulateMinimalProfileChooserView(layout, avatar_menu); 1241 PopulateMinimalProfileChooserView(layout, avatar_menu);
1183 // The user is using right-click switching, no need to tell them about it. 1242 // The user is using right-click switching, no need to tell them about it.
1184 PrefService* local_state = g_browser_process->local_state(); 1243 PrefService* local_state = g_browser_process->local_state();
1185 local_state->SetBoolean( 1244 local_state->SetBoolean(
1186 prefs::kProfileAvatarRightClickTutorialDismissed, true); 1245 prefs::kProfileAvatarRightClickTutorialDismissed, true);
1187 } else { 1246 } else {
1188 PopulateCompleteProfileChooserView(layout, avatar_menu); 1247 PopulateCompleteProfileChooserView(layout, avatar_menu);
1189 } 1248 }
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
1244 const base::string16& button_text, 1303 const base::string16& button_text,
1245 bool stack_button, 1304 bool stack_button,
1246 views::Link** link, 1305 views::Link** link,
1247 views::LabelButton** button, 1306 views::LabelButton** button,
1248 views::ImageButton** close_button) { 1307 views::ImageButton** close_button) {
1249 tutorial_mode_ = tutorial_mode; 1308 tutorial_mode_ = tutorial_mode;
1250 1309
1251 views::View* view = new views::View(); 1310 views::View* view = new views::View();
1252 view->set_background(views::Background::CreateSolidBackground( 1311 view->set_background(views::Background::CreateSolidBackground(
1253 profiles::kAvatarTutorialBackgroundColor)); 1312 profiles::kAvatarTutorialBackgroundColor));
1254 views::GridLayout* layout = CreateSingleColumnLayout(view, 1313 views::GridLayout* layout = CreateSingleColumnLayout(
1255 kFixedMenuWidth - 2 * views::kButtonHEdgeMarginNew); 1314 view, GetFixedMenuWidth() - 2 * views::kButtonHEdgeMarginNew);
1256 // Creates a second column set for buttons and links. 1315 // Creates a second column set for buttons and links.
1257 views::ColumnSet* button_columns = layout->AddColumnSet(1); 1316 views::ColumnSet* button_columns = layout->AddColumnSet(1);
1258 button_columns->AddColumn(views::GridLayout::LEADING, 1317 button_columns->AddColumn(views::GridLayout::LEADING,
1259 views::GridLayout::CENTER, 0, views::GridLayout::USE_PREF, 0, 0); 1318 views::GridLayout::CENTER, 0, views::GridLayout::USE_PREF, 0, 0);
1260 button_columns->AddPaddingColumn( 1319 button_columns->AddPaddingColumn(
1261 1, views::kUnrelatedControlHorizontalSpacing); 1320 1, views::kUnrelatedControlHorizontalSpacing);
1262 button_columns->AddColumn(views::GridLayout::TRAILING, 1321 button_columns->AddColumn(views::GridLayout::TRAILING,
1263 views::GridLayout::CENTER, 0, views::GridLayout::USE_PREF, 0, 0); 1322 views::GridLayout::CENTER, 0, views::GridLayout::USE_PREF, 0, 0);
1264 layout->SetInsets(views::kButtonVEdgeMarginNew, 1323 layout->SetInsets(views::kButtonVEdgeMarginNew,
1265 views::kButtonHEdgeMarginNew, 1324 views::kButtonHEdgeMarginNew,
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
1347 layout->SkipColumns(1); 1406 layout->SkipColumns(1);
1348 } 1407 }
1349 1408
1350 return view; 1409 return view;
1351 } 1410 }
1352 1411
1353 views::View* ProfileChooserView::CreateCurrentProfileView( 1412 views::View* ProfileChooserView::CreateCurrentProfileView(
1354 const AvatarMenu::Item& avatar_item, 1413 const AvatarMenu::Item& avatar_item,
1355 bool is_guest) { 1414 bool is_guest) {
1356 views::View* view = new views::View(); 1415 views::View* view = new views::View();
1357 int column_width = kFixedMenuWidth - 2 * views::kButtonHEdgeMarginNew; 1416 int column_width = GetFixedMenuWidth() - 2 * views::kButtonHEdgeMarginNew;
1358 views::GridLayout* layout = CreateSingleColumnLayout(view, column_width); 1417 views::GridLayout* layout = CreateSingleColumnLayout(view, column_width);
1359 layout->SetInsets(views::kButtonVEdgeMarginNew, 1418 layout->SetInsets(views::kButtonVEdgeMarginNew,
1360 views::kButtonHEdgeMarginNew, 1419 views::kButtonHEdgeMarginNew,
1361 views::kUnrelatedControlVerticalSpacing, 1420 views::kUnrelatedControlVerticalSpacing,
1362 views::kButtonHEdgeMarginNew); 1421 views::kButtonHEdgeMarginNew);
1363 1422
1364 // Profile icon, centered. 1423 // Profile icon, centered.
1365 int x_offset = (column_width - kLargeImageSide) / 2; 1424 int x_offset = (column_width - kLargeImageSide) / 2;
1366 current_profile_photo_ = new EditableProfilePhoto( 1425 current_profile_photo_ = new EditableProfilePhoto(
1367 this, avatar_item.icon, !is_guest, 1426 this, avatar_item.icon, !is_guest, browser_->profile());
1368 gfx::Rect(x_offset, 0, kLargeImageSide, kLargeImageSide)); 1427 current_profile_photo_->SetX(x_offset);
1369 SizedContainer* profile_icon_container = 1428 SizedContainer* profile_icon_container =
1370 new SizedContainer(gfx::Size(column_width, kLargeImageSide)); 1429 new SizedContainer(gfx::Size(column_width, kLargeImageSide));
1371 profile_icon_container->AddChildView(current_profile_photo_); 1430 profile_icon_container->AddChildView(current_profile_photo_);
1372 1431
1373 if (browser_->profile()->IsSupervised()) {
1374 views::ImageView* supervised_icon = new views::ImageView();
1375 supervised_icon->SetImage(CreateBadgeForProfile(browser_->profile()));
1376 gfx::Size preferred_size = supervised_icon->GetPreferredSize();
1377 gfx::Rect parent_bounds = current_profile_photo_->bounds();
1378 supervised_icon->SetBounds(
1379 parent_bounds.right() - preferred_size.width(),
1380 parent_bounds.bottom() - preferred_size.height(),
1381 preferred_size.width(),
1382 preferred_size.height());
1383 profile_icon_container->AddChildView(supervised_icon);
1384 }
1385 1432
1386 layout->StartRow(1, 0); 1433 layout->StartRow(1, 0);
1387 layout->AddView(profile_icon_container); 1434 layout->AddView(profile_icon_container);
1388 1435
1389 // Profile name, centered. 1436 // Profile name, centered.
1390 bool editing_allowed = !is_guest && 1437 bool editing_allowed = !is_guest &&
1391 !browser_->profile()->IsLegacySupervised(); 1438 !browser_->profile()->IsLegacySupervised();
1392 current_profile_name_ = new EditableProfileName( 1439 current_profile_name_ = new EditableProfileName(
1393 this, 1440 this,
1394 profiles::GetAvatarNameForProfile(browser_->profile()->GetPath()), 1441 profiles::GetAvatarNameForProfile(browser_->profile()->GetPath()),
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
1445 if (signin_manager->IsSigninAllowed()) { 1492 if (signin_manager->IsSigninAllowed()) {
1446 views::Label* promo = new views::Label( 1493 views::Label* promo = new views::Label(
1447 l10n_util::GetStringUTF16(IDS_PROFILES_SIGNIN_PROMO)); 1494 l10n_util::GetStringUTF16(IDS_PROFILES_SIGNIN_PROMO));
1448 promo->SetMultiLine(true); 1495 promo->SetMultiLine(true);
1449 promo->SetHorizontalAlignment(gfx::ALIGN_LEFT); 1496 promo->SetHorizontalAlignment(gfx::ALIGN_LEFT);
1450 layout->StartRowWithPadding(1, 0, 0, 1497 layout->StartRowWithPadding(1, 0, 0,
1451 views::kRelatedControlSmallVerticalSpacing); 1498 views::kRelatedControlSmallVerticalSpacing);
1452 layout->StartRow(1, 0); 1499 layout->StartRow(1, 0);
1453 layout->AddView(promo); 1500 layout->AddView(promo);
1454 1501
1455 signin_current_profile_link_ = new views::BlueButton( 1502 signin_current_profile_button_ = new views::BlueButton(
1456 this, l10n_util::GetStringFUTF16(IDS_SYNC_START_SYNC_BUTTON_LABEL, 1503 this, l10n_util::GetStringFUTF16(
1457 l10n_util::GetStringUTF16(IDS_SHORT_PRODUCT_NAME))); 1504 IDS_SYNC_START_SYNC_BUTTON_LABEL,
1505 l10n_util::GetStringUTF16(IDS_SHORT_PRODUCT_NAME)));
1458 layout->StartRowWithPadding(1, 0, 0, 1506 layout->StartRowWithPadding(1, 0, 0,
1459 views::kRelatedControlVerticalSpacing); 1507 views::kRelatedControlVerticalSpacing);
1460 layout->StartRow(1, 0); 1508 layout->StartRow(1, 0);
1461 layout->AddView(signin_current_profile_link_); 1509 layout->AddView(signin_current_profile_button_);
1462 content::RecordAction( 1510 content::RecordAction(
1463 base::UserMetricsAction("Signin_Impression_FromAvatarBubbleSignin")); 1511 base::UserMetricsAction("Signin_Impression_FromAvatarBubbleSignin"));
1464 } 1512 }
1465 } 1513 }
1466 1514
1467 return view; 1515 return view;
1468 } 1516 }
1469 1517
1518 views::View* ProfileChooserView::CreateMaterialDesignCurrentProfileView(
1519 const AvatarMenu::Item& avatar_item,
1520 bool is_guest) {
1521 views::View* view = new views::View();
1522 view->SetLayoutManager(
1523 new views::BoxLayout(views::BoxLayout::kVertical, kMaterialMenuEdgeMargin,
1524 views::kRelatedControlVerticalSpacing,
1525 views::kRelatedControlVerticalSpacing));
1526
1527 // Profile container for the profile photo and avatar/user name.
1528 views::View* profile_container = new views::View();
1529
1530 // Profile picture, left-aligned.
1531 current_profile_photo_ = new EditableProfilePhoto(
1532 this, avatar_item.icon, !is_guest, browser_->profile());
1533
1534 // Profile name, left-aligned to the right of profile icon.
1535 bool editing_allowed =
1536 !is_guest && !browser_->profile()->IsLegacySupervised();
1537 current_profile_name_ = new EditableProfileName(
1538 this, profiles::GetAvatarNameForProfile(browser_->profile()->GetPath()),
1539 editing_allowed);
1540 views::View* profile_name_container = new views::View();
1541 int name_container_v_spacing = views::kRelatedControlSmallVerticalSpacing;
1542 if (!avatar_item.signed_in)
1543 name_container_v_spacing += views::kRelatedControlVerticalSpacing;
1544 profile_name_container->SetLayoutManager(new views::BoxLayout(
1545 views::BoxLayout::kVertical, 0, name_container_v_spacing, 0));
1546 profile_name_container->AddChildView(current_profile_name_);
1547
1548 const int between_child_spacing =
1549 kMaterialMenuEdgeMargin - EditableProfilePhoto::badge_spacing();
1550 profile_container->SetLayoutManager(new views::BoxLayout(
1551 views::BoxLayout::kHorizontal, 0,
1552 views::kRelatedControlSmallVerticalSpacing, between_child_spacing));
1553 profile_container->AddChildView(current_profile_photo_);
1554 profile_container->AddChildView(profile_name_container);
1555 view->AddChildView(profile_container);
1556
1557 if (is_guest)
1558 return view;
1559
1560 // The available links depend on the type of profile that is active.
1561 if (avatar_item.signed_in) {
1562 if (switches::IsEnableAccountConsistency()) {
1563 base::string16 link_title = l10n_util::GetStringUTF16(
1564 IsProfileChooser(view_mode_)
1565 ? IDS_PROFILES_PROFILE_MANAGE_ACCOUNTS_BUTTON
1566 : IDS_PROFILES_PROFILE_HIDE_MANAGE_ACCOUNTS_BUTTON);
1567 manage_accounts_link_ = CreateLink(link_title, this);
1568 manage_accounts_link_->SetHorizontalAlignment(gfx::ALIGN_LEFT);
1569 profile_name_container->AddChildView(manage_accounts_link_);
1570 } else {
1571 views::Label* email_label = new views::Label(avatar_item.username);
1572 email_label->SetElideBehavior(gfx::ELIDE_EMAIL);
1573 email_label->SetEnabled(false);
1574 email_label->SetHorizontalAlignment(gfx::ALIGN_LEFT);
1575 profile_name_container->AddChildView(email_label);
1576 }
1577 return view;
1578 }
1579
1580 SigninManagerBase* signin_manager = SigninManagerFactory::GetForProfile(
1581 browser_->profile()->GetOriginalProfile());
1582 if (signin_manager->IsSigninAllowed()) {
1583 views::Label* promo =
1584 new views::Label(l10n_util::GetStringUTF16(IDS_PROFILES_SIGNIN_PROMO));
1585 promo->SetMultiLine(true);
1586 promo->SetHorizontalAlignment(gfx::ALIGN_LEFT);
1587 view->AddChildView(promo);
1588
1589 signin_current_profile_button_ =
1590 views::MdTextButton::CreateSecondaryUiBlueButton(
1591 this, l10n_util::GetStringFUTF16(
1592 IDS_SYNC_START_SYNC_BUTTON_LABEL,
1593 l10n_util::GetStringUTF16(IDS_SHORT_PRODUCT_NAME)));
1594 view->AddChildView(signin_current_profile_button_);
1595 content::RecordAction(
1596 base::UserMetricsAction("Signin_Impression_FromAvatarBubbleSignin"));
1597 view->SetBorder(views::Border::CreateEmptyBorder(
1598 0, 0, views::kRelatedControlVerticalSpacing, 0));
1599 }
1600
1601 return view;
1602 }
1603
1470 views::View* ProfileChooserView::CreateGuestProfileView() { 1604 views::View* ProfileChooserView::CreateGuestProfileView() {
1471 gfx::Image guest_icon = 1605 gfx::Image guest_icon =
1472 ui::ResourceBundle::GetSharedInstance().GetImageNamed( 1606 ui::ResourceBundle::GetSharedInstance().GetImageNamed(
1473 profiles::GetPlaceholderAvatarIconResourceID()); 1607 profiles::GetPlaceholderAvatarIconResourceID());
1474 AvatarMenu::Item guest_avatar_item(0, base::FilePath(), guest_icon); 1608 AvatarMenu::Item guest_avatar_item(0, base::FilePath(), guest_icon);
1475 guest_avatar_item.active = true; 1609 guest_avatar_item.active = true;
1476 guest_avatar_item.name = l10n_util::GetStringUTF16( 1610 guest_avatar_item.name = l10n_util::GetStringUTF16(
1477 IDS_PROFILES_GUEST_PROFILE_NAME); 1611 IDS_PROFILES_GUEST_PROFILE_NAME);
1478 guest_avatar_item.signed_in = false; 1612 guest_avatar_item.signed_in = false;
1479 1613
1480 return CreateCurrentProfileView(guest_avatar_item, true); 1614 return switches::IsMaterialDesignUserMenu()
1615 ? CreateMaterialDesignCurrentProfileView(guest_avatar_item, true)
1616 : CreateCurrentProfileView(guest_avatar_item, true);
1481 } 1617 }
1482 1618
1483 views::View* ProfileChooserView::CreateOtherProfilesView( 1619 views::View* ProfileChooserView::CreateOtherProfilesView(
1484 const Indexes& avatars_to_show) { 1620 const Indexes& avatars_to_show) {
1485 views::View* view = new views::View(); 1621 views::View* view = new views::View();
1486 views::GridLayout* layout = CreateSingleColumnLayout(view, kFixedMenuWidth); 1622 views::GridLayout* layout =
1623 CreateSingleColumnLayout(view, GetFixedMenuWidth());
1487 1624
1488 for (size_t index : avatars_to_show) { 1625 for (size_t index : avatars_to_show) {
1489 const AvatarMenu::Item& item = avatar_menu_->GetItemAt(index); 1626 const AvatarMenu::Item& item = avatar_menu_->GetItemAt(index);
1490 const int kSmallImageSide = 32; 1627 const int kSmallImageSide = 32;
1491 1628
1492 // Use the low-res, small default avatars in the fast user switcher, like 1629 // Use the low-res, small default avatars in the fast user switcher, like
1493 // we do in the menu bar. 1630 // we do in the menu bar.
1494 gfx::Image item_icon; 1631 gfx::Image item_icon;
1495 AvatarMenu::GetImageForMenuButton(item.profile_path, &item_icon); 1632 AvatarMenu::GetImageForMenuButton(item.profile_path, &item_icon);
1496 1633
(...skipping 11 matching lines...) Expand all
1508 layout->StartRow(1, 0); 1645 layout->StartRow(1, 0);
1509 layout->AddView(button); 1646 layout->AddView(button);
1510 } 1647 }
1511 1648
1512 return view; 1649 return view;
1513 } 1650 }
1514 1651
1515 views::View* ProfileChooserView::CreateOptionsView(bool display_lock, 1652 views::View* ProfileChooserView::CreateOptionsView(bool display_lock,
1516 AvatarMenu* avatar_menu) { 1653 AvatarMenu* avatar_menu) {
1517 views::View* view = new views::View(); 1654 views::View* view = new views::View();
1518 views::GridLayout* layout = CreateSingleColumnLayout(view, kFixedMenuWidth); 1655 views::GridLayout* layout =
1656 CreateSingleColumnLayout(view, GetFixedMenuWidth());
1519 1657
1520 const int kIconSize = switches::IsMaterialDesignUserMenu() ? 20 : 16; 1658 const int kIconSize = switches::IsMaterialDesignUserMenu() ? 20 : 16;
1521 if (switches::IsMaterialDesignUserMenu()) { 1659 if (switches::IsMaterialDesignUserMenu()) {
1522 // Add the user switching buttons 1660 // Add the user switching buttons
1523 const int kProfileIconSize = 18; 1661 const int kProfileIconSize = 18;
1524 layout->StartRowWithPadding(1, 0, 0, views::kRelatedControlVerticalSpacing); 1662 layout->StartRowWithPadding(1, 0, 0, views::kRelatedControlVerticalSpacing);
1525 for (size_t i = 0; i < avatar_menu->GetNumberOfItems(); ++i) { 1663 for (size_t i = 0; i < avatar_menu->GetNumberOfItems(); ++i) {
1526 const AvatarMenu::Item& item = avatar_menu->GetItemAt(i); 1664 const AvatarMenu::Item& item = avatar_menu->GetItemAt(i);
1527 if (!item.active) { 1665 if (!item.active) {
1528 gfx::Image image = profiles::GetSizedAvatarIcon( 1666 gfx::Image image = profiles::GetSizedAvatarIcon(
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
1614 } 1752 }
1615 1753
1616 if (switches::IsMaterialDesignUserMenu()) 1754 if (switches::IsMaterialDesignUserMenu())
1617 layout->StartRowWithPadding(1, 0, 0, views::kRelatedControlVerticalSpacing); 1755 layout->StartRowWithPadding(1, 0, 0, views::kRelatedControlVerticalSpacing);
1618 return view; 1756 return view;
1619 } 1757 }
1620 1758
1621 views::View* ProfileChooserView::CreateSupervisedUserDisclaimerView() { 1759 views::View* ProfileChooserView::CreateSupervisedUserDisclaimerView() {
1622 views::View* view = new views::View(); 1760 views::View* view = new views::View();
1623 views::GridLayout* layout = CreateSingleColumnLayout( 1761 views::GridLayout* layout = CreateSingleColumnLayout(
1624 view, kFixedMenuWidth - 2 * views::kButtonHEdgeMarginNew); 1762 view, GetFixedMenuWidth() - 2 * views::kButtonHEdgeMarginNew);
1625 layout->SetInsets(views::kRelatedControlVerticalSpacing, 1763 if (switches::IsMaterialDesignUserMenu()) {
1626 views::kButtonHEdgeMarginNew, 1764 layout->SetInsets(0, kMaterialMenuEdgeMargin, kMaterialMenuEdgeMargin,
1627 views::kRelatedControlVerticalSpacing, 1765 kMaterialMenuEdgeMargin);
1628 views::kButtonHEdgeMarginNew); 1766 } else {
1767 layout->SetInsets(
1768 views::kRelatedControlVerticalSpacing, views::kButtonHEdgeMarginNew,
1769 views::kRelatedControlVerticalSpacing, views::kButtonHEdgeMarginNew);
1770 }
1771
1629 views::Label* disclaimer = new views::Label( 1772 views::Label* disclaimer = new views::Label(
1630 avatar_menu_->GetSupervisedUserInformation()); 1773 avatar_menu_->GetSupervisedUserInformation());
1631 disclaimer->SetMultiLine(true); 1774 disclaimer->SetMultiLine(true);
1632 disclaimer->SetAllowCharacterBreak(true); 1775 disclaimer->SetAllowCharacterBreak(true);
1633 disclaimer->SetHorizontalAlignment(gfx::ALIGN_LEFT); 1776 disclaimer->SetHorizontalAlignment(gfx::ALIGN_LEFT);
1634 ui::ResourceBundle* rb = &ui::ResourceBundle::GetSharedInstance(); 1777 ui::ResourceBundle* rb = &ui::ResourceBundle::GetSharedInstance();
1635 disclaimer->SetFontList(rb->GetFontList(ui::ResourceBundle::SmallFont)); 1778 disclaimer->SetFontList(rb->GetFontList(ui::ResourceBundle::SmallFont));
1636 layout->StartRow(1, 0); 1779 layout->StartRow(1, 0);
1637 layout->AddView(disclaimer); 1780 layout->AddView(disclaimer);
1638 1781
1639 return view; 1782 return view;
1640 } 1783 }
1641 1784
1642 views::View* ProfileChooserView::CreateCurrentProfileAccountsView( 1785 views::View* ProfileChooserView::CreateCurrentProfileAccountsView(
1643 const AvatarMenu::Item& avatar_item) { 1786 const AvatarMenu::Item& avatar_item) {
1644 DCHECK(avatar_item.signed_in); 1787 DCHECK(avatar_item.signed_in);
1645 views::View* view = new views::View(); 1788 views::View* view = new views::View();
1646 view->set_background(views::Background::CreateSolidBackground( 1789 view->set_background(views::Background::CreateSolidBackground(
1647 profiles::kAvatarBubbleAccountsBackgroundColor)); 1790 profiles::kAvatarBubbleAccountsBackgroundColor));
1648 views::GridLayout* layout = CreateSingleColumnLayout(view, kFixedMenuWidth); 1791 views::GridLayout* layout =
1792 CreateSingleColumnLayout(view, GetFixedMenuWidth());
1649 1793
1650 Profile* profile = browser_->profile(); 1794 Profile* profile = browser_->profile();
1651 std::string primary_account = 1795 std::string primary_account =
1652 SigninManagerFactory::GetForProfile(profile)->GetAuthenticatedAccountId(); 1796 SigninManagerFactory::GetForProfile(profile)->GetAuthenticatedAccountId();
1653 DCHECK(!primary_account.empty()); 1797 DCHECK(!primary_account.empty());
1654 std::vector<std::string>accounts = 1798 std::vector<std::string>accounts =
1655 profiles::GetSecondaryAccountsForProfile(profile, primary_account); 1799 profiles::GetSecondaryAccountsForProfile(profile, primary_account);
1656 1800
1657 // Get state of authentication error, if any. 1801 // Get state of authentication error, if any.
1658 std::string error_account_id = GetAuthErrorAccountId(profile); 1802 std::string error_account_id = GetAuthErrorAccountId(profile);
1659 1803
1660 // The primary account should always be listed first. 1804 // The primary account should always be listed first.
1661 // TODO(rogerta): we still need to further differentiate the primary account 1805 // TODO(rogerta): we still need to further differentiate the primary account
1662 // from the others in the UI, so more work is likely required here: 1806 // from the others in the UI, so more work is likely required here:
1663 // crbug.com/311124. 1807 // crbug.com/311124.
1664 CreateAccountButton(layout, primary_account, true, 1808 CreateAccountButton(layout, primary_account, true,
1665 error_account_id == primary_account, kFixedMenuWidth); 1809 error_account_id == primary_account, GetFixedMenuWidth());
1666 for (size_t i = 0; i < accounts.size(); ++i) 1810 for (size_t i = 0; i < accounts.size(); ++i)
1667 CreateAccountButton(layout, accounts[i], false, 1811 CreateAccountButton(layout, accounts[i], false,
1668 error_account_id == accounts[i], kFixedMenuWidth); 1812 error_account_id == accounts[i], GetFixedMenuWidth());
1669 1813
1670 if (!profile->IsSupervised()) { 1814 if (!profile->IsSupervised()) {
1671 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); 1815 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing);
1672 1816
1673 add_account_link_ = CreateLink(l10n_util::GetStringFUTF16( 1817 add_account_link_ = CreateLink(l10n_util::GetStringFUTF16(
1674 IDS_PROFILES_PROFILE_ADD_ACCOUNT_BUTTON, avatar_item.name), this); 1818 IDS_PROFILES_PROFILE_ADD_ACCOUNT_BUTTON, avatar_item.name), this);
1675 add_account_link_->SetBorder(views::Border::CreateEmptyBorder( 1819 add_account_link_->SetBorder(views::Border::CreateEmptyBorder(
1676 0, views::kButtonVEdgeMarginNew, 1820 0, views::kButtonVEdgeMarginNew,
1677 views::kRelatedControlVerticalSpacing, 0)); 1821 views::kRelatedControlVerticalSpacing, 0));
1678 layout->StartRow(1, 0); 1822 layout->StartRow(1, 0);
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
1968 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) != 2112 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) !=
1969 IncognitoModePrefs::DISABLED; 2113 IncognitoModePrefs::DISABLED;
1970 return incognito_available && !browser_->profile()->IsGuestSession(); 2114 return incognito_available && !browser_->profile()->IsGuestSession();
1971 } 2115 }
1972 2116
1973 void ProfileChooserView::PostActionPerformed( 2117 void ProfileChooserView::PostActionPerformed(
1974 ProfileMetrics::ProfileDesktopMenu action_performed) { 2118 ProfileMetrics::ProfileDesktopMenu action_performed) {
1975 ProfileMetrics::LogProfileDesktopMenu(action_performed, gaia_service_type_); 2119 ProfileMetrics::LogProfileDesktopMenu(action_performed, gaia_service_type_);
1976 gaia_service_type_ = signin::GAIA_SERVICE_TYPE_NONE; 2120 gaia_service_type_ = signin::GAIA_SERVICE_TYPE_NONE;
1977 } 2121 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698