Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "chrome/browser/chromeos/display/quirks_manager_delegate_impl.h" | |
| 6 | |
| 7 #include "base/path_service.h" | |
| 8 #include "base/sys_info.h" | |
| 9 #include "base/task_runner_util.h" | |
| 10 #include "base/threading/thread_restrictions.h" | |
| 11 #include "chrome/browser/chromeos/login/startup_utils.h" | |
| 12 #include "chrome/common/chrome_paths.h" | |
| 13 #include "chromeos/chromeos_paths.h" | |
| 14 #include "content/public/browser/browser_thread.h" | |
| 15 #include "google_apis/google_api_keys.h" | |
| 16 | |
| 17 namespace { | |
| 18 | |
| 19 int GetDaysSinceOobeOnBlockingPool() { | |
| 20 base::ThreadRestrictions::AssertIOAllowed(); | |
| 21 return chromeos::StartupUtils::GetTimeSinceOobeFlagFileCreation().InDays(); | |
| 22 } | |
| 23 | |
| 24 } // namespace | |
| 25 | |
| 26 namespace quirks { | |
| 27 | |
| 28 std::string QuirksManagerDelegateImpl::GetApiKey() const { | |
| 29 return google_apis::GetAPIKey(); | |
| 30 } | |
| 31 | |
| 32 base::FilePath QuirksManagerDelegateImpl::GetBuiltInDisplayProfileDirectory() | |
| 33 const { | |
| 34 base::FilePath path; | |
| 35 DCHECK( | |
| 36 PathService::Get(chromeos::DIR_DEVICE_COLOR_CALIBRATION_PROFILES, &path)); | |
|
stevenjb
2016/03/21 17:43:59
This will fail on a release build since DCHECK() i
Greg Levin
2016/03/21 21:12:45
Ugh, thanks. Don't know what brain fart caused me
| |
| 37 return path; | |
| 38 } | |
| 39 | |
| 40 // On chrome device, returns /var/cache/display_profiles. | |
| 41 // On Linux desktop, returns {DIR_USER_DATA}/display_profiles. | |
| 42 base::FilePath QuirksManagerDelegateImpl::GetDownloadDisplayProfileDirectory() | |
| 43 const { | |
| 44 base::FilePath directory; | |
| 45 if (base::SysInfo::IsRunningOnChromeOS()) { | |
| 46 PathService::Get(chromeos::DIR_DEVICE_DISPLAY_PROFILES, &directory); | |
| 47 } else { | |
| 48 PathService::Get(chrome::DIR_USER_DATA, &directory); | |
| 49 directory = directory.Append("display_profiles"); | |
|
stevenjb
2016/03/21 17:43:59
"display_profiles" should be defined as a const in
Greg Levin
2016/03/21 21:12:45
Done.
| |
| 50 } | |
| 51 return directory; | |
| 52 } | |
| 53 | |
| 54 void QuirksManagerDelegateImpl::GetDaysSinceOobe( | |
| 55 QuirksManager::DaysSinceOobeCallback callback) const { | |
| 56 base::PostTaskAndReplyWithResult( | |
| 57 content::BrowserThread::GetBlockingPool(), FROM_HERE, | |
| 58 base::Bind(&GetDaysSinceOobeOnBlockingPool), callback); | |
| 59 } | |
| 60 | |
| 61 } // namespace quirks | |
| OLD | NEW |