focus_client.cc 890 B

1234567891011121314151617181920212223242526272829
  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/focus_client.h"
  5. #include "ui/aura/client/aura_constants.h"
  6. #include "ui/aura/window_event_dispatcher.h"
  7. #include "ui/base/class_property.h"
  8. namespace aura {
  9. namespace client {
  10. void SetFocusClient(Window* root_window, FocusClient* client) {
  11. DCHECK_EQ(root_window->GetRootWindow(), root_window);
  12. root_window->SetProperty(kFocusClientKey, client);
  13. }
  14. FocusClient* GetFocusClient(Window* window) {
  15. return GetFocusClient(static_cast<const Window*>(window));
  16. }
  17. FocusClient* GetFocusClient(const Window* window) {
  18. const Window* root_window = window->GetRootWindow();
  19. return root_window ? root_window->GetProperty(kFocusClientKey) : nullptr;
  20. }
  21. } // namespace client
  22. } // namespace aura