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

Side by Side Diff: chrome/browser/policy/url_blacklist_manager.cc

Issue 14113053: chrome: Use base::MessageLoop. (Part 3) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase again Created 7 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/policy/url_blacklist_manager.h" 5 #include "chrome/browser/policy/url_blacklist_manager.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/message_loop.h" 8 #include "base/message_loop.h"
9 #include "base/prefs/pref_service.h" 9 #include "base/prefs/pref_service.h"
10 #include "base/stl_util.h" 10 #include "base/stl_util.h"
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 327
328 URLBlacklistManager::~URLBlacklistManager() { 328 URLBlacklistManager::~URLBlacklistManager() {
329 } 329 }
330 330
331 void URLBlacklistManager::ScheduleUpdate() { 331 void URLBlacklistManager::ScheduleUpdate() {
332 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 332 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
333 // Cancel pending updates, if any. This can happen if two preferences that 333 // Cancel pending updates, if any. This can happen if two preferences that
334 // change the blacklist are updated in one message loop cycle. In those cases, 334 // change the blacklist are updated in one message loop cycle. In those cases,
335 // only rebuild the blacklist after all the preference updates are processed. 335 // only rebuild the blacklist after all the preference updates are processed.
336 ui_weak_ptr_factory_.InvalidateWeakPtrs(); 336 ui_weak_ptr_factory_.InvalidateWeakPtrs();
337 MessageLoop::current()->PostTask( 337 base::MessageLoop::current()->PostTask(
338 FROM_HERE, 338 FROM_HERE,
339 base::Bind(&URLBlacklistManager::Update, 339 base::Bind(&URLBlacklistManager::Update,
340 ui_weak_ptr_factory_.GetWeakPtr())); 340 ui_weak_ptr_factory_.GetWeakPtr()));
341 } 341 }
342 342
343 void URLBlacklistManager::Update() { 343 void URLBlacklistManager::Update() {
344 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 344 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
345 345
346 // The preferences can only be read on the UI thread. 346 // The preferences can only be read on the UI thread.
347 scoped_ptr<base::ListValue> block( 347 scoped_ptr<base::ListValue> block(
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
401 // static 401 // static
402 void URLBlacklistManager::RegisterUserPrefs( 402 void URLBlacklistManager::RegisterUserPrefs(
403 user_prefs::PrefRegistrySyncable* registry) { 403 user_prefs::PrefRegistrySyncable* registry) {
404 registry->RegisterListPref(prefs::kUrlBlacklist, 404 registry->RegisterListPref(prefs::kUrlBlacklist,
405 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); 405 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
406 registry->RegisterListPref(prefs::kUrlWhitelist, 406 registry->RegisterListPref(prefs::kUrlWhitelist,
407 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); 407 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
408 } 408 }
409 409
410 } // namespace policy 410 } // namespace policy
OLDNEW
« no previous file with comments | « chrome/browser/policy/policy_service_impl_unittest.cc ('k') | chrome/browser/policy/url_blacklist_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698