event_client.cc 951 B

12345678910111213141516171819202122232425262728293031
  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/event_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::EventClient*)
  9. namespace aura {
  10. namespace client {
  11. DEFINE_UI_CLASS_PROPERTY_KEY(EventClient*, kRootWindowEventClientKey, NULL)
  12. void SetEventClient(Window* root_window, EventClient* client) {
  13. DCHECK_EQ(root_window->GetRootWindow(), root_window);
  14. root_window->SetProperty(kRootWindowEventClientKey, client);
  15. }
  16. EventClient* GetEventClient(const Window* root_window) {
  17. if (root_window)
  18. DCHECK_EQ(root_window->GetRootWindow(), root_window);
  19. return root_window ?
  20. root_window->GetProperty(kRootWindowEventClientKey) : NULL;
  21. }
  22. } // namespace client
  23. } // namespace aura