Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(142)

Side by Side Diff: chrome/browser/extensions/api/file_system/file_system_api.cc

Issue 10915252: Always include base extension type in Mac select file dialog (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: comment to issue Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/extensions/api/file_system/file_system_api.h" 5 #include "chrome/browser/extensions/api/file_system/file_system_api.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/file_path.h" 8 #include "base/file_path.h"
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 185
186 // Expand the mime-types and extensions provided in an AcceptOption, returning 186 // Expand the mime-types and extensions provided in an AcceptOption, returning
187 // them within the passed extension vector. Returns false if no valid types 187 // them within the passed extension vector. Returns false if no valid types
188 // were found. 188 // were found.
189 bool GetFileTypesFromAcceptOption( 189 bool GetFileTypesFromAcceptOption(
190 const file_system::AcceptOption& accept_option, 190 const file_system::AcceptOption& accept_option,
191 std::vector<FilePath::StringType>* extensions, 191 std::vector<FilePath::StringType>* extensions,
192 string16* description) { 192 string16* description) {
193 std::set<FilePath::StringType> extension_set; 193 std::set<FilePath::StringType> extension_set;
194 int description_id = 0; 194 int description_id = 0;
195 bool valid_type = false;
196 195
197 if (accept_option.mime_types.get()) { 196 if (accept_option.mime_types.get()) {
198 std::vector<std::string>* list = accept_option.mime_types.get(); 197 std::vector<std::string>* list = accept_option.mime_types.get();
198 bool valid_type = false;
199 for (std::vector<std::string>::const_iterator iter = list->begin(); 199 for (std::vector<std::string>::const_iterator iter = list->begin();
200 iter != list->end(); ++iter) { 200 iter != list->end(); ++iter) {
201 std::vector<FilePath::StringType> inner; 201 std::vector<FilePath::StringType> inner;
202 std::string accept_type = *iter; 202 std::string accept_type = *iter;
203 StringToLowerASCII(&accept_type); 203 StringToLowerASCII(&accept_type);
204 net::GetExtensionsForMimeType(*iter, &inner); 204 net::GetExtensionsForMimeType(accept_type, &inner);
205 if (inner.empty()) 205 if (inner.empty())
206 continue; 206 continue;
207 207
208 if (valid_type) 208 if (valid_type)
209 description_id = 0; // We already have an accept type with label; if 209 description_id = 0; // We already have an accept type with label; if
210 // we find another, give up and use the default. 210 // we find another, give up and use the default.
211 else if (accept_type == "image/*") 211 else if (accept_type == "image/*")
212 description_id = IDS_IMAGE_FILES; 212 description_id = IDS_IMAGE_FILES;
213 else if (accept_type == "audio/*") 213 else if (accept_type == "audio/*")
214 description_id = IDS_AUDIO_FILES; 214 description_id = IDS_AUDIO_FILES;
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after
592 592
593 if (entry_type == WRITABLE && !HasFileSystemWritePermission()) { 593 if (entry_type == WRITABLE && !HasFileSystemWritePermission()) {
594 error_ = kRequiresFileSystemWriteError; 594 error_ = kRequiresFileSystemWriteError;
595 return false; 595 return false;
596 } 596 }
597 597
598 return ShowPicker(suggested_name, file_type_info, picker_type, entry_type); 598 return ShowPicker(suggested_name, file_type_info, picker_type, entry_type);
599 } 599 }
600 600
601 } // namespace extensions 601 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | ui/base/dialogs/select_file_dialog_mac.mm » ('j') | ui/base/dialogs/select_file_dialog_mac.mm » ('J')

Powered by Google App Engine
This is Rietveld 408576698