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

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

Issue 2613223002: Remove ScopedVector from base::JSONValueConverter (Closed)
Patch Set: Add a TODO 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 <set> 10 #include <set>
11 #include <utility> 11 #include <utility>
12 12
13 #include "base/callback.h" 13 #include "base/callback.h"
14 #include "base/files/file_path.h" 14 #include "base/files/file_path.h"
15 #include "components/drive/drive_app_registry_observer.h" 15 #include "components/drive/drive_app_registry_observer.h"
16 #include "components/drive/service/drive_service_interface.h" 16 #include "components/drive/service/drive_service_interface.h"
17 #include "google_apis/drive/drive_api_parser.h" 17 #include "google_apis/drive/drive_api_parser.h"
18 #include "google_apis/google_api_keys.h" 18 #include "google_apis/google_api_keys.h"
19 19
20 namespace { 20 namespace {
21 21
22 // Add {selector -> app_id} mapping to |map|. 22 // Add {selector -> app_id} mapping to |map|.
23 void AddAppSelectorList(const ScopedVector<std::string>& selectors, 23 void AddAppSelectorList(
24 const std::string& app_id, 24 const std::vector<std::unique_ptr<std::string>>& selectors,
hidehiko 2017/01/10 06:44:36 Ditto for include.
leonhsl(Using Gerrit) 2017/01/10 09:48:13 Done.
25 std::multimap<std::string, std::string>* map) { 25 const std::string& app_id,
26 std::multimap<std::string, std::string>* map) {
26 for (size_t i = 0; i < selectors.size(); ++i) 27 for (size_t i = 0; i < selectors.size(); ++i)
27 map->insert(std::make_pair(*selectors[i], app_id)); 28 map->insert(std::make_pair(*selectors[i], app_id));
28 } 29 }
29 30
30 // Append list of app ids in |map| looked up by |selector| to |matched_apps|. 31 // Append list of app ids in |map| looked up by |selector| to |matched_apps|.
31 void FindAppsForSelector(const std::string& selector, 32 void FindAppsForSelector(const std::string& selector,
32 const std::multimap<std::string, std::string>& map, 33 const std::multimap<std::string, std::string>& map,
33 std::vector<std::string>* matched_apps) { 34 std::vector<std::string>* matched_apps) {
34 typedef std::multimap<std::string, std::string>::const_iterator iterator; 35 typedef std::multimap<std::string, std::string>::const_iterator iterator;
35 std::pair<iterator, iterator> range = map.equal_range(selector); 36 std::pair<iterator, iterator> range = map.equal_range(selector);
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 241
241 // Go forward while the size is larger or equal to preferred_size. 242 // Go forward while the size is larger or equal to preferred_size.
242 size_t i = 1; 243 size_t i = 1;
243 while (i < sorted_icons.size() && sorted_icons[i].first >= preferred_size) 244 while (i < sorted_icons.size() && sorted_icons[i].first >= preferred_size)
244 ++i; 245 ++i;
245 return sorted_icons[i - 1].second; 246 return sorted_icons[i - 1].second;
246 } 247 }
247 248
248 } // namespace util 249 } // namespace util
249 } // namespace drive 250 } // namespace drive
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698