Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(405)

Side by Side Diff: chrome/browser/resources/net_internals/view.js

Issue 1593009: Add extra views to the new net internals page. This adds tabs along the top f... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/resources/net_internals/util.js ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Name: svn:eol-style
+ LF
OLDNEW
(Empty)
1 // Copyright (c) 2010 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 * Base class to represent a "view". A view is an absolutely positioned box on
7 * the page.
8 *
9 * @constructor
10 */
11 function View() {
12 this.isVisible_ = true;
13 }
14
15 /**
16 * Called to reposition the view on the page. Measurements are in pixels.
17 */
18 View.prototype.setGeometry = function(left, top, width, height) {
19 this.left_ = left;
20 this.top_ = top;
21 this.width_ = width;
22 this.height_ = height;
23 };
24
25 /**
26 * Called to show/hide the view.
27 */
28 View.prototype.show = function(isVisible) {
29 this.isVisible_ = isVisible;
30 };
31
32 View.prototype.isVisible = function() {
33 return this.isVisible_;
34 };
35
36 View.prototype.getLeft = function() {
37 return this.left_;
38 };
39
40 View.prototype.getTop = function() {
41 return this.top_;
42 };
43
44 View.prototype.getWidth = function() {
45 return this.width_;
46 };
47
48 View.prototype.getHeight = function() {
49 return this.height_;
50 };
51
52 View.prototype.getRight = function() {
53 return this.getLeft() + this.getWidth();
54 };
55
56 View.prototype.getBottom = function() {
57 return this.getTop() + this.getHeight();
58 };
59
60
61 //-----------------------------------------------------------------------------
62
63 /**
64 * DivView is an implementation of View that wraps a DIV.
65 *
66 * @constructor
67 */
68 function DivView(divId) {
69 View.call(this);
70
71 this.node_ = document.getElementById(divId);
72
73 // Initialize the default values to those of the DIV.
74 this.width_ = this.node_.offsetWidth;
75 this.height_ = this.node_.offsetHeight;
76 this.isVisible_ = this.node_.style.display != 'none';
77 }
78
79 inherits(DivView, View);
80
81 DivView.prototype.setGeometry = function(left, top, width, height) {
82 DivView.superClass_.setGeometry.call(this, left, top, width, height);
83
84 this.node_.style.position = "absolute";
85 setNodePosition(this.node_, left, top, width, height);
86 };
87
88 DivView.prototype.show = function(isVisible) {
89 DivView.superClass_.show.call(this, isVisible);
90 setNodeDisplay(this.node_, isVisible);
91 };
92
93 /**
94 * Returns the wrapped DIV
95 */
96 DivView.prototype.getNode = function() {
97 return this.node_;
98 };
99
100 //-----------------------------------------------------------------------------
101
102 /**
103 * Implementation of View that sizes its child to fit the entire window.
104 *
105 * @param {!View} childView
106 *
107 * @constructor
108 */
109 function WindowView(childView) {
110 View.call(this);
111 this.childView_ = childView;
112 window.addEventListener("resize", this.resetGeometry.bind(this), true);
113 }
114
115 inherits(WindowView, View);
116
117 WindowView.prototype.setGeometry = function(left, top, width, height) {
118 WindowView.superClass_.setGeometry.call(this, left, top, width, height);
119 this.childView_.setGeometry(left, top, width, height);
120 };
121
122 WindowView.prototype.show = function() {
123 WindowView.superClass_.show.call(this, isVisible);
124 this.childView_.show(isVisible);
125 };
126
127 WindowView.prototype.resetGeometry = function() {
128 this.setGeometry(0, 0, window.innerWidth, window.innerHeight);
129 };
130
OLDNEW
« no previous file with comments | « chrome/browser/resources/net_internals/util.js ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698