OLD | NEW |
(Empty) | |
| 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. |
| 4 |
| 5 #include "base/basictypes.h" |
| 6 #include "base/logging.h" |
| 7 #include "base/strings/stringprintf.h" |
| 8 #include "ui/ozone/window/ozone_window.h" |
| 9 #include "ui/ozone/window/window_factory_ozone.h" |
| 10 |
| 11 namespace ui { |
| 12 |
| 13 namespace { |
| 14 |
| 15 // A default window that can be resized. |
| 16 class DefaultOzoneWindow : public OzoneWindow { |
| 17 public: |
| 18 DefaultOzoneWindow(const gfx::Rect& bounds) : bounds_(bounds) {} |
| 19 virtual ~DefaultOzoneWindow() {} |
| 20 |
| 21 // OzoneWindow: |
| 22 virtual gfx::Rect GetBounds() { return bounds_; } |
| 23 virtual bool Resize(const gfx::Rect& bounds) { |
| 24 bounds_ = bounds; |
| 25 return true; |
| 26 } |
| 27 |
| 28 private: |
| 29 gfx::Rect bounds_; |
| 30 }; |
| 31 } |
| 32 |
| 33 // static |
| 34 WindowFactoryOzone* WindowFactoryOzone::impl_ = NULL; |
| 35 |
| 36 WindowFactoryOzone::WindowFactoryOzone() {} |
| 37 |
| 38 WindowFactoryOzone::~WindowFactoryOzone() {} |
| 39 |
| 40 WindowFactoryOzone* WindowFactoryOzone::GetInstance() { |
| 41 CHECK(impl_) << "No WindowFactoryOzone implementation set."; |
| 42 return impl_; |
| 43 } |
| 44 |
| 45 void WindowFactoryOzone::SetInstance(WindowFactoryOzone* impl) { impl_ = impl; } |
| 46 |
| 47 scoped_ptr<OzoneWindow> WindowFactoryOzone::CreateWindow( |
| 48 const gfx::Rect& bounds) { |
| 49 return make_scoped_ptr<OzoneWindow>(new DefaultOzoneWindow(bounds)); |
| 50 } |
| 51 |
| 52 } // namespace ui |
OLD | NEW |