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

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

Issue 2354193002: Revert "MD History: promote menu button to show clear browsing data in narrow mode" (Closed)
Patch Set: 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 6038 matching lines...) Expand 10 before | Expand all | Expand 10 after
6049 // Copyright 2016 The Chromium Authors. All rights reserved. 6049 // Copyright 2016 The Chromium Authors. All rights reserved.
6050 // Use of this source code is governed by a BSD-style license that can be 6050 // Use of this source code is governed by a BSD-style license that can be
6051 // found in the LICENSE file. 6051 // found in the LICENSE file.
6052 Polymer({ 6052 Polymer({
6053 is: 'cr-toolbar', 6053 is: 'cr-toolbar',
6054 properties: { 6054 properties: {
6055 pageName: String, 6055 pageName: String,
6056 searchPrompt: String, 6056 searchPrompt: String,
6057 clearLabel: String, 6057 clearLabel: String,
6058 menuLabel: String, 6058 menuLabel: String,
6059 menuPromo: String,
6060 spinnerActive: Boolean, 6059 spinnerActive: Boolean,
6061 showMenu: { 6060 showMenu: {
6062 type: Boolean, 6061 type: Boolean,
6063 value: false 6062 value: false
6064 }, 6063 },
6065 showMenuPromo: {
6066 type: Boolean,
6067 value: false
6068 },
6069 closeMenuPromo: String,
6070 narrow_: { 6064 narrow_: {
6071 type: Boolean, 6065 type: Boolean,
6072 reflectToAttribute: true 6066 reflectToAttribute: true
6073 }, 6067 },
6074 showingSearch_: { 6068 showingSearch_: {
6075 type: Boolean, 6069 type: Boolean,
6076 reflectToAttribute: true 6070 reflectToAttribute: true
6077 } 6071 }
6078 }, 6072 },
6079 observers: [ 'possiblyShowMenuPromo_(showMenu, showMenuPromo, showingSearch_)' ],
6080 getSearchField: function() { 6073 getSearchField: function() {
6081 return this.$.search; 6074 return this.$.search;
6082 }, 6075 },
6083 onClosePromoTap_: function() { 6076 onMenuTap_: function(e) {
6084 this.showMenuPromo = false;
6085 },
6086 onMenuTap_: function() {
6087 this.fire('cr-menu-tap'); 6077 this.fire('cr-menu-tap');
6088 this.onClosePromoTap_();
6089 },
6090 possiblyShowMenuPromo_: function() {
6091 Polymer.RenderStatus.afterNextRender(this, function() {
6092 if (this.showMenu && this.showMenuPromo && !this.showingSearch_) {
6093 this.$$('#menuPromo').animate({
6094 opacity: [ 0, .9 ]
6095 }, {
6096 duration: 500,
6097 fill: 'forwards'
6098 });
6099 this.fire('cr-menu-promo-shown');
6100 }
6101 }.bind(this));
6102 },
6103 titleIfNotShowMenuPromo_: function(title, showMenuPromo) {
6104 return showMenuPromo ? '' : title;
6105 } 6078 }
6106 }); 6079 });
6107 6080
6108 // Copyright 2016 The Chromium Authors. All rights reserved.
6109 // Use of this source code is governed by a BSD-style license that can be
6110 // found in the LICENSE file.
6111 cr.define('md_history', function() {
6112 function BrowserService() {
6113 this.pendingDeleteItems_ = null;
6114 this.pendingDeletePromise_ = null;
6115 }
6116 BrowserService.prototype = {
6117 deleteItems: function(items) {
6118 if (this.pendingDeleteItems_ != null) {
6119 return new Promise(function(resolve, reject) {
6120 reject(items);
6121 });
6122 }
6123 var removalList = items.map(function(item) {
6124 return {
6125 url: item.url,
6126 timestamps: item.allTimestamps
6127 };
6128 });
6129 this.pendingDeleteItems_ = items;
6130 this.pendingDeletePromise_ = new PromiseResolver();
6131 chrome.send('removeVisits', removalList);
6132 return this.pendingDeletePromise_.promise;
6133 },
6134 removeBookmark: function(url) {
6135 chrome.send('removeBookmark', [ url ]);
6136 },
6137 openForeignSessionAllTabs: function(sessionTag) {
6138 chrome.send('openForeignSession', [ sessionTag ]);
6139 },
6140 openForeignSessionTab: function(sessionTag, windowId, tabId, e) {
6141 chrome.send('openForeignSession', [ sessionTag, String(windowId), String(t abId), e.button || 0, e.altKey, e.ctrlKey, e.metaKey, e.shiftKey ]);
6142 },
6143 deleteForeignSession: function(sessionTag) {
6144 chrome.send('deleteForeignSession', [ sessionTag ]);
6145 },
6146 openClearBrowsingData: function() {
6147 chrome.send('clearBrowsingData');
6148 },
6149 recordHistogram: function(histogram, value, max) {
6150 chrome.send('metricsHandler:recordInHistogram', [ histogram, value, max ]) ;
6151 },
6152 recordAction: function(action) {
6153 if (action.indexOf('_') == -1) action = 'HistoryPage_' + action;
6154 chrome.send('metricsHandler:recordAction', [ action ]);
6155 },
6156 resolveDelete_: function(successful) {
6157 if (this.pendingDeleteItems_ == null || this.pendingDeletePromise_ == null ) {
6158 return;
6159 }
6160 if (successful) this.pendingDeletePromise_.resolve(this.pendingDeleteItems _); else this.pendingDeletePromise_.reject(this.pendingDeleteItems_);
6161 this.pendingDeleteItems_ = null;
6162 this.pendingDeletePromise_ = null;
6163 },
6164 menuPromoShown: function() {
6165 chrome.send('menuPromoShown');
6166 }
6167 };
6168 cr.addSingletonGetter(BrowserService);
6169 return {
6170 BrowserService: BrowserService
6171 };
6172 });
6173
6174 function deleteComplete() {
6175 md_history.BrowserService.getInstance().resolveDelete_(true);
6176 }
6177
6178 function deleteFailed() {
6179 md_history.BrowserService.getInstance().resolveDelete_(false);
6180 }
6181
6182 // Copyright 2015 The Chromium Authors. All rights reserved. 6081 // Copyright 2015 The Chromium Authors. All rights reserved.
6183 // Use of this source code is governed by a BSD-style license that can be 6082 // Use of this source code is governed by a BSD-style license that can be
6184 // found in the LICENSE file. 6083 // found in the LICENSE file.
6185 Polymer({ 6084 Polymer({
6186 is: 'history-toolbar', 6085 is: 'history-toolbar',
6187 properties: { 6086 properties: {
6188 count: { 6087 count: {
6189 type: Number, 6088 type: Number,
6190 value: 0, 6089 value: 0,
6191 observer: 'changeToolbarView_' 6090 observer: 'changeToolbarView_'
(...skipping 21 matching lines...) Expand all
6213 type: Boolean, 6112 type: Boolean,
6214 reflectToAttribute: true 6113 reflectToAttribute: true
6215 }, 6114 },
6216 groupedRange: { 6115 groupedRange: {
6217 type: Number, 6116 type: Number,
6218 value: 0, 6117 value: 0,
6219 reflectToAttribute: true, 6118 reflectToAttribute: true,
6220 notify: true 6119 notify: true
6221 }, 6120 },
6222 queryStartTime: String, 6121 queryStartTime: String,
6223 queryEndTime: String, 6122 queryEndTime: String
6224 showMenuPromo_: {
6225 type: Boolean,
6226 value: function() {
6227 return loadTimeData.getBoolean('showMenuPromo');
6228 }
6229 }
6230 }, 6123 },
6231 changeToolbarView_: function() { 6124 changeToolbarView_: function() {
6232 this.itemsSelected_ = this.count > 0; 6125 this.itemsSelected_ = this.count > 0;
6233 }, 6126 },
6234 setSearchTerm: function(search) { 6127 setSearchTerm: function(search) {
6235 if (this.searchTerm == search) return; 6128 if (this.searchTerm == search) return;
6236 this.searchTerm = search; 6129 this.searchTerm = search;
6237 var searchField = this.$['main-toolbar'].getSearchField(); 6130 var searchField = this.$['main-toolbar'].getSearchField();
6238 searchField.showAndFocus(); 6131 searchField.showAndFocus();
6239 searchField.setValue(search); 6132 searchField.setValue(search);
6240 }, 6133 },
6241 onMenuPromoShown_: function() {
6242 md_history.BrowserService.getInstance().menuPromoShown();
6243 },
6244 onSearchChanged_: function(event) { 6134 onSearchChanged_: function(event) {
6245 this.searchTerm = event.detail; 6135 this.searchTerm = event.detail;
6246 }, 6136 },
6247 onInfoButtonTap_: function() { 6137 onInfoButtonTap_: function() {
6248 var dropdown = this.$.syncNotice.get(); 6138 var dropdown = this.$.syncNotice.get();
6249 dropdown.positionTarget = this.$$('#info-button-icon'); 6139 dropdown.positionTarget = this.$$('#info-button-icon');
6250 if (dropdown.style.display == 'none') dropdown.open(); 6140 if (dropdown.style.display == 'none') dropdown.open();
6251 }, 6141 },
6252 onClearSelectionTap_: function() { 6142 onClearSelectionTap_: function() {
6253 this.fire('unselect-all'); 6143 this.fire('unselect-all');
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
6520 } 6410 }
6521 }; 6411 };
6522 6412
6523 Polymer.PaperItemBehavior = [ Polymer.IronButtonState, Polymer.IronControlState, Polymer.PaperItemBehaviorImpl ]; 6413 Polymer.PaperItemBehavior = [ Polymer.IronButtonState, Polymer.IronControlState, Polymer.PaperItemBehaviorImpl ];
6524 6414
6525 Polymer({ 6415 Polymer({
6526 is: 'paper-item', 6416 is: 'paper-item',
6527 behaviors: [ Polymer.PaperItemBehavior ] 6417 behaviors: [ Polymer.PaperItemBehavior ]
6528 }); 6418 });
6529 6419
6420 // Copyright 2016 The Chromium Authors. All rights reserved.
6421 // Use of this source code is governed by a BSD-style license that can be
6422 // found in the LICENSE file.
6423 cr.define('md_history', function() {
6424 function BrowserService() {
6425 this.pendingDeleteItems_ = null;
6426 this.pendingDeletePromise_ = null;
6427 }
6428 BrowserService.prototype = {
6429 deleteItems: function(items) {
6430 if (this.pendingDeleteItems_ != null) {
6431 return new Promise(function(resolve, reject) {
6432 reject(items);
6433 });
6434 }
6435 var removalList = items.map(function(item) {
6436 return {
6437 url: item.url,
6438 timestamps: item.allTimestamps
6439 };
6440 });
6441 this.pendingDeleteItems_ = items;
6442 this.pendingDeletePromise_ = new PromiseResolver();
6443 chrome.send('removeVisits', removalList);
6444 return this.pendingDeletePromise_.promise;
6445 },
6446 removeBookmark: function(url) {
6447 chrome.send('removeBookmark', [ url ]);
6448 },
6449 openForeignSessionAllTabs: function(sessionTag) {
6450 chrome.send('openForeignSession', [ sessionTag ]);
6451 },
6452 openForeignSessionTab: function(sessionTag, windowId, tabId, e) {
6453 chrome.send('openForeignSession', [ sessionTag, String(windowId), String(t abId), e.button || 0, e.altKey, e.ctrlKey, e.metaKey, e.shiftKey ]);
6454 },
6455 deleteForeignSession: function(sessionTag) {
6456 chrome.send('deleteForeignSession', [ sessionTag ]);
6457 },
6458 openClearBrowsingData: function() {
6459 chrome.send('clearBrowsingData');
6460 },
6461 recordHistogram: function(histogram, value, max) {
6462 chrome.send('metricsHandler:recordInHistogram', [ histogram, value, max ]) ;
6463 },
6464 recordAction: function(action) {
6465 if (action.indexOf('_') == -1) action = 'HistoryPage_' + action;
6466 chrome.send('metricsHandler:recordAction', [ action ]);
6467 },
6468 resolveDelete_: function(successful) {
6469 if (this.pendingDeleteItems_ == null || this.pendingDeletePromise_ == null ) {
6470 return;
6471 }
6472 if (successful) this.pendingDeletePromise_.resolve(this.pendingDeleteItems _); else this.pendingDeletePromise_.reject(this.pendingDeleteItems_);
6473 this.pendingDeleteItems_ = null;
6474 this.pendingDeletePromise_ = null;
6475 }
6476 };
6477 cr.addSingletonGetter(BrowserService);
6478 return {
6479 BrowserService: BrowserService
6480 };
6481 });
6482
6483 function deleteComplete() {
6484 md_history.BrowserService.getInstance().resolveDelete_(true);
6485 }
6486
6487 function deleteFailed() {
6488 md_history.BrowserService.getInstance().resolveDelete_(false);
6489 }
6490
6530 Polymer({ 6491 Polymer({
6531 is: 'iron-collapse', 6492 is: 'iron-collapse',
6532 behaviors: [ Polymer.IronResizableBehavior ], 6493 behaviors: [ Polymer.IronResizableBehavior ],
6533 properties: { 6494 properties: {
6534 horizontal: { 6495 horizontal: {
6535 type: Boolean, 6496 type: Boolean,
6536 value: false, 6497 value: false,
6537 observer: '_horizontalChanged' 6498 observer: '_horizontalChanged'
6538 }, 6499 },
6539 opened: { 6500 opened: {
(...skipping 2400 matching lines...) Expand 10 before | Expand all | Expand 10 after
8940 8901
8941 case HistoryRange.MONTH: 8902 case HistoryRange.MONTH:
8942 histogramValue = HistoryPageViewHistogram.GROUPED_MONTH; 8903 histogramValue = HistoryPageViewHistogram.GROUPED_MONTH;
8943 break; 8904 break;
8944 } 8905 }
8945 break; 8906 break;
8946 } 8907 }
8947 md_history.BrowserService.getInstance().recordHistogram('History.HistoryPage View', histogramValue, HistoryPageViewHistogram.END); 8908 md_history.BrowserService.getInstance().recordHistogram('History.HistoryPage View', histogramValue, HistoryPageViewHistogram.END);
8948 } 8909 }
8949 }); 8910 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/md_downloads/vulcanized.html ('k') | chrome/browser/resources/md_history/app.vulcanized.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698