Supervised user import: Listen for profile creation/deletion
[chromium-blink-merge.git] / components / view_manager / view_manager_app.h
blobfc16a0ce66cc22c640350d80797a77c352386223
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_VIEW_MANAGER_VIEW_MANAGER_APP_H_
6 #define COMPONENTS_VIEW_MANAGER_VIEW_MANAGER_APP_H_
8 #include "base/memory/scoped_ptr.h"
9 #include "components/view_manager/connection_manager_delegate.h"
10 #include "components/view_manager/public/interfaces/view_manager.mojom.h"
11 #include "components/window_manager/public/interfaces/window_manager_internal.mojom.h"
12 #include "mojo/common/tracing_impl.h"
13 #include "third_party/mojo/src/mojo/public/cpp/application/application_delegate.h"
14 #include "third_party/mojo/src/mojo/public/cpp/application/interface_factory.h"
15 #include "third_party/mojo/src/mojo/public/cpp/bindings/binding.h"
16 #include "third_party/mojo/src/mojo/public/cpp/bindings/error_handler.h"
18 namespace mojo {
19 class ApplicationImpl;
22 namespace view_manager {
24 class ConnectionManager;
26 class ViewManagerApp
27 : public mojo::ApplicationDelegate,
28 public ConnectionManagerDelegate,
29 public mojo::ErrorHandler,
30 public mojo::InterfaceFactory<mojo::ViewManagerService>,
31 public mojo::InterfaceFactory<mojo::WindowManagerInternalClient> {
32 public:
33 ViewManagerApp();
34 ~ViewManagerApp() override;
36 private:
37 // ApplicationDelegate:
38 void Initialize(mojo::ApplicationImpl* app) override;
39 bool ConfigureIncomingConnection(
40 mojo::ApplicationConnection* connection) override;
42 // ConnectionManagerDelegate:
43 void OnLostConnectionToWindowManager() override;
44 ClientConnection* CreateClientConnectionForEmbedAtView(
45 ConnectionManager* connection_manager,
46 mojo::InterfaceRequest<mojo::ViewManagerService> service_request,
47 mojo::ConnectionSpecificId creator_id,
48 const std::string& creator_url,
49 const std::string& url,
50 const ViewId& root_id) override;
51 ClientConnection* CreateClientConnectionForEmbedAtView(
52 ConnectionManager* connection_manager,
53 mojo::InterfaceRequest<mojo::ViewManagerService> service_request,
54 mojo::ConnectionSpecificId creator_id,
55 const std::string& creator_url,
56 const ViewId& root_id,
57 mojo::ViewManagerClientPtr view_manager_client) override;
59 // mojo::InterfaceFactory<mojo::ViewManagerService>:
60 void Create(
61 mojo::ApplicationConnection* connection,
62 mojo::InterfaceRequest<mojo::ViewManagerService> request) override;
64 // mojo::InterfaceFactory<mojo::WindowManagerInternalClient>:
65 void Create(mojo::ApplicationConnection* connection,
66 mojo::InterfaceRequest<mojo::WindowManagerInternalClient> request)
67 override;
69 // ErrorHandler (for |wm_internal_| and |wm_internal_client_binding_|).
70 void OnConnectionError() override;
72 mojo::ApplicationImpl* app_impl_;
73 mojo::ApplicationConnection* wm_app_connection_;
74 scoped_ptr<mojo::Binding<mojo::WindowManagerInternalClient>>
75 wm_internal_client_binding_;
76 mojo::InterfaceRequest<mojo::ViewManagerClient> wm_internal_client_request_;
77 mojo::WindowManagerInternalPtr wm_internal_;
78 scoped_ptr<ConnectionManager> connection_manager_;
79 mojo::TracingImpl tracing_;
81 DISALLOW_COPY_AND_ASSIGN(ViewManagerApp);
84 } // namespace view_manager
86 #endif // COMPONENTS_VIEW_MANAGER_VIEW_MANAGER_APP_H_