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

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

Issue 11547033: Implement declarativeContent API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Sync Created 7 years, 11 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/logging.h" 8 #include "base/logging.h"
9 #include "chrome/browser/extensions/api/declarative/initializing_rules_registry. h" 9 #include "chrome/browser/extensions/api/declarative/initializing_rules_registry. h"
10 #include "chrome/browser/extensions/api/declarative/rules_registry_storage_deleg ate.h" 10 #include "chrome/browser/extensions/api/declarative/rules_registry_storage_deleg ate.h"
11 #include "chrome/browser/extensions/api/declarative_content/content_constants.h"
12 #include "chrome/browser/extensions/api/declarative_content/content_rules_regist ry.h"
11 #include "chrome/browser/extensions/api/declarative_webrequest/webrequest_consta nts.h" 13 #include "chrome/browser/extensions/api/declarative_webrequest/webrequest_consta nts.h"
12 #include "chrome/browser/extensions/api/declarative_webrequest/webrequest_rules_ registry.h" 14 #include "chrome/browser/extensions/api/declarative_webrequest/webrequest_rules_ registry.h"
13 #include "chrome/browser/extensions/api/web_request/web_request_api.h" 15 #include "chrome/browser/extensions/api/web_request/web_request_api.h"
14 #include "chrome/common/chrome_notification_types.h" 16 #include "chrome/common/chrome_notification_types.h"
15 #include "chrome/common/extensions/extension.h" 17 #include "chrome/common/extensions/extension.h"
16 #include "content/public/browser/browser_thread.h" 18 #include "content/public/browser/browser_thread.h"
17 #include "content/public/browser/notification_details.h" 19 #include "content/public/browser/notification_details.h"
18 #include "content/public/browser/notification_source.h" 20 #include "content/public/browser/notification_source.h"
19 21
20 namespace extensions { 22 namespace extensions {
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 declarative_webrequest_constants::kOnRequest, 64 declarative_webrequest_constants::kOnRequest,
63 profile_->IsOffTheRecord())); 65 profile_->IsOffTheRecord()));
64 delegates_.push_back(delegate); 66 delegates_.push_back(delegate);
65 67
66 RegisterRulesRegistry(declarative_webrequest_constants::kOnRequest, 68 RegisterRulesRegistry(declarative_webrequest_constants::kOnRequest,
67 web_request_rules_registry); 69 web_request_rules_registry);
68 content::BrowserThread::PostTask( 70 content::BrowserThread::PostTask(
69 content::BrowserThread::IO, FROM_HERE, 71 content::BrowserThread::IO, FROM_HERE,
70 base::Bind(&RegisterToExtensionWebRequestEventRouterOnIO, 72 base::Bind(&RegisterToExtensionWebRequestEventRouterOnIO,
71 profile_, web_request_rules_registry)); 73 profile_, web_request_rules_registry));
74
75 #if defined(ENABLE_EXTENSIONS)
76 delegate = new RulesRegistryStorageDelegate();
77 scoped_refptr<ContentRulesRegistry> content_rules_registry(
78 new ContentRulesRegistry(profile_, delegate));
79 delegate->InitOnUIThread(profile_, content_rules_registry,
80 GetDeclarativeRuleStorageKey(
81 declarative_content_constants::kOnPageChanged,
82 profile_->IsOffTheRecord()));
83 delegates_.push_back(delegate);
84
85 RegisterRulesRegistry(declarative_content_constants::kOnPageChanged,
86 content_rules_registry);
87 content_rules_registry_ = content_rules_registry.get();
88 #endif // defined(ENABLE_EXTENSIONS)
72 } 89 }
73 90
74 void RulesRegistryService::Shutdown() { 91 void RulesRegistryService::Shutdown() {
75 content::BrowserThread::PostTask( 92 content::BrowserThread::PostTask(
76 content::BrowserThread::IO, FROM_HERE, 93 content::BrowserThread::IO, FROM_HERE,
77 base::Bind(&RegisterToExtensionWebRequestEventRouterOnIO, 94 base::Bind(&RegisterToExtensionWebRequestEventRouterOnIO,
78 profile_, scoped_refptr<WebRequestRulesRegistry>(NULL))); 95 profile_, scoped_refptr<WebRequestRulesRegistry>(NULL)));
79 } 96 }
80 97
81 void RulesRegistryService::RegisterRulesRegistry( 98 void RulesRegistryService::RegisterRulesRegistry(
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 OnExtensionUnloaded(extension->id()); 143 OnExtensionUnloaded(extension->id());
127 break; 144 break;
128 } 145 }
129 default: 146 default:
130 NOTREACHED(); 147 NOTREACHED();
131 break; 148 break;
132 } 149 }
133 } 150 }
134 151
135 } // namespace extensions 152 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698