| 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/ui/views/select_file_dialog_extension.h" | 5 #include "chrome/browser/ui/views/select_file_dialog_extension.h" |
| 6 | 6 |
| 7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 canceled_(false), | 38 canceled_(false), |
| 39 params_(NULL) { | 39 params_(NULL) { |
| 40 } | 40 } |
| 41 | 41 |
| 42 bool file_selected() const { return file_selected_; } | 42 bool file_selected() const { return file_selected_; } |
| 43 bool canceled() const { return canceled_; } | 43 bool canceled() const { return canceled_; } |
| 44 FilePath path() const { return path_; } | 44 FilePath path() const { return path_; } |
| 45 void* params() const { return params_; } | 45 void* params() const { return params_; } |
| 46 | 46 |
| 47 // SelectFileDialog::Listener implementation. | 47 // SelectFileDialog::Listener implementation. |
| 48 virtual void FileSelected(const FilePath& path, int index, void* params) { | 48 virtual void FileSelected(const FilePath& path, |
| 49 int index, |
| 50 void* params) OVERRIDE { |
| 49 file_selected_ = true; | 51 file_selected_ = true; |
| 50 path_ = path; | 52 path_ = path; |
| 51 params_ = params; | 53 params_ = params; |
| 52 } | 54 } |
| 53 virtual void FileSelectedWithExtraInfo( | 55 virtual void FileSelectedWithExtraInfo( |
| 54 const ui::SelectedFileInfo& selected_file_info, | 56 const ui::SelectedFileInfo& selected_file_info, |
| 55 int index, | 57 int index, |
| 56 void* params) { | 58 void* params) OVERRIDE { |
| 57 FileSelected(selected_file_info.path, index, params); | 59 FileSelected(selected_file_info.local_path, index, params); |
| 58 } | 60 } |
| 59 virtual void MultiFilesSelected( | 61 virtual void MultiFilesSelected( |
| 60 const std::vector<FilePath>& files, void* params) {} | 62 const std::vector<FilePath>& files, void* params) OVERRIDE {} |
| 61 virtual void FileSelectionCanceled(void* params) { | 63 virtual void FileSelectionCanceled(void* params) { |
| 62 canceled_ = true; | 64 canceled_ = true; |
| 63 params_ = params; | 65 params_ = params; |
| 64 } | 66 } |
| 65 | 67 |
| 66 private: | 68 private: |
| 67 bool file_selected_; | 69 bool file_selected_; |
| 68 bool canceled_; | 70 bool canceled_; |
| 69 FilePath path_; | 71 FilePath path_; |
| 70 void* params_; | 72 void* params_; |
| (...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 336 ASSERT_FALSE(second_dialog_->IsRunning(owning_window)); | 338 ASSERT_FALSE(second_dialog_->IsRunning(owning_window)); |
| 337 | 339 |
| 338 // Click cancel button. | 340 // Click cancel button. |
| 339 CloseDialog(DIALOG_BTN_CANCEL, owning_window); | 341 CloseDialog(DIALOG_BTN_CANCEL, owning_window); |
| 340 | 342 |
| 341 // Listener should have been informed of the cancellation. | 343 // Listener should have been informed of the cancellation. |
| 342 ASSERT_FALSE(listener_->file_selected()); | 344 ASSERT_FALSE(listener_->file_selected()); |
| 343 ASSERT_TRUE(listener_->canceled()); | 345 ASSERT_TRUE(listener_->canceled()); |
| 344 ASSERT_EQ(this, listener_->params()); | 346 ASSERT_EQ(this, listener_->params()); |
| 345 } | 347 } |
| OLD | NEW |