| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_DECLARATIVE_USER_SCRIPT_MASTER_H_ | 5 #ifndef EXTENSIONS_BROWSER_DECLARATIVE_USER_SCRIPT_MASTER_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_DECLARATIVE_USER_SCRIPT_MASTER_H_ | 6 #define EXTENSIONS_BROWSER_DECLARATIVE_USER_SCRIPT_MASTER_H_ |
| 7 | 7 |
| 8 #include "base/scoped_observer.h" | 8 #include "base/scoped_observer.h" |
| 9 #include "chrome/browser/extensions/extension_user_script_loader.h" | 9 #include "extensions/browser/extension_user_script_loader.h" |
| 10 | 10 |
| 11 class Profile; | 11 namespace content { |
| 12 class BrowserContext; |
| 13 } |
| 12 | 14 |
| 13 namespace extensions { | 15 namespace extensions { |
| 14 | 16 |
| 15 class UserScript; | 17 class UserScript; |
| 16 | 18 |
| 17 // Manages declarative user scripts for a single extension. Owns a | 19 // Manages declarative user scripts for a single extension. Owns a |
| 18 // UserScriptLoader to which file loading and shared memory management | 20 // UserScriptLoader to which file loading and shared memory management |
| 19 // operations are delegated, and provides an interface for adding, removing, | 21 // operations are delegated, and provides an interface for adding, removing, |
| 20 // and clearing scripts. | 22 // and clearing scripts. |
| 21 class DeclarativeUserScriptMaster { | 23 class DeclarativeUserScriptMaster { |
| 22 public: | 24 public: |
| 23 DeclarativeUserScriptMaster(Profile* profile, const HostID& host_id); | 25 DeclarativeUserScriptMaster(content::BrowserContext* browser_context, |
| 26 const HostID& host_id); |
| 24 ~DeclarativeUserScriptMaster(); | 27 ~DeclarativeUserScriptMaster(); |
| 25 | 28 |
| 26 // Adds script to shared memory region. This may not happen right away if a | 29 // Adds script to shared memory region. This may not happen right away if a |
| 27 // script load is in progress. | 30 // script load is in progress. |
| 28 void AddScript(const UserScript& script); | 31 void AddScript(const UserScript& script); |
| 29 | 32 |
| 30 // Removes script from shared memory region. This may not happen right away if | 33 // Removes script from shared memory region. This may not happen right away if |
| 31 // a script load is in progress. | 34 // a script load is in progress. |
| 32 void RemoveScript(const UserScript& script); | 35 void RemoveScript(const UserScript& script); |
| 33 | 36 |
| 34 // Removes all scripts from shared memory region. This may not happen right | 37 // Removes all scripts from shared memory region. This may not happen right |
| 35 // away if a script load is in progress. | 38 // away if a script load is in progress. |
| 36 void ClearScripts(); | 39 void ClearScripts(); |
| 37 | 40 |
| 38 const HostID& host_id() const { return host_id_; } | 41 const HostID& host_id() const { return host_id_; } |
| 39 | 42 |
| 40 private: | 43 private: |
| 41 // ID of host that owns scripts that this component manages. | 44 // ID of host that owns scripts that this component manages. |
| 42 HostID host_id_; | 45 HostID host_id_; |
| 43 | 46 |
| 44 // Script loader that handles loading contents of scripts into shared memory | 47 // Script loader that handles loading contents of scripts into shared memory |
| 45 // and notifying renderers of script updates. | 48 // and notifying renderers of script updates. |
| 46 ExtensionUserScriptLoader loader_; | 49 ExtensionUserScriptLoader loader_; |
| 47 | 50 |
| 48 DISALLOW_COPY_AND_ASSIGN(DeclarativeUserScriptMaster); | 51 DISALLOW_COPY_AND_ASSIGN(DeclarativeUserScriptMaster); |
| 49 }; | 52 }; |
| 50 | 53 |
| 51 } // namespace extensions | 54 } // namespace extensions |
| 52 | 55 |
| 53 #endif // CHROME_BROWSER_EXTENSIONS_DECLARATIVE_USER_SCRIPT_MASTER_H_ | 56 #endif // EXTENSIONS_BROWSER_DECLARATIVE_USER_SCRIPT_MASTER_H_ |
| OLD | NEW |