| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/service/service_process_control.h" | 5 #include "chrome/browser/service/service_process_control.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/file_path.h" | 8 #include "base/file_path.h" |
| 9 #include "base/process_util.h" | 9 #include "base/process_util.h" |
| 10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
| 11 #include "base/threading/thread.h" | 11 #include "base/threading/thread.h" |
| 12 #include "base/threading/thread_restrictions.h" | 12 #include "base/threading/thread_restrictions.h" |
| 13 #include "chrome/browser/browser_process.h" | 13 #include "chrome/browser/browser_process.h" |
| 14 #include "chrome/browser/upgrade_detector.h" | 14 #include "chrome/browser/upgrade_detector.h" |
| 15 #include "chrome/common/chrome_switches.h" | 15 #include "chrome/common/chrome_switches.h" |
| 16 #include "chrome/common/chrome_notification_types.h" | 16 #include "chrome/common/chrome_notification_types.h" |
| 17 #include "chrome/common/service_messages.h" | 17 #include "chrome/common/service_messages.h" |
| 18 #include "chrome/common/service_process_util.h" | 18 #include "chrome/common/service_process_util.h" |
| 19 #include "content/browser/browser_thread.h" | 19 #include "content/browser/browser_thread.h" |
| 20 #include "content/common/child_process_host.h" | 20 #include "content/common/child_process_host.h" |
| 21 #include "content/common/notification_service.h" | 21 #include "content/public/browser/notification_service.h" |
| 22 #include "ui/base/ui_base_switches.h" | 22 #include "ui/base/ui_base_switches.h" |
| 23 | 23 |
| 24 | 24 |
| 25 // ServiceProcessControl implementation. | 25 // ServiceProcessControl implementation. |
| 26 ServiceProcessControl::ServiceProcessControl() { | 26 ServiceProcessControl::ServiceProcessControl() { |
| 27 } | 27 } |
| 28 | 28 |
| 29 ServiceProcessControl::~ServiceProcessControl() { | 29 ServiceProcessControl::~ServiceProcessControl() { |
| 30 STLDeleteElements(&connect_done_tasks_); | 30 STLDeleteElements(&connect_done_tasks_); |
| 31 STLDeleteElements(&connect_success_tasks_); | 31 STLDeleteElements(&connect_success_tasks_); |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 void ServiceProcessControl::OnChannelConnected(int32 peer_pid) { | 206 void ServiceProcessControl::OnChannelConnected(int32 peer_pid) { |
| 207 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 207 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 208 | 208 |
| 209 // We just established a channel with the service process. Notify it if an | 209 // We just established a channel with the service process. Notify it if an |
| 210 // upgrade is available. | 210 // upgrade is available. |
| 211 if (UpgradeDetector::GetInstance()->notify_upgrade()) { | 211 if (UpgradeDetector::GetInstance()->notify_upgrade()) { |
| 212 Send(new ServiceMsg_UpdateAvailable); | 212 Send(new ServiceMsg_UpdateAvailable); |
| 213 } else { | 213 } else { |
| 214 if (registrar_.IsEmpty()) | 214 if (registrar_.IsEmpty()) |
| 215 registrar_.Add(this, chrome::NOTIFICATION_UPGRADE_RECOMMENDED, | 215 registrar_.Add(this, chrome::NOTIFICATION_UPGRADE_RECOMMENDED, |
| 216 NotificationService::AllSources()); | 216 content::NotificationService::AllSources()); |
| 217 } | 217 } |
| 218 RunConnectDoneTasks(); | 218 RunConnectDoneTasks(); |
| 219 } | 219 } |
| 220 | 220 |
| 221 void ServiceProcessControl::OnChannelError() { | 221 void ServiceProcessControl::OnChannelError() { |
| 222 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 222 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 223 channel_.reset(); | 223 channel_.reset(); |
| 224 RunConnectDoneTasks(); | 224 RunConnectDoneTasks(); |
| 225 } | 225 } |
| 226 | 226 |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 327 if (base::LaunchProcess(*cmd_line_, options, NULL)) { | 327 if (base::LaunchProcess(*cmd_line_, options, NULL)) { |
| 328 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, | 328 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, |
| 329 NewRunnableMethod(this, | 329 NewRunnableMethod(this, |
| 330 &Launcher::DoDetectLaunched)); | 330 &Launcher::DoDetectLaunched)); |
| 331 } else { | 331 } else { |
| 332 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, | 332 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, |
| 333 NewRunnableMethod(this, &Launcher::Notify)); | 333 NewRunnableMethod(this, &Launcher::Notify)); |
| 334 } | 334 } |
| 335 } | 335 } |
| 336 #endif // !OS_MACOSX | 336 #endif // !OS_MACOSX |
| OLD | NEW |