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/prefs/pref_service.h" | 7 #include "base/prefs/pref_service.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
10 #include "chrome/browser/lifetime/application_lifetime.h" | 10 #include "chrome/browser/lifetime/application_lifetime.h" |
(...skipping 25 matching lines...) Expand all Loading... |
36 #include "components/signin/core/browser/mutable_profile_oauth2_token_service.h" | 36 #include "components/signin/core/browser/mutable_profile_oauth2_token_service.h" |
37 #include "components/signin/core/browser/profile_oauth2_token_service.h" | 37 #include "components/signin/core/browser/profile_oauth2_token_service.h" |
38 #include "components/signin/core/browser/signin_error_controller.h" | 38 #include "components/signin/core/browser/signin_error_controller.h" |
39 #include "components/signin/core/browser/signin_manager.h" | 39 #include "components/signin/core/browser/signin_manager.h" |
40 #include "components/signin/core/common/profile_management_switches.h" | 40 #include "components/signin/core/common/profile_management_switches.h" |
41 #include "content/public/browser/render_widget_host_view.h" | 41 #include "content/public/browser/render_widget_host_view.h" |
42 #include "grit/theme_resources.h" | 42 #include "grit/theme_resources.h" |
43 #include "third_party/skia/include/core/SkColor.h" | 43 #include "third_party/skia/include/core/SkColor.h" |
44 #include "ui/base/l10n/l10n_util.h" | 44 #include "ui/base/l10n/l10n_util.h" |
45 #include "ui/base/resource/resource_bundle.h" | 45 #include "ui/base/resource/resource_bundle.h" |
| 46 #include "ui/compositor/clip_transform_recorder.h" |
46 #include "ui/compositor/paint_context.h" | 47 #include "ui/compositor/paint_context.h" |
47 #include "ui/gfx/canvas.h" | 48 #include "ui/gfx/canvas.h" |
48 #include "ui/gfx/image/image.h" | 49 #include "ui/gfx/image/image.h" |
49 #include "ui/gfx/image/image_skia.h" | 50 #include "ui/gfx/image/image_skia.h" |
50 #include "ui/gfx/path.h" | 51 #include "ui/gfx/path.h" |
51 #include "ui/gfx/skia_util.h" | 52 #include "ui/gfx/skia_util.h" |
52 #include "ui/gfx/text_elider.h" | 53 #include "ui/gfx/text_elider.h" |
53 #include "ui/native_theme/native_theme.h" | 54 #include "ui/native_theme/native_theme.h" |
54 #include "ui/views/controls/button/blue_button.h" | 55 #include "ui/views/controls/button/blue_button.h" |
55 #include "ui/views/controls/button/image_button.h" | 56 #include "ui/views/controls/button/image_button.h" |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 } | 254 } |
254 | 255 |
255 void OnPaint(gfx::Canvas* canvas) override { | 256 void OnPaint(gfx::Canvas* canvas) override { |
256 // Display the profile picture as a circle. | 257 // Display the profile picture as a circle. |
257 canvas->ClipPath(circular_mask_, true); | 258 canvas->ClipPath(circular_mask_, true); |
258 views::LabelButton::OnPaint(canvas); | 259 views::LabelButton::OnPaint(canvas); |
259 } | 260 } |
260 | 261 |
261 void PaintChildren(const ui::PaintContext& context) override { | 262 void PaintChildren(const ui::PaintContext& context) override { |
262 // Display any children (the "change photo" overlay) as a circle. | 263 // Display any children (the "change photo" overlay) as a circle. |
263 context.canvas()->ClipPath(circular_mask_, true); | 264 ui::ClipTransformRecorder clip_transform_recorder(context); |
| 265 clip_transform_recorder.ClipPathWithAntiAliasing(circular_mask_); |
264 View::PaintChildren(context); | 266 View::PaintChildren(context); |
265 } | 267 } |
266 | 268 |
267 private: | 269 private: |
268 // views::CustomButton: | 270 // views::CustomButton: |
269 void StateChanged() override { | 271 void StateChanged() override { |
270 bool show_overlay = | 272 bool show_overlay = |
271 (state() == STATE_PRESSED || state() == STATE_HOVERED || HasFocus()); | 273 (state() == STATE_PRESSED || state() == STATE_HOVERED || HasFocus()); |
272 if (photo_overlay_) | 274 if (photo_overlay_) |
273 photo_overlay_->SetVisible(show_overlay); | 275 photo_overlay_->SetVisible(show_overlay); |
(...skipping 1445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1719 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) != | 1721 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) != |
1720 IncognitoModePrefs::DISABLED; | 1722 IncognitoModePrefs::DISABLED; |
1721 return incognito_available && !browser_->profile()->IsGuestSession(); | 1723 return incognito_available && !browser_->profile()->IsGuestSession(); |
1722 } | 1724 } |
1723 | 1725 |
1724 void ProfileChooserView::PostActionPerformed( | 1726 void ProfileChooserView::PostActionPerformed( |
1725 ProfileMetrics::ProfileDesktopMenu action_performed) { | 1727 ProfileMetrics::ProfileDesktopMenu action_performed) { |
1726 ProfileMetrics::LogProfileDesktopMenu(action_performed, gaia_service_type_); | 1728 ProfileMetrics::LogProfileDesktopMenu(action_performed, gaia_service_type_); |
1727 gaia_service_type_ = signin::GAIA_SERVICE_TYPE_NONE; | 1729 gaia_service_type_ = signin::GAIA_SERVICE_TYPE_NONE; |
1728 } | 1730 } |
OLD | NEW |