OLD | NEW |
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 #include "chrome/browser/apps/app_shim/app_shim_host_mac.h" | 5 #include "chrome/browser/apps/app_shim/app_shim_host_mac.h" |
6 | 6 |
| 7 #include <utility> |
| 8 |
7 #include "base/bind.h" | 9 #include "base/bind.h" |
8 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
9 #include "base/logging.h" | 11 #include "base/logging.h" |
10 #include "chrome/browser/apps/app_shim/app_shim_handler_mac.h" | 12 #include "chrome/browser/apps/app_shim/app_shim_handler_mac.h" |
11 #include "chrome/common/mac/app_shim_messages.h" | 13 #include "chrome/common/mac/app_shim_messages.h" |
12 #include "content/public/browser/browser_thread.h" | 14 #include "content/public/browser/browser_thread.h" |
| 15 #include "ipc/ipc_channel_mojo.h" |
13 #include "ipc/ipc_channel_proxy.h" | 16 #include "ipc/ipc_channel_proxy.h" |
| 17 #include "mojo/edk/embedder/embedder.h" |
14 | 18 |
15 AppShimHost::AppShimHost() : initial_launch_finished_(false) {} | 19 AppShimHost::AppShimHost() : initial_launch_finished_(false) {} |
16 | 20 |
17 AppShimHost::~AppShimHost() { | 21 AppShimHost::~AppShimHost() { |
18 DCHECK(CalledOnValidThread()); | 22 DCHECK(CalledOnValidThread()); |
19 apps::AppShimHandler* handler = apps::AppShimHandler::GetForAppMode(app_id_); | 23 apps::AppShimHandler* handler = apps::AppShimHandler::GetForAppMode(app_id_); |
20 if (handler) | 24 if (handler) |
21 handler->OnShimClose(this); | 25 handler->OnShimClose(this); |
22 } | 26 } |
23 | 27 |
24 void AppShimHost::ServeChannel(const IPC::ChannelHandle& handle) { | 28 void AppShimHost::ServeChannel(mojo::edk::ScopedPlatformHandle handle) { |
25 DCHECK(CalledOnValidThread()); | 29 DCHECK(CalledOnValidThread()); |
26 DCHECK(!channel_.get()); | 30 DCHECK(!channel_.get()); |
| 31 |
27 channel_ = IPC::ChannelProxy::Create( | 32 channel_ = IPC::ChannelProxy::Create( |
28 handle, IPC::Channel::MODE_SERVER, this, | 33 IPC::ChannelMojo::CreateServerFactory( |
| 34 mojo::edk::ConnectToPeerProcess(std::move(handle)), |
| 35 content::BrowserThread::GetTaskRunnerForThread( |
| 36 content::BrowserThread::IO) |
| 37 .get()), |
| 38 this, |
29 content::BrowserThread::GetTaskRunnerForThread(content::BrowserThread::IO) | 39 content::BrowserThread::GetTaskRunnerForThread(content::BrowserThread::IO) |
30 .get()); | 40 .get()); |
31 } | 41 } |
32 | 42 |
33 base::FilePath AppShimHost::GetProfilePath() const { | 43 base::FilePath AppShimHost::GetProfilePath() const { |
34 return profile_path_; | 44 return profile_path_; |
35 } | 45 } |
36 | 46 |
37 std::string AppShimHost::GetAppId() const { | 47 std::string AppShimHost::GetAppId() const { |
38 return app_id_; | 48 return app_id_; |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 } | 133 } |
124 | 134 |
125 void AppShimHost::OnAppRequestUserAttention(apps::AppShimAttentionType type) { | 135 void AppShimHost::OnAppRequestUserAttention(apps::AppShimAttentionType type) { |
126 Send(new AppShimMsg_SetUserAttention(type)); | 136 Send(new AppShimMsg_SetUserAttention(type)); |
127 } | 137 } |
128 | 138 |
129 void AppShimHost::Close() { | 139 void AppShimHost::Close() { |
130 DCHECK(CalledOnValidThread()); | 140 DCHECK(CalledOnValidThread()); |
131 delete this; | 141 delete this; |
132 } | 142 } |
OLD | NEW |