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_storage_deleg
ate.h" | 5 #include "chrome/browser/extensions/api/declarative/rules_registry_storage_deleg
ate.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "chrome/browser/extensions/extension_system.h" | 8 #include "chrome/browser/extensions/extension_system.h" |
9 #include "chrome/browser/extensions/state_store.h" | 9 #include "chrome/browser/extensions/state_store.h" |
10 #include "chrome/common/chrome_notification_types.h" | 10 #include "chrome/common/chrome_notification_types.h" |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 void RulesRegistryStorageDelegate::Inner::Observe( | 171 void RulesRegistryStorageDelegate::Inner::Observe( |
172 int type, | 172 int type, |
173 const content::NotificationSource& source, | 173 const content::NotificationSource& source, |
174 const content::NotificationDetails& details) { | 174 const content::NotificationDetails& details) { |
175 if (type == chrome::NOTIFICATION_EXTENSION_LOADED) { | 175 if (type == chrome::NOTIFICATION_EXTENSION_LOADED) { |
176 const extensions::Extension* extension = | 176 const extensions::Extension* extension = |
177 content::Details<const extensions::Extension>(details).ptr(); | 177 content::Details<const extensions::Extension>(details).ptr(); |
178 // TODO(mpcomplete): This API check should generalize to any use of | 178 // TODO(mpcomplete): This API check should generalize to any use of |
179 // declarative rules, not just webRequest. | 179 // declarative rules, not just webRequest. |
180 if (extension->HasAPIPermission( | 180 if (extension->HasAPIPermission( |
181 ExtensionAPIPermission::kDeclarativeWebRequest)) { | 181 APIPermission::kDeclarativeWebRequest)) { |
182 ReadFromStorage(extension->id()); | 182 ReadFromStorage(extension->id()); |
183 } | 183 } |
184 } else if (type == chrome::NOTIFICATION_EXTENSIONS_READY) { | 184 } else if (type == chrome::NOTIFICATION_EXTENSIONS_READY) { |
185 CheckIfReady(); | 185 CheckIfReady(); |
186 } | 186 } |
187 } | 187 } |
188 | 188 |
189 void RulesRegistryStorageDelegate::Inner::ReadFromStorage( | 189 void RulesRegistryStorageDelegate::Inner::ReadFromStorage( |
190 const std::string& extension_id) { | 190 const std::string& extension_id) { |
191 extensions::StateStore* store = ExtensionSystem::Get(profile_)->state_store(); | 191 extensions::StateStore* store = ExtensionSystem::Get(profile_)->state_store(); |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 void RulesRegistryStorageDelegate::Inner::NotifyReadyOnRegistryThread() { | 238 void RulesRegistryStorageDelegate::Inner::NotifyReadyOnRegistryThread() { |
239 DCHECK(content::BrowserThread::CurrentlyOn(rules_registry_thread_)); | 239 DCHECK(content::BrowserThread::CurrentlyOn(rules_registry_thread_)); |
240 if (ready_) | 240 if (ready_) |
241 return; // we've already notified our readiness | 241 return; // we've already notified our readiness |
242 | 242 |
243 ready_ = true; | 243 ready_ = true; |
244 rules_registry_->OnReady(); | 244 rules_registry_->OnReady(); |
245 } | 245 } |
246 | 246 |
247 } // namespace extensions | 247 } // namespace extensions |
OLD | NEW |