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

Issue 2578293002: Foreign tab suggestions should update when disabling sync or signing out. (Closed)

Created:
4 years ago by skym
Modified:
4 years ago
Reviewers:
Marc Treib, maxbogue
CC:
chromium-reviews, ntp-dev+reviews_chromium.org
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Foreign tab suggestions should update when disabling sync or signing out. Previously we were responding to OnSyncConfigurationCompleted by invoking our callback to regenerate suggestions. This covered initial sync setup, along with enabling or disabling any types from sync, in case Open Tabs was one of the types that was changing. However, when sync is completely disabled or the user signs out, we don't perform an configuration, but session data is no longer there. We want to clear our suggestions, but the hook we were using isn't called. The approach this CL takes is to switch to using OnStateChanged for this tracking. This event is called extremely often, for a variety of things. Because generating suggestions when there are actual sessions data is not computationally trivial, we only want to invoke the callback in TabDelegateSyncAdapter when it is reasonable to do so, so we've added a bool state variable to track the previous state, and only invoke the callback when we're transitioning between states. Note that this change does not mean that the current or any existing NTPs are going to remove their foreign sessions data. By having the ForeignSessionsSuggestionsProvider provide new suggestions, this current only seems to affect NTPs that are opened afterwards. BUG=669041 Committed: https://crrev.com/2fc56e330bdaef8b163ef126bb2a81c4d946ac43 Cr-Commit-Position: refs/heads/master@{#439578}

Patch Set 1 #

Patch Set 2 : Self review. #

Patch Set 3 : Removing a const gmock argument in hopes to fix msvc/gmock compile failure. #

Patch Set 4 : How about without the const at all. #

Patch Set 5 : Adding the const back to .cc #

Total comments: 10

Patch Set 6 : Updates for comments. #

Patch Set 7 : Updated comment again. #

Total comments: 1

Patch Set 8 : Updating comment. #

Patch Set 9 : Fixed more spelling errors. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+183 lines, -4 lines) Patch
M components/ntp_snippets/BUILD.gn View 1 2 3 4 5 1 chunk +1 line, -0 lines 0 comments Download
M components/ntp_snippets/sessions/tab_delegate_sync_adapter.h View 1 chunk +4 lines, -0 lines 0 comments Download
M components/ntp_snippets/sessions/tab_delegate_sync_adapter.cc View 1 2 3 4 5 6 7 8 1 chunk +24 lines, -2 lines 0 comments Download
A components/ntp_snippets/sessions/tab_delegate_sync_adapter_unittest.cc View 1 2 3 4 5 1 chunk +152 lines, -0 lines 0 comments Download
M components/sync_sessions/open_tabs_ui_delegate.h View 1 2 3 1 chunk +1 line, -1 line 0 comments Download
M components/sync_sessions/sessions_sync_manager.h View 1 2 3 1 chunk +1 line, -1 line 0 comments Download

Messages

Total messages: 40 (29 generated)
skym
PTAL. treib@ - ntp_snippets/ maxbogue@ - sync_sessions/
4 years ago (2016-12-16 16:45:20 UTC) #18
maxbogue
https://codereview.chromium.org/2578293002/diff/80001/components/ntp_snippets/sessions/tab_delegate_sync_adapter.cc File components/ntp_snippets/sessions/tab_delegate_sync_adapter.cc (right): https://codereview.chromium.org/2578293002/diff/80001/components/ntp_snippets/sessions/tab_delegate_sync_adapter.cc#newcode54 components/ntp_snippets/sessions/tab_delegate_sync_adapter.cc:54: // realize that this approach requires the data returned ...
4 years ago (2016-12-16 22:21:34 UTC) #21
Marc Treib
Sorry for the delay! ntp_snippets LGTM after maxbogue's comments are addressed; some more nits below. ...
4 years ago (2016-12-19 11:47:53 UTC) #22
skym
Updated for comments. https://codereview.chromium.org/2578293002/diff/80001/components/ntp_snippets/sessions/tab_delegate_sync_adapter.cc File components/ntp_snippets/sessions/tab_delegate_sync_adapter.cc (right): https://codereview.chromium.org/2578293002/diff/80001/components/ntp_snippets/sessions/tab_delegate_sync_adapter.cc#newcode54 components/ntp_snippets/sessions/tab_delegate_sync_adapter.cc:54: // realize that this approach requires ...
4 years ago (2016-12-19 20:31:43 UTC) #25
maxbogue
lgtm https://codereview.chromium.org/2578293002/diff/120001/components/ntp_snippets/sessions/tab_delegate_sync_adapter.cc File components/ntp_snippets/sessions/tab_delegate_sync_adapter.cc (right): https://codereview.chromium.org/2578293002/diff/120001/components/ntp_snippets/sessions/tab_delegate_sync_adapter.cc#newcode57 components/ntp_snippets/sessions/tab_delegate_sync_adapter.cc:57: // results. Fourtunately,this isn'ta problem. GetOpenTabsUIDelegate() is "Fourtunately,this ...
4 years ago (2016-12-19 20:35:16 UTC) #26
skym
4 years ago (2016-12-19 20:41:18 UTC) #27
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2578293002/140001
4 years ago (2016-12-19 20:42:38 UTC) #30
skym
4 years ago (2016-12-19 20:45:29 UTC) #32
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2578293002/160001
4 years ago (2016-12-19 20:46:21 UTC) #35
commit-bot: I haz the power
Committed patchset #9 (id:160001)
4 years ago (2016-12-19 21:45:24 UTC) #38
commit-bot: I haz the power
4 years ago (2016-12-19 21:47:22 UTC) #40
Message was sent while issue was closed.
Patchset 9 (id:??) landed as
https://crrev.com/2fc56e330bdaef8b163ef126bb2a81c4d946ac43
Cr-Commit-Position: refs/heads/master@{#439578}

Powered by Google App Engine
This is Rietveld 408576698