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

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

Issue 2961033002: Use ContainsValue() instead of std::find() in chrome/browser/extensions (Closed)
Patch Set: Reverted code changes in language_settings_private_api.cc:307 Created 3 years, 5 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
« no previous file with comments | « no previous file | chrome/browser/extensions/api/gcm/gcm_apitest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <stddef.h> 7 #include <stddef.h>
8 8
9 #include <memory> 9 #include <memory>
10 #include <set> 10 #include <set>
11 #include <utility> 11 #include <utility>
12 #include <vector> 12 #include <vector>
13 13
14 #include "apps/saved_files_service.h" 14 #include "apps/saved_files_service.h"
15 #include "base/bind.h" 15 #include "base/bind.h"
16 #include "base/files/file_path.h" 16 #include "base/files/file_path.h"
17 #include "base/files/file_util.h" 17 #include "base/files/file_util.h"
18 #include "base/macros.h" 18 #include "base/macros.h"
19 #include "base/memory/ptr_util.h" 19 #include "base/memory/ptr_util.h"
20 #include "base/path_service.h" 20 #include "base/path_service.h"
21 #include "base/stl_util.h"
21 #include "base/strings/string_util.h" 22 #include "base/strings/string_util.h"
22 #include "base/strings/stringprintf.h" 23 #include "base/strings/stringprintf.h"
23 #include "base/strings/sys_string_conversions.h" 24 #include "base/strings/sys_string_conversions.h"
24 #include "base/strings/utf_string_conversions.h" 25 #include "base/strings/utf_string_conversions.h"
25 #include "base/task_scheduler/post_task.h" 26 #include "base/task_scheduler/post_task.h"
26 #include "base/value_conversions.h" 27 #include "base/value_conversions.h"
27 #include "base/values.h" 28 #include "base/values.h"
28 #include "build/build_config.h" 29 #include "build/build_config.h"
29 #include "chrome/browser/platform_util.h" 30 #include "chrome/browser/platform_util.h"
30 #include "chrome/browser/profiles/profile.h" 31 #include "chrome/browser/profiles/profile.h"
(...skipping 743 matching lines...) Expand 10 before | Expand all | Expand 10 after
774 775
775 if (!GetFileTypesFromAcceptOption(option, &extensions, &description)) 776 if (!GetFileTypesFromAcceptOption(option, &extensions, &description))
776 continue; // No extensions were found. 777 continue; // No extensions were found.
777 778
778 file_type_info->extensions.push_back(extensions); 779 file_type_info->extensions.push_back(extensions);
779 file_type_info->extension_description_overrides.push_back(description); 780 file_type_info->extension_description_overrides.push_back(description);
780 781
781 // If we still need to find suggested_extension, hunt for it inside the 782 // If we still need to find suggested_extension, hunt for it inside the
782 // extensions returned from GetFileTypesFromAcceptOption. 783 // extensions returned from GetFileTypesFromAcceptOption.
783 if (need_suggestion && 784 if (need_suggestion &&
784 std::find(extensions.begin(), extensions.end(), 785 base::ContainsValue(extensions, suggested_extension)) {
785 suggested_extension) != extensions.end()) {
786 need_suggestion = false; 786 need_suggestion = false;
787 } 787 }
788 } 788 }
789 } 789 }
790 790
791 // If there's nothing in our accepted extension list or we couldn't find the 791 // If there's nothing in our accepted extension list or we couldn't find the
792 // suggested extension required, then default to accepting all types. 792 // suggested extension required, then default to accepting all types.
793 if (file_type_info->extensions.empty() || need_suggestion) 793 if (file_type_info->extensions.empty() || need_suggestion)
794 file_type_info->include_all_files = true; 794 file_type_info->include_all_files = true;
795 } 795 }
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after
1235 return RespondNow(Error(kNotSupportedOnNonKioskSessionError)); 1235 return RespondNow(Error(kNotSupportedOnNonKioskSessionError));
1236 std::vector<api::file_system::Volume> result_volume_list; 1236 std::vector<api::file_system::Volume> result_volume_list;
1237 FillVolumeList(chrome_details_.GetProfile(), &result_volume_list); 1237 FillVolumeList(chrome_details_.GetProfile(), &result_volume_list);
1238 1238
1239 return RespondNow(ArgumentList( 1239 return RespondNow(ArgumentList(
1240 api::file_system::GetVolumeList::Results::Create(result_volume_list))); 1240 api::file_system::GetVolumeList::Results::Create(result_volume_list)));
1241 } 1241 }
1242 #endif 1242 #endif
1243 1243
1244 } // namespace extensions 1244 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/api/gcm/gcm_apitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698