capture_client.cc 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  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. #include "ui/aura/client/capture_client.h"
  5. #include "ui/aura/window.h"
  6. #include "ui/aura/window_event_dispatcher.h"
  7. #include "ui/base/class_property.h"
  8. DEFINE_UI_CLASS_PROPERTY_TYPE(aura::client::CaptureClient*)
  9. namespace aura {
  10. namespace client {
  11. DEFINE_UI_CLASS_PROPERTY_KEY(CaptureClient*, kRootWindowCaptureClientKey, NULL)
  12. void SetCaptureClient(Window* root_window, CaptureClient* client) {
  13. root_window->SetProperty(kRootWindowCaptureClientKey, client);
  14. }
  15. CaptureClient* GetCaptureClient(Window* root_window) {
  16. return root_window ?
  17. root_window->GetProperty(kRootWindowCaptureClientKey) : NULL;
  18. }
  19. Window* GetCaptureWindow(Window* window) {
  20. Window* root_window = window->GetRootWindow();
  21. if (!root_window)
  22. return NULL;
  23. CaptureClient* capture_client = GetCaptureClient(root_window);
  24. return capture_client ? capture_client->GetCaptureWindow() : NULL;
  25. }
  26. } // namespace client
  27. } // namespace aura