OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <gdk/gdkx.h> | 5 #include <gdk/gdkx.h> |
6 #include <gtk/gtk.h> | 6 #include <gtk/gtk.h> |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
11 #include "base/bind_helpers.h" | 11 #include "base/bind_helpers.h" |
12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
13 #include "base/logging.h" | 13 #include "base/logging.h" |
14 #include "base/mime_util.h" | 14 #include "base/nix/mime_util_xdg.h" |
15 #include "base/nix/xdg_util.h" | 15 #include "base/nix/xdg_util.h" |
16 #include "base/process_util.h" | 16 #include "base/process_util.h" |
17 #include "base/string_number_conversions.h" | 17 #include "base/string_number_conversions.h" |
18 #include "base/string_util.h" | 18 #include "base/string_util.h" |
19 #include "base/utf_string_conversions.h" | 19 #include "base/utf_string_conversions.h" |
20 #include "chrome/browser/ui/gtk/dialogs_common.h" | 20 #include "chrome/browser/ui/gtk/dialogs_common.h" |
21 #include "content/public/browser/browser_thread.h" | 21 #include "content/public/browser/browser_thread.h" |
22 #include "grit/generated_resources.h" | 22 #include "grit/generated_resources.h" |
23 #include "ui/base/l10n/l10n_util.h" | 23 #include "ui/base/l10n/l10n_util.h" |
24 | 24 |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 } | 187 } |
188 | 188 |
189 std::string SelectFileDialogImplKDE::GetMimeTypeFilterString() { | 189 std::string SelectFileDialogImplKDE::GetMimeTypeFilterString() { |
190 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); | 190 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
191 std::string filter_string; | 191 std::string filter_string; |
192 // We need a filter set because the same mime type can appear multiple times. | 192 // We need a filter set because the same mime type can appear multiple times. |
193 std::set<std::string> filter_set; | 193 std::set<std::string> filter_set; |
194 for (size_t i = 0; i < file_types_.extensions.size(); ++i) { | 194 for (size_t i = 0; i < file_types_.extensions.size(); ++i) { |
195 for (size_t j = 0; j < file_types_.extensions[i].size(); ++j) { | 195 for (size_t j = 0; j < file_types_.extensions[i].size(); ++j) { |
196 if (!file_types_.extensions[i][j].empty()) { | 196 if (!file_types_.extensions[i][j].empty()) { |
197 std::string mime_type = mime_util::GetFileMimeType( | 197 std::string mime_type = base::nix::GetFileMimeType( |
198 FilePath("name").ReplaceExtension(file_types_.extensions[i][j])); | 198 FilePath("name").ReplaceExtension(file_types_.extensions[i][j])); |
199 filter_set.insert(mime_type); | 199 filter_set.insert(mime_type); |
200 } | 200 } |
201 } | 201 } |
202 } | 202 } |
203 // Add the *.* filter, but only if we have added other filters (otherwise it | 203 // Add the *.* filter, but only if we have added other filters (otherwise it |
204 // is implied). | 204 // is implied). |
205 if (file_types_.include_all_files && !file_types_.extensions.empty()) | 205 if (file_types_.include_all_files && !file_types_.extensions.empty()) |
206 filter_set.insert("application/octet-stream"); | 206 filter_set.insert("application/octet-stream"); |
207 // Create the final output string. | 207 // Create the final output string. |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
409 continue; | 409 continue; |
410 filenames_fp.push_back(path); | 410 filenames_fp.push_back(path); |
411 } | 411 } |
412 | 412 |
413 if (filenames_fp.empty()) { | 413 if (filenames_fp.empty()) { |
414 FileNotSelected(params); | 414 FileNotSelected(params); |
415 return; | 415 return; |
416 } | 416 } |
417 MultiFilesSelected(filenames_fp, params); | 417 MultiFilesSelected(filenames_fp, params); |
418 } | 418 } |
OLD | NEW |