This commit is contained in:
Cheng Zhao 2016-05-11 15:15:15 +09:00
commit 2cd41b2f84
11 changed files with 40 additions and 14 deletions

View file

@ -1,7 +1,7 @@
[![Electron Logo](http://electron.atom.io/images/electron-logo.svg)](http://electron.atom.io/) [![Electron Logo](http://electron.atom.io/images/electron-logo.svg)](http://electron.atom.io/)
[![Travis Build Status](https://travis-ci.org/electron/electron.svg?branch=master)](https://travis-ci.org/electron/electron) [![Travis Build Status](https://travis-ci.org/electron/electron.svg?branch=master)](https://travis-ci.org/electron/electron)
[![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/qtmod45u0cc1ouov/branch/master?svg=true)](https://ci.appveyor.com/project/Atom/electron) [![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/kvxe4byi7jcxbe26/branch/master?svg=true)](https://ci.appveyor.com/project/Atom/electron)
[![devDependency Status](https://david-dm.org/electron/electron/dev-status.svg)](https://david-dm.org/electron/electron#info=devDependencies) [![devDependency Status](https://david-dm.org/electron/electron/dev-status.svg)](https://david-dm.org/electron/electron#info=devDependencies)
[![Join the Electron Community on Slack](http://atom-slack.herokuapp.com/badge.svg)](http://atom-slack.herokuapp.com/) [![Join the Electron Community on Slack](http://atom-slack.herokuapp.com/badge.svg)](http://atom-slack.herokuapp.com/)

View file

@ -126,7 +126,7 @@ void ConvertStringWithSeparatorToVector(std::vector<std::string>* vec,
void AddPepperFlashFromCommandLine( void AddPepperFlashFromCommandLine(
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( base::FilePath flash_path = command_line->GetSwitchValuePath(
switches::kPpapiFlashPath); switches::kPpapiFlashPath);
if (flash_path.empty()) if (flash_path.empty())
return; return;
@ -134,20 +134,19 @@ void AddPepperFlashFromCommandLine(
auto flash_version = command_line->GetSwitchValueASCII( auto flash_version = command_line->GetSwitchValueASCII(
switches::kPpapiFlashVersion); switches::kPpapiFlashVersion);
plugins->push_back( plugins->push_back(CreatePepperFlashInfo(flash_path, flash_version));
CreatePepperFlashInfo(base::FilePath(flash_path), flash_version));
} }
#if defined(WIDEVINE_CDM_AVAILABLE) && defined(ENABLE_PEPPER_CDMS) #if defined(WIDEVINE_CDM_AVAILABLE) && defined(ENABLE_PEPPER_CDMS)
void AddWidevineCdmFromCommandLine( void AddWidevineCdmFromCommandLine(
std::vector<content::PepperPluginInfo>* plugins) { std::vector<content::PepperPluginInfo>* plugins) {
auto command_line = base::CommandLine::ForCurrentProcess(); auto command_line = base::CommandLine::ForCurrentProcess();
auto widevine_cdm_path = command_line->GetSwitchValueNative( base::FilePath widevine_cdm_path = command_line->GetSwitchValuePath(
switches::kWidevineCdmPath); switches::kWidevineCdmPath);
if (widevine_cdm_path.empty()) if (widevine_cdm_path.empty())
return; return;
if (!base::PathExists(base::FilePath(widevine_cdm_path))) if (!base::PathExists(widevine_cdm_path))
return; return;
auto widevine_cdm_version = command_line->GetSwitchValueASCII( auto widevine_cdm_version = command_line->GetSwitchValueASCII(
@ -155,7 +154,7 @@ void AddWidevineCdmFromCommandLine(
if (widevine_cdm_version.empty()) if (widevine_cdm_version.empty())
return; return;
plugins->push_back(CreateWidevineCdmInfo(base::FilePath(widevine_cdm_path), plugins->push_back(CreateWidevineCdmInfo(widevine_cdm_path,
widevine_cdm_version)); widevine_cdm_version));
} }
#endif #endif

View file

@ -27,6 +27,7 @@
#include "base/files/file_path.h" #include "base/files/file_path.h"
#include "base/files/file_util.h" #include "base/files/file_util.h"
#include "base/path_service.h" #include "base/path_service.h"
#include "base/strings/string_util.h"
#include "brightray/browser/brightray_paths.h" #include "brightray/browser/brightray_paths.h"
#include "chrome/common/chrome_paths.h" #include "chrome/common/chrome_paths.h"
#include "content/public/browser/client_certificate_delegate.h" #include "content/public/browser/client_certificate_delegate.h"
@ -500,7 +501,8 @@ 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 || if (base::EndsWith(switch_string, "-path",
base::CompareCase::INSENSITIVE_ASCII) ||
switch_string == switches::kLogNetLog) { switch_string == switches::kLogNetLog) {
base::FilePath path; base::FilePath path;
args->GetNext(&path); args->GetNext(&path);
@ -546,6 +548,8 @@ void Initialize(v8::Local<v8::Object> exports, v8::Local<v8::Value> unused,
dict.SetMethod("dockBounce", &DockBounce); dict.SetMethod("dockBounce", &DockBounce);
dict.SetMethod("dockCancelBounce", dict.SetMethod("dockCancelBounce",
base::Bind(&Browser::DockCancelBounce, browser)); base::Bind(&Browser::DockCancelBounce, browser));
dict.SetMethod("dockDownloadFinished",
base::Bind(&Browser::DockDownloadFinished, browser));
dict.SetMethod("dockSetBadgeText", dict.SetMethod("dockSetBadgeText",
base::Bind(&Browser::DockSetBadgeText, browser)); base::Bind(&Browser::DockSetBadgeText, browser));
dict.SetMethod("dockGetBadgeText", dict.SetMethod("dockGetBadgeText",

View file

@ -111,6 +111,9 @@ class Browser : public WindowListObserver {
int DockBounce(BounceType type); int DockBounce(BounceType type);
void DockCancelBounce(int request_id); void DockCancelBounce(int request_id);
// Bounce the Downloads stack.
void DockDownloadFinished(const std::string& filePath);
// Set/Get dock's badge text. // Set/Get dock's badge text.
void DockSetBadgeText(const std::string& label); void DockSetBadgeText(const std::string& label);
std::string DockGetBadgeText(); std::string DockGetBadgeText();

View file

@ -158,6 +158,12 @@ void Browser::DockSetBadgeText(const std::string& label) {
[tile setBadgeLabel:base::SysUTF8ToNSString(label)]; [tile setBadgeLabel:base::SysUTF8ToNSString(label)];
} }
void Browser::DockDownloadFinished(const std::string& filePath) {
[[NSDistributedNotificationCenter defaultCenter]
postNotificationName: @"com.apple.DownloadFileFinished"
object: base::SysUTF8ToNSString(filePath)];
}
std::string Browser::DockGetBadgeText() { std::string Browser::DockGetBadgeText() {
NSDockTile *tile = [[AtomApplication sharedApplication] dockTile]; NSDockTile *tile = [[AtomApplication sharedApplication] dockTile];
return base::SysNSStringToUTF8([tile badgeLabel]); return base::SysNSStringToUTF8([tile badgeLabel]);

View file

@ -558,7 +558,7 @@ Chrominum의 명령줄에 인수를 추가합니다. 인수는 올바르게 인
기본값은 `informational` 입니다. 기본값은 `informational` 입니다.
`critical`이 전달되면 dock 아이콘이 어플리케이션이 활성화되거나 요청이 중지되기 전까지 `critical`이 전달되면 dock 아이콘이 어플리케이션이 활성화되거나 요청이 중지되기 전까지
통통 니다. 통통 튀는 바운스 효과를 적용합니다.
`informational`이 전달되면 dock 아이콘이 1초만 통통 튑니다. 하지만 어플리케이션이 `informational`이 전달되면 dock 아이콘이 1초만 통통 튑니다. 하지만 어플리케이션이
활성화되거나 요청이 중지되기 전까지 요청은 계속 활성화로 유지 됩니다. 활성화되거나 요청이 중지되기 전까지 요청은 계속 활성화로 유지 됩니다.
@ -569,7 +569,13 @@ Chrominum의 명령줄에 인수를 추가합니다. 인수는 올바르게 인
* `id` Integer * `id` Integer
`app.dock.bounce([type])` 메서드에서 반환한 `id`의 통통 튀는 효과를 취소합니다. `app.dock.bounce([type])` 메서드에서 반환한 `id`의 바운스 효과를 취소합니다.
### `app.dock.downloadFinished(filePath)` _OS X_
* `filePath` String
`filePath`가 다운로드 폴더에 들어있다면 다운로드 스택을 바운스합니다.
### `app.dock.setBadge(text)` _OS X_ ### `app.dock.setBadge(text)` _OS X_

View file

@ -14,7 +14,8 @@
```html ```html
<!-- index.html --> <!-- index.html -->
<script> <script>
const {Menu, MenuItem} = require('electron').remote; const {remote} = require('electron');
const {Menu, MenuItem} = remote;
const menu = new Menu(); const menu = new Menu();
menu.append(new MenuItem({label: 'MenuItem1', click() { console.log('item 1 clicked'); }})); menu.append(new MenuItem({label: 'MenuItem1', click() { console.log('item 1 clicked'); }}));

View file

@ -563,6 +563,12 @@ Returns an ID representing the request.
Cancel the bounce of `id`. Cancel the bounce of `id`.
### `app.dock.downloadFinished(filePath)` _OS X_
* `filePath` String
Bounces the Downloads stack if the filePath is inside the Downloads folder.
### `app.dock.setBadge(text)` _OS X_ ### `app.dock.setBadge(text)` _OS X_
* `text` String * `text` String

View file

@ -89,13 +89,13 @@ session.defaultSession.cookies.get({}, (error, cookies) => {
}); });
// Query all cookies associated with a specific url. // Query all cookies associated with a specific url.
session.defaultSession.cookies.get({url : 'http://www.github.com'}, (error, cookies) => { session.defaultSession.cookies.get({url: 'http://www.github.com'}, (error, cookies) => {
console.log(cookies); console.log(cookies);
}); });
// Set a cookie with the given cookie data; // Set a cookie with the given cookie data;
// may overwrite equivalent cookies if they exist. // may overwrite equivalent cookies if they exist.
const cookie = {url : 'http://www.github.com', name : 'dummy_name', value : 'dummy'}; const cookie = {url: 'http://www.github.com', name: 'dummy_name', value: 'dummy'};
session.defaultSession.cookies.set(cookie, (error) => { session.defaultSession.cookies.set(cookie, (error) => {
if (error) if (error)
console.error(error); console.error(error);

View file

@ -31,6 +31,7 @@ if (process.platform === 'darwin') {
return bindings.dockBounce(type) return bindings.dockBounce(type)
}, },
cancelBounce: bindings.dockCancelBounce, cancelBounce: bindings.dockCancelBounce,
downloadFinished: bindings.dockDownloadFinished,
setBadge: bindings.dockSetBadgeText, setBadge: bindings.dockSetBadgeText,
getBadge: bindings.dockGetBadgeText, getBadge: bindings.dockGetBadgeText,
hide: bindings.dockHide, hide: bindings.dockHide,

View file

@ -1,4 +1,4 @@
var app = require('app') var app = require('electron').app
var fs = require('fs') var fs = require('fs')
var request = require('request') var request = require('request')