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

Side by Side 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: A few 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 unified diff | Download patch
OLDNEW
(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 const char kUserDataDisplayProfilesDirectory[] = "display_profiles";
20
21 int GetDaysSinceOobeOnBlockingPool() {
22 return chromeos::StartupUtils::GetTimeSinceOobeFlagFileCreation().InDays();
23 }
24
25 } // namespace
26
27 namespace quirks {
28
29 std::string QuirksManagerDelegateImpl::GetApiKey() const {
30 return google_apis::GetAPIKey();
31 }
32
33 base::FilePath QuirksManagerDelegateImpl::GetBuiltInDisplayProfileDirectory()
34 const {
35 base::FilePath path;
36 if (!PathService::Get(chromeos::DIR_DEVICE_COLOR_CALIBRATION_PROFILES, &path))
37 LOG(ERROR) << "Could not get system path for display calibration profiles.";
38 return path;
39 }
40
41 // On chrome device, returns /var/cache/display_profiles.
42 // On Linux desktop, returns {DIR_USER_DATA}/display_profiles.
43 base::FilePath QuirksManagerDelegateImpl::GetDownloadDisplayProfileDirectory()
44 const {
45 base::FilePath directory;
46 if (base::SysInfo::IsRunningOnChromeOS()) {
47 PathService::Get(chromeos::DIR_DEVICE_DISPLAY_PROFILES, &directory);
48 } else {
49 PathService::Get(chrome::DIR_USER_DATA, &directory);
50 directory = directory.Append(kUserDataDisplayProfilesDirectory);
51 }
52 return directory;
53 }
54
55 void QuirksManagerDelegateImpl::GetDaysSinceOobe(
56 QuirksManager::DaysSinceOobeCallback callback) const {
57 base::PostTaskAndReplyWithResult(
58 content::BrowserThread::GetBlockingPool(), FROM_HERE,
59 base::Bind(&GetDaysSinceOobeOnBlockingPool), callback);
60 }
61
62 } // namespace quirks
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698