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

Side by Side Diff: chrome/browser/prefs/tracked/interceptable_pref_filter.cc

Issue 1227973003: Componentize //chrome/browser/prefs/tracked. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 5 years, 4 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "chrome/browser/prefs/tracked/interceptable_pref_filter.h"
6
7 #include "base/bind.h"
8
9 InterceptablePrefFilter::InterceptablePrefFilter() {}
10 InterceptablePrefFilter::~InterceptablePrefFilter() {}
11
12 void InterceptablePrefFilter::FilterOnLoad(
13 const PostFilterOnLoadCallback& post_filter_on_load_callback,
14 scoped_ptr<base::DictionaryValue> pref_store_contents) {
15 if (filter_on_load_interceptor_.is_null()) {
16 FinalizeFilterOnLoad(post_filter_on_load_callback,
17 pref_store_contents.Pass(),
18 false);
19 } else {
20 // Note, in practice (in the implementation as it was in May 2014) it would
21 // be okay to pass an unretained |this| pointer below, but in order to avoid
22 // having to augment the API everywhere to explicitly enforce the ownership
23 // model as it happens to currently be: make the relationship simpler by
24 // weakly binding the FinalizeFilterOnLoadCallback below to |this|.
25 const FinalizeFilterOnLoadCallback finalize_filter_on_load(
26 base::Bind(&InterceptablePrefFilter::FinalizeFilterOnLoad,
27 AsWeakPtr(),
28 post_filter_on_load_callback));
29 filter_on_load_interceptor_.Run(finalize_filter_on_load,
30 pref_store_contents.Pass());
31 filter_on_load_interceptor_.Reset();
32 }
33 }
34
35 void InterceptablePrefFilter::InterceptNextFilterOnLoad(
36 const FilterOnLoadInterceptor& filter_on_load_interceptor) {
37 DCHECK(filter_on_load_interceptor_.is_null());
38 filter_on_load_interceptor_ = filter_on_load_interceptor;
39 }
OLDNEW
« no previous file with comments | « chrome/browser/prefs/tracked/interceptable_pref_filter.h ('k') | chrome/browser/prefs/tracked/mock_validation_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698