This commit is contained in:
Renato Alencar 2015-10-08 12:41:56 -03:00
commit 1a2b5834ed
22 changed files with 428 additions and 31 deletions

View file

@ -99,7 +99,7 @@ void AtomContentClient::AddAdditionalSchemes(
void AtomContentClient::AddPepperPlugins( void AtomContentClient::AddPepperPlugins(
std::vector<content::PepperPluginInfo>* plugins) { std::vector<content::PepperPluginInfo>* plugins) {
auto command_line = base::CommandLine::ForCurrentProcess(); auto command_line = base::CommandLine::ForCurrentProcess();
auto flash_path = command_line->GetSwitchValueNative( auto flash_path = command_line->GetSwitchValuePath(
switches::kPpapiFlashPath); switches::kPpapiFlashPath);
if (flash_path.empty()) if (flash_path.empty())
return; return;
@ -108,7 +108,7 @@ void AtomContentClient::AddPepperPlugins(
switches::kPpapiFlashVersion); switches::kPpapiFlashVersion);
plugins->push_back( plugins->push_back(
CreatePepperFlashInfo(base::FilePath(flash_path), flash_version)); CreatePepperFlashInfo(flash_path, flash_version));
} }
} // namespace atom } // namespace atom

View file

@ -20,6 +20,7 @@
#include "atom/common/native_mate_converters/callback.h" #include "atom/common/native_mate_converters/callback.h"
#include "atom/common/native_mate_converters/file_path_converter.h" #include "atom/common/native_mate_converters/file_path_converter.h"
#include "atom/common/node_includes.h" #include "atom/common/node_includes.h"
#include "atom/common/options_switches.h"
#include "base/command_line.h" #include "base/command_line.h"
#include "base/environment.h" #include "base/environment.h"
#include "base/files/file_path.h" #include "base/files/file_path.h"
@ -27,6 +28,7 @@
#include "brightray/browser/brightray_paths.h" #include "brightray/browser/brightray_paths.h"
#include "content/public/browser/client_certificate_delegate.h" #include "content/public/browser/client_certificate_delegate.h"
#include "content/public/browser/gpu_data_manager.h" #include "content/public/browser/gpu_data_manager.h"
#include "content/public/common/content_switches.h"
#include "native_mate/dictionary.h" #include "native_mate/dictionary.h"
#include "native_mate/object_template_builder.h" #include "native_mate/object_template_builder.h"
#include "net/ssl/ssl_cert_request_info.h" #include "net/ssl/ssl_cert_request_info.h"
@ -301,6 +303,16 @@ namespace {
void AppendSwitch(const std::string& switch_string, mate::Arguments* args) { void AppendSwitch(const std::string& switch_string, mate::Arguments* args) {
auto command_line = base::CommandLine::ForCurrentProcess(); auto command_line = base::CommandLine::ForCurrentProcess();
if (switch_string == atom::switches::kPpapiFlashPath ||
switch_string == atom::switches::kClientCertificate ||
switch_string == switches::kLogNetLog) {
base::FilePath path;
args->GetNext(&path);
command_line->AppendSwitchPath(switch_string, path);
return;
}
std::string value; std::string value;
if (args->GetNext(&value)) if (args->GetNext(&value))
command_line->AppendSwitchASCII(switch_string, value); command_line->AppendSwitchASCII(switch_string, value);

View file

@ -31,6 +31,7 @@
#include "chrome/browser/printing/print_view_manager_basic.h" #include "chrome/browser/printing/print_view_manager_basic.h"
#include "chrome/browser/printing/print_preview_message_handler.h" #include "chrome/browser/printing/print_preview_message_handler.h"
#include "content/common/view_messages.h" #include "content/common/view_messages.h"
#include "content/public/browser/browser_plugin_guest_manager.h"
#include "content/public/browser/favicon_status.h" #include "content/public/browser/favicon_status.h"
#include "content/public/browser/native_web_keyboard_event.h" #include "content/public/browser/native_web_keyboard_event.h"
#include "content/public/browser/navigation_details.h" #include "content/public/browser/navigation_details.h"
@ -67,6 +68,15 @@ void SetUserAgentInIO(scoped_refptr<net::URLRequestContextGetter> getter,
new net::StaticHttpUserAgentSettings("en-us,en", user_agent)); new net::StaticHttpUserAgentSettings("en-us,en", user_agent));
} }
bool NotifyZoomLevelChanged(
double level, content::WebContents* guest_web_contents) {
guest_web_contents->SendToAllFrames(
new AtomViewMsg_SetZoomLevel(MSG_ROUTING_NONE, level));
// Return false to iterate over all guests.
return false;
}
} // namespace } // namespace
namespace mate { namespace mate {
@ -133,7 +143,6 @@ struct Converter<net::HttpResponseHeaders*> {
std::string value; std::string value;
while (headers->EnumerateHeaderLines(&iter, &key, &value)) { while (headers->EnumerateHeaderLines(&iter, &key, &value)) {
key = base::StringToLowerASCII(key); key = base::StringToLowerASCII(key);
value = base::StringToLowerASCII(value);
if (response_headers.HasKey(key)) { if (response_headers.HasKey(key)) {
base::ListValue* values = nullptr; base::ListValue* values = nullptr;
if (response_headers.GetList(key, &values)) if (response_headers.GetList(key, &values))
@ -528,6 +537,7 @@ bool WebContents::OnMessageReceived(const IPC::Message& message) {
IPC_MESSAGE_HANDLER(AtomViewHostMsg_Message, OnRendererMessage) IPC_MESSAGE_HANDLER(AtomViewHostMsg_Message, OnRendererMessage)
IPC_MESSAGE_HANDLER_DELAY_REPLY(AtomViewHostMsg_Message_Sync, IPC_MESSAGE_HANDLER_DELAY_REPLY(AtomViewHostMsg_Message_Sync,
OnRendererMessageSync) OnRendererMessageSync)
IPC_MESSAGE_HANDLER(AtomViewHostMsg_ZoomLevelChanged, OnZoomLevelChanged)
IPC_MESSAGE_UNHANDLED(handled = false) IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP() IPC_END_MESSAGE_MAP()
@ -1033,6 +1043,15 @@ void WebContents::OnRendererMessageSync(const base::string16& channel,
EmitWithSender(base::UTF16ToUTF8(channel), web_contents(), message, args); EmitWithSender(base::UTF16ToUTF8(channel), web_contents(), message, args);
} }
void WebContents::OnZoomLevelChanged(double level) {
auto manager = web_contents()->GetBrowserContext()->GetGuestManager();
if (!manager)
return;
manager->ForEachGuest(web_contents(),
base::Bind(&NotifyZoomLevelChanged,
level));
}
// static // static
mate::Handle<WebContents> WebContents::CreateFrom( mate::Handle<WebContents> WebContents::CreateFrom(
v8::Isolate* isolate, content::WebContents* web_contents) { v8::Isolate* isolate, content::WebContents* web_contents) {

View file

@ -247,6 +247,10 @@ class WebContents : public mate::TrackableObject<WebContents>,
const base::ListValue& args, const base::ListValue& args,
IPC::Message* message); IPC::Message* message);
// Called when guests need to be notified of
// embedders' zoom level change.
void OnZoomLevelChanged(double level);
v8::Global<v8::Value> session_; v8::Global<v8::Value> session_;
v8::Global<v8::Value> devtools_web_contents_; v8::Global<v8::Value> devtools_web_contents_;

View file

@ -18,6 +18,9 @@ for (var i = 0; i < argv.length; i++) {
if (argv[i] == '--version' || argv[i] == '-v') { if (argv[i] == '--version' || argv[i] == '-v') {
option.version = true; option.version = true;
break; break;
} else if (argv[i].match(/^--app=/)) {
option.file = argv[i].split('=')[1];
break;
} else if (argv[i] == '--help' || argv[i] == '-h') { } else if (argv[i] == '--help' || argv[i] == '-h') {
option.help = true; option.help = true;
break; break;

View file

@ -67,7 +67,7 @@ ipc.on 'ATOM_SHELL_GUEST_WINDOW_MANAGER_WINDOW_METHOD', (event, guestId, method,
ipc.on 'ATOM_SHELL_GUEST_WINDOW_MANAGER_WINDOW_POSTMESSAGE', (event, guestId, message, targetOrigin) -> ipc.on 'ATOM_SHELL_GUEST_WINDOW_MANAGER_WINDOW_POSTMESSAGE', (event, guestId, message, targetOrigin) ->
guestContents = BrowserWindow.fromId(guestId)?.webContents guestContents = BrowserWindow.fromId(guestId)?.webContents
if guestContents?.getUrl().indexOf(targetOrigin) is 0 or targetOrigin is '*' if guestContents?.getUrl().indexOf(targetOrigin) is 0 or targetOrigin is '*'
guestContents.send 'ATOM_SHELL_GUEST_WINDOW_POSTMESSAGE', message, targetOrigin guestContents.send 'ATOM_SHELL_GUEST_WINDOW_POSTMESSAGE', guestId, message, targetOrigin
ipc.on 'ATOM_SHELL_GUEST_WINDOW_MANAGER_WINDOW_OPENER_POSTMESSAGE', (event, guestId, message, targetOrigin, sourceOrigin) -> ipc.on 'ATOM_SHELL_GUEST_WINDOW_MANAGER_WINDOW_OPENER_POSTMESSAGE', (event, guestId, message, targetOrigin, sourceOrigin) ->
embedder = v8Util.getHiddenValue event.sender, 'embedder' embedder = v8Util.getHiddenValue event.sender, 'embedder'

View file

@ -30,6 +30,12 @@ IPC_SYNC_MESSAGE_ROUTED2_1(AtomViewHostMsg_Message_Sync,
base::ListValue /* arguments */, base::ListValue /* arguments */,
base::string16 /* result (in JSON) */) base::string16 /* result (in JSON) */)
IPC_MESSAGE_ROUTED1(AtomViewHostMsg_ZoomLevelChanged,
double /* level */)
IPC_MESSAGE_ROUTED1(AtomViewMsg_SetZoomLevel,
double /* level */)
IPC_MESSAGE_ROUTED2(AtomViewMsg_Message, IPC_MESSAGE_ROUTED2(AtomViewMsg_Message,
base::string16 /* channel */, base::string16 /* channel */,
base::ListValue /* arguments */) base::ListValue /* arguments */)

View file

@ -4,11 +4,13 @@
#include "atom/renderer/api/atom_api_web_frame.h" #include "atom/renderer/api/atom_api_web_frame.h"
#include "atom/common/api/api_messages.h"
#include "atom/common/native_mate_converters/callback.h" #include "atom/common/native_mate_converters/callback.h"
#include "atom/common/native_mate_converters/gfx_converter.h" #include "atom/common/native_mate_converters/gfx_converter.h"
#include "atom/common/native_mate_converters/string16_converter.h" #include "atom/common/native_mate_converters/string16_converter.h"
#include "atom/renderer/api/atom_api_spell_check_client.h" #include "atom/renderer/api/atom_api_spell_check_client.h"
#include "content/public/renderer/render_frame.h" #include "content/public/renderer/render_frame.h"
#include "content/public/renderer/render_view.h"
#include "native_mate/dictionary.h" #include "native_mate/dictionary.h"
#include "native_mate/object_template_builder.h" #include "native_mate/object_template_builder.h"
#include "third_party/WebKit/public/web/WebDocument.h" #include "third_party/WebKit/public/web/WebDocument.h"
@ -34,6 +36,10 @@ void WebFrame::SetName(const std::string& name) {
} }
double WebFrame::SetZoomLevel(double level) { double WebFrame::SetZoomLevel(double level) {
auto render_view = content::RenderView::FromWebView(web_frame_->view());
// Notify guests if any for zoom level change.
render_view->Send(
new AtomViewHostMsg_ZoomLevelChanged(MSG_ROUTING_NONE, level));
return web_frame_->view()->setZoomLevel(level); return web_frame_->view()->setZoomLevel(level);
} }

View file

@ -6,6 +6,7 @@
#include <string> #include <string>
#include "atom/common/api/api_messages.h"
#include "atom/common/api/atom_bindings.h" #include "atom/common/api/atom_bindings.h"
#include "atom/common/node_bindings.h" #include "atom/common/node_bindings.h"
#include "atom/common/node_includes.h" #include "atom/common/node_includes.h"
@ -21,11 +22,13 @@
#include "content/public/renderer/render_frame.h" #include "content/public/renderer/render_frame.h"
#include "content/public/renderer/render_frame_observer.h" #include "content/public/renderer/render_frame_observer.h"
#include "content/public/renderer/render_thread.h" #include "content/public/renderer/render_thread.h"
#include "ipc/ipc_message_macros.h"
#include "third_party/WebKit/public/web/WebCustomElement.h" #include "third_party/WebKit/public/web/WebCustomElement.h"
#include "third_party/WebKit/public/web/WebLocalFrame.h" #include "third_party/WebKit/public/web/WebLocalFrame.h"
#include "third_party/WebKit/public/web/WebPluginParams.h" #include "third_party/WebKit/public/web/WebPluginParams.h"
#include "third_party/WebKit/public/web/WebKit.h" #include "third_party/WebKit/public/web/WebKit.h"
#include "third_party/WebKit/public/web/WebRuntimeFeatures.h" #include "third_party/WebKit/public/web/WebRuntimeFeatures.h"
#include "third_party/WebKit/public/web/WebView.h"
#if defined(OS_WIN) #if defined(OS_WIN)
#include <shlobj.h> #include <shlobj.h>
@ -64,6 +67,22 @@ class AtomRenderFrameObserver : public content::RenderFrameObserver {
render_frame()->GetWebFrame(), context); render_frame()->GetWebFrame(), context);
} }
bool OnMessageReceived(const IPC::Message& message) {
bool handled = true;
IPC_BEGIN_MESSAGE_MAP(AtomRenderFrameObserver, message)
IPC_MESSAGE_HANDLER(AtomViewMsg_SetZoomLevel, OnSetZoomLevel)
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP()
return handled;
}
void OnSetZoomLevel(double level) {
auto view = render_frame()->GetWebFrame()->view();
if (view)
view->setZoomLevel(level);
}
private: private:
AtomRendererClient* renderer_client_; AtomRendererClient* renderer_client_;

View file

@ -10,15 +10,15 @@
## Tutoriales ## Tutoriales
* [Introducción](../../docs/tutorial/quick-start.md) * [Introducción](tutorial/quick-start.md)
* [Integración con el entorno de escritorio](../../docs/tutorial/desktop-environment-integration.md) * [Integración con el entorno de escritorio](tutorial/desktop-environment-integration.md)
* [Detección del evento en línea/fuera de línea](../../docs/tutorial/online-offline-events.md) * [Detección del evento en línea/fuera de línea](tutorial/online-offline-events.md)
## API ## API
* [Sinopsis](../../docs/api/synopsis.md) * [Sinopsis](api/synopsis.md)
* [Proceso](../../docs/api/process.md) * [Proceso](api/process.md)
* [Parámetros CLI soportados (Chrome)](../../docs/api/chrome-command-line-switches.md) * [Parámetros CLI soportados (Chrome)](api/chrome-command-line-switches.md)
Elementos DOM customizados: Elementos DOM customizados:

View file

@ -0,0 +1,119 @@
# Parámetros CLI soportados (Chrome)
Esta página lista las líneas de comandos usadas por el navegador Chrome que también son
soportadas por Electron. Puedes usar [app.commandLine.appendSwitch][append-switch] para
anexarlas en el script principal de tu aplicación antes de que el evento [ready][ready] del
modulo [app][app] sea emitido:
```javascript
var app = require('app');
app.commandLine.appendSwitch('remote-debugging-port', '8315');
app.commandLine.appendSwitch('host-rules', 'MAP * 127.0.0.1');
app.on('ready', function() {
// Your code here
});
```
## --client-certificate=`path`
Establece el `path` del archivo de certificado del cliente.
## --ignore-connections-limit=`domains`
Ignora el límite de conexiones para la lista de `domains` separados por `,`.
## --disable-http-cache
Deshabilita la cacheé del disco para las peticiones HTTP.
## --remote-debugging-port=`port`
Habilita la depuración remota a través de HTTP en el puerto especificado.
## --proxy-server=`address:port`
Usa un servidor proxy especificado, que sobreescribe la configuración del sistema.
Este cambio solo afecta peticiones HTTP y HTTPS.
## --proxy-pac-url=`url`
Utiliza el script PAC en la `url` especificada.
## --no-proxy-server
No usa un servidor proxy y siempre establece conexiones directas. Anula cualquier
otra bandera de servidor proxy bandera que se pase.
## --host-rules=`rules`
Una lista separada por comas de `rules` (reglas) que controlan cómo se asignan los
nombres de host.
Por ejemplo:
* `MAP * 127.0.0.1` Obliga a todos los nombres de host a ser asignados a 127.0.0.1
* `MAP *.google.com proxy` Obliga todos los subdominios google.com a resolverse con
"proxy".
* `MAP test.com [::1]:77` Obliga a resolver "test.com" con un bucle invertido de IPv6.
También obligará a que el puerto de la dirección respuesta sea 77.
* `MAP * baz, EXCLUDE www.google.com` Reasigna todo a "baz", excepto a "www.google.com".
Estas asignaciones especifican el host final en una petición de red (Anfitrión de la conexión TCP
y de resolución de conexión directa, y el `CONNECT` en una conexión proxy HTTP, y el host final de
la conexión proxy `SOCKS`).
## --host-resolver-rules=`rules`
Como `--host-rules` pero estas `rules` solo se aplican al solucionador.
[app]: app.md
[append-switch]: app.md#appcommandlineappendswitchswitch-value
[ready]: app.md#event-ready
## --ignore-certificate-errors
Ignora errores de certificado relacionados.
## --ppapi-flash-path=`path`
Asigna la ruta `path` del pepper flash plugin.
## --ppapi-flash-version=`version`
Asigna la versión `version` del pepper flash plugin.
## --log-net-log=`path`
Permite guardar y escribir eventos de registros de red en `path`.
## --ssl-version-fallback-min=`version`
Establece la versión mínima de SSL/TLS ("tls1", "tls1.1" o "tls1.2") que
el repliegue de TLC aceptará.
## --enable-logging
Imprime el registro de Chromium en consola.
Este cambio no puede ser usado en `app.commandLine.appendSwitch` ya que se analiza antes de que la
aplicación del usuario este cargada.
## --v=`log_level`
Da el maximo nivel activo de V-logging por defecto; 0 es el predeterminado. Valores positivos
son normalmente usados para los niveles de V-logging.
Este modificador sólo funciona cuando también se pasa `--enable-logging`.
## --vmodule=`pattern`
Da los niveles máximos de V-logging por módulo para sobreescribir el valor dado por
`--v`. Ej. `my_module=2,foo*=3` cambiaria el nivel de registro para todo el código
el archivos de origen `my_module.*` y `foo*.*`.
Cualquier patron que contiene un slash o un slash invertido será probado contra toda la ruta
y no sólo con el módulo. Ej. `*/foo/bar/*=2` cambiaría el nivel de registro para todo el código
en los archivos origen bajo un directorio `foo/bar`.
Este modificador sólo funciona cuando también se pasa `--enable-logging`.

View file

@ -0,0 +1,47 @@
# process
El objeto `process` en Electron tiene las siguientes diferencias con respecto
al node convencional:
* `process.type` String - El tipo del proceso puede ser `browser` (ej. proceso
principal) o `renderer`.
* `process.versions['electron']` String - Versión de Electron.
* `process.versions['chrome']` String - Versión de Chromium.
* `process.resourcesPath` String - Ruta al código fuente JavaScript.
## Events
### Event: 'loaded'
Se emite cuando Electron ha cargado su script de inicialización interna y
está comenzando a cargar la página web o el script principal.
Puede ser usado por el script precargado para añadir de nuevo los símbolos globales
de Node eliminados, al alcance global cuando la integración de Node está apagada:
```js
// preload.js
var _setImmediate = setImmediate;
var _clearImmediate = clearImmediate;
process.once('loaded', function() {
global.setImmediate = _setImmediate;
global.clearImmediate = _clearImmediate;
});
```
## Methods
El objeto `process` tiene los siguientes métodos:
### `process.hang`
Interrumpe el hilo principal del proceso actual.
### process.setFdLimit(maxDescriptors) _OS X_ _Linux_
* `maxDescriptors` Integer
Establece el límite dinámico del descriptor del archivo en `maxDescriptors`
o en el límite estricto del Sistema Operativo, el que sea menor para el
proceso actual.

View file

@ -0,0 +1,47 @@
# Synopsis
Todos los [Módulos integrados de Node.js](http://nodejs.org/api/) se encuentran
disponibles en Electron y módulos de terceros son támbien totalmente compatibles
(incluyendo los [módulos nativos](../tutorial/using-native-node-modules.md)).
Electron también provee algunos módulos integrados adicionales para desarrollar
aplicaciones nativas de escritorio. Algunos módulos sólo se encuentran disponibles
en el proceso principal, algunos sólo en el proceso renderer (pagina web), y
algunos pueden ser usados en ambos procesos.
La regla básica es: Si un módulo es
[GUI](https://es.wikipedia.org/wiki/Interfaz_gráfica_de_usuario) o de bajo nivel,
entonces solo estará disponible en el proceso principal. Necesitas familiarizarte
con el concepto de [scripts para proceso principal vs scripts para proceso renderer]
(../tutorial/quick-start.md#the-main-process) para ser capaz de usar esos módulos.
El script del proceso principal es como un script normal de Node.js:
```javascript
var app = require('app');
var BrowserWindow = require('browser-window');
var window = null;
app.on('ready', function() {
window = new BrowserWindow({width: 800, height: 600});
window.loadUrl('https://github.com');
});
```
El proceso renderer no es diferente de una página web normal, excepto por la
capacidad extra de utilizar módulos de node:
```html
<!DOCTYPE html>
<html>
<body>
<script>
var remote = require('remote');
console.log(remote.require('app').getVersion());
</script>
</body>
</html>
```
Para ejecutar tu aplicación, lee [Ejecutar la aplicación](../tutorial/quick-start.md#run-your-app).

View file

@ -2,9 +2,9 @@
**이 모듈은 현재 OS X에서만 사용할 수 있습니다.** **이 모듈은 현재 OS X에서만 사용할 수 있습니다.**
Windows 어플리케이션 인스톨러를 생성하려면 [atom/grunt-electron-installer](https://github.com/atom/grunt-electron-installer)를 참고하세요. Windows 인스톨러를 생성하려면 [atom/grunt-electron-installer](https://github.com/atom/grunt-electron-installer)를 참고하세요.
`auto-updater` 모듈은 [Squirrel.Mac](https://github.com/Squirrel/Squirrel.Mac) 프레임워크의 간단한 Wrapper입니다. `auto-updater` 모듈은 [Squirrel.Mac](https://github.com/Squirrel/Squirrel.Mac) 프레임워크의 간단한 wrapper 입니다.
Squirrel.Mac은 업데이트 설치를 위해 `.app` 폴더에 Squirrel.Mac은 업데이트 설치를 위해 `.app` 폴더에
[codesign](https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/codesign.1.html) [codesign](https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/codesign.1.html)
@ -14,23 +14,23 @@ Squirrel.Mac은 업데이트 설치를 위해 `.app` 폴더에
Squirrel은 어플리케이션이 **안전하고 투명한 업데이트**를 제공할 수 있도록 하는데 초점이 맞춰진 OS X 프레임워크입니다. Squirrel은 어플리케이션이 **안전하고 투명한 업데이트**를 제공할 수 있도록 하는데 초점이 맞춰진 OS X 프레임워크입니다.
Squirrel은 사용자에게 어플리케이션의 업데이트를 알릴 필요 없이 서버가 지시하는 버전을 받아온 후 자동으로 업데이트합니다. Squirrel은 사용자에게 어플리케이션의 업데이트를 알릴 필요 없이 자동으로 서버가 지시하는 버전을 받아 어플리케이션을 업데이트합니다.
이 기능을 사용하면 Squirrel을 통해 클라이언트의 어플리케이션을 지능적으로 업데이트 할 수 있습니다. 지능적으로 클라이언트 어플리케이션을 업데이트 할 수 있습니다.
또한 요청시 커스텀 헤더 또는 요청 본문에 인증 정보를 포함시킬 수 있습니다. 업데이트 요청은 커스텀 헤더 또는 요청 본문에 인증 정보를 포함시킬 수 있습니다.
서버에선 이러한 요청을 분류 처리하여 적당한 업데이트를 제공할 수 있습니다. 이에 따라 서버에선 이러한 요청을 분석 처리하여 사용자에게 적당한 업데이트를 제공할 수 있습니다.
Squirrel JSON 업데이트 요청시 처리는 반드시 어떤 업데이트가 필요한지 요청의 기준에 맞춰 동적으로 생성되어야 합니다. Squirrel JSON 업데이트 요청시 처리는 반드시 어떤 업데이트가 필요한지 요청의 기준에 맞춰 동적으로 생성되어야 합니다.
Squirrel은 사용해야 하는 업데이트 선택하는 과정을 서버에 의존합니다. [서버 지원](#server-support)을 참고하세요. Squirrel은 사용해야 하는 업데이트 선택하는 과정을 서버에 의존합니다. [서버 지원](#서버-지원)을 참고하세요.
Squirrel의 인스톨러는 오류에 관대하게 설계되었습니다. 그리고 업데이트가 유효한지 확인합니다. Squirrel의 인스톨러는 오류에 관대하게 설계되었습니다. 그리고 업데이트가 유효한지 확인합니다.
## 업데이트 요청 ## 업데이트 요청
Squirrel은 업데이트 확인을 위해 클라이언트 어플리케이션의 요청은 무시합니다. Squirrel은 클라이언트 어플리케이션이 업데이트 확인을 위해 제공하는 요청을 무시합니다.
Squirrel은 응답을 분석해야 할 책임이 있기 때문에 `Accept: application/json`이 요청 헤더에 추가됩니다. Squirrel이 응답을 분석할 수 있어야하기 때문에 요청 헤더에 `Accept: application/json` 헤더가 추가됩니다.
업데이트 응답과 본문 포맷에 대한 요구 사항은 [Server Support](#server-support)를 참고하세요. 업데이트 응답과 본문 포맷에 대한 요구 사항은 [서버 지원](#서버-지원)를 참고하세요.
업데이트 요청에는 서버가 해당 어플리케이션이 어떤 버전을 사용해야 하는지 판단하기 위해 *반드시* 버전 식별자를 포함시켜야 합니다. 업데이트 요청에는 서버가 해당 어플리케이션이 어떤 버전을 사용해야 하는지 판단하기 위해 *반드시* 버전 식별자를 포함시켜야 합니다.
추가로 OS 버전, 사용자 이름 같은 다른 식별 기준을 포함하여 서버에서 적합한 어플리케이션을 제공할 수 있도록 할 수 있습니다. 추가로 OS 버전, 사용자 이름 같은 다른 식별 기준을 포함하여 서버에서 적합한 어플리케이션을 제공할 수 있도록 할 수 있습니다.
@ -46,7 +46,7 @@ autoUpdater.setFeedUrl('http://mycompany.com/myapp/latest?version=' + app.getVer
## 서버 지원 ## 서버 지원
업데이트를 제공하는 서버는 반드시 클라이언트로부터 받은 [Update Request](#update-requests)를 기반으로 업데이트를 처리할 수 있어야 합니다. 업데이트를 제공하는 서버는 반드시 클라이언트로부터 받은 [업데이트 요청](#업데이트-요청)을 기반으로 업데이트를 처리할 수 있어야 합니다.
만약 업데이트 요청이 들어오면 서버는 반드시 [200 OK](http://tools.ietf.org/html/rfc2616#section-10.2.1) 상태 코드를 포함한 만약 업데이트 요청이 들어오면 서버는 반드시 [200 OK](http://tools.ietf.org/html/rfc2616#section-10.2.1) 상태 코드를 포함한
[업데이트 JSON](#update-json-format)을 본문으로 보내야 합니다. [업데이트 JSON](#update-json-format)을 본문으로 보내야 합니다.

View file

@ -16,7 +16,7 @@ app.on('ready', function() {
// Register a 'ctrl+x' shortcut listener. // Register a 'ctrl+x' shortcut listener.
var ret = globalShortcut.register('ctrl+x', function() { var ret = globalShortcut.register('ctrl+x', function() {
console.log('ctrl+x is pressed'); console.log('ctrl+x is pressed');
}) });
if (!ret) { if (!ret) {
console.log('registration failed'); console.log('registration failed');
@ -62,4 +62,4 @@ Unregisters the global shortcut of `accelerator`.
### `globalShortcut.unregisterAll()` ### `globalShortcut.unregisterAll()`
Unregisters all the global shortcuts. Unregisters all of the global shortcuts.

View file

@ -140,7 +140,7 @@ which sends a file as a response.
Intercepts `scheme` protocol and uses `handler` as the protocol's new handler Intercepts `scheme` protocol and uses `handler` as the protocol's new handler
which sends a `String` as a response. which sends a `String` as a response.
## `protocol.interceptBufferProtocol(scheme, handler[, completion])` ### `protocol.interceptBufferProtocol(scheme, handler[, completion])`
* `scheme` String * `scheme` String
* `handler` Function * `handler` Function
@ -149,7 +149,7 @@ which sends a `String` as a response.
Intercepts `scheme` protocol and uses `handler` as the protocol's new handler Intercepts `scheme` protocol and uses `handler` as the protocol's new handler
which sends a `Buffer` as a response. which sends a `Buffer` as a response.
## `protocol.interceptHttpProtocol(scheme, handler[, completion])` ### `protocol.interceptHttpProtocol(scheme, handler[, completion])`
* `scheme` String * `scheme` String
* `handler` Function * `handler` Function
@ -158,7 +158,7 @@ which sends a `Buffer` as a response.
Intercepts `scheme` protocol and uses `handler` as the protocol's new handler Intercepts `scheme` protocol and uses `handler` as the protocol's new handler
which sends a new HTTP request as a response. which sends a new HTTP request as a response.
## `protocol.uninterceptProtocol(scheme[, completion])` ### `protocol.uninterceptProtocol(scheme[, completion])`
* `scheme` String * `scheme` String
* `completion` Function * `completion` Function

View file

@ -4,7 +4,9 @@
"asar": "^0.8.0", "asar": "^0.8.0",
"coffee-script": "^1.9.2", "coffee-script": "^1.9.2",
"coffeelint": "^1.9.4", "coffeelint": "^1.9.4",
"request": "*", "request": "*"
},
"optionalDependencies": {
"runas": "^3.0.0" "runas": "^3.0.0"
}, },
"private": true, "private": true,

View file

@ -5,14 +5,16 @@
"version": "0.1.0", "version": "0.1.0",
"devDependencies": { "devDependencies": {
"basic-auth": "^1.0.0", "basic-auth": "^1.0.0",
"ffi": "2.0.0",
"formidable": "1.0.16", "formidable": "1.0.16",
"graceful-fs": "3.0.5", "graceful-fs": "3.0.5",
"mocha": "2.1.0", "mocha": "2.1.0",
"q": "0.9.7", "q": "0.9.7",
"runas": "3.x",
"temp": "0.8.1", "temp": "0.8.1",
"walkdir": "0.0.7", "walkdir": "0.0.7",
"ws": "0.7.2" "ws": "0.7.2"
},
"optionalDependencies": {
"ffi": "2.0.0",
"runas": "3.x"
} }
} }

View file

@ -9,6 +9,9 @@
'sysroot%': '', 'sysroot%': '',
'variables': { 'variables': {
# The minimum OS X SDK version to use.
'mac_sdk_min%': '10.10',
# Set ARM architecture version. # Set ARM architecture version.
'arm_version%': 7, 'arm_version%': 7,
@ -17,6 +20,7 @@
}, },
# Copy conditionally-set variables out one scope. # Copy conditionally-set variables out one scope.
'mac_sdk_min%': '<(mac_sdk_min)',
'arm_version%': '<(arm_version)', 'arm_version%': '<(arm_version)',
'arm_neon%': '<(arm_neon)', 'arm_neon%': '<(arm_neon)',
@ -35,6 +39,11 @@
'source_root': '<!(cd <(DEPTH) && pwd -P)', 'source_root': '<!(cd <(DEPTH) && pwd -P)',
}], # OS!="win" }], # OS!="win"
# Search for the available version of SDK.
['OS=="mac"', {
'mac_sdk%': '<!(python <(DEPTH)/tools/mac/find_sdk.py <(mac_sdk_min))',
}],
# Set default compiler flags depending on ARM version. # Set default compiler flags depending on ARM version.
['arm_version==6', { ['arm_version==6', {
'arm_arch%': 'armv6', 'arm_arch%': 'armv6',
@ -94,6 +103,15 @@
}, },
}], # clang==1 }], # clang==1
# Specify the SDKROOT.
['OS=="mac"', {
'target_defaults': {
'xcode_settings': {
'SDKROOT': 'macosx<(mac_sdk)', # -isysroot
},
},
}],
# Setup sysroot environment. # Setup sysroot environment.
['OS=="linux" and target_arch in ["arm", "ia32"]', { ['OS=="linux" and target_arch in ["arm", "ia32"]', {
'variables': { 'variables': {

93
tools/mac/find_sdk.py Executable file
View file

@ -0,0 +1,93 @@
#!/usr/bin/env python
# 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.
"""Prints the lowest locally available SDK version greater than or equal to a
given minimum sdk version to standard output.
Usage:
python find_sdk.py 10.6 # Ignores SDKs < 10.6
"""
import os
import re
import subprocess
import sys
from optparse import OptionParser
def parse_version(version_str):
"""'10.6' => [10, 6]"""
return map(int, re.findall(r'(\d+)', version_str))
def main():
parser = OptionParser()
parser.add_option("--verify",
action="store_true", dest="verify", default=False,
help="return the sdk argument and warn if it doesn't exist")
parser.add_option("--sdk_path",
action="store", type="string", dest="sdk_path", default="",
help="user-specified SDK path; bypasses verification")
parser.add_option("--print_sdk_path",
action="store_true", dest="print_sdk_path", default=False,
help="Additionaly print the path the SDK (appears first).")
options, args = parser.parse_args()
if len(args) != 1:
parser.error('Please specify a minimum SDK version')
min_sdk_version = args[0]
job = subprocess.Popen(['xcode-select', '-print-path'],
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT)
out, err = job.communicate()
if job.returncode != 0:
print >> sys.stderr, out
print >> sys.stderr, err
raise Exception(('Error %d running xcode-select, you might have to run '
'|sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer| '
'if you are using Xcode 4.') % job.returncode)
# The Developer folder moved in Xcode 4.3.
xcode43_sdk_path = os.path.join(
out.rstrip(), 'Platforms/MacOSX.platform/Developer/SDKs')
if os.path.isdir(xcode43_sdk_path):
sdk_dir = xcode43_sdk_path
else:
sdk_dir = os.path.join(out.rstrip(), 'SDKs')
sdks = [re.findall('^MacOSX(10\.\d+)\.sdk$', s) for s in os.listdir(sdk_dir)]
sdks = [s[0] for s in sdks if s] # [['10.5'], ['10.6']] => ['10.5', '10.6']
sdks = [s for s in sdks # ['10.5', '10.6'] => ['10.6']
if parse_version(s) >= parse_version(min_sdk_version)]
if not sdks:
raise Exception('No %s+ SDK found' % min_sdk_version)
best_sdk = sorted(sdks, key=parse_version)[0]
if options.verify and best_sdk != min_sdk_version and not options.sdk_path:
print >> sys.stderr, ''
print >> sys.stderr, ' vvvvvvv'
print >> sys.stderr, ''
print >> sys.stderr, \
'This build requires the %s SDK, but it was not found on your system.' \
% min_sdk_version
print >> sys.stderr, \
'Either install it, or explicitly set mac_sdk in your GYP_DEFINES.'
print >> sys.stderr, ''
print >> sys.stderr, ' ^^^^^^^'
print >> sys.stderr, ''
return min_sdk_version
if options.print_sdk_path:
print subprocess.check_output(['xcodebuild', '-version', '-sdk',
'macosx' + best_sdk, 'Path']).strip()
return best_sdk
if __name__ == '__main__':
if sys.platform != 'darwin':
raise Exception("This script only runs on Mac")
print main()
sys.exit(0)

2
vendor/brightray vendored

@ -1 +1 @@
Subproject commit c25b9b27845a308e6a6a5966dad057d721b1f3d1 Subproject commit aec3ce10baaf21254f9d84b33111663fe7d609a6

2
vendor/crashpad vendored

@ -1 +1 @@
Subproject commit e6a0d433b0ee399eecce2bef671794771052ffdb Subproject commit 5b777419c303d8aa7930239d8ef755475f1ede57