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

Unified Diff: chrome/browser/chromeos/display/quirks_manager_delegate_impl.cc

Issue 1528963002: Quirks Client for downloading and providing display profiles (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: stevenjb@'s latest code review (small tweaks) Created 4 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 side-by-side diff with in-line comments
Download patch
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..e5e8fe0574bf61d3f9baf989771428f304ca17ed
--- /dev/null
+++ b/chrome/browser/chromeos/display/quirks_manager_delegate_impl.cc
@@ -0,0 +1,63 @@
+// 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 {
+
+const char kUserDataDisplayProfilesDirectory[] = "display_profiles";
+
+int GetDaysSinceOobeOnBlockingPool() {
+ base::ThreadRestrictions::AssertIOAllowed();
+ return chromeos::StartupUtils::GetTimeSinceOobeFlagFileCreation().InDays();
+}
+
+} // namespace
+
+namespace quirks {
+
+std::string QuirksManagerDelegateImpl::GetApiKey() const {
+ return google_apis::GetAPIKey();
+}
+
+base::FilePath QuirksManagerDelegateImpl::GetBuiltInDisplayProfileDirectory()
+ const {
+ base::FilePath path;
+ if (!PathService::Get(chromeos::DIR_DEVICE_COLOR_CALIBRATION_PROFILES, &path))
+ LOG(ERROR) << "Could not get system path for display calibration profiles.";
+ 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(kUserDataDisplayProfilesDirectory);
+ }
+ return directory;
+}
+
+void QuirksManagerDelegateImpl::GetDaysSinceOobe(
+ QuirksManager::DaysSinceOobeCallback callback) const {
+ base::PostTaskAndReplyWithResult(
+ content::BrowserThread::GetBlockingPool(), FROM_HERE,
+ base::Bind(&GetDaysSinceOobeOnBlockingPool), callback);
+}
+
+} // namespace quirks

Powered by Google App Engine
This is Rietveld 408576698