Index: ui/ozone/window/window_factory_ozone.cc |
diff --git a/ui/ozone/window/window_factory_ozone.cc b/ui/ozone/window/window_factory_ozone.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..eed4a715d57d668a252ec434bef94e3dd6167571 |
--- /dev/null |
+++ b/ui/ozone/window/window_factory_ozone.cc |
@@ -0,0 +1,52 @@ |
+// Copyright 2014 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 "base/basictypes.h" |
+#include "base/logging.h" |
+#include "base/strings/stringprintf.h" |
+#include "ui/ozone/window/ozone_window.h" |
+#include "ui/ozone/window/window_factory_ozone.h" |
+ |
+namespace ui { |
+ |
+namespace { |
+ |
+// A default window that can be resized. |
+class DefaultOzoneWindow : public OzoneWindow { |
+ public: |
+ DefaultOzoneWindow(const gfx::Rect& bounds) : bounds_(bounds) {} |
+ virtual ~DefaultOzoneWindow() {} |
+ |
+ // OzoneWindow: |
+ virtual gfx::Rect GetBounds() { return bounds_; } |
+ virtual bool Resize(const gfx::Rect& bounds) { |
+ bounds_ = bounds; |
+ return true; |
+ } |
+ |
+ private: |
+ gfx::Rect bounds_; |
+}; |
+} |
+ |
+// static |
+WindowFactoryOzone* WindowFactoryOzone::impl_ = NULL; |
+ |
+WindowFactoryOzone::WindowFactoryOzone() {} |
+ |
+WindowFactoryOzone::~WindowFactoryOzone() {} |
+ |
+WindowFactoryOzone* WindowFactoryOzone::GetInstance() { |
+ CHECK(impl_) << "No WindowFactoryOzone implementation set."; |
+ return impl_; |
+} |
+ |
+void WindowFactoryOzone::SetInstance(WindowFactoryOzone* impl) { impl_ = impl; } |
+ |
+scoped_ptr<OzoneWindow> WindowFactoryOzone::CreateWindow( |
+ const gfx::Rect& bounds) { |
+ return make_scoped_ptr<OzoneWindow>(new DefaultOzoneWindow(bounds)); |
+} |
+ |
+} // namespace ui |