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

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

Issue 2238163002: [MD History] Add UMA stats for switching views and the CBD button. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@start_focus_in_search_bar
Patch Set: rebase, vulcanize 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 21 matching lines...) Expand all
32 /** 32 /**
33 * An array of synced devices with synced tab data. 33 * An array of synced devices with synced tab data.
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 // Updated on attach by chrome.sending 'otherDevicesInitialized'.
44 value: loadTimeData.getBoolean('isUserSignedIn'), 45 value: loadTimeData.getBoolean('isUserSignedIn'),
46 observer: 'signInStateChanged_',
45 }, 47 },
46 48
47 /** @private */ 49 /** @private */
48 guestSession_: { 50 guestSession_: {
49 type: Boolean, 51 type: Boolean,
50 value: loadTimeData.getBoolean('isGuestSession'), 52 value: loadTimeData.getBoolean('isGuestSession'),
51 }, 53 },
52 54
53 /** @private */ 55 /** @private */
54 fetchingSyncedTabs_: { 56 fetchingSyncedTabs_: {
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 */ 222 */
221 tabSyncDisabled: function() { 223 tabSyncDisabled: function() {
222 this.fetchingSyncedTabs_ = false; 224 this.fetchingSyncedTabs_ = false;
223 this.clearDisplayedSyncedDevices_(); 225 this.clearDisplayedSyncedDevices_();
224 }, 226 },
225 227
226 /** 228 /**
227 * Get called when user's sign in state changes, this will affect UI of synced 229 * Get called when user's sign in state changes, this will affect UI of synced
228 * tabs page. Sign in promo gets displayed when user is signed out, and 230 * tabs page. Sign in promo gets displayed when user is signed out, and
229 * different messages are shown when there are no synced tabs. 231 * different messages are shown when there are no synced tabs.
230 * @param {boolean} isUserSignedIn 232 * @param {boolean} signInState
231 */ 233 */
232 updateSignInState: function(isUserSignedIn) { 234 signInStateChanged_: function(signInState) {
tsergeant 2016/08/17 06:03:09 Convention is for observer functions to leave out
calamity 2016/08/18 03:11:15 Done.
233 // If user's sign in state didn't change, then don't change message or 235 this.fire('history-view-changed');
234 // update UI.
235 if (this.signInState_ == isUserSignedIn)
236 return;
237
238 this.signInState_ = isUserSignedIn;
239 236
240 // User signed out, clear synced device list and show the sign in promo. 237 // User signed out, clear synced device list and show the sign in promo.
241 if (!isUserSignedIn) { 238 if (!signInState) {
242 this.clearDisplayedSyncedDevices_(); 239 this.clearDisplayedSyncedDevices_();
243 return; 240 return;
244 } 241 }
245 // User signed in, show the loading message when querying for synced 242 // User signed in, show the loading message when querying for synced
246 // devices. 243 // devices.
247 this.fetchingSyncedTabs_ = true; 244 this.fetchingSyncedTabs_ = true;
248 }, 245 },
249 246
250 searchTermChanged: function(searchTerm) { 247 searchTermChanged: function(searchTerm) {
251 this.clearDisplayedSyncedDevices_(); 248 this.clearDisplayedSyncedDevices_();
252 this.updateSyncedDevices(this.sessionList); 249 this.updateSyncedDevices(this.sessionList);
253 } 250 }
254 }); 251 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698