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

Side by Side Diff: chrome/browser/resources/md_history/synced_device_manager.js

Issue 2191173003: MD History: Get sign in state from backend when refreshing the page (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 /** 5 /**
6 * @typedef {{device: string, 6 * @typedef {{device: string,
7 * lastUpdateTime: string, 7 * lastUpdateTime: string,
8 * separatorIndexes: !Array<number>, 8 * separatorIndexes: !Array<number>,
9 * timestamp: number, 9 * timestamp: number,
10 * tabs: !Array<!ForeignSessionTab>, 10 * tabs: !Array<!ForeignSessionTab>,
(...skipping 23 matching lines...) Expand all
34 * @type {!Array<!ForeignDeviceInternal>} 34 * @type {!Array<!ForeignDeviceInternal>}
35 */ 35 */
36 syncedDevices_: { 36 syncedDevices_: {
37 type: Array, 37 type: Array,
38 value: function() { return []; } 38 value: function() { return []; }
39 }, 39 },
40 40
41 /** @private */ 41 /** @private */
42 signInState_: { 42 signInState_: {
43 type: Boolean, 43 type: Boolean,
44 value: loadTimeData.getBoolean('isUserSignedIn'), 44 value: true,
calamity 2016/07/29 05:14:59 You might want to leave this in... I think this wi
lshang 2016/07/29 06:11:58 Done.
45 }, 45 },
46 46
47 /** @private */ 47 /** @private */
48 guestSession_: { 48 guestSession_: {
49 type: Boolean, 49 type: Boolean,
50 value: loadTimeData.getBoolean('isGuestSession'), 50 value: loadTimeData.getBoolean('isGuestSession'),
51 }, 51 },
52 52
53 /** @private */ 53 /** @private */
54 fetchingSyncedTabs_: { 54 fetchingSyncedTabs_: {
55 type: Boolean, 55 type: Boolean,
56 value: false, 56 value: false,
57 } 57 }
58 }, 58 },
59 59
60 /** @override */
61 attached: function() {
62 // When user signs in or out with MD History tab open, the internal sign in
63 // state will be updated, but refreshing the page will still get the
64 // outdated state. Get the current state from backend when element is
65 // attached.
66 this.getSignInState_();
calamity 2016/07/29 05:14:59 No need for a method here, just chrome.send('other
lshang 2016/07/29 06:11:58 Done.
67 },
68
60 /** 69 /**
61 * @param {!ForeignSession} session 70 * @param {!ForeignSession} session
62 * @return {!ForeignDeviceInternal} 71 * @return {!ForeignDeviceInternal}
63 */ 72 */
64 createInternalDevice_: function(session) { 73 createInternalDevice_: function(session) {
65 var tabs = []; 74 var tabs = [];
66 var separatorIndexes = []; 75 var separatorIndexes = [];
67 for (var i = 0; i < session.windows.length; i++) { 76 for (var i = 0; i < session.windows.length; i++) {
68 var windowId = session.windows[i].sessionId; 77 var windowId = session.windows[i].sessionId;
69 var newTabs = session.windows[i].tabs; 78 var newTabs = session.windows[i].tabs;
(...skipping 26 matching lines...) Expand all
96 return { 105 return {
97 device: session.name, 106 device: session.name,
98 lastUpdateTime: '– ' + session.modifiedTime, 107 lastUpdateTime: '– ' + session.modifiedTime,
99 separatorIndexes: separatorIndexes, 108 separatorIndexes: separatorIndexes,
100 timestamp: session.timestamp, 109 timestamp: session.timestamp,
101 tabs: tabs, 110 tabs: tabs,
102 tag: session.tag, 111 tag: session.tag,
103 }; 112 };
104 }, 113 },
105 114
115 /** @private */
116 getSignInState_: function() {
117 chrome.send('getSignInState');
118 },
106 119
107 onSignInTap_: function() { 120 onSignInTap_: function() {
108 chrome.send('SyncSetupShowSetupUI'); 121 chrome.send('SyncSetupShowSetupUI');
109 chrome.send('SyncSetupStartSignIn', [false]); 122 chrome.send('SyncSetupStartSignIn', [false]);
110 }, 123 },
111 124
112 /** @private */ 125 /** @private */
113 clearDisplayedSyncedDevices_: function() { 126 clearDisplayedSyncedDevices_: function() {
114 this.syncedDevices_ = []; 127 this.syncedDevices_ = [];
115 }, 128 },
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 // User signed in, show the loading message when querying for synced 217 // User signed in, show the loading message when querying for synced
205 // devices. 218 // devices.
206 this.fetchingSyncedTabs_ = true; 219 this.fetchingSyncedTabs_ = true;
207 }, 220 },
208 221
209 searchTermChanged: function(searchTerm) { 222 searchTermChanged: function(searchTerm) {
210 this.clearDisplayedSyncedDevices_(); 223 this.clearDisplayedSyncedDevices_();
211 this.updateSyncedDevices(this.sessionList); 224 this.updateSyncedDevices(this.sessionList);
212 } 225 }
213 }); 226 });
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/webui/history_login_handler.h » ('j') | chrome/browser/ui/webui/history_login_handler.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698