| 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/first_run/upgrade_util.h" | 5 #include "chrome/browser/first_run/upgrade_util.h" |
| 6 | 6 |
| 7 #include "base/base_paths.h" | 7 #include "base/base_paths.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
| 10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "base/path_service.h" | 12 #include "base/path_service.h" |
| 13 #include "base/platform_file.h" | 13 #include "base/platform_file.h" |
| 14 #include "base/process_util.h" | 14 #include "base/process_util.h" |
| 15 #include "chrome/browser/first_run/upgrade_util_linux.h" | 15 #include "chrome/browser/first_run/upgrade_util_linux.h" |
| 16 | 16 |
| 17 namespace { | 17 namespace { |
| 18 | 18 |
| 19 double saved_last_modified_time_of_exe = 0; | 19 double saved_last_modified_time_of_exe = 0; |
| 20 | 20 |
| 21 } // namespace | 21 } // namespace |
| 22 | 22 |
| 23 namespace upgrade_util { | 23 namespace upgrade_util { |
| 24 | 24 |
| 25 bool RelaunchChromeBrowser(const CommandLine& command_line) { | 25 bool RelaunchChromeBrowser(const CommandLine& command_line) { |
| 26 base::LaunchOptions options; | 26 return base::LaunchProcess(command_line, base::LaunchOptions(), NULL); |
| 27 return base::LaunchProcess(command_line, options); | |
| 28 } | 27 } |
| 29 | 28 |
| 30 bool IsUpdatePendingRestart() { | 29 bool IsUpdatePendingRestart() { |
| 31 return saved_last_modified_time_of_exe != GetLastModifiedTimeOfExe(); | 30 return saved_last_modified_time_of_exe != GetLastModifiedTimeOfExe(); |
| 32 } | 31 } |
| 33 | 32 |
| 34 void SaveLastModifiedTimeOfExe() { | 33 void SaveLastModifiedTimeOfExe() { |
| 35 saved_last_modified_time_of_exe = GetLastModifiedTimeOfExe(); | 34 saved_last_modified_time_of_exe = GetLastModifiedTimeOfExe(); |
| 36 } | 35 } |
| 37 | 36 |
| 38 double GetLastModifiedTimeOfExe() { | 37 double GetLastModifiedTimeOfExe() { |
| 39 FilePath exe_file_path; | 38 FilePath exe_file_path; |
| 40 if (!PathService::Get(base::FILE_EXE, &exe_file_path)) { | 39 if (!PathService::Get(base::FILE_EXE, &exe_file_path)) { |
| 41 LOG(WARNING) << "Failed to get FilePath object for FILE_EXE."; | 40 LOG(WARNING) << "Failed to get FilePath object for FILE_EXE."; |
| 42 return saved_last_modified_time_of_exe; | 41 return saved_last_modified_time_of_exe; |
| 43 } | 42 } |
| 44 base::PlatformFileInfo exe_file_info; | 43 base::PlatformFileInfo exe_file_info; |
| 45 if (!file_util::GetFileInfo(exe_file_path, &exe_file_info)) { | 44 if (!file_util::GetFileInfo(exe_file_path, &exe_file_info)) { |
| 46 LOG(WARNING) << "Failed to get FileInfo object for FILE_EXE - " | 45 LOG(WARNING) << "Failed to get FileInfo object for FILE_EXE - " |
| 47 << exe_file_path.value(); | 46 << exe_file_path.value(); |
| 48 return saved_last_modified_time_of_exe; | 47 return saved_last_modified_time_of_exe; |
| 49 } | 48 } |
| 50 return exe_file_info.last_modified.ToDoubleT(); | 49 return exe_file_info.last_modified.ToDoubleT(); |
| 51 } | 50 } |
| 52 | 51 |
| 53 } // namespace upgrade_util | 52 } // namespace upgrade_util |
| OLD | NEW |