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

Side by Side Diff: chrome/browser/resources/md_history/app.crisper.js

Issue 2361513003: MD History: Update sign in state in data source (Closed)
Patch Set: remove downloads Created 4 years, 2 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 function PromiseResolver() { 4 function PromiseResolver() {
5 this.resolve_; 5 this.resolve_;
6 this.reject_; 6 this.reject_;
7 this.promise_ = new Promise(function(resolve, reject) { 7 this.promise_ = new Promise(function(resolve, reject) {
8 this.resolve_ = resolve; 8 this.resolve_ = resolve;
9 this.reject_ = reject; 9 this.reject_ = reject;
10 }.bind(this)); 10 }.bind(this));
(...skipping 6457 matching lines...) Expand 10 before | Expand all | Expand 10 after
6468 lastFocus_: null, 6468 lastFocus_: null,
6469 attached: function() { 6469 attached: function() {
6470 window.addEventListener('resize', this.closeMenu.bind(this)); 6470 window.addEventListener('resize', this.closeMenu.bind(this));
6471 }, 6471 },
6472 closeMenu: function() { 6472 closeMenu: function() {
6473 if (this.root.activeElement == null) { 6473 if (this.root.activeElement == null) {
6474 this.$.dropdown.restoreFocusOnClose = false; 6474 this.$.dropdown.restoreFocusOnClose = false;
6475 } 6475 }
6476 this.menuOpen = false; 6476 this.menuOpen = false;
6477 }, 6477 },
6478 openMenu: function(anchor, itemData) { 6478 openMenu: function(anchor, opt_itemData) {
6479 if (this.lastAnchor_ == anchor && this.menuOpen) return; 6479 if (this.lastAnchor_ == anchor && this.menuOpen) return;
6480 if (this.menuOpen) this.closeMenu(); 6480 if (this.menuOpen) this.closeMenu();
6481 this.itemData = itemData; 6481 this.itemData = opt_itemData || null;
6482 this.lastAnchor_ = anchor; 6482 this.lastAnchor_ = anchor;
6483 this.$.dropdown.restoreFocusOnClose = true; 6483 this.$.dropdown.restoreFocusOnClose = true;
6484 var focusableChildren = Polymer.dom(this).querySelectorAll('[tabindex]:not([ disabled]):not([hidden]),' + 'button:not([disabled]):not([hidden])'); 6484 var focusableChildren = Polymer.dom(this).querySelectorAll('[tabindex]:not([ disabled]):not([hidden]),' + 'button:not([disabled]):not([hidden])');
6485 if (focusableChildren.length > 0) { 6485 if (focusableChildren.length > 0) {
6486 this.$.dropdown.focusTarget = focusableChildren[0]; 6486 this.$.dropdown.focusTarget = focusableChildren[0];
6487 this.firstFocus_ = focusableChildren[0]; 6487 this.firstFocus_ = focusableChildren[0];
6488 this.lastFocus_ = focusableChildren[focusableChildren.length - 1]; 6488 this.lastFocus_ = focusableChildren[focusableChildren.length - 1];
6489 } 6489 }
6490 this.$.dropdown.positionTarget = anchor; 6490 this.$.dropdown.positionTarget = anchor;
6491 this.menuOpen = true; 6491 this.menuOpen = true;
6492 }, 6492 },
6493 toggleMenu: function(anchor, itemData) { 6493 toggleMenu: function(anchor, opt_itemData) {
6494 if (anchor == this.lastAnchor_ && this.menuOpen) this.closeMenu(); else this .openMenu(anchor, itemData); 6494 if (anchor == this.lastAnchor_ && this.menuOpen) this.closeMenu(); else this .openMenu(anchor, opt_itemData);
6495 }, 6495 },
6496 onTabPressed_: function(e) { 6496 onTabPressed_: function(e) {
6497 if (!this.firstFocus_ || !this.lastFocus_) return; 6497 if (!this.firstFocus_ || !this.lastFocus_) return;
6498 var toFocus; 6498 var toFocus;
6499 var keyEvent = e.detail.keyboardEvent; 6499 var keyEvent = e.detail.keyboardEvent;
6500 if (keyEvent.shiftKey && keyEvent.target == this.firstFocus_) toFocus = this .lastFocus_; else if (!keyEvent.shiftKey && keyEvent.target == this.lastFocus_) toFocus = this.firstFocus_; 6500 if (keyEvent.shiftKey && keyEvent.target == this.firstFocus_) toFocus = this .lastFocus_; else if (!keyEvent.shiftKey && keyEvent.target == this.lastFocus_) toFocus = this.firstFocus_;
6501 if (!toFocus) return; 6501 if (!toFocus) return;
6502 e.preventDefault(); 6502 e.preventDefault();
6503 toFocus.focus(); 6503 toFocus.focus();
6504 }, 6504 },
(...skipping 2047 matching lines...) Expand 10 before | Expand all | Expand 10 after
8552 type: Boolean, 8552 type: Boolean,
8553 value: false 8553 value: false
8554 }, 8554 },
8555 hasSeenForeignData_: Boolean 8555 hasSeenForeignData_: Boolean
8556 }, 8556 },
8557 listeners: { 8557 listeners: {
8558 'toggle-menu': 'onToggleMenu_', 8558 'toggle-menu': 'onToggleMenu_',
8559 scroll: 'onListScroll_' 8559 scroll: 'onListScroll_'
8560 }, 8560 },
8561 attached: function() { 8561 attached: function() {
8562 chrome.send('otherDevicesInitialized');
8563 md_history.BrowserService.getInstance().recordHistogram(SYNCED_TABS_HISTOGRA M_NAME, SyncedTabsHistogram.INITIALIZED, SyncedTabsHistogram.LIMIT); 8562 md_history.BrowserService.getInstance().recordHistogram(SYNCED_TABS_HISTOGRA M_NAME, SyncedTabsHistogram.INITIALIZED, SyncedTabsHistogram.LIMIT);
8564 }, 8563 },
8565 getContentScrollTarget: function() { 8564 getContentScrollTarget: function() {
8566 return this; 8565 return this;
8567 }, 8566 },
8568 createInternalDevice_: function(session) { 8567 createInternalDevice_: function(session) {
8569 var tabs = []; 8568 var tabs = [];
8570 var separatorIndexes = []; 8569 var separatorIndexes = [];
8571 for (var i = 0; i < session.windows.length; i++) { 8570 for (var i = 0; i < session.windows.length; i++) {
8572 var windowId = session.windows[i].sessionId; 8571 var windowId = session.windows[i].sessionId;
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after
8940 8939
8941 case HistoryRange.MONTH: 8940 case HistoryRange.MONTH:
8942 histogramValue = HistoryPageViewHistogram.GROUPED_MONTH; 8941 histogramValue = HistoryPageViewHistogram.GROUPED_MONTH;
8943 break; 8942 break;
8944 } 8943 }
8945 break; 8944 break;
8946 } 8945 }
8947 md_history.BrowserService.getInstance().recordHistogram('History.HistoryPage View', histogramValue, HistoryPageViewHistogram.END); 8946 md_history.BrowserService.getInstance().recordHistogram('History.HistoryPage View', histogramValue, HistoryPageViewHistogram.END);
8948 } 8947 }
8949 }); 8948 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698