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

Issue 3323022: Create a DefaultPrefStore to hold registered application-default preference v... (Closed)

Created:
10 years, 3 months ago by Pam (message me for reviews)
Modified:
9 years, 5 months ago
CC:
chromium-reviews, cbentzel+watch_chromium.org, ben+cc_chromium.org, Erik does not do reviews, Aaron Boodman, pam+watch_chromium.org, Paweł Hajdan Jr., darin-cc_chromium.org
Visibility:
Public.

Description

Create a DefaultPrefStore to hold registered application-default preference values. Also rework preference notifications so they're not sent when a pref store rewrites the same value it already had, to avoid infinite recursion in places that set a pref in response to a notification that that pref has changed. This allows notifications to be sent properly when another PrefStore takes control from a default value. BUG=52719, 54950 TEST=covered by unit tests (PrefValueStoreTest.*, PrefNotifierTest.*, and ExtensionPrefStoreTest.*) Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=59345

Patch Set 1 #

Patch Set 2 : Minor formatting/wording changes #

Total comments: 15

Patch Set 3 : '' #

Patch Set 4 : '' #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+493 lines, -451 lines) Patch
M chrome/browser/cocoa/preferences_window_controller_unittest.mm View 1 2 3 1 chunk +1 line, -2 lines 0 comments Download
M chrome/browser/extensions/extension_pref_store.cc View 1 2 3 2 chunks +22 lines, -9 lines 0 comments Download
M chrome/browser/extensions/extension_pref_store_unittest.cc View 1 2 3 2 chunks +3 lines, -1 line 0 comments Download
M chrome/browser/net/chrome_url_request_context_unittest.cc View 1 2 3 2 chunks +4 lines, -1 line 0 comments Download
A chrome/browser/prefs/default_pref_store.h View 1 2 1 chunk +31 lines, -0 lines 0 comments Download
A chrome/browser/prefs/default_pref_store.cc View 1 chunk +21 lines, -0 lines 0 comments Download
M chrome/browser/prefs/pref_notifier.h View 1 2 3 3 chunks +10 lines, -9 lines 0 comments Download
M chrome/browser/prefs/pref_notifier.cc View 1 2 3 1 chunk +4 lines, -6 lines 0 comments Download
M chrome/browser/prefs/pref_notifier_unittest.cc View 1 2 3 9 chunks +20 lines, -17 lines 0 comments Download
M chrome/browser/prefs/pref_service.h View 1 2 3 8 chunks +27 lines, -19 lines 0 comments Download
M chrome/browser/prefs/pref_service.cc View 1 2 3 10 chunks +122 lines, -223 lines 0 comments Download
M chrome/browser/prefs/pref_service_unittest.cc View 1 2 3 3 chunks +9 lines, -0 lines 0 comments Download
M chrome/browser/prefs/pref_value_store.h View 1 2 3 7 chunks +43 lines, -41 lines 0 comments Download
M chrome/browser/prefs/pref_value_store.cc View 1 2 3 7 chunks +63 lines, -60 lines 1 comment Download
M chrome/browser/prefs/pref_value_store_unittest.cc View 1 2 3 14 chunks +103 lines, -59 lines 0 comments Download
M chrome/chrome_browser.gypi View 1 2 3 1 chunk +2 lines, -0 lines 0 comments Download
M chrome/test/testing_pref_service.h View 1 2 3 2 chunks +3 lines, -1 line 0 comments Download
M chrome/test/testing_pref_service.cc View 1 2 3 2 chunks +5 lines, -3 lines 0 comments Download

Messages

Total messages: 10 (0 generated)
Pam (message me for reviews)
Here's an expansion of the previous patch, including removing old_value from PrefHasChanged() and making that ...
10 years, 3 months ago (2010-09-10 10:22:27 UTC) #1
Mattias Nissler (ping if slow)
I've put some comments that suggest to move the whole change detection and notification business ...
10 years, 3 months ago (2010-09-10 11:49:41 UTC) #2
Pam (message me for reviews)
Requested changes made (except as noted below). Please take another look. - Pam http://codereview.chromium.org/3323022/diff/17001/18002 File ...
10 years, 3 months ago (2010-09-12 14:03:08 UTC) #3
Mattias Nissler (ping if slow)
I like the value_changed removal. It feels like we're now getting much closer to the ...
10 years, 3 months ago (2010-09-13 12:17:47 UTC) #4
Mattias Nissler (ping if slow)
Oh, and LGTM :)
10 years, 3 months ago (2010-09-13 12:17:59 UTC) #5
Nico
This probably caused http://code.google.com/p/chromium/issues/detail?id=55720
10 years, 3 months ago (2010-09-15 17:20:53 UTC) #6
jeanluc1
http://codereview.chromium.org/3323022/diff/36002/42013 File chrome/browser/prefs/pref_value_store.cc (right): http://codereview.chromium.org/3323022/diff/36002/42013#newcode96 chrome/browser/prefs/pref_value_store.cc:96: return rv && !PrefValueFromDefaultStore(path); This change modifies the behavior ...
10 years, 3 months ago (2010-09-21 04:16:39 UTC) #7
jeanluc1
Follow up to the previous message... For the current implementation of TemplateURLModel::LoadDefaultSearchProviderFromPrefs, there's a difference ...
10 years, 3 months ago (2010-09-21 04:27:11 UTC) #8
Pam (message me for reviews)
Previously, PrefValueStore::GetValue() ignored the default value and returned false if there was no "real" value ...
10 years, 3 months ago (2010-09-21 07:25:16 UTC) #9
jeanluc
10 years, 3 months ago (2010-09-21 07:42:59 UTC) #10
Never mind, I misunderstood the comment in HasPrefPath.  I'll look into
again in the morning and file a bug if there's still an issue.

Jean-Luc

On Tue, Sep 21, 2010 at 12:25 AM, <pam@chromium.org> wrote:

> Previously, PrefValueStore::GetValue() ignored the default value and
> returned
> false if there was no "real" value set. This CL kept the same behavior.
>
> Looking at TemplateURLModel::LoadDefaultSearchProviderFromPrefs, it's using
> these APIs in a nonstandard way (the PrefService really wants every
> preference
> to be registered), but it ought to still work. If the pref isn't
> registered,
> HasPrefPath will still return false; if it is registered, it should return
> the
> value set, or the default value of an empty string if nothing is set.
>
> What's it doing instead?
>
> About your second question, we don't currently have any established
> mechanism
> for migrating prefs. As far as I know, any that have needed it have done
> their
> own migration manually at the point of use.
>
> Rather than continuing discussion here, please file a bug report (or two)
> so we
> can track the problem and its fix.
>
> - Pam
>
>
> On 2010/09/21 04:27:11, jeanluc1 wrote:
>
>> Follow up to the previous message...
>>
>
>  For the current implementation of
>> TemplateURLModel::LoadDefaultSearchProviderFromPrefs, there's a difference
>> between not finding prefs::kDefaultSearchProviderSearchURL and finding it
>> but
>> with the default value of blank.  For the former, it means that no default
>> search have been set and we rely on built-in defaults.  For the latter, it
>>
> means
>
>> that the user has chosen to not have any defaults.
>>
>
>  This CL breaks this.
>>
>
>  For a different reason, the CL I'm working on adds a boolean
>> prefs::kDefaultSearchProviderEnabled.  That flag is needed because that's
>> the
>> way the Windows policy editor can disable a policy.  So I can change
>> LoadDefaultSearchProviderFromPrefs.  My question is... how can we
>> transition
>> existing preferences to the new scheme, i.e. if the path is there but
>> empty,
>>
> set
>
>> that boolean to false?
>>  having the pref of path  and havin
>>
>
>
>   would distingus
>>
>
>  The
>>
>
>  Umm, this problem might be a
>>
>
>
>
> http://codereview.chromium.org/3323022/show
>

Powered by Google App Engine
This is Rietveld 408576698