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

Issue 4438001: First part to fix Bug 50726 "Save extension list and "winning" prefs from extensions" (Closed)

Created:
10 years, 1 month ago by battre (please use the other)
Modified:
9 years, 7 months ago
CC:
chromium-reviews, Erik does not do reviews, Paweł Hajdan Jr., pam+watch_chromium.org, ben+cc_chromium.org
Base URL:
http://git.chromium.org/git/chromium.git/@trunk
Visibility:
Public.

Description

The goal of this patch is to ensure that Chrome maintains the order in which extensions apply their preferences between restarts. This may be an issue if two extensions overwrite each others preferences. ExtensionPrefs has been extended to store and retrieve an ordered list of extension IDs, that correspond to the precedences of extensions. Extensions that appear further to the end of the list may override settings of extension closer to the beginning of the list. ExtensionPrefStore has been extended to use this storage capability and maintain the precedences according to the installation order. Newly installed extensions have a higher precedence than previously installed extensions. Upon restart of Chrome, the precedences are preserved. There is currently no code that uses the ExtensionPrefStore except for the unfinished Proxy API. This makes manual testing difficult. This is an alternative implementation to issue 4111015, http://codereview.chromium.org/4111015/show The difference: The datastructure of extension_stack_ has been modified. The key is no longer an |Extension *| but now an extension_id. This enables a simpler approach to achieve deterministic extension precedences. The extension_stack_ is lazily initialized the first time an extension preference is registered. At that time we put empty dictionaries in the right order onto the extension_stack_ (right order = respecting the precedences). This guarantees the precedence and does not require sorting the extension_stack_ as in CL 4111015. Advantage of this approach: - simpler (no sorting) - simpler to extend so that previously winning prefs can be restored Disadvantage of this approach: - comparison of extension ids is more expensive than comparison of pointers, but this should not be performance critical anyway Contributed by battre@google.com BUG=50726 TEST=none

Patch Set 1 #

Patch Set 2 : Fix whitespace #

Total comments: 7

Patch Set 3 : Addressed review comments (uniqueness of IDs and use of DCHECK) #

Patch Set 4 : Rebase to trunk #

Patch Set 5 : whitespaces #

Unified diffs Side-by-side diffs Delta from patch set Stats (+342 lines, -15 lines) Patch
M chrome/browser/extensions/extension_pref_store.h View 1 2 3 3 chunks +36 lines, -2 lines 0 comments Download
M chrome/browser/extensions/extension_pref_store.cc View 1 2 3 4 6 chunks +75 lines, -6 lines 0 comments Download
M chrome/browser/extensions/extension_pref_store_unittest.cc View 11 chunks +152 lines, -7 lines 0 comments Download
M chrome/browser/extensions/extension_prefs.h View 1 2 3 1 chunk +15 lines, -0 lines 0 comments Download
M chrome/browser/extensions/extension_prefs.cc View 1 2 3 3 chunks +39 lines, -0 lines 0 comments Download
M chrome/browser/extensions/extension_prefs_unittest.cc View 1 chunk +25 lines, -0 lines 0 comments Download

Messages

Total messages: 14 (0 generated)
battre (please use the other)
Hi Bernhard, this is an alternative implementation to CL 4111015 with the approach discussed on ...
10 years, 1 month ago (2010-11-03 23:09:16 UTC) #1
Pam (message me for reviews)
http://codereview.chromium.org/4438001/diff/8001/9002 File chrome/browser/extensions/extension_pref_store.h (right): http://codereview.chromium.org/4438001/diff/8001/9002#newcode123 chrome/browser/extensions/extension_pref_store.h:123: ExtensionPrefs(const std::string& extension_id, PrefValueMap* values); The problem is that ...
10 years, 1 month ago (2010-11-04 11:58:48 UTC) #2
Bernhard Bauer
http://codereview.chromium.org/4438001/diff/8001/9001 File chrome/browser/extensions/extension_pref_store.cc (right): http://codereview.chromium.org/4438001/diff/8001/9001#newcode215 chrome/browser/extensions/extension_pref_store.cc:215: } Nit: The usual way for these sanity checks ...
10 years, 1 month ago (2010-11-04 16:03:37 UTC) #3
battre (please use the other)
Hi Bernhard, I have addressed the comments (see below). Pam did not do a full ...
10 years, 1 month ago (2010-11-04 21:24:59 UTC) #4
Bernhard Bauer
On 2010/11/04 21:24:59, battre wrote: > Hi Bernhard, > > I have addressed the comments ...
10 years, 1 month ago (2010-11-05 10:51:48 UTC) #5
battre (please use the other)
Rebased
10 years, 1 month ago (2010-11-05 16:57:05 UTC) #6
Aaron Boodman
I've not really been a part of the conversations here, and I only glanced over ...
10 years, 1 month ago (2010-11-06 20:26:26 UTC) #7
battre (please use the other)
Hi Aaron, thanks for input. I think your suggestion would work as well. I don't ...
10 years, 1 month ago (2010-11-09 14:56:26 UTC) #8
Aaron Boodman
On Tue, Nov 9, 2010 at 6:56 AM, <battre@google.com> wrote: > thanks for input. I ...
10 years, 1 month ago (2010-11-09 15:10:37 UTC) #9
battre (please use the other)
On 2010/11/09 15:10:37, Aaron Boodman wrote: > On Tue, Nov 9, 2010 at 6:56 AM, ...
10 years, 1 month ago (2010-11-09 15:50:14 UTC) #10
Aaron Boodman
On 2010/11/09 15:50:14, battre wrote: > On 2010/11/09 15:10:37, Aaron Boodman wrote: > > On ...
10 years, 1 month ago (2010-11-09 22:45:39 UTC) #11
Pam (message me for reviews)
On Tue, Nov 9, 2010 at 11:45 PM, <aa@chromium.org> wrote: > On 2010/11/09 15:50:14, battre ...
10 years, 1 month ago (2010-11-10 07:42:56 UTC) #12
Aaron Boodman
On 2010/11/10 07:42:56, Pam wrote: > Although it affects performance, this is mainly to fit ...
10 years, 1 month ago (2010-11-10 17:58:37 UTC) #13
Erik does not do reviews
10 years, 1 month ago (2010-11-12 18:12:21 UTC) #14
+jochen

On Wed, Nov 10, 2010 at 9:58 AM, <aa@chromium.org> wrote:

> On 2010/11/10 07:42:56, Pam wrote:
>
>> Although it affects performance, this is mainly to fit the API expected by
>> the PrefValueStore. The latter is designed to access a Dictionary of prefs
>> from each PrefStore, so the ExtensionPrefStore needs to provide one
>> containing the current/active/winning values for each pref it stores.
>>
>
>  For background, the PrefValueStore coordinates preferences set by a number
>> of different PrefStores, ensuring that user preferences, command-line
>> options, prefs set by extensions, prefs set by administrator policy, etc.
>> override each other with the right priority.
>>
> ...
>
>  As Dominic describes, we also need to persist the precedence of those
>> browser preferences, so it comes up the same on restart. Furthermore, we
>> need to persist the winning values, so they're available before extensions
>> have loaded. These can be done either by saving the priority order of any
>> extensions that set browser preferences and the single winning values, or
>> by
>> also saving the whole stack of preferences that any extension has set. In
>> either case, although these are stored in the user profile directory like
>> a
>> user preference would be, that's only an implementation detail; they're
>> saved under separate keys from any actual user prefs.
>>
>
> I see.
>
> It seems like this is interesting enough to deserve a mini design doc, or
> just
> an email to chromium-dev. Has that happened?
>
>
> http://codereview.chromium.org/4438001/
>

Was chatting with Jochen about this this morning.  He's going to follow up
and see if we can get a design doc put together here.

Erik

Powered by Google App Engine
This is Rietveld 408576698