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

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

Issue 1413803002: Window capture stop draw cursor when it points to the hidden content. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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 | « 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/aura_window_capture_machine.h" 5 #include "content/browser/media/capture/aura_window_capture_machine.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #include "base/timer/timer.h" 9 #include "base/timer/timer.h"
10 #include "cc/output/copy_output_request.h" 10 #include "cc/output/copy_output_request.h"
(...skipping 12 matching lines...) Expand all
23 #include "ui/aura/client/screen_position_client.h" 23 #include "ui/aura/client/screen_position_client.h"
24 #include "ui/aura/env.h" 24 #include "ui/aura/env.h"
25 #include "ui/aura/window.h" 25 #include "ui/aura/window.h"
26 #include "ui/aura/window_observer.h" 26 #include "ui/aura/window_observer.h"
27 #include "ui/aura/window_tree_host.h" 27 #include "ui/aura/window_tree_host.h"
28 #include "ui/base/cursor/cursors_aura.h" 28 #include "ui/base/cursor/cursors_aura.h"
29 #include "ui/compositor/compositor.h" 29 #include "ui/compositor/compositor.h"
30 #include "ui/compositor/dip_util.h" 30 #include "ui/compositor/dip_util.h"
31 #include "ui/compositor/layer.h" 31 #include "ui/compositor/layer.h"
32 #include "ui/gfx/screen.h" 32 #include "ui/gfx/screen.h"
33 #include "ui/wm/public/activation_client.h"
33 34
34 namespace content { 35 namespace content {
35 36
36 namespace { 37 namespace {
37 38
38 int clip_byte(int x) { 39 int clip_byte(int x) {
39 return std::max(0, std::min(x, 255)); 40 return std::max(0, std::min(x, 255));
40 } 41 }
41 42
42 int alpha_blend(int alpha, int src, int dst) { 43 int alpha_blend(int alpha, int src, int dst) {
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after
406 gfx::Point AuraWindowCaptureMachine::UpdateCursorState( 407 gfx::Point AuraWindowCaptureMachine::UpdateCursorState(
407 const gfx::Rect& region_in_frame) { 408 const gfx::Rect& region_in_frame) {
408 const gfx::Rect window_bounds = desktop_window_->GetBoundsInScreen(); 409 const gfx::Rect window_bounds = desktop_window_->GetBoundsInScreen();
409 gfx::Point cursor_position = aura::Env::GetInstance()->last_mouse_location(); 410 gfx::Point cursor_position = aura::Env::GetInstance()->last_mouse_location();
410 if (!window_bounds.Contains(cursor_position)) { 411 if (!window_bounds.Contains(cursor_position)) {
411 // Return early if there is no need to draw the cursor. 412 // Return early if there is no need to draw the cursor.
412 ClearCursorState(); 413 ClearCursorState();
413 return gfx::Point(); 414 return gfx::Point();
414 } 415 }
415 416
417 // Return early if the target content pointed by the mouse is hidden.
418 aura::client::ActivationClient* activation_client =
419 aura::client::GetActivationClient(desktop_window_->GetRootWindow());
420 DCHECK(activation_client);
421 aura::Window* active_window = activation_client->GetActiveWindow();
422 DCHECK(active_window);
423 if (active_window != desktop_window_) {
424 if (active_window->GetBoundsInScreen().Contains(cursor_position)) {
miu 2015/10/19 19:49:47 This mostly works. It wouldn't if there were TWO
xjz 2015/10/20 00:03:21 Done.
425 ClearCursorState();
426 return gfx::Point();
427 }
428 }
429
416 gfx::NativeCursor cursor = desktop_window_->GetHost()->last_cursor(); 430 gfx::NativeCursor cursor = desktop_window_->GetHost()->last_cursor();
417 gfx::Point cursor_hot_point; 431 gfx::Point cursor_hot_point;
418 if (last_cursor_ != cursor || 432 if (last_cursor_ != cursor ||
419 window_size_when_cursor_last_updated_ != window_bounds.size()) { 433 window_size_when_cursor_last_updated_ != window_bounds.size()) {
420 SkBitmap cursor_bitmap; 434 SkBitmap cursor_bitmap;
421 if (ui::GetCursorBitmap(cursor, &cursor_bitmap, &cursor_hot_point)) { 435 if (ui::GetCursorBitmap(cursor, &cursor_bitmap, &cursor_hot_point)) {
422 const int scaled_width = cursor_bitmap.width() * 436 const int scaled_width = cursor_bitmap.width() *
423 region_in_frame.width() / window_bounds.width(); 437 region_in_frame.width() / window_bounds.width();
424 const int scaled_height = cursor_bitmap.height() * 438 const int scaled_height = cursor_bitmap.height() *
425 region_in_frame.height() / window_bounds.height(); 439 region_in_frame.height() / window_bounds.height();
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
501 // TODO(miu): The CopyOutputRequest should be made earlier, at WillCommit(). 515 // TODO(miu): The CopyOutputRequest should be made earlier, at WillCommit().
502 // http://crbug.com/492839 516 // http://crbug.com/492839
503 BrowserThread::PostTask( 517 BrowserThread::PostTask(
504 BrowserThread::UI, 518 BrowserThread::UI,
505 FROM_HERE, 519 FROM_HERE,
506 base::Bind(&AuraWindowCaptureMachine::Capture, weak_factory_.GetWeakPtr(), 520 base::Bind(&AuraWindowCaptureMachine::Capture, weak_factory_.GetWeakPtr(),
507 true)); 521 true));
508 } 522 }
509 523
510 } // namespace content 524 } // 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