OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 24 matching lines...) Expand all Loading... |
35 * @param {!WebInspector.ExtensionServer} server | 35 * @param {!WebInspector.ExtensionServer} server |
36 * @param {string} id | 36 * @param {string} id |
37 * @param {string} pageURL | 37 * @param {string} pageURL |
38 */ | 38 */ |
39 WebInspector.ExtensionPanel = function(server, id, pageURL) | 39 WebInspector.ExtensionPanel = function(server, id, pageURL) |
40 { | 40 { |
41 WebInspector.Panel.call(this, id); | 41 WebInspector.Panel.call(this, id); |
42 this._server = server; | 42 this._server = server; |
43 this.setHideOnDetach(); | 43 this.setHideOnDetach(); |
44 this.element.classList.add("extension-panel"); | 44 this.element.classList.add("extension-panel"); |
45 this._panelStatusBarElement = this.element.createChild("div", "panel-status-
bar hidden"); | 45 this._panelStatusBar = new WebInspector.StatusBar(this.element); |
| 46 this._panelStatusBar.element.classList.add("hidden"); |
46 | 47 |
47 this._searchableView = new WebInspector.SearchableView(this); | 48 this._searchableView = new WebInspector.SearchableView(this); |
48 this._searchableView.show(this.element); | 49 this._searchableView.show(this.element); |
49 | 50 |
50 var extensionView = new WebInspector.ExtensionView(server, id, pageURL, "ext
ension"); | 51 var extensionView = new WebInspector.ExtensionView(server, id, pageURL, "ext
ension"); |
51 extensionView.show(this._searchableView.element); | 52 extensionView.show(this._searchableView.element); |
52 this.setDefaultFocusedElement(extensionView.defaultFocusedElement()); | 53 this.setDefaultFocusedElement(extensionView.defaultFocusedElement()); |
53 } | 54 } |
54 | 55 |
55 WebInspector.ExtensionPanel.prototype = { | 56 WebInspector.ExtensionPanel.prototype = { |
56 /** | 57 /** |
57 * @return {!Element} | 58 * @return {!Element} |
58 */ | 59 */ |
59 defaultFocusedElement: function() | 60 defaultFocusedElement: function() |
60 { | 61 { |
61 return WebInspector.View.prototype.defaultFocusedElement.call(this); | 62 return WebInspector.View.prototype.defaultFocusedElement.call(this); |
62 }, | 63 }, |
63 | 64 |
64 /** | 65 /** |
65 * @param {!Element} element | 66 * @param {!WebInspector.StatusBarItem} item |
66 */ | 67 */ |
67 addStatusBarItem: function(element) | 68 addStatusBarItem: function(item) |
68 { | 69 { |
69 this._panelStatusBarElement.classList.remove("hidden"); | 70 this._panelStatusBar.element.classList.remove("hidden"); |
70 this._panelStatusBarElement.appendChild(element); | 71 this._panelStatusBar.appendStatusBarItem(item); |
71 }, | 72 }, |
72 | 73 |
73 searchCanceled: function() | 74 searchCanceled: function() |
74 { | 75 { |
75 this._server.notifySearchAction(this.name, WebInspector.extensionAPI.pan
els.SearchAction.CancelSearch); | 76 this._server.notifySearchAction(this.name, WebInspector.extensionAPI.pan
els.SearchAction.CancelSearch); |
76 this._searchableView.updateSearchMatchesCount(0); | 77 this._searchableView.updateSearchMatchesCount(0); |
77 }, | 78 }, |
78 | 79 |
79 /** | 80 /** |
80 * @return {!WebInspector.SearchableView} | 81 * @return {!WebInspector.SearchableView} |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 * @constructor | 129 * @constructor |
129 * @param {!WebInspector.ExtensionServer} server | 130 * @param {!WebInspector.ExtensionServer} server |
130 * @param {string} id | 131 * @param {string} id |
131 * @param {string} iconURL | 132 * @param {string} iconURL |
132 * @param {string=} tooltip | 133 * @param {string=} tooltip |
133 * @param {boolean=} disabled | 134 * @param {boolean=} disabled |
134 */ | 135 */ |
135 WebInspector.ExtensionButton = function(server, id, iconURL, tooltip, disabled) | 136 WebInspector.ExtensionButton = function(server, id, iconURL, tooltip, disabled) |
136 { | 137 { |
137 this._id = id; | 138 this._id = id; |
138 this.element = createElement("button"); | 139 |
139 this.element.className = "status-bar-item extension"; | 140 this._statusBarButton = new WebInspector.StatusBarButton("", "extension"); |
140 this.element.addEventListener("click", server.notifyButtonClicked.bind(serve
r, this._id), false); | 141 this._statusBarButton.addEventListener("click", server.notifyButtonClicked.b
ind(server, this._id)); |
141 this.update(iconURL, tooltip, disabled); | 142 this.update(iconURL, tooltip, disabled); |
142 } | 143 } |
143 | 144 |
144 WebInspector.ExtensionButton.prototype = { | 145 WebInspector.ExtensionButton.prototype = { |
145 /** | 146 /** |
146 * @param {string} iconURL | 147 * @param {string} iconURL |
147 * @param {string=} tooltip | 148 * @param {string=} tooltip |
148 * @param {boolean=} disabled | 149 * @param {boolean=} disabled |
149 */ | 150 */ |
150 update: function(iconURL, tooltip, disabled) | 151 update: function(iconURL, tooltip, disabled) |
151 { | 152 { |
152 if (typeof iconURL === "string") | 153 if (typeof iconURL === "string") |
153 this.element.style.backgroundImage = "url(" + iconURL + ")"; | 154 this._statusBarButton.setBackgroundImage(iconURL); |
154 if (typeof tooltip === "string") | 155 if (typeof tooltip === "string") |
155 this.element.title = tooltip; | 156 this._statusBarButton.setTitle(tooltip); |
156 if (typeof disabled === "boolean") | 157 if (typeof disabled === "boolean") |
157 this.element.disabled = disabled; | 158 this._statusBarButton.setEnabled(!disabled); |
| 159 }, |
| 160 |
| 161 /** |
| 162 * @return {!WebInspector.StatusBarButton} |
| 163 */ |
| 164 statusBarButton: function() |
| 165 { |
| 166 return this._statusBarButton; |
158 } | 167 } |
159 } | 168 } |
160 | 169 |
161 /** | 170 /** |
162 * @constructor | 171 * @constructor |
163 * @extends {WebInspector.SidebarPane} | 172 * @extends {WebInspector.SidebarPane} |
164 * @param {!WebInspector.ExtensionServer} server | 173 * @param {!WebInspector.ExtensionServer} server |
165 * @param {string} panelName | 174 * @param {string} panelName |
166 * @param {string} title | 175 * @param {string} title |
167 * @param {string} id | 176 * @param {string} id |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 if (!title) | 296 if (!title) |
288 section.headerElement.classList.add("hidden"); | 297 section.headerElement.classList.add("hidden"); |
289 section.expanded = true; | 298 section.expanded = true; |
290 section.editable = false; | 299 section.editable = false; |
291 this._objectPropertiesView.element.appendChild(section.element); | 300 this._objectPropertiesView.element.appendChild(section.element); |
292 callback(); | 301 callback(); |
293 }, | 302 }, |
294 | 303 |
295 __proto__: WebInspector.SidebarPane.prototype | 304 __proto__: WebInspector.SidebarPane.prototype |
296 } | 305 } |
OLD | NEW |