OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/common/extensions/api/url_handlers/url_handlers_parser.h" | 5 #include "chrome/common/extensions/api/url_handlers/url_handlers_parser.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 if (!handler_info.GetList(mkeys::kMatches, &manif_patterns) || | 107 if (!handler_info.GetList(mkeys::kMatches, &manif_patterns) || |
108 manif_patterns->GetSize() == 0) { | 108 manif_patterns->GetSize() == 0) { |
109 *error = ErrorUtils::FormatErrorMessageUTF16( | 109 *error = ErrorUtils::FormatErrorMessageUTF16( |
110 merrors::kInvalidURLHandlerPattern, handler_id); | 110 merrors::kInvalidURLHandlerPattern, handler_id); |
111 return false; | 111 return false; |
112 } | 112 } |
113 | 113 |
114 for (base::ListValue::const_iterator it = manif_patterns->begin(); | 114 for (base::ListValue::const_iterator it = manif_patterns->begin(); |
115 it != manif_patterns->end(); ++it) { | 115 it != manif_patterns->end(); ++it) { |
116 std::string str_pattern; | 116 std::string str_pattern; |
117 (*it)->GetAsString(&str_pattern); | 117 it->GetAsString(&str_pattern); |
118 // TODO(sergeygs): Limit this to non-top-level domains. | 118 // TODO(sergeygs): Limit this to non-top-level domains. |
119 // TODO(sergeygs): Also add a verification to the CWS installer that the | 119 // TODO(sergeygs): Also add a verification to the CWS installer that the |
120 // URL patterns claimed here belong to the app's author verified sites. | 120 // URL patterns claimed here belong to the app's author verified sites. |
121 URLPattern pattern(URLPattern::SCHEME_HTTP | | 121 URLPattern pattern(URLPattern::SCHEME_HTTP | |
122 URLPattern::SCHEME_HTTPS); | 122 URLPattern::SCHEME_HTTPS); |
123 if (pattern.Parse(str_pattern) != URLPattern::PARSE_SUCCESS) { | 123 if (pattern.Parse(str_pattern) != URLPattern::PARSE_SUCCESS) { |
124 *error = ErrorUtils::FormatErrorMessageUTF16( | 124 *error = ErrorUtils::FormatErrorMessageUTF16( |
125 merrors::kInvalidURLHandlerPatternElement, handler_id); | 125 merrors::kInvalidURLHandlerPatternElement, handler_id); |
126 return false; | 126 return false; |
127 } | 127 } |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 extension->SetManifestData(mkeys::kUrlHandlers, std::move(info)); | 162 extension->SetManifestData(mkeys::kUrlHandlers, std::move(info)); |
163 | 163 |
164 return true; | 164 return true; |
165 } | 165 } |
166 | 166 |
167 const std::vector<std::string> UrlHandlersParser::Keys() const { | 167 const std::vector<std::string> UrlHandlersParser::Keys() const { |
168 return SingleKey(mkeys::kUrlHandlers); | 168 return SingleKey(mkeys::kUrlHandlers); |
169 } | 169 } |
170 | 170 |
171 } // namespace extensions | 171 } // namespace extensions |
OLD | NEW |