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

Side by Side Diff: chrome/browser/upgrade_detector_impl.cc

Issue 211543008: Show a modified outdated upgrade Bubble for non-enterprise users without auto-update (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Shot in the dark to try and prevent Mac crashes... Created 6 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/upgrade_detector_impl.h ('k') | chrome/common/chrome_switches.h » ('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) 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 <string> 7 #include <string>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/build_time.h" 10 #include "base/build_time.h"
11 #include "base/command_line.h" 11 #include "base/command_line.h"
12 #include "base/files/file_path.h" 12 #include "base/files/file_path.h"
13 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
14 #include "base/memory/singleton.h" 14 #include "base/memory/singleton.h"
15 #include "base/path_service.h" 15 #include "base/path_service.h"
16 #include "base/prefs/pref_service.h"
16 #include "base/process/launch.h" 17 #include "base/process/launch.h"
17 #include "base/strings/string_number_conversions.h" 18 #include "base/strings/string_number_conversions.h"
18 #include "base/strings/string_util.h" 19 #include "base/strings/string_util.h"
19 #include "base/strings/utf_string_conversions.h" 20 #include "base/strings/utf_string_conversions.h"
20 #include "base/time/time.h" 21 #include "base/time/time.h"
21 #include "base/version.h" 22 #include "base/version.h"
22 #include "chrome/browser/browser_process.h" 23 #include "chrome/browser/browser_process.h"
23 #include "chrome/browser/google/google_util.h" 24 #include "chrome/browser/google/google_util.h"
24 #include "chrome/common/chrome_switches.h" 25 #include "chrome/common/chrome_switches.h"
25 #include "chrome/common/chrome_version_info.h" 26 #include "chrome/common/chrome_version_info.h"
27 #include "chrome/common/pref_names.h"
26 #include "content/public/browser/browser_thread.h" 28 #include "content/public/browser/browser_thread.h"
27 #include "ui/base/resource/resource_bundle.h" 29 #include "ui/base/resource/resource_bundle.h"
28 30
29 #if defined(OS_WIN) 31 #if defined(OS_WIN)
32 #include "base/win/win_util.h"
30 #include "chrome/installer/util/browser_distribution.h" 33 #include "chrome/installer/util/browser_distribution.h"
31 #include "chrome/installer/util/google_update_settings.h" 34 #include "chrome/installer/util/google_update_settings.h"
32 #include "chrome/installer/util/helper.h" 35 #include "chrome/installer/util/helper.h"
33 #include "chrome/installer/util/install_util.h" 36 #include "chrome/installer/util/install_util.h"
34 #elif defined(OS_MACOSX) 37 #elif defined(OS_MACOSX)
35 #include "chrome/browser/mac/keystone_glue.h" 38 #include "chrome/browser/mac/keystone_glue.h"
36 #endif 39 #endif
37 40
38 using content::BrowserThread; 41 using content::BrowserThread;
39 42
40 namespace { 43 namespace {
41 44
42 // How long (in milliseconds) to wait (each cycle) before checking whether 45 // How long (in milliseconds) to wait (each cycle) before checking whether
43 // Chrome's been upgraded behind our back. 46 // Chrome's been upgraded behind our back.
44 const int kCheckForUpgradeMs = 2 * 60 * 60 * 1000; // 2 hours. 47 const int kCheckForUpgradeMs = 2 * 60 * 60 * 1000; // 2 hours.
45 48
46 // How long to wait (each cycle) before checking which severity level we should 49 // How long to wait (each cycle) before checking which severity level we should
47 // be at. Once we reach the highest severity, the timer will stop. 50 // be at. Once we reach the highest severity, the timer will stop.
48 const int kNotifyCycleTimeMs = 20 * 60 * 1000; // 20 minutes. 51 const int kNotifyCycleTimeMs = 20 * 60 * 1000; // 20 minutes.
49 52
50 // Same as kNotifyCycleTimeMs but only used during testing. 53 // Same as kNotifyCycleTimeMs but only used during testing.
51 const int kNotifyCycleTimeForTestingMs = 500; // Half a second. 54 const int kNotifyCycleTimeForTestingMs = 500; // Half a second.
52 55
53 // The number of days after which we identify a build/install as outdated. 56 // The number of days after which we identify a build/install as outdated.
54 const uint64 kOutdatedBuildAgeInDays = 12 * 7; 57 const uint64 kOutdatedBuildAgeInDays = 12 * 7;
55 58
59 // Return the string that was passed as a value for the
60 // kCheckForUpdateIntervalSec switch.
56 std::string CmdLineInterval() { 61 std::string CmdLineInterval() {
57 const CommandLine& cmd_line = *CommandLine::ForCurrentProcess(); 62 const CommandLine& cmd_line = *CommandLine::ForCurrentProcess();
58 return cmd_line.GetSwitchValueASCII(switches::kCheckForUpdateIntervalSec); 63 return cmd_line.GetSwitchValueASCII(switches::kCheckForUpdateIntervalSec);
59 } 64 }
60 65
66 // Check if one of the outdated simulation switches was present on the command
67 // line.
68 bool SimulatingOutdated() {
69 const CommandLine& cmd_line = *CommandLine::ForCurrentProcess();
70 return cmd_line.HasSwitch(switches::kSimulateOutdated) ||
71 cmd_line.HasSwitch(switches::kSimulateOutdatedNoAU);
72 }
73
74 // Check if any of the testing switches was present on the command line.
61 bool IsTesting() { 75 bool IsTesting() {
62 const CommandLine& cmd_line = *CommandLine::ForCurrentProcess(); 76 const CommandLine& cmd_line = *CommandLine::ForCurrentProcess();
63 return cmd_line.HasSwitch(switches::kSimulateUpgrade) || 77 return cmd_line.HasSwitch(switches::kSimulateUpgrade) ||
64 cmd_line.HasSwitch(switches::kCheckForUpdateIntervalSec) || 78 cmd_line.HasSwitch(switches::kCheckForUpdateIntervalSec) ||
65 cmd_line.HasSwitch(switches::kSimulateCriticalUpdate) || 79 cmd_line.HasSwitch(switches::kSimulateCriticalUpdate) ||
66 cmd_line.HasSwitch(switches::kSimulateOutdated); 80 SimulatingOutdated();
67 } 81 }
68 82
69 // How often to check for an upgrade. 83 // How often to check for an upgrade.
70 int GetCheckForUpgradeEveryMs() { 84 int GetCheckForUpgradeEveryMs() {
71 // Check for a value passed via the command line. 85 // Check for a value passed via the command line.
72 int interval_ms; 86 int interval_ms;
73 std::string interval = CmdLineInterval(); 87 std::string interval = CmdLineInterval();
74 if (!interval.empty() && base::StringToInt(interval, &interval_ms)) 88 if (!interval.empty() && base::StringToInt(interval, &interval_ms))
75 return interval_ms * 1000; // Command line value is in seconds. 89 return interval_ms * 1000; // Command line value is in seconds.
76 90
77 return kCheckForUpgradeMs; 91 return kCheckForUpgradeMs;
78 } 92 }
79 93
94 // Return true if the current build is one of the unstable channels.
80 bool IsUnstableChannel() { 95 bool IsUnstableChannel() {
81 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); 96 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
82 chrome::VersionInfo::Channel channel = chrome::VersionInfo::GetChannel(); 97 chrome::VersionInfo::Channel channel = chrome::VersionInfo::GetChannel();
83 return channel == chrome::VersionInfo::CHANNEL_DEV || 98 return channel == chrome::VersionInfo::CHANNEL_DEV ||
84 channel == chrome::VersionInfo::CHANNEL_CANARY; 99 channel == chrome::VersionInfo::CHANNEL_CANARY;
85 } 100 }
86 101
87 // This task identifies whether we are running an unstable version. And then 102 // This task identifies whether we are running an unstable version. And then
88 // it unconditionally calls back the provided task. 103 // it unconditionally calls back the provided task.
89 void CheckForUnstableChannel(const base::Closure& callback_task, 104 void CheckForUnstableChannel(const base::Closure& callback_task,
90 bool* is_unstable_channel) { 105 bool* is_unstable_channel) {
91 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); 106 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
92 *is_unstable_channel = IsUnstableChannel(); 107 *is_unstable_channel = IsUnstableChannel();
93 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, callback_task); 108 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, callback_task);
94 } 109 }
95 110
96 #if defined(OS_WIN) 111 #if defined(OS_WIN)
112 // Return true if the currently running Chrome is a system install.
97 bool IsSystemInstall() { 113 bool IsSystemInstall() {
98 // Get the version of the currently *installed* instance of Chrome, 114 // Get the version of the currently *installed* instance of Chrome,
99 // which might be newer than the *running* instance if we have been 115 // which might be newer than the *running* instance if we have been
100 // upgraded in the background. 116 // upgraded in the background.
101 base::FilePath exe_path; 117 base::FilePath exe_path;
102 if (!PathService::Get(base::DIR_EXE, &exe_path)) { 118 if (!PathService::Get(base::DIR_EXE, &exe_path)) {
103 NOTREACHED() << "Failed to find executable path"; 119 NOTREACHED() << "Failed to find executable path";
104 return false; 120 return false;
105 } 121 }
106 122
107 return !InstallUtil::IsPerUserInstall(exe_path.value().c_str()); 123 return !InstallUtil::IsPerUserInstall(exe_path.value().c_str());
108 } 124 }
109 125
110 // This task checks the update policy and calls back the task only if automatic 126 // This task checks the update policy and calls back the task only if the
111 // updates are allowed. It also identifies whether we are running an unstable 127 // system is not enrolled in a domain (i.e., not in an enterprise environment).
112 // channel. 128 // It also identifies if autoupdate is enabled and whether we are running an
129 // unstable channel. |is_auto_update_enabled| can be NULL.
113 void DetectUpdatability(const base::Closure& callback_task, 130 void DetectUpdatability(const base::Closure& callback_task,
114 bool* is_unstable_channel) { 131 bool* is_unstable_channel,
132 bool* is_auto_update_enabled) {
115 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); 133 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
116 134
117 base::string16 app_guid = installer::GetAppGuidForUpdates(IsSystemInstall()); 135 base::string16 app_guid = installer::GetAppGuidForUpdates(IsSystemInstall());
118 DCHECK(!app_guid.empty()); 136 DCHECK(!app_guid.empty());
119 if (GoogleUpdateSettings::AreAutoupdatesEnabled(app_guid)) 137 // Don't try to turn on autoupdate when we failed previously.
138 if (is_auto_update_enabled) {
139 *is_auto_update_enabled =
140 GoogleUpdateSettings::AreAutoupdatesEnabled(app_guid);
141 }
142 // Don't show the update bubbles to entreprise users (i.e., on a domain).
143 if (!base::win::IsEnrolledToDomain())
120 CheckForUnstableChannel(callback_task, is_unstable_channel); 144 CheckForUnstableChannel(callback_task, is_unstable_channel);
121 } 145 }
122 #endif // defined(OS_WIN) 146 #endif // defined(OS_WIN)
123 147
124 } // namespace 148 } // namespace
125 149
126 UpgradeDetectorImpl::UpgradeDetectorImpl() 150 UpgradeDetectorImpl::UpgradeDetectorImpl()
127 : weak_factory_(this), 151 : weak_factory_(this),
128 is_unstable_channel_(false), 152 is_unstable_channel_(false),
153 is_auto_update_enabled_(true),
129 build_date_(base::GetBuildTime()) { 154 build_date_(base::GetBuildTime()) {
130 CommandLine command_line(*CommandLine::ForCurrentProcess()); 155 CommandLine command_line(*CommandLine::ForCurrentProcess());
131 // The different command line switches that affect testing can't be used 156 // The different command line switches that affect testing can't be used
132 // simultaneously, if they do, here's the precedence order, based on the order 157 // simultaneously, if they do, here's the precedence order, based on the order
133 // of the if statements below: 158 // of the if statements below:
134 // - kDisableBackgroundNetworking prevents any of the other command line 159 // - kDisableBackgroundNetworking prevents any of the other command line
135 // switch from being taken into account. 160 // switch from being taken into account.
136 // - kSimulateUpgrade supersedes critical or outdated upgrade switches. 161 // - kSimulateUpgrade supersedes critical or outdated upgrade switches.
137 // - kSimulateCriticalUpdate has precedence over kSimulateOutdated. 162 // - kSimulateCriticalUpdate has precedence over kSimulateOutdated.
138 // - kSimulateOutdated can work on its own, or with a specified date. 163 // - kSimulateOutdatedNoAU has precedence over kSimulateOutdated.
164 // - kSimulateOutdated[NoAu] can work on its own, or with a specified date.
139 if (command_line.HasSwitch(switches::kDisableBackgroundNetworking)) 165 if (command_line.HasSwitch(switches::kDisableBackgroundNetworking))
140 return; 166 return;
141 if (command_line.HasSwitch(switches::kSimulateUpgrade)) { 167 if (command_line.HasSwitch(switches::kSimulateUpgrade)) {
142 UpgradeDetected(UPGRADE_AVAILABLE_REGULAR); 168 UpgradeDetected(UPGRADE_AVAILABLE_REGULAR);
143 return; 169 return;
144 } 170 }
145 if (command_line.HasSwitch(switches::kSimulateCriticalUpdate)) { 171 if (command_line.HasSwitch(switches::kSimulateCriticalUpdate)) {
146 UpgradeDetected(UPGRADE_AVAILABLE_CRITICAL); 172 UpgradeDetected(UPGRADE_AVAILABLE_CRITICAL);
147 return; 173 return;
148 } 174 }
149 if (command_line.HasSwitch(switches::kSimulateOutdated)) { 175 if (SimulatingOutdated()) {
150 // The outdated simulation can work without a value, which means outdated 176 // The outdated simulation can work without a value, which means outdated
151 // now, or with a value that must be a well formed date/time string that 177 // now, or with a value that must be a well formed date/time string that
152 // overrides the build date. 178 // overrides the build date.
153 // Also note that to test with a given time/date, until the network time 179 // Also note that to test with a given time/date, until the network time
154 // tracking moves off of the VariationsService, the "variations-server-url" 180 // tracking moves off of the VariationsService, the "variations-server-url"
155 // command line switch must also be specified for the service to be 181 // command line switch must also be specified for the service to be
156 // available on non GOOGLE_CHROME_BUILD. 182 // available on non GOOGLE_CHROME_BUILD.
157 std::string build_date = command_line.GetSwitchValueASCII( 183 std::string switch_name;
158 switches::kSimulateOutdated); 184 if (command_line.HasSwitch(switches::kSimulateOutdatedNoAU)) {
185 is_auto_update_enabled_ = false;
186 switch_name = switches::kSimulateOutdatedNoAU;
187 } else {
188 switch_name = switches::kSimulateOutdated;
189 }
190 std::string build_date = command_line.GetSwitchValueASCII(switch_name);
159 base::Time maybe_build_time; 191 base::Time maybe_build_time;
160 bool result = base::Time::FromString(build_date.c_str(), &maybe_build_time); 192 bool result = base::Time::FromString(build_date.c_str(), &maybe_build_time);
161 if (result && !maybe_build_time.is_null()) { 193 if (result && !maybe_build_time.is_null()) {
162 // We got a valid build date simulation so use it and check for upgrades. 194 // We got a valid build date simulation so use it and check for upgrades.
163 build_date_ = maybe_build_time; 195 build_date_ = maybe_build_time;
164 StartTimerForUpgradeCheck(); 196 StartTimerForUpgradeCheck();
165 } else { 197 } else {
166 // Without a valid date, we simulate that we are already outdated... 198 // Without a valid date, we simulate that we are already outdated...
167 UpgradeDetected(UPGRADE_NEEDED_OUTDATED_INSTALL); 199 UpgradeDetected(
200 is_auto_update_enabled_ ? UPGRADE_NEEDED_OUTDATED_INSTALL
201 : UPGRADE_NEEDED_OUTDATED_INSTALL_NO_AU);
168 } 202 }
169 return; 203 return;
170 } 204 }
171 205
172 base::Closure start_upgrade_check_timer_task = 206 base::Closure start_upgrade_check_timer_task =
173 base::Bind(&UpgradeDetectorImpl::StartTimerForUpgradeCheck, 207 base::Bind(&UpgradeDetectorImpl::StartTimerForUpgradeCheck,
174 weak_factory_.GetWeakPtr()); 208 weak_factory_.GetWeakPtr());
175 209
176 #if defined(OS_WIN) 210 #if defined(OS_WIN)
177 // Only enable upgrade notifications for official builds. Chromium has no 211 // Only enable upgrade notifications for official builds. Chromium has no
178 // upgrade channel. 212 // upgrade channel.
179 #if defined(GOOGLE_CHROME_BUILD) 213 #if defined(GOOGLE_CHROME_BUILD)
180 // On Windows, there might be a policy preventing updates, so validate 214 // On Windows, there might be a policy/enterprise environment preventing
181 // updatability, and then call StartTimerForUpgradeCheck appropriately. 215 // updates, so validate updatability, and then call StartTimerForUpgradeCheck
216 // appropriately. And don't check for autoupdate if we already attempted to
217 // enable it in the past.
218 bool attempted_enabling_autoupdate = g_browser_process->local_state() &&
219 g_browser_process->local_state()->GetBoolean(
220 prefs::kAttemptedToEnableAutoupdate);
182 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, 221 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE,
183 base::Bind(&DetectUpdatability, 222 base::Bind(&DetectUpdatability,
184 start_upgrade_check_timer_task, 223 start_upgrade_check_timer_task,
185 &is_unstable_channel_)); 224 &is_unstable_channel_,
225 attempted_enabling_autoupdate ?
226 NULL : &is_auto_update_enabled_));
186 #endif 227 #endif
187 #else 228 #else
188 #if defined(OS_MACOSX) 229 #if defined(OS_MACOSX)
189 // Only enable upgrade notifications if the updater (Keystone) is present. 230 // Only enable upgrade notifications if the updater (Keystone) is present.
190 if (!keystone_glue::KeystoneEnabled()) 231 if (!keystone_glue::KeystoneEnabled()) {
232 is_auto_update_enabled_ = false;
191 return; 233 return;
234 }
192 #elif defined(OS_POSIX) 235 #elif defined(OS_POSIX)
193 // Always enable upgrade notifications regardless of branding. 236 // Always enable upgrade notifications regardless of branding.
194 #else 237 #else
195 return; 238 return;
196 #endif 239 #endif
197 // Check whether the build is an unstable channel before starting the timer. 240 // Check whether the build is an unstable channel before starting the timer.
198 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, 241 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE,
199 base::Bind(&CheckForUnstableChannel, 242 base::Bind(&CheckForUnstableChannel,
200 start_upgrade_check_timer_task, 243 start_upgrade_check_timer_task,
201 &is_unstable_channel_)); 244 &is_unstable_channel_));
202 245 #endif
203 // Start tracking network time updates. 246 // Start tracking network time updates.
204 network_time_tracker_.Start(); 247 network_time_tracker_.Start();
205 #endif
206 } 248 }
207 249
208 UpgradeDetectorImpl::~UpgradeDetectorImpl() { 250 UpgradeDetectorImpl::~UpgradeDetectorImpl() {
209 } 251 }
210 252
211 // Static 253 // Static
212 // This task checks the currently running version of Chrome against the 254 // This task checks the currently running version of Chrome against the
213 // installed version. If the installed version is newer, it calls back 255 // installed version. If the installed version is newer, it calls back
214 // UpgradeDetectorImpl::UpgradeDetected using a weak pointer so that it can 256 // UpgradeDetectorImpl::UpgradeDetected using a weak pointer so that it can
215 // be interrupted from the UI thread. 257 // be interrupted from the UI thread.
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 // We use FILE as the thread to run the upgrade detection code on all 346 // We use FILE as the thread to run the upgrade detection code on all
305 // platforms. For Linux, this is because we don't want to block the UI thread 347 // platforms. For Linux, this is because we don't want to block the UI thread
306 // while launching a background process and reading its output; on the Mac and 348 // while launching a background process and reading its output; on the Mac and
307 // on Windows checking for an upgrade requires reading a file. 349 // on Windows checking for an upgrade requires reading a file.
308 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, 350 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE,
309 base::Bind(&UpgradeDetectorImpl::DetectUpgradeTask, 351 base::Bind(&UpgradeDetectorImpl::DetectUpgradeTask,
310 weak_factory_.GetWeakPtr())); 352 weak_factory_.GetWeakPtr()));
311 } 353 }
312 354
313 bool UpgradeDetectorImpl::DetectOutdatedInstall() { 355 bool UpgradeDetectorImpl::DetectOutdatedInstall() {
314 // Only enable the outdated install check if we are running the trial for it, 356 // Don't show the bubble if we have a brand code that is NOT organic, unless
315 // unless we are simulating an outdated isntall. 357 // an outdated build is being simulated by command line switches.
316 static bool simulate_outdated = CommandLine::ForCurrentProcess()->HasSwitch( 358 static bool simulate_outdated = SimulatingOutdated();
317 switches::kSimulateOutdated);
318 if (!simulate_outdated) { 359 if (!simulate_outdated) {
319 // Also don't show the bubble if we have a brand code that is NOT organic.
320 std::string brand; 360 std::string brand;
321 if (google_util::GetBrand(&brand) && !google_util::IsOrganic(brand)) 361 if (google_util::GetBrand(&brand) && !google_util::IsOrganic(brand))
322 return false; 362 return false;
323 } 363 }
324 364
325 base::Time network_time; 365 base::Time network_time;
326 base::TimeDelta uncertainty; 366 base::TimeDelta uncertainty;
327 if (!network_time_tracker_.GetNetworkTime(base::TimeTicks::Now(), 367 if (!network_time_tracker_.GetNetworkTime(base::TimeTicks::Now(),
328 &network_time, 368 &network_time,
329 &uncertainty)) { 369 &uncertainty)) {
330 return false; 370 // When network time has not been initialized yet, simply rely on the
371 // machine's current time.
372 network_time = base::Time::Now();
331 } 373 }
332 374
333 if (network_time.is_null() || build_date_.is_null() || 375 if (network_time.is_null() || build_date_.is_null() ||
334 build_date_ > network_time) { 376 build_date_ > network_time) {
335 NOTREACHED(); 377 NOTREACHED();
336 return false; 378 return false;
337 } 379 }
338 380
339 if (network_time - build_date_ > 381 if (network_time - build_date_ >
340 base::TimeDelta::FromDays(kOutdatedBuildAgeInDays)) { 382 base::TimeDelta::FromDays(kOutdatedBuildAgeInDays)) {
341 UpgradeDetected(UPGRADE_NEEDED_OUTDATED_INSTALL); 383 UpgradeDetected(is_auto_update_enabled_ ?
384 UPGRADE_NEEDED_OUTDATED_INSTALL :
385 UPGRADE_NEEDED_OUTDATED_INSTALL_NO_AU);
342 return true; 386 return true;
343 } 387 }
344 // If we simlated an outdated install with a date, we don't want to keep 388 // If we simlated an outdated install with a date, we don't want to keep
345 // checking for version upgrades, which happens on non-official builds. 389 // checking for version upgrades, which happens on non-official builds.
346 return simulate_outdated; 390 return simulate_outdated;
347 } 391 }
348 392
349 void UpgradeDetectorImpl::UpgradeDetected(UpgradeAvailable upgrade_available) { 393 void UpgradeDetectorImpl::UpgradeDetected(UpgradeAvailable upgrade_available) {
350 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 394 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
351 upgrade_available_ = upgrade_available; 395 upgrade_available_ = upgrade_available;
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
422 466
423 // static 467 // static
424 UpgradeDetectorImpl* UpgradeDetectorImpl::GetInstance() { 468 UpgradeDetectorImpl* UpgradeDetectorImpl::GetInstance() {
425 return Singleton<UpgradeDetectorImpl>::get(); 469 return Singleton<UpgradeDetectorImpl>::get();
426 } 470 }
427 471
428 // static 472 // static
429 UpgradeDetector* UpgradeDetector::GetInstance() { 473 UpgradeDetector* UpgradeDetector::GetInstance() {
430 return UpgradeDetectorImpl::GetInstance(); 474 return UpgradeDetectorImpl::GetInstance();
431 } 475 }
OLDNEW
« no previous file with comments | « chrome/browser/upgrade_detector_impl.h ('k') | chrome/common/chrome_switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698