Demo/bin/Debug/front_end/screencast/ScreencastApp.js

(开头部分) 4KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

// 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.

/**
 * @constructor
 * @implements {WebInspector.App}
 * @implements {WebInspector.TargetManager.Observer}
 */
WebInspector.ScreencastApp = function()
{
    this._enabledSetting = WebInspector.settings.createSetting("screencastEnabled", true);
    this._toggleButton = new WebInspector.ToolbarButton(WebInspector.UIString("Toggle screencast."), "screencast-toolbar-item");
    this._toggleButton.setToggled(this._enabledSetting.get());
    this._toggleButton.addEventListener("click", this._toggleButtonClicked, this);
    WebInspector.targetManager.observeTargets(this);
};

WebInspector.ScreencastApp.prototype = {
    /**
     * @param {!Document} document
     * @override
     */
    presentUI: function(document)
    {
        var rootView = new WebInspector.RootView();

        this._rootSplitWidget = new WebInspector.SplitWidget(false, true, "InspectorView.screencastSplitViewState", 300, 300);
        this._rootSplitWidget.setVertical(true);
        this._rootSplitWidget.setSecondIsSidebar(true);
        this._rootSplitWidget.show(rootView.element);
        this._rootSplitWidget.hideMain();

        this._rootSplitWidget.setSidebarWidget(WebInspector.inspectorView);
        WebInspector.inspectorView.showInitialPanel();
        rootView.attachToDocument(document);
    },

    /**
     * @override
     * @param {!WebInspector.Target} target
     */
    targetAdded: function(target)
    {
        if (this._target)
            return;
        this._target = target;
        if (target.hasCapability(WebInspector.Target.Capabilities.CanScreencast)) {
            this._screencastView = new WebInspector.ScreencastView(target);
            this._rootSplitWidget.setMainWidget(this._screencastView);
            this._screencastView.initialize();
        } else {
            this._toggleButton.setEnabled(false);
        }
        this._onScreencastEnabledChanged();
    },

    /**
     * @override
     * @param {!WebInspector.Target} target
后面还有 85 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。