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

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

Issue 1527603005: Bug fix: Show mouse cursor during full screen share on ChromeOS. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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 <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 } 69 }
70 const gfx::Rect window_bounds = window_->GetBoundsInScreen(); 70 const gfx::Rect window_bounds = window_->GetBoundsInScreen();
71 gfx::Point cursor_position = aura::Env::GetInstance()->last_mouse_location(); 71 gfx::Point cursor_position = aura::Env::GetInstance()->last_mouse_location();
72 if (!window_bounds.Contains(cursor_position)) { 72 if (!window_bounds.Contains(cursor_position)) {
73 // Return early if there is no need to draw the cursor. 73 // Return early if there is no need to draw the cursor.
74 DVLOG(2) << "Skipping update with cursor outside the window"; 74 DVLOG(2) << "Skipping update with cursor outside the window";
75 Clear(); 75 Clear();
76 return false; 76 return false;
77 } 77 }
78 78
79 aura::client::ActivationClient* activation_client = 79 // No need to check whether the root window, namely the screen is active or
80 aura::client::GetActivationClient(window_->GetRootWindow()); 80 // not.
Sergey Ulanov 2015/12/16 01:43:36 Please reword this to make it clear what's going o
qiangchen 2015/12/16 17:30:05 Done.
81 DCHECK(activation_client); 81 if (!window_->IsRootWindow()){
Sergey Ulanov 2015/12/16 01:43:36 formatting: need a space before {
qiangchen 2015/12/16 17:30:05 Done.
82 aura::Window* active_window = activation_client->GetActiveWindow(); 82 aura::client::ActivationClient* activation_client =
83 if (!active_window->Contains(window_)) { 83 aura::client::GetActivationClient(window_->GetRootWindow());
84 // Return early if the target window is not active. 84 DCHECK(activation_client);
85 DVLOG(2) << "Skipping update on an inactive window"; 85 aura::Window* active_window = activation_client->GetActiveWindow();
86 Clear(); 86 if (!active_window->Contains(window_)) {
87 return false; 87 // Return early if the target window is not active.
88 DVLOG(2) << "Skipping update on an inactive window";
89 Clear();
90 return false;
91 }
88 } 92 }
89 93
90 gfx::NativeCursor cursor = window_->GetHost()->last_cursor(); 94 gfx::NativeCursor cursor = window_->GetHost()->last_cursor();
91 gfx::Point cursor_hot_point; 95 gfx::Point cursor_hot_point;
92 if (last_cursor_ != cursor || 96 if (last_cursor_ != cursor ||
93 window_size_when_cursor_last_updated_ != window_bounds.size()) { 97 window_size_when_cursor_last_updated_ != window_bounds.size()) {
94 SkBitmap cursor_bitmap; 98 SkBitmap cursor_bitmap;
95 if (ui::GetCursorBitmap(cursor, &cursor_bitmap, &cursor_hot_point)) { 99 if (ui::GetCursorBitmap(cursor, &cursor_bitmap, &cursor_hot_point)) {
96 const int scaled_width = cursor_bitmap.width() * region_in_frame.width() / 100 const int scaled_width = cursor_bitmap.width() * region_in_frame.width() /
97 window_bounds.width(); 101 window_bounds.width();
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 } 214 }
211 215
212 void CursorRendererAura::OnWindowDestroying(aura::Window* window) { 216 void CursorRendererAura::OnWindowDestroying(aura::Window* window) {
213 DCHECK_EQ(window_, window); 217 DCHECK_EQ(window_, window);
214 window_->RemovePreTargetHandler(this); 218 window_->RemovePreTargetHandler(this);
215 window_->RemoveObserver(this); 219 window_->RemoveObserver(this);
216 window_ = nullptr; 220 window_ = nullptr;
217 } 221 }
218 222
219 } // namespace content 223 } // 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