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> |
| 8 |
7 #include "base/command_line.h" | 9 #include "base/command_line.h" |
8 #include "base/memory/scoped_ptr.h" | |
9 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
10 #include "base/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
11 #include "base/values.h" | 12 #include "base/values.h" |
12 #include "extensions/common/error_utils.h" | 13 #include "extensions/common/error_utils.h" |
13 #include "extensions/common/manifest_constants.h" | 14 #include "extensions/common/manifest_constants.h" |
14 #include "extensions/common/manifest_handlers/offline_enabled_info.h" | 15 #include "extensions/common/manifest_handlers/offline_enabled_info.h" |
15 #include "extensions/common/switches.h" | 16 #include "extensions/common/switches.h" |
16 #include "net/base/network_change_notifier.h" | 17 #include "net/base/network_change_notifier.h" |
17 #include "url/gurl.h" | 18 #include "url/gurl.h" |
18 | 19 |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 } | 127 } |
127 handler.patterns.AddPattern(pattern); | 128 handler.patterns.AddPattern(pattern); |
128 } | 129 } |
129 | 130 |
130 url_handlers->push_back(handler); | 131 url_handlers->push_back(handler); |
131 | 132 |
132 return true; | 133 return true; |
133 } | 134 } |
134 | 135 |
135 bool UrlHandlersParser::Parse(Extension* extension, base::string16* error) { | 136 bool UrlHandlersParser::Parse(Extension* extension, base::string16* error) { |
136 scoped_ptr<UrlHandlers> info(new UrlHandlers); | 137 std::unique_ptr<UrlHandlers> info(new UrlHandlers); |
137 const base::DictionaryValue* all_handlers = NULL; | 138 const base::DictionaryValue* all_handlers = NULL; |
138 if (!extension->manifest()->GetDictionary( | 139 if (!extension->manifest()->GetDictionary( |
139 mkeys::kUrlHandlers, &all_handlers)) { | 140 mkeys::kUrlHandlers, &all_handlers)) { |
140 *error = base::ASCIIToUTF16(merrors::kInvalidURLHandlers); | 141 *error = base::ASCIIToUTF16(merrors::kInvalidURLHandlers); |
141 return false; | 142 return false; |
142 } | 143 } |
143 | 144 |
144 DCHECK(extension->is_platform_app()); | 145 DCHECK(extension->is_platform_app()); |
145 | 146 |
146 for (base::DictionaryValue::Iterator iter(*all_handlers); !iter.IsAtEnd(); | 147 for (base::DictionaryValue::Iterator iter(*all_handlers); !iter.IsAtEnd(); |
(...skipping 14 matching lines...) Expand all Loading... |
161 extension->SetManifestData(mkeys::kUrlHandlers, info.release()); | 162 extension->SetManifestData(mkeys::kUrlHandlers, info.release()); |
162 | 163 |
163 return true; | 164 return true; |
164 } | 165 } |
165 | 166 |
166 const std::vector<std::string> UrlHandlersParser::Keys() const { | 167 const std::vector<std::string> UrlHandlersParser::Keys() const { |
167 return SingleKey(mkeys::kUrlHandlers); | 168 return SingleKey(mkeys::kUrlHandlers); |
168 } | 169 } |
169 | 170 |
170 } // namespace extensions | 171 } // namespace extensions |
OLD | NEW |