OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 Identity API. | 5 // Custom binding for the Identity API. |
6 | 6 |
7 var binding = require('binding').Binding.create('identity'); | 7 var binding = require('binding').Binding.create('identity'); |
8 | 8 |
9 binding.registerCustomHook(function(binding, id, contextType) { | 9 binding.registerCustomHook(function(binding, id, contextType) { |
10 var apiFunctions = binding.apiFunctions; | 10 var apiFunctions = binding.apiFunctions; |
11 var identity = binding.compiledApi; | 11 var identity = binding.compiledApi; |
12 | 12 |
13 apiFunctions.setHandleRequest('getRedirectURL', function(path) { | 13 apiFunctions.setHandleRequest('getRedirectURL', function(path) { |
14 if (path === null || path === undefined) | 14 if (path === null || path === undefined) |
15 path = '/'; | 15 path = '/'; |
16 else | 16 else |
17 path = String(path); | 17 path = String(path); |
18 if (path[0] != '/') | 18 if (path[0] != '/') |
19 path = '/' + path; | 19 path = '/' + path; |
20 return 'https://' + id + '.chromiumapp.org' + path; | 20 return 'https://' + id + '.chromiumapp.org' + path; |
21 }); | 21 }); |
22 }); | 22 }); |
23 | 23 |
24 exports.binding = binding.generate(); | 24 exports.$set('binding', binding.generate()); |
OLD | NEW |