Index: chrome/browser/extensions/extension_user_script_loader.h |
diff --git a/chrome/browser/extensions/shared_user_script_master.h b/chrome/browser/extensions/extension_user_script_loader.h |
similarity index 32% |
copy from chrome/browser/extensions/shared_user_script_master.h |
copy to chrome/browser/extensions/extension_user_script_loader.h |
index bd20bb7062bee34755f0ea9bff580bea07881b7f..5b4992119948665a525daa804ad377d683a32ef6 100644 |
--- a/chrome/browser/extensions/shared_user_script_master.h |
+++ b/chrome/browser/extensions/extension_user_script_loader.h |
@@ -1,17 +1,15 @@ |
-// Copyright 2014 The Chromium Authors. All rights reserved. |
+// 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_SHARED_USER_SCRIPT_MASTER_H_ |
-#define CHROME_BROWSER_EXTENSIONS_SHARED_USER_SCRIPT_MASTER_H_ |
+#ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_USER_SCRIPT_LOADER_H_ |
+#define CHROME_BROWSER_EXTENSIONS_EXTENSION_USER_SCRIPT_LOADER_H_ |
-#include <set> |
- |
-#include "base/scoped_observer.h" |
+#include "base/memory/shared_memory.h" |
#include "chrome/browser/extensions/user_script_loader.h" |
#include "extensions/browser/extension_registry_observer.h" |
#include "extensions/common/extension.h" |
-#include "extensions/common/user_script.h" |
+#include "extensions/common/extension_set.h" |
Devlin
2015/01/21 23:25:20
Do we need this?
Xi Han
2015/01/22 17:19:36
Removed.
|
namespace content { |
class BrowserContext; |
@@ -21,44 +19,43 @@ class Profile; |
namespace extensions { |
+class ContentVerifier; |
class ExtensionRegistry; |
-// Manages statically-defined user scripts for all extensions. Owns a |
-// UserScriptLoader to which file loading and shared memory management |
-// operations are delegated. |
-class SharedUserScriptMaster : public ExtensionRegistryObserver { |
+// UserScriptLoader for extensions. |
+class ExtensionUserScriptLoader : public UserScriptLoader, |
+ public ExtensionRegistryObserver { |
public: |
- explicit SharedUserScriptMaster(Profile* profile); |
- ~SharedUserScriptMaster() override; |
- |
- // Provides access to loader state method: scripts_ready(). |
- bool scripts_ready() const { return loader_.scripts_ready(); } |
+ // 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: |
- // ExtensionRegistryObserver implementation. |
- void OnExtensionLoaded(content::BrowserContext* browser_context, |
- const Extension* extension) override; |
+ // UserScriptLoader: |
+ void UpdateConsumersInfo(const ConsumerIDSet& changed_consumers) override; |
+ LoadUserScriptsContentFunction GetLoadUserScriptsFunction() override; |
+ |
+ // ExtensionRegistryObserver: |
void OnExtensionUnloaded(content::BrowserContext* browser_context, |
const Extension* extension, |
UnloadedExtensionInfo::Reason reason) override; |
- // Gets an extension's scripts' metadata; i.e., gets a list of UserScript |
- // objects that contains script info, but not the contents of the scripts. |
- const std::set<UserScript> GetScriptsMetadata(const Extension* extension); |
- |
- // Script loader that handles loading contents of scripts into shared memory |
- // and notifying renderers of scripts in shared memory. |
- UserScriptLoader loader_; |
- |
- // The profile for which the scripts managed here are installed. |
- Profile* profile_; |
+ // Initiates script load when we have been waiting for the extension system |
+ // to be ready. |
+ void OnExtensionSystemReady(); |
ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver> |
extension_registry_observer_; |
- DISALLOW_COPY_AND_ASSIGN(SharedUserScriptMaster); |
+ base::WeakPtrFactory<ExtensionUserScriptLoader> weak_factory_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(ExtensionUserScriptLoader); |
}; |
} // namespace extensions |
-#endif // CHROME_BROWSER_EXTENSIONS_SHARED_USER_SCRIPT_MASTER_H_ |
+#endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_USER_SCRIPT_LOADER_H_ |