Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "chrome/browser/chromeos/display/touch_calibrator/touch_calibrator_view .h" | |
| 6 | |
| 7 #include "ash/display/window_tree_host_manager.h" | |
| 8 #include "ash/public/cpp/shell_window_ids.h" | |
| 9 #include "ash/shell.h" | |
| 10 #include "ui/aura/window.h" | |
| 11 #include "ui/gfx/canvas.h" | |
| 12 #include "ui/views/widget/widget.h" | |
| 13 | |
| 14 namespace chromeos { | |
|
stevenjb
2016/12/22 01:14:21
blank line
malaykeshav
2016/12/22 11:50:07
Done
| |
| 15 namespace { | |
| 16 | |
| 17 const char kWidgetName[] = "TouchCalibratorOverlay"; | |
|
stevenjb
2016/12/22 01:14:21
constexpr
malaykeshav
2016/12/22 11:50:07
Done
| |
| 18 | |
| 19 // Returns the initialization params for the widget that contains the touch | |
| 20 // calibrator view. | |
| 21 views::Widget::InitParams GetWidgetParams(aura::Window* root_window) { | |
| 22 views::Widget::InitParams params; | |
| 23 params.type = views::Widget::InitParams::TYPE_WINDOW_FRAMELESS; | |
| 24 params.name = kWidgetName; | |
| 25 params.keep_on_top = true; | |
| 26 params.accept_events = true; | |
| 27 params.activatable = views::Widget::InitParams::ACTIVATABLE_NO; | |
| 28 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; | |
| 29 params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW; | |
| 30 params.parent = ash::Shell::GetContainer( | |
| 31 root_window, ash::kShellWindowId_OverlayContainer); | |
| 32 return params; | |
| 33 } | |
| 34 | |
| 35 } // namespace | |
| 36 | |
| 37 TouchCalibratorView::TouchCalibratorView(const display::Display& target_display, | |
| 38 bool is_primary_view) | |
| 39 : display_(target_display), is_primary_view_(is_primary_view) { | |
| 40 aura::Window* root = ash::Shell::GetInstance() | |
| 41 ->window_tree_host_manager() | |
| 42 ->GetRootWindowForDisplayId(display_.id()); | |
| 43 widget_.reset(new views::Widget); | |
| 44 widget_->Init(GetWidgetParams(root)); | |
| 45 widget_->Show(); | |
| 46 widget_->SetContentsView(this); | |
| 47 widget_->SetBounds(display_.bounds()); | |
| 48 set_owned_by_client(); | |
| 49 } | |
| 50 | |
| 51 TouchCalibratorView::~TouchCalibratorView() { | |
| 52 state_ = UNKNOWN; | |
| 53 widget_->Hide(); | |
| 54 } | |
|
stevenjb
2016/12/22 01:14:21
blank line
malaykeshav
2016/12/22 11:50:07
Done
| |
| 55 // views::View override: | |
|
stevenjb
2016/12/22 01:14:21
Elim. unnecessary comments, these should just be i
malaykeshav
2016/12/22 11:50:07
Done
| |
| 56 void TouchCalibratorView::OnPaint(gfx::Canvas* canvas) { | |
| 57 OnPaintBackground(canvas); | |
| 58 } | |
| 59 | |
| 60 // views::View override: | |
| 61 void TouchCalibratorView::OnPaintBackground(gfx::Canvas* canvas) {} | |
| 62 | |
| 63 // gfx::AnimationDelegate override: | |
| 64 void TouchCalibratorView::AnimationProgressed(const gfx::Animation* animation) { | |
| 65 } | |
| 66 | |
| 67 // gfx::AnimationDelegate override: | |
| 68 void TouchCalibratorView::AnimationCanceled(const gfx::Animation* animation) { | |
| 69 AnimationEnded(animation); | |
| 70 } | |
| 71 | |
| 72 // gfx::AnimationDelegate override: | |
| 73 void TouchCalibratorView::AnimationEnded(const gfx::Animation* animation) {} | |
| 74 | |
| 75 void TouchCalibratorView::NextState() {} | |
| 76 | |
| 77 bool TouchCalibratorView::GetTouchPointLocation(gfx::Point* location) { | |
| 78 if (!is_primary_view_) | |
| 79 return false; | |
| 80 return false; | |
| 81 } | |
| 82 | |
| 83 void TouchCalibratorView::SkipToFinalState() {} | |
| 84 | |
| 85 } // namespace chromeos | |
| OLD | NEW |