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

Side by Side Diff: components/drive/drive_app_registry.cc

Issue 2613223002: Remove ScopedVector from base::JSONValueConverter (Closed)
Patch Set: Rebase and address comments from mmenke@ Created 3 years, 11 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "components/drive/drive_app_registry.h" 5 #include "components/drive/drive_app_registry.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <memory>
10 #include <set> 11 #include <set>
11 #include <utility> 12 #include <utility>
13 #include <vector>
12 14
13 #include "base/callback.h" 15 #include "base/callback.h"
14 #include "base/files/file_path.h" 16 #include "base/files/file_path.h"
15 #include "components/drive/drive_app_registry_observer.h" 17 #include "components/drive/drive_app_registry_observer.h"
16 #include "components/drive/service/drive_service_interface.h" 18 #include "components/drive/service/drive_service_interface.h"
17 #include "google_apis/drive/drive_api_parser.h" 19 #include "google_apis/drive/drive_api_parser.h"
18 #include "google_apis/google_api_keys.h" 20 #include "google_apis/google_api_keys.h"
19 21
20 namespace { 22 namespace {
21 23
22 // Add {selector -> app_id} mapping to |map|. 24 // Add {selector -> app_id} mapping to |map|.
23 void AddAppSelectorList(const ScopedVector<std::string>& selectors, 25 void AddAppSelectorList(
24 const std::string& app_id, 26 const std::vector<std::unique_ptr<std::string>>& selectors,
25 std::multimap<std::string, std::string>* map) { 27 const std::string& app_id,
28 std::multimap<std::string, std::string>* map) {
26 for (size_t i = 0; i < selectors.size(); ++i) 29 for (size_t i = 0; i < selectors.size(); ++i)
27 map->insert(std::make_pair(*selectors[i], app_id)); 30 map->insert(std::make_pair(*selectors[i], app_id));
28 } 31 }
29 32
30 // Append list of app ids in |map| looked up by |selector| to |matched_apps|. 33 // Append list of app ids in |map| looked up by |selector| to |matched_apps|.
31 void FindAppsForSelector(const std::string& selector, 34 void FindAppsForSelector(const std::string& selector,
32 const std::multimap<std::string, std::string>& map, 35 const std::multimap<std::string, std::string>& map,
33 std::vector<std::string>* matched_apps) { 36 std::vector<std::string>* matched_apps) {
34 typedef std::multimap<std::string, std::string>::const_iterator iterator; 37 typedef std::multimap<std::string, std::string>::const_iterator iterator;
35 std::pair<iterator, iterator> range = map.equal_range(selector); 38 std::pair<iterator, iterator> range = map.equal_range(selector);
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 243
241 // Go forward while the size is larger or equal to preferred_size. 244 // Go forward while the size is larger or equal to preferred_size.
242 size_t i = 1; 245 size_t i = 1;
243 while (i < sorted_icons.size() && sorted_icons[i].first >= preferred_size) 246 while (i < sorted_icons.size() && sorted_icons[i].first >= preferred_size)
244 ++i; 247 ++i;
245 return sorted_icons[i - 1].second; 248 return sorted_icons[i - 1].second;
246 } 249 }
247 250
248 } // namespace util 251 } // namespace util
249 } // namespace drive 252 } // namespace drive
OLDNEW
« no previous file with comments | « components/drive/chromeos/file_system/search_operation.cc ('k') | components/drive/service/fake_drive_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698