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

Issue 2361513003: MD History: Update sign in state in data source (Closed)

Created:
4 years, 3 months ago by lshang
Modified:
4 years, 2 months ago
Reviewers:
calamity, Dan Beam
CC:
chromium-reviews, asanka, Patrick Dubroy, michaelpg+watch-md-ui_chromium.org, dbeam+watch-history_chromium.org, pam+watch_chromium.org, arv+watch_chromium.org, dbeam+watch-downloads_chromium.org, chrome-apps-syd-reviews_chromium.org, tsergeant
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

MD History: Update sign in state in data source Currently we get user's sign in state from LoadTimeData() on page load, but WebUI data source is re-used when refreshing the page, which will cause bugs if user changes sign in state(e.g. via sign in promo) and reload the page because LoadTimeData() will return out-dated sign in state. We made a quick fix before by chrome.sending 'otherDevicesInitialized' after synced device manager is attached to the document, so that signInStateChanged() gets called to update element's current state. But this would cause a *fake* sign-in action(when user signs in via promo and reload, signInState will first be set false from LoadTimeData and then changes to be true from otherDevicesInitialized) and 'Loading' message will keeps showing if no other actions trigger updateSyncedDevices() to stop the fetching state. So in this CL, we update the sign in state in WebUI data source, when profile info changed in HistoryLoginHandler. This will guarantee that LoadTimeData() returns updated state every time page gets loaded. BUG=639811 CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:closure_compilation Committed: https://crrev.com/93a39a3cfff736b8e10f65e9d7bf2612186a26c8 Cr-Commit-Position: refs/heads/master@{#422038}

Patch Set 1 #

Patch Set 2 : remove downloads #

Total comments: 8

Patch Set 3 : rewrite #

Patch Set 4 : remove extra line #

Patch Set 5 : try another approach #

Total comments: 9

Patch Set 6 : use callback #

Patch Set 7 : debug crash #

Patch Set 8 : fix promo crash #

Total comments: 8

Patch Set 9 : add get method #

Total comments: 12

Patch Set 10 : just create #

Patch Set 11 : remove unused forward declare #

Total comments: 4

Patch Set 12 : address #

Total comments: 2

Patch Set 13 : move #

Unified diffs Side-by-side diffs Delta from patch set Stats (+67 lines, -21 lines) Patch
M chrome/browser/resources/history/other_devices.js View 1 2 3 4 5 6 1 chunk +2 lines, -0 lines 0 comments Download
M chrome/browser/resources/md_history/app.html View 1 2 3 4 5 1 chunk +1 line, -0 lines 0 comments Download
M chrome/browser/resources/md_history/app.js View 1 2 3 4 5 6 2 chunks +10 lines, -1 line 0 comments Download
M chrome/browser/resources/md_history/app.crisper.js View 1 2 3 4 5 2 chunks +7 lines, -3 lines 0 comments Download
M chrome/browser/resources/md_history/compiled_resources2.gyp View 1 2 3 4 5 1 chunk +1 line, -0 lines 0 comments Download
M chrome/browser/resources/md_history/lazy_load.vulcanized.html View 1 2 3 4 5 1 chunk +1 line, -0 lines 0 comments Download
M chrome/browser/ui/webui/history_login_handler.h View 1 2 3 4 5 6 7 8 9 10 3 chunks +4 lines, -1 line 0 comments Download
M chrome/browser/ui/webui/history_login_handler.cc View 1 2 3 4 5 6 7 8 9 3 chunks +13 lines, -3 lines 0 comments Download
M chrome/browser/ui/webui/history_ui.h View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +2 lines, -0 lines 0 comments Download
M chrome/browser/ui/webui/history_ui.cc View 1 2 3 4 5 6 7 8 9 10 11 12 3 chunks +11 lines, -3 lines 0 comments Download
M chrome/browser/ui/webui/md_history_ui.h View 1 2 3 4 5 6 7 8 9 10 11 2 chunks +2 lines, -5 lines 0 comments Download
M chrome/browser/ui/webui/md_history_ui.cc View 1 2 3 4 5 6 7 8 9 10 11 2 chunks +13 lines, -5 lines 0 comments Download

Messages

Total messages: 41 (18 generated)
lshang
PTAL thanks!
4 years, 3 months ago (2016-09-22 06:50:13 UTC) #6
calamity
https://codereview.chromium.org/2361513003/diff/20001/chrome/browser/ui/webui/history_login_handler.cc File chrome/browser/ui/webui/history_login_handler.cc (right): https://codereview.chromium.org/2361513003/diff/20001/chrome/browser/ui/webui/history_login_handler.cc#newcode54 chrome/browser/ui/webui/history_login_handler.cc:54: web_ui()->CallJavascriptFunctionUnsafe("updateSignInState", Can we just update what we need to ...
4 years, 3 months ago (2016-09-22 08:16:29 UTC) #7
Dan Beam
https://codereview.chromium.org/2361513003/diff/20001/chrome/browser/ui/webui/history_login_handler.cc File chrome/browser/ui/webui/history_login_handler.cc (right): https://codereview.chromium.org/2361513003/diff/20001/chrome/browser/ui/webui/history_login_handler.cc#newcode14 chrome/browser/ui/webui/history_login_handler.cc:14: #include "chrome/browser/ui/webui/md_history_ui.cc" whoa whoa whoa, don't include a .cc ...
4 years, 3 months ago (2016-09-22 18:18:53 UTC) #8
Dan Beam
https://codereview.chromium.org/2361513003/diff/20001/chrome/browser/ui/webui/history_login_handler.cc File chrome/browser/ui/webui/history_login_handler.cc (right): https://codereview.chromium.org/2361513003/diff/20001/chrome/browser/ui/webui/history_login_handler.cc#newcode14 chrome/browser/ui/webui/history_login_handler.cc:14: #include "chrome/browser/ui/webui/md_history_ui.cc" On 2016/09/22 18:18:52, Dan Beam wrote: > ...
4 years, 3 months ago (2016-09-22 18:19:27 UTC) #10
lshang
Hi Chris & Dan, I've rewritten this fix. Now the approach is: updateSignInState(JS) gets called ...
4 years, 3 months ago (2016-09-23 02:00:01 UTC) #11
Dan Beam
I think this flow is kind of in reverse. the C++ knows the signed in ...
4 years, 3 months ago (2016-09-23 06:12:16 UTC) #12
lshang
On 2016/09/23 06:12:16, Dan Beam wrote: > I think this flow is kind of in ...
4 years, 2 months ago (2016-09-27 08:11:17 UTC) #13
Dan Beam
https://codereview.chromium.org/2361513003/diff/80001/chrome/browser/ui/webui/history_login_handler.cc File chrome/browser/ui/webui/history_login_handler.cc (right): https://codereview.chromium.org/2361513003/diff/80001/chrome/browser/ui/webui/history_login_handler.cc#newcode48 chrome/browser/ui/webui/history_login_handler.cc:48: AllowJavascript(); you only want to call AllowJavascript() when the ...
4 years, 2 months ago (2016-09-27 23:16:23 UTC) #14
calamity
https://codereview.chromium.org/2361513003/diff/80001/chrome/browser/resources/md_history/synced_device_manager.js File chrome/browser/resources/md_history/synced_device_manager.js (left): https://codereview.chromium.org/2361513003/diff/80001/chrome/browser/resources/md_history/synced_device_manager.js#oldcode71 chrome/browser/resources/md_history/synced_device_manager.js:71: chrome.send('otherDevicesInitialized'); You can keep this in and then AllowJavascript() ...
4 years, 2 months ago (2016-09-28 02:54:23 UTC) #15
Dan Beam
https://codereview.chromium.org/2361513003/diff/80001/chrome/browser/resources/md_history/app.js File chrome/browser/resources/md_history/app.js (right): https://codereview.chromium.org/2361513003/diff/80001/chrome/browser/resources/md_history/app.js#newcode113 chrome/browser/resources/md_history/app.js:113: this.updateSignInState.bind(this)); this part is perfect :) https://codereview.chromium.org/2361513003/diff/80001/chrome/browser/ui/webui/history_login_handler.cc File chrome/browser/ui/webui/history_login_handler.cc ...
4 years, 2 months ago (2016-09-28 03:56:49 UTC) #16
Dan Beam
On 2016/09/28 02:54:23, calamity wrote: > https://codereview.chromium.org/2361513003/diff/80001/chrome/browser/resources/md_history/synced_device_manager.js > File chrome/browser/resources/md_history/synced_device_manager.js (left): > > https://codereview.chromium.org/2361513003/diff/80001/chrome/browser/resources/md_history/synced_device_manager.js#oldcode71 > ...
4 years, 2 months ago (2016-09-28 04:24:28 UTC) #17
lshang
Hi Dan, please take a look at the newest patch and the comments I added ...
4 years, 2 months ago (2016-09-29 08:06:48 UTC) #24
Dan Beam
https://codereview.chromium.org/2361513003/diff/140001/chrome/browser/ui/webui/md_history_ui.cc File chrome/browser/ui/webui/md_history_ui.cc (right): https://codereview.chromium.org/2361513003/diff/140001/chrome/browser/ui/webui/md_history_ui.cc#newcode227 chrome/browser/ui/webui/md_history_ui.cc:227: &MdHistoryUI::SignInChanged, weak_ptr_factory_.GetWeakPtr()))); you can use weakptr, but now that ...
4 years, 2 months ago (2016-09-29 18:13:34 UTC) #27
lshang
https://codereview.chromium.org/2361513003/diff/140001/chrome/browser/ui/webui/md_history_ui.cc File chrome/browser/ui/webui/md_history_ui.cc (right): https://codereview.chromium.org/2361513003/diff/140001/chrome/browser/ui/webui/md_history_ui.cc#newcode227 chrome/browser/ui/webui/md_history_ui.cc:227: &MdHistoryUI::SignInChanged, weak_ptr_factory_.GetWeakPtr()))); On 2016/09/29 18:13:33, Dan Beam wrote: > ...
4 years, 2 months ago (2016-09-30 00:33:19 UTC) #28
Dan Beam
https://codereview.chromium.org/2361513003/diff/160001/chrome/browser/ui/webui/history_login_handler.cc File chrome/browser/ui/webui/history_login_handler.cc (right): https://codereview.chromium.org/2361513003/diff/160001/chrome/browser/ui/webui/history_login_handler.cc#newcode9 chrome/browser/ui/webui/history_login_handler.cc:9: #include "base/callback_forward.h" base/callback.h https://codereview.chromium.org/2361513003/diff/160001/chrome/browser/ui/webui/history_login_handler.h File chrome/browser/ui/webui/history_login_handler.h (right): https://codereview.chromium.org/2361513003/diff/160001/chrome/browser/ui/webui/history_login_handler.h#newcode9 chrome/browser/ui/webui/history_login_handler.h:9: ...
4 years, 2 months ago (2016-09-30 00:47:43 UTC) #29
lshang
https://codereview.chromium.org/2361513003/diff/160001/chrome/browser/ui/webui/history_login_handler.cc File chrome/browser/ui/webui/history_login_handler.cc (right): https://codereview.chromium.org/2361513003/diff/160001/chrome/browser/ui/webui/history_login_handler.cc#newcode9 chrome/browser/ui/webui/history_login_handler.cc:9: #include "base/callback_forward.h" On 2016/09/30 00:47:43, Dan Beam wrote: > ...
4 years, 2 months ago (2016-09-30 01:31:08 UTC) #30
Dan Beam
lgtm https://codereview.chromium.org/2361513003/diff/160001/chrome/browser/ui/webui/history_ui.cc File chrome/browser/ui/webui/history_ui.cc (right): https://codereview.chromium.org/2361513003/diff/160001/chrome/browser/ui/webui/history_ui.cc#newcode219 chrome/browser/ui/webui/history_ui.cc:219: return data_source; On 2016/09/30 01:31:08, lshang wrote: > ...
4 years, 2 months ago (2016-09-30 02:55:40 UTC) #31
lshang
https://codereview.chromium.org/2361513003/diff/160001/chrome/browser/ui/webui/history_ui.cc File chrome/browser/ui/webui/history_ui.cc (right): https://codereview.chromium.org/2361513003/diff/160001/chrome/browser/ui/webui/history_ui.cc#newcode219 chrome/browser/ui/webui/history_ui.cc:219: return data_source; On 2016/09/30 02:55:40, Dan Beam wrote: > ...
4 years, 2 months ago (2016-09-30 03:21:14 UTC) #32
calamity
lgtm https://codereview.chromium.org/2361513003/diff/210001/chrome/browser/ui/webui/history_ui.cc File chrome/browser/ui/webui/history_ui.cc (right): https://codereview.chromium.org/2361513003/diff/210001/chrome/browser/ui/webui/history_ui.cc#newcode180 chrome/browser/ui/webui/history_ui.cc:180: CreateDataSource(); May as well move this back to ...
4 years, 2 months ago (2016-09-30 04:09:49 UTC) #33
lshang
https://codereview.chromium.org/2361513003/diff/210001/chrome/browser/ui/webui/history_ui.cc File chrome/browser/ui/webui/history_ui.cc (right): https://codereview.chromium.org/2361513003/diff/210001/chrome/browser/ui/webui/history_ui.cc#newcode180 chrome/browser/ui/webui/history_ui.cc:180: CreateDataSource(); On 2016/09/30 04:09:49, calamity wrote: > May as ...
4 years, 2 months ago (2016-09-30 04:53:51 UTC) #34
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/2361513003/230001
4 years, 2 months ago (2016-09-30 04:54:20 UTC) #37
commit-bot: I haz the power
Committed patchset #13 (id:230001)
4 years, 2 months ago (2016-09-30 05:52:33 UTC) #39
commit-bot: I haz the power
4 years, 2 months ago (2016-09-30 05:54:58 UTC) #41
Message was sent while issue was closed.
Patchset 13 (id:??) landed as
https://crrev.com/93a39a3cfff736b8e10f65e9d7bf2612186a26c8
Cr-Commit-Position: refs/heads/master@{#422038}

Powered by Google App Engine
This is Rietveld 408576698