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

Side by Side Diff: chrome/browser/safe_browsing/safe_browsing_service.cc

Issue 6905044: Refactor preference syncing. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Self review Created 9 years, 7 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "chrome/browser/safe_browsing/safe_browsing_service.h" 5 #include "chrome/browser/safe_browsing/safe_browsing_service.h"
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/lazy_instance.h" 9 #include "base/lazy_instance.h"
10 #include "base/path_service.h" 10 #include "base/path_service.h"
(...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after
476 476
477 void SafeBrowsingService::OnEnable(bool enabled) { 477 void SafeBrowsingService::OnEnable(bool enabled) {
478 if (enabled) 478 if (enabled)
479 Start(); 479 Start();
480 else 480 else
481 ShutDown(); 481 ShutDown();
482 } 482 }
483 483
484 // static 484 // static
485 void SafeBrowsingService::RegisterPrefs(PrefService* prefs) { 485 void SafeBrowsingService::RegisterPrefs(PrefService* prefs) {
486 prefs->RegisterStringPref(prefs::kSafeBrowsingClientKey, ""); 486 prefs->RegisterStringPref(prefs::kSafeBrowsingClientKey,
487 prefs->RegisterStringPref(prefs::kSafeBrowsingWrappedKey, ""); 487 "",
488 false /* don't sync pref */);
489 prefs->RegisterStringPref(prefs::kSafeBrowsingWrappedKey,
490 "",
491 false /* don't sync pref */);
488 } 492 }
489 493
490 void SafeBrowsingService::CloseDatabase() { 494 void SafeBrowsingService::CloseDatabase() {
491 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 495 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
492 496
493 // Cases to avoid: 497 // Cases to avoid:
494 // * If |closing_database_| is true, continuing will queue up a second 498 // * If |closing_database_| is true, continuing will queue up a second
495 // request, |closing_database_| will be reset after handling the first 499 // request, |closing_database_| will be reset after handling the first
496 // request, and if any functions on the db thread recreate the database, we 500 // request, and if any functions on the db thread recreate the database, we
497 // could start using it on the IO thread and then have the second request 501 // could start using it on the IO thread and then have the second request
(...skipping 688 matching lines...) Expand 10 before | Expand all | Expand 10 after
1186 check->is_download = true; 1190 check->is_download = true;
1187 check->timeout_task = 1191 check->timeout_task =
1188 NewRunnableMethod(this, &SafeBrowsingService::TimeoutCallback, check); 1192 NewRunnableMethod(this, &SafeBrowsingService::TimeoutCallback, check);
1189 checks_.insert(check); 1193 checks_.insert(check);
1190 1194
1191 safe_browsing_thread_->message_loop()->PostTask(FROM_HERE, task); 1195 safe_browsing_thread_->message_loop()->PostTask(FROM_HERE, task);
1192 1196
1193 MessageLoop::current()->PostDelayedTask( 1197 MessageLoop::current()->PostDelayedTask(
1194 FROM_HERE, check->timeout_task, timeout_ms); 1198 FROM_HERE, check->timeout_task, timeout_ms);
1195 } 1199 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698