Index: chrome/browser/extensions/user_script_master.h |
diff --git a/chrome/browser/extensions/user_script_master.h b/chrome/browser/extensions/user_script_master.h |
index 2df53d8acf5fb433bd7aebae439909bdf6b9a575..658bb3c3c4b1d1c30d89bd0747009f0fde7cc64d 100644 |
--- a/chrome/browser/extensions/user_script_master.h |
+++ b/chrome/browser/extensions/user_script_master.h |
@@ -6,10 +6,16 @@ |
#define CHROME_BROWSER_EXTENSIONS_USER_SCRIPT_MASTER_H_ |
#pragma once |
+#include <map> |
+#include <string> |
+ |
#include "base/file_path.h" |
#include "base/gtest_prod_util.h" |
#include "base/memory/scoped_ptr.h" |
#include "base/shared_memory.h" |
+#include "chrome/browser/extensions/extension_info_map.h" |
+#include "chrome/common/extensions/extension_messages.h" |
+#include "chrome/common/extensions/extension_set.h" |
#include "chrome/common/extensions/user_script.h" |
#include "content/browser/browser_thread.h" |
#include "content/common/notification_observer.h" |
@@ -75,7 +81,6 @@ class UserScriptMaster : public base::RefCountedThreadSafe<UserScriptMaster>, |
} |
private: |
- private: |
FRIEND_TEST_ALL_PREFIXES(UserScriptMasterTest, SkipBOMAtTheBeginning); |
FRIEND_TEST_ALL_PREFIXES(UserScriptMasterTest, LeaveBOMNotAtTheBeginning); |
friend class base::RefCountedThreadSafe<UserScriptMaster::ScriptReloader>; |
@@ -83,8 +88,10 @@ class UserScriptMaster : public base::RefCountedThreadSafe<UserScriptMaster>, |
~ScriptReloader() {} |
// Where functions are run: |
- // master file |
- // StartLoad -> RunLoad |
+ // master file io |
+ // StartLoad -> GatherExtensionsInfo |
+ // info_map->extensions().Get... |
+ // RunLoad <- GatherExtensionsInfo |
// LoadUserScripts() |
// NotifyMaster <- RunLoad |
@@ -92,18 +99,32 @@ class UserScriptMaster : public base::RefCountedThreadSafe<UserScriptMaster>, |
// Notify the master that new scripts are available. |
void NotifyMaster(base::SharedMemory* memory); |
+ // Runs on IO thread. |
+ // Accesses the extension set in order to populate extensions_info_, |
+ // then drops to the File thread to execute RunLoad. |
+ void GatherExtensionsInfo(const ExtensionInfoMap* info_map, |
+ const UserScriptList& user_scripts); |
+ |
// Runs on the File thread. |
// Load the specified user scripts, calling NotifyMaster when done. |
// |user_scripts| is intentionally passed by value so its lifetime isn't |
// tied to the caller. |
void RunLoad(const UserScriptList& user_scripts); |
- static void LoadUserScripts(UserScriptList* user_scripts); |
+ void LoadUserScripts(UserScriptList* user_scripts); |
+ |
+ // Uses extensions_info_ to build a map of localization messages. |
+ // Returns NULL if |extension_id| is invalid. |
+ SubstitutionMap* GetLocalizationMessages(std::string extension_id); |
// A pointer back to our master. |
// May be NULL if DisownMaster() is called. |
UserScriptMaster* master_; |
+ // Maps extension info needed for localization to an extension ID. |
+ std::map<std::string, ExtensionSet::ExtensionPathAndDefaultLocale> |
+ extensions_info_; |
+ |
// The message loop to call our master back on. |
// Expected to always outlive us. |
BrowserThread::ID master_thread_id_; |