| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 } |
| OLD | NEW |