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

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

Issue 1909773002: Convert //extensions/browser from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 8 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 | « extensions/browser/declarative_user_script_master.h ('k') | extensions/browser/error_map.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 <stddef.h> 8 #include <stddef.h>
9 9
10 #include <deque> 10 #include <deque>
11 #include <map> 11 #include <map>
12 #include <memory>
12 #include <set> 13 #include <set>
13 #include <string> 14 #include <string>
14 15
15 #include "base/macros.h" 16 #include "base/macros.h"
16 #include "base/memory/scoped_ptr.h"
17 #include "extensions/browser/extension_error.h" 17 #include "extensions/browser/extension_error.h"
18 18
19 namespace extensions { 19 namespace extensions {
20 20
21 typedef std::deque<const ExtensionError*> ErrorList; 21 typedef std::deque<const ExtensionError*> ErrorList;
22 22
23 // An ErrorMap is responsible for storing Extension-related errors, keyed by 23 // An ErrorMap is responsible for storing Extension-related errors, keyed by
24 // Extension ID. The errors are owned by the ErrorMap, and are deleted upon 24 // Extension ID. The errors are owned by the ErrorMap, and are deleted upon
25 // destruction. 25 // destruction.
26 class ErrorMap { 26 class ErrorMap {
(...skipping 27 matching lines...) Expand all
54 const std::string restrict_to_extension_id; 54 const std::string restrict_to_extension_id;
55 const int restrict_to_type; 55 const int restrict_to_type;
56 const std::set<int> restrict_to_ids; 56 const std::set<int> restrict_to_ids;
57 const bool restrict_to_incognito; 57 const bool restrict_to_incognito;
58 }; 58 };
59 59
60 // Return the list of all errors associated with the given extension. 60 // Return the list of all errors associated with the given extension.
61 const ErrorList& GetErrorsForExtension(const std::string& extension_id) const; 61 const ErrorList& GetErrorsForExtension(const std::string& extension_id) const;
62 62
63 // Add the |error| to the ErrorMap. 63 // Add the |error| to the ErrorMap.
64 const ExtensionError* AddError(scoped_ptr<ExtensionError> error); 64 const ExtensionError* AddError(std::unique_ptr<ExtensionError> error);
65 65
66 // Removes errors that match the given |filter| from the map. If non-null, 66 // Removes errors that match the given |filter| from the map. If non-null,
67 // |affected_ids| will be populated with the set of extension ids that were 67 // |affected_ids| will be populated with the set of extension ids that were
68 // affected by this removal. 68 // affected by this removal.
69 void RemoveErrors(const Filter& filter, std::set<std::string>* affected_ids); 69 void RemoveErrors(const Filter& filter, std::set<std::string>* affected_ids);
70 70
71 // Remove all errors for all extensions, and clear the map. 71 // Remove all errors for all extensions, and clear the map.
72 void RemoveAllErrors(); 72 void RemoveAllErrors();
73 73
74 size_t size() const { return map_.size(); } 74 size_t size() const { return map_.size(); }
75 75
76 private: 76 private:
77 // An Entry is created for each Extension ID, and stores the errors related to 77 // An Entry is created for each Extension ID, and stores the errors related to
78 // that Extension. 78 // that Extension.
79 class ExtensionEntry; 79 class ExtensionEntry;
80 using EntryMap = std::map<std::string, ExtensionEntry*>; 80 using EntryMap = std::map<std::string, ExtensionEntry*>;
81 81
82 // The mapping between Extension IDs and their corresponding Entries. 82 // The mapping between Extension IDs and their corresponding Entries.
83 EntryMap map_; 83 EntryMap map_;
84 84
85 DISALLOW_COPY_AND_ASSIGN(ErrorMap); 85 DISALLOW_COPY_AND_ASSIGN(ErrorMap);
86 }; 86 };
87 87
88 } // namespace extensions 88 } // namespace extensions
89 89
90 #endif // EXTENSIONS_BROWSER_ERROR_MAP_H_ 90 #endif // EXTENSIONS_BROWSER_ERROR_MAP_H_
OLDNEW
« no previous file with comments | « extensions/browser/declarative_user_script_master.h ('k') | extensions/browser/error_map.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698