Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(692)

Unified Diff: ui/ozone/window/window_factory_ozone.cc

Issue 205433005: ozone: Add OzoneWindowFactory & OzoneWindow (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« ui/ozone/window/ozone_window.h ('K') | « ui/ozone/window/window_factory_ozone.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« ui/ozone/window/ozone_window.h ('K') | « ui/ozone/window/window_factory_ozone.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698