From 6dae07b76fb4e559eb0c76984f5dbef48ed4ae48 Mon Sep 17 00:00:00 2001 From: Daniel Pham Date: Tue, 10 May 2016 15:02:56 -0400 Subject: [PATCH 1/6] Add API: app.dock.downloadFinished(filePath) --- atom/browser/api/atom_api_app.cc | 2 ++ atom/browser/browser.h | 3 +++ atom/browser/browser_mac.mm | 6 ++++++ docs/api/app.md | 6 ++++++ lib/browser/api/app.js | 1 + 5 files changed, 18 insertions(+) diff --git a/atom/browser/api/atom_api_app.cc b/atom/browser/api/atom_api_app.cc index 52a6926d1a9b..835a2b52f20b 100644 --- a/atom/browser/api/atom_api_app.cc +++ b/atom/browser/api/atom_api_app.cc @@ -546,6 +546,8 @@ void Initialize(v8::Local exports, v8::Local unused, dict.SetMethod("dockBounce", &DockBounce); dict.SetMethod("dockCancelBounce", base::Bind(&Browser::DockCancelBounce, browser)); + dict.SetMethod("dockDownloadFinished", + base::Bind(&Browser::DockDownloadFinished, browser)); dict.SetMethod("dockSetBadgeText", base::Bind(&Browser::DockSetBadgeText, browser)); dict.SetMethod("dockGetBadgeText", diff --git a/atom/browser/browser.h b/atom/browser/browser.h index eb8d2865ad82..1c70eb875906 100644 --- a/atom/browser/browser.h +++ b/atom/browser/browser.h @@ -111,6 +111,9 @@ class Browser : public WindowListObserver { int DockBounce(BounceType type); void DockCancelBounce(int request_id); + // Bounce the Downloads stack. + void DockDownloadFinished(const std::string& filePath); + // Set/Get dock's badge text. void DockSetBadgeText(const std::string& label); std::string DockGetBadgeText(); diff --git a/atom/browser/browser_mac.mm b/atom/browser/browser_mac.mm index eb7191b67a23..477a132be6af 100644 --- a/atom/browser/browser_mac.mm +++ b/atom/browser/browser_mac.mm @@ -134,6 +134,12 @@ void Browser::DockSetBadgeText(const std::string& 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() { NSDockTile *tile = [[AtomApplication sharedApplication] dockTile]; return base::SysNSStringToUTF8([tile badgeLabel]); diff --git a/docs/api/app.md b/docs/api/app.md index c6c5887ef623..7f928bb5b1ce 100644 --- a/docs/api/app.md +++ b/docs/api/app.md @@ -566,6 +566,12 @@ Returns an ID representing the request. 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_ * `text` String diff --git a/lib/browser/api/app.js b/lib/browser/api/app.js index 0487270ce7b3..f8bff4b8a72c 100644 --- a/lib/browser/api/app.js +++ b/lib/browser/api/app.js @@ -32,6 +32,7 @@ if (process.platform === 'darwin') { return bindings.dockBounce(type) }, cancelBounce: bindings.dockCancelBounce, + downloadFinished: bindings.dockDownloadFinished, setBadge: bindings.dockSetBadgeText, getBadge: bindings.dockGetBadgeText, hide: bindings.dockHide, From 0dad2581efbcd300101aa7f4e3d54abe0eda84f1 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Wed, 11 May 2016 08:47:50 +0900 Subject: [PATCH 2/6] Fix passing paths in command line --- atom/app/atom_content_client.cc | 11 +++++------ atom/browser/api/atom_api_app.cc | 4 +++- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/atom/app/atom_content_client.cc b/atom/app/atom_content_client.cc index 8f59c77768c6..705573abe5d2 100644 --- a/atom/app/atom_content_client.cc +++ b/atom/app/atom_content_client.cc @@ -126,7 +126,7 @@ void ConvertStringWithSeparatorToVector(std::vector* vec, void AddPepperFlashFromCommandLine( std::vector* plugins) { auto command_line = base::CommandLine::ForCurrentProcess(); - auto flash_path = command_line->GetSwitchValueNative( + base::FilePath flash_path = command_line->GetSwitchValuePath( switches::kPpapiFlashPath); if (flash_path.empty()) return; @@ -134,20 +134,19 @@ void AddPepperFlashFromCommandLine( auto flash_version = command_line->GetSwitchValueASCII( switches::kPpapiFlashVersion); - plugins->push_back( - CreatePepperFlashInfo(base::FilePath(flash_path), flash_version)); + plugins->push_back(CreatePepperFlashInfo(flash_path, flash_version)); } #if defined(WIDEVINE_CDM_AVAILABLE) && defined(ENABLE_PEPPER_CDMS) void AddWidevineCdmFromCommandLine( std::vector* plugins) { auto command_line = base::CommandLine::ForCurrentProcess(); - auto widevine_cdm_path = command_line->GetSwitchValueNative( + base::FilePath widevine_cdm_path = command_line->GetSwitchValuePath( switches::kWidevineCdmPath); if (widevine_cdm_path.empty()) return; - if (!base::PathExists(base::FilePath(widevine_cdm_path))) + if (!base::PathExists(widevine_cdm_path)) return; auto widevine_cdm_version = command_line->GetSwitchValueASCII( @@ -155,7 +154,7 @@ void AddWidevineCdmFromCommandLine( if (widevine_cdm_version.empty()) return; - plugins->push_back(CreateWidevineCdmInfo(base::FilePath(widevine_cdm_path), + plugins->push_back(CreateWidevineCdmInfo(widevine_cdm_path, widevine_cdm_version)); } #endif diff --git a/atom/browser/api/atom_api_app.cc b/atom/browser/api/atom_api_app.cc index 52a6926d1a9b..4d587d9f0b64 100644 --- a/atom/browser/api/atom_api_app.cc +++ b/atom/browser/api/atom_api_app.cc @@ -27,6 +27,7 @@ #include "base/files/file_path.h" #include "base/files/file_util.h" #include "base/path_service.h" +#include "base/strings/string_util.h" #include "brightray/browser/brightray_paths.h" #include "chrome/common/chrome_paths.h" #include "content/public/browser/client_certificate_delegate.h" @@ -500,7 +501,8 @@ namespace { void AppendSwitch(const std::string& switch_string, mate::Arguments* args) { 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) { base::FilePath path; args->GetNext(&path); From 4cdba29fbd5ebdf90a027499af85bb23fb688713 Mon Sep 17 00:00:00 2001 From: Plusb Preco Date: Wed, 11 May 2016 10:30:02 +0900 Subject: [PATCH 3/6] :memo: Match object notation style [ci skip] --- docs/api/session.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/api/session.md b/docs/api/session.md index 76ba4a611b0f..33a53df5844e 100644 --- a/docs/api/session.md +++ b/docs/api/session.md @@ -89,13 +89,13 @@ session.defaultSession.cookies.get({}, (error, cookies) => { }); // 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); }); // Set a cookie with the given cookie data; // 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) => { if (error) console.error(error); From 01c483e0dd5f675fdc2b1df13d83efe0224e0266 Mon Sep 17 00:00:00 2001 From: Plusb Preco Date: Wed, 11 May 2016 10:48:54 +0900 Subject: [PATCH 4/6] :memo: Update `README-ko.md` [ci skip] --- README-ko.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README-ko.md b/README-ko.md index 5f809bbf05f9..bb7684e9d53a 100644 --- a/README-ko.md +++ b/README-ko.md @@ -1,7 +1,7 @@ [![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) -[![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) [![Join the Electron Community on Slack](http://atom-slack.herokuapp.com/badge.svg)](http://atom-slack.herokuapp.com/) From 95c9e488222dbdec9806bd97131b2530d2171f86 Mon Sep 17 00:00:00 2001 From: Plusb Preco Date: Wed, 11 May 2016 13:48:40 +0900 Subject: [PATCH 5/6] :memo: Update Korean docs as upstream [ci skip] --- docs-translations/ko-KR/api/app.md | 10 ++++++++-- docs-translations/ko-KR/api/menu.md | 3 ++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/docs-translations/ko-KR/api/app.md b/docs-translations/ko-KR/api/app.md index 52a7baa308ef..b0bf4d73601c 100644 --- a/docs-translations/ko-KR/api/app.md +++ b/docs-translations/ko-KR/api/app.md @@ -558,7 +558,7 @@ Chrominum의 명령줄에 인수를 추가합니다. 인수는 올바르게 인 기본값은 `informational` 입니다. `critical`이 전달되면 dock 아이콘이 어플리케이션이 활성화되거나 요청이 중지되기 전까지 -통통 튑니다. +통통 튀는 바운스 효과를 적용합니다. `informational`이 전달되면 dock 아이콘이 1초만 통통 튑니다. 하지만 어플리케이션이 활성화되거나 요청이 중지되기 전까지 요청은 계속 활성화로 유지 됩니다. @@ -569,7 +569,13 @@ Chrominum의 명령줄에 인수를 추가합니다. 인수는 올바르게 인 * `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_ diff --git a/docs-translations/ko-KR/api/menu.md b/docs-translations/ko-KR/api/menu.md index df3ed0717166..e627a9a87a4b 100644 --- a/docs-translations/ko-KR/api/menu.md +++ b/docs-translations/ko-KR/api/menu.md @@ -14,7 +14,8 @@ ```html