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

Side by Side Diff: components/quirks/quirks_manager.cc

Issue 2016883003: Remove Quirks flag, limit server retries (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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
« no previous file with comments | « components/quirks/quirks_client.cc ('k') | components/quirks/switches.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/quirks/quirks_manager.h" 5 #include "components/quirks/quirks_manager.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/command_line.h"
10 #include "base/files/file_util.h" 9 #include "base/files/file_util.h"
11 #include "base/format_macros.h" 10 #include "base/format_macros.h"
12 #include "base/memory/ptr_util.h" 11 #include "base/memory/ptr_util.h"
13 #include "base/path_service.h" 12 #include "base/path_service.h"
14 #include "base/rand_util.h" 13 #include "base/rand_util.h"
15 #include "base/strings/stringprintf.h" 14 #include "base/strings/stringprintf.h"
16 #include "base/task_runner_util.h" 15 #include "base/task_runner_util.h"
17 #include "components/prefs/pref_registry_simple.h" 16 #include "components/prefs/pref_registry_simple.h"
18 #include "components/prefs/scoped_user_pref_update.h" 17 #include "components/prefs/scoped_user_pref_update.h"
19 #include "components/quirks/pref_names.h" 18 #include "components/quirks/pref_names.h"
20 #include "components/quirks/quirks_client.h" 19 #include "components/quirks/quirks_client.h"
21 #include "components/quirks/switches.h"
22 #include "net/url_request/url_fetcher.h" 20 #include "net/url_request/url_fetcher.h"
23 #include "net/url_request/url_request_context_getter.h" 21 #include "net/url_request/url_request_context_getter.h"
24 #include "url/gurl.h" 22 #include "url/gurl.h"
25 23
26 namespace quirks { 24 namespace quirks {
27 25
28 namespace { 26 namespace {
29 27
30 QuirksManager* manager_ = nullptr; 28 QuirksManager* manager_ = nullptr;
31 29
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 QuirksClient* client = 244 QuirksClient* client =
247 new QuirksClient(product_id, on_request_finished, this); 245 new QuirksClient(product_id, on_request_finished, this);
248 clients_.insert(base::WrapUnique(client)); 246 clients_.insert(base::WrapUnique(client));
249 if (!waiting_for_login_) 247 if (!waiting_for_login_)
250 client->StartDownload(); 248 client->StartDownload();
251 else 249 else
252 VLOG(2) << "Quirks Client created; waiting for login to begin download."; 250 VLOG(2) << "Quirks Client created; waiting for login to begin download.";
253 } 251 }
254 252
255 bool QuirksManager::QuirksEnabled() { 253 bool QuirksManager::QuirksEnabled() {
256 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
257 switches::kDisableQuirksClient)) {
258 VLOG(2) << "Quirks Client disabled by command line flag.";
259 return false;
260 }
261 if (!delegate_->DevicePolicyEnabled()) { 254 if (!delegate_->DevicePolicyEnabled()) {
262 VLOG(2) << "Quirks Client disabled by device policy."; 255 VLOG(2) << "Quirks Client disabled by device policy.";
263 return false; 256 return false;
264 } 257 }
265 return true; 258 return true;
266 } 259 }
267 260
268 void QuirksManager::SetLastServerCheck(int64_t product_id, 261 void QuirksManager::SetLastServerCheck(int64_t product_id,
269 const base::Time& last_check) { 262 const base::Time& last_check) {
270 DCHECK(thread_checker_.CalledOnValidThread()); 263 DCHECK(thread_checker_.CalledOnValidThread());
271 DictionaryPrefUpdate dict(local_state_, prefs::kQuirksClientLastServerCheck); 264 DictionaryPrefUpdate dict(local_state_, prefs::kQuirksClientLastServerCheck);
272 dict->SetDouble(IdToHexString(product_id), last_check.ToDoubleT()); 265 dict->SetDouble(IdToHexString(product_id), last_check.ToDoubleT());
273 } 266 }
274 267
275 } // namespace quirks 268 } // namespace quirks
OLDNEW
« no previous file with comments | « components/quirks/quirks_client.cc ('k') | components/quirks/switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698