OLD | NEW |
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 5362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5373 if (cl.contains('expand')) { | 5373 if (cl.contains('expand')) { |
5374 cl.remove('expand'); | 5374 cl.remove('expand'); |
5375 cl.add('contract'); | 5375 cl.add('contract'); |
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. |
| 5384 // Use of this source code is governed by a BSD-style license that can be |
| 5385 // found in the LICENSE file. |
| 5386 Polymer({ |
| 5387 is: 'cr-lazy-render', |
| 5388 "extends": 'template', |
| 5389 behaviors: [ Polymer.Templatizer ], |
| 5390 _renderPromise: null, |
| 5391 _instance: null, |
| 5392 get: function() { |
| 5393 if (!this._renderPromise) { |
| 5394 this._renderPromise = new Promise(function(resolve) { |
| 5395 this._debounceTemplate(function() { |
| 5396 this._render(); |
| 5397 this._renderPromise = null; |
| 5398 resolve(this.getIfExists()); |
| 5399 }.bind(this)); |
| 5400 }.bind(this)); |
| 5401 } |
| 5402 return this._renderPromise; |
| 5403 }, |
| 5404 getIfExists: function() { |
| 5405 if (this._instance) { |
| 5406 var children = this._instance._children; |
| 5407 for (var i = 0; i < children.length; i++) { |
| 5408 if (children[i].nodeType == Node.ELEMENT_NODE) return children[i]; |
| 5409 } |
| 5410 } |
| 5411 return null; |
| 5412 }, |
| 5413 _render: function() { |
| 5414 if (!this.ctor) this.templatize(this); |
| 5415 var parentNode = this.parentNode; |
| 5416 if (parentNode && !this._instance) { |
| 5417 this._instance = this.stamp({}); |
| 5418 var root = this._instance.root; |
| 5419 parentNode.insertBefore(root, this); |
| 5420 } |
| 5421 }, |
| 5422 _forwardParentProp: function(prop, value) { |
| 5423 if (this._instance) this._instance.__setProperty(prop, value, true); |
| 5424 }, |
| 5425 _forwardParentPath: function(path, value) { |
| 5426 if (this._instance) this._instance._notifyPath(path, value, true); |
| 5427 } |
| 5428 }); |
| 5429 |
5383 (function() { | 5430 (function() { |
5384 'use strict'; | 5431 'use strict'; |
5385 Polymer.IronA11yAnnouncer = Polymer({ | 5432 Polymer.IronA11yAnnouncer = Polymer({ |
5386 is: 'iron-a11y-announcer', | 5433 is: 'iron-a11y-announcer', |
5387 properties: { | 5434 properties: { |
5388 mode: { | 5435 mode: { |
5389 type: String, | 5436 type: String, |
5390 value: 'polite' | 5437 value: 'polite' |
5391 }, | 5438 }, |
5392 _text: { | 5439 _text: { |
(...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6033 } | 6080 } |
6034 }, | 6081 }, |
6035 getSearchField: function() { | 6082 getSearchField: function() { |
6036 return this.$.search; | 6083 return this.$.search; |
6037 }, | 6084 }, |
6038 onMenuTap_: function(e) { | 6085 onMenuTap_: function(e) { |
6039 this.fire('cr-menu-tap'); | 6086 this.fire('cr-menu-tap'); |
6040 } | 6087 } |
6041 }); | 6088 }); |
6042 | 6089 |
6043 // Copyright 2016 The Chromium Authors. All rights reserved. | |
6044 // Use of this source code is governed by a BSD-style license that can be | |
6045 // found in the LICENSE file. | |
6046 Polymer({ | |
6047 is: 'history-lazy-render', | |
6048 "extends": 'template', | |
6049 behaviors: [ Polymer.Templatizer ], | |
6050 _renderPromise: null, | |
6051 _instance: null, | |
6052 get: function() { | |
6053 if (!this._renderPromise) { | |
6054 this._renderPromise = new Promise(function(resolve) { | |
6055 this._debounceTemplate(function() { | |
6056 this._render(); | |
6057 this._renderPromise = null; | |
6058 resolve(this.getIfExists()); | |
6059 }.bind(this)); | |
6060 }.bind(this)); | |
6061 } | |
6062 return this._renderPromise; | |
6063 }, | |
6064 getIfExists: function() { | |
6065 if (this._instance) { | |
6066 var children = this._instance._children; | |
6067 for (var i = 0; i < children.length; i++) { | |
6068 if (children[i].nodeType == Node.ELEMENT_NODE) return children[i]; | |
6069 } | |
6070 } | |
6071 return null; | |
6072 }, | |
6073 _render: function() { | |
6074 if (!this.ctor) this.templatize(this); | |
6075 var parentNode = this.parentNode; | |
6076 if (parentNode && !this._instance) { | |
6077 this._instance = this.stamp({}); | |
6078 var root = this._instance.root; | |
6079 parentNode.insertBefore(root, this); | |
6080 } | |
6081 }, | |
6082 _forwardParentProp: function(prop, value) { | |
6083 if (this._instance) this._instance.__setProperty(prop, value, true); | |
6084 }, | |
6085 _forwardParentPath: function(path, value) { | |
6086 if (this._instance) this._instance._notifyPath(path, value, true); | |
6087 } | |
6088 }); | |
6089 | |
6090 // Copyright 2015 The Chromium Authors. All rights reserved. | 6090 // Copyright 2015 The Chromium Authors. All rights reserved. |
6091 // Use of this source code is governed by a BSD-style license that can be | 6091 // Use of this source code is governed by a BSD-style license that can be |
6092 // found in the LICENSE file. | 6092 // found in the LICENSE file. |
6093 Polymer({ | 6093 Polymer({ |
6094 is: 'history-toolbar', | 6094 is: 'history-toolbar', |
6095 properties: { | 6095 properties: { |
6096 count: { | 6096 count: { |
6097 type: Number, | 6097 type: Number, |
6098 value: 0, | 6098 value: 0, |
6099 observer: 'changeToolbarView_' | 6099 observer: 'changeToolbarView_' |
(...skipping 2597 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8697 | 8697 |
8698 case HistoryRange.MONTH: | 8698 case HistoryRange.MONTH: |
8699 histogramValue = HistoryPageViewHistogram.GROUPED_MONTH; | 8699 histogramValue = HistoryPageViewHistogram.GROUPED_MONTH; |
8700 break; | 8700 break; |
8701 } | 8701 } |
8702 break; | 8702 break; |
8703 } | 8703 } |
8704 md_history.BrowserService.getInstance().recordHistogram('History.HistoryPage
View', histogramValue, HistoryPageViewHistogram.END); | 8704 md_history.BrowserService.getInstance().recordHistogram('History.HistoryPage
View', histogramValue, HistoryPageViewHistogram.END); |
8705 } | 8705 } |
8706 }); | 8706 }); |
OLD | NEW |