| 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/paint_context.h" |
| 46 #include "ui/gfx/canvas.h" | 47 #include "ui/gfx/canvas.h" |
| 47 #include "ui/gfx/image/image.h" | 48 #include "ui/gfx/image/image.h" |
| 48 #include "ui/gfx/image/image_skia.h" | 49 #include "ui/gfx/image/image_skia.h" |
| 49 #include "ui/gfx/path.h" | 50 #include "ui/gfx/path.h" |
| 50 #include "ui/gfx/skia_util.h" | 51 #include "ui/gfx/skia_util.h" |
| 51 #include "ui/gfx/text_elider.h" | 52 #include "ui/gfx/text_elider.h" |
| 52 #include "ui/native_theme/native_theme.h" | 53 #include "ui/native_theme/native_theme.h" |
| 53 #include "ui/views/controls/button/blue_button.h" | 54 #include "ui/views/controls/button/blue_button.h" |
| 54 #include "ui/views/controls/button/image_button.h" | 55 #include "ui/views/controls/button/image_button.h" |
| 55 #include "ui/views/controls/button/label_button.h" | 56 #include "ui/views/controls/button/label_button.h" |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 photo_overlay_->SetVisible(false); | 251 photo_overlay_->SetVisible(false); |
| 251 AddChildView(photo_overlay_); | 252 AddChildView(photo_overlay_); |
| 252 } | 253 } |
| 253 | 254 |
| 254 void OnPaint(gfx::Canvas* canvas) override { | 255 void OnPaint(gfx::Canvas* canvas) override { |
| 255 // Display the profile picture as a circle. | 256 // Display the profile picture as a circle. |
| 256 canvas->ClipPath(circular_mask_, true); | 257 canvas->ClipPath(circular_mask_, true); |
| 257 views::LabelButton::OnPaint(canvas); | 258 views::LabelButton::OnPaint(canvas); |
| 258 } | 259 } |
| 259 | 260 |
| 260 void PaintChildren(const PaintContext& context) override { | 261 void PaintChildren(const ui::PaintContext& context) override { |
| 261 // Display any children (the "change photo" overlay) as a circle. | 262 // Display any children (the "change photo" overlay) as a circle. |
| 262 context.canvas()->ClipPath(circular_mask_, true); | 263 context.canvas()->ClipPath(circular_mask_, true); |
| 263 View::PaintChildren(context); | 264 View::PaintChildren(context); |
| 264 } | 265 } |
| 265 | 266 |
| 266 private: | 267 private: |
| 267 // views::CustomButton: | 268 // views::CustomButton: |
| 268 void StateChanged() override { | 269 void StateChanged() override { |
| 269 bool show_overlay = | 270 bool show_overlay = |
| 270 (state() == STATE_PRESSED || state() == STATE_HOVERED || HasFocus()); | 271 (state() == STATE_PRESSED || state() == STATE_HOVERED || HasFocus()); |
| (...skipping 1447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1718 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) != | 1719 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) != |
| 1719 IncognitoModePrefs::DISABLED; | 1720 IncognitoModePrefs::DISABLED; |
| 1720 return incognito_available && !browser_->profile()->IsGuestSession(); | 1721 return incognito_available && !browser_->profile()->IsGuestSession(); |
| 1721 } | 1722 } |
| 1722 | 1723 |
| 1723 void ProfileChooserView::PostActionPerformed( | 1724 void ProfileChooserView::PostActionPerformed( |
| 1724 ProfileMetrics::ProfileDesktopMenu action_performed) { | 1725 ProfileMetrics::ProfileDesktopMenu action_performed) { |
| 1725 ProfileMetrics::LogProfileDesktopMenu(action_performed, gaia_service_type_); | 1726 ProfileMetrics::LogProfileDesktopMenu(action_performed, gaia_service_type_); |
| 1726 gaia_service_type_ = signin::GAIA_SERVICE_TYPE_NONE; | 1727 gaia_service_type_ = signin::GAIA_SERVICE_TYPE_NONE; |
| 1727 } | 1728 } |
| OLD | NEW |