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