| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_observer_hud.h" | 5 #include "ash/touch/touch_observer_hud.h" |
| 6 | 6 |
| 7 #include "ash/root_window_controller.h" | 7 #include "ash/root_window_controller.h" |
| 8 #include "ash/root_window_settings.h" | 8 #include "ash/root_window_settings.h" |
| 9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
| 10 #include "ash/shell_window_ids.h" | 10 #include "ash/shell_window_ids.h" |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 } | 79 } |
| 80 | 80 |
| 81 void TouchObserverHUD::OnTouchEvent(ui::TouchEvent* /*event*/) { | 81 void TouchObserverHUD::OnTouchEvent(ui::TouchEvent* /*event*/) { |
| 82 } | 82 } |
| 83 | 83 |
| 84 void TouchObserverHUD::OnWidgetDestroying(views::Widget* widget) { | 84 void TouchObserverHUD::OnWidgetDestroying(views::Widget* widget) { |
| 85 DCHECK_EQ(widget, widget_); | 85 DCHECK_EQ(widget, widget_); |
| 86 delete this; | 86 delete this; |
| 87 } | 87 } |
| 88 | 88 |
| 89 void TouchObserverHUD::OnDisplayBoundsChanged(const gfx::Display& display) { | |
| 90 if (display.id() != display_id_) | |
| 91 return; | |
| 92 widget_->SetSize(display.size()); | |
| 93 } | |
| 94 | |
| 95 void TouchObserverHUD::OnDisplayAdded(const gfx::Display& new_display) {} | 89 void TouchObserverHUD::OnDisplayAdded(const gfx::Display& new_display) {} |
| 96 | 90 |
| 97 void TouchObserverHUD::OnDisplayRemoved(const gfx::Display& old_display) { | 91 void TouchObserverHUD::OnDisplayRemoved(const gfx::Display& old_display) { |
| 98 if (old_display.id() != display_id_) | 92 if (old_display.id() != display_id_) |
| 99 return; | 93 return; |
| 100 widget_->CloseNow(); | 94 widget_->CloseNow(); |
| 101 } | 95 } |
| 102 | 96 |
| 97 void TouchObserverHUD::OnDisplayMetricsChanged( |
| 98 const gfx::Display& display, DisplayObserver::MetricsType metrics) { |
| 99 if (display.id() != display_id_ || !(metrics & DISPLAY_METRICS_BOUNDS)) |
| 100 return; |
| 101 |
| 102 widget_->SetSize(display.size()); |
| 103 } |
| 104 |
| 103 #if defined(OS_CHROMEOS) | 105 #if defined(OS_CHROMEOS) |
| 104 void TouchObserverHUD::OnDisplayModeChanged( | 106 void TouchObserverHUD::OnDisplayModeChanged( |
| 105 const ui::DisplayConfigurator::DisplayStateList& outputs) { | 107 const ui::DisplayConfigurator::DisplayStateList& outputs) { |
| 106 // Clear touch HUD for any change in display mode (single, dual extended, dual | 108 // Clear touch HUD for any change in display mode (single, dual extended, dual |
| 107 // mirrored, ...). | 109 // mirrored, ...). |
| 108 Clear(); | 110 Clear(); |
| 109 } | 111 } |
| 110 #endif // defined(OS_CHROMEOS) | 112 #endif // defined(OS_CHROMEOS) |
| 111 | 113 |
| 112 void TouchObserverHUD::OnDisplaysInitialized() { | 114 void TouchObserverHUD::OnDisplaysInitialized() { |
| (...skipping 28 matching lines...) Expand all Loading... |
| 141 widget_->GetNativeView(), | 143 widget_->GetNativeView(), |
| 142 Shell::GetContainer(root_window_, kShellWindowId_OverlayContainer)); | 144 Shell::GetContainer(root_window_, kShellWindowId_OverlayContainer)); |
| 143 | 145 |
| 144 RootWindowController* controller = GetRootWindowController(root_window_); | 146 RootWindowController* controller = GetRootWindowController(root_window_); |
| 145 SetHudForRootWindowController(controller); | 147 SetHudForRootWindowController(controller); |
| 146 | 148 |
| 147 root_window_->AddPreTargetHandler(this); | 149 root_window_->AddPreTargetHandler(this); |
| 148 } | 150 } |
| 149 | 151 |
| 150 } // namespace ash | 152 } // namespace ash |
| OLD | NEW |