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 /** | 5 /** |
6 * @constructor | |
7 * @extends cr.EventTarget | 6 * @extends cr.EventTarget |
8 * @param {HTMLDivElement} div Div container for breadcrumbs. | 7 * @param {HTMLDivElement} div Div container for breadcrumbs. |
| 8 * @constructor |
9 */ | 9 */ |
10 function BreadcrumbsController(div) { | 10 function BreadcrumbsController(div) { |
11 this.bc_ = div; | 11 this.bc_ = div; |
12 this.hideLast_ = false; | 12 this.hideLast_ = false; |
13 this.rootPath_ = null; | 13 this.rootPath_ = null; |
14 this.path_ = null; | 14 this.path_ = null; |
15 div.addEventListener('click', this.onClick_.bind(this)); | 15 div.addEventListener('click', this.onClick_.bind(this)); |
16 } | 16 } |
17 | 17 |
18 /** | 18 /** |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 | 181 |
182 /** | 182 /** |
183 * Hide breadcrumbs div. | 183 * Hide breadcrumbs div. |
184 */ | 184 */ |
185 BreadcrumbsController.prototype.hide = function() { | 185 BreadcrumbsController.prototype.hide = function() { |
186 this.bc_.style.display = 'none'; | 186 this.bc_.style.display = 'none'; |
187 }; | 187 }; |
188 | 188 |
189 /** | 189 /** |
190 * Handle a click event on a breadcrumb element. | 190 * Handle a click event on a breadcrumb element. |
| 191 * @param {Event} event The click event. |
191 * @private | 192 * @private |
192 * @param {Event} event The click event. | |
193 */ | 193 */ |
194 BreadcrumbsController.prototype.onClick_ = function(event) { | 194 BreadcrumbsController.prototype.onClick_ = function(event) { |
195 var path = this.getTargetPath(event); | 195 var path = this.getTargetPath(event); |
196 if (!path) | 196 if (!path) |
197 return; | 197 return; |
198 | 198 |
199 var newEvent = new cr.Event('pathclick'); | 199 var newEvent = new cr.Event('pathclick'); |
200 newEvent.path = path; | 200 newEvent.path = path; |
201 this.dispatchEvent(newEvent); | 201 this.dispatchEvent(newEvent); |
202 }; | 202 }; |
(...skipping 22 matching lines...) Expand all Loading... |
225 }; | 225 }; |
226 | 226 |
227 /** | 227 /** |
228 * Returns the breadcrumbs container. | 228 * Returns the breadcrumbs container. |
229 * @return {HTMLElement} Breadcumbs container HTML element. | 229 * @return {HTMLElement} Breadcumbs container HTML element. |
230 */ | 230 */ |
231 BreadcrumbsController.prototype.getContainer = function() { | 231 BreadcrumbsController.prototype.getContainer = function() { |
232 return this.bc_; | 232 return this.bc_; |
233 }; | 233 }; |
234 | 234 |
OLD | NEW |