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

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

Issue 2449073002: Makes DefaultCaptureClient work with a null root_window (Closed)
Patch Set: 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 | no next file » | 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..0178717edeade54d8de21bdf0913ee4ce7740f17 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,14 @@ 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_) {
+ capture_delegate = capture_window_->GetHost()->dispatcher();
msw 2016/10/25 17:57:58 q: just checking that the change from |root_window
capture_delegate->SetNativeCapture();
- else
+ } else {
+ 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 | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698