|
|
Created:
4 years ago by Daniel Erat Modified:
4 years ago CC:
chromium-reviews, oshima+watch_chromium.org, davemoore+watch_chromium.org Target Ref:
refs/pending/heads/master Project:
chromium Visibility:
Public. |
Descriptionchromeos: Notify about Chrome note-taking apps.
Make NoteTakingHelper notify its observers when Chrome
note-taking apps are loaded or unloaded.
BUG=633596
Committed: https://crrev.com/e97a722caafc2d3a8b807ee115bfb307f7d2cfd9
Cr-Commit-Position: refs/heads/master@{#440174}
Patch Set 1 #Patch Set 2 : remove forward declaration of Extension #Patch Set 3 : track profiles and register with ExtensionRegistry #Patch Set 4 : work around profile lifecycle wonkiness in browser tests #
Total comments: 2
Patch Set 5 : use ScopedObserver #
Total comments: 4
Patch Set 6 : change CHECK to DCHECK #Patch Set 7 : drop NOTIFICATION_PROFILE_DESTROYED and instead stop observing registries on destruction #
Messages
Total messages: 38 (25 generated)
The CQ bit was checked by derat@chromium.org to run a CQ dry run
derat@chromium.org changed reviewers: + jdufault@chromium.org
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: This issue passed the CQ dry run.
The CQ bit was checked by derat@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
upon testing on a device with the followup change to add the setting, i realized that this code would probably work better if i actually registered as an ExtensionRegistry observer instead of just implementing the interface. :-P doing so resulted in some more profile-related test code.
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: Try jobs failed on following builders: linux_chromium_chromeos_rel_ng on master.tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_...)
The CQ bit was checked by derat@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: This issue passed the CQ dry run.
derat@chromium.org changed reviewers: + xiyuan@chromium.org
adding xiyuan as a reviewer since you're the gardener right now, jacob. :-) as background: this class will be used by settings to get a list of chrome note-taking apps (currently just whitelisted google keep IDs) and provide notifications when the apps are updated. this change makes it watch for extensions being added or removed.
Just one request. https://codereview.chromium.org/2587913006/diff/60001/chrome/browser/chromeos... File chrome/browser/chromeos/note_taking_helper.cc (right): https://codereview.chromium.org/2587913006/diff/60001/chrome/browser/chromeos... chrome/browser/chromeos/note_taking_helper.cc:264: extensions::ExtensionRegistry::Get(profile)->AddObserver(this); Suggest to use base::ScopedObserver. It can track multiple sources (ExtensionRegistry).
https://codereview.chromium.org/2587913006/diff/60001/chrome/browser/chromeos... File chrome/browser/chromeos/note_taking_helper.cc (right): https://codereview.chromium.org/2587913006/diff/60001/chrome/browser/chromeos... chrome/browser/chromeos/note_taking_helper.cc:264: extensions::ExtensionRegistry::Get(profile)->AddObserver(this); On 2016/12/21 16:46:51, xiyuan wrote: > Suggest to use base::ScopedObserver. It can track multiple sources > (ExtensionRegistry). thanks, i'd forgotten about ScopedObserver and additionally didn't know it could handle multiple sources! :-)
The CQ bit was checked by derat@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
lgtm https://codereview.chromium.org/2587913006/diff/80001/chrome/browser/chromeos... File chrome/browser/chromeos/note_taking_helper.cc (right): https://codereview.chromium.org/2587913006/diff/80001/chrome/browser/chromeos... chrome/browser/chromeos/note_taking_helper.cc:363: CHECK(!extension_registry_observer_.IsObserving(registry)); nit: DCHECK should be enough. NOTIFICATION_PROFILE_ADDED should only be fired once for a profile.
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: This issue passed the CQ dry run.
https://codereview.chromium.org/2587913006/diff/80001/chrome/browser/chromeos... File chrome/browser/chromeos/note_taking_helper.cc (right): https://codereview.chromium.org/2587913006/diff/80001/chrome/browser/chromeos... chrome/browser/chromeos/note_taking_helper.cc:363: CHECK(!extension_registry_observer_.IsObserving(registry)); On 2016/12/21 17:11:17, xiyuan wrote: > nit: DCHECK should be enough. NOTIFICATION_PROFILE_ADDED should only be fired > once for a profile. thanks, makes sense! i realized that i probably have a problem here due to ExtensionRegistry objects being shared between regular and incognito profiles: - i see _ADDED for regular profiles but not incognito ones (luckily, or else this check would be hit) - i see _DESTROYED for both regular and incognito profiles - there's a _CREATED notification that's presumably sent for both so if an incognito window is opened and then closed, i think i'll incorrectly stop observing the regular profile's registry when i see _DESTROYED for the incognito profile. one workaround might be not unregistering when _DESTROYED is received for an incognito profile, but i'm wondering if there's a cleaner way to handle this. any thoughts?
https://codereview.chromium.org/2587913006/diff/80001/chrome/browser/chromeos... File chrome/browser/chromeos/note_taking_helper.cc (right): https://codereview.chromium.org/2587913006/diff/80001/chrome/browser/chromeos... chrome/browser/chromeos/note_taking_helper.cc:363: CHECK(!extension_registry_observer_.IsObserving(registry)); On 2016/12/21 18:08:51, Daniel Erat wrote: > On 2016/12/21 17:11:17, xiyuan wrote: > > nit: DCHECK should be enough. NOTIFICATION_PROFILE_ADDED should only be fired > > once for a profile. > > thanks, makes sense! > > i realized that i probably have a problem here due to ExtensionRegistry objects > being shared between regular and incognito profiles: > > - i see _ADDED for regular profiles but not incognito ones (luckily, or else > this check would be hit) > - i see _DESTROYED for both regular and incognito profiles > - there's a _CREATED notification that's presumably sent for both > > so if an incognito window is opened and then closed, i think i'll incorrectly > stop observing the regular profile's registry when i see _DESTROYED for the > incognito profile. > > one workaround might be not unregistering when _DESTROYED is received for an > incognito profile, but i'm wondering if there's a cleaner way to handle this. > any thoughts? ExtensionRegistryObserver has an "OnShutdown" method. Maybe we clean up there instead of observing _DESTROYED?
https://codereview.chromium.org/2587913006/diff/80001/chrome/browser/chromeos... File chrome/browser/chromeos/note_taking_helper.cc (right): https://codereview.chromium.org/2587913006/diff/80001/chrome/browser/chromeos... chrome/browser/chromeos/note_taking_helper.cc:363: CHECK(!extension_registry_observer_.IsObserving(registry)); On 2016/12/21 18:19:41, xiyuan wrote: > On 2016/12/21 18:08:51, Daniel Erat wrote: > > On 2016/12/21 17:11:17, xiyuan wrote: > > > nit: DCHECK should be enough. NOTIFICATION_PROFILE_ADDED should only be > fired > > > once for a profile. > > > > thanks, makes sense! > > > > i realized that i probably have a problem here due to ExtensionRegistry > objects > > being shared between regular and incognito profiles: > > > > - i see _ADDED for regular profiles but not incognito ones (luckily, or else > > this check would be hit) > > - i see _DESTROYED for both regular and incognito profiles > > - there's a _CREATED notification that's presumably sent for both > > > > so if an incognito window is opened and then closed, i think i'll incorrectly > > stop observing the regular profile's registry when i see _DESTROYED for the > > incognito profile. > > > > one workaround might be not unregistering when _DESTROYED is received for an > > incognito profile, but i'm wondering if there's a cleaner way to handle this. > > any thoughts? > > ExtensionRegistryObserver has an "OnShutdown" method. Maybe we clean up there > instead of observing _DESTROYED? thanks for pointing it out; that's much cleaner.
The CQ bit was checked by derat@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
lgtm++
The CQ bit was unchecked by derat@chromium.org
The CQ bit was checked by derat@chromium.org
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
CQ is committing da patch. Bot data: {"patchset_id": 120001, "attempt_start_ts": 1482345927635910, "parent_rev": "212cdffe7365dd31e74249f6b90df05f17b503e2", "commit_rev": "206370b68b48ddb86c2dad7f26b95ff089d7271a"}
Message was sent while issue was closed.
Description was changed from ========== chromeos: Notify about Chrome note-taking apps. Make NoteTakingHelper notify its observers when Chrome note-taking apps are loaded or unloaded. BUG=633596 ========== to ========== chromeos: Notify about Chrome note-taking apps. Make NoteTakingHelper notify its observers when Chrome note-taking apps are loaded or unloaded. BUG=633596 Review-Url: https://codereview.chromium.org/2587913006 ==========
Message was sent while issue was closed.
Committed patchset #7 (id:120001)
Message was sent while issue was closed.
Description was changed from ========== chromeos: Notify about Chrome note-taking apps. Make NoteTakingHelper notify its observers when Chrome note-taking apps are loaded or unloaded. BUG=633596 Review-Url: https://codereview.chromium.org/2587913006 ========== to ========== chromeos: Notify about Chrome note-taking apps. Make NoteTakingHelper notify its observers when Chrome note-taking apps are loaded or unloaded. BUG=633596 Committed: https://crrev.com/e97a722caafc2d3a8b807ee115bfb307f7d2cfd9 Cr-Commit-Position: refs/heads/master@{#440174} ==========
Message was sent while issue was closed.
Patchset 7 (id:??) landed as https://crrev.com/e97a722caafc2d3a8b807ee115bfb307f7d2cfd9 Cr-Commit-Position: refs/heads/master@{#440174} |