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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 // Return early if the target window is not active. | 108 // Return early if the target window is not active. |
109 DVLOG(2) << "Skipping update on an inactive window"; | 109 DVLOG(2) << "Skipping update on an inactive window"; |
110 Clear(); | 110 Clear(); |
111 return false; | 111 return false; |
112 } | 112 } |
113 } | 113 } |
114 | 114 |
115 if (cursor_display_setting_ == kCursorEnabledOnMouseMovement) { | 115 if (cursor_display_setting_ == kCursorEnabledOnMouseMovement) { |
116 if (cursor_displayed_) { | 116 if (cursor_displayed_) { |
117 // Stop displaying cursor if there has been no mouse movement | 117 // Stop displaying cursor if there has been no mouse movement |
118 base::TimeDelta now = tick_clock_->NowTicks() - base::TimeTicks(); | 118 base::TimeTicks now = tick_clock_->NowTicks(); |
119 if ((now - last_mouse_movement_timestamp_) > | 119 if ((now - last_mouse_movement_timestamp_) > |
120 base::TimeDelta::FromSeconds(MAX_IDLE_TIME_SECONDS)) { | 120 base::TimeDelta::FromSeconds(MAX_IDLE_TIME_SECONDS)) { |
121 cursor_displayed_ = false; | 121 cursor_displayed_ = false; |
122 DVLOG(2) << "Turning off cursor display after idle time"; | 122 DVLOG(2) << "Turning off cursor display after idle time"; |
123 } | 123 } |
124 } | 124 } |
125 if (!cursor_displayed_) | 125 if (!cursor_displayed_) |
126 return false; | 126 return false; |
127 } | 127 } |
128 | 128 |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 | 241 |
242 void CursorRendererAura::OnWindowDestroying(aura::Window* window) { | 242 void CursorRendererAura::OnWindowDestroying(aura::Window* window) { |
243 DCHECK_EQ(window_, window); | 243 DCHECK_EQ(window_, window); |
244 if (cursor_display_setting_ == kCursorEnabledOnMouseMovement) | 244 if (cursor_display_setting_ == kCursorEnabledOnMouseMovement) |
245 window_->RemovePreTargetHandler(this); | 245 window_->RemovePreTargetHandler(this); |
246 window_->RemoveObserver(this); | 246 window_->RemoveObserver(this); |
247 window_ = nullptr; | 247 window_ = nullptr; |
248 } | 248 } |
249 | 249 |
250 } // namespace content | 250 } // namespace content |
OLD | NEW |