| 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 <set> | 7 #include <set> |
| 8 | 8 |
| 9 #include "apps/saved_files_service.h" | 9 #include "apps/saved_files_service.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 436 select_file_dialog_->SelectFile(picker_type, | 436 select_file_dialog_->SelectFile(picker_type, |
| 437 base::string16(), | 437 base::string16(), |
| 438 suggested_name, | 438 suggested_name, |
| 439 &file_type_info, | 439 &file_type_info, |
| 440 0, | 440 0, |
| 441 base::FilePath::StringType(), | 441 base::FilePath::StringType(), |
| 442 owning_window, | 442 owning_window, |
| 443 NULL); | 443 NULL); |
| 444 } | 444 } |
| 445 | 445 |
| 446 virtual ~FilePicker() {} | 446 ~FilePicker() override {} |
| 447 | 447 |
| 448 private: | 448 private: |
| 449 // ui::SelectFileDialog::Listener implementation. | 449 // ui::SelectFileDialog::Listener implementation. |
| 450 virtual void FileSelected(const base::FilePath& path, | 450 void FileSelected(const base::FilePath& path, |
| 451 int index, | 451 int index, |
| 452 void* params) override { | 452 void* params) override { |
| 453 std::vector<base::FilePath> paths; | 453 std::vector<base::FilePath> paths; |
| 454 paths.push_back(path); | 454 paths.push_back(path); |
| 455 MultiFilesSelected(paths, params); | 455 MultiFilesSelected(paths, params); |
| 456 } | 456 } |
| 457 | 457 |
| 458 virtual void FileSelectedWithExtraInfo(const ui::SelectedFileInfo& file, | 458 void FileSelectedWithExtraInfo(const ui::SelectedFileInfo& file, |
| 459 int index, | 459 int index, |
| 460 void* params) override { | 460 void* params) override { |
| 461 // Normally, file.local_path is used because it is a native path to the | 461 // Normally, file.local_path is used because it is a native path to the |
| 462 // local read-only cached file in the case of remote file system like | 462 // local read-only cached file in the case of remote file system like |
| 463 // Chrome OS's Google Drive integration. Here, however, |file.file_path| is | 463 // Chrome OS's Google Drive integration. Here, however, |file.file_path| is |
| 464 // necessary because we need to create a FileEntry denoting the remote file, | 464 // necessary because we need to create a FileEntry denoting the remote file, |
| 465 // not its cache. On other platforms than Chrome OS, they are the same. | 465 // not its cache. On other platforms than Chrome OS, they are the same. |
| 466 // | 466 // |
| 467 // TODO(kinaba): remove this, once after the file picker implements proper | 467 // TODO(kinaba): remove this, once after the file picker implements proper |
| 468 // switch of the path treatment depending on the |support_drive| flag. | 468 // switch of the path treatment depending on the |support_drive| flag. |
| 469 FileSelected(file.file_path, index, params); | 469 FileSelected(file.file_path, index, params); |
| 470 } | 470 } |
| 471 | 471 |
| 472 virtual void MultiFilesSelected(const std::vector<base::FilePath>& files, | 472 void MultiFilesSelected(const std::vector<base::FilePath>& files, |
| 473 void* params) override { | 473 void* params) override { |
| 474 function_->FilesSelected(files); | 474 function_->FilesSelected(files); |
| 475 delete this; | 475 delete this; |
| 476 } | 476 } |
| 477 | 477 |
| 478 virtual void MultiFilesSelectedWithExtraInfo( | 478 void MultiFilesSelectedWithExtraInfo( |
| 479 const std::vector<ui::SelectedFileInfo>& files, | 479 const std::vector<ui::SelectedFileInfo>& files, |
| 480 void* params) override { | 480 void* params) override { |
| 481 std::vector<base::FilePath> paths; | 481 std::vector<base::FilePath> paths; |
| 482 for (std::vector<ui::SelectedFileInfo>::const_iterator it = files.begin(); | 482 for (std::vector<ui::SelectedFileInfo>::const_iterator it = files.begin(); |
| 483 it != files.end(); ++it) { | 483 it != files.end(); ++it) { |
| 484 paths.push_back(it->file_path); | 484 paths.push_back(it->file_path); |
| 485 } | 485 } |
| 486 MultiFilesSelected(paths, params); | 486 MultiFilesSelected(paths, params); |
| 487 } | 487 } |
| 488 | 488 |
| 489 virtual void FileSelectionCanceled(void* params) override { | 489 void FileSelectionCanceled(void* params) override { |
| 490 function_->FileSelectionCanceled(); | 490 function_->FileSelectionCanceled(); |
| 491 delete this; | 491 delete this; |
| 492 } | 492 } |
| 493 | 493 |
| 494 scoped_refptr<ui::SelectFileDialog> select_file_dialog_; | 494 scoped_refptr<ui::SelectFileDialog> select_file_dialog_; |
| 495 scoped_refptr<FileSystemChooseEntryFunction> function_; | 495 scoped_refptr<FileSystemChooseEntryFunction> function_; |
| 496 | 496 |
| 497 DISALLOW_COPY_AND_ASSIGN(FilePicker); | 497 DISALLOW_COPY_AND_ASSIGN(FilePicker); |
| 498 }; | 498 }; |
| 499 | 499 |
| (...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 988 return false; | 988 return false; |
| 989 } | 989 } |
| 990 | 990 |
| 991 bool FileSystemGetObservedEntriesFunction::RunSync() { | 991 bool FileSystemGetObservedEntriesFunction::RunSync() { |
| 992 NOTIMPLEMENTED(); | 992 NOTIMPLEMENTED(); |
| 993 error_ = kUnknownIdError; | 993 error_ = kUnknownIdError; |
| 994 return false; | 994 return false; |
| 995 } | 995 } |
| 996 | 996 |
| 997 } // namespace extensions | 997 } // namespace extensions |
| OLD | NEW |