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

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

Issue 332413003: Cleanup: Remove #ifdefs in extensions code that is disabled on mobile. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 6 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 | Annotate | Revision Log
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 "chrome/browser/extensions/api/declarative/rules_registry_service.h" 5 #include "chrome/browser/extensions/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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 new WebRequestRulesRegistry(profile_, 80 new WebRequestRulesRegistry(profile_,
81 web_request_cache_delegate, 81 web_request_cache_delegate,
82 webview_key)); 82 webview_key));
83 83
84 RegisterRulesRegistry(web_request_rules_registry); 84 RegisterRulesRegistry(web_request_rules_registry);
85 content::BrowserThread::PostTask( 85 content::BrowserThread::PostTask(
86 content::BrowserThread::IO, FROM_HERE, 86 content::BrowserThread::IO, FROM_HERE,
87 base::Bind(&RegisterToExtensionWebRequestEventRouterOnIO, 87 base::Bind(&RegisterToExtensionWebRequestEventRouterOnIO,
88 profile_, webview_key, web_request_rules_registry)); 88 profile_, webview_key, web_request_rules_registry));
89 89
90 #if defined(ENABLE_EXTENSIONS)
91 // Only create a ContentRulesRegistry for regular pages and not webviews. 90 // Only create a ContentRulesRegistry for regular pages and not webviews.
92 if (!IsWebView(webview_key)) { 91 if (!IsWebView(webview_key)) {
93 RulesCacheDelegate* content_rules_cache_delegate = 92 RulesCacheDelegate* content_rules_cache_delegate =
94 new RulesCacheDelegate(false /*log_storage_init_delay*/); 93 new RulesCacheDelegate(false /*log_storage_init_delay*/);
95 cache_delegates_.push_back(content_rules_cache_delegate); 94 cache_delegates_.push_back(content_rules_cache_delegate);
96 scoped_refptr<ContentRulesRegistry> content_rules_registry( 95 scoped_refptr<ContentRulesRegistry> content_rules_registry(
97 new ContentRulesRegistry(profile_, content_rules_cache_delegate)); 96 new ContentRulesRegistry(profile_, content_rules_cache_delegate));
98 RegisterRulesRegistry(content_rules_registry); 97 RegisterRulesRegistry(content_rules_registry);
99 content_rules_registry_ = content_rules_registry.get(); 98 content_rules_registry_ = content_rules_registry.get();
100 } 99 }
101 #endif // defined(ENABLE_EXTENSIONS)
102 } 100 }
103 101
104 void RulesRegistryService::Shutdown() { 102 void RulesRegistryService::Shutdown() {
105 // Release the references to all registries. This would happen soon during 103 // Release the references to all registries. This would happen soon during
106 // destruction of |*this|, but we need the ExtensionWebRequestEventRouter to 104 // destruction of |*this|, but we need the ExtensionWebRequestEventRouter to
107 // be the last to reference the WebRequestRulesRegistry objects, so that 105 // be the last to reference the WebRequestRulesRegistry objects, so that
108 // the posted task below causes their destruction on the IO thread, not on UI 106 // the posted task below causes their destruction on the IO thread, not on UI
109 // where the destruction of |*this| takes place. 107 // where the destruction of |*this| takes place.
110 // TODO(vabr): Remove once http://crbug.com/218451#c6 gets addressed. 108 // TODO(vabr): Remove once http://crbug.com/218451#c6 gets addressed.
111 rule_registries_.clear(); 109 rule_registries_.clear();
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 const content::NotificationSource& source, 223 const content::NotificationSource& source,
226 const content::NotificationDetails& details) { 224 const content::NotificationDetails& details) {
227 DCHECK_EQ(content::NOTIFICATION_RENDERER_PROCESS_TERMINATED, type); 225 DCHECK_EQ(content::NOTIFICATION_RENDERER_PROCESS_TERMINATED, type);
228 226
229 content::RenderProcessHost* process = 227 content::RenderProcessHost* process =
230 content::Source<content::RenderProcessHost>(source).ptr(); 228 content::Source<content::RenderProcessHost>(source).ptr();
231 RemoveWebViewRulesRegistries(process->GetID()); 229 RemoveWebViewRulesRegistries(process->GetID());
232 } 230 }
233 231
234 } // namespace extensions 232 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/bookmarks/bookmarks_api.cc ('k') | chrome/browser/extensions/api/management/management_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698