| 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 "chrome/browser/upgrade_detector_impl.h" | 5 #include "chrome/browser/upgrade_detector_impl.h" |
| 6 | 6 |
| 7 #include <stdint.h> |
| 8 |
| 7 #include <string> | 9 #include <string> |
| 8 | 10 |
| 9 #include "base/bind.h" | 11 #include "base/bind.h" |
| 10 #include "base/build_time.h" | 12 #include "base/build_time.h" |
| 11 #include "base/command_line.h" | 13 #include "base/command_line.h" |
| 12 #include "base/files/file_path.h" | 14 #include "base/files/file_path.h" |
| 13 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
| 14 #include "base/memory/singleton.h" | 16 #include "base/memory/singleton.h" |
| 15 #include "base/path_service.h" | 17 #include "base/path_service.h" |
| 16 #include "base/prefs/pref_service.h" | 18 #include "base/prefs/pref_service.h" |
| 17 #include "base/process/launch.h" | 19 #include "base/process/launch.h" |
| 18 #include "base/strings/string_number_conversions.h" | 20 #include "base/strings/string_number_conversions.h" |
| 19 #include "base/strings/string_util.h" | 21 #include "base/strings/string_util.h" |
| 20 #include "base/strings/utf_string_conversions.h" | 22 #include "base/strings/utf_string_conversions.h" |
| 21 #include "base/time/time.h" | 23 #include "base/time/time.h" |
| 24 #include "build/build_config.h" |
| 22 #include "chrome/browser/browser_process.h" | 25 #include "chrome/browser/browser_process.h" |
| 23 #include "chrome/browser/google/google_brand.h" | 26 #include "chrome/browser/google/google_brand.h" |
| 24 #include "chrome/common/channel_info.h" | 27 #include "chrome/common/channel_info.h" |
| 25 #include "chrome/common/chrome_switches.h" | 28 #include "chrome/common/chrome_switches.h" |
| 26 #include "chrome/common/pref_names.h" | 29 #include "chrome/common/pref_names.h" |
| 27 #include "components/network_time/network_time_tracker.h" | 30 #include "components/network_time/network_time_tracker.h" |
| 28 #include "components/version_info/version_info.h" | 31 #include "components/version_info/version_info.h" |
| 29 #include "content/public/browser/browser_thread.h" | 32 #include "content/public/browser/browser_thread.h" |
| 30 | 33 |
| 31 #if defined(OS_WIN) | 34 #if defined(OS_WIN) |
| (...skipping 15 matching lines...) Expand all Loading... |
| 47 const int kCheckForUpgradeMs = 2 * 60 * 60 * 1000; // 2 hours. | 50 const int kCheckForUpgradeMs = 2 * 60 * 60 * 1000; // 2 hours. |
| 48 | 51 |
| 49 // How long to wait (each cycle) before checking which severity level we should | 52 // How long to wait (each cycle) before checking which severity level we should |
| 50 // be at. Once we reach the highest severity, the timer will stop. | 53 // be at. Once we reach the highest severity, the timer will stop. |
| 51 const int kNotifyCycleTimeMs = 20 * 60 * 1000; // 20 minutes. | 54 const int kNotifyCycleTimeMs = 20 * 60 * 1000; // 20 minutes. |
| 52 | 55 |
| 53 // Same as kNotifyCycleTimeMs but only used during testing. | 56 // Same as kNotifyCycleTimeMs but only used during testing. |
| 54 const int kNotifyCycleTimeForTestingMs = 500; // Half a second. | 57 const int kNotifyCycleTimeForTestingMs = 500; // Half a second. |
| 55 | 58 |
| 56 // The number of days after which we identify a build/install as outdated. | 59 // The number of days after which we identify a build/install as outdated. |
| 57 const uint64 kOutdatedBuildAgeInDays = 12 * 7; | 60 const uint64_t kOutdatedBuildAgeInDays = 12 * 7; |
| 58 | 61 |
| 59 // Return the string that was passed as a value for the | 62 // Return the string that was passed as a value for the |
| 60 // kCheckForUpdateIntervalSec switch. | 63 // kCheckForUpdateIntervalSec switch. |
| 61 std::string CmdLineInterval() { | 64 std::string CmdLineInterval() { |
| 62 const base::CommandLine& cmd_line = *base::CommandLine::ForCurrentProcess(); | 65 const base::CommandLine& cmd_line = *base::CommandLine::ForCurrentProcess(); |
| 63 return cmd_line.GetSwitchValueASCII(switches::kCheckForUpdateIntervalSec); | 66 return cmd_line.GetSwitchValueASCII(switches::kCheckForUpdateIntervalSec); |
| 64 } | 67 } |
| 65 | 68 |
| 66 // Check if one of the outdated simulation switches was present on the command | 69 // Check if one of the outdated simulation switches was present on the command |
| 67 // line. | 70 // line. |
| (...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 511 | 514 |
| 512 // static | 515 // static |
| 513 UpgradeDetectorImpl* UpgradeDetectorImpl::GetInstance() { | 516 UpgradeDetectorImpl* UpgradeDetectorImpl::GetInstance() { |
| 514 return base::Singleton<UpgradeDetectorImpl>::get(); | 517 return base::Singleton<UpgradeDetectorImpl>::get(); |
| 515 } | 518 } |
| 516 | 519 |
| 517 // static | 520 // static |
| 518 UpgradeDetector* UpgradeDetector::GetInstance() { | 521 UpgradeDetector* UpgradeDetector::GetInstance() { |
| 519 return UpgradeDetectorImpl::GetInstance(); | 522 return UpgradeDetectorImpl::GetInstance(); |
| 520 } | 523 } |
| OLD | NEW |