3eaadd79d8489fe04a43b26002fc7614c6fbbe94
[platform/framework/web/crosswalk.git] / src / mojo / services / surfaces / surfaces_service_application.cc
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 "mojo/services/surfaces/surfaces_service_application.h"
6
7 #include "cc/surfaces/display.h"
8
9 namespace mojo {
10
11 SurfacesServiceApplication::SurfacesServiceApplication()
12     : next_id_namespace_(1u), display_(NULL) {
13 }
14
15 SurfacesServiceApplication::~SurfacesServiceApplication() {
16 }
17
18 bool SurfacesServiceApplication::ConfigureIncomingConnection(
19     ApplicationConnection* connection) {
20   connection->AddService(this);
21   return true;
22 }
23
24 void SurfacesServiceApplication::Create(ApplicationConnection* connection,
25                                         InterfaceRequest<Surface> request) {
26   BindToRequest(new SurfacesImpl(&manager_, next_id_namespace_++, this),
27                 &request);
28 }
29
30 void SurfacesServiceApplication::FrameSubmitted() {
31   if (display_)
32     display_->Draw();
33 }
34
35 void SurfacesServiceApplication::SetDisplay(cc::Display* display) {
36   display_ = display;
37 }
38
39 // static
40 ApplicationDelegate* ApplicationDelegate::Create() {
41   return new SurfacesServiceApplication;
42 }
43
44 }  // namespace mojo