| OLD | NEW |
| 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 bindings for the app_window API. | 5 // Custom bindings for the app_window API. |
| 6 | 6 |
| 7 var chromeHidden = requireNative('chrome_hidden').GetChromeHidden(); | 7 var chromeHidden = requireNative('chrome_hidden').GetChromeHidden(); |
| 8 var sendRequest = require('sendRequest').sendRequest; | 8 var sendRequest = require('sendRequest').sendRequest; |
| 9 var appWindowNatives = requireNative('app_window'); | 9 var appWindowNatives = requireNative('app_window'); |
| 10 var GetView = appWindowNatives.GetView; | 10 var GetView = appWindowNatives.GetView; |
| 11 | 11 |
| 12 chromeHidden.registerCustomHook('app.window', function(bindingsAPI) { | 12 chromeHidden.registerCustomHook('app.window', function(bindingsAPI) { |
| 13 var apiFunctions = bindingsAPI.apiFunctions; | 13 var apiFunctions = bindingsAPI.apiFunctions; |
| 14 apiFunctions.setCustomCallback('create', function(name, request, viewId) { | 14 apiFunctions.setCustomCallback('create', function(name, request, viewId) { |
| 15 var view = null; | 15 var view = null; |
| 16 if (viewId) | 16 if (viewId) { |
| 17 view = GetView(viewId); | 17 view = GetView(viewId); |
| 18 if (view) { |
| 19 if (request.args[1].frame != 'none') |
| 20 view._setHasTitlebarInternal(true); |
| 21 delete view._setHasTitlebarInternal; |
| 22 } |
| 23 } |
| 18 if (request.callback) { | 24 if (request.callback) { |
| 19 request.callback(view); | 25 request.callback(view); |
| 20 delete request.callback; | 26 delete request.callback; |
| 21 } | 27 } |
| 22 }) | 28 }) |
| 23 apiFunctions.setHandleRequest('moveTo', function(x, y) { | 29 apiFunctions.setHandleRequest('moveTo', function(x, y) { |
| 24 window.moveTo(x, y); | 30 window.moveTo(x, y); |
| 25 }) | 31 }) |
| 26 apiFunctions.setHandleRequest('resizeTo', function(width, height) { | 32 apiFunctions.setHandleRequest('resizeTo', function(width, height) { |
| 27 window.resizeTo(width, height); | 33 window.resizeTo(width, height); |
| 28 }) | 34 }) |
| 29 }); | 35 }); |
| OLD | NEW |