| 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/file_browser_handlers/file_browser_handle
r.h" | 5 #include "chrome/common/extensions/api/file_browser_handlers/file_browser_handle
r.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 | 10 |
| (...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 return result; | 247 return result; |
| 248 } | 248 } |
| 249 | 249 |
| 250 // Loads FileBrowserHandlers from |extension_actions| into a list in |result|. | 250 // Loads FileBrowserHandlers from |extension_actions| into a list in |result|. |
| 251 bool LoadFileBrowserHandlers( | 251 bool LoadFileBrowserHandlers( |
| 252 const std::string& extension_id, | 252 const std::string& extension_id, |
| 253 const base::ListValue* extension_actions, | 253 const base::ListValue* extension_actions, |
| 254 FileBrowserHandler::List* result, | 254 FileBrowserHandler::List* result, |
| 255 base::string16* error) { | 255 base::string16* error) { |
| 256 for (const auto& entry : *extension_actions) { | 256 for (const auto& entry : *extension_actions) { |
| 257 base::DictionaryValue* dict; | 257 const base::DictionaryValue* dict; |
| 258 if (!entry->GetAsDictionary(&dict)) { | 258 if (!entry.GetAsDictionary(&dict)) { |
| 259 *error = base::ASCIIToUTF16(errors::kInvalidFileBrowserHandler); | 259 *error = base::ASCIIToUTF16(errors::kInvalidFileBrowserHandler); |
| 260 return false; | 260 return false; |
| 261 } | 261 } |
| 262 std::unique_ptr<FileBrowserHandler> action = | 262 std::unique_ptr<FileBrowserHandler> action = |
| 263 LoadFileBrowserHandler(extension_id, dict, error); | 263 LoadFileBrowserHandler(extension_id, dict, error); |
| 264 if (!action) | 264 if (!action) |
| 265 return false; // Failed to parse file browser action definition. | 265 return false; // Failed to parse file browser action definition. |
| 266 result->push_back(std::move(action)); | 266 result->push_back(std::move(action)); |
| 267 } | 267 } |
| 268 return true; | 268 return true; |
| (...skipping 30 matching lines...) Expand all Loading... |
| 299 return false; // Failed to parse file browser actions definition. | 299 return false; // Failed to parse file browser actions definition. |
| 300 } | 300 } |
| 301 | 301 |
| 302 extension->SetManifestData(keys::kFileBrowserHandlers, std::move(info)); | 302 extension->SetManifestData(keys::kFileBrowserHandlers, std::move(info)); |
| 303 return true; | 303 return true; |
| 304 } | 304 } |
| 305 | 305 |
| 306 const std::vector<std::string> FileBrowserHandlerParser::Keys() const { | 306 const std::vector<std::string> FileBrowserHandlerParser::Keys() const { |
| 307 return SingleKey(keys::kFileBrowserHandlers); | 307 return SingleKey(keys::kFileBrowserHandlers); |
| 308 } | 308 } |
| OLD | NEW |