Index: chrome/browser/resources/md_history/app.crisper.js |
diff --git a/chrome/browser/resources/md_history/app.crisper.js b/chrome/browser/resources/md_history/app.crisper.js |
index 8ae2931050341fc41cc6c612054f1ef4cafbd0ef..13cac26558957c4e08da8fa30bef5a3d9b8dae8e 100644 |
--- a/chrome/browser/resources/md_history/app.crisper.js |
+++ b/chrome/browser/resources/md_history/app.crisper.js |
@@ -5387,37 +5387,37 @@ Polymer({ |
is: 'cr-lazy-render', |
"extends": 'template', |
behaviors: [ Polymer.Templatizer ], |
- _renderPromise: null, |
- _child: null, |
+ renderPromise_: null, |
+ child_: null, |
get: function() { |
- if (!this._renderPromise) { |
- this._renderPromise = new Promise(function(resolve) { |
+ if (!this.renderPromise_) { |
+ this.renderPromise_ = new Promise(function(resolve) { |
this._debounceTemplate(function() { |
- this._render(); |
- this._renderPromise = null; |
+ this.render_(); |
+ this.renderPromise_ = null; |
resolve(this.getIfExists()); |
}.bind(this)); |
}.bind(this)); |
} |
- return this._renderPromise; |
+ return this.renderPromise_; |
}, |
getIfExists: function() { |
- return this._child; |
+ return this.child_; |
}, |
- _render: function() { |
+ render_: function() { |
if (!this.ctor) this.templatize(this); |
var parentNode = this.parentNode; |
- if (parentNode && !this._child) { |
+ if (parentNode && !this.child_) { |
var instance = this.stamp({}); |
- this._child = instance.root.querySelector('*'); |
+ this.child_ = instance.root.firstElementChild; |
parentNode.insertBefore(instance.root, this); |
} |
}, |
_forwardParentProp: function(prop, value) { |
- if (this._child) this._child._templateInstance[prop] = value; |
+ if (this.child_) this.child_._templateInstance[prop] = value; |
}, |
_forwardParentPath: function(path, value) { |
- if (this._child) this._child._templateInstance.notifyPath(path, value, true); |
+ if (this.child_) this.child_._templateInstance.notifyPath(path, value, true); |
} |
}); |
@@ -6059,11 +6059,17 @@ Polymer({ |
searchPrompt: String, |
clearLabel: String, |
menuLabel: String, |
+ menuPromo: String, |
spinnerActive: Boolean, |
showMenu: { |
type: Boolean, |
value: false |
}, |
+ showMenuPromo: { |
+ type: Boolean, |
+ value: false |
+ }, |
+ closeMenuPromo: String, |
narrow_: { |
type: Boolean, |
reflectToAttribute: true |
@@ -6073,14 +6079,108 @@ Polymer({ |
reflectToAttribute: true |
} |
}, |
+ observers: [ 'possiblyShowMenuPromo_(showMenu, showMenuPromo, showingSearch_)' ], |
getSearchField: function() { |
return this.$.search; |
}, |
- onMenuTap_: function(e) { |
+ onClosePromoTap_: function() { |
+ this.showMenuPromo = false; |
+ }, |
+ onMenuTap_: function() { |
this.fire('cr-menu-tap'); |
+ this.onClosePromoTap_(); |
+ }, |
+ possiblyShowMenuPromo_: function() { |
+ Polymer.RenderStatus.afterNextRender(this, function() { |
+ if (this.showMenu && this.showMenuPromo && !this.showingSearch_) { |
+ this.$$('#menuPromo').animate({ |
+ opacity: [ 0, .9 ] |
+ }, { |
+ duration: 500, |
+ fill: 'forwards' |
+ }); |
+ } |
+ }.bind(this)); |
+ }, |
+ titleIfNotShowMenuPromo_: function(title, showMenuPromo) { |
+ return showMenuPromo ? '' : title; |
} |
}); |
+// Copyright 2016 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+cr.define('md_history', function() { |
+ function BrowserService() { |
+ this.pendingDeleteItems_ = null; |
+ this.pendingDeletePromise_ = null; |
+ } |
+ BrowserService.prototype = { |
+ deleteItems: function(items) { |
+ if (this.pendingDeleteItems_ != null) { |
+ return new Promise(function(resolve, reject) { |
+ reject(items); |
+ }); |
+ } |
+ var removalList = items.map(function(item) { |
+ return { |
+ url: item.url, |
+ timestamps: item.allTimestamps |
+ }; |
+ }); |
+ this.pendingDeleteItems_ = items; |
+ this.pendingDeletePromise_ = new PromiseResolver(); |
+ chrome.send('removeVisits', removalList); |
+ return this.pendingDeletePromise_.promise; |
+ }, |
+ removeBookmark: function(url) { |
+ chrome.send('removeBookmark', [ url ]); |
+ }, |
+ openForeignSessionAllTabs: function(sessionTag) { |
+ chrome.send('openForeignSession', [ sessionTag ]); |
+ }, |
+ openForeignSessionTab: function(sessionTag, windowId, tabId, e) { |
+ chrome.send('openForeignSession', [ sessionTag, String(windowId), String(tabId), e.button || 0, e.altKey, e.ctrlKey, e.metaKey, e.shiftKey ]); |
+ }, |
+ deleteForeignSession: function(sessionTag) { |
+ chrome.send('deleteForeignSession', [ sessionTag ]); |
+ }, |
+ openClearBrowsingData: function() { |
+ chrome.send('clearBrowsingData'); |
+ }, |
+ recordHistogram: function(histogram, value, max) { |
+ chrome.send('metricsHandler:recordInHistogram', [ histogram, value, max ]); |
+ }, |
+ recordAction: function(action) { |
+ if (action.indexOf('_') == -1) action = 'HistoryPage_' + action; |
+ chrome.send('metricsHandler:recordAction', [ action ]); |
+ }, |
+ resolveDelete_: function(successful) { |
+ if (this.pendingDeleteItems_ == null || this.pendingDeletePromise_ == null) { |
+ return; |
+ } |
+ if (successful) this.pendingDeletePromise_.resolve(this.pendingDeleteItems_); else this.pendingDeletePromise_.reject(this.pendingDeleteItems_); |
+ this.pendingDeleteItems_ = null; |
+ this.pendingDeletePromise_ = null; |
+ }, |
+ menuPromoShown: function() { |
+ chrome.send('menuPromoShown'); |
+ } |
+ }; |
+ cr.addSingletonGetter(BrowserService); |
+ return { |
+ BrowserService: BrowserService |
+ }; |
+}); |
+ |
+function deleteComplete() { |
+ md_history.BrowserService.getInstance().resolveDelete_(true); |
+} |
+ |
+function deleteFailed() { |
+ md_history.BrowserService.getInstance().resolveDelete_(false); |
+} |
+ |
// Copyright 2015 The Chromium Authors. All rights reserved. |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
@@ -6122,7 +6222,13 @@ Polymer({ |
notify: true |
}, |
queryStartTime: String, |
- queryEndTime: String |
+ queryEndTime: String, |
+ showMenuPromo_: { |
+ type: Boolean, |
+ value: function() { |
+ return loadTimeData.getBoolean('showMenuPromo'); |
+ } |
+ } |
}, |
changeToolbarView_: function() { |
this.itemsSelected_ = this.count > 0; |
@@ -6134,6 +6240,9 @@ Polymer({ |
searchField.showAndFocus(); |
searchField.setValue(search); |
}, |
+ onMenuPromoShown_: function() { |
+ md_history.BrowserService.getInstance().menuPromoShown(); |
+ }, |
onSearchChanged_: function(event) { |
this.searchTerm = event.detail; |
}, |
@@ -6421,77 +6530,6 @@ Polymer({ |
behaviors: [ Polymer.PaperItemBehavior ] |
}); |
-// Copyright 2016 The Chromium Authors. All rights reserved. |
-// Use of this source code is governed by a BSD-style license that can be |
-// found in the LICENSE file. |
-cr.define('md_history', function() { |
- function BrowserService() { |
- this.pendingDeleteItems_ = null; |
- this.pendingDeletePromise_ = null; |
- } |
- BrowserService.prototype = { |
- deleteItems: function(items) { |
- if (this.pendingDeleteItems_ != null) { |
- return new Promise(function(resolve, reject) { |
- reject(items); |
- }); |
- } |
- var removalList = items.map(function(item) { |
- return { |
- url: item.url, |
- timestamps: item.allTimestamps |
- }; |
- }); |
- this.pendingDeleteItems_ = items; |
- this.pendingDeletePromise_ = new PromiseResolver(); |
- chrome.send('removeVisits', removalList); |
- return this.pendingDeletePromise_.promise; |
- }, |
- removeBookmark: function(url) { |
- chrome.send('removeBookmark', [ url ]); |
- }, |
- openForeignSessionAllTabs: function(sessionTag) { |
- chrome.send('openForeignSession', [ sessionTag ]); |
- }, |
- openForeignSessionTab: function(sessionTag, windowId, tabId, e) { |
- chrome.send('openForeignSession', [ sessionTag, String(windowId), String(tabId), e.button || 0, e.altKey, e.ctrlKey, e.metaKey, e.shiftKey ]); |
- }, |
- deleteForeignSession: function(sessionTag) { |
- chrome.send('deleteForeignSession', [ sessionTag ]); |
- }, |
- openClearBrowsingData: function() { |
- chrome.send('clearBrowsingData'); |
- }, |
- recordHistogram: function(histogram, value, max) { |
- chrome.send('metricsHandler:recordInHistogram', [ histogram, value, max ]); |
- }, |
- recordAction: function(action) { |
- if (action.indexOf('_') == -1) action = 'HistoryPage_' + action; |
- chrome.send('metricsHandler:recordAction', [ action ]); |
- }, |
- resolveDelete_: function(successful) { |
- if (this.pendingDeleteItems_ == null || this.pendingDeletePromise_ == null) { |
- return; |
- } |
- if (successful) this.pendingDeletePromise_.resolve(this.pendingDeleteItems_); else this.pendingDeletePromise_.reject(this.pendingDeleteItems_); |
- this.pendingDeleteItems_ = null; |
- this.pendingDeletePromise_ = null; |
- } |
- }; |
- cr.addSingletonGetter(BrowserService); |
- return { |
- BrowserService: BrowserService |
- }; |
-}); |
- |
-function deleteComplete() { |
- md_history.BrowserService.getInstance().resolveDelete_(true); |
-} |
- |
-function deleteFailed() { |
- md_history.BrowserService.getInstance().resolveDelete_(false); |
-} |
- |
Polymer({ |
is: 'iron-collapse', |
behaviors: [ Polymer.IronResizableBehavior ], |