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

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

Issue 202993002: Fix "unreachable code" warnings (MSVC warning 4702) in chrome/browser/. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 6 years, 9 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/ui/views/tabs/tab_strip.cc ('k') | no next file » | 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"
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 // We got a valid build date simulation so use it and check for upgrades. 166 // We got a valid build date simulation so use it and check for upgrades.
167 build_date_ = maybe_build_time; 167 build_date_ = maybe_build_time;
168 StartTimerForUpgradeCheck(); 168 StartTimerForUpgradeCheck();
169 } else { 169 } else {
170 // Without a valid date, we simulate that we are already outdated... 170 // Without a valid date, we simulate that we are already outdated...
171 UpgradeDetected(UPGRADE_NEEDED_OUTDATED_INSTALL); 171 UpgradeDetected(UPGRADE_NEEDED_OUTDATED_INSTALL);
172 } 172 }
173 return; 173 return;
174 } 174 }
175 175
176 // Windows: only enable upgrade notifications for official builds.
177 // Mac: only enable them if the updater (Keystone) is present.
178 // Linux (and other POSIX): always enable regardless of branding.
179 base::Closure start_upgrade_check_timer_task = 176 base::Closure start_upgrade_check_timer_task =
180 base::Bind(&UpgradeDetectorImpl::StartTimerForUpgradeCheck, 177 base::Bind(&UpgradeDetectorImpl::StartTimerForUpgradeCheck,
181 weak_factory_.GetWeakPtr()); 178 weak_factory_.GetWeakPtr());
182 #if defined(OS_WIN) && defined(GOOGLE_CHROME_BUILD) 179
180 #if defined(OS_WIN)
181 // Only enable upgrade notifications for official builds. Chromium has no
182 // upgrade channel.
183 #if defined(GOOGLE_CHROME_BUILD)
183 // On Windows, there might be a policy preventing updates, so validate 184 // On Windows, there might be a policy preventing updates, so validate
184 // updatability, and then call StartTimerForUpgradeCheck appropriately. 185 // updatability, and then call StartTimerForUpgradeCheck appropriately.
185 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, 186 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE,
186 base::Bind(&DetectUpdatability, 187 base::Bind(&DetectUpdatability,
187 start_upgrade_check_timer_task, 188 start_upgrade_check_timer_task,
188 &is_unstable_channel_)); 189 &is_unstable_channel_));
189 return; 190 #endif
190 #elif defined(OS_WIN) && !defined(GOOGLE_CHROME_BUILD) 191 #else
191 return; // Chromium has no upgrade channel. 192 #if defined(OS_MACOSX)
192 #elif defined(OS_MACOSX) 193 // Only enable upgrade notifications if the updater (Keystone) is present.
193 if (!keystone_glue::KeystoneEnabled()) 194 if (!keystone_glue::KeystoneEnabled())
194 return; // Keystone updater not enabled. 195 return;
195 #elif !defined(OS_POSIX) 196 #elif defined(OS_POSIX)
197 // Always enable upgrade notifications regardless of branding.
198 #else
196 return; 199 return;
197 #endif 200 #endif
198
199 // Check whether the build is an unstable channel before starting the timer. 201 // Check whether the build is an unstable channel before starting the timer.
200 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, 202 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE,
201 base::Bind(&CheckForUnstableChannel, 203 base::Bind(&CheckForUnstableChannel,
202 start_upgrade_check_timer_task, 204 start_upgrade_check_timer_task,
203 &is_unstable_channel_)); 205 &is_unstable_channel_));
204 206
205 // Start tracking network time updates. 207 // Start tracking network time updates.
206 network_time_tracker_.Start(); 208 network_time_tracker_.Start();
209 #endif
207 } 210 }
208 211
209 UpgradeDetectorImpl::~UpgradeDetectorImpl() { 212 UpgradeDetectorImpl::~UpgradeDetectorImpl() {
210 } 213 }
211 214
212 // Static 215 // Static
213 // This task checks the currently running version of Chrome against the 216 // This task checks the currently running version of Chrome against the
214 // installed version. If the installed version is newer, it calls back 217 // installed version. If the installed version is newer, it calls back
215 // UpgradeDetectorImpl::UpgradeDetected using a weak pointer so that it can 218 // UpgradeDetectorImpl::UpgradeDetected using a weak pointer so that it can
216 // be interrupted from the UI thread. 219 // be interrupted from the UI thread.
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
423 426
424 // static 427 // static
425 UpgradeDetectorImpl* UpgradeDetectorImpl::GetInstance() { 428 UpgradeDetectorImpl* UpgradeDetectorImpl::GetInstance() {
426 return Singleton<UpgradeDetectorImpl>::get(); 429 return Singleton<UpgradeDetectorImpl>::get();
427 } 430 }
428 431
429 // static 432 // static
430 UpgradeDetector* UpgradeDetector::GetInstance() { 433 UpgradeDetector* UpgradeDetector::GetInstance() {
431 return UpgradeDetectorImpl::GetInstance(); 434 return UpgradeDetectorImpl::GetInstance();
432 } 435 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/tabs/tab_strip.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698