| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/extensions/api/messaging/native_message_process_host.h" | 5 #include "chrome/browser/extensions/api/messaging/native_message_process_host.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 "base/platform_file.h" | 10 #include "base/platform_file.h" |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 base::Unretained(this))); | 70 base::Unretained(this))); |
| 71 } | 71 } |
| 72 | 72 |
| 73 NativeMessageProcessHost::~NativeMessageProcessHost() { | 73 NativeMessageProcessHost::~NativeMessageProcessHost() { |
| 74 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); | 74 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); |
| 75 Close(std::string()); | 75 Close(std::string()); |
| 76 } | 76 } |
| 77 | 77 |
| 78 // static | 78 // static |
| 79 scoped_ptr<NativeMessageProcessHost> NativeMessageProcessHost::Create( | 79 scoped_ptr<NativeMessageProcessHost> NativeMessageProcessHost::Create( |
| 80 gfx::NativeView native_view, |
| 80 base::WeakPtr<Client> weak_client_ui, | 81 base::WeakPtr<Client> weak_client_ui, |
| 81 const std::string& source_extension_id, | 82 const std::string& source_extension_id, |
| 82 const std::string& native_host_name, | 83 const std::string& native_host_name, |
| 83 int destination_port) { | 84 int destination_port) { |
| 84 return CreateWithLauncher(weak_client_ui, source_extension_id, | 85 return CreateWithLauncher(weak_client_ui, source_extension_id, |
| 85 native_host_name, destination_port, | 86 native_host_name, destination_port, |
| 86 NativeProcessLauncher::CreateDefault()); | 87 NativeProcessLauncher::CreateDefault(native_view)); |
| 87 } | 88 } |
| 88 | 89 |
| 89 // static | 90 // static |
| 90 scoped_ptr<NativeMessageProcessHost> | 91 scoped_ptr<NativeMessageProcessHost> |
| 91 NativeMessageProcessHost::CreateWithLauncher( | 92 NativeMessageProcessHost::CreateWithLauncher( |
| 92 base::WeakPtr<Client> weak_client_ui, | 93 base::WeakPtr<Client> weak_client_ui, |
| 93 const std::string& source_extension_id, | 94 const std::string& source_extension_id, |
| 94 const std::string& native_host_name, | 95 const std::string& native_host_name, |
| 95 int destination_port, | 96 int destination_port, |
| 96 scoped_ptr<NativeProcessLauncher> launcher) { | 97 scoped_ptr<NativeProcessLauncher> launcher) { |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 331 closed_ = true; | 332 closed_ = true; |
| 332 read_stream_.reset(); | 333 read_stream_.reset(); |
| 333 write_stream_.reset(); | 334 write_stream_.reset(); |
| 334 content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE, | 335 content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE, |
| 335 base::Bind(&Client::CloseChannel, weak_client_ui_, | 336 base::Bind(&Client::CloseChannel, weak_client_ui_, |
| 336 destination_port_, error_message)); | 337 destination_port_, error_message)); |
| 337 } | 338 } |
| 338 } | 339 } |
| 339 | 340 |
| 340 } // namespace extensions | 341 } // namespace extensions |
| OLD | NEW |