Merge branch 'master' of github.com:github/atom
1
.gitignore
vendored
@@ -15,3 +15,4 @@ profile
|
||||
*.moved-aside
|
||||
.DS_Store
|
||||
tags
|
||||
atom-build
|
||||
|
||||
@@ -76,8 +76,8 @@
|
||||
0487D15B14FEE6D60045E5E3 /* cef_zip_archive.cc in Sources */ = {isa = PBXBuildFile; fileRef = 0487D12314FEE6D60045E5E3 /* cef_zip_archive.cc */; };
|
||||
0487D15C14FEE6D60045E5E3 /* libcef_dll_wrapper.cc in Sources */ = {isa = PBXBuildFile; fileRef = 0487D12414FEE6D60045E5E3 /* libcef_dll_wrapper.cc */; };
|
||||
0487D15D14FEE6D60045E5E3 /* libcef_dll_wrapper2.cc in Sources */ = {isa = PBXBuildFile; fileRef = 0487D12514FEE6D60045E5E3 /* libcef_dll_wrapper2.cc */; };
|
||||
0487D15F14FEE7880045E5E3 /* resources in Resources */ = {isa = PBXBuildFile; fileRef = 0487D15E14FEE7880045E5E3 /* resources */; };
|
||||
0487D16014FEE78E0045E5E3 /* resources in Copy Chrome Resources */ = {isa = PBXBuildFile; fileRef = 0487D15E14FEE7880045E5E3 /* resources */; };
|
||||
0487D15F14FEE7880045E5E3 /* Resources in Resources */ = {isa = PBXBuildFile; fileRef = 0487D15E14FEE7880045E5E3 /* Resources */; };
|
||||
0487D16014FEE78E0045E5E3 /* Resources in Copy Chrome Resources */ = {isa = PBXBuildFile; fileRef = 0487D15E14FEE7880045E5E3 /* Resources */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXContainerItemProxy section */
|
||||
@@ -105,11 +105,11 @@
|
||||
};
|
||||
0487CD9C14FEE17D0045E5E3 /* Copy Chrome Resources */ = {
|
||||
isa = PBXCopyFilesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
buildActionMask = 12;
|
||||
dstPath = "$(CONTENTS_FOLDER_PATH)";
|
||||
dstSubfolderSpec = 16;
|
||||
files = (
|
||||
0487D16014FEE78E0045E5E3 /* resources in Copy Chrome Resources */,
|
||||
0487D16014FEE78E0045E5E3 /* Resources in Copy Chrome Resources */,
|
||||
);
|
||||
name = "Copy Chrome Resources";
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
@@ -285,7 +285,7 @@
|
||||
0487D12314FEE6D60045E5E3 /* cef_zip_archive.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = cef_zip_archive.cc; sourceTree = "<group>"; };
|
||||
0487D12414FEE6D60045E5E3 /* libcef_dll_wrapper.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = libcef_dll_wrapper.cc; sourceTree = "<group>"; };
|
||||
0487D12514FEE6D60045E5E3 /* libcef_dll_wrapper2.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = libcef_dll_wrapper2.cc; sourceTree = "<group>"; };
|
||||
0487D15E14FEE7880045E5E3 /* resources */ = {isa = PBXFileReference; lastKnownFileType = folder; path = resources; sourceTree = "<group>"; };
|
||||
0487D15E14FEE7880045E5E3 /* Resources */ = {isa = PBXFileReference; lastKnownFileType = folder; path = Resources; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
@@ -371,7 +371,7 @@
|
||||
0487C91D14FED5360045E5E3 /* Supporting Files */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
0487D15E14FEE7880045E5E3 /* resources */,
|
||||
0487D15E14FEE7880045E5E3 /* Resources */,
|
||||
0487C93314FED5FB0045E5E3 /* Atom.icns */,
|
||||
0487C93414FED5FB0045E5E3 /* ClientWindow.xib */,
|
||||
0487C93514FED5FB0045E5E3 /* Info.plist */,
|
||||
@@ -675,7 +675,7 @@
|
||||
0487C93714FED5FB0045E5E3 /* Atom.icns in Resources */,
|
||||
0487C93814FED5FB0045E5E3 /* ClientWindow.xib in Resources */,
|
||||
0487C93A14FED5FB0045E5E3 /* MainMenu.xib in Resources */,
|
||||
0487D15F14FEE7880045E5E3 /* resources in Resources */,
|
||||
0487D15F14FEE7880045E5E3 /* Resources in Resources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
@@ -726,7 +726,7 @@
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "rake build";
|
||||
shellScript = "rake compile-coffeescripts";
|
||||
showEnvVarsInLog = 0;
|
||||
};
|
||||
/* End PBXShellScriptBuildPhase section */
|
||||
|
||||
|
Before Width: | Height: | Size: 752 B After Width: | Height: | Size: 752 B |
|
Before Width: | Height: | Size: 183 B After Width: | Height: | Size: 183 B |
|
Before Width: | Height: | Size: 523 B After Width: | Height: | Size: 523 B |
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.2 KiB |
|
Before Width: | Height: | Size: 5.8 KiB After Width: | Height: | Size: 5.8 KiB |
|
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.3 KiB |
|
Before Width: | Height: | Size: 6.0 KiB After Width: | Height: | Size: 6.0 KiB |
|
Before Width: | Height: | Size: 123 B After Width: | Height: | Size: 123 B |
|
Before Width: | Height: | Size: 126 B After Width: | Height: | Size: 126 B |
|
Before Width: | Height: | Size: 239 B After Width: | Height: | Size: 239 B |
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 341 B After Width: | Height: | Size: 341 B |
|
Before Width: | Height: | Size: 411 B After Width: | Height: | Size: 411 B |
|
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 3.3 KiB |
|
Before Width: | Height: | Size: 175 B After Width: | Height: | Size: 175 B |
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 90 B After Width: | Height: | Size: 90 B |
|
Before Width: | Height: | Size: 209 B After Width: | Height: | Size: 209 B |
|
Before Width: | Height: | Size: 212 B After Width: | Height: | Size: 212 B |
|
Before Width: | Height: | Size: 125 B After Width: | Height: | Size: 125 B |
|
Before Width: | Height: | Size: 144 B After Width: | Height: | Size: 144 B |
|
Before Width: | Height: | Size: 174 B After Width: | Height: | Size: 174 B |
|
Before Width: | Height: | Size: 193 B After Width: | Height: | Size: 193 B |
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 7.0 KiB After Width: | Height: | Size: 7.0 KiB |
|
Before Width: | Height: | Size: 175 B After Width: | Height: | Size: 175 B |
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 166 B After Width: | Height: | Size: 166 B |
|
Before Width: | Height: | Size: 128 B After Width: | Height: | Size: 128 B |
|
Before Width: | Height: | Size: 177 B After Width: | Height: | Size: 177 B |
|
Before Width: | Height: | Size: 146 B After Width: | Height: | Size: 146 B |
|
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 2.8 KiB |
|
Before Width: | Height: | Size: 819 B After Width: | Height: | Size: 819 B |
|
Before Width: | Height: | Size: 120 B After Width: | Height: | Size: 120 B |
|
Before Width: | Height: | Size: 125 B After Width: | Height: | Size: 125 B |
|
Before Width: | Height: | Size: 122 B After Width: | Height: | Size: 122 B |
|
Before Width: | Height: | Size: 199 B After Width: | Height: | Size: 199 B |
|
Before Width: | Height: | Size: 182 B After Width: | Height: | Size: 182 B |
@@ -12,18 +12,12 @@
|
||||
// Provide the CefAppProtocol implementation required by CEF.
|
||||
@implementation Atom
|
||||
|
||||
+ (NSApplication *)sharedApplication {
|
||||
if (!NSApp) {
|
||||
// Populate the settings based on command line arguments.
|
||||
CefSettings settings;
|
||||
AppGetSettings(settings);
|
||||
|
||||
// Initialize CEF.
|
||||
CefRefPtr<CefApp> app;
|
||||
CefInitialize(settings, app);
|
||||
}
|
||||
+ (void)load {
|
||||
CefSettings settings;
|
||||
AppGetSettings(settings);
|
||||
|
||||
return [super sharedApplication];
|
||||
CefRefPtr<CefApp> app;
|
||||
CefInitialize(settings, app);
|
||||
}
|
||||
|
||||
- (void)dealloc {
|
||||
@@ -64,7 +58,7 @@
|
||||
NSURL *resourceDirURL = [[NSBundle mainBundle] resourceURL];
|
||||
NSString *indexURLString = [[resourceDirURL URLByAppendingPathComponent:@"index.html"] absoluteString];
|
||||
CefBrowser::CreateBrowser(window_info, _clientHandler.get(), [indexURLString UTF8String], settings);
|
||||
}
|
||||
}
|
||||
|
||||
- (void)open:(NSString *)path {
|
||||
[[AtomController alloc] initWithPath:path atomContext:[self atomContext]];
|
||||
@@ -113,6 +107,18 @@
|
||||
context->Exit();
|
||||
}
|
||||
|
||||
- (void)loadEnd {
|
||||
if ([[[NSProcessInfo processInfo] arguments] containsObject:@"--benchmark"]) {
|
||||
CefRefPtr<CefV8Context> context = _clientHandler->GetBrowser()->GetMainFrame()->GetV8Context();
|
||||
context->Enter();
|
||||
CefRefPtr<CefV8Value> atom = context->GetGlobal()->GetValue("atom");
|
||||
atom->SetValue("exitOnCompletion", CefV8Value::CreateBool(YES), V8_PROPERTY_ATTRIBUTE_NONE);
|
||||
context->Exit();
|
||||
|
||||
[self runBenchmarks:self];
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
// Returns the application settings based on command line arguments.
|
||||
|
||||
@@ -120,7 +120,6 @@
|
||||
_atomContext = NULL;
|
||||
_clientHandler = NULL;
|
||||
|
||||
// Clean ourselves up after clearing the stack of anything that might have the window on it.
|
||||
[self autorelease];
|
||||
|
||||
return YES;
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
@optional
|
||||
- (void)afterCreated;
|
||||
- (void)loadStart;
|
||||
- (void)loadEnd;
|
||||
- (bool)keyEventOfType:(cef_handler_keyevent_type_t)type code:(int)code modifiers:(int)modifiers isSystemKey:(bool)isSystemKey isAfterJavaScript:(bool)isAfterJavaScript;
|
||||
|
||||
@end
|
||||
|
||||
@@ -82,6 +82,11 @@ public:
|
||||
virtual void OnFocusedNodeChanged(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
CefRefPtr<CefDOMNode> node) OVERRIDE;
|
||||
|
||||
virtual bool OnConsoleMessage(CefRefPtr<CefBrowser> browser,
|
||||
const CefString& message,
|
||||
const CefString& source,
|
||||
int line) OVERRIDE;
|
||||
|
||||
// CefKeyboardHandler methods.
|
||||
virtual bool OnKeyEvent(CefRefPtr<CefBrowser> browser,
|
||||
|
||||
@@ -4,10 +4,10 @@
|
||||
#import "AtomController.h"
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
#import <iostream>
|
||||
#import <sstream>
|
||||
#import <stdio.h>
|
||||
#import <string>
|
||||
|
||||
#import <assert.h>
|
||||
|
||||
#ifndef NDEBUG
|
||||
@@ -82,6 +82,12 @@ void ClientHandler::OnLoadEnd(CefRefPtr<CefBrowser> browser,
|
||||
int httpStatusCode)
|
||||
{
|
||||
REQUIRE_UI_THREAD();
|
||||
|
||||
|
||||
if ([m_delegate respondsToSelector:@selector(loadEnd)]) {
|
||||
[m_delegate loadEnd];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
bool ClientHandler::OnLoadError(CefRefPtr<CefBrowser> browser,
|
||||
@@ -197,3 +203,15 @@ void ClientHandler::OnTitleChange(CefRefPtr<CefBrowser> browser,
|
||||
NSString* str = [NSString stringWithUTF8String:titleStr.c_str()];
|
||||
[window setTitle:str];
|
||||
}
|
||||
|
||||
bool ClientHandler::OnConsoleMessage(CefRefPtr<CefBrowser> browser,
|
||||
const CefString& message,
|
||||
const CefString& source,
|
||||
int line)
|
||||
{
|
||||
REQUIRE_UI_THREAD();
|
||||
|
||||
std::cout << std::string(message) << "\n";
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ NSString *stringFromCefV8Value(const CefRefPtr<CefV8Value>& value) {
|
||||
NativeHandler::NativeHandler() : CefV8Handler() {
|
||||
m_object = CefV8Value::CreateObject(NULL);
|
||||
|
||||
const char *functionNames[] = {"exists", "read", "write", "absolute", "list", "isFile", "isDirectory", "remove", "asyncList", "open", "openDialog", "quit", "writeToPasteboard", "readFromPasteboard", "showDevTools", "newWindow", "saveDialog"};
|
||||
const char *functionNames[] = {"exists", "read", "write", "absolute", "list", "isFile", "isDirectory", "remove", "asyncList", "open", "openDialog", "quit", "writeToPasteboard", "readFromPasteboard", "showDevTools", "newWindow", "saveDialog", "exit"};
|
||||
NSUInteger arrayLength = sizeof(functionNames) / sizeof(const char *);
|
||||
for (NSUInteger i = 0; i < arrayLength; i++) {
|
||||
const char *functionName = functionNames[i];
|
||||
@@ -253,6 +253,10 @@ bool NativeHandler::Execute(const CefString& name,
|
||||
CefV8Context::GetCurrentContext()->GetBrowser()->ShowDevTools();
|
||||
return true;
|
||||
}
|
||||
else if (name == "exit") {
|
||||
[NSApp terminate:NSApp];
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
46
Rakefile
@@ -1,7 +1,43 @@
|
||||
ENV['PATH'] = "#{ENV['PATH']}:/usr/local/bin/"
|
||||
$ATOM_ENV = []
|
||||
|
||||
desc "Build the shit."
|
||||
ENV['PATH'] = "#{ENV['PATH']}:/usr/local/bin/"
|
||||
BUILD_DIR = 'atom-build'
|
||||
|
||||
desc "Build Atom via `xcodebuild`"
|
||||
task :build do
|
||||
output = `xcodebuild SYMROOT=#{BUILD_DIR}`
|
||||
if $?.exitstatus != 0
|
||||
$stderr.puts "Error #{$?.exitstatus}:\n#{output}"
|
||||
end
|
||||
end
|
||||
|
||||
desc "Run Atom"
|
||||
task :run => :build do
|
||||
applications = FileList["#{BUILD_DIR}/**/*.app"]
|
||||
if applications.size == 0
|
||||
$stderr.puts "No Atom application found in directory `#{BUILD_DIR}`"
|
||||
elsif applications.size > 1
|
||||
$stderr.puts "Multiple Atom applications found \n\t" + applications.join("\n\t")
|
||||
else
|
||||
app_path = "#{applications.first}/Contents/MacOS/Atom"
|
||||
if File.exists?(app_path)
|
||||
puts "#{$ATOM_ENV.join(' ')} #{applications.first}/Contents/MacOS/Atom"
|
||||
output = `#{applications.first}/Contents/MacOS/Atom --benchmark`
|
||||
puts output
|
||||
else
|
||||
$stderr.puts "Executable `#{app_path}` not found."
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
desc "Run the benchmarks"
|
||||
task :benchmark do
|
||||
$ATOM_ENV.push "RUN_BENCHMARKS=1"
|
||||
Rake::Task["run"].invoke
|
||||
end
|
||||
|
||||
desc "Compile CoffeeScripts"
|
||||
task :"compile-coffeescripts" do
|
||||
project_dir = ENV['PROJECT_DIR'] || '.'
|
||||
built_dir = ENV['BUILT_PRODUCTS_DIR'] || '.'
|
||||
contents_dir = ENV['CONTENTS_FOLDER_PATH'].to_s
|
||||
@@ -23,12 +59,6 @@ task :build do
|
||||
sh "coffee -c #{dest}/src #{dest}/vendor #{dest}/spec"
|
||||
end
|
||||
|
||||
desc "Install the app in /Applications"
|
||||
task :install do
|
||||
rm_rf "/Applications/Atomicity.app"
|
||||
cp_r "Cocoa/build/Debug/Atomicity.app /Applications"
|
||||
end
|
||||
|
||||
desc "Change webkit frameworks to use @rpath as install name"
|
||||
task :"webkit-fix" do
|
||||
for framework in FileList["frameworks/*.framework"]
|
||||
|
||||
@@ -14,6 +14,12 @@ $('body').append $$ ->
|
||||
@div id: 'jasmine_runner'
|
||||
@div id: 'jasmine-content'
|
||||
|
||||
if atom.exitOnCompletion?
|
||||
originalFinishCallback = jasmine.Runner.prototype.finishCallback
|
||||
jasmine.Runner.prototype.finishCallback = ->
|
||||
originalFinishCallback.call(this)
|
||||
$native.exit()
|
||||
|
||||
jasmineEnv = jasmine.getEnv()
|
||||
trivialReporter = new jasmine.TrivialReporter(document, 'jasmine_runner')
|
||||
|
||||
|
||||