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

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

Powered by Google App Engine
This is Rietveld 408576698