Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(13)

Side by Side Diff: extensions/browser/api/declarative/rules_registry_service.cc

Issue 596003002: Allow declarative webrequest and webrequest in extensions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #include "extensions/browser/api/declarative/rules_registry_service.h" 5 #include "extensions/browser/api/declarative/rules_registry_service.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/lazy_instance.h" 8 #include "base/lazy_instance.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 browser_context_, webview_key, web_request_rules_registry)); 88 browser_context_, webview_key, web_request_rules_registry));
89 89
90 // Only create a ContentRulesRegistry for regular pages and not webviews. 90 // Only create a ContentRulesRegistry for regular pages and not webviews.
91 if (!IsWebView(webview_key)) { 91 if (!IsWebView(webview_key)) {
92 RulesCacheDelegate* content_rules_cache_delegate = 92 RulesCacheDelegate* content_rules_cache_delegate =
93 new RulesCacheDelegate(false /*log_storage_init_delay*/); 93 new RulesCacheDelegate(false /*log_storage_init_delay*/);
94 cache_delegates_.push_back(content_rules_cache_delegate); 94 cache_delegates_.push_back(content_rules_cache_delegate);
95 scoped_refptr<ContentRulesRegistry> content_rules_registry = 95 scoped_refptr<ContentRulesRegistry> content_rules_registry =
96 ExtensionsAPIClient::Get()->CreateContentRulesRegistry( 96 ExtensionsAPIClient::Get()->CreateContentRulesRegistry(
97 browser_context_, content_rules_cache_delegate); 97 browser_context_, content_rules_cache_delegate);
98 RegisterRulesRegistry(content_rules_registry); 98 if (content_rules_registry.get() != nullptr) {
99 content_rules_registry_ = content_rules_registry.get(); 99 RegisterRulesRegistry(content_rules_registry);
100 content_rules_registry_ = content_rules_registry.get();
101 }
100 } 102 }
101 } 103 }
102 104
103 void RulesRegistryService::Shutdown() { 105 void RulesRegistryService::Shutdown() {
104 // Release the references to all registries. This would happen soon during 106 // Release the references to all registries. This would happen soon during
105 // destruction of |*this|, but we need the ExtensionWebRequestEventRouter to 107 // destruction of |*this|, but we need the ExtensionWebRequestEventRouter to
106 // be the last to reference the WebRequestRulesRegistry objects, so that 108 // be the last to reference the WebRequestRulesRegistry objects, so that
107 // the posted task below causes their destruction on the IO thread, not on UI 109 // the posted task below causes their destruction on the IO thread, not on UI
108 // where the destruction of |*this| takes place. 110 // where the destruction of |*this| takes place.
109 // TODO(vabr): Remove once http://crbug.com/218451#c6 gets addressed. 111 // TODO(vabr): Remove once http://crbug.com/218451#c6 gets addressed.
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 const content::NotificationSource& source, 227 const content::NotificationSource& source,
226 const content::NotificationDetails& details) { 228 const content::NotificationDetails& details) {
227 DCHECK_EQ(content::NOTIFICATION_RENDERER_PROCESS_TERMINATED, type); 229 DCHECK_EQ(content::NOTIFICATION_RENDERER_PROCESS_TERMINATED, type);
228 230
229 content::RenderProcessHost* process = 231 content::RenderProcessHost* process =
230 content::Source<content::RenderProcessHost>(source).ptr(); 232 content::Source<content::RenderProcessHost>(source).ptr();
231 RemoveWebViewRulesRegistries(process->GetID()); 233 RemoveWebViewRulesRegistries(process->GetID());
232 } 234 }
233 235
234 } // namespace extensions 236 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/browser/api/declarative/declarative_api.cc ('k') | extensions/browser/api/extensions_api_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698