| OLD | NEW |
| 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 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 465 icon_image_side() + badge_spacing() - GetProfileBadgeSize(); | 465 icon_image_side() + badge_spacing() - GetProfileBadgeSize(); |
| 466 gfx::Vector2d badge_offset_vector = gfx::Vector2d( | 466 gfx::Vector2d badge_offset_vector = gfx::Vector2d( |
| 467 GetMirroredXWithWidthInView(badge_offset, GetProfileBadgeSize()), | 467 GetMirroredXWithWidthInView(badge_offset, GetProfileBadgeSize()), |
| 468 badge_offset + (switches::IsMaterialDesignUserMenu() | 468 badge_offset + (switches::IsMaterialDesignUserMenu() |
| 469 ? views::kRelatedControlSmallVerticalSpacing | 469 ? views::kRelatedControlSmallVerticalSpacing |
| 470 : 0)); | 470 : 0)); |
| 471 | 471 |
| 472 gfx::Point center_point = bounds.CenterPoint() + badge_offset_vector; | 472 gfx::Point center_point = bounds.CenterPoint() + badge_offset_vector; |
| 473 | 473 |
| 474 // Paint the circular background. | 474 // Paint the circular background. |
| 475 cc::PaintFlags paint; | 475 cc::PaintFlags flags; |
| 476 paint.setAntiAlias(true); | 476 flags.setAntiAlias(true); |
| 477 paint.setColor(GetNativeTheme()->GetSystemColor( | 477 flags.setColor(GetNativeTheme()->GetSystemColor( |
| 478 ui::NativeTheme::kColorId_BubbleBackground)); | 478 ui::NativeTheme::kColorId_BubbleBackground)); |
| 479 canvas->DrawCircle(center_point, GetProfileBadgeSize() / 2, paint); | 479 canvas->DrawCircle(center_point, GetProfileBadgeSize() / 2, flags); |
| 480 | 480 |
| 481 gfx::VectorIconId icon_id; | 481 gfx::VectorIconId icon_id; |
| 482 int icon_size; | 482 int icon_size; |
| 483 SkColor icon_color; | 483 SkColor icon_color; |
| 484 if (switches::IsMaterialDesignUserMenu()) { | 484 if (switches::IsMaterialDesignUserMenu()) { |
| 485 icon_id = profile_->IsChild() | 485 icon_id = profile_->IsChild() |
| 486 ? gfx::VectorIconId::ACCOUNT_CHILD_CIRCLE | 486 ? gfx::VectorIconId::ACCOUNT_CHILD_CIRCLE |
| 487 : gfx::VectorIconId::SUPERVISOR_ACCOUNT_CIRCLE; | 487 : gfx::VectorIconId::SUPERVISOR_ACCOUNT_CIRCLE; |
| 488 icon_size = 22; | 488 icon_size = 22; |
| 489 icon_color = gfx::kChromeIconGrey; | 489 icon_color = gfx::kChromeIconGrey; |
| 490 } else { | 490 } else { |
| 491 // Paint the light blue circle. | 491 // Paint the light blue circle. |
| 492 paint.setColor(SkColorSetRGB(0xaf, 0xd9, 0xfc)); | 492 flags.setColor(SkColorSetRGB(0xaf, 0xd9, 0xfc)); |
| 493 canvas->DrawCircle( | 493 canvas->DrawCircle( |
| 494 center_point, GetProfileBadgeSize() / 2 - kProfileBadgeWhitePadding, | 494 center_point, GetProfileBadgeSize() / 2 - kProfileBadgeWhitePadding, |
| 495 paint); | 495 flags); |
| 496 | 496 |
| 497 icon_id = profile_->IsChild() | 497 icon_id = profile_->IsChild() |
| 498 ? gfx::VectorIconId::ACCOUNT_CHILD | 498 ? gfx::VectorIconId::ACCOUNT_CHILD |
| 499 : gfx::VectorIconId::SUPERVISOR_ACCOUNT; | 499 : gfx::VectorIconId::SUPERVISOR_ACCOUNT; |
| 500 icon_size = profile_->IsChild() ? 26 : 20; | 500 icon_size = profile_->IsChild() ? 26 : 20; |
| 501 icon_color = SkColorSetRGB(0, 0x66, 0xff); | 501 icon_color = SkColorSetRGB(0, 0x66, 0xff); |
| 502 } | 502 } |
| 503 | 503 |
| 504 // Paint the badge icon. | 504 // Paint the badge icon. |
| 505 int offset = (GetProfileBadgeSize() - icon_size) / 2; | 505 int offset = (GetProfileBadgeSize() - icon_size) / 2; |
| (...skipping 1859 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2365 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) != | 2365 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) != |
| 2366 IncognitoModePrefs::DISABLED; | 2366 IncognitoModePrefs::DISABLED; |
| 2367 return incognito_available && !browser_->profile()->IsGuestSession(); | 2367 return incognito_available && !browser_->profile()->IsGuestSession(); |
| 2368 } | 2368 } |
| 2369 | 2369 |
| 2370 void ProfileChooserView::PostActionPerformed( | 2370 void ProfileChooserView::PostActionPerformed( |
| 2371 ProfileMetrics::ProfileDesktopMenu action_performed) { | 2371 ProfileMetrics::ProfileDesktopMenu action_performed) { |
| 2372 ProfileMetrics::LogProfileDesktopMenu(action_performed, gaia_service_type_); | 2372 ProfileMetrics::LogProfileDesktopMenu(action_performed, gaia_service_type_); |
| 2373 gaia_service_type_ = signin::GAIA_SERVICE_TYPE_NONE; | 2373 gaia_service_type_ = signin::GAIA_SERVICE_TYPE_NONE; |
| 2374 } | 2374 } |
| OLD | NEW |