OLD | NEW |
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2015 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 "content/browser/media/capture/cursor_renderer_aura.h" | 5 #include "content/browser/media/capture/cursor_renderer_aura.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <cmath> | 10 #include <cmath> |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 // Return early if the target window is not active. | 113 // Return early if the target window is not active. |
114 DVLOG(2) << "Skipping update on an inactive window"; | 114 DVLOG(2) << "Skipping update on an inactive window"; |
115 Clear(); | 115 Clear(); |
116 return false; | 116 return false; |
117 } | 117 } |
118 } | 118 } |
119 | 119 |
120 if (cursor_display_setting_ == kCursorEnabledOnMouseMovement) { | 120 if (cursor_display_setting_ == kCursorEnabledOnMouseMovement) { |
121 if (cursor_displayed_) { | 121 if (cursor_displayed_) { |
122 // Stop displaying cursor if there has been no mouse movement | 122 // Stop displaying cursor if there has been no mouse movement |
123 base::TimeDelta now = tick_clock_->NowTicks() - base::TimeTicks(); | 123 base::TimeTicks now = tick_clock_->NowTicks(); |
124 if ((now - last_mouse_movement_timestamp_) > | 124 if ((now - last_mouse_movement_timestamp_) > |
125 base::TimeDelta::FromSeconds(MAX_IDLE_TIME_SECONDS)) { | 125 base::TimeDelta::FromSeconds(MAX_IDLE_TIME_SECONDS)) { |
126 cursor_displayed_ = false; | 126 cursor_displayed_ = false; |
127 DVLOG(2) << "Turning off cursor display after idle time"; | 127 DVLOG(2) << "Turning off cursor display after idle time"; |
128 } | 128 } |
129 } | 129 } |
130 if (!cursor_displayed_) | 130 if (!cursor_displayed_) |
131 return false; | 131 return false; |
132 } | 132 } |
133 | 133 |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 | 246 |
247 void CursorRendererAura::OnWindowDestroying(aura::Window* window) { | 247 void CursorRendererAura::OnWindowDestroying(aura::Window* window) { |
248 DCHECK_EQ(window_, window); | 248 DCHECK_EQ(window_, window); |
249 if (cursor_display_setting_ == kCursorEnabledOnMouseMovement) | 249 if (cursor_display_setting_ == kCursorEnabledOnMouseMovement) |
250 window_->RemovePreTargetHandler(this); | 250 window_->RemovePreTargetHandler(this); |
251 window_->RemoveObserver(this); | 251 window_->RemoveObserver(this); |
252 window_ = nullptr; | 252 window_ = nullptr; |
253 } | 253 } |
254 | 254 |
255 } // namespace content | 255 } // namespace content |
OLD | NEW |