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 } | |
|
Bernhard Bauer
2016/03/17 17:42:25
Nit: empty line before closing the namespace, and
Greg Levin
2016/03/18 00:35:46
Ah, thanks! git cl format had told me to remove t
| |
| 24 | |
| 25 namespace quirks { | |
| 26 | |
| 27 std::string QuirksManagerDelegateImpl::GetApiKey() const { | |
| 28 return google_apis::GetAPIKey(); | |
| 29 } | |
| 30 | |
| 31 base::FilePath QuirksManagerDelegateImpl::GetBuiltInDisplayProfileDirectory() | |
| 32 const { | |
| 33 base::FilePath path; | |
| 34 DCHECK( | |
| 35 PathService::Get(chromeos::DIR_DEVICE_COLOR_CALIBRATION_PROFILES, &path)); | |
| 36 return path; | |
| 37 } | |
| 38 | |
| 39 // On chrome device, returns /var/cache/display_profiles. | |
| 40 // On Linux desktop, returns {DIR_USER_DATA}/display_profiles. | |
| 41 base::FilePath QuirksManagerDelegateImpl::GetDownloadDisplayProfileDirectory() | |
| 42 const { | |
| 43 base::FilePath directory; | |
| 44 if (base::SysInfo::IsRunningOnChromeOS()) { | |
| 45 PathService::Get(chromeos::DIR_DEVICE_DISPLAY_PROFILES, &directory); | |
| 46 } else { | |
| 47 PathService::Get(chrome::DIR_USER_DATA, &directory); | |
| 48 directory = directory.Append("display_profiles"); | |
| 49 } | |
| 50 return directory; | |
| 51 } | |
| 52 | |
| 53 void QuirksManagerDelegateImpl::GetDaysSinceOobe( | |
| 54 QuirksManager::DaysSinceOobeCallback callback) const { | |
| 55 base::PostTaskAndReplyWithResult( | |
| 56 content::BrowserThread::GetBlockingPool(), FROM_HERE, | |
| 57 base::Bind(&GetDaysSinceOobeOnBlockingPool), callback); | |
| 58 } | |
| 59 | |
| 60 } // namespace quirks | |
| OLD | NEW |