OLD | NEW |
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 "components/content_settings/core/browser/content_settings_pref_provide
r.h" | 5 #include "components/content_settings/core/browser/content_settings_pref_provide
r.h" |
6 | 6 |
7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 // |PrefProvider| holds a lock when the preferences change. | 59 // |PrefProvider| holds a lock when the preferences change. |
60 class DeadlockCheckerObserver { | 60 class DeadlockCheckerObserver { |
61 public: | 61 public: |
62 // |DeadlockCheckerObserver| doesn't take the ownership of |prefs| or | 62 // |DeadlockCheckerObserver| doesn't take the ownership of |prefs| or |
63 // |provider|. | 63 // |provider|. |
64 DeadlockCheckerObserver(PrefService* prefs, PrefProvider* provider) | 64 DeadlockCheckerObserver(PrefService* prefs, PrefProvider* provider) |
65 : provider_(provider), | 65 : provider_(provider), |
66 notification_received_(false) { | 66 notification_received_(false) { |
67 pref_change_registrar_.Init(prefs); | 67 pref_change_registrar_.Init(prefs); |
68 for (const auto& pair : provider_->content_settings_prefs_) { | 68 for (const auto& pair : provider_->content_settings_prefs_) { |
69 const ContentSettingsPref* pref = pair.second; | 69 const ContentSettingsPref* pref = pair.second.get(); |
70 pref_change_registrar_.Add( | 70 pref_change_registrar_.Add( |
71 pref->pref_name_, | 71 pref->pref_name_, |
72 base::Bind( | 72 base::Bind( |
73 &DeadlockCheckerObserver::OnContentSettingsPatternPairsChanged, | 73 &DeadlockCheckerObserver::OnContentSettingsPatternPairsChanged, |
74 base::Unretained(this), base::Unretained(pref))); | 74 base::Unretained(this), base::Unretained(pref))); |
75 } | 75 } |
76 } | 76 } |
77 virtual ~DeadlockCheckerObserver() {} | 77 virtual ~DeadlockCheckerObserver() {} |
78 | 78 |
79 bool notification_received() const { | 79 bool notification_received() const { |
(...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
584 for (const char* pref : nonempty_prefs) { | 584 for (const char* pref : nonempty_prefs) { |
585 DictionaryPrefUpdate update(&prefs, pref); | 585 DictionaryPrefUpdate update(&prefs, pref); |
586 const base::DictionaryValue* dictionary = update.Get(); | 586 const base::DictionaryValue* dictionary = update.Get(); |
587 EXPECT_EQ(1u, dictionary->size()); | 587 EXPECT_EQ(1u, dictionary->size()); |
588 } | 588 } |
589 | 589 |
590 provider.ShutdownOnUIThread(); | 590 provider.ShutdownOnUIThread(); |
591 } | 591 } |
592 | 592 |
593 } // namespace content_settings | 593 } // namespace content_settings |
OLD | NEW |