1
    2
    3
    4
    5
    6
    7
    8
    9
   10
   11
   12
   13
   14
   15
   16
   17
   18
   19
   20
   21
   22
   23
   24
   25
   26
   27
   28
   29
   30
   31
   32

ash / wm / window_parenting_controller.cc [blame]

// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "ash/wm/window_parenting_controller.h"

#include "ash/shell.h"
#include "ash/wm/container_finder.h"

namespace ash {

WindowParentingController::WindowParentingController(aura::Window* root_window)
    : root_window_(root_window) {
  aura::client::SetWindowParentingClient(root_window, this);
}

WindowParentingController::~WindowParentingController() {
  aura::client::SetWindowParentingClient(root_window_, nullptr);
}

aura::Window* WindowParentingController::GetDefaultParent(
    aura::Window* window,
    const gfx::Rect& bounds,
    int64_t display_id) {
  auto* target_root = Shell::GetRootWindowForDisplayId(display_id);
  if (target_root == nullptr) {
    target_root = root_window_;
  }
  return GetDefaultParentForWindow(window, target_root, bounds);
}

}  // namespace ash