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

Unified Diff: ui/aura/client/default_capture_client.cc

Issue 2449073002: Makes DefaultCaptureClient work with a null root_window (Closed)
Patch Set: client:: Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | ui/aura/test/aura_test_helper.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/aura/client/default_capture_client.cc
diff --git a/ui/aura/client/default_capture_client.cc b/ui/aura/client/default_capture_client.cc
index 19f0d40c2a0127b1e21fa39d88db835983db2abd..5132431d380f4888ec369f79b39b8c064dad2438 100644
--- a/ui/aura/client/default_capture_client.cc
+++ b/ui/aura/client/default_capture_client.cc
@@ -20,13 +20,15 @@ Window* global_capture_window_ = nullptr;
DefaultCaptureClient::DefaultCaptureClient(Window* root_window)
: root_window_(root_window), capture_window_(nullptr) {
- SetCaptureClient(root_window_, this);
+ if (root_window_)
+ SetCaptureClient(root_window_, this);
}
DefaultCaptureClient::~DefaultCaptureClient() {
if (global_capture_window_ == capture_window_)
global_capture_window_ = nullptr;
- SetCaptureClient(root_window_, nullptr);
+ if (root_window_)
+ SetCaptureClient(root_window_, nullptr);
}
void DefaultCaptureClient::SetCapture(Window* window) {
@@ -39,11 +41,17 @@ void DefaultCaptureClient::SetCapture(Window* window) {
capture_window_ = window;
global_capture_window_ = window;
- CaptureDelegate* capture_delegate = root_window_->GetHost()->dispatcher();
- if (capture_window_)
+ CaptureDelegate* capture_delegate = nullptr;
+ if (capture_window_) {
+ DCHECK(!root_window_ || root_window_ == capture_window_->GetRootWindow());
+ capture_delegate = capture_window_->GetHost()->dispatcher();
capture_delegate->SetNativeCapture();
- else
+ } else {
+ DCHECK(!root_window_ ||
+ root_window_ == old_capture_window->GetRootWindow());
+ capture_delegate = old_capture_window->GetHost()->dispatcher();
capture_delegate->ReleaseNativeCapture();
+ }
capture_delegate->UpdateCapture(old_capture_window, capture_window_);
« no previous file with comments | « no previous file | ui/aura/test/aura_test_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698