| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "ui/aura/shared/root_window_capture_client.h" | |
| 6 | |
| 7 #include "ui/aura/root_window.h" | |
| 8 #include "ui/aura/window.h" | |
| 9 | |
| 10 namespace aura { | |
| 11 namespace shared { | |
| 12 | |
| 13 //////////////////////////////////////////////////////////////////////////////// | |
| 14 // RootWindowCaptureClient, public: | |
| 15 | |
| 16 RootWindowCaptureClient::RootWindowCaptureClient(RootWindow* root_window) | |
| 17 : root_window_(root_window), | |
| 18 capture_window_(NULL) { | |
| 19 client::SetCaptureClient(root_window, this); | |
| 20 } | |
| 21 | |
| 22 RootWindowCaptureClient::~RootWindowCaptureClient() { | |
| 23 client::SetCaptureClient(root_window_, NULL); | |
| 24 } | |
| 25 | |
| 26 //////////////////////////////////////////////////////////////////////////////// | |
| 27 // RootWindowCaptureClient, client::CaptureClient implementation: | |
| 28 | |
| 29 void RootWindowCaptureClient::SetCapture(Window* window) { | |
| 30 if (capture_window_ == window) | |
| 31 return; | |
| 32 root_window_->gesture_recognizer()->TransferEventsTo(capture_window_, window); | |
| 33 | |
| 34 aura::Window* old_capture_window = capture_window_; | |
| 35 capture_window_ = window; | |
| 36 | |
| 37 if (capture_window_) | |
| 38 root_window_->SetNativeCapture(); | |
| 39 else | |
| 40 root_window_->ReleaseNativeCapture(); | |
| 41 | |
| 42 root_window_->UpdateCapture(old_capture_window, capture_window_); | |
| 43 } | |
| 44 | |
| 45 void RootWindowCaptureClient::ReleaseCapture(Window* window) { | |
| 46 if (capture_window_ != window) | |
| 47 return; | |
| 48 SetCapture(NULL); | |
| 49 } | |
| 50 | |
| 51 Window* RootWindowCaptureClient::GetCaptureWindow() { | |
| 52 return capture_window_; | |
| 53 } | |
| 54 | |
| 55 } // namespace shared | |
| 56 } // namespace aura | |
| OLD | NEW |