| 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 30 matching lines...) Expand all Loading... |
| 41 widget_->Init(params); | 41 widget_->Init(params); |
| 42 widget_->SetContentsView(content); | 42 widget_->SetContentsView(content); |
| 43 widget_->StackAtTop(); | 43 widget_->StackAtTop(); |
| 44 widget_->Show(); | 44 widget_->Show(); |
| 45 | 45 |
| 46 widget_->AddObserver(this); | 46 widget_->AddObserver(this); |
| 47 | 47 |
| 48 // Observe changes in display size and mode to update touch HUD. | 48 // Observe changes in display size and mode to update touch HUD. |
| 49 Shell::GetScreen()->AddObserver(this); | 49 Shell::GetScreen()->AddObserver(this); |
| 50 #if defined(OS_CHROMEOS) | 50 #if defined(OS_CHROMEOS) |
| 51 Shell::GetInstance()->output_configurator()->AddObserver(this); | 51 Shell::GetInstance()->display_configurator()->AddObserver(this); |
| 52 #endif // defined(OS_CHROMEOS) | 52 #endif // defined(OS_CHROMEOS) |
| 53 | 53 |
| 54 Shell::GetInstance()->display_controller()->AddObserver(this); | 54 Shell::GetInstance()->display_controller()->AddObserver(this); |
| 55 root_window_->AddPreTargetHandler(this); | 55 root_window_->AddPreTargetHandler(this); |
| 56 } | 56 } |
| 57 | 57 |
| 58 TouchObserverHUD::~TouchObserverHUD() { | 58 TouchObserverHUD::~TouchObserverHUD() { |
| 59 Shell::GetInstance()->display_controller()->RemoveObserver(this); | 59 Shell::GetInstance()->display_controller()->RemoveObserver(this); |
| 60 | 60 |
| 61 #if defined(OS_CHROMEOS) | 61 #if defined(OS_CHROMEOS) |
| 62 Shell::GetInstance()->output_configurator()->RemoveObserver(this); | 62 Shell::GetInstance()->display_configurator()->RemoveObserver(this); |
| 63 #endif // defined(OS_CHROMEOS) | 63 #endif // defined(OS_CHROMEOS) |
| 64 Shell::GetScreen()->RemoveObserver(this); | 64 Shell::GetScreen()->RemoveObserver(this); |
| 65 | 65 |
| 66 widget_->RemoveObserver(this); | 66 widget_->RemoveObserver(this); |
| 67 } | 67 } |
| 68 | 68 |
| 69 void TouchObserverHUD::Clear() { | 69 void TouchObserverHUD::Clear() { |
| 70 } | 70 } |
| 71 | 71 |
| 72 void TouchObserverHUD::Remove() { | 72 void TouchObserverHUD::Remove() { |
| (...skipping 22 matching lines...) Expand all Loading... |
| 95 void TouchObserverHUD::OnDisplayAdded(const gfx::Display& new_display) {} | 95 void TouchObserverHUD::OnDisplayAdded(const gfx::Display& new_display) {} |
| 96 | 96 |
| 97 void TouchObserverHUD::OnDisplayRemoved(const gfx::Display& old_display) { | 97 void TouchObserverHUD::OnDisplayRemoved(const gfx::Display& old_display) { |
| 98 if (old_display.id() != display_id_) | 98 if (old_display.id() != display_id_) |
| 99 return; | 99 return; |
| 100 widget_->CloseNow(); | 100 widget_->CloseNow(); |
| 101 } | 101 } |
| 102 | 102 |
| 103 #if defined(OS_CHROMEOS) | 103 #if defined(OS_CHROMEOS) |
| 104 void TouchObserverHUD::OnDisplayModeChanged( | 104 void TouchObserverHUD::OnDisplayModeChanged( |
| 105 const ui::OutputConfigurator::DisplayStateList& outputs) { | 105 const ui::DisplayConfigurator::DisplayStateList& outputs) { |
| 106 // Clear touch HUD for any change in display mode (single, dual extended, dual | 106 // Clear touch HUD for any change in display mode (single, dual extended, dual |
| 107 // mirrored, ...). | 107 // mirrored, ...). |
| 108 Clear(); | 108 Clear(); |
| 109 } | 109 } |
| 110 #endif // defined(OS_CHROMEOS) | 110 #endif // defined(OS_CHROMEOS) |
| 111 | 111 |
| 112 void TouchObserverHUD::OnDisplaysInitialized() { | 112 void TouchObserverHUD::OnDisplaysInitialized() { |
| 113 OnDisplayConfigurationChanged(); | 113 OnDisplayConfigurationChanged(); |
| 114 } | 114 } |
| 115 | 115 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 141 widget_->GetNativeView(), | 141 widget_->GetNativeView(), |
| 142 Shell::GetContainer(root_window_, kShellWindowId_OverlayContainer)); | 142 Shell::GetContainer(root_window_, kShellWindowId_OverlayContainer)); |
| 143 | 143 |
| 144 RootWindowController* controller = GetRootWindowController(root_window_); | 144 RootWindowController* controller = GetRootWindowController(root_window_); |
| 145 SetHudForRootWindowController(controller); | 145 SetHudForRootWindowController(controller); |
| 146 | 146 |
| 147 root_window_->AddPreTargetHandler(this); | 147 root_window_->AddPreTargetHandler(this); |
| 148 } | 148 } |
| 149 | 149 |
| 150 } // namespace ash | 150 } // namespace ash |
| OLD | NEW |