Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(34)

Side by Side Diff: extensions/browser/error_map.h

Issue 563263002: Cleanup: cpplint from /extensions (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | extensions/browser/granted_file_entry.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <string> 10 #include <string>
11 11
12 #include "base/basictypes.h" 12 #include "base/basictypes.h"
13 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
14 #include "extensions/browser/extension_error.h" 14 #include "extensions/browser/extension_error.h"
15 15
16 namespace extensions { 16 namespace extensions {
17 17
18 typedef std::deque<const ExtensionError*> ErrorList; 18 typedef std::deque<const ExtensionError*> ErrorList;
19 19
20 // An ErrorMap is responsible for storing Extension-related errors, keyed by 20 // An ErrorMap is responsible for storing Extension-related errors, keyed by
21 // Extension ID. The errors are owned by the ErrorMap, and are deleted upon 21 // Extension ID. The errors are owned by the ErrorMap, and are deleted upon
22 // destruction. 22 // destruction.
23 class ErrorMap { 23 class ErrorMap {
24 public: 24 public:
25 explicit ErrorMap(); 25 ErrorMap();
26 ~ErrorMap(); 26 ~ErrorMap();
27 27
28 // Return the list of all errors associated with the given extension. 28 // Return the list of all errors associated with the given extension.
29 const ErrorList& GetErrorsForExtension(const std::string& extension_id) const; 29 const ErrorList& GetErrorsForExtension(const std::string& extension_id) const;
30 30
31 // Add the |error| to the ErrorMap. 31 // Add the |error| to the ErrorMap.
32 const ExtensionError* AddError(scoped_ptr<ExtensionError> error); 32 const ExtensionError* AddError(scoped_ptr<ExtensionError> error);
33 33
34 // Remove an extension from the ErrorMap, deleting all associated errors. 34 // Remove an extension from the ErrorMap, deleting all associated errors.
35 void Remove(const std::string& extension_id); 35 void Remove(const std::string& extension_id);
36 // Remove all errors of a given type for an extension. 36 // Remove all errors of a given type for an extension.
37 void RemoveErrorsForExtensionOfType(const std::string& extension_id, 37 void RemoveErrorsForExtensionOfType(const std::string& extension_id,
38 ExtensionError::Type type); 38 ExtensionError::Type type);
39 // Remove all incognito errors for all extensions. 39 // Remove all incognito errors for all extensions.
40 void RemoveIncognitoErrors(); 40 void RemoveIncognitoErrors();
41 // Remove all errors for all extensions, and clear the map. 41 // Remove all errors for all extensions, and clear the map.
42 void RemoveAllErrors(); 42 void RemoveAllErrors();
43 43
44 size_t size() const { return map_.size(); } 44 size_t size() const { return map_.size(); }
45 45
46 private: 46 private:
47 // An Entry is created for each Extension ID, and stores the errors related to 47 // An Entry is created for each Extension ID, and stores the errors related to
48 // that Extension. 48 // that Extension.
49 class ExtensionEntry { 49 class ExtensionEntry {
50 public: 50 public:
51 explicit ExtensionEntry(); 51 ExtensionEntry();
52 ~ExtensionEntry(); 52 ~ExtensionEntry();
53 53
54 // Delete all errors associated with this extension. 54 // Delete all errors associated with this extension.
55 void DeleteAllErrors(); 55 void DeleteAllErrors();
56 // Delete all incognito errors associated with this extension. 56 // Delete all incognito errors associated with this extension.
57 void DeleteIncognitoErrors(); 57 void DeleteIncognitoErrors();
58 // Delete all errors of the given |type| associated with this extension. 58 // Delete all errors of the given |type| associated with this extension.
59 void DeleteErrorsOfType(ExtensionError::Type type); 59 void DeleteErrorsOfType(ExtensionError::Type type);
60 60
61 // Add the error to the list, and return a weak reference. 61 // Add the error to the list, and return a weak reference.
(...skipping 13 matching lines...) Expand all
75 75
76 // The mapping between Extension IDs and their corresponding Entries. 76 // The mapping between Extension IDs and their corresponding Entries.
77 EntryMap map_; 77 EntryMap map_;
78 78
79 DISALLOW_COPY_AND_ASSIGN(ErrorMap); 79 DISALLOW_COPY_AND_ASSIGN(ErrorMap);
80 }; 80 };
81 81
82 } // namespace extensions 82 } // namespace extensions
83 83
84 #endif // EXTENSIONS_BROWSER_ERROR_MAP_H_ 84 #endif // EXTENSIONS_BROWSER_ERROR_MAP_H_
OLDNEW
« no previous file with comments | « no previous file | extensions/browser/granted_file_entry.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698