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/select_file_dialog.h" | 5 #include "chrome/browser/ui/select_file_dialog.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 if (source_contents) { | 76 if (source_contents) { |
77 TabContentsWrapper* wrapper = | 77 TabContentsWrapper* wrapper = |
78 TabContentsWrapper::GetCurrentWrapperForContents(source_contents); | 78 TabContentsWrapper::GetCurrentWrapperForContents(source_contents); |
79 InfoBarTabHelper* infobar_helper = wrapper->infobar_tab_helper(); | 79 InfoBarTabHelper* infobar_helper = wrapper->infobar_tab_helper(); |
80 infobar_helper->AddInfoBar(new SimpleAlertInfoBarDelegate( | 80 infobar_helper->AddInfoBar(new SimpleAlertInfoBarDelegate( |
81 infobar_helper, | 81 infobar_helper, |
82 NULL, | 82 NULL, |
83 l10n_util::GetStringUTF16(IDS_FILE_SELECTION_DIALOG_INFOBAR), | 83 l10n_util::GetStringUTF16(IDS_FILE_SELECTION_DIALOG_INFOBAR), |
84 true)); | 84 true)); |
85 } else { | 85 } else { |
86 LOG(WARNING) << "File-selection dialogs are disabled but no TabContents " | 86 LOG(WARNING) << "File-selection dialogs are disabled but no WebContents " |
87 << "is given to display the InfoBar."; | 87 << "is given to display the InfoBar."; |
88 } | 88 } |
89 | 89 |
90 // Inform the listener that no file was selected. | 90 // Inform the listener that no file was selected. |
91 // Post a task rather than calling FileSelectionCanceled directly to ensure | 91 // Post a task rather than calling FileSelectionCanceled directly to ensure |
92 // that the listener is called asynchronously. | 92 // that the listener is called asynchronously. |
93 MessageLoop::current()->PostTask( | 93 MessageLoop::current()->PostTask( |
94 FROM_HERE, base::Bind(&SelectFileDialog::CancelFileSelection, this, | 94 FROM_HERE, base::Bind(&SelectFileDialog::CancelFileSelection, this, |
95 params)); | 95 params)); |
96 return; | 96 return; |
97 } | 97 } |
98 // Call the platform specific implementation of the file selection dialog. | 98 // Call the platform specific implementation of the file selection dialog. |
99 SelectFileImpl(type, title, default_path, file_types, file_type_index, | 99 SelectFileImpl(type, title, default_path, file_types, file_type_index, |
100 default_extension, owning_window, params); | 100 default_extension, owning_window, params); |
101 } | 101 } |
102 | 102 |
103 bool SelectFileDialog::HasMultipleFileTypeChoices() { | 103 bool SelectFileDialog::HasMultipleFileTypeChoices() { |
104 return HasMultipleFileTypeChoicesImpl(); | 104 return HasMultipleFileTypeChoicesImpl(); |
105 } | 105 } |
106 | 106 |
107 void SelectFileDialog::CancelFileSelection(void* params) { | 107 void SelectFileDialog::CancelFileSelection(void* params) { |
108 if (listener_) | 108 if (listener_) |
109 listener_->FileSelectionCanceled(params); | 109 listener_->FileSelectionCanceled(params); |
110 } | 110 } |
OLD | NEW |