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

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

Issue 2877483003: Implements core logic for Pixel Canvas (Closed)
Patch Set: Sync with ToT Created 3 years, 4 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 <algorithm> 7 #include <algorithm>
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 10
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 SetImage(views::LabelButton::STATE_NORMAL, *image.ToImageSkia()); 342 SetImage(views::LabelButton::STATE_NORMAL, *image.ToImageSkia());
343 SetBorder(views::NullBorder()); 343 SetBorder(views::NullBorder());
344 SetMinSize(gfx::Size(GetPreferredSize().width() + kBadgeSpacing, 344 SetMinSize(gfx::Size(GetPreferredSize().width() + kBadgeSpacing,
345 GetPreferredSize().height() + kBadgeSpacing + 345 GetPreferredSize().height() + kBadgeSpacing +
346 ChromeLayoutProvider::Get()->GetDistanceMetric( 346 ChromeLayoutProvider::Get()->GetDistanceMetric(
347 DISTANCE_RELATED_CONTROL_VERTICAL_SMALL))); 347 DISTANCE_RELATED_CONTROL_VERTICAL_SMALL)));
348 348
349 SetEnabled(false); 349 SetEnabled(false);
350 } 350 }
351 351
352 void PaintChildren(const ui::PaintContext& context) override { 352 void PaintChildren(const views::PaintInfo& paint_info) override {
353 { 353 {
354 // Display any children (the "change photo" overlay) as a circle. 354 // Display any children (the "change photo" overlay) as a circle.
355 ui::ClipRecorder clip_recorder(context); 355 ui::ClipRecorder clip_recorder(paint_info.context());
356 gfx::Rect clip_bounds = image()->GetMirroredBounds(); 356 gfx::Rect clip_bounds = image()->GetMirroredBounds();
357 gfx::Path clip_mask; 357 gfx::Path clip_mask;
358 clip_mask.addCircle( 358 clip_mask.addCircle(
359 clip_bounds.x() + clip_bounds.width() / 2, 359 clip_bounds.x() + clip_bounds.width() / 2,
360 clip_bounds.y() + clip_bounds.height() / 2, 360 clip_bounds.y() + clip_bounds.height() / 2,
361 clip_bounds.width() / 2); 361 clip_bounds.width() / 2);
362 clip_recorder.ClipPathWithAntiAliasing(clip_mask); 362 clip_recorder.ClipPathWithAntiAliasing(clip_mask);
363 View::PaintChildren(context); 363 View::PaintChildren(paint_info);
364 } 364 }
365 365
366 ui::PaintRecorder paint_recorder( 366 ui::PaintRecorder paint_recorder(
367 context, gfx::Size(kProfileBadgeSize, kProfileBadgeSize)); 367 paint_info.context(), gfx::Size(kProfileBadgeSize, kProfileBadgeSize));
368 gfx::Canvas* canvas = paint_recorder.canvas(); 368 gfx::Canvas* canvas = paint_recorder.canvas();
369 if (profile_->IsSupervised()) { 369 if (profile_->IsSupervised()) {
370 gfx::Rect bounds(0, 0, kProfileBadgeSize, kProfileBadgeSize); 370 gfx::Rect bounds(0, 0, kProfileBadgeSize, kProfileBadgeSize);
371 int badge_offset = kImageSide + kBadgeSpacing - kProfileBadgeSize; 371 int badge_offset = kImageSide + kBadgeSpacing - kProfileBadgeSize;
372 gfx::Vector2d badge_offset_vector = gfx::Vector2d( 372 gfx::Vector2d badge_offset_vector = gfx::Vector2d(
373 GetMirroredXWithWidthInView(badge_offset, kProfileBadgeSize), 373 GetMirroredXWithWidthInView(badge_offset, kProfileBadgeSize),
374 badge_offset + ChromeLayoutProvider::Get()->GetDistanceMetric( 374 badge_offset + ChromeLayoutProvider::Get()->GetDistanceMetric(
375 DISTANCE_RELATED_CONTROL_VERTICAL_SMALL)); 375 DISTANCE_RELATED_CONTROL_VERTICAL_SMALL));
376 376
377 gfx::Point center_point = bounds.CenterPoint() + badge_offset_vector; 377 gfx::Point center_point = bounds.CenterPoint() + badge_offset_vector;
(...skipping 1264 matching lines...) Expand 10 before | Expand all | Expand 10 after
1642 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) != 1642 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) !=
1643 IncognitoModePrefs::DISABLED; 1643 IncognitoModePrefs::DISABLED;
1644 return incognito_available && !browser_->profile()->IsGuestSession(); 1644 return incognito_available && !browser_->profile()->IsGuestSession();
1645 } 1645 }
1646 1646
1647 void ProfileChooserView::PostActionPerformed( 1647 void ProfileChooserView::PostActionPerformed(
1648 ProfileMetrics::ProfileDesktopMenu action_performed) { 1648 ProfileMetrics::ProfileDesktopMenu action_performed) {
1649 ProfileMetrics::LogProfileDesktopMenu(action_performed, gaia_service_type_); 1649 ProfileMetrics::LogProfileDesktopMenu(action_performed, gaia_service_type_);
1650 gaia_service_type_ = signin::GAIA_SERVICE_TYPE_NONE; 1650 gaia_service_type_ = signin::GAIA_SERVICE_TYPE_NONE;
1651 } 1651 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/omnibox/omnibox_popup_contents_view.cc ('k') | chrome/browser/ui/views/tabs/tab_strip.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698