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

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

Issue 2280513002: MD History: promote menu button to show clear browsing data in narrow mode (Closed)
Patch Set: merge Created 4 years, 3 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 5365 matching lines...) Expand 10 before | Expand all | Expand 10 after
5376 this._positionBar(this._pos.width, this._pos.left); 5376 this._positionBar(this._pos.width, this._pos.left);
5377 } else if (cl.contains('contract')) { 5377 } else if (cl.contains('contract')) {
5378 cl.remove('contract'); 5378 cl.remove('contract');
5379 } 5379 }
5380 } 5380 }
5381 }); 5381 });
5382 5382
5383 // Copyright 2016 The Chromium Authors. All rights reserved. 5383 // Copyright 2016 The Chromium Authors. All rights reserved.
5384 // Use of this source code is governed by a BSD-style license that can be 5384 // Use of this source code is governed by a BSD-style license that can be
5385 // found in the LICENSE file. 5385 // found in the LICENSE file.
5386 var TemplateInstance = function() {};
5387
5388 TemplateInstance.prototype._children;
5389
5390 TemplateInstance.prototype.__setProperty = function(prop, value, quiet) {};
5391
5392 TemplateInstance.prototype._notifyPath = function(path, value, quiet) {};
5393
5386 Polymer({ 5394 Polymer({
5387 is: 'cr-lazy-render', 5395 is: 'cr-lazy-render',
5388 "extends": 'template', 5396 "extends": 'template',
5389 behaviors: [ Polymer.Templatizer ], 5397 behaviors: [ Polymer.Templatizer ],
5390 _renderPromise: null, 5398 _renderPromise: null,
5391 _instance: null, 5399 _instance: null,
5392 get: function() { 5400 get: function() {
5393 if (!this._renderPromise) { 5401 if (!this._renderPromise) {
5394 this._renderPromise = new Promise(function(resolve) { 5402 this._renderPromise = new Promise(function(resolve) {
5395 this._debounceTemplate(function() { 5403 this._debounceTemplate(function() {
(...skipping 24 matching lines...) Expand all
5420 } 5428 }
5421 }, 5429 },
5422 _forwardParentProp: function(prop, value) { 5430 _forwardParentProp: function(prop, value) {
5423 if (this._instance) this._instance.__setProperty(prop, value, true); 5431 if (this._instance) this._instance.__setProperty(prop, value, true);
5424 }, 5432 },
5425 _forwardParentPath: function(path, value) { 5433 _forwardParentPath: function(path, value) {
5426 if (this._instance) this._instance._notifyPath(path, value, true); 5434 if (this._instance) this._instance._notifyPath(path, value, true);
5427 } 5435 }
5428 }); 5436 });
5429 5437
5438 Polymer({
5439 is: 'fade-in-animation',
5440 behaviors: [ Polymer.NeonAnimationBehavior ],
5441 configure: function(config) {
5442 var node = config.node;
5443 this._effect = new KeyframeEffect(node, [ {
5444 opacity: '0'
5445 }, {
5446 opacity: '1'
5447 } ], this.timingFromConfig(config));
5448 return this._effect;
5449 }
5450 });
5451
5452 Polymer({
5453 is: 'fade-out-animation',
5454 behaviors: [ Polymer.NeonAnimationBehavior ],
5455 configure: function(config) {
5456 var node = config.node;
5457 this._effect = new KeyframeEffect(node, [ {
5458 opacity: '1'
5459 }, {
5460 opacity: '0'
5461 } ], this.timingFromConfig(config));
5462 return this._effect;
5463 }
5464 });
5465
5466 Polymer({
5467 is: 'paper-tooltip',
5468 hostAttributes: {
5469 role: 'tooltip',
5470 tabindex: -1
5471 },
5472 behaviors: [ Polymer.NeonAnimationRunnerBehavior ],
5473 properties: {
5474 "for": {
5475 type: String,
5476 observer: '_findTarget'
5477 },
5478 manualMode: {
5479 type: Boolean,
5480 value: false,
5481 observer: '_manualModeChanged'
5482 },
5483 position: {
5484 type: String,
5485 value: 'bottom'
5486 },
5487 fitToVisibleBounds: {
5488 type: Boolean,
5489 value: false
5490 },
5491 offset: {
5492 type: Number,
5493 value: 14
5494 },
5495 marginTop: {
5496 type: Number,
5497 value: 14
5498 },
5499 animationDelay: {
5500 type: Number,
5501 value: 500
5502 },
5503 animationConfig: {
5504 type: Object,
5505 value: function() {
5506 return {
5507 entry: [ {
5508 name: 'fade-in-animation',
5509 node: this,
5510 timing: {
5511 delay: 0
5512 }
5513 } ],
5514 exit: [ {
5515 name: 'fade-out-animation',
5516 node: this
5517 } ]
5518 };
5519 }
5520 },
5521 _showing: {
5522 type: Boolean,
5523 value: false
5524 }
5525 },
5526 listeners: {
5527 'neon-animation-finish': '_onAnimationFinish'
5528 },
5529 get target() {
5530 var parentNode = Polymer.dom(this).parentNode;
5531 var ownerRoot = Polymer.dom(this).getOwnerRoot();
5532 var target;
5533 if (this.for) {
5534 target = Polymer.dom(ownerRoot).querySelector('#' + this.for);
5535 } else {
5536 target = parentNode.nodeType == Node.DOCUMENT_FRAGMENT_NODE ? ownerRoot.ho st : parentNode;
5537 }
5538 return target;
5539 },
5540 attached: function() {
5541 this._findTarget();
5542 },
5543 detached: function() {
5544 if (!this.manualMode) this._removeListeners();
5545 },
5546 show: function() {
5547 if (this._showing) return;
5548 if (Polymer.dom(this).textContent.trim() === '') return;
5549 this.cancelAnimation();
5550 this._showing = true;
5551 this.toggleClass('hidden', false, this.$.tooltip);
5552 this.updatePosition();
5553 this.animationConfig.entry[0].timing = this.animationConfig.entry[0].timing || {};
5554 this.animationConfig.entry[0].timing.delay = this.animationDelay;
5555 this._animationPlaying = true;
5556 this.playAnimation('entry');
5557 },
5558 hide: function() {
5559 if (!this._showing) {
5560 return;
5561 }
5562 if (this._animationPlaying) {
5563 this.cancelAnimation();
5564 this._showing = false;
5565 this._onAnimationFinish();
5566 return;
5567 }
5568 this._showing = false;
5569 this._animationPlaying = true;
5570 this.playAnimation('exit');
5571 },
5572 updatePosition: function() {
5573 if (!this._target || !this.offsetParent) return;
5574 var offset = this.offset;
5575 if (this.marginTop != 14 && this.offset == 14) offset = this.marginTop;
5576 var parentRect = this.offsetParent.getBoundingClientRect();
5577 var targetRect = this._target.getBoundingClientRect();
5578 var thisRect = this.getBoundingClientRect();
5579 var horizontalCenterOffset = (targetRect.width - thisRect.width) / 2;
5580 var verticalCenterOffset = (targetRect.height - thisRect.height) / 2;
5581 var targetLeft = targetRect.left - parentRect.left;
5582 var targetTop = targetRect.top - parentRect.top;
5583 var tooltipLeft, tooltipTop;
5584 switch (this.position) {
5585 case 'top':
5586 tooltipLeft = targetLeft + horizontalCenterOffset;
5587 tooltipTop = targetTop - thisRect.height - offset;
5588 break;
5589
5590 case 'bottom':
5591 tooltipLeft = targetLeft + horizontalCenterOffset;
5592 tooltipTop = targetTop + targetRect.height + offset;
5593 break;
5594
5595 case 'left':
5596 tooltipLeft = targetLeft - thisRect.width - offset;
5597 tooltipTop = targetTop + verticalCenterOffset;
5598 break;
5599
5600 case 'right':
5601 tooltipLeft = targetLeft + targetRect.width + offset;
5602 tooltipTop = targetTop + verticalCenterOffset;
5603 break;
5604 }
5605 if (this.fitToVisibleBounds) {
5606 if (tooltipLeft + thisRect.width > window.innerWidth) {
5607 this.style.right = '0px';
5608 this.style.left = 'auto';
5609 } else {
5610 this.style.left = Math.max(0, tooltipLeft) + 'px';
5611 this.style.right = 'auto';
5612 }
5613 if (tooltipTop + thisRect.height > window.innerHeight) {
5614 this.style.bottom = '0px';
5615 this.style.top = 'auto';
5616 } else {
5617 this.style.top = Math.max(0, tooltipTop) + 'px';
5618 this.style.bottom = 'auto';
5619 }
5620 } else {
5621 this.style.left = tooltipLeft + 'px';
5622 this.style.top = tooltipTop + 'px';
5623 }
5624 },
5625 _addListeners: function() {
5626 if (this._target) {
5627 this.listen(this._target, 'mouseenter', 'show');
5628 this.listen(this._target, 'focus', 'show');
5629 this.listen(this._target, 'mouseleave', 'hide');
5630 this.listen(this._target, 'blur', 'hide');
5631 this.listen(this._target, 'tap', 'hide');
5632 }
5633 this.listen(this, 'mouseenter', 'hide');
5634 },
5635 _findTarget: function() {
5636 if (!this.manualMode) this._removeListeners();
5637 this._target = this.target;
5638 if (!this.manualMode) this._addListeners();
5639 },
5640 _manualModeChanged: function() {
5641 if (this.manualMode) this._removeListeners(); else this._addListeners();
5642 },
5643 _onAnimationFinish: function() {
5644 this._animationPlaying = false;
5645 if (!this._showing) {
5646 this.toggleClass('hidden', true, this.$.tooltip);
5647 }
5648 },
5649 _removeListeners: function() {
5650 if (this._target) {
5651 this.unlisten(this._target, 'mouseenter', 'show');
5652 this.unlisten(this._target, 'focus', 'show');
5653 this.unlisten(this._target, 'mouseleave', 'hide');
5654 this.unlisten(this._target, 'blur', 'hide');
5655 this.unlisten(this._target, 'tap', 'hide');
5656 }
5657 this.unlisten(this, 'mouseenter', 'hide');
5658 }
5659 });
5660
5430 (function() { 5661 (function() {
5431 'use strict'; 5662 'use strict';
5432 Polymer.IronA11yAnnouncer = Polymer({ 5663 Polymer.IronA11yAnnouncer = Polymer({
5433 is: 'iron-a11y-announcer', 5664 is: 'iron-a11y-announcer',
5434 properties: { 5665 properties: {
5435 mode: { 5666 mode: {
5436 type: String, 5667 type: String,
5437 value: 'polite' 5668 value: 'polite'
5438 }, 5669 },
5439 _text: { 5670 _text: {
(...skipping 618 matching lines...) Expand 10 before | Expand all | Expand 10 after
6058 // Copyright 2016 The Chromium Authors. All rights reserved. 6289 // Copyright 2016 The Chromium Authors. All rights reserved.
6059 // Use of this source code is governed by a BSD-style license that can be 6290 // Use of this source code is governed by a BSD-style license that can be
6060 // found in the LICENSE file. 6291 // found in the LICENSE file.
6061 Polymer({ 6292 Polymer({
6062 is: 'cr-toolbar', 6293 is: 'cr-toolbar',
6063 properties: { 6294 properties: {
6064 pageName: String, 6295 pageName: String,
6065 searchPrompt: String, 6296 searchPrompt: String,
6066 clearLabel: String, 6297 clearLabel: String,
6067 menuLabel: String, 6298 menuLabel: String,
6299 menuPromo: String,
6068 spinnerActive: Boolean, 6300 spinnerActive: Boolean,
6069 showMenu: { 6301 showMenu: {
6070 type: Boolean, 6302 type: Boolean,
6071 value: false 6303 value: false
6072 }, 6304 },
6305 showMenuPromo: {
6306 type: Boolean,
6307 value: false
6308 },
6309 closeMenuPromo: String,
6073 narrow_: { 6310 narrow_: {
6074 type: Boolean, 6311 type: Boolean,
6075 reflectToAttribute: true 6312 reflectToAttribute: true
6076 }, 6313 },
6077 showingSearch_: { 6314 showingSearch_: {
6078 type: Boolean, 6315 type: Boolean,
6079 reflectToAttribute: true 6316 reflectToAttribute: true
6080 } 6317 }
6081 }, 6318 },
6319 observers: [ 'possiblyShowMenuPromo_(showMenu, showMenuPromo, showingSearch_)' ],
6082 getSearchField: function() { 6320 getSearchField: function() {
6083 return this.$.search; 6321 return this.$.search;
6084 }, 6322 },
6085 onMenuTap_: function(e) { 6323 onMenuTap_: function() {
6086 this.fire('cr-menu-tap'); 6324 this.fire('cr-menu-tap');
6325 this.onMenuPromoCloseTap_();
6326 },
6327 onMenuPromoCloseTap_: function() {
6328 this.showMenuPromo = false;
6329 },
6330 possiblyShowMenuPromo_: function() {
6331 Polymer.RenderStatus.afterNextRender(this, function() {
6332 if (this.showMenu && this.showMenuPromo && !this.showingSearch_) {
6333 this.$$('paper-tooltip').show();
6334 this.fire('cr-menu-promo-shown');
6335 }
6336 }.bind(this));
6337 },
6338 titleIfNotShowMenuPromo_: function(title, showMenuPromo) {
6339 return showMenuPromo ? '' : title;
6087 } 6340 }
6088 }); 6341 });
6089 6342
6343 // Copyright 2016 The Chromium Authors. All rights reserved.
6344 // Use of this source code is governed by a BSD-style license that can be
6345 // found in the LICENSE file.
6346 cr.define('md_history', function() {
6347 function BrowserService() {
6348 this.pendingDeleteItems_ = null;
6349 this.pendingDeletePromise_ = null;
6350 }
6351 BrowserService.prototype = {
6352 deleteItems: function(items) {
6353 if (this.pendingDeleteItems_ != null) {
6354 return new Promise(function(resolve, reject) {
6355 reject(items);
6356 });
6357 }
6358 var removalList = items.map(function(item) {
6359 return {
6360 url: item.url,
6361 timestamps: item.allTimestamps
6362 };
6363 });
6364 this.pendingDeleteItems_ = items;
6365 this.pendingDeletePromise_ = new PromiseResolver();
6366 chrome.send('removeVisits', removalList);
6367 return this.pendingDeletePromise_.promise;
6368 },
6369 removeBookmark: function(url) {
6370 chrome.send('removeBookmark', [ url ]);
6371 },
6372 openForeignSessionAllTabs: function(sessionTag) {
6373 chrome.send('openForeignSession', [ sessionTag ]);
6374 },
6375 openForeignSessionTab: function(sessionTag, windowId, tabId, e) {
6376 chrome.send('openForeignSession', [ sessionTag, String(windowId), String(t abId), e.button || 0, e.altKey, e.ctrlKey, e.metaKey, e.shiftKey ]);
6377 },
6378 deleteForeignSession: function(sessionTag) {
6379 chrome.send('deleteForeignSession', [ sessionTag ]);
6380 },
6381 openClearBrowsingData: function() {
6382 chrome.send('clearBrowsingData');
6383 },
6384 recordHistogram: function(histogram, value, max) {
6385 chrome.send('metricsHandler:recordInHistogram', [ histogram, value, max ]) ;
6386 },
6387 recordAction: function(action) {
6388 if (action.indexOf('_') == -1) action = 'HistoryPage_' + action;
6389 chrome.send('metricsHandler:recordAction', [ action ]);
6390 },
6391 resolveDelete_: function(successful) {
6392 if (this.pendingDeleteItems_ == null || this.pendingDeletePromise_ == null ) {
6393 return;
6394 }
6395 if (successful) this.pendingDeletePromise_.resolve(this.pendingDeleteItems _); else this.pendingDeletePromise_.reject(this.pendingDeleteItems_);
6396 this.pendingDeleteItems_ = null;
6397 this.pendingDeletePromise_ = null;
6398 },
6399 menuPromoShown: function() {
6400 chrome.send('menuPromoShown');
6401 }
6402 };
6403 cr.addSingletonGetter(BrowserService);
6404 return {
6405 BrowserService: BrowserService
6406 };
6407 });
6408
6409 function deleteComplete() {
6410 md_history.BrowserService.getInstance().resolveDelete_(true);
6411 }
6412
6413 function deleteFailed() {
6414 md_history.BrowserService.getInstance().resolveDelete_(false);
6415 }
6416
6090 // Copyright 2015 The Chromium Authors. All rights reserved. 6417 // Copyright 2015 The Chromium Authors. All rights reserved.
6091 // Use of this source code is governed by a BSD-style license that can be 6418 // Use of this source code is governed by a BSD-style license that can be
6092 // found in the LICENSE file. 6419 // found in the LICENSE file.
6093 Polymer({ 6420 Polymer({
6094 is: 'history-toolbar', 6421 is: 'history-toolbar',
6095 properties: { 6422 properties: {
6096 count: { 6423 count: {
6097 type: Number, 6424 type: Number,
6098 value: 0, 6425 value: 0,
6099 observer: 'changeToolbarView_' 6426 observer: 'changeToolbarView_'
(...skipping 21 matching lines...) Expand all
6121 type: Boolean, 6448 type: Boolean,
6122 reflectToAttribute: true 6449 reflectToAttribute: true
6123 }, 6450 },
6124 groupedRange: { 6451 groupedRange: {
6125 type: Number, 6452 type: Number,
6126 value: 0, 6453 value: 0,
6127 reflectToAttribute: true, 6454 reflectToAttribute: true,
6128 notify: true 6455 notify: true
6129 }, 6456 },
6130 queryStartTime: String, 6457 queryStartTime: String,
6131 queryEndTime: String 6458 queryEndTime: String,
6459 showMenuPromo_: {
6460 type: Boolean,
6461 value: function() {
6462 return loadTimeData.getBoolean('showMenuPromo');
6463 }
6464 }
6132 }, 6465 },
6133 changeToolbarView_: function() { 6466 changeToolbarView_: function() {
6134 this.itemsSelected_ = this.count > 0; 6467 this.itemsSelected_ = this.count > 0;
6135 }, 6468 },
6136 setSearchTerm: function(search) { 6469 setSearchTerm: function(search) {
6137 if (this.searchTerm == search) return; 6470 if (this.searchTerm == search) return;
6138 this.searchTerm = search; 6471 this.searchTerm = search;
6139 var searchField = this.$['main-toolbar'].getSearchField(); 6472 var searchField = this.$['main-toolbar'].getSearchField();
6140 searchField.showAndFocus(); 6473 searchField.showAndFocus();
6141 searchField.setValue(search); 6474 searchField.setValue(search);
6142 }, 6475 },
6476 onMenuPromoShown_: function() {
6477 md_history.BrowserService.getInstance().menuPromoShown();
6478 },
6143 onSearchChanged_: function(event) { 6479 onSearchChanged_: function(event) {
6144 this.searchTerm = event.detail; 6480 this.searchTerm = event.detail;
6145 }, 6481 },
6146 onInfoButtonTap_: function() { 6482 onInfoButtonTap_: function() {
6147 this.$.syncNotice.get().then(function(dropdown) { 6483 this.$.syncNotice.get().then(function(dropdown) {
6148 dropdown.positionTarget = this.$$('#info-button-icon'); 6484 dropdown.positionTarget = this.$$('#info-button-icon');
6149 if (dropdown.style.display == 'none') dropdown.open(); 6485 if (dropdown.style.display == 'none') dropdown.open();
6150 }.bind(this)); 6486 }.bind(this));
6151 }, 6487 },
6152 onClearSelectionTap_: function() { 6488 onClearSelectionTap_: function() {
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
6192 }, 6528 },
6193 close: function(opt_returnValue) { 6529 close: function(opt_returnValue) {
6194 HTMLDialogElement.prototype.close.call(this, 'success'); 6530 HTMLDialogElement.prototype.close.call(this, 'success');
6195 }, 6531 },
6196 getCloseButton: function() { 6532 getCloseButton: function() {
6197 return this.$.close; 6533 return this.$.close;
6198 } 6534 }
6199 }); 6535 });
6200 6536
6201 Polymer({ 6537 Polymer({
6202 is: 'fade-in-animation',
6203 behaviors: [ Polymer.NeonAnimationBehavior ],
6204 configure: function(config) {
6205 var node = config.node;
6206 this._effect = new KeyframeEffect(node, [ {
6207 opacity: '0'
6208 }, {
6209 opacity: '1'
6210 } ], this.timingFromConfig(config));
6211 return this._effect;
6212 }
6213 });
6214
6215 Polymer({
6216 is: 'fade-out-animation',
6217 behaviors: [ Polymer.NeonAnimationBehavior ],
6218 configure: function(config) {
6219 var node = config.node;
6220 this._effect = new KeyframeEffect(node, [ {
6221 opacity: '1'
6222 }, {
6223 opacity: '0'
6224 } ], this.timingFromConfig(config));
6225 return this._effect;
6226 }
6227 });
6228
6229 Polymer({
6230 is: 'paper-menu-grow-height-animation', 6538 is: 'paper-menu-grow-height-animation',
6231 behaviors: [ Polymer.NeonAnimationBehavior ], 6539 behaviors: [ Polymer.NeonAnimationBehavior ],
6232 configure: function(config) { 6540 configure: function(config) {
6233 var node = config.node; 6541 var node = config.node;
6234 var rect = node.getBoundingClientRect(); 6542 var rect = node.getBoundingClientRect();
6235 var height = rect.height; 6543 var height = rect.height;
6236 this._effect = new KeyframeEffect(node, [ { 6544 this._effect = new KeyframeEffect(node, [ {
6237 height: height / 2 + 'px' 6545 height: height / 2 + 'px'
6238 }, { 6546 }, {
6239 height: height + 'px' 6547 height: height + 'px'
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
6420 } 6728 }
6421 }; 6729 };
6422 6730
6423 Polymer.PaperItemBehavior = [ Polymer.IronButtonState, Polymer.IronControlState, Polymer.PaperItemBehaviorImpl ]; 6731 Polymer.PaperItemBehavior = [ Polymer.IronButtonState, Polymer.IronControlState, Polymer.PaperItemBehaviorImpl ];
6424 6732
6425 Polymer({ 6733 Polymer({
6426 is: 'paper-item', 6734 is: 'paper-item',
6427 behaviors: [ Polymer.PaperItemBehavior ] 6735 behaviors: [ Polymer.PaperItemBehavior ]
6428 }); 6736 });
6429 6737
6430 // Copyright 2016 The Chromium Authors. All rights reserved.
6431 // Use of this source code is governed by a BSD-style license that can be
6432 // found in the LICENSE file.
6433 cr.define('md_history', function() {
6434 function BrowserService() {
6435 this.pendingDeleteItems_ = null;
6436 this.pendingDeletePromise_ = null;
6437 }
6438 BrowserService.prototype = {
6439 deleteItems: function(items) {
6440 if (this.pendingDeleteItems_ != null) {
6441 return new Promise(function(resolve, reject) {
6442 reject(items);
6443 });
6444 }
6445 var removalList = items.map(function(item) {
6446 return {
6447 url: item.url,
6448 timestamps: item.allTimestamps
6449 };
6450 });
6451 this.pendingDeleteItems_ = items;
6452 this.pendingDeletePromise_ = new PromiseResolver();
6453 chrome.send('removeVisits', removalList);
6454 return this.pendingDeletePromise_.promise;
6455 },
6456 removeBookmark: function(url) {
6457 chrome.send('removeBookmark', [ url ]);
6458 },
6459 openForeignSessionAllTabs: function(sessionTag) {
6460 chrome.send('openForeignSession', [ sessionTag ]);
6461 },
6462 openForeignSessionTab: function(sessionTag, windowId, tabId, e) {
6463 chrome.send('openForeignSession', [ sessionTag, String(windowId), String(t abId), e.button || 0, e.altKey, e.ctrlKey, e.metaKey, e.shiftKey ]);
6464 },
6465 deleteForeignSession: function(sessionTag) {
6466 chrome.send('deleteForeignSession', [ sessionTag ]);
6467 },
6468 openClearBrowsingData: function() {
6469 chrome.send('clearBrowsingData');
6470 },
6471 recordHistogram: function(histogram, value, max) {
6472 chrome.send('metricsHandler:recordInHistogram', [ histogram, value, max ]) ;
6473 },
6474 recordAction: function(action) {
6475 if (action.indexOf('_') == -1) action = 'HistoryPage_' + action;
6476 chrome.send('metricsHandler:recordAction', [ action ]);
6477 },
6478 resolveDelete_: function(successful) {
6479 if (this.pendingDeleteItems_ == null || this.pendingDeletePromise_ == null ) {
6480 return;
6481 }
6482 if (successful) this.pendingDeletePromise_.resolve(this.pendingDeleteItems _); else this.pendingDeletePromise_.reject(this.pendingDeleteItems_);
6483 this.pendingDeleteItems_ = null;
6484 this.pendingDeletePromise_ = null;
6485 }
6486 };
6487 cr.addSingletonGetter(BrowserService);
6488 return {
6489 BrowserService: BrowserService
6490 };
6491 });
6492
6493 function deleteComplete() {
6494 md_history.BrowserService.getInstance().resolveDelete_(true);
6495 }
6496
6497 function deleteFailed() {
6498 md_history.BrowserService.getInstance().resolveDelete_(false);
6499 }
6500
6501 Polymer({ 6738 Polymer({
6502 is: 'iron-collapse', 6739 is: 'iron-collapse',
6503 behaviors: [ Polymer.IronResizableBehavior ], 6740 behaviors: [ Polymer.IronResizableBehavior ],
6504 properties: { 6741 properties: {
6505 horizontal: { 6742 horizontal: {
6506 type: Boolean, 6743 type: Boolean,
6507 value: false, 6744 value: false,
6508 observer: '_horizontalChanged' 6745 observer: '_horizontalChanged'
6509 }, 6746 },
6510 opened: { 6747 opened: {
(...skipping 2187 matching lines...) Expand 10 before | Expand all | Expand 10 after
8698 8935
8699 case HistoryRange.MONTH: 8936 case HistoryRange.MONTH:
8700 histogramValue = HistoryPageViewHistogram.GROUPED_MONTH; 8937 histogramValue = HistoryPageViewHistogram.GROUPED_MONTH;
8701 break; 8938 break;
8702 } 8939 }
8703 break; 8940 break;
8704 } 8941 }
8705 md_history.BrowserService.getInstance().recordHistogram('History.HistoryPage View', histogramValue, HistoryPageViewHistogram.END); 8942 md_history.BrowserService.getInstance().recordHistogram('History.HistoryPage View', histogramValue, HistoryPageViewHistogram.END);
8706 } 8943 }
8707 }); 8944 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698