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 // TODO(nasko): this should be temporary, until the UI is modified to |
| 126 // properly account for the new "app" level in the tree model. |
| 127 if (args[0] == null) { |
| 128 // We are at the root of the tree, just load the browser wide cookies. |
| 129 var browser = null; |
| 130 for (var i = 0; i < args[1].length; ++i) { |
| 131 if (args[1][i] && args[1][i].appId === '') { |
| 132 browser = args[1][i]; |
| 133 break; |
| 134 } |
| 135 } |
| 136 if (browser) { |
| 137 $('cookies-list').rootId = browser.id; |
| 138 chrome.send('loadCookie', [browser.id]); |
| 139 } |
| 140 } else { |
| 141 $('cookies-list').loadChildren(args[0], args[1]); |
| 142 } |
126 }; | 143 }; |
127 | 144 |
128 // Export | 145 // Export |
129 return { | 146 return { |
130 CookiesView: CookiesView | 147 CookiesView: CookiesView |
131 }; | 148 }; |
132 | 149 |
133 }); | 150 }); |
OLD | NEW |