| 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 26 matching lines...) Expand all Loading... |
| 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_header_helper.h" | 39 #include "components/signin/core/browser/signin_header_helper.h" |
| 40 #include "components/signin/core/browser/signin_manager.h" | 40 #include "components/signin/core/browser/signin_manager.h" |
| 41 #include "components/signin/core/common/profile_management_switches.h" | 41 #include "components/signin/core/common/profile_management_switches.h" |
| 42 #include "content/public/browser/render_widget_host_view.h" | 42 #include "content/public/browser/render_widget_host_view.h" |
| 43 #include "grit/theme_resources.h" | 43 #include "grit/theme_resources.h" |
| 44 #include "third_party/skia/include/core/SkColor.h" | 44 #include "third_party/skia/include/core/SkColor.h" |
| 45 #include "ui/base/l10n/l10n_util.h" | 45 #include "ui/base/l10n/l10n_util.h" |
| 46 #include "ui/base/resource/resource_bundle.h" | 46 #include "ui/base/resource/resource_bundle.h" |
| 47 #include "ui/compositor/clip_transform_recorder.h" | 47 #include "ui/compositor/clip_recorder.h" |
| 48 #include "ui/gfx/canvas.h" | 48 #include "ui/gfx/canvas.h" |
| 49 #include "ui/gfx/color_palette.h" | 49 #include "ui/gfx/color_palette.h" |
| 50 #include "ui/gfx/image/canvas_image_source.h" | 50 #include "ui/gfx/image/canvas_image_source.h" |
| 51 #include "ui/gfx/image/image.h" | 51 #include "ui/gfx/image/image.h" |
| 52 #include "ui/gfx/image/image_skia.h" | 52 #include "ui/gfx/image/image_skia.h" |
| 53 #include "ui/gfx/paint_vector_icon.h" | 53 #include "ui/gfx/paint_vector_icon.h" |
| 54 #include "ui/gfx/path.h" | 54 #include "ui/gfx/path.h" |
| 55 #include "ui/gfx/skia_util.h" | 55 #include "ui/gfx/skia_util.h" |
| 56 #include "ui/gfx/text_elider.h" | 56 #include "ui/gfx/text_elider.h" |
| 57 #include "ui/gfx/vector_icons_public.h" | 57 #include "ui/gfx/vector_icons_public.h" |
| (...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 321 } | 321 } |
| 322 | 322 |
| 323 void OnPaint(gfx::Canvas* canvas) override { | 323 void OnPaint(gfx::Canvas* canvas) override { |
| 324 // Display the profile picture as a circle. | 324 // Display the profile picture as a circle. |
| 325 canvas->ClipPath(circular_mask_, true); | 325 canvas->ClipPath(circular_mask_, true); |
| 326 views::LabelButton::OnPaint(canvas); | 326 views::LabelButton::OnPaint(canvas); |
| 327 } | 327 } |
| 328 | 328 |
| 329 void PaintChildren(const ui::PaintContext& context) override { | 329 void PaintChildren(const ui::PaintContext& context) override { |
| 330 // Display any children (the "change photo" overlay) as a circle. | 330 // Display any children (the "change photo" overlay) as a circle. |
| 331 ui::ClipTransformRecorder clip_transform_recorder(context); | 331 ui::ClipRecorder clip_recorder(context); |
| 332 clip_transform_recorder.ClipPathWithAntiAliasing(circular_mask_); | 332 clip_recorder.ClipPathWithAntiAliasing(circular_mask_); |
| 333 View::PaintChildren(context); | 333 View::PaintChildren(context); |
| 334 } | 334 } |
| 335 | 335 |
| 336 private: | 336 private: |
| 337 // views::CustomButton: | 337 // views::CustomButton: |
| 338 void StateChanged() override { | 338 void StateChanged() override { |
| 339 bool show_overlay = | 339 bool show_overlay = |
| 340 (state() == STATE_PRESSED || state() == STATE_HOVERED || HasFocus()); | 340 (state() == STATE_PRESSED || state() == STATE_HOVERED || HasFocus()); |
| 341 if (photo_overlay_) | 341 if (photo_overlay_) |
| 342 photo_overlay_->SetVisible(show_overlay); | 342 photo_overlay_->SetVisible(show_overlay); |
| (...skipping 1528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1871 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) != | 1871 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) != |
| 1872 IncognitoModePrefs::DISABLED; | 1872 IncognitoModePrefs::DISABLED; |
| 1873 return incognito_available && !browser_->profile()->IsGuestSession(); | 1873 return incognito_available && !browser_->profile()->IsGuestSession(); |
| 1874 } | 1874 } |
| 1875 | 1875 |
| 1876 void ProfileChooserView::PostActionPerformed( | 1876 void ProfileChooserView::PostActionPerformed( |
| 1877 ProfileMetrics::ProfileDesktopMenu action_performed) { | 1877 ProfileMetrics::ProfileDesktopMenu action_performed) { |
| 1878 ProfileMetrics::LogProfileDesktopMenu(action_performed, gaia_service_type_); | 1878 ProfileMetrics::LogProfileDesktopMenu(action_performed, gaia_service_type_); |
| 1879 gaia_service_type_ = signin::GAIA_SERVICE_TYPE_NONE; | 1879 gaia_service_type_ = signin::GAIA_SERVICE_TYPE_NONE; |
| 1880 } | 1880 } |
| OLD | NEW |