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 "chrome/browser/extensions/api/messaging/message_service.h" | 5 #include "chrome/browser/extensions/api/messaging/message_service.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 #include <limits> | 8 #include <limits> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 | 78 |
79 // All native messaging hosts are allowed if there is no blacklist. | 79 // All native messaging hosts are allowed if there is no blacklist. |
80 if (!pref_service->IsManagedPreference(pref_names::kNativeMessagingBlacklist)) | 80 if (!pref_service->IsManagedPreference(pref_names::kNativeMessagingBlacklist)) |
81 return allow_result; | 81 return allow_result; |
82 const base::ListValue* blacklist = | 82 const base::ListValue* blacklist = |
83 pref_service->GetList(pref_names::kNativeMessagingBlacklist); | 83 pref_service->GetList(pref_names::kNativeMessagingBlacklist); |
84 if (!blacklist) | 84 if (!blacklist) |
85 return allow_result; | 85 return allow_result; |
86 | 86 |
87 // Check if the name or the wildcard is in the blacklist. | 87 // Check if the name or the wildcard is in the blacklist. |
88 base::StringValue name_value(native_host_name); | 88 base::Value name_value(native_host_name); |
89 base::StringValue wildcard_value("*"); | 89 base::Value wildcard_value("*"); |
90 if (blacklist->Find(name_value) == blacklist->end() && | 90 if (blacklist->Find(name_value) == blacklist->end() && |
91 blacklist->Find(wildcard_value) == blacklist->end()) { | 91 blacklist->Find(wildcard_value) == blacklist->end()) { |
92 return allow_result; | 92 return allow_result; |
93 } | 93 } |
94 | 94 |
95 // The native messaging host is blacklisted. Check the whitelist. | 95 // The native messaging host is blacklisted. Check the whitelist. |
96 if (pref_service->IsManagedPreference( | 96 if (pref_service->IsManagedPreference( |
97 pref_names::kNativeMessagingWhitelist)) { | 97 pref_names::kNativeMessagingWhitelist)) { |
98 const base::ListValue* whitelist = | 98 const base::ListValue* whitelist = |
99 pref_service->GetList(pref_names::kNativeMessagingWhitelist); | 99 pref_service->GetList(pref_names::kNativeMessagingWhitelist); |
(...skipping 887 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
987 MessageChannelMap::iterator channel_iter = channels_.find(channel_id); | 987 MessageChannelMap::iterator channel_iter = channels_.find(channel_id); |
988 if (channel_iter != channels_.end()) { | 988 if (channel_iter != channels_.end()) { |
989 for (const PendingMessage& message : queue) { | 989 for (const PendingMessage& message : queue) { |
990 DispatchMessage(message.first, channel_iter->second.get(), | 990 DispatchMessage(message.first, channel_iter->second.get(), |
991 message.second); | 991 message.second); |
992 } | 992 } |
993 } | 993 } |
994 } | 994 } |
995 | 995 |
996 } // namespace extensions | 996 } // namespace extensions |
OLD | NEW |