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, int index, void* params) |
49 OVERRIDE { | |
achuithb
2012/07/24 20:13:05
nit: don't think you're supposed to break before O
tbarzic
2012/07/25 02:02:54
Done.
| |
49 file_selected_ = true; | 50 file_selected_ = true; |
50 path_ = path; | 51 path_ = path; |
51 params_ = params; | 52 params_ = params; |
52 } | 53 } |
53 virtual void FileSelectedWithExtraInfo( | 54 virtual void FileSelectedWithExtraInfo( |
54 const ui::SelectedFileInfo& selected_file_info, | 55 const ui::SelectedFileInfo& selected_file_info, |
55 int index, | 56 int index, |
56 void* params) { | 57 void* params) OVERRIDE { |
57 FileSelected(selected_file_info.path, index, params); | 58 FileSelected(selected_file_info.real_path, index, params); |
58 } | 59 } |
59 virtual void MultiFilesSelected( | 60 virtual void MultiFilesSelected( |
60 const std::vector<FilePath>& files, void* params) {} | 61 const std::vector<FilePath>& files, void* params) OVERRIDE {} |
61 virtual void FileSelectionCanceled(void* params) { | 62 virtual void FileSelectionCanceled(void* params) { |
62 canceled_ = true; | 63 canceled_ = true; |
63 params_ = params; | 64 params_ = params; |
64 } | 65 } |
65 | 66 |
66 private: | 67 private: |
67 bool file_selected_; | 68 bool file_selected_; |
68 bool canceled_; | 69 bool canceled_; |
69 FilePath path_; | 70 FilePath path_; |
70 void* params_; | 71 void* params_; |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
336 ASSERT_FALSE(second_dialog_->IsRunning(owning_window)); | 337 ASSERT_FALSE(second_dialog_->IsRunning(owning_window)); |
337 | 338 |
338 // Click cancel button. | 339 // Click cancel button. |
339 CloseDialog(DIALOG_BTN_CANCEL, owning_window); | 340 CloseDialog(DIALOG_BTN_CANCEL, owning_window); |
340 | 341 |
341 // Listener should have been informed of the cancellation. | 342 // Listener should have been informed of the cancellation. |
342 ASSERT_FALSE(listener_->file_selected()); | 343 ASSERT_FALSE(listener_->file_selected()); |
343 ASSERT_TRUE(listener_->canceled()); | 344 ASSERT_TRUE(listener_->canceled()); |
344 ASSERT_EQ(this, listener_->params()); | 345 ASSERT_EQ(this, listener_->params()); |
345 } | 346 } |
OLD | NEW |