| 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 "cloud_print/service/win/chrome_launcher.h" | 5 #include "cloud_print/service/win/chrome_launcher.h" |
| 6 | 6 |
| 7 #include "base/base_switches.h" | 7 #include "base/base_switches.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/files/scoped_temp_dir.h" | 10 #include "base/files/scoped_temp_dir.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 #include "cloud_print/service/win/service_utils.h" | 25 #include "cloud_print/service/win/service_utils.h" |
| 26 #include "google_apis/gaia/gaia_urls.h" | 26 #include "google_apis/gaia/gaia_urls.h" |
| 27 #include "net/base/url_util.h" | 27 #include "net/base/url_util.h" |
| 28 #include "url/gurl.h" | 28 #include "url/gurl.h" |
| 29 | 29 |
| 30 namespace { | 30 namespace { |
| 31 | 31 |
| 32 const int kShutdownTimeoutMs = 30 * 1000; | 32 const int kShutdownTimeoutMs = 30 * 1000; |
| 33 const int kUsageUpdateTimeoutMs = 6 * 3600 * 1000; // 6 hours. | 33 const int kUsageUpdateTimeoutMs = 6 * 3600 * 1000; // 6 hours. |
| 34 | 34 |
| 35 static const char16 kAutoRunKeyPath[] = | 35 static const base::char16 kAutoRunKeyPath[] = |
| 36 L"Software\\Microsoft\\Windows\\CurrentVersion\\Run"; | 36 L"Software\\Microsoft\\Windows\\CurrentVersion\\Run"; |
| 37 | 37 |
| 38 // Terminates any process. | 38 // Terminates any process. |
| 39 void ShutdownChrome(HANDLE process, DWORD thread_id) { | 39 void ShutdownChrome(HANDLE process, DWORD thread_id) { |
| 40 if (::PostThreadMessage(thread_id, WM_QUIT, 0, 0) && | 40 if (::PostThreadMessage(thread_id, WM_QUIT, 0, 0) && |
| 41 WAIT_OBJECT_0 == ::WaitForSingleObject(process, kShutdownTimeoutMs)) { | 41 WAIT_OBJECT_0 == ::WaitForSingleObject(process, kShutdownTimeoutMs)) { |
| 42 return; | 42 return; |
| 43 } | 43 } |
| 44 LOG(ERROR) << "Failed to shutdown process."; | 44 LOG(ERROR) << "Failed to shutdown process."; |
| 45 base::KillProcess(process, 0, true); | 45 base::KillProcess(process, 0, true); |
| (...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 338 } | 338 } |
| 339 } else { | 339 } else { |
| 340 LOG(ERROR) << "Chrome launch failed."; | 340 LOG(ERROR) << "Chrome launch failed."; |
| 341 return result; | 341 return result; |
| 342 } | 342 } |
| 343 } | 343 } |
| 344 NOTREACHED(); | 344 NOTREACHED(); |
| 345 return std::string(); | 345 return std::string(); |
| 346 } | 346 } |
| 347 | 347 |
| OLD | NEW |