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

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: 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 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 139
140 // Expand the mime-types and extensions provided in an AcceptOption, returning 140 // Expand the mime-types and extensions provided in an AcceptOption, returning
141 // them within the passed extension vector. Returns false if no valid types 141 // them within the passed extension vector. Returns false if no valid types
142 // were found. 142 // were found.
143 bool GetFileTypesFromAcceptOption( 143 bool GetFileTypesFromAcceptOption(
144 const file_system::AcceptOption& accept_option, 144 const file_system::AcceptOption& accept_option,
145 std::vector<FilePath::StringType>* extensions, 145 std::vector<FilePath::StringType>* extensions,
146 string16* description) { 146 string16* description) {
147 std::set<FilePath::StringType> extension_set; 147 std::set<FilePath::StringType> extension_set;
148 int description_id = 0; 148 int description_id = 0;
149 bool valid_type = false;
150 149
151 if (accept_option.mime_types.get()) { 150 if (accept_option.mime_types.get()) {
152 std::vector<std::string>* list = accept_option.mime_types.get(); 151 std::vector<std::string>* list = accept_option.mime_types.get();
152 bool valid_type = false;
153 for (std::vector<std::string>::const_iterator iter = list->begin(); 153 for (std::vector<std::string>::const_iterator iter = list->begin();
154 iter != list->end(); ++iter) { 154 iter != list->end(); ++iter) {
155 std::vector<FilePath::StringType> inner; 155 std::vector<FilePath::StringType> inner;
156 std::string accept_type = *iter; 156 std::string accept_type = *iter;
157 StringToLowerASCII(&accept_type); 157 StringToLowerASCII(&accept_type);
158 net::GetExtensionsForMimeType(*iter, &inner); 158 net::GetExtensionsForMimeType(accept_type, &inner);
159 if (inner.empty()) 159 if (inner.empty())
160 continue; 160 continue;
161 161
162 if (valid_type) 162 if (valid_type)
163 description_id = 0; // We already have an accept type with label; if 163 description_id = 0; // We already have an accept type with label; if
164 // we find another, give up and use the default. 164 // we find another, give up and use the default.
165 else if (accept_type == "image/*") 165 else if (accept_type == "image/*")
166 description_id = IDS_IMAGE_FILES; 166 description_id = IDS_IMAGE_FILES;
167 else if (accept_type == "audio/*") 167 else if (accept_type == "audio/*")
168 description_id = IDS_AUDIO_FILES; 168 description_id = IDS_AUDIO_FILES;
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after
546 546
547 if (entry_type == WRITABLE && !HasFileSystemWritePermission()) { 547 if (entry_type == WRITABLE && !HasFileSystemWritePermission()) {
548 error_ = kRequiresFileSystemWriteError; 548 error_ = kRequiresFileSystemWriteError;
549 return false; 549 return false;
550 } 550 }
551 551
552 return ShowPicker(suggested_name, file_type_info, picker_type, entry_type); 552 return ShowPicker(suggested_name, file_type_info, picker_type, entry_type);
553 } 553 }
554 554
555 } // namespace extensions 555 } // 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