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 #ifndef CHROME_BROWSER_EXTENSIONS_API_DECLARATIVE_RULES_REGISTRY_STORAGE_DELEGAT
E_H__ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_DECLARATIVE_RULES_REGISTRY_STORAGE_DELEGAT
E_H__ |
6 #define CHROME_BROWSER_EXTENSIONS_API_DECLARATIVE_RULES_REGISTRY_STORAGE_DELEGAT
E_H__ | 6 #define CHROME_BROWSER_EXTENSIONS_API_DECLARATIVE_RULES_REGISTRY_STORAGE_DELEGAT
E_H__ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
12 | 12 |
13 #include "chrome/browser/extensions/api/declarative/rules_registry_with_cache.h" | 13 #include "chrome/browser/extensions/api/declarative/rules_registry_with_cache.h" |
14 | 14 |
15 class Profile; | 15 class Profile; |
16 | 16 |
17 namespace extensions { | 17 namespace extensions { |
18 | 18 |
19 // A Delegate to the RulesRegistryWithCache which handles reading/writing rules | 19 // A Delegate to the RulesRegistryWithCache which handles reading/writing rules |
20 // to the extension state store. This class should be initialized on the UI | 20 // to the extension state store. This class should be (de)initialized on the UI |
21 // thread, but used on the RulesRegistry thread. | 21 // thread, but used on the RulesRegistry thread. |
22 class RulesRegistryStorageDelegate : public RulesRegistryWithCache::Delegate { | 22 class RulesRegistryStorageDelegate : public RulesRegistryWithCache::Delegate { |
23 public: | 23 public: |
24 RulesRegistryStorageDelegate(); | 24 RulesRegistryStorageDelegate(); |
25 virtual ~RulesRegistryStorageDelegate(); | 25 virtual ~RulesRegistryStorageDelegate(); |
26 | 26 |
27 // Called on the UI thread to initialize the delegate. | 27 // Called on the UI thread to initialize the delegate. |
28 void Init(Profile* profile, | 28 void InitOnUIThread(Profile* profile, |
29 RulesRegistryWithCache* rules_registry, | 29 RulesRegistryWithCache* rules_registry, |
30 const std::string& storage_key); | 30 const std::string& storage_key); |
| 31 void CleanupOnUIThread(); |
31 | 32 |
32 // RulesRegistryWithCache::Delegate | 33 // RulesRegistryWithCache::Delegate |
33 virtual bool IsReady() OVERRIDE; | 34 virtual bool IsReady() OVERRIDE; |
34 virtual void OnRulesChanged(RulesRegistryWithCache* rules_registry, | 35 virtual void OnRulesChanged(RulesRegistryWithCache* rules_registry, |
35 const std::string& extension_id) OVERRIDE; | 36 const std::string& extension_id) OVERRIDE; |
36 | 37 |
37 private: | 38 private: |
38 class Inner; | 39 class Inner; |
39 | 40 |
40 scoped_refptr<Inner> inner_; | 41 scoped_refptr<Inner> inner_; |
41 }; | 42 }; |
42 | 43 |
43 } // namespace extensions | 44 } // namespace extensions |
44 | 45 |
45 #endif // CHROME_BROWSER_EXTENSIONS_API_DECLARATIVE_RULES_REGISTRY_STORAGE_DELE
GATE_H__ | 46 #endif // CHROME_BROWSER_EXTENSIONS_API_DECLARATIVE_RULES_REGISTRY_STORAGE_DELE
GATE_H__ |
OLD | NEW |