| OLD | NEW |
| 1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2015 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/content_settings/content_settings_supervised_provider.h
" | 5 #include "chrome/browser/content_settings/content_settings_supervised_provider.h
" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <utility> |
| 8 #include <vector> | 9 #include <vector> |
| 9 | 10 |
| 10 #include "chrome/browser/supervised_user/supervised_user_constants.h" | 11 #include "chrome/browser/supervised_user/supervised_user_constants.h" |
| 11 #include "chrome/browser/supervised_user/supervised_user_settings_service.h" | 12 #include "chrome/browser/supervised_user/supervised_user_settings_service.h" |
| 12 | 13 |
| 13 namespace { | 14 namespace { |
| 14 | 15 |
| 15 struct ContentSettingsFromSupervisedSettingsEntry { | 16 struct ContentSettingsFromSupervisedSettingsEntry { |
| 16 const char* setting_name; | 17 const char* setting_name; |
| 17 ContentSettingsType content_type; | 18 ContentSettingsType content_type; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 | 51 |
| 51 SupervisedProvider::~SupervisedProvider() { | 52 SupervisedProvider::~SupervisedProvider() { |
| 52 } | 53 } |
| 53 | 54 |
| 54 scoped_ptr<RuleIterator> SupervisedProvider::GetRuleIterator( | 55 scoped_ptr<RuleIterator> SupervisedProvider::GetRuleIterator( |
| 55 ContentSettingsType content_type, | 56 ContentSettingsType content_type, |
| 56 const ResourceIdentifier& resource_identifier, | 57 const ResourceIdentifier& resource_identifier, |
| 57 bool incognito) const { | 58 bool incognito) const { |
| 58 scoped_ptr<base::AutoLock> auto_lock(new base::AutoLock(lock_)); | 59 scoped_ptr<base::AutoLock> auto_lock(new base::AutoLock(lock_)); |
| 59 return value_map_.GetRuleIterator(content_type, resource_identifier, | 60 return value_map_.GetRuleIterator(content_type, resource_identifier, |
| 60 auto_lock.Pass()); | 61 std::move(auto_lock)); |
| 61 } | 62 } |
| 62 | 63 |
| 63 void SupervisedProvider::OnSupervisedSettingsAvailable( | 64 void SupervisedProvider::OnSupervisedSettingsAvailable( |
| 64 const base::DictionaryValue* settings) { | 65 const base::DictionaryValue* settings) { |
| 65 std::vector<ContentSettingsType> to_notify; | 66 std::vector<ContentSettingsType> to_notify; |
| 66 // Entering locked scope to update content settings. | 67 // Entering locked scope to update content settings. |
| 67 { | 68 { |
| 68 base::AutoLock auto_lock(lock_); | 69 base::AutoLock auto_lock(lock_); |
| 69 for (const auto& entry : kContentSettingsFromSupervisedSettingsMap) { | 70 for (const auto& entry : kContentSettingsFromSupervisedSettingsMap) { |
| 70 bool new_value = false; | 71 bool new_value = false; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 100 ContentSettingsType content_type) { | 101 ContentSettingsType content_type) { |
| 101 } | 102 } |
| 102 | 103 |
| 103 void SupervisedProvider::ShutdownOnUIThread() { | 104 void SupervisedProvider::ShutdownOnUIThread() { |
| 104 DCHECK(CalledOnValidThread()); | 105 DCHECK(CalledOnValidThread()); |
| 105 RemoveAllObservers(); | 106 RemoveAllObservers(); |
| 106 user_settings_subscription_.reset(); | 107 user_settings_subscription_.reset(); |
| 107 } | 108 } |
| 108 | 109 |
| 109 } // namespace content_settings | 110 } // namespace content_settings |
| OLD | NEW |