OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 EXTENSIONS_BROWSER_ERROR_MAP_H_ | 5 #ifndef EXTENSIONS_BROWSER_ERROR_MAP_H_ |
6 #define EXTENSIONS_BROWSER_ERROR_MAP_H_ | 6 #define EXTENSIONS_BROWSER_ERROR_MAP_H_ |
7 | 7 |
8 #include <deque> | 8 #include <deque> |
9 #include <map> | 9 #include <map> |
10 #include <set> | 10 #include <set> |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 const std::set<int> restrict_to_ids; | 53 const std::set<int> restrict_to_ids; |
54 const bool restrict_to_incognito; | 54 const bool restrict_to_incognito; |
55 }; | 55 }; |
56 | 56 |
57 // Return the list of all errors associated with the given extension. | 57 // Return the list of all errors associated with the given extension. |
58 const ErrorList& GetErrorsForExtension(const std::string& extension_id) const; | 58 const ErrorList& GetErrorsForExtension(const std::string& extension_id) const; |
59 | 59 |
60 // Add the |error| to the ErrorMap. | 60 // Add the |error| to the ErrorMap. |
61 const ExtensionError* AddError(scoped_ptr<ExtensionError> error); | 61 const ExtensionError* AddError(scoped_ptr<ExtensionError> error); |
62 | 62 |
63 // Removes errors that match the given |filter| from the map. | 63 // Removes errors that match the given |filter| from the map. If non-null, |
64 void RemoveErrors(const Filter& filter); | 64 // |affected_ids| will be populated with the set of extension ids that were |
| 65 // affected by this removal. |
| 66 void RemoveErrors(const Filter& filter, std::set<std::string>* affected_ids); |
65 | 67 |
66 // Remove all errors for all extensions, and clear the map. | 68 // Remove all errors for all extensions, and clear the map. |
67 void RemoveAllErrors(); | 69 void RemoveAllErrors(); |
68 | 70 |
69 size_t size() const { return map_.size(); } | 71 size_t size() const { return map_.size(); } |
70 | 72 |
71 private: | 73 private: |
72 // An Entry is created for each Extension ID, and stores the errors related to | 74 // An Entry is created for each Extension ID, and stores the errors related to |
73 // that Extension. | 75 // that Extension. |
74 class ExtensionEntry; | 76 class ExtensionEntry; |
75 using EntryMap = std::map<std::string, ExtensionEntry*>; | 77 using EntryMap = std::map<std::string, ExtensionEntry*>; |
76 | 78 |
77 // The mapping between Extension IDs and their corresponding Entries. | 79 // The mapping between Extension IDs and their corresponding Entries. |
78 EntryMap map_; | 80 EntryMap map_; |
79 | 81 |
80 DISALLOW_COPY_AND_ASSIGN(ErrorMap); | 82 DISALLOW_COPY_AND_ASSIGN(ErrorMap); |
81 }; | 83 }; |
82 | 84 |
83 } // namespace extensions | 85 } // namespace extensions |
84 | 86 |
85 #endif // EXTENSIONS_BROWSER_ERROR_MAP_H_ | 87 #endif // EXTENSIONS_BROWSER_ERROR_MAP_H_ |
OLD | NEW |