OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_CACHE_DELEGATE_H__ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_DECLARATIVE_RULES_CACHE_DELEGATE_H__ |
6 #define CHROME_BROWSER_EXTENSIONS_API_DECLARATIVE_RULES_CACHE_DELEGATE_H__ | 6 #define CHROME_BROWSER_EXTENSIONS_API_DECLARATIVE_RULES_CACHE_DELEGATE_H__ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 24 matching lines...) Expand all Loading... |
35 static std::string GetRulesStoredKey(const std::string& event_name, | 35 static std::string GetRulesStoredKey(const std::string& event_name, |
36 bool incognito); | 36 bool incognito); |
37 | 37 |
38 // Initialize the storage functionality. | 38 // Initialize the storage functionality. |
39 void Init(RulesRegistry* registry); | 39 void Init(RulesRegistry* registry); |
40 | 40 |
41 void WriteToStorage(const std::string& extension_id, | 41 void WriteToStorage(const std::string& extension_id, |
42 scoped_ptr<base::Value> value); | 42 scoped_ptr<base::Value> value); |
43 | 43 |
44 base::WeakPtr<RulesCacheDelegate> GetWeakPtr() { | 44 base::WeakPtr<RulesCacheDelegate> GetWeakPtr() { |
45 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 45 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
46 return weak_ptr_factory_.GetWeakPtr(); | 46 return weak_ptr_factory_.GetWeakPtr(); |
47 } | 47 } |
48 | 48 |
49 private: | 49 private: |
50 FRIEND_TEST_ALL_PREFIXES(RulesRegistryWithCacheTest, | 50 FRIEND_TEST_ALL_PREFIXES(RulesRegistryWithCacheTest, |
51 DeclarativeRulesStored); | 51 DeclarativeRulesStored); |
52 FRIEND_TEST_ALL_PREFIXES(RulesRegistryWithCacheTest, | 52 FRIEND_TEST_ALL_PREFIXES(RulesRegistryWithCacheTest, |
53 RulesStoredFlagMultipleRegistries); | 53 RulesStoredFlagMultipleRegistries); |
54 | 54 |
55 static const char kRulesStoredKey[]; | 55 static const char kRulesStoredKey[]; |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 // We notified the RulesRegistry that the rules are loaded. | 101 // We notified the RulesRegistry that the rules are loaded. |
102 bool notified_registry_; | 102 bool notified_registry_; |
103 | 103 |
104 // Use this factory to generate weak pointers bound to the UI thread. | 104 // Use this factory to generate weak pointers bound to the UI thread. |
105 base::WeakPtrFactory<RulesCacheDelegate> weak_ptr_factory_; | 105 base::WeakPtrFactory<RulesCacheDelegate> weak_ptr_factory_; |
106 }; | 106 }; |
107 | 107 |
108 } // namespace extensions | 108 } // namespace extensions |
109 | 109 |
110 #endif // CHROME_BROWSER_EXTENSIONS_API_DECLARATIVE_RULES_CACHE_DELEGATE_H__ | 110 #endif // CHROME_BROWSER_EXTENSIONS_API_DECLARATIVE_RULES_CACHE_DELEGATE_H__ |
OLD | NEW |