| 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 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 // While we were scanning, there were further changes. Don't bother | 188 // While we were scanning, there were further changes. Don't bother |
| 189 // notifying about these scripts and instead just immediately rescan. | 189 // notifying about these scripts and instead just immediately rescan. |
| 190 pending_scan_ = false; | 190 pending_scan_ = false; |
| 191 StartScan(); | 191 StartScan(); |
| 192 } else { | 192 } else { |
| 193 // We're no longer scanning. | 193 // We're no longer scanning. |
| 194 script_reloader_ = NULL; | 194 script_reloader_ = NULL; |
| 195 // We've got scripts ready to go. | 195 // We've got scripts ready to go. |
| 196 shared_memory_.swap(handle_deleter); | 196 shared_memory_.swap(handle_deleter); |
| 197 | 197 |
| 198 NotificationService::current()->Notify(NOTIFY_NEW_USER_SCRIPTS, | 198 NotificationService::current()->Notify(NOTIFY_GREASEMONKEY_SCRIPTS_LOADED, |
| 199 NotificationService::AllSources(), | 199 NotificationService::AllSources(), |
| 200 Details<base::SharedMemory>(handle)); | 200 Details<base::SharedMemory>(handle)); |
| 201 } | 201 } |
| 202 } | 202 } |
| 203 | 203 |
| 204 void GreasemonkeyMaster::OnDirectoryChanged(const FilePath& path) { | 204 void GreasemonkeyMaster::OnDirectoryChanged(const FilePath& path) { |
| 205 if (script_reloader_.get()) { | 205 if (script_reloader_.get()) { |
| 206 // We're already scanning for scripts. We note that we should rescan when | 206 // We're already scanning for scripts. We note that we should rescan when |
| 207 // we get the chance. | 207 // we get the chance. |
| 208 pending_scan_ = true; | 208 pending_scan_ = true; |
| 209 return; | 209 return; |
| 210 } | 210 } |
| 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 |