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/file_select_helper.h" | 5 #include "chrome/browser/file_select_helper.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 void FileSelectHelper::FileSelectedWithExtraInfo( | 116 void FileSelectHelper::FileSelectedWithExtraInfo( |
117 const ui::SelectedFileInfo& file, | 117 const ui::SelectedFileInfo& file, |
118 int index, | 118 int index, |
119 void* params) { | 119 void* params) { |
120 if (!render_view_host_) | 120 if (!render_view_host_) |
121 return; | 121 return; |
122 | 122 |
123 profile_->set_last_selected_directory(file.file_path.DirName()); | 123 profile_->set_last_selected_directory(file.file_path.DirName()); |
124 | 124 |
125 const base::FilePath& path = file.local_path; | 125 const base::FilePath& path = file.local_path; |
126 if (dialog_type_ == ui::SelectFileDialog::SELECT_FOLDER) { | 126 if (dialog_type_ == ui::SelectFileDialog::SELECT_UPLOAD_FOLDER) { |
127 StartNewEnumeration(path, kFileSelectEnumerationId, render_view_host_); | 127 StartNewEnumeration(path, kFileSelectEnumerationId, render_view_host_); |
128 return; | 128 return; |
129 } | 129 } |
130 | 130 |
131 std::vector<ui::SelectedFileInfo> files; | 131 std::vector<ui::SelectedFileInfo> files; |
132 files.push_back(file); | 132 files.push_back(file); |
133 NotifyRenderViewHost(render_view_host_, files, dialog_mode_); | 133 NotifyRenderViewHost(render_view_host_, files, dialog_mode_); |
134 | 134 |
135 // No members should be accessed from here on. | 135 // No members should be accessed from here on. |
136 RunFileChooserEnd(); | 136 RunFileChooserEnd(); |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
370 this, new ChromeSelectFilePolicy(web_contents_)); | 370 this, new ChromeSelectFilePolicy(web_contents_)); |
371 | 371 |
372 dialog_mode_ = params.mode; | 372 dialog_mode_ = params.mode; |
373 switch (params.mode) { | 373 switch (params.mode) { |
374 case FileChooserParams::Open: | 374 case FileChooserParams::Open: |
375 dialog_type_ = ui::SelectFileDialog::SELECT_OPEN_FILE; | 375 dialog_type_ = ui::SelectFileDialog::SELECT_OPEN_FILE; |
376 break; | 376 break; |
377 case FileChooserParams::OpenMultiple: | 377 case FileChooserParams::OpenMultiple: |
378 dialog_type_ = ui::SelectFileDialog::SELECT_OPEN_MULTI_FILE; | 378 dialog_type_ = ui::SelectFileDialog::SELECT_OPEN_MULTI_FILE; |
379 break; | 379 break; |
380 case FileChooserParams::OpenFolder: | 380 case FileChooserParams::UploadFolder: |
381 dialog_type_ = ui::SelectFileDialog::SELECT_FOLDER; | 381 dialog_type_ = ui::SelectFileDialog::SELECT_UPLOAD_FOLDER; |
382 break; | 382 break; |
383 case FileChooserParams::Save: | 383 case FileChooserParams::Save: |
384 dialog_type_ = ui::SelectFileDialog::SELECT_SAVEAS_FILE; | 384 dialog_type_ = ui::SelectFileDialog::SELECT_SAVEAS_FILE; |
385 break; | 385 break; |
386 default: | 386 default: |
387 // Prevent warning. | 387 // Prevent warning. |
388 dialog_type_ = ui::SelectFileDialog::SELECT_OPEN_FILE; | 388 dialog_type_ = ui::SelectFileDialog::SELECT_OPEN_FILE; |
389 NOTREACHED(); | 389 NOTREACHED(); |
390 } | 390 } |
391 | 391 |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
478 // A 1 character accept type will always be invalid (either a "." in the case | 478 // A 1 character accept type will always be invalid (either a "." in the case |
479 // of an extension or a "/" in the case of a MIME type). | 479 // of an extension or a "/" in the case of a MIME type). |
480 std::string unused; | 480 std::string unused; |
481 if (accept_type.length() <= 1 || | 481 if (accept_type.length() <= 1 || |
482 StringToLowerASCII(accept_type) != accept_type || | 482 StringToLowerASCII(accept_type) != accept_type || |
483 TrimWhitespaceASCII(accept_type, TRIM_ALL, &unused) != TRIM_NONE) { | 483 TrimWhitespaceASCII(accept_type, TRIM_ALL, &unused) != TRIM_NONE) { |
484 return false; | 484 return false; |
485 } | 485 } |
486 return true; | 486 return true; |
487 } | 487 } |
OLD | NEW |