Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(535)

Side by Side Diff: ash/touch/touch_observer_hud.cc

Issue 2618143002: cros: Remove some OS platform ifdefs from ash (Closed)
Patch Set: rebase Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ash/touch/touch_observer_hud.h ('k') | ash/touch/touch_observer_hud_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/public/cpp/shell_window_ids.h" 7 #include "ash/public/cpp/shell_window_ids.h"
8 #include "ash/root_window_controller.h" 8 #include "ash/root_window_controller.h"
9 #include "ash/root_window_settings.h" 9 #include "ash/root_window_settings.h"
10 #include "ash/shell.h" 10 #include "ash/shell.h"
(...skipping 29 matching lines...) Expand all
40 Shell::GetContainer(root_window_, kShellWindowId_OverlayContainer); 40 Shell::GetContainer(root_window_, kShellWindowId_OverlayContainer);
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 display::Screen::GetScreen()->AddObserver(this); 49 display::Screen::GetScreen()->AddObserver(this);
50 #if defined(OS_CHROMEOS)
51 Shell::GetInstance()->display_configurator()->AddObserver(this); 50 Shell::GetInstance()->display_configurator()->AddObserver(this);
52 #endif // defined(OS_CHROMEOS)
53
54 Shell::GetInstance()->window_tree_host_manager()->AddObserver(this); 51 Shell::GetInstance()->window_tree_host_manager()->AddObserver(this);
55 root_window_->AddPreTargetHandler(this); 52 root_window_->AddPreTargetHandler(this);
56 } 53 }
57 54
58 TouchObserverHUD::~TouchObserverHUD() { 55 TouchObserverHUD::~TouchObserverHUD() {
59 Shell::GetInstance()->window_tree_host_manager()->RemoveObserver(this); 56 Shell::GetInstance()->window_tree_host_manager()->RemoveObserver(this);
60
61 #if defined(OS_CHROMEOS)
62 Shell::GetInstance()->display_configurator()->RemoveObserver(this); 57 Shell::GetInstance()->display_configurator()->RemoveObserver(this);
63 #endif // defined(OS_CHROMEOS)
64 display::Screen::GetScreen()->RemoveObserver(this); 58 display::Screen::GetScreen()->RemoveObserver(this);
65 59
66 widget_->RemoveObserver(this); 60 widget_->RemoveObserver(this);
67 } 61 }
68 62
69 void TouchObserverHUD::Clear() {} 63 void TouchObserverHUD::Clear() {}
70 64
71 void TouchObserverHUD::Remove() { 65 void TouchObserverHUD::Remove() {
72 root_window_->RemovePreTargetHandler(this); 66 root_window_->RemovePreTargetHandler(this);
73 67
(...skipping 19 matching lines...) Expand all
93 } 87 }
94 88
95 void TouchObserverHUD::OnDisplayMetricsChanged(const display::Display& display, 89 void TouchObserverHUD::OnDisplayMetricsChanged(const display::Display& display,
96 uint32_t metrics) { 90 uint32_t metrics) {
97 if (display.id() != display_id_ || !(metrics & DISPLAY_METRIC_BOUNDS)) 91 if (display.id() != display_id_ || !(metrics & DISPLAY_METRIC_BOUNDS))
98 return; 92 return;
99 93
100 widget_->SetSize(display.size()); 94 widget_->SetSize(display.size());
101 } 95 }
102 96
103 #if defined(OS_CHROMEOS)
104 void TouchObserverHUD::OnDisplayModeChanged( 97 void TouchObserverHUD::OnDisplayModeChanged(
105 const display::DisplayConfigurator::DisplayStateList& outputs) { 98 const display::DisplayConfigurator::DisplayStateList& outputs) {
106 // Clear touch HUD for any change in display mode (single, dual extended, dual 99 // Clear touch HUD for any change in display mode (single, dual extended, dual
107 // mirrored, ...). 100 // mirrored, ...).
108 Clear(); 101 Clear();
109 } 102 }
110 #endif // defined(OS_CHROMEOS)
111 103
112 void TouchObserverHUD::OnDisplaysInitialized() { 104 void TouchObserverHUD::OnDisplaysInitialized() {
113 OnDisplayConfigurationChanged(); 105 OnDisplayConfigurationChanged();
114 } 106 }
115 107
116 void TouchObserverHUD::OnDisplayConfigurationChanging() { 108 void TouchObserverHUD::OnDisplayConfigurationChanging() {
117 if (!root_window_) 109 if (!root_window_)
118 return; 110 return;
119 111
120 root_window_->RemovePreTargetHandler(this); 112 root_window_->RemovePreTargetHandler(this);
(...skipping 21 matching lines...) Expand all
142 widget_->GetNativeView(), 134 widget_->GetNativeView(),
143 Shell::GetContainer(root_window_, kShellWindowId_OverlayContainer)); 135 Shell::GetContainer(root_window_, kShellWindowId_OverlayContainer));
144 136
145 RootWindowController* controller = GetRootWindowController(root_window_); 137 RootWindowController* controller = GetRootWindowController(root_window_);
146 SetHudForRootWindowController(controller); 138 SetHudForRootWindowController(controller);
147 139
148 root_window_->AddPreTargetHandler(this); 140 root_window_->AddPreTargetHandler(this);
149 } 141 }
150 142
151 } // namespace ash 143 } // namespace ash
OLDNEW
« no previous file with comments | « ash/touch/touch_observer_hud.h ('k') | ash/touch/touch_observer_hud_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698