| Index: chrome/browser/extensions/api/declarative/rules_registry_with_cache.cc
|
| diff --git a/chrome/browser/extensions/api/declarative/rules_registry_with_cache.cc b/chrome/browser/extensions/api/declarative/rules_registry_with_cache.cc
|
| index a452130fb03c26eacd4b2a2c1590c28fdd0c1538..aeebde6e898451cd65a97fd909c3d3e11f6d192e 100644
|
| --- a/chrome/browser/extensions/api/declarative/rules_registry_with_cache.cc
|
| +++ b/chrome/browser/extensions/api/declarative/rules_registry_with_cache.cc
|
| @@ -60,12 +60,13 @@ std::vector<linked_ptr<extensions::RulesRegistry::Rule> > RulesFromValue(
|
| }
|
|
|
| // Returns the key to use for storing declarative rules in the state store.
|
| -std::string GetDeclarativeRuleStorageKey(const std::string& event_name,
|
| - bool incognito) {
|
| - if (incognito)
|
| - return "declarative_rules.incognito." + event_name;
|
| - else
|
| - return "declarative_rules." + event_name;
|
| +std::string GetDeclarativeRuleStorageKey(
|
| + const std::string& event_name,
|
| + bool incognito,
|
| + const extensions::RulesRegistry::WebViewKey& webview_key) {
|
| + return base::StringPrintf("declarative_rules%s.%s.%d.%d",
|
| + incognito ? ".incognito" : "",
|
| + event_name.c_str(), webview_key.first, webview_key.second);
|
| }
|
|
|
| } // namespace
|
| @@ -80,15 +81,17 @@ RulesRegistryWithCache::RulesRegistryWithCache(
|
| const std::string& event_name,
|
| content::BrowserThread::ID owner_thread,
|
| bool log_storage_init_delay,
|
| - scoped_ptr<RuleStorageOnUI>* ui_part)
|
| - : RulesRegistry(owner_thread, event_name),
|
| + scoped_ptr<RuleStorageOnUI>* ui_part,
|
| + const WebViewKey& webview_key)
|
| + : RulesRegistry(owner_thread, event_name, webview_key),
|
| weak_ptr_factory_(profile ? this : NULL),
|
| storage_on_ui_(
|
| (profile ? (new RuleStorageOnUI(profile,
|
| event_name,
|
| owner_thread,
|
| weak_ptr_factory_.GetWeakPtr(),
|
| - log_storage_init_delay))->GetWeakPtr()
|
| + log_storage_init_delay,
|
| + webview_key))->GetWeakPtr()
|
| : base::WeakPtr<RuleStorageOnUI>())),
|
| process_changed_rules_requested_(profile ? NOT_SCHEDULED_FOR_PROCESSING
|
| : NEVER_PROCESS) {
|
| @@ -276,12 +279,15 @@ RulesRegistryWithCache::RuleStorageOnUI::RuleStorageOnUI(
|
| const std::string& event_name,
|
| content::BrowserThread::ID rules_registry_thread,
|
| base::WeakPtr<RulesRegistryWithCache> registry,
|
| - bool log_storage_init_delay)
|
| + bool log_storage_init_delay,
|
| + const WebViewKey& webview_key)
|
| : profile_(profile),
|
| storage_key_(GetDeclarativeRuleStorageKey(event_name,
|
| - profile->IsOffTheRecord())),
|
| + profile->IsOffTheRecord(),
|
| + webview_key)),
|
| rules_stored_key_(GetRulesStoredKey(event_name,
|
| - profile->IsOffTheRecord())),
|
| + profile->IsOffTheRecord(),
|
| + webview_key)),
|
| log_storage_init_delay_(log_storage_init_delay),
|
| registry_(registry),
|
| rules_registry_thread_(rules_registry_thread),
|
| @@ -294,10 +300,12 @@ RulesRegistryWithCache::RuleStorageOnUI::~RuleStorageOnUI() {}
|
| // static
|
| std::string RulesRegistryWithCache::RuleStorageOnUI::GetRulesStoredKey(
|
| const std::string& event_name,
|
| - bool incognito) {
|
| - std::string result(kRulesStoredKey);
|
| - result += incognito ? ".incognito." : ".";
|
| - return result + event_name;
|
| + bool incognito,
|
| + const WebViewKey& webview_key) {
|
| + return base::StringPrintf("%s.%s%s.%d.%d",
|
| + kRulesStoredKey, incognito ? "incognito." : "",
|
| + event_name.c_str(),
|
| + webview_key.first, webview_key.second);
|
| }
|
|
|
| // This is called from the constructor of RulesRegistryWithCache, so it is
|
|
|