chrome 100 percent

chrome 100 percent


DisciplinaPedagogia116.285 materiais669.908 seguidores
Pré-visualização50 páginas
{
 return GetMostVisitedItemData(restrictedId);
 };
 // This method is restricted to chrome-search://most-visited and
 // chrome-search://local-ntp pages by checking the invoking context's
 // origin in searchbox_extension.cc.
 this.logEvent = function(histogram_name) {
 LogEvent(histogram_name);
 };
 // This method is restricted to chrome-search://most-visited pages by
 // checking the invoking context's origin in searchbox_extension.cc.
 this.logMostVisitedImpression = function(position, tileTitleSource,
 tileSource, tileType,
 dataGenerationTime) {
 LogMostVisitedImpression(position, tileTitleSource, tileSource,
 tileType, dataGenerationTime);
 };
 // This method is restricted to chrome-search://most-visited pages by
 // checking the invoking context's origin in searchbox_extension.cc.
 this.logMostVisitedNavigation = function(position, tileTitleSource,
 tileSource, tileType,
 dataGenerationTime) {
 LogMostVisitedNavigation(position, tileTitleSource, tileSource,
 tileType, dataGenerationTime);
 };
 this.undoAllMostVisitedDeletions = function() {
 UndoAllMostVisitedDeletions();
 };
 this.undoMostVisitedDeletion = function(restrictedId) {
 UndoMostVisitedDeletion(restrictedId);
 };
 this.onsignedincheckdone = null;
 this.onhistorysynccheckdone = null;
 this.oninputcancel = null;
 this.oninputstart = null;
 this.onmostvisitedchange = null;
 this.onthemechange = null;
 };
 // TODO(jered): Remove when google no longer expects this object.
 chrome.searchBox = this.searchBox;
 };
}
// 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.
// Custom binding for the app API.
var appNatives = requireNative('app');
var process = requireNative('process');
var extensionId = process.GetExtensionId();
var logActivity = requireNative('activityLogger');
function wrapForLogging(fun) {
 if (!extensionId)
 return fun; // nothing interesting to log without an extension
 return function() {
 // TODO(ataly): We need to make sure we use the right prototype for
 // fun.apply. Array slice can either be rewritten or similarly defined.
 logActivity.LogAPICall(extensionId, "app." + fun.name,
 $Array.slice(arguments));
 return $Function.apply(fun, this, arguments);
 };
}
// This becomes chrome.app
var app = {
 getIsInstalled: wrapForLogging(appNatives.GetIsInstalled),
 getDetails: wrapForLogging(appNatives.GetDetails),
 runningState: wrapForLogging(appNatives.GetRunningState)
};
// Tricky; "getIsInstalled" is actually exposed as the getter "isInstalled",
// but we don't have a way to express this in the schema JSON (nor is it
// worth it for this one special case).
//
// So, define it manually, and let the getIsInstalled function act as its
// documentation.
var isInstalled = wrapForLogging(appNatives.GetIsInstalled);
$Object.defineProperty(
 app, 'isInstalled',
 {
 __proto__: null,
 configurable: true,
 enumerable: true,
 get: function() { return isInstalled(); },
 });
// Called by app_bindings.cc.
function onInstallStateResponse(state, callbackId) {
 var callback = callbacks[callbackId];
 delete callbacks[callbackId];
 if (typeof callback == 'function') {
 try {
 callback(state);
 } catch (e) {
 console.error('Exception in chrome.app.installState response handler: ' +
 e.stack);
 }
 }
}
// TODO(kalman): move this stuff to its own custom bindings.
var callbacks = { __proto__: null };
var nextCallbackId = 1;
function getInstallState(callback) {
 var callbackId = nextCallbackId++;
 callbacks[callbackId] = callback;
 appNatives.GetInstallState(callbackId);
}
$Object.defineProperty(
 app, 'installState',
 {
 __proto__: null,
 configurable: true,
 enumerable: true,
 value: wrapForLogging(getInstallState),
 writable: true,
 });
exports.$set('binding', app);
exports.$set('onInstallStateResponse', onInstallStateResponse);
// Copyright 2014 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.
// Custom bindings for the automation API.
var AutomationNode = require('automationNode').AutomationNode;
var AutomationRootNode = require('automationNode').AutomationRootNode;
var automation = apiBridge || require('binding').Binding.create('automation');
var automationInternal =
 getInternalApi ?
 getInternalApi('automationInternal') :
 require('binding').Binding.create('automationInternal').generate();
var exceptionHandler = require('uncaught_exception_handler');
var logging = requireNative('logging');
var nativeAutomationInternal = requireNative('automationInternal');
var GetRoutingID = nativeAutomationInternal.GetRoutingID;
var DestroyAccessibilityTree =
 nativeAutomationInternal.DestroyAccessibilityTree;
var GetIntAttribute = nativeAutomationInternal.GetIntAttribute;
var StartCachingAccessibilityTrees =
 nativeAutomationInternal.StartCachingAccessibilityTrees;
var AddTreeChangeObserver = nativeAutomationInternal.AddTreeChangeObserver;
var RemoveTreeChangeObserver =
 nativeAutomationInternal.RemoveTreeChangeObserver;
var GetFocusNative = nativeAutomationInternal.GetFocus;
var jsLastError = bindingUtil ? undefined : require('lastError');
function hasLastError() {
 return bindingUtil ?
 bindingUtil.hasLastError() : jsLastError.hasError(chrome);
}
/**
 * A namespace to export utility functions to other files in automation.
 */
window.automationUtil = function() {};
// TODO(aboxhall): Look into using WeakMap
var idToCallback = {};
var DESKTOP_TREE_ID = 0;
automationUtil.storeTreeCallback = function(id, callback) {
 if (!callback)
 return;
 var targetTree = AutomationRootNode.get(id);
 if (!targetTree) {
 // If we haven't cached the tree, hold the callback until the tree is
 // populated by the initial onAccessibilityEvent call.
 if (id in idToCallback)
 idToCallback[id].push(callback);
 else
 idToCallback[id] = [callback];
 } else {
 callback(targetTree);
 }
};
/**
 * Global list of tree change observers.
 * @type {Object<number, TreeChangeObserver>}
 */
automationUtil.treeChangeObserverMap = {};
/**
 * The id of the next tree change observer.
 * @type {number}
 */
automationUtil.nextTreeChangeObserverId = 1;
/**
 * @type {AutomationNode} The current focused node. This is only updated
 * when calling automationUtil.updateFocusedNode.
 */
automationUtil.focusedNode = null;
/**
 * Gets the currently focused AutomationNode.
 * @return {AutomationNode}
 */
automationUtil.getFocus = function() {
 var focusedNodeInfo = GetFocusNative(DESKTOP_TREE_ID);
 if (!focusedNodeInfo)
 return null;
 var tree = AutomationRootNode.getOrCreate(focusedNodeInfo.treeId);
 if (tree)
 return privates(tree).impl.get(focusedNodeInfo.nodeId);
};
/**
 * Update automationUtil.focusedNode to be the node that currently has focus.
 */
automationUtil.updateFocusedNode = function() {
 automationUtil.focusedNode = automationUtil.getFocus();
};
/**
 * Updates the focus on blur.
 */
automationUtil.updateFocusedNodeOnBlur = function() {
 var focus = automationUtil.getFocus();
 automationUtil.focusedNode = focus ? focus.root : null;
};
automation.registerCustomHook(function(bindingsAPI) {