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

Unified Diff: chrome/browser/extensions/component_loader.h

Issue 2504333003: Fix DictionaryValue leak in component_loader.cc (Closed)
Patch Set: address comments + rewrite all loops Created 4 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/extensions/component_loader.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/component_loader.h
diff --git a/chrome/browser/extensions/component_loader.h b/chrome/browser/extensions/component_loader.h
index 0d34bef8b90e7bd8f33b9140d422332c4ad247f1..7dd607cadbd0fc97143f1d792e3931858a492b56 100644
--- a/chrome/browser/extensions/component_loader.h
+++ b/chrome/browser/extensions/component_loader.h
@@ -66,11 +66,6 @@ class ComponentLoader {
// extension with the same ID.
std::string AddOrReplace(const base::FilePath& path);
- // Returns the extension ID of a component extension specified by resource
- // id of its manifest file.
- std::string GetExtensionID(int manifest_resource_id,
- const base::FilePath& root_directory);
-
// Returns true if an extension with the specified id has been added.
bool Exists(const std::string& id) const;
@@ -92,9 +87,6 @@ class ComponentLoader {
// Similar to above but adds the default component extensions for kiosk mode.
void AddDefaultComponentExtensionsForKioskMode(bool skip_session_components);
- // Clear the list of registered extensions.
- void ClearAllRegistered();
-
// Reloads a registered component extension.
void Reload(const std::string& extension_id);
@@ -120,28 +112,36 @@ class ComponentLoader {
// Information about a registered component extension.
struct ComponentExtensionInfo {
- ComponentExtensionInfo(const base::DictionaryValue* manifest,
- const base::FilePath& root_directory);
+ ComponentExtensionInfo(
+ std::unique_ptr<base::DictionaryValue> manifest_param,
+ const base::FilePath& root_directory);
+ ~ComponentExtensionInfo();
+
+ ComponentExtensionInfo(ComponentExtensionInfo&& other);
+ ComponentExtensionInfo& operator=(ComponentExtensionInfo&& other);
// The parsed contents of the extensions's manifest file.
- const base::DictionaryValue* manifest;
+ std::unique_ptr<base::DictionaryValue> manifest;
// Directory where the extension is stored.
base::FilePath root_directory;
// The component extension's ID.
std::string extension_id;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(ComponentExtensionInfo);
};
// Parses the given JSON manifest. Returns nullptr if it cannot be parsed or
// if the result is not a DictionaryValue.
- base::DictionaryValue* ParseManifest(
+ std::unique_ptr<base::DictionaryValue> ParseManifest(
base::StringPiece manifest_contents) const;
std::string Add(const base::StringPiece& manifest_contents,
const base::FilePath& root_directory,
bool skip_whitelist);
- std::string Add(const base::DictionaryValue* parsed_manifest,
+ std::string Add(std::unique_ptr<base::DictionaryValue> parsed_manifest,
const base::FilePath& root_directory,
bool skip_whitelist);
« no previous file with comments | « no previous file | chrome/browser/extensions/component_loader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698