Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(473)

Side by Side Diff: apps/app_shim/app_shim_host_manager_mac.h

Issue 305973002: Rename IPC::ChannelFactory to ChannelHandleAcceptor. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef APPS_APP_SHIM_APP_SHIM_HOST_MANAGER_MAC_H_ 5 #ifndef APPS_APP_SHIM_APP_SHIM_HOST_MANAGER_MAC_H_
6 #define APPS_APP_SHIM_APP_SHIM_HOST_MANAGER_MAC_H_ 6 #define APPS_APP_SHIM_APP_SHIM_HOST_MANAGER_MAC_H_
7 7
8 #include "apps/app_shim/extension_app_shim_handler_mac.h" 8 #include "apps/app_shim/extension_app_shim_handler_mac.h"
9 #include "apps/app_shim/unix_domain_socket_acceptor.h"
9 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
10 #include "content/public/browser/browser_thread.h" 11 #include "content/public/browser/browser_thread.h"
11 #include "ipc/ipc_channel_factory.h"
12 12
13 namespace base { 13 namespace base {
14 class FilePath; 14 class FilePath;
15 } 15 }
16 16
17 namespace test { 17 namespace test {
18 class AppShimHostManagerTestApi; 18 class AppShimHostManagerTestApi;
19 } 19 }
20 20
21 // The AppShimHostManager receives connections from app shims on a UNIX 21 // The AppShimHostManager receives connections from app shims on a UNIX
22 // socket (|factory_|) and creates a helper object to manage the connection. 22 // socket (|acceptor_|) and creates a helper object to manage the connection.
23 class AppShimHostManager 23 class AppShimHostManager : public apps::UnixDomainSocketAcceptor::Delegate,
24 : public IPC::ChannelFactory::Delegate, 24 public base::RefCountedThreadSafe<
25 public base::RefCountedThreadSafe< 25 AppShimHostManager,
26 AppShimHostManager, content::BrowserThread::DeleteOnUIThread> { 26 content::BrowserThread::DeleteOnUIThread> {
27 public: 27 public:
28 AppShimHostManager(); 28 AppShimHostManager();
29 29
30 // Init passes this AppShimHostManager to PostTask which requires it to have 30 // Init passes this AppShimHostManager to PostTask which requires it to have
31 // a non-zero refcount. Therefore, Init cannot be called in the constructor 31 // a non-zero refcount. Therefore, Init cannot be called in the constructor
32 // since the refcount is zero at that point. 32 // since the refcount is zero at that point.
33 void Init(); 33 void Init();
34 34
35 apps::ExtensionAppShimHandler* extension_app_shim_handler() { 35 apps::ExtensionAppShimHandler* extension_app_shim_handler() {
36 return &extension_app_shim_handler_; 36 return &extension_app_shim_handler_;
37 } 37 }
38 38
39 private: 39 private:
40 friend class base::RefCountedThreadSafe<AppShimHostManager>; 40 friend class base::RefCountedThreadSafe<AppShimHostManager>;
41 friend struct content::BrowserThread::DeleteOnThread< 41 friend struct content::BrowserThread::DeleteOnThread<
42 content::BrowserThread::UI>; 42 content::BrowserThread::UI>;
43 friend class base::DeleteHelper<AppShimHostManager>; 43 friend class base::DeleteHelper<AppShimHostManager>;
44 friend class test::AppShimHostManagerTestApi; 44 friend class test::AppShimHostManagerTestApi;
45 virtual ~AppShimHostManager(); 45 virtual ~AppShimHostManager();
46 46
47 // IPC::ChannelFactory::Delegate implementation. 47 // UnixDomainSocketAcceptor::Delegate implementation.
48 virtual void OnClientConnected(const IPC::ChannelHandle& handle) OVERRIDE; 48 virtual void OnClientConnected(const IPC::ChannelHandle& handle) OVERRIDE;
49 virtual void OnListenError() OVERRIDE; 49 virtual void OnListenError() OVERRIDE;
50 50
51 // The |factory_| must be created on a thread which allows blocking I/O, so 51 // The |acceptor_| must be created on a thread which allows blocking I/O, so
52 // part of the initialization of this class must be carried out on the file 52 // part of the initialization of this class must be carried out on the file
53 // thread. 53 // thread.
54 void InitOnFileThread(); 54 void InitOnFileThread();
55 55
56 // Called on the IO thread to begin listening for connections from app shims. 56 // Called on the IO thread to begin listening for connections from app shims.
57 void ListenOnIOThread(); 57 void ListenOnIOThread();
58 58
59 // The AppShimHostManager is only initialized if the Chrome process 59 // The AppShimHostManager is only initialized if the Chrome process
60 // successfully took the singleton lock. This prevents subsequent processes 60 // successfully took the singleton lock. This prevents subsequent processes
61 // from deleting existing app shim socket files. 61 // from deleting existing app shim socket files.
62 bool did_init_; 62 bool did_init_;
63 63
64 base::FilePath directory_in_tmp_; 64 base::FilePath directory_in_tmp_;
65 65
66 scoped_ptr<IPC::ChannelFactory> factory_; 66 scoped_ptr<apps::UnixDomainSocketAcceptor> acceptor_;
67 67
68 apps::ExtensionAppShimHandler extension_app_shim_handler_; 68 apps::ExtensionAppShimHandler extension_app_shim_handler_;
69 69
70 DISALLOW_COPY_AND_ASSIGN(AppShimHostManager); 70 DISALLOW_COPY_AND_ASSIGN(AppShimHostManager);
71 }; 71 };
72 72
73 #endif // APPS_APP_SHIM_APP_SHIM_HOST_MANAGER_MAC_H_ 73 #endif // APPS_APP_SHIM_APP_SHIM_HOST_MANAGER_MAC_H_
OLDNEW
« no previous file with comments | « apps/app_shim/app_shim_host_manager_browsertest_mac.mm ('k') | apps/app_shim/app_shim_host_manager_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698