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

Side by Side Diff: chrome/browser/resources/md_bookmarks/actions.js

Issue 2740863003: MD Bookmarks: Implement search and selection in new data flow system (Closed)
Patch Set: Review round 2 Created 3 years, 9 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
« no previous file with comments | « no previous file | chrome/browser/resources/md_bookmarks/app.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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 /** 5 /**
6 * @fileoverview Module for functions which produce action objects. These are 6 * @fileoverview Module for functions which produce action objects. These are
7 * listed in one place to document available actions and their parameters. 7 * listed in one place to document available actions and their parameters.
8 */ 8 */
9 9
10 cr.define('bookmarks.actions', function() { 10 cr.define('bookmarks.actions', function() {
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 name: 'refresh-nodes', 45 name: 'refresh-nodes',
46 nodes: nodeMap, 46 nodes: nodeMap,
47 }; 47 };
48 }; 48 };
49 49
50 /** 50 /**
51 * @param {string} id 51 * @param {string} id
52 * @return {!Action} 52 * @return {!Action}
53 */ 53 */
54 function selectFolder(id) { 54 function selectFolder(id) {
55 assert(id != '0', 'Cannot select root folder');
55 return { 56 return {
56 name: 'select-folder', 57 name: 'select-folder',
57 id: id, 58 id: id,
58 }; 59 };
59 } 60 }
60 61
61 /** 62 /**
62 * @param {string} id 63 * @param {string} id
63 * @param {boolean} open 64 * @param {boolean} open
64 * @return {!Action} 65 * @return {!Action}
65 */ 66 */
66 function changeFolderOpen(id, open) { 67 function changeFolderOpen(id, open) {
67 return { 68 return {
68 name: 'change-folder-open', 69 name: 'change-folder-open',
69 id: id, 70 id: id,
70 open: open, 71 open: open,
71 }; 72 };
72 } 73 }
73 74
75 /** @return {!Action} */
76 function clearSearch() {
77 return {
78 name: 'clear-search',
79 };
80 }
81
82 /**
83 * @param {string} term
84 * @return {!Action}
85 */
86 function setSearchTerm(term) {
87 if (!term)
88 return clearSearch();
89
90 return {
91 name: 'start-search',
92 term: term,
93 };
94 }
95
96 /**
97 * @param {!Array<string>} ids
98 * @return {!Action}
99 */
100 function setSearchResults(ids) {
101 return {
102 name: 'finish-search',
103 results: ids,
104 };
105 }
106
74 return { 107 return {
75 changeFolderOpen: changeFolderOpen, 108 changeFolderOpen: changeFolderOpen,
109 clearSearch: clearSearch,
76 editBookmark: editBookmark, 110 editBookmark: editBookmark,
77 refreshNodes: refreshNodes, 111 refreshNodes: refreshNodes,
78 removeBookmark: removeBookmark, 112 removeBookmark: removeBookmark,
79 selectFolder: selectFolder, 113 selectFolder: selectFolder,
114 setSearchResults: setSearchResults,
115 setSearchTerm: setSearchTerm,
80 }; 116 };
81 }); 117 });
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/resources/md_bookmarks/app.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698