OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 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 |
| 5 #include "content/browser/web_contents/aura/slidable_wrapper.h" |
| 6 |
| 7 #include "ui/aura/window.h" |
| 8 #include "ui/compositor/layer.h" |
| 9 |
| 10 namespace content { |
| 11 |
| 12 SlidableWrapper::SlidableWrapper(scoped_ptr<aura::Window> window) |
| 13 : layer_(nullptr), |
| 14 window_(window.Pass()) { |
| 15 } |
| 16 |
| 17 SlidableWrapper::SlidableWrapper(scoped_ptr<ui::Layer> layer) |
| 18 : layer_(layer.Pass()), |
| 19 window_(nullptr) { |
| 20 } |
| 21 |
| 22 SlidableWrapper::~SlidableWrapper() { |
| 23 } |
| 24 |
| 25 ui::Layer* SlidableWrapper::GetLayer() { |
| 26 if (layer_) |
| 27 return layer_.get(); |
| 28 DCHECK(window_); |
| 29 return window_->layer(); |
| 30 } |
| 31 |
| 32 scoped_ptr<ui::Layer> SlidableWrapper::AcquireLayer() { |
| 33 DCHECK(layer_); |
| 34 return layer_.Pass(); |
| 35 } |
| 36 |
| 37 scoped_ptr<aura::Window> SlidableWrapper::AcquireWindow() { |
| 38 DCHECK(window_); |
| 39 return window_.Pass(); |
| 40 } |
| 41 |
| 42 gfx::Rect SlidableWrapper::GetBounds() { |
| 43 if (layer_) |
| 44 return layer_->bounds(); |
| 45 DCHECK(window_); |
| 46 return window_->bounds(); |
| 47 } |
| 48 |
| 49 void SlidableWrapper::SetBounds(const gfx::Rect& bounds) { |
| 50 if (layer_) { |
| 51 layer_->SetBounds(bounds); |
| 52 return; |
| 53 } |
| 54 DCHECK(window_); |
| 55 window_->SetBounds(bounds); |
| 56 } |
| 57 |
| 58 } // namespace content |
OLD | NEW |