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

Side by Side Diff: gin/modules/file_module_provider.cc

Issue 1284833004: Remove remaining legacy SplitString calls. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 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 | « device/hid/hid_service_linux.cc ('k') | jingle/notifier/communicator/single_login_attempt.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "gin/modules/file_module_provider.h" 5 #include "gin/modules/file_module_provider.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/files/file_util.h" 8 #include "base/files/file_util.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/strings/string_split.h" 10 #include "base/strings/string_split.h"
11 #include "gin/converter.h" 11 #include "gin/converter.h"
12 12
13 namespace gin { 13 namespace gin {
14 14
15 namespace { 15 namespace {
16 16
17 void AttempToLoadModule(const base::WeakPtr<Runner>& runner, 17 void AttempToLoadModule(const base::WeakPtr<Runner>& runner,
18 const std::vector<base::FilePath>& search_paths, 18 const std::vector<base::FilePath>& search_paths,
19 const std::string& id) { 19 const std::string& id) {
20 if (!runner) 20 if (!runner)
21 return; 21 return;
22 22
23 std::vector<std::string> components; 23 std::vector<std::string> components = base::SplitString(
24 base::SplitString(id, '/', &components); 24 id, "/", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL);
25 25
26 base::FilePath path; 26 base::FilePath path;
27 for (size_t i = 0; i < components.size(); ++i) { 27 for (size_t i = 0; i < components.size(); ++i) {
28 // TODO(abarth): Technically the path components can be UTF-8. We don't 28 // TODO(abarth): Technically the path components can be UTF-8. We don't
29 // handle that case correctly yet. 29 // handle that case correctly yet.
30 path = path.AppendASCII(components[i]); 30 path = path.AppendASCII(components[i]);
31 } 31 }
32 path = path.AddExtension(FILE_PATH_LITERAL("js")); 32 path = path.AddExtension(FILE_PATH_LITERAL("js"));
33 33
34 for (size_t i = 0; i < search_paths.size(); ++i) { 34 for (size_t i = 0; i < search_paths.size(); ++i) {
(...skipping 26 matching lines...) Expand all
61 const std::string& id = *it; 61 const std::string& id = *it;
62 if (attempted_ids_.count(id)) 62 if (attempted_ids_.count(id))
63 continue; 63 continue;
64 attempted_ids_.insert(id); 64 attempted_ids_.insert(id);
65 base::MessageLoop::current()->PostTask(FROM_HERE, base::Bind( 65 base::MessageLoop::current()->PostTask(FROM_HERE, base::Bind(
66 AttempToLoadModule, runner->GetWeakPtr(), search_paths_, id)); 66 AttempToLoadModule, runner->GetWeakPtr(), search_paths_, id));
67 } 67 }
68 } 68 }
69 69
70 } // namespace gin 70 } // namespace gin
OLDNEW
« no previous file with comments | « device/hid/hid_service_linux.cc ('k') | jingle/notifier/communicator/single_login_attempt.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698