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

Side by Side Diff: chrome/test/data/extensions/bookmarks/bookmark_api.html

Issue 102009: more extensions bookmarks changes:... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 7 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 | Annotate | Revision Log
OLDNEW
1 <html> 1 <html>
2 <style>
3 body {
4 overflow: hidden;
5 margin: 0 0 0 0;
6 }
7
8 /* TODO: put the background style into body when
9 https://bugs.webkit.org/show_bug.cgi?id=18445 is fixed. */
10 .content {
11 background: -webkit-gradient(linear, left top, left bottom, from(rgb(222, 234, 248)), to(rgb(237, 244, 252)));
12 padding: 1;
13 white-space: nowrap;
14 }
15
16 .button {
17 display: inline;
18 border: 1px solid silver;
19 padding: 2px;
20 margin: 1px 3px;
21 height: 100%;
22 }
23 </style>
24 <script> 2 <script>
25 3
26 var dump = function(obj, indent) { 4 var dump = function(obj, indent) {
27 if (indent === undefined) 5 if (indent === undefined)
28 indent = ""; 6 indent = "";
29 if (typeof obj == "object") { 7 if (typeof obj == "object") {
30 var ret = "{<br/>"; 8 var ret = "{<br/>";
31 var child_indent = indent + " "; 9 var child_indent = indent + " ";
32 for (var item in obj) { 10 for (var item in obj) {
33 var child = null; 11 var child = null;
34 try { 12 try {
35 child = obj[item]; 13 child = obj[item];
36 } catch (e) { 14 } catch (e) {
37 child = '<error>'; 15 child = '<error>';
38 } 16 }
39 ret += child_indent + item + ": " + dump(child, indent + " "); 17 ret += child_indent + item + ": " + dump(child, indent + " ");
40 } 18 }
41 return ret + indent + "}" + "<br/>"; 19 return ret + indent + "}" + "<br/>";
42 } else { 20 } else {
43 return obj.toString() + "<br/>"; 21 return obj.toString() + "<br/>";
44 } 22 }
45 } 23 }
46 24
47 var testMoveBookmarks = function(event) { 25 var testMoveBookmarks = function(event) {
26 testMoveBookmarks2(event);
27 }
28
29 var testMoveBookmarks2 = function(event) {
30 console.log(testMoveBookmarks2.caller.name);
48 if (event.shiftKey) { 31 if (event.shiftKey) {
49 // TODO - it would be nice to have a mechanism to do this built-in to a 32 // TODO - it would be nice to have a mechanism to do this built-in to a
50 // context menu. 33 // context menu.
51 window.location.reload(); 34 window.location.reload();
52 return; 35 return;
53 } 36 }
54 console.log("testMoveBookmarks"); 37 console.log("testMoveBookmarks2");
55 chromium.bookmarks.get([], function(root) { 38 chromium.bookmarks.get([], function(root) {
39 console.log("1");
56 chromium.bookmarks.get(root[0].childrenIds, function(root_children) { 40 chromium.bookmarks.get(root[0].childrenIds, function(root_children) {
57 var bookmark_bar = root_children[0]; // bookmarks bar is always first 41 var bookmark_bar = root_children[0]; // bookmarks bar is always first
58 chromium.bookmarks.get(bookmark_bar.childrenIds, 42 chromium.bookmarks.get(bookmark_bar.childrenIds,
59 function(bar_children) { 43 function(bar_children) {
60 var folder_search = []; 44 var folder_search = [];
61 bar_children.forEach(function(child) { 45 bar_children.forEach(function(child) {
62 if (child.title == "folder" && child.url == undefined) { 46 if (child.title == "folder" && child.url == undefined) {
63 folder_search.push(child); 47 folder_search.push(child);
64 } 48 }
65 }); 49 });
(...skipping 20 matching lines...) Expand all
86 } else { 70 } else {
87 console.log("my puny code wasn't written to handle this"); 71 console.log("my puny code wasn't written to handle this");
88 } 72 }
89 }); 73 });
90 }); 74 });
91 }); 75 });
92 }; 76 };
93 77
94 var dumpBookmarks = function(event) { 78 var dumpBookmarks = function(event) {
95 window.open("bookmark_view.html"); 79 window.open("bookmark_view.html");
96 /*
97 console.dir(results);
98 var win = window.open();
99 win.document.write("<html><body><pre>");
100 win.document.write(dump(results));
101 win.document.write("</pre></body></html>");
102 win.document.title = "Bookmarks";
103 });
104 */
105 }; 80 };
106 </script> 81 </script>
107 <body> 82 <body>
108 <div class="content"> 83 <div class="toolbar-button" onclick="dumpBookmarks(window.event);">
109 <div class="button" onclick="dumpBookmarks(window.event);"> 84 <span>Dump Bookmarks</span>
110 Dump Bookmarks
111 </div> 85 </div>
112 <div class="button" onclick="testMoveBookmarks(window.event);"> 86 <div class="toolbar-button" onclick="testMoveBookmarks(window.event);">
113 Test Move 87 <span>Test Move</span>
114 </div>
115 </div> 88 </div>
116 </body> 89 </body>
117 </html> 90 </html>
OLDNEW
« no previous file with comments | « chrome/renderer/resources/extension_process_bindings.js ('k') | chrome/test/data/extensions/bookmarks/bookmark_view.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698