| OLD | NEW |
| 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 Loading... |
| 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 delegate = new RulesRegistryStorageDelegate(); |
| 76 scoped_refptr<ContentRulesRegistry> content_rules_registry( |
| 77 new ContentRulesRegistry(profile_, delegate)); |
| 78 delegate->InitOnUIThread(profile_, content_rules_registry, |
| 79 GetDeclarativeRuleStorageKey( |
| 80 declarative_content_constants::kOnPageChanged, |
| 81 profile_->IsOffTheRecord())); |
| 82 delegates_.push_back(delegate); |
| 83 |
| 84 RegisterRulesRegistry(declarative_content_constants::kOnPageChanged, |
| 85 content_rules_registry); |
| 86 content_rules_registry_ = content_rules_registry.get(); |
| 72 } | 87 } |
| 73 | 88 |
| 74 void RulesRegistryService::Shutdown() { | 89 void RulesRegistryService::Shutdown() { |
| 75 content::BrowserThread::PostTask( | 90 content::BrowserThread::PostTask( |
| 76 content::BrowserThread::IO, FROM_HERE, | 91 content::BrowserThread::IO, FROM_HERE, |
| 77 base::Bind(&RegisterToExtensionWebRequestEventRouterOnIO, | 92 base::Bind(&RegisterToExtensionWebRequestEventRouterOnIO, |
| 78 profile_, scoped_refptr<WebRequestRulesRegistry>(NULL))); | 93 profile_, scoped_refptr<WebRequestRulesRegistry>(NULL))); |
| 79 } | 94 } |
| 80 | 95 |
| 81 void RulesRegistryService::RegisterRulesRegistry( | 96 void RulesRegistryService::RegisterRulesRegistry( |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 OnExtensionUnloaded(extension->id()); | 141 OnExtensionUnloaded(extension->id()); |
| 127 break; | 142 break; |
| 128 } | 143 } |
| 129 default: | 144 default: |
| 130 NOTREACHED(); | 145 NOTREACHED(); |
| 131 break; | 146 break; |
| 132 } | 147 } |
| 133 } | 148 } |
| 134 | 149 |
| 135 } // namespace extensions | 150 } // namespace extensions |
| OLD | NEW |