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

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

Issue 2257703002: MD History: Improve test helpers, update synced tabs tests to use them (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Revulcanize 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 * @fileoverview PromiseResolver is a helper class that allows creating a 6 * @fileoverview PromiseResolver is a helper class that allows creating a
7 * Promise that will be fulfilled (resolved or rejected) some time later. 7 * Promise that will be fulfilled (resolved or rejected) some time later.
8 * 8 *
9 * Example: 9 * Example:
10 * var resolver = new PromiseResolver(); 10 * var resolver = new PromiseResolver();
(...skipping 7727 matching lines...) Expand 10 before | Expand all | Expand 10 after
7738 * canceled via cancel(), a 'cancel' event is fired followed by a 'close' event. 7738 * canceled via cancel(), a 'cancel' event is fired followed by a 'close' event.
7739 * Additionally clients can inspect the dialog's |returnValue| property inside 7739 * Additionally clients can inspect the dialog's |returnValue| property inside
7740 * the 'close' event listener to determine whether it was canceled or just 7740 * the 'close' event listener to determine whether it was canceled or just
7741 * closed, where a truthy value means success, and a falsy value means it was 7741 * closed, where a truthy value means success, and a falsy value means it was
7742 * canceled. 7742 * canceled.
7743 */ 7743 */
7744 Polymer({ 7744 Polymer({
7745 is: 'cr-dialog', 7745 is: 'cr-dialog',
7746 extends: 'dialog', 7746 extends: 'dialog',
7747 7747
7748 /** @override */
7749 created: function() {
7750 // If the active history entry changes (i.e. user clicks back button),
7751 // all open dialogs should be cancelled.
7752 window.addEventListener('popstate', function() {
7753 if (this.open)
7754 this.cancel();
7755 }.bind(this));
7756 },
7757
7748 cancel: function() { 7758 cancel: function() {
7749 this.fire('cancel'); 7759 this.fire('cancel');
7750 HTMLDialogElement.prototype.close.call(this, ''); 7760 HTMLDialogElement.prototype.close.call(this, '');
7751 }, 7761 },
7752 7762
7753 /** 7763 /**
7754 * @param {string=} opt_returnValue 7764 * @param {string=} opt_returnValue
7755 * @override 7765 * @override
7756 */ 7766 */
7757 close: function(opt_returnValue) { 7767 close: function(opt_returnValue) {
(...skipping 6669 matching lines...) Expand 10 before | Expand all | Expand 10 after
14427 lastVisitTime, maxResults 14437 lastVisitTime, maxResults
14428 ]); 14438 ]);
14429 }, 14439 },
14430 14440
14431 /** @return {number} */ 14441 /** @return {number} */
14432 getSelectedItemCount: function() { 14442 getSelectedItemCount: function() {
14433 return this.getSelectedList_().selectedPaths.size; 14443 return this.getSelectedList_().selectedPaths.size;
14434 }, 14444 },
14435 14445
14436 unselectAllItems: function(count) { 14446 unselectAllItems: function(count) {
14437 this.getSelectedList_().unselectAllItems(count); 14447 var selectedList = this.getSelectedList_();
14448 if (selectedList)
14449 selectedList.unselectAllItems(count);
14438 }, 14450 },
14439 14451
14440 /** 14452 /**
14441 * Delete all the currently selected history items. Will prompt the user with 14453 * Delete all the currently selected history items. Will prompt the user with
14442 * a dialog to confirm that the deletion should be performed. 14454 * a dialog to confirm that the deletion should be performed.
14443 */ 14455 */
14444 deleteSelectedWithPrompt: function() { 14456 deleteSelectedWithPrompt: function() {
14445 if (!loadTimeData.getBoolean('allowDeletingHistory')) 14457 if (!loadTimeData.getBoolean('allowDeletingHistory'))
14446 return; 14458 return;
14447 this.$.dialog.get().then(function(dialog) { 14459 this.$.dialog.get().then(function(dialog) {
(...skipping 861 matching lines...) Expand 10 before | Expand all | Expand 10 after
15309 return selectedPage; 15321 return selectedPage;
15310 }, 15322 },
15311 15323
15312 /** @private */ 15324 /** @private */
15313 closeDrawer_: function() { 15325 closeDrawer_: function() {
15314 var drawer = this.$$('#drawer'); 15326 var drawer = this.$$('#drawer');
15315 if (drawer) 15327 if (drawer)
15316 drawer.close(); 15328 drawer.close();
15317 }, 15329 },
15318 }); 15330 });
OLDNEW
« no previous file with comments | « chrome/browser/browser_resources.grd ('k') | chrome/browser/resources/md_history/app.vulcanized.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698