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

Side by Side Diff: components/user_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
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 "chrome/browser/prefs/tracked/interceptable_pref_filter.h" 5 #include "components/user_prefs/tracked/interceptable_pref_filter.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 8
9 InterceptablePrefFilter::InterceptablePrefFilter() {} 9 InterceptablePrefFilter::InterceptablePrefFilter() {
10 InterceptablePrefFilter::~InterceptablePrefFilter() {} 10 }
11 InterceptablePrefFilter::~InterceptablePrefFilter() {
12 }
11 13
12 void InterceptablePrefFilter::FilterOnLoad( 14 void InterceptablePrefFilter::FilterOnLoad(
13 const PostFilterOnLoadCallback& post_filter_on_load_callback, 15 const PostFilterOnLoadCallback& post_filter_on_load_callback,
14 scoped_ptr<base::DictionaryValue> pref_store_contents) { 16 scoped_ptr<base::DictionaryValue> pref_store_contents) {
15 if (filter_on_load_interceptor_.is_null()) { 17 if (filter_on_load_interceptor_.is_null()) {
16 FinalizeFilterOnLoad(post_filter_on_load_callback, 18 FinalizeFilterOnLoad(post_filter_on_load_callback,
17 pref_store_contents.Pass(), 19 pref_store_contents.Pass(), false);
18 false);
19 } else { 20 } else {
20 // Note, in practice (in the implementation as it was in May 2014) it would 21 // 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 // 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 // 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 // model as it happens to currently be: make the relationship simpler by
24 // weakly binding the FinalizeFilterOnLoadCallback below to |this|. 25 // weakly binding the FinalizeFilterOnLoadCallback below to |this|.
25 const FinalizeFilterOnLoadCallback finalize_filter_on_load( 26 const FinalizeFilterOnLoadCallback finalize_filter_on_load(
26 base::Bind(&InterceptablePrefFilter::FinalizeFilterOnLoad, 27 base::Bind(&InterceptablePrefFilter::FinalizeFilterOnLoad, AsWeakPtr(),
27 AsWeakPtr(),
28 post_filter_on_load_callback)); 28 post_filter_on_load_callback));
29 filter_on_load_interceptor_.Run(finalize_filter_on_load, 29 filter_on_load_interceptor_.Run(finalize_filter_on_load,
30 pref_store_contents.Pass()); 30 pref_store_contents.Pass());
31 filter_on_load_interceptor_.Reset(); 31 filter_on_load_interceptor_.Reset();
32 } 32 }
33 } 33 }
34 34
35 void InterceptablePrefFilter::InterceptNextFilterOnLoad( 35 void InterceptablePrefFilter::InterceptNextFilterOnLoad(
36 const FilterOnLoadInterceptor& filter_on_load_interceptor) { 36 const FilterOnLoadInterceptor& filter_on_load_interceptor) {
37 DCHECK(filter_on_load_interceptor_.is_null()); 37 DCHECK(filter_on_load_interceptor_.is_null());
38 filter_on_load_interceptor_ = filter_on_load_interceptor; 38 filter_on_load_interceptor_ = filter_on_load_interceptor;
39 } 39 }
OLDNEW
« no previous file with comments | « components/user_prefs/tracked/interceptable_pref_filter.h ('k') | components/user_prefs/tracked/mock_validation_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698