Chromium Code Reviews| 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_); |