Skip to content
This repository was archived by the owner on Sep 6, 2021. It is now read-only.

Allow loading custom application shells. #6605

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,17 @@ require.config({

// The file system implementation. Change this value to use different
// implementations (e.g. cloud-based storage).
"fileSystemImpl" : "filesystem/impls/appshell/AppshellFileSystem"
"fileSystemImpl" : "filesystem/impls/appshell/AppshellFileSystem",

// The application shell implementation. Brackets-shell provides an
// instance of brackets.app, it will be used and the default value
// points to a void implementation. However, when running Brackets in a
// different environment, use this to load your implementation. For the
// definition of the interface, see appshell.app namespace at
// https://github.com/adobe/brackets-shell/blob/master/appshell/appshell_extensions.js
// Change this value to load custom implementation to run brackets in
// something else than Brackets shell (e.g. in a browser).
"appShellImpl" : "utils/InBrowserShell"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should probably not put this in utils. Probably best at the root but I could go for a shellImpl folder. This isn't a utility so it doesn't belong there.

}
});

Expand Down
2 changes: 1 addition & 1 deletion src/utils/Global.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ define(function (require, exports, module) {

// Create empty app namespace if running in-browser
if (!global.brackets.app) {
global.brackets.app = {};
global.brackets.app = require("appShellImpl");
}

// Loading extensions requires creating new require.js contexts, which
Expand Down
32 changes: 32 additions & 0 deletions src/utils/InBrowserShell.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* Copyright (c) 2014 Adobe Systems Incorporated. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*/

/*jslint vars: true, plusplus: true, devel: true, nomen: true, indent: 4, maxerr: 50 */
/*global define */
define(function (require, exports, module) {
"use strict";

// this implementation is intentionally left empty
// see src/main.js for details
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like this file should actually be named InAppShell or InBracketsShell or some such... running "in browser" (i.e. vanilla Chrome) would actually require filling in a bunch of the APIs here...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, my idea was that this would be the landing for in-browser shell API implementation, similar to what you've already started in the in-browser branch. This particular comment is misleading. So should I rename the file (would VoidShell do?) or clarify the comment?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was assuming that, in the in-browser branch, we'd change the require.config to redefine "appShellImpl" to point to a different impl module. Otherwise I'm confused about why we need that level of indirection: if we're just changing the contents of the same fixed module, we could load it the regular way with no special require.config needed.

If we're keeping the require.config indirection, then I think renaming to something like InNativeShell or InAppShell would be clearer -- since we'd have a different file in the in-browser branch.


});