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 /** 6 * This view displays information related to Prerendering. 7 */ 8 var PrerenderView = (function() { 9 'use strict'; 10 11 // We inherit from DivView. 12 var superClass = DivView; 13 14 /** 15 * @constructor 16 */ 17 function PrerenderView() { 18 assertFirstConstructorCall(PrerenderView); 19 20 // Call superclass's constructor. 21 superClass.call(this, PrerenderView.MAIN_BOX_ID); 22 23 g_browser.addPrerenderInfoObserver(this, true); 24 } 25 26 PrerenderView.TAB_ID = 'tab-handle-prerender'; 27 PrerenderView.TAB_NAME = 'Prerender'; 28 PrerenderView.TAB_HASH = '#prerender'; 29 30 // IDs for special HTML elements in prerender_view.html 31 PrerenderView.MAIN_BOX_ID = 'prerender-view-tab-content'; 32 33 // Used in tests. 34 PrerenderView.HISTORY_TABLE_ID = 'prerender-view-history-table'; 35 PrerenderView.ACTIVE_TABLE_ID = 'prerender-view-active-table'; 36 37 cr.addSingletonGetter(PrerenderView); 38 39 PrerenderView.prototype = { 40 // Inherit the superclass's methods. 41 __proto__: superClass.prototype, 42 43 onLoadLogFinish: function(data) { 44 return this.onPrerenderInfoChanged(data.prerenderInfo); 45 }, 46 47 onPrerenderInfoChanged: function(prerenderInfo) { 48 if (!prerenderInfo) 49 return false; 50 var input = new JsEvalContext(prerenderInfo); 51 jstProcess(input, $(PrerenderView.MAIN_BOX_ID)); 52 return true; 53 } 54 }; 55 56 return PrerenderView; 57 })(); 58