- add sources.
[platform/framework/web/crosswalk.git] / src / mojo / services / native_viewport / native_viewport_x11.cc
1 // Copyright 2013 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 "mojo/services/native_viewport/native_viewport.h"
6
7 namespace mojo {
8 namespace services {
9
10 class NativeViewportX11 : public NativeViewport {
11  public:
12   NativeViewportX11(NativeViewportDelegate* delegate)
13       : delegate_(delegate) {
14   }
15   virtual ~NativeViewportX11() {
16   }
17
18  private:
19   // Overridden from NativeViewport:
20   virtual void Close() OVERRIDE {
21     // TODO(beng): perform this in response to XWindow destruction.
22     delegate_->OnDestroyed();
23   }
24
25   NativeViewportDelegate* delegate_;
26
27   DISALLOW_COPY_AND_ASSIGN(NativeViewportX11);
28 };
29
30 // static
31 scoped_ptr<NativeViewport> NativeViewport::Create(
32     shell::Context* context,
33     NativeViewportDelegate* delegate) {
34   return scoped_ptr<NativeViewport>(new NativeViewportX11(delegate)).Pass();
35 }
36
37 }  // namespace services
38 }  // namespace mojo