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.
5 #ifndef COMPONENTS_WINDOW_MANAGER_WINDOW_MANAGER_IMPL_H_
6 #define COMPONENTS_WINDOW_MANAGER_WINDOW_MANAGER_IMPL_H_
8 #include "base/basictypes.h"
9 #include "base/logging.h"
10 #include "components/view_manager/public/cpp/types.h"
11 #include "components/window_manager/public/interfaces/window_manager.mojom.h"
12 #include "third_party/mojo/src/mojo/public/cpp/bindings/binding.h"
13 #include "third_party/mojo/src/mojo/public/cpp/bindings/error_handler.h"
15 namespace window_manager
{
17 class WindowManagerApp
;
19 class WindowManagerImpl
: public mojo::WindowManager
,
20 public mojo::ErrorHandler
{
22 // See description above |from_vm_| for details on |from_vm|.
23 // WindowManagerImpl deletes itself on connection errors. WindowManagerApp
24 // also deletes WindowManagerImpl in its destructor.
25 WindowManagerImpl(WindowManagerApp
* window_manager
, bool from_vm
);
26 ~WindowManagerImpl() override
;
28 void Bind(mojo::ScopedMessagePipeHandle window_manager_pipe
);
31 // mojo::WindowManager:
32 void Embed(const mojo::String
& url
,
33 mojo::InterfaceRequest
<mojo::ServiceProvider
> services
,
34 mojo::ServiceProviderPtr exposed_services
) override
;
36 // mojo::ErrorHandler:
37 void OnConnectionError() override
;
39 WindowManagerApp
* window_manager_
;
41 // Whether this connection originated from the ViewManager. Connections that
42 // originate from the view manager are expected to have clients. Connections
43 // that don't originate from the view manager do not have clients.
46 mojo::Binding
<mojo::WindowManager
> binding_
;
48 DISALLOW_COPY_AND_ASSIGN(WindowManagerImpl
);
51 } // namespace window_manager
53 #endif // COMPONENTS_WINDOW_MANAGER_WINDOW_MANAGER_IMPL_H_