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.
5 #ifndef CHROME_BROWSER_WEB_APPLICATIONS_APP_SHIM_HOST_MANAGER_MAC_H_
6 #define CHROME_BROWSER_WEB_APPLICATIONS_APP_SHIM_HOST_MANAGER_MAC_H_
8 #include "apps/app_shim/extension_app_shim_handler_mac.h"
9 #include "base/memory/weak_ptr.h"
10 #include "ipc/ipc_channel_factory.h"
12 // The AppShimHostManager receives connections from app shims on a UNIX
13 // socket (|factory_|) and creates a helper object to manage the connection.
14 class AppShimHostManager
15 : public IPC::ChannelFactory::Delegate
,
16 public base::SupportsWeakPtr
<AppShimHostManager
> {
19 virtual ~AppShimHostManager();
21 apps::ExtensionAppShimHandler
* extension_app_shim_handler() {
22 return &extension_app_shim_handler_
;
26 // IPC::ChannelFactory::Delegate implementation.
27 virtual void OnClientConnected(const IPC::ChannelHandle
& handle
) OVERRIDE
;
28 virtual void OnListenError() OVERRIDE
;
30 // The |factory_| must be created on a thread which allows blocking I/O, so
31 // part of the initialization of this class must be carried out on the file
33 void InitOnFileThread();
35 // Called on the IO thread to begin listening for connections from app shims.
36 void ListenOnIOThread();
38 scoped_ptr
<IPC::ChannelFactory
> factory_
;
40 apps::ExtensionAppShimHandler extension_app_shim_handler_
;
42 DISALLOW_COPY_AND_ASSIGN(AppShimHostManager
);
45 #endif // CHROME_BROWSER_WEB_APPLICATIONS_APP_SHIM_HOST_MANAGER_MAC_H_