OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "ash/touch/touch_hud_debug.h" | 5 #include "ash/touch/touch_hud_debug.h" |
6 | 6 |
7 #include "ash/display/display_manager.h" | 7 #include "ash/display/display_manager.h" |
8 #include "ash/root_window_controller.h" | 8 #include "ash/root_window_controller.h" |
9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
10 #include "base/json/json_string_value_serializer.h" | 10 #include "base/json/json_string_value_serializer.h" |
11 #include "base/strings/string_number_conversions.h" | 11 #include "base/strings/string_number_conversions.h" |
12 #include "base/strings/stringprintf.h" | 12 #include "base/strings/stringprintf.h" |
13 #include "base/strings/utf_string_conversions.h" | 13 #include "base/strings/utf_string_conversions.h" |
14 #include "third_party/skia/include/core/SkPath.h" | 14 #include "third_party/skia/include/core/SkPath.h" |
15 #include "ui/aura/window_event_dispatcher.h" | 15 #include "ui/aura/window_event_dispatcher.h" |
16 #include "ui/events/event.h" | 16 #include "ui/events/event.h" |
17 #include "ui/gfx/animation/animation_delegate.h" | 17 #include "ui/gfx/animation/animation_delegate.h" |
18 #include "ui/gfx/canvas.h" | 18 #include "ui/gfx/canvas.h" |
19 #include "ui/gfx/display.h" | 19 #include "ui/gfx/display.h" |
20 #include "ui/gfx/geometry/size.h" | 20 #include "ui/gfx/geometry/size.h" |
| 21 #include "ui/gfx/geometry/vector2d.h" |
21 #include "ui/gfx/transform.h" | 22 #include "ui/gfx/transform.h" |
22 #include "ui/views/controls/label.h" | 23 #include "ui/views/controls/label.h" |
23 #include "ui/views/layout/box_layout.h" | 24 #include "ui/views/layout/box_layout.h" |
24 #include "ui/views/widget/widget.h" | 25 #include "ui/views/widget/widget.h" |
25 | 26 |
26 #if defined(USE_X11) | 27 #if defined(USE_X11) |
27 #include <X11/extensions/XInput2.h> | 28 #include <X11/extensions/XInput2.h> |
28 #include <X11/Xlib.h> | 29 #include <X11/Xlib.h> |
29 | 30 |
30 #include "ui/events/devices/x11/device_data_manager_x11.h" | 31 #include "ui/events/devices/x11/device_data_manager_x11.h" |
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
336 canvas_->SetSize(display_size); | 337 canvas_->SetSize(display_size); |
337 | 338 |
338 label_container_ = new views::View; | 339 label_container_ = new views::View; |
339 label_container_->SetLayoutManager(new views::BoxLayout( | 340 label_container_->SetLayoutManager(new views::BoxLayout( |
340 views::BoxLayout::kVertical, 0, 0, 0)); | 341 views::BoxLayout::kVertical, 0, 0, 0)); |
341 | 342 |
342 for (int i = 0; i < kMaxTouchPoints; ++i) { | 343 for (int i = 0; i < kMaxTouchPoints; ++i) { |
343 touch_labels_[i] = new views::Label; | 344 touch_labels_[i] = new views::Label; |
344 touch_labels_[i]->SetBackgroundColor(SkColorSetARGB(0, 255, 255, 255)); | 345 touch_labels_[i]->SetBackgroundColor(SkColorSetARGB(0, 255, 255, 255)); |
345 touch_labels_[i]->SetShadows(gfx::ShadowValues( | 346 touch_labels_[i]->SetShadows(gfx::ShadowValues( |
346 1, gfx::ShadowValue(gfx::Point(1, 1), 0, SK_ColorWHITE))); | 347 1, gfx::ShadowValue(gfx::Vector2d(1, 1), 0, SK_ColorWHITE))); |
347 label_container_->AddChildView(touch_labels_[i]); | 348 label_container_->AddChildView(touch_labels_[i]); |
348 } | 349 } |
349 label_container_->SetX(0); | 350 label_container_->SetX(0); |
350 label_container_->SetY(display_size.height() / kReducedScale); | 351 label_container_->SetY(display_size.height() / kReducedScale); |
351 label_container_->SetSize(label_container_->GetPreferredSize()); | 352 label_container_->SetSize(label_container_->GetPreferredSize()); |
352 label_container_->SetVisible(false); | 353 label_container_->SetVisible(false); |
353 content->AddChildView(label_container_); | 354 content->AddChildView(label_container_); |
354 } | 355 } |
355 | 356 |
356 TouchHudDebug::~TouchHudDebug() { | 357 TouchHudDebug::~TouchHudDebug() { |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
469 RootWindowController* controller) { | 470 RootWindowController* controller) { |
470 controller->set_touch_hud_debug(this); | 471 controller->set_touch_hud_debug(this); |
471 } | 472 } |
472 | 473 |
473 void TouchHudDebug::UnsetHudForRootWindowController( | 474 void TouchHudDebug::UnsetHudForRootWindowController( |
474 RootWindowController* controller) { | 475 RootWindowController* controller) { |
475 controller->set_touch_hud_debug(NULL); | 476 controller->set_touch_hud_debug(NULL); |
476 } | 477 } |
477 | 478 |
478 } // namespace ash | 479 } // namespace ash |
OLD | NEW |