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/chromeos/file_manager/file_browser_handlers.h" | 5 #include "chrome/browser/chromeos/file_manager/file_browser_handlers.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <algorithm> | 8 #include <algorithm> |
9 #include <set> | 9 #include <set> |
10 #include <utility> | 10 #include <utility> |
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
385 } | 385 } |
386 | 386 |
387 SetupHandlerHostFileAccessPermissions( | 387 SetupHandlerHostFileAccessPermissions( |
388 file_definition_list.get(), extension_.get(), handler_pid); | 388 file_definition_list.get(), extension_.get(), handler_pid); |
389 | 389 |
390 std::unique_ptr<base::ListValue> event_args(new base::ListValue()); | 390 std::unique_ptr<base::ListValue> event_args(new base::ListValue()); |
391 event_args->AppendString(action_id_); | 391 event_args->AppendString(action_id_); |
392 auto details = base::MakeUnique<base::DictionaryValue>(); | 392 auto details = base::MakeUnique<base::DictionaryValue>(); |
393 // Get file definitions. These will be replaced with Entry instances by | 393 // Get file definitions. These will be replaced with Entry instances by |
394 // dispatchEvent() method from event_binding.js. | 394 // dispatchEvent() method from event_binding.js. |
395 base::ListValue* file_entries = new base::ListValue(); | 395 auto file_entries = base::MakeUnique<base::ListValue>(); |
396 details->Set("entries", file_entries); | |
397 event_args->Append(std::move(details)); | |
398 | 396 |
399 for (EntryDefinitionList::const_iterator iter = | 397 for (EntryDefinitionList::const_iterator iter = |
400 entry_definition_list->begin(); | 398 entry_definition_list->begin(); |
401 iter != entry_definition_list->end(); | 399 iter != entry_definition_list->end(); |
402 ++iter) { | 400 ++iter) { |
403 auto file_def = base::MakeUnique<base::DictionaryValue>(); | 401 auto file_def = base::MakeUnique<base::DictionaryValue>(); |
404 file_def->SetString("fileSystemName", iter->file_system_name); | 402 file_def->SetString("fileSystemName", iter->file_system_name); |
405 file_def->SetString("fileSystemRoot", iter->file_system_root_url); | 403 file_def->SetString("fileSystemRoot", iter->file_system_root_url); |
406 file_def->SetString("fileFullPath", | 404 file_def->SetString("fileFullPath", |
407 "/" + iter->full_path.AsUTF8Unsafe()); | 405 "/" + iter->full_path.AsUTF8Unsafe()); |
408 file_def->SetBoolean("fileIsDirectory", iter->is_directory); | 406 file_def->SetBoolean("fileIsDirectory", iter->is_directory); |
409 file_entries->Append(std::move(file_def)); | 407 file_entries->Append(std::move(file_def)); |
410 } | 408 } |
411 | 409 |
| 410 details->Set("entries", std::move(file_entries)); |
| 411 event_args->Append(std::move(details)); |
412 std::unique_ptr<extensions::Event> event(new extensions::Event( | 412 std::unique_ptr<extensions::Event> event(new extensions::Event( |
413 extensions::events::FILE_BROWSER_HANDLER_ON_EXECUTE, | 413 extensions::events::FILE_BROWSER_HANDLER_ON_EXECUTE, |
414 "fileBrowserHandler.onExecute", std::move(event_args))); | 414 "fileBrowserHandler.onExecute", std::move(event_args))); |
415 event->restrict_to_browser_context = profile_; | 415 event->restrict_to_browser_context = profile_; |
416 router->DispatchEventToExtension(extension_->id(), std::move(event)); | 416 router->DispatchEventToExtension(extension_->id(), std::move(event)); |
417 | 417 |
418 ExecuteDoneOnUIThread(true); | 418 ExecuteDoneOnUIThread(true); |
419 } | 419 } |
420 | 420 |
421 void FileBrowserHandlerExecutor::SetupHandlerHostFileAccessPermissions( | 421 void FileBrowserHandlerExecutor::SetupHandlerHostFileAccessPermissions( |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
529 if (common_handlers.empty()) | 529 if (common_handlers.empty()) |
530 return FileBrowserHandlerList(); | 530 return FileBrowserHandlerList(); |
531 } | 531 } |
532 } | 532 } |
533 | 533 |
534 return common_handlers; | 534 return common_handlers; |
535 } | 535 } |
536 | 536 |
537 } // namespace file_browser_handlers | 537 } // namespace file_browser_handlers |
538 } // namespace file_manager | 538 } // namespace file_manager |
OLD | NEW |