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/saved_files_service.h" | 7 #include "apps/saved_files_service.h" |
8 #include "apps/shell_window.h" | 8 #include "apps/shell_window.h" |
9 #include "apps/shell_window_registry.h" | 9 #include "apps/shell_window_registry.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
332 is_directory_, | 332 is_directory_, |
333 base::Bind(&FileSystemEntryFunction::RegisterFileSystemsAndSendResponse, | 333 base::Bind(&FileSystemEntryFunction::RegisterFileSystemsAndSendResponse, |
334 this, | 334 this, |
335 paths), | 335 paths), |
336 base::Bind(&FileSystemEntryFunction::HandleWritableFileError, this)); | 336 base::Bind(&FileSystemEntryFunction::HandleWritableFileError, this)); |
337 } | 337 } |
338 | 338 |
339 void FileSystemEntryFunction::RegisterFileSystemsAndSendResponse( | 339 void FileSystemEntryFunction::RegisterFileSystemsAndSendResponse( |
340 const std::vector<base::FilePath>& paths) { | 340 const std::vector<base::FilePath>& paths) { |
341 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 341 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
| 342 if (!render_view_host_) |
| 343 return; |
342 | 344 |
343 CreateResponse(); | 345 CreateResponse(); |
344 for (std::vector<base::FilePath>::const_iterator it = paths.begin(); | 346 for (std::vector<base::FilePath>::const_iterator it = paths.begin(); |
345 it != paths.end(); ++it) { | 347 it != paths.end(); ++it) { |
346 AddEntryToResponse(*it, ""); | 348 AddEntryToResponse(*it, ""); |
347 } | 349 } |
348 SendResponse(true); | 350 SendResponse(true); |
349 } | 351 } |
350 | 352 |
351 void FileSystemEntryFunction::CreateResponse() { | 353 void FileSystemEntryFunction::CreateResponse() { |
(...skipping 653 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1005 if (needs_new_entry) { | 1007 if (needs_new_entry) { |
1006 is_directory_ = file_entry->is_directory; | 1008 is_directory_ = file_entry->is_directory; |
1007 CreateResponse(); | 1009 CreateResponse(); |
1008 AddEntryToResponse(file_entry->path, file_entry->id); | 1010 AddEntryToResponse(file_entry->path, file_entry->id); |
1009 } | 1011 } |
1010 SendResponse(true); | 1012 SendResponse(true); |
1011 return true; | 1013 return true; |
1012 } | 1014 } |
1013 | 1015 |
1014 } // namespace extensions | 1016 } // namespace extensions |
OLD | NEW |