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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(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
OLDNEW
« 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