Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(324)

Side by Side Diff: chrome/browser/first_run/upgrade_util_linux.cc

Issue 6839021: first-run: Reland refactor of Upgrade class into upgrade_util API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: one more ifdef for linux_chromeos Created 9 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/first_run/upgrade_util.cc ('k') | chrome/browser/first_run/upgrade_util_win.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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.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 15
16 namespace {
17
16 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) 18 #if defined(OS_LINUX) && !defined(OS_CHROMEOS)
17 // static 19 double saved_last_modified_time_of_exe = 0;
18 CommandLine* Upgrade::new_command_line_ = NULL; 20 #endif
19 21
20 // static 22 } // namespace
21 double Upgrade::saved_last_modified_time_of_exe_ = 0;
22 23
23 // static 24 namespace upgrade_util {
24 bool Upgrade::RelaunchChromeBrowser(const CommandLine& command_line) { 25
26 bool RelaunchChromeBrowser(const CommandLine& command_line) {
25 return base::LaunchApp(command_line, false, false, NULL); 27 return base::LaunchApp(command_line, false, false, NULL);
26 } 28 }
27 29
28 // static 30 #if defined(OS_LINUX) && !defined(OS_CHROMEOS)
29 void Upgrade::SaveLastModifiedTimeOfExe() { 31 bool IsUpdatePendingRestart() {
30 saved_last_modified_time_of_exe_ = Upgrade::GetLastModifiedTimeOfExe(); 32 return saved_last_modified_time_of_exe != GetLastModifiedTimeOfExe();
31 } 33 }
32 34
33 // static 35 void SaveLastModifiedTimeOfExe() {
34 bool Upgrade::IsUpdatePendingRestart() { 36 saved_last_modified_time_of_exe = GetLastModifiedTimeOfExe();
35 return saved_last_modified_time_of_exe_ !=
36 Upgrade::GetLastModifiedTimeOfExe();
37 } 37 }
38 38
39 // static 39 double GetLastModifiedTimeOfExe() {
40 double Upgrade::GetLastModifiedTimeOfExe() {
41 FilePath exe_file_path; 40 FilePath exe_file_path;
42 if (!PathService::Get(base::FILE_EXE, &exe_file_path)) { 41 if (!PathService::Get(base::FILE_EXE, &exe_file_path)) {
43 LOG(WARNING) << "Failed to get FilePath object for FILE_EXE."; 42 LOG(WARNING) << "Failed to get FilePath object for FILE_EXE.";
44 return saved_last_modified_time_of_exe_; 43 return saved_last_modified_time_of_exe;
45 } 44 }
46 base::PlatformFileInfo exe_file_info; 45 base::PlatformFileInfo exe_file_info;
47 if (!file_util::GetFileInfo(exe_file_path, &exe_file_info)) { 46 if (!file_util::GetFileInfo(exe_file_path, &exe_file_info)) {
48 LOG(WARNING) << "Failed to get FileInfo object for FILE_EXE - " 47 LOG(WARNING) << "Failed to get FileInfo object for FILE_EXE - "
49 << exe_file_path.value(); 48 << exe_file_path.value();
50 return saved_last_modified_time_of_exe_; 49 return saved_last_modified_time_of_exe;
51 } 50 }
52 return exe_file_info.last_modified.ToDoubleT(); 51 return exe_file_info.last_modified.ToDoubleT();
53 } 52 }
53 #endif // defined(OS_LINUX) && !defined(OS_CHROMEOS)
54 54
55 #endif // defined(OS_LINUX) && !defined(OS_CHROMEOS) 55 } // namespace upgrade_util
OLDNEW
« no previous file with comments | « chrome/browser/first_run/upgrade_util.cc ('k') | chrome/browser/first_run/upgrade_util_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698