Index: components/quirks/quirks_manager.cc |
diff --git a/components/quirks/quirks_manager.cc b/components/quirks/quirks_manager.cc |
index d4c693375a655851429a36fcd88107a973fa2234..4875ee4ddf87acc140b7c5b9b60856007c434f3b 100644 |
--- a/components/quirks/quirks_manager.cc |
+++ b/components/quirks/quirks_manager.cc |
@@ -43,7 +43,8 @@ bool CheckAndLogFile(const base::FilePath& path) { |
} |
base::FilePath CheckForIccFile(base::FilePath built_in_path, |
- base::FilePath download_path) { |
+ base::FilePath download_path, |
+ bool quirks_enabled) { |
// First, look for icc file in old read-only location. If there, we don't use |
// the Quirks server. |
// TODO(glevin): Awaiting final decision on how to handle old read-only files. |
@@ -51,8 +52,7 @@ base::FilePath CheckForIccFile(base::FilePath built_in_path, |
return built_in_path; |
// If experimental Quirks flag isn't set, no other icc file is available. |
- if (!base::CommandLine::ForCurrentProcess()->HasSwitch( |
- switches::kEnableQuirksClient)) { |
+ if (!quirks_enabled) { |
VLOG(1) << "Quirks Client disabled, no built-in icc file available."; |
return base::FilePath(); |
} |
@@ -126,6 +126,11 @@ void QuirksManager::OnLoginCompleted() { |
return; |
waiting_for_login_ = false; |
+ if (!QuirksEnabled()) { |
+ VLOG(1) << "Quirks Client disabled by device policy."; |
+ return; |
+ } |
+ |
for (const scoped_ptr<QuirksClient>& client : clients_) |
client->StartDownload(); |
} |
@@ -140,7 +145,8 @@ void QuirksManager::RequestIccProfilePath( |
blocking_pool_.get(), FROM_HERE, |
base::Bind(&CheckForIccFile, |
delegate_->GetBuiltInDisplayProfileDirectory().Append(name), |
- delegate_->GetDownloadDisplayProfileDirectory().Append(name)), |
+ delegate_->GetDownloadDisplayProfileDirectory().Append(name), |
+ QuirksEnabled()), |
base::Bind(&QuirksManager::OnIccFilePathRequestCompleted, |
weak_ptr_factory_.GetWeakPtr(), product_id, |
on_request_finished)); |
@@ -173,9 +179,7 @@ void QuirksManager::OnIccFilePathRequestCompleted( |
DCHECK(thread_checker_.CalledOnValidThread()); |
// If we found a file or client is disabled, inform requester. |
- if (!path.empty() || |
- !base::CommandLine::ForCurrentProcess()->HasSwitch( |
- switches::kEnableQuirksClient)) { |
+ if (!path.empty() || !QuirksEnabled()) { |
on_request_finished.Run(path, false); |
// TODO(glevin): If Quirks files are ever modified on the server, we'll need |
// to modify this logic to check for updates. See crbug.com/595024. |
@@ -247,6 +251,12 @@ void QuirksManager::CreateClient( |
VLOG(2) << "Quirks Client created; waiting for login to begin download."; |
} |
+bool QuirksManager::QuirksEnabled() { |
+ return base::CommandLine::ForCurrentProcess()->HasSwitch( |
+ switches::kEnableQuirksClient) && |
+ delegate_->DevicePolicyEnabled(); |
+} |
+ |
void QuirksManager::SetLastServerCheck(int64_t product_id, |
const base::Time& last_check) { |
DCHECK(thread_checker_.CalledOnValidThread()); |