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

Unified Diff: chrome/browser/protector/protector_service.h

Issue 9968007: [protector] Support for collapsing multiple changes into a single one. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge Created 8 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/protector/protector_service.h
diff --git a/chrome/browser/protector/protector_service.h b/chrome/browser/protector/protector_service.h
index 7d0637d3541ac1c56237897615abe9071cfb1ea8..ba56448be2ffbb82db462dbb45897532c06587cf 100644
--- a/chrome/browser/protector/protector_service.h
+++ b/chrome/browser/protector/protector_service.h
@@ -71,15 +71,24 @@ class ProtectorService : public ProfileKeyedService,
private:
friend class ProtectorServiceTest;
- // Pair of error and corresponding change instance. linked_ptr is used because
- // Item instances are stored in a std::vector and must be copyable.
+ // Each item consists of an error and corresponding change instance.
+ // linked_ptr is used because Item instances are stored in a std::vector and
+ // must be copyable.
struct Item {
Item();
~Item();
linked_ptr<BaseSettingChange> change;
linked_ptr<SettingsChangeGlobalError> error;
+ // When true, this means |change| was merged with another instance and
+ // |error| is in process of being removed from GlobalErrorService.
+ bool was_merged;
+ // Meaningful only when |was_merged| is true. In that case, true means that
+ // the new merged GlobalError instance will be immediately shown.
+ bool show_when_merged;
};
+ typedef std::vector<Item> Items;
+
// Matches Item by |change| field.
class MatchItemByChange {
public:
@@ -102,6 +111,11 @@ class ProtectorService : public ProfileKeyedService,
const SettingsChangeGlobalError* other_;
};
+ // Returns an Item instance whose change can be merged with |change|, if any.
+ // Otherwise returns |NULL|. Provided that the merge strategy is transitive,
+ // there can be only one such instance.
+ Item* FindItemToMergeWith(const BaseSettingChange* change);
+
// ProfileKeyedService implementation.
virtual void Shutdown() OVERRIDE;
@@ -115,7 +129,7 @@ class ProtectorService : public ProfileKeyedService,
// Pointers to error bubble controllers and corresponding changes in the order
// added.
- std::vector<Item> items_;
+ Items items_;
// Profile which settings we are protecting.
Profile* profile_;
« no previous file with comments | « chrome/browser/protector/prefs_backup_invalid_change.cc ('k') | chrome/browser/protector/protector_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698