| 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" | |
| 11 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
| 12 #include "base/process/kill.h" | 11 #include "base/process/kill.h" |
| 13 #include "base/threading/sequenced_worker_pool.h" | 12 #include "base/threading/sequenced_worker_pool.h" |
| 14 #include "base/values.h" | 13 #include "base/values.h" |
| 15 #include "chrome/browser/extensions/api/messaging/native_messaging_host_manifest
.h" | 14 #include "chrome/browser/extensions/api/messaging/native_messaging_host_manifest
.h" |
| 16 #include "chrome/browser/extensions/api/messaging/native_process_launcher.h" | 15 #include "chrome/browser/extensions/api/messaging/native_process_launcher.h" |
| 17 #include "chrome/common/chrome_version_info.h" | 16 #include "chrome/common/chrome_version_info.h" |
| 18 #include "content/public/browser/browser_thread.h" | 17 #include "content/public/browser/browser_thread.h" |
| 19 #include "extensions/browser/pref_names.h" | 18 #include "extensions/browser/pref_names.h" |
| 20 #include "extensions/common/constants.h" | 19 #include "extensions/common/constants.h" |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 int destination_port, | 97 int destination_port, |
| 99 scoped_ptr<NativeProcessLauncher> launcher) | 98 scoped_ptr<NativeProcessLauncher> launcher) |
| 100 : weak_client_ui_(weak_client_ui), | 99 : weak_client_ui_(weak_client_ui), |
| 101 source_extension_id_(source_extension_id), | 100 source_extension_id_(source_extension_id), |
| 102 native_host_name_(native_host_name), | 101 native_host_name_(native_host_name), |
| 103 destination_port_(destination_port), | 102 destination_port_(destination_port), |
| 104 launcher_(launcher.Pass()), | 103 launcher_(launcher.Pass()), |
| 105 closed_(false), | 104 closed_(false), |
| 106 process_handle_(base::kNullProcessHandle), | 105 process_handle_(base::kNullProcessHandle), |
| 107 #if defined(OS_POSIX) | 106 #if defined(OS_POSIX) |
| 108 read_file_(base::kInvalidPlatformFileValue), | 107 read_file_(-1), |
| 109 #endif | 108 #endif |
| 110 read_pending_(false), | 109 read_pending_(false), |
| 111 write_pending_(false) { | 110 write_pending_(false) { |
| 112 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 111 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 113 | 112 |
| 114 // It's safe to use base::Unretained() here because NativeMessagePort always | 113 // It's safe to use base::Unretained() here because NativeMessagePort always |
| 115 // deletes us on the IO thread. | 114 // deletes us on the IO thread. |
| 116 content::BrowserThread::PostTask(content::BrowserThread::IO, FROM_HERE, | 115 content::BrowserThread::PostTask(content::BrowserThread::IO, FROM_HERE, |
| 117 base::Bind(&NativeMessageProcessHost::LaunchHostProcess, | 116 base::Bind(&NativeMessageProcessHost::LaunchHostProcess, |
| 118 base::Unretained(this))); | 117 base::Unretained(this))); |
| (...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 406 content::BrowserThread::PostBlockingPoolTask( | 405 content::BrowserThread::PostBlockingPoolTask( |
| 407 FROM_HERE, base::Bind(&base::EnsureProcessTerminated, process_handle_)); | 406 FROM_HERE, base::Bind(&base::EnsureProcessTerminated, process_handle_)); |
| 408 #else | 407 #else |
| 409 base::EnsureProcessTerminated(process_handle_); | 408 base::EnsureProcessTerminated(process_handle_); |
| 410 #endif | 409 #endif |
| 411 process_handle_ = base::kNullProcessHandle; | 410 process_handle_ = base::kNullProcessHandle; |
| 412 } | 411 } |
| 413 } | 412 } |
| 414 | 413 |
| 415 } // namespace extensions | 414 } // namespace extensions |
| OLD | NEW |