Index: tools/cc-frame-viewer/src/analysis_view.js |
diff --git a/tools/cc-frame-viewer/src/analysis_view.js b/tools/cc-frame-viewer/src/analysis_view.js |
new file mode 100644 |
index 0000000000000000000000000000000000000000..59e356b649b9e8320fb9b25fc4a8e2c090fd4e0b |
--- /dev/null |
+++ b/tools/cc-frame-viewer/src/analysis_view.js |
@@ -0,0 +1,66 @@ |
+/* Copyright (c) 2012 The Chromium Authors. All rights reserved. |
+ * Use of this source code is governed by a BSD-style license that can be |
+ * found in the LICENSE file. |
+ */ |
+'use strict'; |
+ |
+base.require('tile_view'); |
+base.require('ui'); |
+base.require('ui.list_and_associated_view'); |
+ |
+base.requireStylesheet('analysis_view'); |
+ |
+base.exportTo('ccfv', function() { |
+ var TileView = ccfv.TileView; |
+ |
+ var AnalysisView = ui.define('x-analysis-view'); |
+ |
+ AnalysisView.prototype = { |
+ __proto__: HTMLUnknownElement.prototype, |
+ |
+ decorate: function() { |
+ this.selection_ = undefined; |
+ this.updateChildren_(); |
+ }, |
+ |
+ set selection(selection) { |
+ if (this.selection_) |
+ this.selection_.deactivate(); |
+ this.selection_ = selection; |
+ if (this.selection_) |
+ this.selection_.activate(); |
+ this.updateChildren_(); |
+ }, |
+ |
+ get selection() { |
+ return this.selection_; |
+ }, |
+ |
+ updateChildren_: function() { |
+ if (!this.selection_) { |
+ this.textContent = 'Select something'; |
+ return; |
+ } |
+ if (this.selection_.tiles) { |
+ this.updateChildrenGivenTiles_(this.selection_.tiles); |
+ return; |
+ } |
+ throw new Error('I am confused about what you selected'); |
+ }, |
+ |
+ updateChildrenGivenTiles_: function(tiles) { |
+ this.textContent = ''; |
+ var tileListEl = new ui.ListAndAssociatedView(); |
+ tileListEl.view = new TileView(); |
+ tileListEl.viewProperty = 'tile'; |
+ tileListEl.list = tiles; |
+ tileListEl.listProperty = 'title'; |
+ this.appendChild(tileListEl); |
+ }, |
+ }; |
+ |
+ return { |
+ AnalysisView: AnalysisView |
+ } |
+}); |
+ |