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

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: add test, add grouped history 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 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 */ 213 */
212 tabSyncDisabled: function() { 214 tabSyncDisabled: function() {
213 this.fetchingSyncedTabs_ = false; 215 this.fetchingSyncedTabs_ = false;
214 this.clearDisplayedSyncedDevices_(); 216 this.clearDisplayedSyncedDevices_();
215 }, 217 },
216 218
217 /** 219 /**
218 * Get called when user's sign in state changes, this will affect UI of synced 220 * Get called when user's sign in state changes, this will affect UI of synced
219 * tabs page. Sign in promo gets displayed when user is signed out, and 221 * tabs page. Sign in promo gets displayed when user is signed out, and
220 * different messages are shown when there are no synced tabs. 222 * different messages are shown when there are no synced tabs.
221 * @param {boolean} isUserSignedIn 223 * @param {boolean} signInState
222 */ 224 */
223 updateSignInState: function(isUserSignedIn) { 225 signInStateChanged_: function(signInState) {
224 // If user's sign in state didn't change, then don't change message or 226 this.fire('history-view-changed');
225 // update UI.
226 if (this.signInState_ == isUserSignedIn)
227 return;
228
229 this.signInState_ = isUserSignedIn;
230 227
231 // User signed out, clear synced device list and show the sign in promo. 228 // User signed out, clear synced device list and show the sign in promo.
232 if (!isUserSignedIn) { 229 if (!signInState) {
233 this.clearDisplayedSyncedDevices_(); 230 this.clearDisplayedSyncedDevices_();
234 return; 231 return;
235 } 232 }
236 // User signed in, show the loading message when querying for synced 233 // User signed in, show the loading message when querying for synced
237 // devices. 234 // devices.
238 this.fetchingSyncedTabs_ = true; 235 this.fetchingSyncedTabs_ = true;
239 }, 236 },
240 237
241 searchTermChanged: function(searchTerm) { 238 searchTermChanged: function(searchTerm) {
242 this.clearDisplayedSyncedDevices_(); 239 this.clearDisplayedSyncedDevices_();
243 this.updateSyncedDevices(this.sessionList); 240 this.updateSyncedDevices(this.sessionList);
244 } 241 }
245 }); 242 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698