Merge pull request #1389 from atom/rename-to-electron

Rename to electron
This commit is contained in:
Cheng Zhao 2015-04-17 15:22:07 +08:00
commit cd0aa4a956
76 changed files with 375 additions and 313 deletions

View file

@ -29,7 +29,7 @@ int AtomInitializeICUandStartNode(int argc, char *argv[]) {
brightray::MainApplicationBundlePath()
.Append("Contents")
.Append("Frameworks")
.Append(PRODUCT_NAME " Framework.framework"));
.Append(ATOM_PRODUCT_NAME " Framework.framework"));
base::i18n::InitializeICU();
return atom::NodeMain(argc, argv);
}

View file

@ -6,7 +6,9 @@
#include "base/mac/bundle_locations.h"
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/path_service.h"
#include "brightray/common/application_info.h"
#include "brightray/common/mac/main_application_bundle.h"
#include "content/public/common/content_paths.h"
@ -19,19 +21,30 @@ base::FilePath GetFrameworksPath() {
.Append("Frameworks");
}
base::FilePath GetHelperAppPath(const base::FilePath& frameworks_path,
const std::string& name) {
return frameworks_path.Append(name + " Helper.app")
.Append("Contents")
.Append("MacOS")
.Append(name + " Helper");
}
} // namespace
void AtomMainDelegate::OverrideFrameworkBundlePath() {
base::mac::SetOverrideFrameworkBundlePath(
GetFrameworksPath().Append(PRODUCT_NAME " Framework.framework"));
GetFrameworksPath().Append(ATOM_PRODUCT_NAME " Framework.framework"));
}
void AtomMainDelegate::OverrideChildProcessPath() {
base::FilePath helper_path =
GetFrameworksPath().Append(PRODUCT_NAME " Helper.app")
.Append("Contents")
.Append("MacOS")
.Append(PRODUCT_NAME " Helper");
base::FilePath frameworks_path = GetFrameworksPath();
base::FilePath helper_path = GetHelperAppPath(frameworks_path,
ATOM_PRODUCT_NAME);
if (!base::PathExists(helper_path))
helper_path = GetHelperAppPath(frameworks_path,
brightray::GetApplicationName());
if (!base::PathExists(helper_path))
LOG(FATAL) << "Unable to find helper app";
PathService::Override(content::CHILD_PROCESS_EXE, helper_path);
}

View file

@ -4,12 +4,11 @@
#include "atom/browser/atom_browser_main_parts.h"
#import "atom/browser/mac/atom_application.h"
#import "atom/browser/mac/atom_application_delegate.h"
#include "base/files/file_path.h"
#import "base/mac/foundation_util.h"
#include "atom/browser/mac/atom_application.h"
#include "atom/browser/mac/atom_application_delegate.h"
#include "base/mac/bundle_locations.h"
#include "base/mac/foundation_util.h"
#include "ui/base/l10n/l10n_util_mac.h"
#import "vendor/brightray/common/mac/main_application_bundle.h"
namespace atom {
@ -23,12 +22,7 @@ void AtomBrowserMainParts::PreMainMessageLoopStart() {
AtomApplicationDelegate* delegate = [[AtomApplicationDelegate alloc] init];
[NSApp setDelegate:(id<NSFileManagerDelegate>)delegate];
base::FilePath frameworkPath = brightray::MainApplicationBundlePath()
.Append("Contents")
.Append("Frameworks")
.Append(PRODUCT_NAME " Framework.framework");
NSBundle* frameworkBundle = [NSBundle
bundleWithPath:base::mac::FilePathToNSString(frameworkPath)];
NSBundle* frameworkBundle = base::mac::FrameworkBundle();
NSNib* mainNib = [[NSNib alloc] initWithNibNamed:@"MainMenu"
bundle:frameworkBundle];
[mainNib instantiateWithOwner:application topLevelObjects:nil];

View file

@ -9,6 +9,7 @@
#include "atom/browser/native_window.h"
#include "atom/browser/window_list.h"
#include "atom/common/atom_version.h"
#include "brightray/common/application_info.h"
namespace atom {
@ -31,11 +32,11 @@ void Browser::ClearRecentDocuments() {
}
std::string Browser::GetExecutableFileVersion() const {
return ATOM_VERSION_STRING;
return brightray::GetApplicationVersion();
}
std::string Browser::GetExecutableFileProductName() const {
return "Atom-Shell";
return brightray::GetApplicationName();
}
} // namespace atom

View file

@ -4,13 +4,13 @@
#include "atom/browser/browser.h"
#import "atom/browser/mac/atom_application.h"
#import "atom/browser/mac/atom_application_delegate.h"
#include "atom/browser/mac/atom_application.h"
#include "atom/browser/mac/atom_application_delegate.h"
#include "atom/browser/native_window.h"
#include "atom/browser/window_list.h"
#import "base/mac/bundle_locations.h"
#import "base/mac/foundation_util.h"
#include "base/mac/foundation_util.h"
#include "base/strings/sys_string_conversions.h"
#include "brightray/common/application_info.h"
namespace atom {
@ -27,15 +27,11 @@ void Browser::ClearRecentDocuments() {
}
std::string Browser::GetExecutableFileVersion() const {
NSDictionary* infoDictionary = base::mac::OuterBundle().infoDictionary;
NSString *version = [infoDictionary objectForKey:@"CFBundleVersion"];
return base::SysNSStringToUTF8(version);
return brightray::GetApplicationVersion();
}
std::string Browser::GetExecutableFileProductName() const {
NSDictionary* infoDictionary = base::mac::OuterBundle().infoDictionary;
NSString *version = [infoDictionary objectForKey:@"CFBundleName"];
return base::SysNSStringToUTF8(version);
return brightray::GetApplicationName();
}
int Browser::DockBounce(BounceType type) {

View file

@ -118,7 +118,7 @@ void Browser::SetUserTasks(const std::vector<UserTask>& tasks) {
}
void Browser::SetAppUserModelID(const std::string& name) {
app_user_model_id_ = base::string16(L"atom-shell.app.");
app_user_model_id_ = base::string16(L"electron.app.");
app_user_model_id_ += base::UTF8ToUTF16(name);
SetCurrentProcessExplicitAppUserModelID(app_user_model_id_.c_str());
}
@ -142,7 +142,7 @@ std::string Browser::GetExecutableFileProductName() const {
return base::UTF16ToUTF8(version_info->product_name());
}
return "Atom-Shell";
return ATOM_PRODUCT_NAME;
}
} // namespace atom

View file

@ -25,10 +25,10 @@ app.on('ready', function() {
if (process.platform == 'darwin') {
var template = [
{
label: 'Atom Shell',
label: 'Electron',
submenu: [
{
label: 'About Atom Shell',
label: 'About Electron',
selector: 'orderFrontStandardAboutPanel:'
},
{
@ -42,7 +42,7 @@ app.on('ready', function() {
type: 'separator'
},
{
label: 'Hide Atom Shell',
label: 'Hide Electron',
accelerator: 'Command+H',
selector: 'hide:'
},

View file

@ -1,6 +1,6 @@
<html>
<head>
<title>Atom Shell</title>
<title>Electron</title>
<style>
body {
color: #555;
@ -72,19 +72,19 @@
};
</script>
<h2 style="-webkit-app-region: drag">Welcome to Atom Shell</h2>
<h2 style="-webkit-app-region: drag">Welcome to Electron</h2>
<p>
To run your app with atom-shell, execute the following command under your
To run your app with Electron, execute the following command under your
Console (or Terminal):
</p>
<script>document.write('<pre>' + command + '</pre>')</script>
<p>
The <code>path-to-your-app</code> should be the path to your own atom-shell
app, you can read the <a href='https://github.com/atom/atom-shell/blob/master/docs/tutorial/quick-start.md'>quick start</a>
guide in atom-shell's <a href='https://github.com/atom/atom-shell/blob/master/docs'>docs</a>
The <code>path-to-your-app</code> should be the path to your own Electron
app, you can read the <a href='https://github.com/atom/electron/blob/master/docs/tutorial/quick-start.md'>quick start</a>
guide in Electron's <a href='https://github.com/atom/electron/blob/master/docs'>docs</a>
on how to write one.
</p>

View file

@ -50,7 +50,7 @@ if (option.file && !option.webdriver) {
} catch(e) {
if (e.code == 'MODULE_NOT_FOUND') {
app.focus();
dialog.showErrorBox('Error opening app', 'The app provided is not a valid atom-shell app, please read the docs on how to write one:\nhttps://github.com/atom/atom-shell/tree/master/docs');
dialog.showErrorBox('Error opening app', 'The app provided is not a valid electron app, please read the docs on how to write one:\nhttps://github.com/atom/electron/tree/master/docs');
process.exit(1);
} else {
console.error('App threw an error when running', e);
@ -58,7 +58,7 @@ if (option.file && !option.webdriver) {
}
}
} else if (option.version) {
console.log('v' + process.versions['atom-shell']);
console.log('v' + process.versions['electron']);
process.exit(0);
} else {
require('./default_app.js');

View file

@ -1,6 +1,5 @@
{
"name": "atom-shell-default-app",
"productName": "Atom Shell Default App",
"version": "0.1.0",
"name": "electron",
"productName": "Electron",
"main": "main.js"
}

View file

@ -144,7 +144,7 @@ NativeWindow::NativeWindow(content::WebContents* web_contents,
// Override the user agent to contain application and atom-shell's version.
Browser* browser = Browser::Get();
std::string product_name = base::StringPrintf(
"%s/%s Chrome/%s AtomShell/" ATOM_VERSION_STRING,
"%s/%s Chrome/%s " ATOM_PRODUCT_NAME "/" ATOM_VERSION_STRING,
RemoveWhitespace(browser->GetName()).c_str(),
browser->GetVersion().c_str(),
CHROME_VERSION_STRING);
@ -226,7 +226,7 @@ void NativeWindow::InitFromOptions(const mate::Dictionary& options) {
if (options.Get(switches::kKiosk, &kiosk) && kiosk) {
SetKiosk(kiosk);
}
std::string title("Atom Shell");
std::string title("Electron");
options.Get(switches::kTitle, &title);
SetTitle(title);

View file

@ -126,7 +126,7 @@ void NodeDebugger::SendConnectMessage() {
"Protocol-Version: 1\r\n"
"Embedding-Host: %s\r\n"
"%s: 0\r\n",
v8::V8::GetVersion(), "Atom-Shell", kContentLength), true);
v8::V8::GetVersion(), ATOM_PRODUCT_NAME, kContentLength), true);
}
// static

View file

@ -7,7 +7,7 @@
<key>CFBundleExecutable</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundleIdentifier</key>
<string>com.github.atom-shell</string>
<string>${ATOM_BUNDLE_ID}</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 345 KiB

After

Width:  |  Height:  |  Size: 76 KiB

Before After
Before After

View file

@ -120,7 +120,7 @@ struct RunState {
};
bool CreateDialogThread(RunState* run_state) {
base::Thread* thread = new base::Thread("AtomShell_FileDialogThread");
base::Thread* thread = new base::Thread(ATOM_PRODUCT_NAME "FileDialogThread");
thread->init_com_with_mta(false);
if (!thread->Start())
return false;

View file

@ -25,7 +25,7 @@ namespace atom {
namespace {
const char kViewClassName[] = "AtomMenuBar";
const char kViewClassName[] = "ElectronMenuBar";
// Default color of the menu bar.
const SkColor kDefaultColor = SkColorSetARGB(255, 233, 233, 233);

View file

@ -24,7 +24,7 @@ const UINT kNotifyIconMessage = WM_APP + 1;
// |kBaseIconId| is 2 to avoid conflicts with plugins that hard-code id 1.
const UINT kBaseIconId = 2;
const wchar_t kNotifyIconHostWindowClass[] = L"AtomShell_NotifyIconHostWindow";
const wchar_t kNotifyIconHostWindowClass[] = L"Electron_NotifyIconHostWindow";
} // namespace

View file

@ -63,7 +63,8 @@ void AtomBindings::BindTo(v8::Isolate* isolate,
mate::Dictionary versions;
if (dict.Get("versions", &versions)) {
versions.Set("atom-shell", ATOM_VERSION_STRING);
versions.Set(ATOM_PROJECT_NAME, ATOM_VERSION_STRING);
versions.Set("atom-shell", ATOM_VERSION_STRING); // For compatibility.
versions.Set("chrome", CHROME_VERSION_STRING);
}
}

View file

@ -8,7 +8,13 @@ class CrashReporter
start: (options={}) ->
{@productName, companyName, submitUrl, autoSubmit, ignoreSystemCrashHandler, extra} = options
@productName ?= 'Atom-Shell'
app =
if process.type is 'browser'
require 'app'
else
require('remote').require 'app'
@productName ?= app.getName()
companyName ?= 'GitHub, Inc'
submitUrl ?= 'http://54.249.141.255:1127/post'
autoSubmit ?= true
@ -17,11 +23,7 @@ class CrashReporter
extra._productName ?= @productName
extra._companyName ?= companyName
extra._version ?=
if process.type is 'browser'
require('app').getVersion()
else
require('remote').require('app').getVersion()
extra._version ?= app.getVersion()
start = => binding.start @productName, companyName, submitUrl, autoSubmit, ignoreSystemCrashHandler, extra

View file

@ -64,7 +64,7 @@ void CrashReporterLinux::InitBreakpad(const std::string& product_name,
bool skip_system_crash_handler) {
EnableCrashDumping(product_name);
crash_keys_.SetKeyValue("prod", "Atom-Shell");
crash_keys_.SetKeyValue("prod", ATOM_PRODUCT_NAME);
crash_keys_.SetKeyValue("ver", version.c_str());
upload_url_ = submit_url;

View file

@ -32,7 +32,7 @@ void CrashReporterMac::InitBreakpad(const std::string& product_name,
NSMutableDictionary* parameters =
[NSMutableDictionary dictionaryWithCapacity:4];
[parameters setValue:@"Atom-Shell"
[parameters setValue:@ATOM_PRODUCT_NAME
forKey:@BREAKPAD_PRODUCT];
[parameters setValue:base::SysUTF8ToNSString(product_name)
forKey:@BREAKPAD_PRODUCT_DISPLAY];

View file

@ -103,7 +103,7 @@ google_breakpad::CustomClientInfo* CrashReporterWin::GetCustomInfo(
custom_info_entries_.reserve(2 + upload_parameters_.size());
custom_info_entries_.push_back(google_breakpad::CustomInfoEntry(
L"prod", L"Atom-Shell"));
L"prod", L"Electron"));
custom_info_entries_.push_back(google_breakpad::CustomInfoEntry(
L"ver", base::UTF8ToWide(version).c_str()));

View file

@ -73,7 +73,7 @@ int Main(const wchar_t* cmd) {
NULL);
cmd_line.AppendSwitch("no-window");
cmd_line.AppendSwitchASCII("max-reports", "128");
cmd_line.AppendSwitchASCII("reporter", "atom-shell-crash-service");
cmd_line.AppendSwitchASCII("reporter", ATOM_PROJECT_NAME "-crash-service");
cmd_line.AppendSwitchNative("pipe-name", pipe_name);
breakpad::CrashService crash_service;

View file

@ -9,7 +9,7 @@
namespace brightray {
std::string GetApplicationName() {
return "Atom-Shell";
return ATOM_PRODUCT_NAME;
}
std::string GetApplicationVersion() {

View file

@ -15,6 +15,7 @@
#include "base/message_loop/message_loop.h"
#include "base/path_service.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/common/content_paths.h"
#include "native_mate/locker.h"
#include "native_mate/dictionary.h"
@ -27,7 +28,7 @@ using content::BrowserThread;
#define REFERENCE_MODULE(name) \
extern "C" void _register_ ## name(void); \
void (*fp_register_ ## name)(void) = _register_ ## name
// Atom Shell's builtin modules.
// Electron's builtin modules.
REFERENCE_MODULE(atom_browser_app);
REFERENCE_MODULE(atom_browser_auto_updater);
REFERENCE_MODULE(atom_browser_content_tracing);
@ -157,6 +158,10 @@ node::Environment* NodeBindings::CreateEnvironment(
mate::Dictionary process(context->GetIsolate(), env->process_object());
process.Set("type", process_type);
process.Set("resourcesPath", resources_path);
// The path to helper app.
base::FilePath helper_exec_path;
PathService::Get(content::CHILD_PROCESS_EXE, &helper_exec_path);
process.Set("helperExecPath", helper_exec_path);
return env;
}

View file

@ -3,11 +3,11 @@
<plist version="1.0">
<dict>
<key>CFBundleExecutable</key>
<string>Atom Framework</string>
<string>${PRODUCT_NAME} Framework</string>
<key>CFBundleIdentifier</key>
<string>com.github.AtomFramework</string>
<string>${ATOM_BUNDLE_ID}</string>
<key>CFBundleName</key>
<string>Atom Framework</string>
<string>${PRODUCT_NAME} Framework</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>NSSupportsAutomaticGraphicsSwitching</key>

View file

@ -57,7 +57,7 @@
<array class="NSMutableArray" key="NSMenuItems">
<object class="NSMenuItem" id="238522557">
<reference key="NSMenu" ref="110575045"/>
<string key="NSTitle">About Atom</string>
<string key="NSTitle">About</string>
<string key="NSKeyEquiv"/>
<int key="NSMnemonicLoc">2147483647</int>
<reference key="NSOnImage" ref="229763992"/>
@ -118,7 +118,7 @@
</object>
<object class="NSMenuItem" id="755159360">
<reference key="NSMenu" ref="110575045"/>
<string key="NSTitle">Hide Atom</string>
<string key="NSTitle">Hide</string>
<string key="NSKeyEquiv">h</string>
<int key="NSKeyEquivModMask">1048576</int>
<int key="NSMnemonicLoc">2147483647</int>
@ -154,7 +154,7 @@
</object>
<object class="NSMenuItem" id="632727374">
<reference key="NSMenu" ref="110575045"/>
<string key="NSTitle">Quit Atom</string>
<string key="NSTitle">Quit</string>
<string key="NSKeyEquiv">q</string>
<int key="NSKeyEquivModMask">1048576</int>
<int key="NSMnemonicLoc">2147483647</int>

View file

@ -72,7 +72,7 @@ window.confirm = (message, title='') ->
# But we do not support prompt().
window.prompt = ->
throw new Error('prompt() is and will not be supported in atom-shell.')
throw new Error('prompt() is and will not be supported.')
window.opener =
postMessage: (message, targetOrigin='*') ->

View file

@ -2,15 +2,15 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleIdentifier</key>
<string>com.github.atom-shell.helper</string>
<key>CFBundleName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>LSUIElement</key>
<true/>
<key>NSSupportsAutomaticGraphicsSwitching</key>
<true/>
<key>CFBundleIdentifier</key>
<string>${ATOM_BUNDLE_ID}</string>
<key>CFBundleName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>LSUIElement</key>
<true/>
<key>NSSupportsAutomaticGraphicsSwitching</key>
<true/>
</dict>
</plist>