Chromium Code Reviews| 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> |
| 11 | 11 |
| 12 #include "base/bind.h" | 12 #include "base/bind.h" |
| 13 #include "base/command_line.h" | 13 #include "base/command_line.h" |
| 14 #include "base/files/file_util.h" | 14 #include "base/files/file_util.h" |
| 15 #include "base/i18n/case_conversion.h" | 15 #include "base/i18n/case_conversion.h" |
| 16 #include "base/macros.h" | 16 #include "base/macros.h" |
| 17 #include "base/memory/ptr_util.h" | |
| 17 #include "base/strings/utf_string_conversions.h" | 18 #include "base/strings/utf_string_conversions.h" |
| 18 #include "chrome/browser/chromeos/drive/file_system_util.h" | 19 #include "chrome/browser/chromeos/drive/file_system_util.h" |
| 19 #include "chrome/browser/chromeos/file_manager/app_id.h" | 20 #include "chrome/browser/chromeos/file_manager/app_id.h" |
| 20 #include "chrome/browser/chromeos/file_manager/fileapi_util.h" | 21 #include "chrome/browser/chromeos/file_manager/fileapi_util.h" |
| 21 #include "chrome/browser/chromeos/file_manager/open_with_browser.h" | 22 #include "chrome/browser/chromeos/file_manager/open_with_browser.h" |
| 22 #include "chrome/browser/chromeos/fileapi/file_system_backend.h" | 23 #include "chrome/browser/chromeos/fileapi/file_system_backend.h" |
| 23 #include "chrome/browser/extensions/extension_service.h" | 24 #include "chrome/browser/extensions/extension_service.h" |
| 24 #include "chrome/browser/extensions/extension_util.h" | 25 #include "chrome/browser/extensions/extension_util.h" |
| 25 #include "chrome/browser/profiles/profile.h" | 26 #include "chrome/browser/profiles/profile.h" |
| 26 #include "chrome/browser/ui/browser_finder.h" | 27 #include "chrome/browser/ui/browser_finder.h" |
| (...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 381 if (!router) { | 382 if (!router) { |
| 382 ExecuteDoneOnUIThread(false); | 383 ExecuteDoneOnUIThread(false); |
| 383 return; | 384 return; |
| 384 } | 385 } |
| 385 | 386 |
| 386 SetupHandlerHostFileAccessPermissions( | 387 SetupHandlerHostFileAccessPermissions( |
| 387 file_definition_list.get(), extension_.get(), handler_pid); | 388 file_definition_list.get(), extension_.get(), handler_pid); |
| 388 | 389 |
| 389 std::unique_ptr<base::ListValue> event_args(new base::ListValue()); | 390 std::unique_ptr<base::ListValue> event_args(new base::ListValue()); |
| 390 event_args->AppendString(action_id_); | 391 event_args->AppendString(action_id_); |
| 391 base::DictionaryValue* details = new base::DictionaryValue(); | 392 auto details = base::MakeUnique<base::DictionaryValue>(); |
| 392 event_args->Append(details); | |
| 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 base::ListValue* file_entries = new base::ListValue(); |
| 396 details->Set("entries", file_entries); | 396 details->Set("entries", file_entries); |
| 397 event_args->Append(std::move(details)); | |
| 397 | 398 |
| 398 for (EntryDefinitionList::const_iterator iter = | 399 for (EntryDefinitionList::const_iterator iter = |
| 399 entry_definition_list->begin(); | 400 entry_definition_list->begin(); |
| 400 iter != entry_definition_list->end(); | 401 iter != entry_definition_list->end(); |
| 401 ++iter) { | 402 ++iter) { |
| 402 base::DictionaryValue* file_def = new base::DictionaryValue(); | 403 auto file_def = base::MakeUnique<base::DictionaryValue>(); |
| 403 file_entries->Append(file_def); | 404 file_entries->Append(std::move(file_def)); |
|
Daniel Erat
2016/10/13 17:57:16
uh... file_def looks like it's still getting used
dcheng
2016/10/13 19:42:46
Doh, I missed this one. Done.
| |
| 404 file_def->SetString("fileSystemName", iter->file_system_name); | 405 file_def->SetString("fileSystemName", iter->file_system_name); |
| 405 file_def->SetString("fileSystemRoot", iter->file_system_root_url); | 406 file_def->SetString("fileSystemRoot", iter->file_system_root_url); |
| 406 file_def->SetString("fileFullPath", | 407 file_def->SetString("fileFullPath", |
| 407 "/" + iter->full_path.AsUTF8Unsafe()); | 408 "/" + iter->full_path.AsUTF8Unsafe()); |
| 408 file_def->SetBoolean("fileIsDirectory", iter->is_directory); | 409 file_def->SetBoolean("fileIsDirectory", iter->is_directory); |
| 409 } | 410 } |
| 410 | 411 |
| 411 std::unique_ptr<extensions::Event> event(new extensions::Event( | 412 std::unique_ptr<extensions::Event> event(new extensions::Event( |
| 412 extensions::events::FILE_BROWSER_HANDLER_ON_EXECUTE, | 413 extensions::events::FILE_BROWSER_HANDLER_ON_EXECUTE, |
| 413 "fileBrowserHandler.onExecute", std::move(event_args))); | 414 "fileBrowserHandler.onExecute", std::move(event_args))); |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 528 if (common_handlers.empty()) | 529 if (common_handlers.empty()) |
| 529 return FileBrowserHandlerList(); | 530 return FileBrowserHandlerList(); |
| 530 } | 531 } |
| 531 } | 532 } |
| 532 | 533 |
| 533 return common_handlers; | 534 return common_handlers; |
| 534 } | 535 } |
| 535 | 536 |
| 536 } // namespace file_browser_handlers | 537 } // namespace file_browser_handlers |
| 537 } // namespace file_manager | 538 } // namespace file_manager |
| OLD | NEW |