<commit_before>// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

var platformId = cordova.require('cordova/platform').id;
var runtime = require('chrome.runtime');

exports.TokenDetails = function(interactive) {
    this.interactive = interactive || false;
};

exports.WebAuthFlowDetails = function(url, interactive, width, height, left, top) {
    if (typeof url == 'undefined') {
        throw new Error('Url required');
    }
    this.url = url;
    this.interactive = interactive || false;
    this.width = width;
    this.height = height;
    this.left = left;
    this.top = top;
};

exports.getAuthToken = function(details, callback) {
    if(typeof details == 'function') {
        callback = details;
        details = new exports.TokenDetails();
    }
    if (typeof callback == 'undefined') {
        chrome.runtime.lastError = { 'message' : 'Callback function required' };
        // Not calling callback as it wasnt provided
        return;
    }
    var win = function(token) {
        callback(token);
    };
    var fail = function() {
        callback();
    };

    if (platformId == 'android') {
        // Use native implementation for logging into google accounts
        cordova.exec(win, fail, 'ChromeIdentity', 'getAuthToken', [details]);
    } else {
        // Use web app oauth flow
        _getAuthTokenJS(win, fail, details);
    }
};

exports.launchWebAuthFlow = function(details, callback) {S
    var failed = false;
    var failMessage;
    if (typeof details == 'undefined') {
        failed = true;
        failMessage = 'WebAuthFlowDetails required';
    } else if (typeof callback == 'undefined') {
        failed = true;
        failMessage = 'Callback function required';
    }

    if(failed === true) {
        chrome.runtime.lastError = { 'message' : failMessage };
        // Not calling callback as it wasnt provided<commit_msg>Delete a rogue character in identity.js<commit_after>// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

var platformId = cordova.require('cordova/platform').id;
var runtime = require('chrome.runtime');

exports.TokenDetails = function(interactive) {
    this.interactive = interactive || false;
};

exports.WebAuthFlowDetails = function(url, interactive, width, height, left, top) {
    if (typeof url == 'undefined') {
        throw new Error('Url required');
    }
    this.url = url;
    this.interactive = interactive || false;
    this.width = width;
    this.height = height;
    this.left = left;
    this.top = top;
};

exports.getAuthToken = function(details, callback) {
    if(typeof details == 'function') {
        callback = details;
        details = new exports.TokenDetails();
    }
    if (typeof callback == 'undefined') {
        chrome.runtime.lastError = { 'message' : 'Callback function required' };
        // Not calling callback as it wasnt provided
        return;
    }
    var win = function(token) {
        callback(token);
    };
    var fail = function() {
        callback();
    };

    if (platformId == 'android') {
        // Use native implementation for logging into google accounts
        cordova.exec(win, fail, 'ChromeIdentity', 'getAuthToken', [details]);
    } else {
        // Use web app oauth flow
        _getAuthTokenJS(win, fail, details);
    }
};

exports.launchWebAuthFlow = function(details, callback) {
    var failed = false;
    var failMessage;
    if (typeof details == 'undefined') {
        failed = true;
        failMessage = 'WebAuthFlowDetails required';
    } else if (typeof callback == 'undefined') {
        failed = true;
        failMessage = 'Callback function required';
    }

    if(failed === true) {
        chrome.runtime.lastError = { 'message' : failMessage };
        // Not calling callback as it wasnt provided
{'fraction_non_alphanumeric': 0.11910112359550562, 'fraction_numerical': 0.0019975031210986267, 'mean_word_length': 2.733457595526561, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4526230', 'n_tokens_mistral': 1104, 'n_tokens_neox': 1082, 'n_words': 343}