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

Side by Side Diff: chrome/browser/extensions/user_script_master.h

Issue 18352: Miscellaneous changes to Extension class in prep for user scripts (Closed)
Patch Set: be more paranoid about accessing string indexes than is probably warranted Created 11 years, 11 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
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 #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 "base/directory_watcher.h" 8 #include "base/directory_watcher.h"
9 #include "base/file_path.h" 9 #include "base/file_path.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
11 #include "base/process.h" 11 #include "base/process.h"
12 #include "base/scoped_ptr.h" 12 #include "base/scoped_ptr.h"
13 #include "base/shared_memory.h" 13 #include "base/shared_memory.h"
14 #include "base/string_piece.h" 14 #include "base/string_piece.h"
15 #include "googleurl/src/gurl.h"
16
17 struct UserScriptInfo {
18 GURL url;
19 FilePath path;
20 std::vector<std::string> matches;
21 };
22 typedef std::vector<UserScriptInfo> UserScriptList;
15 23
16 // Manages a segment of shared memory that contains the user scripts the user 24 // Manages a segment of shared memory that contains the user scripts the user
17 // has installed. Lives on the UI thread. 25 // has installed. Lives on the UI thread.
18 class UserScriptMaster : public base::RefCounted<UserScriptMaster>, 26 class UserScriptMaster : public base::RefCounted<UserScriptMaster>,
19 public DirectoryWatcher::Delegate { 27 public DirectoryWatcher::Delegate {
20 public: 28 public:
21 // For testability, the constructor takes the MessageLoop to run the 29 // For testability, the constructor takes the MessageLoop to run the
22 // script-reloading worker on as well as the path the scripts live in. 30 // script-reloading worker on as well as the path the scripts live in.
23 // These are normally the file thread and a directory inside the profile. 31 // These are normally the file thread and a directory inside the profile.
24 UserScriptMaster(MessageLoop* worker, const FilePath& script_dir); 32 UserScriptMaster(MessageLoop* worker, const FilePath& script_dir);
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 136
129 // If the script directory is modified while we're rescanning it, we note 137 // If the script directory is modified while we're rescanning it, we note
130 // that we're currently mid-scan and then start over again once the scan 138 // that we're currently mid-scan and then start over again once the scan
131 // finishes. This boolean tracks whether another scan is pending. 139 // finishes. This boolean tracks whether another scan is pending.
132 bool pending_scan_; 140 bool pending_scan_;
133 141
134 DISALLOW_COPY_AND_ASSIGN(UserScriptMaster); 142 DISALLOW_COPY_AND_ASSIGN(UserScriptMaster);
135 }; 143 };
136 144
137 #endif // CHROME_BROWSER_EXTENSIONS_USER_SCRIPT_MASTER_H_ 145 #endif // CHROME_BROWSER_EXTENSIONS_USER_SCRIPT_MASTER_H_
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extensions_service_unittest.cc ('k') | chrome/test/data/extensions/extension1/manifest » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698