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

Side by Side Diff: chrome/browser/greasemonkey_master.cc

Issue 13315: Move file enumeration to filepaths. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 12 years 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2008 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/greasemonkey_master.h" 5 #include "chrome/browser/greasemonkey_master.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/file_path.h" 9 #include "base/file_path.h"
10 #include "base/file_util.h" 10 #include "base/file_util.h"
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 master_message_loop_->PostTask(FROM_HERE, 106 master_message_loop_->PostTask(FROM_HERE,
107 NewRunnableMethod(this, 107 NewRunnableMethod(this,
108 &GreasemonkeyMaster::ScriptReloader::NotifyMaster, 108 &GreasemonkeyMaster::ScriptReloader::NotifyMaster,
109 shared_memory)); 109 shared_memory));
110 } 110 }
111 111
112 base::SharedMemory* GreasemonkeyMaster::ScriptReloader::GetNewScripts( 112 base::SharedMemory* GreasemonkeyMaster::ScriptReloader::GetNewScripts(
113 const FilePath& script_dir) { 113 const FilePath& script_dir) {
114 std::vector<std::wstring> scripts; 114 std::vector<std::wstring> scripts;
115 115
116 file_util::FileEnumerator enumerator(script_dir.value(), false, 116 file_util::FileEnumerator enumerator(script_dir, false,
117 file_util::FileEnumerator::FILES, 117 file_util::FileEnumerator::FILES,
118 L"*.user.js"); 118 FILE_PATH_LITERAL("*.user.js"));
119 for (std::wstring file = enumerator.Next(); !file.empty(); 119 for (FilePath file = enumerator.Next(); !file.value().empty();
120 file = enumerator.Next()) { 120 file = enumerator.Next()) {
121 scripts.push_back(file); 121 scripts.push_back(file.ToWStringHack());
122 } 122 }
123 123
124 if (scripts.empty()) 124 if (scripts.empty())
125 return NULL; 125 return NULL;
126 126
127 // Pickle scripts data. 127 // Pickle scripts data.
128 Pickle pickle; 128 Pickle pickle;
129 pickle.WriteSize(scripts.size()); 129 pickle.WriteSize(scripts.size());
130 for (std::vector<std::wstring>::iterator path = scripts.begin(); 130 for (std::vector<std::wstring>::iterator path = scripts.begin();
131 path != scripts.end(); ++path) { 131 path != scripts.end(); ++path) {
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 211
212 StartScan(); 212 StartScan();
213 } 213 }
214 214
215 void GreasemonkeyMaster::StartScan() { 215 void GreasemonkeyMaster::StartScan() {
216 if (!script_reloader_) 216 if (!script_reloader_)
217 script_reloader_ = new ScriptReloader(this); 217 script_reloader_ = new ScriptReloader(this);
218 218
219 script_reloader_->StartScan(worker_loop_, *user_script_dir_); 219 script_reloader_->StartScan(worker_loop_, *user_script_dir_);
220 } 220 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extensions_service.cc ('k') | chrome/browser/history/text_database_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698