Index: content/browser/web_contents/aura/slidable_wrapper.cc |
diff --git a/content/browser/web_contents/aura/slidable_wrapper.cc b/content/browser/web_contents/aura/slidable_wrapper.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..49b75bc20ebe7c502d70aca10dafd5ca0e720a37 |
--- /dev/null |
+++ b/content/browser/web_contents/aura/slidable_wrapper.cc |
@@ -0,0 +1,58 @@ |
+// Copyright 2015 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "content/browser/web_contents/aura/slidable_wrapper.h" |
+ |
+#include "ui/aura/window.h" |
+#include "ui/compositor/layer.h" |
+ |
+namespace content { |
+ |
+SlidableWrapper::SlidableWrapper(scoped_ptr<aura::Window> window) |
+ : layer_(nullptr), |
+ window_(window.Pass()) { |
+} |
+ |
+SlidableWrapper::SlidableWrapper(scoped_ptr<ui::Layer> layer) |
+ : layer_(layer.Pass()), |
+ window_(nullptr) { |
+} |
+ |
+SlidableWrapper::~SlidableWrapper() { |
+} |
+ |
+ui::Layer* SlidableWrapper::GetLayer() { |
+ if (layer_) |
+ return layer_.get(); |
+ DCHECK(window_); |
+ return window_->layer(); |
+} |
+ |
+scoped_ptr<ui::Layer> SlidableWrapper::AcquireLayer() { |
+ DCHECK(layer_); |
+ return layer_.Pass(); |
+} |
+ |
+scoped_ptr<aura::Window> SlidableWrapper::AcquireWindow() { |
+ DCHECK(window_); |
+ return window_.Pass(); |
+} |
+ |
+gfx::Rect SlidableWrapper::GetBounds() { |
+ if (layer_) |
+ return layer_->bounds(); |
+ DCHECK(window_); |
+ return window_->bounds(); |
+} |
+ |
+void SlidableWrapper::SetBounds(const gfx::Rect& bounds) { |
+ if (layer_) { |
+ layer_->SetBounds(bounds); |
+ return; |
+ } |
+ DCHECK(window_); |
+ window_->SetBounds(bounds); |
+} |
+ |
+} // namespace content |