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

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

Issue 9595001: Apps on NTP should be in order of installation (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Unit test fixes Created 8 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/pending_extension_manager.h
diff --git a/chrome/browser/extensions/pending_extension_manager.h b/chrome/browser/extensions/pending_extension_manager.h
index 4aeecbfa029bc61b356fdbc0dac22568d0c46f9b..2c68ff262b646a802b31d7ea17b96eb8f2cd2875 100644
--- a/chrome/browser/extensions/pending_extension_manager.h
+++ b/chrome/browser/extensions/pending_extension_manager.h
@@ -6,8 +6,9 @@
#define CHROME_BROWSER_EXTENSIONS_PENDING_EXTENSION_MANAGER_H_
#pragma once
-#include <map>
+#include <list>
#include <string>
+#include <utility>
#include "chrome/browser/extensions/pending_extension_info.h"
#include "chrome/common/extensions/extension.h"
@@ -43,14 +44,13 @@ class PendingExtensionManager {
// TODO(skerner): Many of these methods can be private once code in
// ExtensionService is moved into methods of this class.
- // Remove |id| from the set of pending extensions.
- void Remove(const std::string& id);
+ // Remove extension with id |id| from the set of pending extensions. Returns
+ // true if such an extension was found and removed, false otherwise.
+ bool Remove(const std::string& id);
- // Get the information for a pending extension. Returns true and sets
- // |out_pending_extension_info| if there is a pending extension with id
- // |id|. Returns false otherwise.
- bool GetById(const std::string& id,
- PendingExtensionInfo* out_pending_extension_info) const;
+ // Get the information for a pending extension. Returns a pointer to the
+ // pending extension with id |id|, or NULL if there is no such extension.
+ const PendingExtensionInfo* GetById(const std::string& id) const;
// Is |id| in the set of pending extensions?
bool IsIdPending(const std::string& id) const;
@@ -84,14 +84,14 @@ class PendingExtensionManager {
Extension::Location location,
const Version& version);
- // Get the set of pending IDs that should be installed from an update URL.
+ // Get the list of pending IDs that should be installed from an update URL.
// Pending extensions that will be installed from local files will not be
// included in the set.
void GetPendingIdsForUpdateCheck(
- std::set<std::string>* out_ids_for_update_check) const;
+ std::list<std::string>* out_ids_for_update_check) const;
private:
- typedef std::map<std::string, PendingExtensionInfo> PendingExtensionMap;
+ typedef std::list<PendingExtensionInfo> PendingExtensionList;
// Assumes an extension with id |id| is not already installed.
// Return true if the extension was added.
@@ -107,8 +107,7 @@ class PendingExtensionManager {
// Add a pending extension record directly. Used for unit tests that need
// to set an inital state. Use friendship to allow the tests to call this
// method.
- void AddForTesting(const std::string& id,
- const PendingExtensionInfo& pending_etension_info);
+ void AddForTesting(const PendingExtensionInfo& pending_etension_info);
// Reference to the extension service whose pending extensions this class is
// managing. Because this class is a member of |service_|, it is created
@@ -116,8 +115,7 @@ class PendingExtensionManager {
// ExtensionServiceInterface.
const ExtensionServiceInterface& service_;
- // A map from extension id to the pending extension info for that extension.
- PendingExtensionMap pending_extension_map_;
+ PendingExtensionList pending_extension_list_;
FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest,
UpdatePendingExtensionAlreadyInstalled);

Powered by Google App Engine
This is Rietveld 408576698