Chromium Code Reviews| Index: chrome/browser/extensions/extension_user_script_loader.h |
| diff --git a/chrome/browser/extensions/extension_user_script_loader.h b/chrome/browser/extensions/extension_user_script_loader.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..df3a1ed65360cb931fbd4f3bdfbcf3598db01184 |
| --- /dev/null |
| +++ b/chrome/browser/extensions/extension_user_script_loader.h |
| @@ -0,0 +1,70 @@ |
| +// Copyright 2015 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_USER_SCRIPT_LOADER_H_ |
| +#define CHROME_BROWSER_EXTENSIONS_EXTENSION_USER_SCRIPT_LOADER_H_ |
| + |
| +#include "base/memory/shared_memory.h" |
| +#include "chrome/browser/extensions/user_script_loader.h" |
| +#include "content/public/browser/notification_observer.h" |
|
Devlin
2015/01/20 17:51:05
nit: prune includes.
Xi Han
2015/01/21 21:30:16
Done.
|
| +#include "extensions/browser/extension_registry_observer.h" |
| +#include "extensions/common/extension.h" |
| +#include "extensions/common/extension_set.h" |
| + |
| +namespace content { |
| +class BrowserContext; |
| +} |
| + |
| +class Profile; |
| + |
| +namespace extensions { |
| + |
| +class ContentVerifier; |
| +class ExtensionRegistry; |
| + |
| +// UserScriptLoader for extensions. |
| +class ExtensionUserScriptLoader : public UserScriptLoader, |
| + public ExtensionRegistryObserver { |
| + public: |
| + // The listen_for_extension_system_loaded is only set true when initilizing |
| + // the Exttension System, e.g, when constructs SharedUserScriptMaster in |
| + // ExtensionSystemImpl. |
| + ExtensionUserScriptLoader(Profile* profile, |
| + const ConsumerID& consumer_id, |
| + bool listen_for_extension_system_loaded); |
| + ~ExtensionUserScriptLoader() override; |
| + |
| + private: |
| + static bool LoadScriptContent(const ConsumerID& consumer_id, |
|
Devlin
2015/01/20 17:51:05
nit: function comments.
Xi Han
2015/01/21 21:30:16
Done.
|
| + UserScript::File* script_file, |
| + const SubstitutionMap* localization_messages, |
| + scoped_refptr<ContentVerifier> verifier); |
| + |
| + // UserScriptLoader: |
| + void UpdateConsumersInfo(const ConsumerIDSet& changed_consumers) override; |
| + LoadUserScriptsFunctionCallback GetLoadUserScriptsFunction() override; |
| + void SendUpdate(content::RenderProcessHost* process, |
| + base::SharedMemoryHandle handle_for_process, |
| + const std::set<ConsumerID>& changed_consumers) override; |
| + |
| + // ExtensionRegistryObserver: |
| + void OnExtensionUnloaded(content::BrowserContext* browser_context, |
| + const Extension* extension, |
| + UnloadedExtensionInfo::Reason reason) override; |
| + |
| + // Initiates script load when we have been waiting for the extension system |
| + // to be ready. |
| + void OnExtensionSystemReady(); |
| + |
| + ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver> |
| + extension_registry_observer_; |
| + |
| + base::WeakPtrFactory<ExtensionUserScriptLoader> weak_factory_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(ExtensionUserScriptLoader); |
| +}; |
| + |
| +} // namespace extensions |
| + |
| +#endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_USER_SCRIPT_LOADER_H_ |