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

Side by Side Diff: chrome/browser/resources/bookmark_manager/js/main.js

Issue 52803009: BMM: Split initialization into two phases (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 (function() { 5 (function() {
6 /** @const */ var BookmarkList = bmm.BookmarkList; 6 /** @const */ var BookmarkList = bmm.BookmarkList;
7 /** @const */ var BookmarkTree = bmm.BookmarkTree; 7 /** @const */ var BookmarkTree = bmm.BookmarkTree;
8 /** @const */ var Command = cr.ui.Command; 8 /** @const */ var Command = cr.ui.Command;
9 /** @const */ var CommandBinding = cr.ui.CommandBinding; 9 /** @const */ var CommandBinding = cr.ui.CommandBinding;
10 /** @const */ var LinkKind = cr.LinkKind; 10 /** @const */ var LinkKind = cr.LinkKind;
(...skipping 1199 matching lines...) Expand 10 before | Expand all | Expand 10 after
1210 splitter.addEventListener('resize', function(e) { 1210 splitter.addEventListener('resize', function(e) {
1211 localStorage['treeWidth'] = splitter.previousElementSibling.style.width; 1211 localStorage['treeWidth'] = splitter.previousElementSibling.style.width;
1212 }); 1212 });
1213 } 1213 }
1214 1214
1215 function initializeBookmarkManager() { 1215 function initializeBookmarkManager() {
1216 // Sometimes the extension API is not initialized. 1216 // Sometimes the extension API is not initialized.
1217 if (!chrome.bookmarks) 1217 if (!chrome.bookmarks)
1218 console.error('Bookmarks extension API is not available'); 1218 console.error('Bookmarks extension API is not available');
1219 1219
1220 chrome.bookmarkManagerPrivate.getStrings(loadLocalizedStrings); 1220 chrome.bookmarkManagerPrivate.getStrings(continueInitializeBookmarkManager);
1221 }
1222
1223 function continueInitializeBookmarkManager(localizedStrings) {
1224 loadLocalizedStrings(localizedStrings);
1221 1225
1222 bmm.treeLookup[searchTreeItem.bookmarkId] = searchTreeItem; 1226 bmm.treeLookup[searchTreeItem.bookmarkId] = searchTreeItem;
1223 1227
1224 cr.ui.decorate('menu', Menu); 1228 cr.ui.decorate('menu', Menu);
1225 cr.ui.decorate('button[menu]', MenuButton); 1229 cr.ui.decorate('button[menu]', MenuButton);
1226 cr.ui.decorate('command', Command); 1230 cr.ui.decorate('command', Command);
1227 BookmarkList.decorate(list); 1231 BookmarkList.decorate(list);
1228 BookmarkTree.decorate(tree); 1232 BookmarkTree.decorate(tree);
1229 1233
1230 list.addEventListener('canceledit', handleCancelEdit); 1234 list.addEventListener('canceledit', handleCancelEdit);
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
1301 1305
1302 cr.ui.FocusOutlineManager.forDocument(document); 1306 cr.ui.FocusOutlineManager.forDocument(document);
1303 initializeSplitter(); 1307 initializeSplitter();
1304 bmm.addBookmarkModelListeners(); 1308 bmm.addBookmarkModelListeners();
1305 dnd.init(selectItemsAfterUserAction); 1309 dnd.init(selectItemsAfterUserAction);
1306 tree.reload(); 1310 tree.reload();
1307 } 1311 }
1308 1312
1309 initializeBookmarkManager(); 1313 initializeBookmarkManager();
1310 })(); 1314 })();
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698