| 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 #ifndef CHROME_BROWSER_EXTENSIONS_USER_SCRIPT_MASTER_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_USER_SCRIPT_MASTER_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_USER_SCRIPT_MASTER_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_USER_SCRIPT_MASTER_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/directory_watcher.h" | 10 #include "base/directory_watcher.h" |
| 11 #include "base/file_path.h" | 11 #include "base/file_path.h" |
| 12 #include "base/message_loop.h" | 12 #include "base/message_loop.h" |
| 13 #include "base/process.h" | 13 #include "base/process.h" |
| 14 #include "base/scoped_ptr.h" | 14 #include "base/scoped_ptr.h" |
| 15 #include "base/shared_memory.h" | 15 #include "base/shared_memory.h" |
| 16 #include "base/string_piece.h" | |
| 17 #include "chrome/common/extensions/user_script.h" | 16 #include "chrome/common/extensions/user_script.h" |
| 18 #include "googleurl/src/gurl.h" | 17 #include "googleurl/src/gurl.h" |
| 19 #include "testing/gtest/include/gtest/gtest_prod.h" | 18 #include "testing/gtest/include/gtest/gtest_prod.h" |
| 20 | 19 |
| 20 class StringPiece; |
| 21 |
| 21 // Manages a segment of shared memory that contains the user scripts the user | 22 // Manages a segment of shared memory that contains the user scripts the user |
| 22 // has installed. Lives on the UI thread. | 23 // has installed. Lives on the UI thread. |
| 23 class UserScriptMaster : public base::RefCounted<UserScriptMaster>, | 24 class UserScriptMaster : public base::RefCounted<UserScriptMaster>, |
| 24 public DirectoryWatcher::Delegate { | 25 public DirectoryWatcher::Delegate { |
| 25 public: | 26 public: |
| 26 // For testability, the constructor takes the MessageLoop to run the | 27 // For testability, the constructor takes the MessageLoop to run the |
| 27 // script-reloading worker on as well as the path the scripts live in. | 28 // script-reloading worker on as well as the path the scripts live in. |
| 28 // These are normally the file thread and a directory inside the profile. | 29 // These are normally the file thread and a directory inside the profile. |
| 29 UserScriptMaster(MessageLoop* worker, const FilePath& script_dir); | 30 UserScriptMaster(MessageLoop* worker, const FilePath& script_dir); |
| 30 ~UserScriptMaster(); | 31 ~UserScriptMaster(); |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 | 148 |
| 148 // If the script directory is modified while we're rescanning it, we note | 149 // If the script directory is modified while we're rescanning it, we note |
| 149 // that we're currently mid-scan and then start over again once the scan | 150 // that we're currently mid-scan and then start over again once the scan |
| 150 // finishes. This boolean tracks whether another scan is pending. | 151 // finishes. This boolean tracks whether another scan is pending. |
| 151 bool pending_scan_; | 152 bool pending_scan_; |
| 152 | 153 |
| 153 DISALLOW_COPY_AND_ASSIGN(UserScriptMaster); | 154 DISALLOW_COPY_AND_ASSIGN(UserScriptMaster); |
| 154 }; | 155 }; |
| 155 | 156 |
| 156 #endif // CHROME_BROWSER_EXTENSIONS_USER_SCRIPT_MASTER_H_ | 157 #endif // CHROME_BROWSER_EXTENSIONS_USER_SCRIPT_MASTER_H_ |
| OLD | NEW |