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

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

Issue 2954273002: [MD Bookmarks] Restore focus after closing a dialog or context menu. (Closed)
Patch Set: fix deps Created 3 years, 5 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 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 Polymer({ 5 Polymer({
6 is: 'bookmarks-edit-dialog', 6 is: 'bookmarks-edit-dialog',
7 7
8 properties: { 8 properties: {
9 /** @private */ 9 /** @private */
10 isFolder_: Boolean, 10 isFolder_: Boolean,
(...skipping 25 matching lines...) Expand all
36 * inserted into the tree as a child of |parentId|. 36 * inserted into the tree as a child of |parentId|.
37 * @param {boolean} isFolder 37 * @param {boolean} isFolder
38 * @param {string} parentId 38 * @param {string} parentId
39 */ 39 */
40 showAddDialog: function(isFolder, parentId) { 40 showAddDialog: function(isFolder, parentId) {
41 this.reset_(); 41 this.reset_();
42 this.isEdit_ = false; 42 this.isEdit_ = false;
43 this.isFolder_ = isFolder; 43 this.isFolder_ = isFolder;
44 this.parentId_ = parentId; 44 this.parentId_ = parentId;
45 45
46 this.$.dialog.showModal(); 46 bookmarks.DialogFocusManager.getInstance().showDialog(this.$.dialog);
47 }, 47 },
48 48
49 /** 49 /**
50 * Show the edit dialog for |editItem|. 50 * Show the edit dialog for |editItem|.
51 * @param {BookmarkNode} editItem 51 * @param {BookmarkNode} editItem
52 */ 52 */
53 showEditDialog: function(editItem) { 53 showEditDialog: function(editItem) {
54 this.reset_(); 54 this.reset_();
55 this.isEdit_ = true; 55 this.isEdit_ = true;
56 this.isFolder_ = !editItem.url; 56 this.isFolder_ = !editItem.url;
57 this.editItem_ = editItem; 57 this.editItem_ = editItem;
58 58
59 this.titleValue_ = editItem.title; 59 this.titleValue_ = editItem.title;
60 if (!this.isFolder_) 60 if (!this.isFolder_)
61 this.urlValue_ = assert(editItem.url); 61 this.urlValue_ = assert(editItem.url);
62 62
63 this.$.dialog.showModal(); 63 bookmarks.DialogFocusManager.getInstance().showDialog(this.$.dialog);
64 }, 64 },
65 65
66 /** 66 /**
67 * Clear out existing values from the dialog, allowing it to be reused. 67 * Clear out existing values from the dialog, allowing it to be reused.
68 * @private 68 * @private
69 */ 69 */
70 reset_: function() { 70 reset_: function() {
71 this.editItem_ = null; 71 this.editItem_ = null;
72 this.parentId_ = null; 72 this.parentId_ = null;
73 this.$.url.invalid = false; 73 this.$.url.invalid = false;
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 chrome.bookmarks.create(edit); 130 chrome.bookmarks.create(edit);
131 } 131 }
132 this.$.dialog.close(); 132 this.$.dialog.close();
133 }, 133 },
134 134
135 /** @private */ 135 /** @private */
136 onCancelButtonTap_: function() { 136 onCancelButtonTap_: function() {
137 this.$.dialog.cancel(); 137 this.$.dialog.cancel();
138 }, 138 },
139 }); 139 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/md_bookmarks/edit_dialog.html ('k') | chrome/browser/resources/md_bookmarks/item.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698