Chromium Code Reviews| Index: chrome/browser/chromeos/display/quirks_manager_delegate_impl.cc |
| diff --git a/chrome/browser/chromeos/display/quirks_manager_delegate_impl.cc b/chrome/browser/chromeos/display/quirks_manager_delegate_impl.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..1310290d57872a3a4a46c0103eea25ea67d3be0e |
| --- /dev/null |
| +++ b/chrome/browser/chromeos/display/quirks_manager_delegate_impl.cc |
| @@ -0,0 +1,60 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "chrome/browser/chromeos/display/quirks_manager_delegate_impl.h" |
| + |
| +#include "base/path_service.h" |
| +#include "base/sys_info.h" |
| +#include "base/task_runner_util.h" |
| +#include "base/threading/thread_restrictions.h" |
| +#include "chrome/browser/chromeos/login/startup_utils.h" |
| +#include "chrome/common/chrome_paths.h" |
| +#include "chromeos/chromeos_paths.h" |
| +#include "content/public/browser/browser_thread.h" |
| +#include "google_apis/google_api_keys.h" |
| + |
| +namespace { |
| + |
| +int GetDaysSinceOobeOnBlockingPool() { |
| + base::ThreadRestrictions::AssertIOAllowed(); |
| + return chromeos::StartupUtils::GetTimeSinceOobeFlagFileCreation().InDays(); |
| +} |
| +} |
|
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
|
| + |
| +namespace quirks { |
| + |
| +std::string QuirksManagerDelegateImpl::GetApiKey() const { |
| + return google_apis::GetAPIKey(); |
| +} |
| + |
| +base::FilePath QuirksManagerDelegateImpl::GetBuiltInDisplayProfileDirectory() |
| + const { |
| + base::FilePath path; |
| + DCHECK( |
| + PathService::Get(chromeos::DIR_DEVICE_COLOR_CALIBRATION_PROFILES, &path)); |
| + return path; |
| +} |
| + |
| +// On chrome device, returns /var/cache/display_profiles. |
| +// On Linux desktop, returns {DIR_USER_DATA}/display_profiles. |
| +base::FilePath QuirksManagerDelegateImpl::GetDownloadDisplayProfileDirectory() |
| + const { |
| + base::FilePath directory; |
| + if (base::SysInfo::IsRunningOnChromeOS()) { |
| + PathService::Get(chromeos::DIR_DEVICE_DISPLAY_PROFILES, &directory); |
| + } else { |
| + PathService::Get(chrome::DIR_USER_DATA, &directory); |
| + directory = directory.Append("display_profiles"); |
| + } |
| + return directory; |
| +} |
| + |
| +void QuirksManagerDelegateImpl::GetDaysSinceOobe( |
| + QuirksManager::DaysSinceOobeCallback callback) const { |
| + base::PostTaskAndReplyWithResult( |
| + content::BrowserThread::GetBlockingPool(), FROM_HERE, |
| + base::Bind(&GetDaysSinceOobeOnBlockingPool), callback); |
| +} |
| + |
| +} // namespace quirks |