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> | 7 #include <stdint.h> |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 #include <string> | 10 #include <string> |
11 | 11 |
12 #include "base/bind.h" | 12 #include "base/bind.h" |
13 #include "base/build_time.h" | 13 #include "base/build_time.h" |
14 #include "base/command_line.h" | 14 #include "base/command_line.h" |
15 #include "base/feature_list.h" | |
15 #include "base/files/file_path.h" | 16 #include "base/files/file_path.h" |
16 #include "base/memory/singleton.h" | 17 #include "base/memory/singleton.h" |
17 #include "base/path_service.h" | 18 #include "base/path_service.h" |
18 #include "base/process/launch.h" | 19 #include "base/process/launch.h" |
19 #include "base/strings/string_number_conversions.h" | 20 #include "base/strings/string_number_conversions.h" |
20 #include "base/strings/string_util.h" | 21 #include "base/strings/string_util.h" |
21 #include "base/strings/utf_string_conversions.h" | 22 #include "base/strings/utf_string_conversions.h" |
22 #include "base/time/time.h" | 23 #include "base/time/time.h" |
23 #include "build/build_config.h" | 24 #include "build/build_config.h" |
24 #include "chrome/browser/browser_process.h" | 25 #include "chrome/browser/browser_process.h" |
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
386 // We use FILE as the thread to run the upgrade detection code on all | 387 // We use FILE as the thread to run the upgrade detection code on all |
387 // platforms. For Linux, this is because we don't want to block the UI thread | 388 // platforms. For Linux, this is because we don't want to block the UI thread |
388 // while launching a background process and reading its output; on the Mac and | 389 // while launching a background process and reading its output; on the Mac and |
389 // on Windows checking for an upgrade requires reading a file. | 390 // on Windows checking for an upgrade requires reading a file. |
390 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, | 391 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, |
391 base::Bind(&UpgradeDetectorImpl::DetectUpgradeTask, | 392 base::Bind(&UpgradeDetectorImpl::DetectUpgradeTask, |
392 weak_factory_.GetWeakPtr())); | 393 weak_factory_.GetWeakPtr())); |
393 } | 394 } |
394 | 395 |
395 bool UpgradeDetectorImpl::DetectOutdatedInstall() { | 396 bool UpgradeDetectorImpl::DetectOutdatedInstall() { |
397 constexpr base::Feature kOutdatedBuildDetector = | |
grt (UTC plus 2)
2016/08/23 08:54:44
thakis: should this really be:
static constexpr
| |
398 { "OutdatedBuildDetector", base::FEATURE_ENABLED_BY_DEFAULT }; | |
399 | |
400 if (!base::FeatureList::IsEnabled(kOutdatedBuildDetector)) | |
401 return false; | |
402 | |
396 // Don't show the bubble if we have a brand code that is NOT organic, unless | 403 // Don't show the bubble if we have a brand code that is NOT organic, unless |
397 // an outdated build is being simulated by command line switches. | 404 // an outdated build is being simulated by command line switches. |
398 static bool simulate_outdated = SimulatingOutdated(); | 405 static bool simulate_outdated = SimulatingOutdated(); |
399 if (!simulate_outdated) { | 406 if (!simulate_outdated) { |
400 std::string brand; | 407 std::string brand; |
401 if (google_brand::GetBrand(&brand) && !google_brand::IsOrganic(brand)) | 408 if (google_brand::GetBrand(&brand) && !google_brand::IsOrganic(brand)) |
402 return false; | 409 return false; |
403 | 410 |
404 #if defined(OS_WIN) | 411 #if defined(OS_WIN) |
405 // Don't show the update bubbles to enterprise users (i.e., on a domain). | 412 // Don't show the update bubbles to enterprise users (i.e., on a domain). |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
514 | 521 |
515 // static | 522 // static |
516 UpgradeDetectorImpl* UpgradeDetectorImpl::GetInstance() { | 523 UpgradeDetectorImpl* UpgradeDetectorImpl::GetInstance() { |
517 return base::Singleton<UpgradeDetectorImpl>::get(); | 524 return base::Singleton<UpgradeDetectorImpl>::get(); |
518 } | 525 } |
519 | 526 |
520 // static | 527 // static |
521 UpgradeDetector* UpgradeDetector::GetInstance() { | 528 UpgradeDetector* UpgradeDetector::GetInstance() { |
522 return UpgradeDetectorImpl::GetInstance(); | 529 return UpgradeDetectorImpl::GetInstance(); |
523 } | 530 } |
OLD | NEW |