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 3// found in the LICENSE file. 4 5// Custom binding for the Identity API. 6 7var binding = require('binding').Binding.create('identity'); 8 9binding.registerCustomHook(function(binding, id, contextType) { 10 var apiFunctions = binding.apiFunctions; 11 var identity = binding.compiledApi; 12 13 apiFunctions.setHandleRequest('getRedirectURL', function(path) { 14 if (path === null || path === undefined) 15 path = '/'; 16 else 17 path = String(path); 18 if (path[0] != '/') 19 path = '/' + path; 20 return 'https://' + id + '.chromiumapp.org' + path; 21 }); 22}); 23 24exports.binding = binding.generate(); 25