| 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 "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "chrome/browser/apps/app_shim/app_shim_handler_mac.h" | 10 #include "chrome/browser/apps/app_shim/app_shim_handler_mac.h" |
| 11 #include "chrome/common/mac/app_shim_messages.h" | 11 #include "chrome/common/mac/app_shim_messages.h" |
| 12 #include "content/public/browser/browser_thread.h" | 12 #include "content/public/browser/browser_thread.h" |
| 13 #include "content/public/common/child_process_host.h" |
| 13 #include "ipc/ipc_channel_proxy.h" | 14 #include "ipc/ipc_channel_proxy.h" |
| 14 | 15 |
| 15 AppShimHost::AppShimHost() : initial_launch_finished_(false) {} | 16 AppShimHost::AppShimHost() : initial_launch_finished_(false) {} |
| 16 | 17 |
| 17 AppShimHost::~AppShimHost() { | 18 AppShimHost::~AppShimHost() { |
| 18 DCHECK(CalledOnValidThread()); | 19 DCHECK(CalledOnValidThread()); |
| 19 apps::AppShimHandler* handler = apps::AppShimHandler::GetForAppMode(app_id_); | 20 apps::AppShimHandler* handler = apps::AppShimHandler::GetForAppMode(app_id_); |
| 20 if (handler) | 21 if (handler) |
| 21 handler->OnShimClose(this); | 22 handler->OnShimClose(this); |
| 22 } | 23 } |
| 23 | 24 |
| 24 void AppShimHost::ServeChannel(const IPC::ChannelHandle& handle) { | 25 void AppShimHost::ServeChannel(const IPC::ChannelHandle& handle) { |
| 25 DCHECK(CalledOnValidThread()); | 26 DCHECK(CalledOnValidThread()); |
| 26 DCHECK(!channel_.get()); | 27 DCHECK(!channel_.get()); |
| 27 channel_ = IPC::ChannelProxy::Create( | 28 channel_ = IPC::ChannelProxy::Create( |
| 28 handle, | 29 handle, IPC::Channel::MODE_SERVER, this, |
| 29 IPC::Channel::MODE_SERVER, | |
| 30 this, | |
| 31 content::BrowserThread::GetMessageLoopProxyForThread( | 30 content::BrowserThread::GetMessageLoopProxyForThread( |
| 32 content::BrowserThread::IO).get()); | 31 content::BrowserThread::IO).get(), |
| 32 content::ChildProcessHost::GetAttachmentBroker()); |
| 33 } | 33 } |
| 34 | 34 |
| 35 base::FilePath AppShimHost::GetProfilePath() const { | 35 base::FilePath AppShimHost::GetProfilePath() const { |
| 36 return profile_path_; | 36 return profile_path_; |
| 37 } | 37 } |
| 38 | 38 |
| 39 std::string AppShimHost::GetAppId() const { | 39 std::string AppShimHost::GetAppId() const { |
| 40 return app_id_; | 40 return app_id_; |
| 41 } | 41 } |
| 42 | 42 |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 } | 125 } |
| 126 | 126 |
| 127 void AppShimHost::OnAppRequestUserAttention(apps::AppShimAttentionType type) { | 127 void AppShimHost::OnAppRequestUserAttention(apps::AppShimAttentionType type) { |
| 128 Send(new AppShimMsg_SetUserAttention(type)); | 128 Send(new AppShimMsg_SetUserAttention(type)); |
| 129 } | 129 } |
| 130 | 130 |
| 131 void AppShimHost::Close() { | 131 void AppShimHost::Close() { |
| 132 DCHECK(CalledOnValidThread()); | 132 DCHECK(CalledOnValidThread()); |
| 133 delete this; | 133 delete this; |
| 134 } | 134 } |
| OLD | NEW |