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/extensions/api/file_system/file_system_api.h" | 5 #include "chrome/browser/extensions/api/file_system/file_system_api.h" |
6 | 6 |
7 #include "apps/app_window.h" | 7 #include "apps/app_window.h" |
8 #include "apps/app_window_registry.h" | 8 #include "apps/app_window_registry.h" |
| 9 #include "apps/browser/file_handler_util.h" |
9 #include "apps/saved_files_service.h" | 10 #include "apps/saved_files_service.h" |
10 #include "base/bind.h" | 11 #include "base/bind.h" |
11 #include "base/file_util.h" | 12 #include "base/file_util.h" |
12 #include "base/files/file_path.h" | 13 #include "base/files/file_path.h" |
13 #include "base/logging.h" | 14 #include "base/logging.h" |
14 #include "base/path_service.h" | 15 #include "base/path_service.h" |
15 #include "base/strings/string_util.h" | 16 #include "base/strings/string_util.h" |
16 #include "base/strings/stringprintf.h" | 17 #include "base/strings/stringprintf.h" |
17 #include "base/strings/sys_string_conversions.h" | 18 #include "base/strings/sys_string_conversions.h" |
18 #include "base/strings/utf_string_conversions.h" | 19 #include "base/strings/utf_string_conversions.h" |
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
315 base::ListValue* list = new base::ListValue(); | 316 base::ListValue* list = new base::ListValue(); |
316 response_->Set("entries", list); | 317 response_->Set("entries", list); |
317 response_->SetBoolean("multiple", multiple_); | 318 response_->SetBoolean("multiple", multiple_); |
318 SetResult(response_); | 319 SetResult(response_); |
319 } | 320 } |
320 | 321 |
321 void FileSystemEntryFunction::AddEntryToResponse( | 322 void FileSystemEntryFunction::AddEntryToResponse( |
322 const base::FilePath& path, | 323 const base::FilePath& path, |
323 const std::string& id_override) { | 324 const std::string& id_override) { |
324 DCHECK(response_); | 325 DCHECK(response_); |
325 extensions::app_file_handler_util::GrantedFileEntry file_entry = | 326 apps::file_handler_util::GrantedFileEntry file_entry = |
326 extensions::app_file_handler_util::CreateFileEntry( | 327 extensions::app_file_handler_util::CreateFileEntry( |
327 GetProfile(), | 328 GetProfile(), |
328 GetExtension(), | 329 GetExtension(), |
329 render_view_host_->GetProcess()->GetID(), | 330 render_view_host_->GetProcess()->GetID(), |
330 path, | 331 path, |
331 is_directory_); | 332 is_directory_); |
332 base::ListValue* entries; | 333 base::ListValue* entries; |
333 bool success = response_->GetList("entries", &entries); | 334 bool success = response_->GetList("entries", &entries); |
334 DCHECK(success); | 335 DCHECK(success); |
335 | 336 |
(...skipping 641 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
977 if (needs_new_entry) { | 978 if (needs_new_entry) { |
978 is_directory_ = file_entry->is_directory; | 979 is_directory_ = file_entry->is_directory; |
979 CreateResponse(); | 980 CreateResponse(); |
980 AddEntryToResponse(file_entry->path, file_entry->id); | 981 AddEntryToResponse(file_entry->path, file_entry->id); |
981 } | 982 } |
982 SendResponse(true); | 983 SendResponse(true); |
983 return true; | 984 return true; |
984 } | 985 } |
985 | 986 |
986 } // namespace extensions | 987 } // namespace extensions |
OLD | NEW |