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

Side by Side Diff: chrome/renderer/resources/extensions/app_window_custom_bindings.js

Issue 375183002: Add app.window.alphaEnabled() and onAlphaEnabledChanged. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Sync and rebase Created 6 years, 5 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Custom binding for the app_window API. 5 // Custom binding for the app_window API.
6 6
7 var appWindowNatives = requireNative('app_window_natives'); 7 var appWindowNatives = requireNative('app_window_natives');
8 var runtimeNatives = requireNative('runtime'); 8 var runtimeNatives = requireNative('runtime');
9 var Binding = require('binding').Binding; 9 var Binding = require('binding').Binding;
10 var Event = require('event_bindings').Event; 10 var Event = require('event_bindings').Event;
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 }; 234 };
235 AppWindow.prototype.isMinimized = function() { 235 AppWindow.prototype.isMinimized = function() {
236 return appWindowData.minimized; 236 return appWindowData.minimized;
237 }; 237 };
238 AppWindow.prototype.isMaximized = function() { 238 AppWindow.prototype.isMaximized = function() {
239 return appWindowData.maximized; 239 return appWindowData.maximized;
240 }; 240 };
241 AppWindow.prototype.isAlwaysOnTop = function() { 241 AppWindow.prototype.isAlwaysOnTop = function() {
242 return appWindowData.alwaysOnTop; 242 return appWindowData.alwaysOnTop;
243 }; 243 };
244 AppWindow.prototype.alphaEnabled = function() {
245 return appWindowData.alphaEnabled;
246 }
244 AppWindow.prototype.handleWindowFirstShownForTests = function(callback) { 247 AppWindow.prototype.handleWindowFirstShownForTests = function(callback) {
245 // This allows test apps to get have their callback run even if they 248 // This allows test apps to get have their callback run even if they
246 // call this after the first show has happened. 249 // call this after the first show has happened.
247 if (this.firstShowHasHappened) { 250 if (this.firstShowHasHappened) {
248 callback(); 251 callback();
249 return; 252 return;
250 } 253 }
251 this.onWindowFirstShownForTests.addListener(callback); 254 this.onWindowFirstShownForTests.addListener(callback);
252 } 255 }
253 256
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 minHeight: params.outerBounds.minHeight, 297 minHeight: params.outerBounds.minHeight,
295 maxWidth: params.outerBounds.maxWidth, 298 maxWidth: params.outerBounds.maxWidth,
296 maxHeight: params.outerBounds.maxHeight 299 maxHeight: params.outerBounds.maxHeight
297 }, 300 },
298 fullscreen: params.fullscreen, 301 fullscreen: params.fullscreen,
299 minimized: params.minimized, 302 minimized: params.minimized,
300 maximized: params.maximized, 303 maximized: params.maximized,
301 alwaysOnTop: params.alwaysOnTop, 304 alwaysOnTop: params.alwaysOnTop,
302 hasFrameColor: params.hasFrameColor, 305 hasFrameColor: params.hasFrameColor,
303 activeFrameColor: params.activeFrameColor, 306 activeFrameColor: params.activeFrameColor,
304 inactiveFrameColor: params.inactiveFrameColor 307 inactiveFrameColor: params.inactiveFrameColor,
308 alphaEnabled: params.alphaEnabled
305 }; 309 };
306 currentAppWindow = new AppWindow; 310 currentAppWindow = new AppWindow;
307 }); 311 });
308 }); 312 });
309 313
310 function boundsEqual(bounds1, bounds2) { 314 function boundsEqual(bounds1, bounds2) {
311 if (!bounds1 || !bounds2) 315 if (!bounds1 || !bounds2)
312 return false; 316 return false;
313 return (bounds1.left == bounds2.left && bounds1.top == bounds2.top && 317 return (bounds1.left == bounds2.left && bounds1.top == bounds2.top &&
314 bounds1.width == bounds2.width && bounds1.height == bounds2.height); 318 bounds1.width == bounds2.width && bounds1.height == bounds2.height);
(...skipping 26 matching lines...) Expand all
341 dispatchEventIfExists(currentWindow, "onFullscreened"); 345 dispatchEventIfExists(currentWindow, "onFullscreened");
342 if (!oldData.minimized && update.minimized) 346 if (!oldData.minimized && update.minimized)
343 dispatchEventIfExists(currentWindow, "onMinimized"); 347 dispatchEventIfExists(currentWindow, "onMinimized");
344 if (!oldData.maximized && update.maximized) 348 if (!oldData.maximized && update.maximized)
345 dispatchEventIfExists(currentWindow, "onMaximized"); 349 dispatchEventIfExists(currentWindow, "onMaximized");
346 350
347 if ((oldData.fullscreen && !update.fullscreen) || 351 if ((oldData.fullscreen && !update.fullscreen) ||
348 (oldData.minimized && !update.minimized) || 352 (oldData.minimized && !update.minimized) ||
349 (oldData.maximized && !update.maximized)) 353 (oldData.maximized && !update.maximized))
350 dispatchEventIfExists(currentWindow, "onRestored"); 354 dispatchEventIfExists(currentWindow, "onRestored");
355
356 if (oldData.alphaEnabled !== update.alphaEnabled)
357 dispatchEventIfExists(currentWindow, "onAlphaEnabledChanged");
351 }; 358 };
352 359
353 function onAppWindowShownForTests() { 360 function onAppWindowShownForTests() {
354 if (!currentAppWindow) 361 if (!currentAppWindow)
355 return; 362 return;
356 363
357 if (!currentAppWindow.firstShowHasHappened) 364 if (!currentAppWindow.firstShowHasHappened)
358 dispatchEventIfExists(currentAppWindow, "onWindowFirstShownForTests"); 365 dispatchEventIfExists(currentAppWindow, "onWindowFirstShownForTests");
359 366
360 currentAppWindow.firstShowHasHappened = true; 367 currentAppWindow.firstShowHasHappened = true;
(...skipping 24 matching lines...) Expand all
385 constraints[key] = 0; 392 constraints[key] = 0;
386 }); 393 });
387 394
388 currentWindowInternal.setSizeConstraints(boundsType, constraints); 395 currentWindowInternal.setSizeConstraints(boundsType, constraints);
389 } 396 }
390 397
391 exports.binding = appWindow.generate(); 398 exports.binding = appWindow.generate();
392 exports.onAppWindowClosed = onAppWindowClosed; 399 exports.onAppWindowClosed = onAppWindowClosed;
393 exports.updateAppWindowProperties = updateAppWindowProperties; 400 exports.updateAppWindowProperties = updateAppWindowProperties;
394 exports.appWindowShownForTests = onAppWindowShownForTests; 401 exports.appWindowShownForTests = onAppWindowShownForTests;
OLDNEW
« no previous file with comments | « chrome/common/extensions/api/app_window.idl ('k') | ui/views/widget/desktop_aura/desktop_native_widget_aura.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698