Merge remote-tracking branch 'refs/remotes/atom/master'

This commit is contained in:
Plusb Preco 2015-11-16 23:55:46 +09:00
commit 62e6332366
15 changed files with 125 additions and 30 deletions

View file

@ -4,7 +4,7 @@
'product_name%': 'Electron',
'company_name%': 'GitHub, Inc',
'company_abbr%': 'github',
'version%': '0.34.3',
'version%': '0.35.0',
},
'includes': [
'filenames.gypi',

View file

@ -658,10 +658,6 @@ void WebContents::Stop() {
web_contents()->Stop();
}
void WebContents::ReloadIgnoringCache() {
web_contents()->GetController().ReloadIgnoringCache(false);
}
void WebContents::GoBack() {
atom::AtomBrowserClient::SuppressRendererProcessRestartForOnce();
web_contents()->GetController().GoBack();
@ -1009,7 +1005,6 @@ mate::ObjectTemplateBuilder WebContents::GetObjectTemplateBuilder(
.SetMethod("isLoading", &WebContents::IsLoading)
.SetMethod("isWaitingForResponse", &WebContents::IsWaitingForResponse)
.SetMethod("_stop", &WebContents::Stop)
.SetMethod("_reloadIgnoringCache", &WebContents::ReloadIgnoringCache)
.SetMethod("_goBack", &WebContents::GoBack)
.SetMethod("_goForward", &WebContents::GoForward)
.SetMethod("_goToOffset", &WebContents::GoToOffset)

View file

@ -38,6 +38,9 @@ void FrameSubscriber::OnFrameDelivered(
if (!result)
return;
v8::Locker locker(isolate_);
v8::HandleScope handle_scope(isolate_);
gfx::Rect rect = frame->visible_rect();
size_t rgb_arr_size = rect.width() * rect.height() * 4;
v8::MaybeLocal<v8::Object> buffer = node::Buffer::New(isolate_, rgb_arr_size);
@ -56,8 +59,6 @@ void FrameSubscriber::OnFrameDelivered(
rect.width() * 4,
media::YV12);
v8::Locker locker(isolate_);
v8::HandleScope handle_scope(isolate_);
callback_.Run(buffer.ToLocalChecked());
}

View file

@ -62,8 +62,8 @@ class NavigationController
@webContents._loadURL @getURL(), {}
reloadIgnoringCache: ->
@webContents._reloadIgnoringCache() # Rely on WebContents to clear cache.
@reload()
@pendingIndex = @currentIndex
@webContents._loadURL @getURL(), {extraHeaders: "pragma: no-cache\n"}
canGoBack: ->
@getActiveIndex() > 0

View file

@ -17,9 +17,9 @@
<key>CFBundleIconFile</key>
<string>atom.icns</string>
<key>CFBundleVersion</key>
<string>0.34.3</string>
<string>0.35.0</string>
<key>CFBundleShortVersionString</key>
<string>0.34.3</string>
<string>0.35.0</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.developer-tools</string>
<key>LSMinimumSystemVersion</key>

View file

@ -56,8 +56,8 @@ END
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 0,34,3,0
PRODUCTVERSION 0,34,3,0
FILEVERSION 0,35,0,0
PRODUCTVERSION 0,35,0,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@ -74,12 +74,12 @@ BEGIN
BEGIN
VALUE "CompanyName", "GitHub, Inc."
VALUE "FileDescription", "Electron"
VALUE "FileVersion", "0.34.3"
VALUE "FileVersion", "0.35.0"
VALUE "InternalName", "electron.exe"
VALUE "LegalCopyright", "Copyright (C) 2015 GitHub, Inc. All rights reserved."
VALUE "OriginalFilename", "electron.exe"
VALUE "ProductName", "Electron"
VALUE "ProductVersion", "0.34.3"
VALUE "ProductVersion", "0.35.0"
VALUE "SquirrelAwareVersion", "1"
END
END

View file

@ -6,8 +6,8 @@
#define ATOM_VERSION_H
#define ATOM_MAJOR_VERSION 0
#define ATOM_MINOR_VERSION 34
#define ATOM_PATCH_VERSION 3
#define ATOM_MINOR_VERSION 35
#define ATOM_PATCH_VERSION 0
#define ATOM_VERSION_IS_RELEASE 1

View file

@ -2,12 +2,13 @@
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#include <string>
#include "atom/common/keyboad_util.h"
namespace atom {
// Return key code of the char.
ui::KeyboardCode KeyboardCodeFromCharCode(char c, bool* shifted) {
ui::KeyboardCode KeyboardCodeFromCharCode(base::char16 c, bool* shifted) {
*shifted = false;
switch (c) {
case 0x08: return ui::VKEY_BACK;
@ -71,4 +72,28 @@ ui::KeyboardCode KeyboardCodeFromCharCode(char c, bool* shifted) {
}
}
// Return key code of the char.
ui::KeyboardCode KeyboardCodeFromKeyIdentifier(const std::string& chr) {
if (chr == "enter") return ui::VKEY_RETURN;
if (chr == "backspace") return ui::VKEY_BACK;
if (chr == "delete") return ui::VKEY_DELETE;
if (chr == "tab") return ui::VKEY_TAB;
if (chr == "escape") return ui::VKEY_ESCAPE;
if (chr == "control") return ui::VKEY_CONTROL;
if (chr == "alt") return ui::VKEY_MENU;
if (chr == "shift") return ui::VKEY_SHIFT;
if (chr == "end") return ui::VKEY_END;
if (chr == "home") return ui::VKEY_HOME;
if (chr == "insert") return ui::VKEY_INSERT;
if (chr == "left") return ui::VKEY_LEFT;
if (chr == "up") return ui::VKEY_UP;
if (chr == "right") return ui::VKEY_RIGHT;
if (chr == "down") return ui::VKEY_DOWN;
if (chr == "pageup") return ui::VKEY_PRIOR;
if (chr == "pagedown") return ui::VKEY_NEXT;
if (chr == "printscreen") return ui::VKEY_SNAPSHOT;
return ui::VKEY_UNKNOWN;
}
} // namespace atom

View file

@ -5,13 +5,18 @@
#ifndef ATOM_COMMON_KEYBOAD_UTIL_H_
#define ATOM_COMMON_KEYBOAD_UTIL_H_
#include <string>
#include "ui/events/keycodes/keyboard_codes.h"
#include "base/strings/string_util.h"
namespace atom {
// Return key code of the char, and also determine whether the SHIFT key is
// pressed.
ui::KeyboardCode KeyboardCodeFromCharCode(char c, bool* shifted);
ui::KeyboardCode KeyboardCodeFromCharCode(base::char16 c, bool* shifted);
// Return key code of the char from a string representation of the char
ui::KeyboardCode KeyboardCodeFromKeyIdentifier(const std::string& chr);
} // namespace atom

View file

@ -159,10 +159,17 @@ bool Converter<blink::WebKeyboardEvent>::FromV8(
if (!ConvertFromV8(isolate, val, static_cast<blink::WebInputEvent*>(out)))
return false;
base::char16 code;
if (!dict.Get("keyCode", &code))
return false;
std::string identifier;
bool shifted = false;
out->windowsKeyCode = atom::KeyboardCodeFromCharCode(code, &shifted);
if (dict.Get("keyCode", &code))
out->windowsKeyCode = atom::KeyboardCodeFromCharCode(code, &shifted);
else if (dict.Get("keyCode", &identifier))
out->windowsKeyCode = atom::KeyboardCodeFromKeyIdentifier(
base::StringToLowerASCII(identifier));
else
return false;
if (shifted)
out->modifiers |= blink::WebInputEvent::ShiftKey;
out->setKeyIdentifierFromWindowsKeyCode();

View file

@ -62,7 +62,7 @@
## 开发
* [编码规范](development/coding-style.md)
* [源码文件结构](development/source-code-directory-structure.md)
* [源码目录结构](development/source-code-directory-structure.md)
* [与 NW.js (原名 node-webkit) 在技术上的差异](development/atom-shell-vs-node-webkit.md)
* [构建系统概况](development/build-system-overview.md)
* [构建步骤 (Mac)](development/build-instructions-mac.md)

View file

@ -0,0 +1,53 @@
# 源码目录结构
Electron 的源代码主要依据 Chromium 的拆分约定被拆成了许多部分。
为了更好地理解源代码,您可能需要了解一下
[Chromium 的多进程架构](http://dev.chromium.org/developers/design-documents/multi-process-architecture)。
## 源代码的结构
```
Electron
├──atom - Electron 的源代码
| ├── app - 系统入口代码
| ├── browser - 包含了主窗口、UI 和其他所有与主进程有关的东西,它会告诉渲染进程如何管理页面
| |   ├── lib - 主进程初始化代码中 JavaScript 部分的代码
| | ├── ui - 不同平台上 UI 部分的实现
| | | ├── cocoa - Cocoa 部分的源代码
| | | ├── gtk - GTK+ 部分的源代码
| | | └── win - Windows GUI 部分的源代码
| | ├── default_app - 在没有指定 app 的情况下 Electron 启动时默认显示的页面
| | ├── api - 主进程 API 的实现
| | | └── lib - API 实现中 Javascript 部分的代码
| | ├── net - 网络相关的代码
| | ├── mac - 与 Mac 有关的 Objective-C 代码
| | └── resources - 图标,平台相关的文件等
| ├── renderer - 运行在渲染进程中的代码
| | ├── lib - 渲染进程初始化代码中 JavaScript 部分的代码
| | └── api - 渲染进程 API 的实现
| | └── lib - API 实现中 Javascript 部分的代码
| └── common - 同时被主进程和渲染进程用到的代码,包括了一些用来将 node 的事件循环
| | 整合到 Chromium 的事件循环中时用到的工具函数和代码
| ├── lib - 同时被主进程和渲染进程使用到的 Javascript 初始化代码
| └── api - 同时被主进程和渲染进程使用到的 API 的实现以及 Electron 内置模块的基础设施
| └── lib - API 实现中 Javascript 部分的代码
├── chromium_src - 从 Chromium 项目中拷贝来的代码
├── docs - 英语版本的文档
├── docs-translations - 各种语言版本的文档翻译
├── spec - 自动化测试
├── atom.gyp - Electron 的构建规则
└── common.gypi - 为诸如 `node``breakpad` 等其他组件准备的编译设置和构建规则
```
## 其他目录的结构
* **script** - 用于诸如构建、打包、测试等开发用途的脚本
* **tools** - 在 gyp 文件中用到的工具脚本,但与 `script` 目录不同,
该目录中的脚本不应该被用户直接调用
* **vendor** - 第三方依赖项的源代码,为了防止人们将它与 Chromium 源码中的同名目录相混淆,
在这里我们不使用 `third_party` 作为目录名
* **node_modules** - 在构建中用到的第三方 node 模块
* **out** - `ninja` 的临时输出目录
* **dist** - 由脚本 `script/create-dist.py` 创建的临时发布目录
* **external_binaries** - 下载的不支持通过 `gyp` 构建的预编译第三方框架

View file

@ -207,7 +207,13 @@ See [session documentation](session.md) for this object's methods.
* `extraHeaders` String - Extra headers separated by "\n"
Loads the `url` in the window, the `url` must contain the protocol prefix,
e.g. the `http://` or `file://`.
e.g. the `http://` or `file://`. If the load should bypass http cache then
use the `pragma` header to achieve it.
```javascript
const options = {"extraHeaders" : "pragma: no-cache\n"}
webContents.loadURL(url, options)
```
### `webContents.getURL()`
@ -584,7 +590,7 @@ Disable device emulation enabled by `webContents.enableDeviceEmulation`.
* `event` Object
* `type` String (**required**) - The type of the event, can be `mouseDown`,
`mouseUp`, `mouseEnter`, `mouseLeave`, `contextMenu`, `mouseWheel`,
`keyDown`, `keyUp`, `char`.
`mouseMove`, `keyDown`, `keyUp`, `char`.
* `modifiers` Array - An array of modifiers of the event, can
include `shift`, `control`, `alt`, `meta`, `isKeypad`, `isAutoRepeat`,
`leftButtonDown`, `middleButtonDown`, `rightButtonDown`, `capsLock`,
@ -594,8 +600,11 @@ Sends an input `event` to the page.
For keyboard events, the `event` object also have following properties:
* `keyCode` String (**required**) - A single character that will be sent as
keyboard event. Can be any UTF-8 character.
* `keyCode` Char or String (**required**) - The character that will be sent
as the keyboard event. Can be a single UTF-8 character, or the name of the
key that generates the event. Accepted key names are `enter`, `backspace`,
`delete`, `tab`, `escape`, `control`, `alt`, `shift`, `end`, `home`, `insert`,
`left`, `up`, `right`, `down`, `pageUp`, `pageDown`, `printScreen`
For mouse events, the `event` object also have following properties:

View file

@ -35,7 +35,7 @@ __3. Node Integration__
In NW.js, the Node integration in web pages requires patching Chromium to
work, while in Electron we chose a different way to integrate the libuv loop
with each platform's message loop to avoid hacking Chromium. See the
[`node_bindings`](../../atom/common/) code for how that was done.
[`node_bindings`](../../../atom/common/) code for how that was done.
__4. Multi-context__

2
vendor/brightray vendored

@ -1 +1 @@
Subproject commit 10ea3c5207dc18b3103aaf6e457193f8454becf1
Subproject commit d788bdfe0bcd4672e62ed0e777876e76897e4613