Specifies background after Widget::Init for frameless app_list.
[chromium-blink-merge.git] / ui / compositor / layer_tree_owner.cc
blobebb0a7fc7f4b9da01245d897d4d9e66e19c5da82
1 // Copyright 2014 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.
5 #include "ui/compositor/layer_tree_owner.h"
7 #include "ui/compositor/layer.h"
9 namespace ui {
11 namespace {
13 // Deletes |layer| and all its descendants.
14 void DeepDeleteLayers(Layer* layer) {
15 std::vector<Layer*> children = layer->children();
16 for (std::vector<Layer*>::const_iterator it = children.begin();
17 it != children.end();
18 ++it) {
19 Layer* child = *it;
20 DeepDeleteLayers(child);
22 delete layer;
25 } // namespace
27 LayerTreeOwner::LayerTreeOwner(Layer* root) : root_(root) {}
29 LayerTreeOwner::~LayerTreeOwner() {
30 if (root_)
31 DeepDeleteLayers(root_);
34 } // namespace ui