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 "extensions/common/manifest_handlers/externally_connectable.h" | 5 #include "extensions/common/manifest_handlers/externally_connectable.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 } // namespace | 53 } // namespace |
54 | 54 |
55 ExternallyConnectableHandler::ExternallyConnectableHandler() { | 55 ExternallyConnectableHandler::ExternallyConnectableHandler() { |
56 } | 56 } |
57 | 57 |
58 ExternallyConnectableHandler::~ExternallyConnectableHandler() { | 58 ExternallyConnectableHandler::~ExternallyConnectableHandler() { |
59 } | 59 } |
60 | 60 |
61 bool ExternallyConnectableHandler::Parse(Extension* extension, | 61 bool ExternallyConnectableHandler::Parse(Extension* extension, |
62 base::string16* error) { | 62 base::string16* error) { |
63 const base::Value* externally_connectable = NULL; | 63 const base::Value* externally_connectable = nullptr; |
64 CHECK(extension->manifest()->Get(keys::kExternallyConnectable, | 64 CHECK(extension->manifest()->Get(keys::kExternallyConnectable, |
65 &externally_connectable)); | 65 &externally_connectable)); |
66 std::vector<InstallWarning> install_warnings; | 66 std::vector<InstallWarning> install_warnings; |
67 scoped_ptr<ExternallyConnectableInfo> info = | 67 scoped_ptr<ExternallyConnectableInfo> info = |
68 ExternallyConnectableInfo::FromValue(*externally_connectable, | 68 ExternallyConnectableInfo::FromValue(*externally_connectable, |
69 &install_warnings, | 69 &install_warnings, |
70 error); | 70 error); |
71 if (!info) | 71 if (!info) |
72 return false; | 72 return false; |
73 if (!info->matches.is_empty()) { | 73 if (!info->matches.is_empty()) { |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 } | 210 } |
211 | 211 |
212 bool ExternallyConnectableInfo::IdCanConnect(const std::string& id) { | 212 bool ExternallyConnectableInfo::IdCanConnect(const std::string& id) { |
213 if (all_ids) | 213 if (all_ids) |
214 return true; | 214 return true; |
215 DCHECK(base::STLIsSorted(ids)); | 215 DCHECK(base::STLIsSorted(ids)); |
216 return std::binary_search(ids.begin(), ids.end(), id); | 216 return std::binary_search(ids.begin(), ids.end(), id); |
217 } | 217 } |
218 | 218 |
219 } // namespace extensions | 219 } // namespace extensions |
OLD | NEW |