| 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 <algorithm> | 5 #include <algorithm> |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/memory/singleton.h" | 9 #include "base/memory/singleton.h" |
| 10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 // us reading bogus data from shared memory for an app that has died. | 60 // us reading bogus data from shared memory for an app that has died. |
| 61 if (!CheckServiceProcessReady()) { | 61 if (!CheckServiceProcessReady()) { |
| 62 return SERVICE_NOT_RUNNING; | 62 return SERVICE_NOT_RUNNING; |
| 63 } | 63 } |
| 64 #endif // defined(OS_POSIX) | 64 #endif // defined(OS_POSIX) |
| 65 | 65 |
| 66 // At this time we have a version string. Set the out param if it exists. | 66 // At this time we have a version string. Set the out param if it exists. |
| 67 if (service_version_out) | 67 if (service_version_out) |
| 68 *service_version_out = version; | 68 *service_version_out = version; |
| 69 | 69 |
| 70 base::Version service_version(version); | 70 Version service_version(version); |
| 71 // If the version string is invalid, treat it like an older version. | 71 // If the version string is invalid, treat it like an older version. |
| 72 if (!service_version.IsValid()) | 72 if (!service_version.IsValid()) |
| 73 return SERVICE_OLDER_VERSION_RUNNING; | 73 return SERVICE_OLDER_VERSION_RUNNING; |
| 74 | 74 |
| 75 // Get the version of the currently *running* instance of Chrome. | 75 // Get the version of the currently *running* instance of Chrome. |
| 76 chrome::VersionInfo version_info; | 76 chrome::VersionInfo version_info; |
| 77 if (!version_info.is_valid()) { | 77 if (!version_info.is_valid()) { |
| 78 NOTREACHED() << "Failed to get current file version"; | 78 NOTREACHED() << "Failed to get current file version"; |
| 79 // Our own version is invalid. This is an error case. Pretend that we | 79 // Our own version is invalid. This is an error case. Pretend that we |
| 80 // are out of date. | 80 // are out of date. |
| 81 return SERVICE_NEWER_VERSION_RUNNING; | 81 return SERVICE_NEWER_VERSION_RUNNING; |
| 82 } | 82 } |
| 83 base::Version running_version(version_info.Version()); | 83 Version running_version(version_info.Version()); |
| 84 if (!running_version.IsValid()) { | 84 if (!running_version.IsValid()) { |
| 85 NOTREACHED() << "Failed to parse version info"; | 85 NOTREACHED() << "Failed to parse version info"; |
| 86 // Our own version is invalid. This is an error case. Pretend that we | 86 // Our own version is invalid. This is an error case. Pretend that we |
| 87 // are out of date. | 87 // are out of date. |
| 88 return SERVICE_NEWER_VERSION_RUNNING; | 88 return SERVICE_NEWER_VERSION_RUNNING; |
| 89 } | 89 } |
| 90 | 90 |
| 91 if (running_version.CompareTo(service_version) > 0) { | 91 if (running_version.CompareTo(service_version) > 0) { |
| 92 return SERVICE_OLDER_VERSION_RUNNING; | 92 return SERVICE_OLDER_VERSION_RUNNING; |
| 93 } else if (service_version.CompareTo(running_version) > 0) { | 93 } else if (service_version.CompareTo(running_version) > 0) { |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 | 257 |
| 258 // The user data directory is the only other flag we currently want to | 258 // The user data directory is the only other flag we currently want to |
| 259 // possibly store. | 259 // possibly store. |
| 260 const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess(); | 260 const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess(); |
| 261 base::FilePath user_data_dir = | 261 base::FilePath user_data_dir = |
| 262 browser_command_line.GetSwitchValuePath(switches::kUserDataDir); | 262 browser_command_line.GetSwitchValuePath(switches::kUserDataDir); |
| 263 if (!user_data_dir.empty()) | 263 if (!user_data_dir.empty()) |
| 264 autorun_command_line_->AppendSwitchPath(switches::kUserDataDir, | 264 autorun_command_line_->AppendSwitchPath(switches::kUserDataDir, |
| 265 user_data_dir); | 265 user_data_dir); |
| 266 } | 266 } |
| OLD | NEW |