| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/chromeos/display/touch_calibrator/touch_calibrator_view
.h" | 5 #include "chrome/browser/chromeos/display/touch_calibrator/touch_calibrator_view
.h" |
| 6 | 6 |
| 7 #include "ash/display/window_tree_host_manager.h" | 7 #include "ash/display/window_tree_host_manager.h" |
| 8 #include "ash/public/cpp/shell_window_ids.h" | 8 #include "ash/public/cpp/shell_window_ids.h" |
| 9 #include "ash/resources/vector_icons/vector_icons.h" |
| 9 #include "ash/shell.h" | 10 #include "ash/shell.h" |
| 10 #include "ui/aura/window.h" | 11 #include "ui/aura/window.h" |
| 11 #include "ui/base/resource/resource_bundle.h" | 12 #include "ui/base/resource/resource_bundle.h" |
| 12 #include "ui/compositor/scoped_layer_animation_settings.h" | 13 #include "ui/compositor/scoped_layer_animation_settings.h" |
| 13 #include "ui/gfx/animation/linear_animation.h" | 14 #include "ui/gfx/animation/linear_animation.h" |
| 14 #include "ui/gfx/animation/throb_animation.h" | 15 #include "ui/gfx/animation/throb_animation.h" |
| 15 #include "ui/gfx/canvas.h" | 16 #include "ui/gfx/canvas.h" |
| 17 #include "ui/gfx/paint_vector_icon.h" |
| 16 #include "ui/strings/grit/ui_strings.h" | 18 #include "ui/strings/grit/ui_strings.h" |
| 17 #include "ui/views/background.h" | 19 #include "ui/views/background.h" |
| 18 #include "ui/views/controls/label.h" | 20 #include "ui/views/controls/label.h" |
| 19 #include "ui/views/widget/widget.h" | 21 #include "ui/views/widget/widget.h" |
| 20 | 22 |
| 21 namespace chromeos { | 23 namespace chromeos { |
| 22 | 24 |
| 23 namespace { | 25 namespace { |
| 24 | 26 |
| 25 constexpr char kWidgetName[] = "TouchCalibratorOverlay"; | 27 constexpr char kWidgetName[] = "TouchCalibratorOverlay"; |
| 26 | 28 |
| 27 constexpr int kAnimationFrameRate = 100; | 29 constexpr int kAnimationFrameRate = 100; |
| 28 constexpr int kFadeDurationInMs = 150; | 30 constexpr int kFadeDurationInMs = 150; |
| 29 constexpr int kPointMoveDurationInMs = 600; | 31 constexpr int kPointMoveDurationInMs = 400; |
| 30 constexpr int kPointMoveDurationLongInMs = 700; | 32 constexpr int kPointMoveDurationLongInMs = 500; |
| 31 | 33 |
| 32 const SkColor kExitLabelColor = SkColorSetARGBInline(255, 96, 96, 96); | 34 const SkColor kExitLabelColor = SkColorSetARGBInline(255, 96, 96, 96); |
| 33 const SkColor kExitLabelShadowColor = SkColorSetARGBInline(255, 11, 11, 11); | 35 const SkColor kExitLabelShadowColor = SkColorSetARGBInline(255, 11, 11, 11); |
| 34 constexpr int kExitLabelWidth = 300; | 36 constexpr int kExitLabelWidth = 300; |
| 35 constexpr int kExitLabelHeight = 20; | 37 constexpr int kExitLabelHeight = 20; |
| 36 | 38 |
| 37 const SkColor kTapHereLabelColor = SK_ColorWHITE; | 39 const SkColor kTapHereLabelColor = SK_ColorWHITE; |
| 38 | 40 |
| 39 constexpr int kHintBoxWidth = 298; | 41 constexpr int kHintBoxWidth = 298; |
| 40 constexpr int kHintBoxHeight = 180; | 42 constexpr int kHintBoxHeight = 180; |
| 41 constexpr int kHintBoxLabelTextSize = 5; | 43 constexpr int kHintBoxLabelTextSize = 5; |
| 42 constexpr int kHintBoxSublabelTextSize = 3; | 44 constexpr int kHintBoxSublabelTextSize = 3; |
| 43 | 45 |
| 44 constexpr int kThrobberCircleViewWidth = 64; | 46 constexpr int kThrobberCircleViewWidth = 64; |
| 45 constexpr float kThrobberCircleRadiusFactor = 3.f / 8.f; | 47 constexpr float kThrobberCircleRadiusFactor = 3.f / 8.f; |
| 46 | 48 |
| 49 constexpr int kFinalMessageTransitionDurationMs = 200; |
| 50 constexpr int kCompleteMessageViewWidth = 427; |
| 51 constexpr int kCompleteMessageViewHeight = kThrobberCircleViewWidth; |
| 52 constexpr int kCompleteMessageTextSize = 16; |
| 53 |
| 47 constexpr int kTouchPointViewOffset = 100; | 54 constexpr int kTouchPointViewOffset = 100; |
| 48 | 55 |
| 49 constexpr int kTapLabelHeight = 48; | 56 constexpr int kTapLabelHeight = 48; |
| 50 constexpr int kTapLabelWidth = 80; | 57 constexpr int kTapLabelWidth = 80; |
| 51 | 58 |
| 52 const SkColor kHintLabelTextColor = SK_ColorBLACK; | 59 const SkColor kHintLabelTextColor = SK_ColorBLACK; |
| 53 const SkColor kHintSublabelTextColor = SkColorSetARGBInline(255, 161, 161, 161); | 60 const SkColor kHintSublabelTextColor = SkColorSetARGBInline(255, 161, 161, 161); |
| 54 | 61 |
| 55 const SkColor kInnerCircleColor = SK_ColorWHITE; | 62 const SkColor kInnerCircleColor = SK_ColorWHITE; |
| 56 const SkColor kOuterCircleColor = SkColorSetA(kInnerCircleColor, 128); | 63 const SkColor kOuterCircleColor = SkColorSetA(kInnerCircleColor, 255 * 0.2); |
| 57 | 64 |
| 58 constexpr int kCircleAnimationDurationMs = 900; | 65 constexpr int kCircleAnimationDurationMs = 900; |
| 59 | 66 |
| 60 constexpr int kHintRectBorderRadius = 4; | 67 constexpr int kHintRectBorderRadius = 4; |
| 61 | 68 |
| 62 constexpr float kBackgroundFinalOpacity = 0.75f; | 69 constexpr float kBackgroundFinalOpacity = 0.75f; |
| 63 | 70 |
| 64 // Returns the initialization params for the widget that contains the touch | 71 // Returns the initialization params for the widget that contains the touch |
| 65 // calibrator view. | 72 // calibrator view. |
| 66 views::Widget::InitParams GetWidgetParams(aura::Window* root_window) { | 73 views::Widget::InitParams GetWidgetParams(aura::Window* root_window) { |
| (...skipping 13 matching lines...) Expand all Loading... |
| 80 // Returns the size of bounding box required for |text| of given |font_list|. | 87 // Returns the size of bounding box required for |text| of given |font_list|. |
| 81 gfx::Size GetSizeForString(const base::string16& text, | 88 gfx::Size GetSizeForString(const base::string16& text, |
| 82 const gfx::FontList& font_list) { | 89 const gfx::FontList& font_list) { |
| 83 int height = 0, width = 0; | 90 int height = 0, width = 0; |
| 84 gfx::Canvas::SizeStringInt(text, font_list, &width, &height, 0, 0); | 91 gfx::Canvas::SizeStringInt(text, font_list, &width, &height, 0, 0); |
| 85 return gfx::Size(width, height); | 92 return gfx::Size(width, height); |
| 86 } | 93 } |
| 87 | 94 |
| 88 void AnimateLayerToPosition(views::View* view, | 95 void AnimateLayerToPosition(views::View* view, |
| 89 int duration, | 96 int duration, |
| 90 gfx::Point end_position) { | 97 gfx::Point end_position, |
| 98 float opacity = 1.f) { |
| 91 ui::ScopedLayerAnimationSettings slide_settings(view->layer()->GetAnimator()); | 99 ui::ScopedLayerAnimationSettings slide_settings(view->layer()->GetAnimator()); |
| 92 slide_settings.SetPreemptionStrategy( | 100 slide_settings.SetPreemptionStrategy( |
| 93 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET); | 101 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET); |
| 94 slide_settings.SetTransitionDuration( | 102 slide_settings.SetTransitionDuration( |
| 95 base::TimeDelta::FromMilliseconds(duration)); | 103 base::TimeDelta::FromMilliseconds(duration)); |
| 96 view->SetBoundsRect(gfx::Rect(end_position, view->size())); | 104 view->SetBoundsRect(gfx::Rect(end_position, view->size())); |
| 105 view->layer()->SetOpacity(opacity); |
| 97 } | 106 } |
| 98 | 107 |
| 99 } // namespace | 108 } // namespace |
| 100 | 109 |
| 101 // Creates a throbbing animated view with two concentric circles. The radius of | 110 // Creates a throbbing animated view with two concentric circles. The radius of |
| 102 // the inner circle is fixed while that of the outer circle oscillates between a | 111 // the inner circle is fixed while that of the outer circle oscillates between a |
| 103 // min and max radius. The animation takes |animation_duration| milliseconds | 112 // min and max radius. The animation takes |animation_duration| milliseconds |
| 104 // to complete. The center of these circles are at the center of the view | 113 // to complete. The center of these circles are at the center of the view |
| 105 // element. | 114 // element. |
| 106 class CircularThrobberView : public views::View, public gfx::AnimationDelegate { | 115 class CircularThrobberView : public views::View, public gfx::AnimationDelegate { |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 | 306 |
| 298 void HintBox::OnPaint(gfx::Canvas* canvas) { | 307 void HintBox::OnPaint(gfx::Canvas* canvas) { |
| 299 canvas->DrawRoundRect(GetLocalBounds(), border_radius_, paint_); | 308 canvas->DrawRoundRect(GetLocalBounds(), border_radius_, paint_); |
| 300 canvas->DrawStringRectWithFlags(label_text_, label_font_list_, label_color_, | 309 canvas->DrawStringRectWithFlags(label_text_, label_font_list_, label_color_, |
| 301 label_text_bounds_, gfx::Canvas::NO_ELLIPSIS); | 310 label_text_bounds_, gfx::Canvas::NO_ELLIPSIS); |
| 302 canvas->DrawStringRectWithFlags(sublabel_text_, sublabel_font_list_, | 311 canvas->DrawStringRectWithFlags(sublabel_text_, sublabel_font_list_, |
| 303 sublabel_color_, sublabel_text_bounds_, | 312 sublabel_color_, sublabel_text_bounds_, |
| 304 gfx::Canvas::NO_ELLIPSIS); | 313 gfx::Canvas::NO_ELLIPSIS); |
| 305 } | 314 } |
| 306 | 315 |
| 316 class CompletionMessageView : public views::View { |
| 317 public: |
| 318 CompletionMessageView(const gfx::Rect& bounds, const base::string16& message); |
| 319 ~CompletionMessageView() override; |
| 320 |
| 321 // views::View overrides: |
| 322 void OnPaint(gfx::Canvas* canvas) override; |
| 323 |
| 324 private: |
| 325 const base::string16 message_; |
| 326 gfx::FontList font_list_; |
| 327 |
| 328 gfx::Rect text_bounds_; |
| 329 |
| 330 gfx::ImageSkia check_icon_; |
| 331 |
| 332 SkPaint paint_; |
| 333 |
| 334 DISALLOW_COPY_AND_ASSIGN(CompletionMessageView); |
| 335 }; |
| 336 |
| 337 CompletionMessageView::CompletionMessageView(const gfx::Rect& bounds, |
| 338 const base::string16& message) |
| 339 : message_(message) { |
| 340 SetBoundsRect(bounds); |
| 341 |
| 342 int x_offset = height() * 5.f / 4.f; |
| 343 text_bounds_.SetRect(x_offset, 0, width() - x_offset, height()); |
| 344 |
| 345 font_list_ = ui::ResourceBundle::GetSharedInstance().GetFontListWithDelta( |
| 346 kCompleteMessageTextSize, gfx::Font::FontStyle::NORMAL, |
| 347 gfx::Font::Weight::NORMAL); |
| 348 |
| 349 // crbug/676513 moves this file to src/ash which will require an ash icon |
| 350 // file. |
| 351 check_icon_ = gfx::CreateVectorIcon(ash::kTouchCalibrationCompleteCheckIcon, |
| 352 SK_ColorWHITE); |
| 353 |
| 354 paint_.setColor(SK_ColorWHITE); |
| 355 paint_.setStyle(SkPaint::kFill_Style); |
| 356 paint_.setFlags(SkPaint::kAntiAlias_Flag); |
| 357 } |
| 358 |
| 359 CompletionMessageView::~CompletionMessageView() {} |
| 360 |
| 361 void CompletionMessageView::OnPaint(gfx::Canvas* canvas) { |
| 362 canvas->DrawImageInt(check_icon_, 0, 0); |
| 363 |
| 364 // TODO(malaykeshav): Work with elizabethchiu@ to get better UX for RTL. |
| 365 canvas->DrawStringRectWithFlags( |
| 366 message_, font_list_, paint_.getColor(), text_bounds_, |
| 367 gfx::Canvas::TEXT_ALIGN_LEFT | gfx::Canvas::NO_SUBPIXEL_RENDERING); |
| 368 } |
| 369 |
| 307 TouchCalibratorView::TouchCalibratorView(const display::Display& target_display, | 370 TouchCalibratorView::TouchCalibratorView(const display::Display& target_display, |
| 308 bool is_primary_view) | 371 bool is_primary_view) |
| 309 : display_(target_display), | 372 : display_(target_display), |
| 310 is_primary_view_(is_primary_view), | 373 is_primary_view_(is_primary_view), |
| 311 exit_label_(nullptr), | 374 exit_label_(nullptr), |
| 312 tap_label_(nullptr), | 375 tap_label_(nullptr), |
| 313 throbber_circle_(nullptr), | 376 throbber_circle_(nullptr), |
| 314 hint_box_view_(nullptr), | 377 hint_box_view_(nullptr), |
| 315 touch_point_view_(nullptr) { | 378 touch_point_view_(nullptr) { |
| 316 aura::Window* root = ash::Shell::GetInstance() | 379 aura::Window* root = ash::Shell::GetInstance() |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 421 touch_point_view_->y() + (tpv_width / 2.f) - (size.height() / 2.f)); | 484 touch_point_view_->y() + (tpv_width / 2.f) - (size.height() / 2.f)); |
| 422 | 485 |
| 423 HintBox* hint_box = | 486 HintBox* hint_box = |
| 424 new HintBox(gfx::Rect(position, size), kHintRectBorderRadius); | 487 new HintBox(gfx::Rect(position, size), kHintRectBorderRadius); |
| 425 hint_box->SetVisible(false); | 488 hint_box->SetVisible(false); |
| 426 hint_box->SetLabel(hint_label_text, kHintLabelTextColor); | 489 hint_box->SetLabel(hint_label_text, kHintLabelTextColor); |
| 427 hint_box->SetSubLabel(hint_sublabel_text, kHintSublabelTextColor); | 490 hint_box->SetSubLabel(hint_sublabel_text, kHintSublabelTextColor); |
| 428 hint_box_view_ = hint_box; | 491 hint_box_view_ = hint_box; |
| 429 | 492 |
| 430 AddChildView(hint_box_view_); | 493 AddChildView(hint_box_view_); |
| 494 |
| 495 // Initialize the view that contains the calibration complete message which |
| 496 // will be displayed at the end. |
| 497 base::string16 finish_msg_text = |
| 498 rb.GetLocalizedString(IDS_DISPLAY_TOUCH_CALIBRATION_FINISH_LABEL); |
| 499 |
| 500 gfx::Rect msg_view_bounds( |
| 501 (display_.bounds().width() - kCompleteMessageViewWidth) / 2, |
| 502 display_.bounds().height() / 3, kCompleteMessageViewWidth, |
| 503 kCompleteMessageViewHeight); |
| 504 completion_message_view_ = |
| 505 new CompletionMessageView(msg_view_bounds, finish_msg_text); |
| 506 completion_message_view_->SetVisible(false); |
| 507 completion_message_view_->SetPaintToLayer(true); |
| 508 completion_message_view_->layer()->SetFillsBoundsOpaquely(false); |
| 509 completion_message_view_->layer()->GetAnimator()->AddObserver(this); |
| 510 completion_message_view_->set_background( |
| 511 views::Background::CreateSolidBackground(SK_ColorTRANSPARENT)); |
| 512 |
| 513 AddChildView(completion_message_view_); |
| 431 } | 514 } |
| 432 | 515 |
| 433 void TouchCalibratorView::OnPaint(gfx::Canvas* canvas) { | 516 void TouchCalibratorView::OnPaint(gfx::Canvas* canvas) { |
| 434 OnPaintBackground(canvas); | 517 OnPaintBackground(canvas); |
| 435 } | 518 } |
| 436 | 519 |
| 437 void TouchCalibratorView::OnPaintBackground(gfx::Canvas* canvas) { | 520 void TouchCalibratorView::OnPaintBackground(gfx::Canvas* canvas) { |
| 438 float opacity; | 521 float opacity; |
| 439 | 522 |
| 440 // If current state is a fade in or fade out state then update opacity | 523 // If current state is a fade in or fade out state then update opacity |
| (...skipping 25 matching lines...) Expand all Loading... |
| 466 void TouchCalibratorView::AnimationEnded(const gfx::Animation* animation) { | 549 void TouchCalibratorView::AnimationEnded(const gfx::Animation* animation) { |
| 467 switch (state_) { | 550 switch (state_) { |
| 468 case BACKGROUND_FADING_IN: | 551 case BACKGROUND_FADING_IN: |
| 469 exit_label_->SetVisible(true); | 552 exit_label_->SetVisible(true); |
| 470 state_ = is_primary_view_ ? DISPLAY_POINT_1 : CALIBRATION_COMPLETE; | 553 state_ = is_primary_view_ ? DISPLAY_POINT_1 : CALIBRATION_COMPLETE; |
| 471 if (is_primary_view_) { | 554 if (is_primary_view_) { |
| 472 touch_point_view_->SetVisible(true); | 555 touch_point_view_->SetVisible(true); |
| 473 hint_box_view_->SetVisible(true); | 556 hint_box_view_->SetVisible(true); |
| 474 } | 557 } |
| 475 break; | 558 break; |
| 559 case BACKGROUND_FADING_OUT: |
| 560 exit_label_->SetVisible(false); |
| 561 if (is_primary_view_) |
| 562 completion_message_view_->SetVisible(false); |
| 563 widget_->Hide(); |
| 564 break; |
| 476 default: | 565 default: |
| 477 break; | 566 break; |
| 478 } | 567 } |
| 479 } | 568 } |
| 480 | 569 |
| 481 void TouchCalibratorView::OnLayerAnimationStarted( | 570 void TouchCalibratorView::OnLayerAnimationStarted( |
| 482 ui::LayerAnimationSequence* sequence) {} | 571 ui::LayerAnimationSequence* sequence) {} |
| 483 | 572 |
| 484 void TouchCalibratorView::OnLayerAnimationEnded( | 573 void TouchCalibratorView::OnLayerAnimationEnded( |
| 485 ui::LayerAnimationSequence* sequence) { | 574 ui::LayerAnimationSequence* sequence) { |
| 486 switch (state_) { | 575 switch (state_) { |
| 487 case ANIMATING_1_TO_2: | 576 case ANIMATING_1_TO_2: |
| 488 state_ = DISPLAY_POINT_2; | 577 state_ = DISPLAY_POINT_2; |
| 489 tap_label_->SetVisible(true); | 578 tap_label_->SetVisible(true); |
| 490 break; | 579 break; |
| 491 case ANIMATING_2_TO_3: | 580 case ANIMATING_2_TO_3: |
| 492 state_ = DISPLAY_POINT_3; | 581 state_ = DISPLAY_POINT_3; |
| 493 break; | 582 break; |
| 494 case ANIMATING_3_TO_4: | 583 case ANIMATING_3_TO_4: |
| 495 state_ = DISPLAY_POINT_4; | 584 state_ = DISPLAY_POINT_4; |
| 496 break; | 585 break; |
| 586 case ANIMATING_FINAL_MESSAGE: |
| 587 state_ = CALIBRATION_COMPLETE; |
| 588 break; |
| 497 default: | 589 default: |
| 498 break; | 590 break; |
| 499 } | 591 } |
| 500 } | 592 } |
| 501 | 593 |
| 502 void TouchCalibratorView::OnLayerAnimationAborted( | 594 void TouchCalibratorView::OnLayerAnimationAborted( |
| 503 ui::LayerAnimationSequence* sequence) { | 595 ui::LayerAnimationSequence* sequence) { |
| 504 OnLayerAnimationEnded(sequence); | 596 OnLayerAnimationEnded(sequence); |
| 505 } | 597 } |
| 506 | 598 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 549 state_ = ANIMATING_3_TO_4; | 641 state_ = ANIMATING_3_TO_4; |
| 550 | 642 |
| 551 // The touch point has to be animated from the bottom left corner of the | 643 // The touch point has to be animated from the bottom left corner of the |
| 552 // screen to the bottom right corner. | 644 // screen to the bottom right corner. |
| 553 AnimateLayerToPosition( | 645 AnimateLayerToPosition( |
| 554 touch_point_view_, kPointMoveDurationInMs, | 646 touch_point_view_, kPointMoveDurationInMs, |
| 555 gfx::Point(display_.bounds().width() - kTouchPointViewOffset - | 647 gfx::Point(display_.bounds().width() - kTouchPointViewOffset - |
| 556 touch_point_view_->width(), | 648 touch_point_view_->width(), |
| 557 touch_point_view_->y())); | 649 touch_point_view_->y())); |
| 558 return; | 650 return; |
| 651 case DISPLAY_POINT_4: |
| 652 state_ = ANIMATING_FINAL_MESSAGE; |
| 653 completion_message_view_->layer()->SetOpacity(0.f); |
| 654 completion_message_view_->SetVisible(true); |
| 655 |
| 656 touch_point_view_->SetVisible(false); |
| 657 |
| 658 AnimateLayerToPosition(completion_message_view_, |
| 659 kFinalMessageTransitionDurationMs, |
| 660 gfx::Point(completion_message_view_->x(), |
| 661 display_.bounds().height() / 2)); |
| 662 return; |
| 663 case CALIBRATION_COMPLETE: |
| 664 state_ = BACKGROUND_FADING_OUT; |
| 665 if (is_primary_view_) { |
| 666 // In case of primary view, we also need to fade out the calibration |
| 667 // complete message view. |
| 668 AnimateLayerToPosition( |
| 669 completion_message_view_, kFadeDurationInMs, |
| 670 gfx::Point(completion_message_view_->x(), |
| 671 completion_message_view_->y() + |
| 672 2 * completion_message_view_->height()), |
| 673 0.f); |
| 674 } |
| 675 |
| 676 start_opacity_value_ = kBackgroundFinalOpacity; |
| 677 end_opacity_value_ = 0.f; |
| 678 |
| 679 paint_.setStyle(SkPaint::kFill_Style); |
| 680 animator_->SetDuration(kFadeDurationInMs); |
| 681 animator_->Start(); |
| 682 return; |
| 559 default: | 683 default: |
| 560 return; | 684 return; |
| 561 } | 685 } |
| 562 } | 686 } |
| 563 | 687 |
| 564 bool TouchCalibratorView::GetDisplayPointLocation(gfx::Point* location) { | 688 bool TouchCalibratorView::GetDisplayPointLocation(gfx::Point* location) { |
| 565 DCHECK(location); | 689 DCHECK(location); |
| 566 if (!is_primary_view_) | 690 if (!is_primary_view_) |
| 567 return false; | 691 return false; |
| 568 | 692 |
| 569 if (state_ != DISPLAY_POINT_1 && state_ != DISPLAY_POINT_2 && | 693 if (state_ != DISPLAY_POINT_1 && state_ != DISPLAY_POINT_2 && |
| 570 state_ != DISPLAY_POINT_3 && state_ != DISPLAY_POINT_4) { | 694 state_ != DISPLAY_POINT_3 && state_ != DISPLAY_POINT_4) { |
| 571 return false; | 695 return false; |
| 572 } | 696 } |
| 573 | 697 |
| 574 if (!touch_point_view_ || !throbber_circle_) | 698 if (!touch_point_view_ || !throbber_circle_) |
| 575 return false; | 699 return false; |
| 576 // TODO(malaykeshav): Can use views::ConvertPointToScreen() | 700 // TODO(malaykeshav): Can use views::ConvertPointToScreen() |
| 577 location->SetPoint(touch_point_view_->x() + touch_point_view_->width() / 2.f, | 701 location->SetPoint(touch_point_view_->x() + touch_point_view_->width() / 2.f, |
| 578 touch_point_view_->y() + touch_point_view_->width() / 2.f); | 702 touch_point_view_->y() + touch_point_view_->width() / 2.f); |
| 579 return true; | 703 return true; |
| 580 } | 704 } |
| 581 | 705 |
| 582 void TouchCalibratorView::SkipToFinalState() {} | 706 void TouchCalibratorView::SkipToFinalState() { |
| 707 state_ = CALIBRATION_COMPLETE; |
| 708 |
| 709 exit_label_->SetVisible(false); |
| 710 |
| 711 if (is_primary_view_) { |
| 712 touch_point_view_->SetVisible(false); |
| 713 hint_box_view_->SetVisible(false); |
| 714 } |
| 715 |
| 716 AdvanceToNextState(); |
| 717 } |
| 583 | 718 |
| 584 void TouchCalibratorView::SkipCurrentAnimation() { | 719 void TouchCalibratorView::SkipCurrentAnimation() { |
| 585 if (animator_->is_animating()) | 720 if (animator_->is_animating()) |
| 586 animator_->End(); | 721 animator_->End(); |
| 587 if (touch_point_view_ && | 722 if (touch_point_view_ && |
| 588 touch_point_view_->layer()->GetAnimator()->is_animating()) { | 723 touch_point_view_->layer()->GetAnimator()->is_animating()) { |
| 589 touch_point_view_->layer()->GetAnimator()->StopAnimating(); | 724 touch_point_view_->layer()->GetAnimator()->StopAnimating(); |
| 590 } | 725 } |
| 591 } | 726 } |
| 592 | 727 |
| 593 } // namespace chromeos | 728 } // namespace chromeos |
| OLD | NEW |