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

Side by Side Diff: components/policy/core/browser/url_blacklist_manager.cc

Issue 573133003: Code re-factor related to WeakPtrFactory in src/component module (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/policy/core/browser/url_blacklist_manager.h" 5 #include "components/policy/core/browser/url_blacklist_manager.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/files/file_path.h" 8 #include "base/files/file_path.h"
9 #include "base/location.h" 9 #include "base/location.h"
10 #include "base/message_loop/message_loop_proxy.h" 10 #include "base/message_loop/message_loop_proxy.h"
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 394
395 return false; 395 return false;
396 } 396 }
397 397
398 URLBlacklistManager::URLBlacklistManager( 398 URLBlacklistManager::URLBlacklistManager(
399 PrefService* pref_service, 399 PrefService* pref_service,
400 const scoped_refptr<base::SequencedTaskRunner>& background_task_runner, 400 const scoped_refptr<base::SequencedTaskRunner>& background_task_runner,
401 const scoped_refptr<base::SequencedTaskRunner>& io_task_runner, 401 const scoped_refptr<base::SequencedTaskRunner>& io_task_runner,
402 URLBlacklist::SegmentURLCallback segment_url, 402 URLBlacklist::SegmentURLCallback segment_url,
403 OverrideBlacklistCallback override_blacklist) 403 OverrideBlacklistCallback override_blacklist)
404 : ui_weak_ptr_factory_(this), 404 : pref_service_(pref_service),
405 pref_service_(pref_service),
406 background_task_runner_(background_task_runner), 405 background_task_runner_(background_task_runner),
407 io_task_runner_(io_task_runner), 406 io_task_runner_(io_task_runner),
408 segment_url_(segment_url), 407 segment_url_(segment_url),
409 override_blacklist_(override_blacklist), 408 override_blacklist_(override_blacklist),
410 io_weak_ptr_factory_(this),
411 ui_task_runner_(base::MessageLoopProxy::current()), 409 ui_task_runner_(base::MessageLoopProxy::current()),
412 blacklist_(new URLBlacklist(segment_url)) { 410 blacklist_(new URLBlacklist(segment_url)),
411 ui_weak_ptr_factory_(this),
412 io_weak_ptr_factory_(this) {
413 pref_change_registrar_.Init(pref_service_); 413 pref_change_registrar_.Init(pref_service_);
414 base::Closure callback = base::Bind(&URLBlacklistManager::ScheduleUpdate, 414 base::Closure callback = base::Bind(&URLBlacklistManager::ScheduleUpdate,
415 base::Unretained(this)); 415 base::Unretained(this));
416 pref_change_registrar_.Add(policy_prefs::kUrlBlacklist, callback); 416 pref_change_registrar_.Add(policy_prefs::kUrlBlacklist, callback);
417 pref_change_registrar_.Add(policy_prefs::kUrlWhitelist, callback); 417 pref_change_registrar_.Add(policy_prefs::kUrlWhitelist, callback);
418 418
419 // Start enforcing the policies without a delay when they are present at 419 // Start enforcing the policies without a delay when they are present at
420 // startup. 420 // startup.
421 if (pref_service_->HasPrefPath(policy_prefs::kUrlBlacklist)) 421 if (pref_service_->HasPrefPath(policy_prefs::kUrlBlacklist))
422 Update(); 422 Update();
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
510 // static 510 // static
511 void URLBlacklistManager::RegisterProfilePrefs( 511 void URLBlacklistManager::RegisterProfilePrefs(
512 user_prefs::PrefRegistrySyncable* registry) { 512 user_prefs::PrefRegistrySyncable* registry) {
513 registry->RegisterListPref(policy_prefs::kUrlBlacklist, 513 registry->RegisterListPref(policy_prefs::kUrlBlacklist,
514 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); 514 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
515 registry->RegisterListPref(policy_prefs::kUrlWhitelist, 515 registry->RegisterListPref(policy_prefs::kUrlWhitelist,
516 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); 516 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
517 } 517 }
518 518
519 } // namespace policy 519 } // namespace policy
OLDNEW
« no previous file with comments | « components/policy/core/browser/url_blacklist_manager.h ('k') | components/policy/core/common/async_policy_provider.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698