OLD | NEW |
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_policy_handler.h" | 5 #include "components/policy/core/browser/url_blacklist_policy_handler.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/values.h" | 10 #include "base/values.h" |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 if (disabled_schemes_policy) | 53 if (disabled_schemes_policy) |
54 disabled_schemes_policy->GetAsList(&disabled_schemes); | 54 disabled_schemes_policy->GetAsList(&disabled_schemes); |
55 | 55 |
56 std::unique_ptr<base::ListValue> merged_url_blacklist(new base::ListValue()); | 56 std::unique_ptr<base::ListValue> merged_url_blacklist(new base::ListValue()); |
57 | 57 |
58 // We start with the DisabledSchemes because we have size limit when | 58 // We start with the DisabledSchemes because we have size limit when |
59 // handling URLBlacklists. | 59 // handling URLBlacklists. |
60 if (disabled_schemes) { | 60 if (disabled_schemes) { |
61 for (const auto& entry : *disabled_schemes) { | 61 for (const auto& entry : *disabled_schemes) { |
62 std::string entry_value; | 62 std::string entry_value; |
63 if (entry.GetAsString(&entry_value)) { | 63 if (entry->GetAsString(&entry_value)) { |
64 entry_value.append("://*"); | 64 entry_value.append("://*"); |
65 merged_url_blacklist->AppendString(entry_value); | 65 merged_url_blacklist->AppendString(entry_value); |
66 } | 66 } |
67 } | 67 } |
68 } | 68 } |
69 | 69 |
70 if (url_blacklist) { | 70 if (url_blacklist) { |
71 for (const auto& entry : *url_blacklist) { | 71 for (const auto& entry : *url_blacklist) { |
72 if (entry.IsType(base::Value::Type::STRING)) | 72 if (entry->IsType(base::Value::Type::STRING)) |
73 merged_url_blacklist->Append(entry.CreateDeepCopy()); | 73 merged_url_blacklist->Append(entry->CreateDeepCopy()); |
74 } | 74 } |
75 } | 75 } |
76 | 76 |
77 if (disabled_schemes || url_blacklist) { | 77 if (disabled_schemes || url_blacklist) { |
78 prefs->SetValue(policy_prefs::kUrlBlacklist, | 78 prefs->SetValue(policy_prefs::kUrlBlacklist, |
79 std::move(merged_url_blacklist)); | 79 std::move(merged_url_blacklist)); |
80 } | 80 } |
81 } | 81 } |
82 | 82 |
83 } // namespace policy | 83 } // namespace policy |
OLD | NEW |