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

Side by Side Diff: content/browser/media/capture/cursor_renderer_aura.cc

Issue 2466453003: Fix nullptr access in CursorRendererAura::SnapshotCursorState. (Closed)
Patch Set: Created 4 years, 1 month 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 | « no previous file | no next file » | 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) 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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 // cursor when the window is active. 102 // cursor when the window is active.
103 if (!window_->IsRootWindow()) { 103 if (!window_->IsRootWindow()) {
104 aura::client::ActivationClient* activation_client = 104 aura::client::ActivationClient* activation_client =
105 aura::client::GetActivationClient(window_->GetRootWindow()); 105 aura::client::GetActivationClient(window_->GetRootWindow());
106 if (!activation_client) { 106 if (!activation_client) {
107 DVLOG(2) << "Assume window inactive with invalid activation_client"; 107 DVLOG(2) << "Assume window inactive with invalid activation_client";
108 Clear(); 108 Clear();
109 return false; 109 return false;
110 } 110 }
111 aura::Window* active_window = activation_client->GetActiveWindow(); 111 aura::Window* active_window = activation_client->GetActiveWindow();
112 if (!active_window) {
113 DVLOG(2) << "Skipping update as there is no active window";
114 Clear();
115 return false;
116 }
112 if (!active_window->Contains(window_)) { 117 if (!active_window->Contains(window_)) {
113 // Return early if the target window is not active. 118 // Return early if the target window is not active.
114 DVLOG(2) << "Skipping update on an inactive window"; 119 DVLOG(2) << "Skipping update on an inactive window";
115 Clear(); 120 Clear();
116 return false; 121 return false;
117 } 122 }
118 } 123 }
119 124
120 if (cursor_display_setting_ == kCursorEnabledOnMouseMovement) { 125 if (cursor_display_setting_ == kCursorEnabledOnMouseMovement) {
121 if (cursor_displayed_) { 126 if (cursor_displayed_) {
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 251
247 void CursorRendererAura::OnWindowDestroying(aura::Window* window) { 252 void CursorRendererAura::OnWindowDestroying(aura::Window* window) {
248 DCHECK_EQ(window_, window); 253 DCHECK_EQ(window_, window);
249 if (cursor_display_setting_ == kCursorEnabledOnMouseMovement) 254 if (cursor_display_setting_ == kCursorEnabledOnMouseMovement)
250 window_->RemovePreTargetHandler(this); 255 window_->RemovePreTargetHandler(this);
251 window_->RemoveObserver(this); 256 window_->RemoveObserver(this);
252 window_ = nullptr; 257 window_ = nullptr;
253 } 258 }
254 259
255 } // namespace content 260 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698