Fix a type mismatch on Windows caused by r201738.
[chromium-blink-merge.git] / tools / cc-frame-viewer / src / analysis_view.js
blob59e356b649b9e8320fb9b25fc4a8e2c090fd4e0b
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
3 * found in the LICENSE file.
4 */
5 'use strict';
7 base.require('tile_view');
8 base.require('ui');
9 base.require('ui.list_and_associated_view');
11 base.requireStylesheet('analysis_view');
13 base.exportTo('ccfv', function() {
14 var TileView = ccfv.TileView;
16 var AnalysisView = ui.define('x-analysis-view');
18 AnalysisView.prototype = {
19 __proto__: HTMLUnknownElement.prototype,
21 decorate: function() {
22 this.selection_ = undefined;
23 this.updateChildren_();
26 set selection(selection) {
27 if (this.selection_)
28 this.selection_.deactivate();
29 this.selection_ = selection;
30 if (this.selection_)
31 this.selection_.activate();
32 this.updateChildren_();
35 get selection() {
36 return this.selection_;
39 updateChildren_: function() {
40 if (!this.selection_) {
41 this.textContent = 'Select something';
42 return;
44 if (this.selection_.tiles) {
45 this.updateChildrenGivenTiles_(this.selection_.tiles);
46 return;
48 throw new Error('I am confused about what you selected');
51 updateChildrenGivenTiles_: function(tiles) {
52 this.textContent = '';
53 var tileListEl = new ui.ListAndAssociatedView();
54 tileListEl.view = new TileView();
55 tileListEl.viewProperty = 'tile';
56 tileListEl.list = tiles;
57 tileListEl.listProperty = 'title';
58 this.appendChild(tileListEl);
62 return {
63 AnalysisView: AnalysisView
65 });