| 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 413 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 424                                     owning_window, | 424                                     owning_window, | 
| 425                                     NULL); | 425                                     NULL); | 
| 426   } | 426   } | 
| 427 | 427 | 
| 428   virtual ~FilePicker() {} | 428   virtual ~FilePicker() {} | 
| 429 | 429 | 
| 430  private: | 430  private: | 
| 431   // ui::SelectFileDialog::Listener implementation. | 431   // ui::SelectFileDialog::Listener implementation. | 
| 432   virtual void FileSelected(const base::FilePath& path, | 432   virtual void FileSelected(const base::FilePath& path, | 
| 433                             int index, | 433                             int index, | 
| 434                             void* params) OVERRIDE { | 434                             void* params) override { | 
| 435     std::vector<base::FilePath> paths; | 435     std::vector<base::FilePath> paths; | 
| 436     paths.push_back(path); | 436     paths.push_back(path); | 
| 437     MultiFilesSelected(paths, params); | 437     MultiFilesSelected(paths, params); | 
| 438   } | 438   } | 
| 439 | 439 | 
| 440   virtual void FileSelectedWithExtraInfo(const ui::SelectedFileInfo& file, | 440   virtual void FileSelectedWithExtraInfo(const ui::SelectedFileInfo& file, | 
| 441                                          int index, | 441                                          int index, | 
| 442                                          void* params) OVERRIDE { | 442                                          void* params) override { | 
| 443     // Normally, file.local_path is used because it is a native path to the | 443     // Normally, file.local_path is used because it is a native path to the | 
| 444     // local read-only cached file in the case of remote file system like | 444     // local read-only cached file in the case of remote file system like | 
| 445     // Chrome OS's Google Drive integration. Here, however, |file.file_path| is | 445     // Chrome OS's Google Drive integration. Here, however, |file.file_path| is | 
| 446     // necessary because we need to create a FileEntry denoting the remote file, | 446     // necessary because we need to create a FileEntry denoting the remote file, | 
| 447     // not its cache. On other platforms than Chrome OS, they are the same. | 447     // not its cache. On other platforms than Chrome OS, they are the same. | 
| 448     // | 448     // | 
| 449     // TODO(kinaba): remove this, once after the file picker implements proper | 449     // TODO(kinaba): remove this, once after the file picker implements proper | 
| 450     // switch of the path treatment depending on the |support_drive| flag. | 450     // switch of the path treatment depending on the |support_drive| flag. | 
| 451     FileSelected(file.file_path, index, params); | 451     FileSelected(file.file_path, index, params); | 
| 452   } | 452   } | 
| 453 | 453 | 
| 454   virtual void MultiFilesSelected(const std::vector<base::FilePath>& files, | 454   virtual void MultiFilesSelected(const std::vector<base::FilePath>& files, | 
| 455                                   void* params) OVERRIDE { | 455                                   void* params) override { | 
| 456     function_->FilesSelected(files); | 456     function_->FilesSelected(files); | 
| 457     delete this; | 457     delete this; | 
| 458   } | 458   } | 
| 459 | 459 | 
| 460   virtual void MultiFilesSelectedWithExtraInfo( | 460   virtual void MultiFilesSelectedWithExtraInfo( | 
| 461       const std::vector<ui::SelectedFileInfo>& files, | 461       const std::vector<ui::SelectedFileInfo>& files, | 
| 462       void* params) OVERRIDE { | 462       void* params) override { | 
| 463     std::vector<base::FilePath> paths; | 463     std::vector<base::FilePath> paths; | 
| 464     for (std::vector<ui::SelectedFileInfo>::const_iterator it = files.begin(); | 464     for (std::vector<ui::SelectedFileInfo>::const_iterator it = files.begin(); | 
| 465          it != files.end(); ++it) { | 465          it != files.end(); ++it) { | 
| 466       paths.push_back(it->file_path); | 466       paths.push_back(it->file_path); | 
| 467     } | 467     } | 
| 468     MultiFilesSelected(paths, params); | 468     MultiFilesSelected(paths, params); | 
| 469   } | 469   } | 
| 470 | 470 | 
| 471   virtual void FileSelectionCanceled(void* params) OVERRIDE { | 471   virtual void FileSelectionCanceled(void* params) override { | 
| 472     function_->FileSelectionCanceled(); | 472     function_->FileSelectionCanceled(); | 
| 473     delete this; | 473     delete this; | 
| 474   } | 474   } | 
| 475 | 475 | 
| 476   scoped_refptr<ui::SelectFileDialog> select_file_dialog_; | 476   scoped_refptr<ui::SelectFileDialog> select_file_dialog_; | 
| 477   scoped_refptr<FileSystemChooseEntryFunction> function_; | 477   scoped_refptr<FileSystemChooseEntryFunction> function_; | 
| 478 | 478 | 
| 479   DISALLOW_COPY_AND_ASSIGN(FilePicker); | 479   DISALLOW_COPY_AND_ASSIGN(FilePicker); | 
| 480 }; | 480 }; | 
| 481 | 481 | 
| (...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 944   return false; | 944   return false; | 
| 945 } | 945 } | 
| 946 | 946 | 
| 947 bool FileSystemGetObservedEntriesFunction::RunSync() { | 947 bool FileSystemGetObservedEntriesFunction::RunSync() { | 
| 948   NOTIMPLEMENTED(); | 948   NOTIMPLEMENTED(); | 
| 949   error_ = kUnknownIdError; | 949   error_ = kUnknownIdError; | 
| 950   return false; | 950   return false; | 
| 951 } | 951 } | 
| 952 | 952 | 
| 953 }  // namespace extensions | 953 }  // namespace extensions | 
| OLD | NEW | 
|---|