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

Side by Side Diff: chrome/browser/resources/md_history/history_list.js

Issue 2097003002: MD History: Remove bookmark when clicking bookmark star (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add event listener to remove all bookmark stars Created 4 years, 6 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 Polymer({ 5 Polymer({
6 is: 'history-list', 6 is: 'history-list',
7 7
8 properties: { 8 properties: {
9 // The search term for the current query. Set when the query returns. 9 // The search term for the current query. Set when the query returns.
10 searchedTerm: { 10 searchedTerm: {
(...skipping 11 matching lines...) Expand all
22 resultLoadingDisabled_: { 22 resultLoadingDisabled_: {
23 type: Boolean, 23 type: Boolean,
24 value: false, 24 value: false,
25 }, 25 },
26 }, 26 },
27 27
28 listeners: { 28 listeners: {
29 'infinite-list.scroll': 'closeMenu_', 29 'infinite-list.scroll': 'closeMenu_',
30 'tap': 'closeMenu_', 30 'tap': 'closeMenu_',
31 'toggle-menu': 'toggleMenu_', 31 'toggle-menu': 'toggleMenu_',
32 'remove-bookmark-stars': 'removeBookmarkStars_',
32 }, 33 },
33 34
34 /** 35 /**
35 * Closes the overflow menu. 36 * Closes the overflow menu.
36 * @private 37 * @private
37 */ 38 */
38 closeMenu_: function() { 39 closeMenu_: function() {
39 /** @type {CrSharedMenuElement} */(this.$.sharedMenu).closeMenu(); 40 /** @type {CrSharedMenuElement} */(this.$.sharedMenu).closeMenu();
40 }, 41 },
41 42
42 /** 43 /**
43 * Opens the overflow menu unless the menu is already open and the same button 44 * Opens the overflow menu unless the menu is already open and the same button
44 * is pressed. 45 * is pressed.
45 * @param {{detail: {item: !HistoryEntry, target: !HTMLElement}}} e 46 * @param {{detail: {item: !HistoryEntry, target: !HTMLElement}}} e
46 * @private 47 * @private
47 */ 48 */
48 toggleMenu_: function(e) { 49 toggleMenu_: function(e) {
49 var target = e.detail.target; 50 var target = e.detail.target;
50 /** @type {CrSharedMenuElement} */(this.$.sharedMenu).toggleMenu( 51 /** @type {CrSharedMenuElement} */(this.$.sharedMenu).toggleMenu(
51 target, e.detail.item); 52 target, e.detail.item);
52 }, 53 },
53 54
55 /**
56 * Remove bookmark star of an url's all history items.
calamity 2016/06/29 07:36:05 nit: Remove bookmark star for history items with m
lshang 2016/07/01 01:15:16 Done.
57 * @param {{detail: !string}} e
58 * @private
59 */
60 removeBookmarkStars_: function(e) {
61 var url = e.detail;
62
63 if (this.historyData_ === undefined)
64 return;
65
66 for (var i = 0; i < this.historyData_.length; i++) {
67 if (this.historyData_[i].url == url) {
calamity 2016/06/29 07:36:05 nit: No braces needed for single line if.
lshang 2016/07/01 01:15:16 Done.
68 this.set('historyData_.' + i + '.starred', false);
69 }
70 }
71 },
72
54 /** @private */ 73 /** @private */
55 onMoreFromSiteTap_: function() { 74 onMoreFromSiteTap_: function() {
56 var menu = /** @type {CrSharedMenuElement} */(this.$.sharedMenu); 75 var menu = /** @type {CrSharedMenuElement} */(this.$.sharedMenu);
57 this.fire('search-domain', {domain: menu.itemData.domain}); 76 this.fire('search-domain', {domain: menu.itemData.domain});
58 menu.closeMenu(); 77 menu.closeMenu();
59 }, 78 },
60 79
61 /** @private */ 80 /** @private */
62 onRemoveFromHistoryTap_: function() { 81 onRemoveFromHistoryTap_: function() {
63 var menu = /** @type {CrSharedMenuElement} */(this.$.sharedMenu); 82 var menu = /** @type {CrSharedMenuElement} */(this.$.sharedMenu);
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 266
248 /** 267 /**
249 * @param {number} index 268 * @param {number} index
250 * @return {boolean} 269 * @return {boolean}
251 * @private 270 * @private
252 */ 271 */
253 isFirstItem_: function(index) { 272 isFirstItem_: function(index) {
254 return index == 0; 273 return index == 0;
255 } 274 }
256 }); 275 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698