Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / chrome / browser / resources / settings / settings_ui / breadcrumb.js
bloba4fcb5f96986d5d6b8aa432bf479bfc37d423289
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 /**
6  * @fileoverview
7  * 'settings-breadcrumb' displays the breadcrumb.
8  *
9  * Example:
10  *
11  *     <settings-breadcrumb current-route="{{currentRoute}}">
12  *     </settings-breadcrumb>
13  *
14  * @group Chrome Settings Elements
15  * @element settings-breadcrumb
16  */
17 Polymer({
18   is: 'settings-breadcrumb',
20   properties: {
21     /**
22      * The current active route.
23      */
24     currentRoute: {
25       type: Object,
26       notify: true,
27     },
29     /**
30      * Page titles for the currently active route.
31      */
32     currentRouteTitles: {
33       type: Object,
34     },
35   },
37   /** @private */
38   onTapPage_: function() {
39     this.currentRoute = {
40       page: this.currentRoute.page,
41       section: '',
42       subpage: [],
43     };
44   },
46   /** @private */
47   onTapSubpage_: function(event) {
48     var clickedIndex = event.target.dataset.subpageIndex;
49     this.currentRoute = {
50       page: this.currentRoute.page,
51       section: this.currentRoute.section,
52       subpage: this.currentRoute.subpage.slice(0, clickedIndex + 1),
53     };
54   },
55 });