OLD | NEW |
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 cr.define('options', function() { | 5 cr.define('options', function() { |
6 | 6 |
7 var OptionsPage = options.OptionsPage; | 7 var OptionsPage = options.OptionsPage; |
8 | 8 |
9 ///////////////////////////////////////////////////////////////////////////// | 9 ///////////////////////////////////////////////////////////////////////////// |
10 // CookiesView class: | 10 // CookiesView class: |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 // CookiesViewHandler callbacks. | 115 // CookiesViewHandler callbacks. |
116 CookiesView.onTreeItemAdded = function(args) { | 116 CookiesView.onTreeItemAdded = function(args) { |
117 $('cookies-list').addByParentId(args[0], args[1], args[2]); | 117 $('cookies-list').addByParentId(args[0], args[1], args[2]); |
118 }; | 118 }; |
119 | 119 |
120 CookiesView.onTreeItemRemoved = function(args) { | 120 CookiesView.onTreeItemRemoved = function(args) { |
121 $('cookies-list').removeByParentId(args[0], args[1], args[2]); | 121 $('cookies-list').removeByParentId(args[0], args[1], args[2]); |
122 }; | 122 }; |
123 | 123 |
124 CookiesView.loadChildren = function(args) { | 124 CookiesView.loadChildren = function(args) { |
125 $('cookies-list').loadChildren(args[0], args[1]); | 125 // We are at the root of the tree, just load the browser wide cookies. |
| 126 if (args[0] == null) { |
| 127 var browser = null; |
| 128 for (var i = 0; i < args[1].length; ++i) { |
| 129 if (args[1][i]) |
| 130 if (args[1][i].appId == '') { |
| 131 browser = args[1][i]; |
| 132 break; |
| 133 } |
| 134 } |
| 135 if (browser) { |
| 136 $('cookies-list').rootId = browser.id; |
| 137 chrome.send('loadCookie', [browser.id]); |
| 138 } |
| 139 } else { |
| 140 $('cookies-list').loadChildren(args[0], args[1]); |
| 141 } |
126 }; | 142 }; |
127 | 143 |
128 // Export | 144 // Export |
129 return { | 145 return { |
130 CookiesView: CookiesView | 146 CookiesView: CookiesView |
131 }; | 147 }; |
132 | 148 |
133 }); | 149 }); |
OLD | NEW |