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 |
11 #include "base/gtest_prod_util.h" | 11 #include "base/gtest_prod_util.h" |
12 #include "base/values.h" | 12 #include "base/values.h" |
13 #include "content/public/browser/browser_thread.h" | 13 #include "content/public/browser/browser_thread.h" |
14 | 14 |
15 class Profile; | 15 namespace content { |
| 16 class BrowserContext; |
| 17 } |
16 | 18 |
17 namespace extensions { | 19 namespace extensions { |
18 | 20 |
19 class RulesRegistry; | 21 class RulesRegistry; |
20 | 22 |
21 // RulesCacheDelegate implements the part of the RulesRegistry which works on | 23 // RulesCacheDelegate implements the part of the RulesRegistry which works on |
22 // the UI thread. It should only be used on the UI thread. | 24 // the UI thread. It should only be used on the UI thread. |
23 // If |log_storage_init_delay| is set, the delay caused by loading and | 25 // If |log_storage_init_delay| is set, the delay caused by loading and |
24 // registering rules on initialization will be logged with UMA. | 26 // registering rules on initialization will be logged with UMA. |
25 class RulesCacheDelegate { | 27 class RulesCacheDelegate { |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 scoped_ptr<base::Value> value); | 71 scoped_ptr<base::Value> value); |
70 | 72 |
71 // Check the preferences whether the extension with |extension_id| has some | 73 // Check the preferences whether the extension with |extension_id| has some |
72 // rules stored on disk. If this information is not in the preferences, true | 74 // rules stored on disk. If this information is not in the preferences, true |
73 // is returned as a safe default value. | 75 // is returned as a safe default value. |
74 bool GetDeclarativeRulesStored(const std::string& extension_id) const; | 76 bool GetDeclarativeRulesStored(const std::string& extension_id) const; |
75 // Modify the preference to |rules_stored|. | 77 // Modify the preference to |rules_stored|. |
76 void SetDeclarativeRulesStored(const std::string& extension_id, | 78 void SetDeclarativeRulesStored(const std::string& extension_id, |
77 bool rules_stored); | 79 bool rules_stored); |
78 | 80 |
79 Profile* profile_; | 81 content::BrowserContext* browser_context_; |
80 | 82 |
81 // The key under which rules are stored. | 83 // The key under which rules are stored. |
82 std::string storage_key_; | 84 std::string storage_key_; |
83 | 85 |
84 // The key under which we store whether the rules have been stored. | 86 // The key under which we store whether the rules have been stored. |
85 std::string rules_stored_key_; | 87 std::string rules_stored_key_; |
86 | 88 |
87 // A set of extension IDs that have rules we are reading from storage. | 89 // A set of extension IDs that have rules we are reading from storage. |
88 std::set<std::string> waiting_for_extensions_; | 90 std::set<std::string> waiting_for_extensions_; |
89 | 91 |
(...skipping 11 matching lines...) Expand all Loading... |
101 // We notified the RulesRegistry that the rules are loaded. | 103 // We notified the RulesRegistry that the rules are loaded. |
102 bool notified_registry_; | 104 bool notified_registry_; |
103 | 105 |
104 // Use this factory to generate weak pointers bound to the UI thread. | 106 // Use this factory to generate weak pointers bound to the UI thread. |
105 base::WeakPtrFactory<RulesCacheDelegate> weak_ptr_factory_; | 107 base::WeakPtrFactory<RulesCacheDelegate> weak_ptr_factory_; |
106 }; | 108 }; |
107 | 109 |
108 } // namespace extensions | 110 } // namespace extensions |
109 | 111 |
110 #endif // CHROME_BROWSER_EXTENSIONS_API_DECLARATIVE_RULES_CACHE_DELEGATE_H__ | 112 #endif // CHROME_BROWSER_EXTENSIONS_API_DECLARATIVE_RULES_CACHE_DELEGATE_H__ |
OLD | NEW |