diff --git a/CONTRIBUTING-ko.md b/CONTRIBUTING-ko.md index fe3eb90b68c..480c2f73e47 100644 --- a/CONTRIBUTING-ko.md +++ b/CONTRIBUTING-ko.md @@ -68,7 +68,7 @@ * :non-potable_water: `:non-potable_water:` 메모리 누수를 연결했을 때 * :memo: `:memo:` 문서를 작성했을 때 * :penguin: `:penguin:` Linux에 대한 패치를 했을 때 - * :apple: `:apple:` Mac OS에 대한 패치를 했을 때 + * :apple: `:apple:` macOS에 대한 패치를 했을 때 * :checkered_flag: `:checkered_flag:` Windows에 대한 패치를 했을 때 * :bug: `:bug:` 버그를 고쳤을 때 * :fire: `:fire:` 코드 또는 파일을 삭제했을 때 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index d6bc3cb2d67..736f0b22ef7 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -65,7 +65,7 @@ possible with your report. If you can, please include: * :non-potable_water: `:non-potable_water:` when plugging memory leaks * :memo: `:memo:` when writing docs * :penguin: `:penguin:` when fixing something on Linux - * :apple: `:apple:` when fixing something on Mac OS + * :apple: `:apple:` when fixing something on macOS * :checkered_flag: `:checkered_flag:` when fixing something on Windows * :bug: `:bug:` when fixing a bug * :fire: `:fire:` when removing code or files diff --git a/README-ko.md b/README-ko.md index 7cabe5ed456..c3c0216c2ac 100644 --- a/README-ko.md +++ b/README-ko.md @@ -8,10 +8,10 @@ ### [Electron](https://github.com/electron/electron/) 한국어 참조 문서 Electron 프레임워크는 JavaScript, HTML 그리고 CSS를 사용하여 -Cross-Platform 데스크톱 어플리케이션을 개발할 수 있도록 해주는 프레임워크입니다. +Cross-Platform 데스크톱 애플리케이션을 개발할 수 있도록 해주는 프레임워크입니다. [Node.js](https://nodejs.org/)와 [Chromium](http://www.chromium.org)을 기반으로 만들어졌으며 [Atom Editor](https://github.com/atom/atom)에 사용되고 있습니다. -더 많은 어플리케이션은 [이곳](http://electron.atom.io/apps)에서 확인하세요. +더 많은 애플리케이션은 [이곳](http://electron.atom.io/apps)에서 확인하세요. Electron에 대한 중요한 알림을 받고 싶다면 Twitter에서 [@ElectronJS](https://twitter.com/electronjs)를 팔로우 하세요. @@ -22,7 +22,7 @@ Electron에 대한 중요한 알림을 받고 싶다면 Twitter에서 ## 다운로드 -Linux, Windows, OS X 용으로 미리 빌드된 Electron 바이너리와 디버그 심볼이 준비되어 +Linux, Windows, macOS 용으로 미리 빌드된 Electron 바이너리와 디버그 심볼이 준비되어 있습니다. [releases](https://github.com/electron/electron/releases) 페이지에서 받아 볼 수 있습니다. @@ -77,4 +77,4 @@ npm install electron-prebuilt --save-dev - [`electron-jp`](https://electron-jp-slackin.herokuapp.com/) *(일본)* 커뮤니티 [awesome-electron](https://github.com/sindresorhus/awesome-electron) 프로젝트에 -커뮤니티가 운영중인 유용한 예시 어플리케이션과 도구, 리소스가 있으니 참고하기 바랍니다. +커뮤니티가 운영중인 유용한 예시 애플리케이션과 도구, 리소스가 있으니 참고하기 바랍니다. diff --git a/README.md b/README.md index b1e0d6b1b9a..83ba1f5a618 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ behavior to electron@github.com. ## Downloads -Prebuilt binaries and debug symbols of Electron for Linux, Windows and OS X can +Prebuilt binaries and debug symbols of Electron for Linux, Windows and macOS can be found on the [releases](https://github.com/electron/electron/releases) page. You can also use [`npm`](https://docs.npmjs.com/) to install prebuilt electron diff --git a/atom/browser/api/atom_api_auto_updater.cc b/atom/browser/api/atom_api_auto_updater.cc index cdf3406ae78..54e2bd9f746 100644 --- a/atom/browser/api/atom_api_auto_updater.cc +++ b/atom/browser/api/atom_api_auto_updater.cc @@ -79,6 +79,12 @@ void AutoUpdater::OnWindowAllClosed() { QuitAndInstall(); } +void AutoUpdater::SetFeedURL(const std::string& url, mate::Arguments* args) { + auto_updater::AutoUpdater::HeaderMap headers; + args->GetNext(&headers); + auto_updater::AutoUpdater::SetFeedURL(url, headers); +} + void AutoUpdater::QuitAndInstall() { // If we don't have any window then quitAndInstall immediately. WindowList* window_list = WindowList::GetInstance(); @@ -102,8 +108,8 @@ mate::Handle AutoUpdater::Create(v8::Isolate* isolate) { void AutoUpdater::BuildPrototype( v8::Isolate* isolate, v8::Local prototype) { mate::ObjectTemplateBuilder(isolate, prototype) - .SetMethod("setFeedURL", &auto_updater::AutoUpdater::SetFeedURL) .SetMethod("checkForUpdates", &auto_updater::AutoUpdater::CheckForUpdates) + .SetMethod("setFeedURL", &AutoUpdater::SetFeedURL) .SetMethod("quitAndInstall", &AutoUpdater::QuitAndInstall); } diff --git a/atom/browser/api/atom_api_auto_updater.h b/atom/browser/api/atom_api_auto_updater.h index 857647258ad..e8c135f292e 100644 --- a/atom/browser/api/atom_api_auto_updater.h +++ b/atom/browser/api/atom_api_auto_updater.h @@ -10,6 +10,7 @@ #include "atom/browser/api/event_emitter.h" #include "atom/browser/auto_updater.h" #include "atom/browser/window_list_observer.h" +#include "native_mate/arguments.h" #include "native_mate/handle.h" namespace atom { @@ -43,6 +44,7 @@ class AutoUpdater : public mate::EventEmitter, void OnWindowAllClosed() override; private: + void SetFeedURL(const std::string& url, mate::Arguments* args); void QuitAndInstall(); DISALLOW_COPY_AND_ASSIGN(AutoUpdater); diff --git a/atom/browser/api/atom_api_menu_mac.h b/atom/browser/api/atom_api_menu_mac.h index 293e8ec4eda..062fd9be41b 100644 --- a/atom/browser/api/atom_api_menu_mac.h +++ b/atom/browser/api/atom_api_menu_mac.h @@ -19,7 +19,7 @@ class MenuMac : public Menu { protected: explicit MenuMac(v8::Isolate* isolate); - void PopupAt(Window* window, int x, int y, int positioning_item = 0) override; + void PopupAt(Window* window, int x, int y, int positioning_item) override; base::scoped_nsobject menu_controller_; diff --git a/atom/browser/api/atom_api_menu_views.h b/atom/browser/api/atom_api_menu_views.h index e1daa490402..9a7a740182d 100644 --- a/atom/browser/api/atom_api_menu_views.h +++ b/atom/browser/api/atom_api_menu_views.h @@ -17,7 +17,7 @@ class MenuViews : public Menu { explicit MenuViews(v8::Isolate* isolate); protected: - void PopupAt(Window* window, int x, int y, int positioning_item = 0) override; + void PopupAt(Window* window, int x, int y, int positioning_item) override; private: DISALLOW_COPY_AND_ASSIGN(MenuViews); diff --git a/atom/browser/api/atom_api_protocol.cc b/atom/browser/api/atom_api_protocol.cc index db8facfe095..c762559ab62 100644 --- a/atom/browser/api/atom_api_protocol.cc +++ b/atom/browser/api/atom_api_protocol.cc @@ -5,7 +5,6 @@ #include "atom/browser/api/atom_api_protocol.h" #include "atom/browser/atom_browser_client.h" -#include "atom/browser/atom_browser_context.h" #include "atom/browser/atom_browser_main_parts.h" #include "atom/browser/net/url_request_async_asar_job.h" #include "atom/browser/net/url_request_buffer_job.h" @@ -28,9 +27,9 @@ namespace atom { namespace api { Protocol::Protocol(v8::Isolate* isolate, AtomBrowserContext* browser_context) - : request_context_getter_(browser_context->GetRequestContext()), - job_factory_(browser_context->job_factory()) { - CHECK(job_factory_); + : request_context_getter_(static_cast( + browser_context->GetRequestContext())), + weak_factory_(this) { Init(isolate); } @@ -46,30 +45,37 @@ void Protocol::UnregisterProtocol( content::BrowserThread::PostTaskAndReplyWithResult( content::BrowserThread::IO, FROM_HERE, base::Bind(&Protocol::UnregisterProtocolInIO, - base::Unretained(this), scheme), + request_context_getter_, scheme), base::Bind(&Protocol::OnIOCompleted, - base::Unretained(this), callback)); + GetWeakPtr(), callback)); } +// static Protocol::ProtocolError Protocol::UnregisterProtocolInIO( + scoped_refptr request_context_getter, const std::string& scheme) { - if (!job_factory_->HasProtocolHandler(scheme)) + auto job_factory = static_cast( + request_context_getter->job_factory()); + if (!job_factory->HasProtocolHandler(scheme)) return PROTOCOL_NOT_REGISTERED; - job_factory_->SetProtocolHandler(scheme, nullptr); + job_factory->SetProtocolHandler(scheme, nullptr); return PROTOCOL_OK; } void Protocol::IsProtocolHandled(const std::string& scheme, - const BooleanCallback& callback) { + const BooleanCallback& callback) { content::BrowserThread::PostTaskAndReplyWithResult( content::BrowserThread::IO, FROM_HERE, base::Bind(&Protocol::IsProtocolHandledInIO, - base::Unretained(this), scheme), + request_context_getter_, scheme), callback); } -bool Protocol::IsProtocolHandledInIO(const std::string& scheme) { - return job_factory_->IsHandledProtocol(scheme); +// static +bool Protocol::IsProtocolHandledInIO( + scoped_refptr request_context_getter, + const std::string& scheme) { + return request_context_getter->job_factory()->IsHandledProtocol(scheme); } void Protocol::UninterceptProtocol( @@ -79,18 +85,18 @@ void Protocol::UninterceptProtocol( content::BrowserThread::PostTaskAndReplyWithResult( content::BrowserThread::IO, FROM_HERE, base::Bind(&Protocol::UninterceptProtocolInIO, - base::Unretained(this), scheme), + request_context_getter_, scheme), base::Bind(&Protocol::OnIOCompleted, - base::Unretained(this), callback)); + GetWeakPtr(), callback)); } +// static Protocol::ProtocolError Protocol::UninterceptProtocolInIO( + scoped_refptr request_context_getter, const std::string& scheme) { - if (!original_protocols_.contains(scheme)) - return PROTOCOL_NOT_INTERCEPTED; - job_factory_->ReplaceProtocol(scheme, - original_protocols_.take_and_erase(scheme)); - return PROTOCOL_OK; + return static_cast( + request_context_getter->job_factory())->UninterceptProtocol(scheme) ? + PROTOCOL_OK : PROTOCOL_NOT_INTERCEPTED; } void Protocol::OnIOCompleted( @@ -121,6 +127,13 @@ std::string Protocol::ErrorCodeToString(ProtocolError error) { } } +AtomURLRequestJobFactory* Protocol::GetJobFactoryInIO() const { + request_context_getter_->GetURLRequestContext(); // Force init. + return static_cast( + static_cast( + request_context_getter_.get())->job_factory()); +} + // static mate::Handle Protocol::Create( v8::Isolate* isolate, AtomBrowserContext* browser_context) { diff --git a/atom/browser/api/atom_api_protocol.h b/atom/browser/api/atom_api_protocol.h index 734d179dfac..379c43bfcd7 100644 --- a/atom/browser/api/atom_api_protocol.h +++ b/atom/browser/api/atom_api_protocol.h @@ -10,28 +10,22 @@ #include #include "atom/browser/api/trackable_object.h" +#include "atom/browser/atom_browser_context.h" #include "atom/browser/net/atom_url_request_job_factory.h" #include "base/callback.h" -#include "base/containers/scoped_ptr_hash_map.h" +#include "base/memory/weak_ptr.h" #include "content/public/browser/browser_thread.h" #include "native_mate/arguments.h" #include "native_mate/dictionary.h" #include "native_mate/handle.h" +#include "net/url_request/url_request_context.h" namespace base { class DictionaryValue; } -namespace net { -class URLRequest; -class URLRequestContextGetter; -} - namespace atom { -class AtomBrowserContext; -class AtomURLRequestJobFactory; - namespace api { class Protocol : public mate::TrackableObject { @@ -80,13 +74,13 @@ class Protocol : public mate::TrackableObject { net::URLRequest* request, net::NetworkDelegate* network_delegate) const override { RequestJob* request_job = new RequestJob(request, network_delegate); - request_job->SetHandlerInfo(isolate_, request_context_, handler_); + request_job->SetHandlerInfo(isolate_, request_context_.get(), handler_); return request_job; } private: v8::Isolate* isolate_; - net::URLRequestContextGetter* request_context_; + scoped_refptr request_context_; Protocol::Handler handler_; DISALLOW_COPY_AND_ASSIGN(CustomProtocolHandler); @@ -105,19 +99,24 @@ class Protocol : public mate::TrackableObject { content::BrowserThread::PostTaskAndReplyWithResult( content::BrowserThread::IO, FROM_HERE, base::Bind(&Protocol::RegisterProtocolInIO, - base::Unretained(this), scheme, handler), + request_context_getter_, isolate(), scheme, handler), base::Bind(&Protocol::OnIOCompleted, - base::Unretained(this), callback)); + GetWeakPtr(), callback)); } template - ProtocolError RegisterProtocolInIO(const std::string& scheme, - const Handler& handler) { - if (job_factory_->IsHandledProtocol(scheme)) + static ProtocolError RegisterProtocolInIO( + scoped_refptr request_context_getter, + v8::Isolate* isolate, + const std::string& scheme, + const Handler& handler) { + auto job_factory = static_cast( + request_context_getter->job_factory()); + if (job_factory->IsHandledProtocol(scheme)) return PROTOCOL_REGISTERED; std::unique_ptr> protocol_handler( new CustomProtocolHandler( - isolate(), request_context_getter_, handler)); - if (job_factory_->SetProtocolHandler(scheme, std::move(protocol_handler))) + isolate, request_context_getter.get(), handler)); + if (job_factory->SetProtocolHandler(scheme, std::move(protocol_handler))) return PROTOCOL_OK; else return PROTOCOL_FAIL; @@ -125,12 +124,16 @@ class Protocol : public mate::TrackableObject { // Unregister the protocol handler that handles |scheme|. void UnregisterProtocol(const std::string& scheme, mate::Arguments* args); - ProtocolError UnregisterProtocolInIO(const std::string& scheme); + static ProtocolError UnregisterProtocolInIO( + scoped_refptr request_context_getter, + const std::string& scheme); // Whether the protocol has handler registered. void IsProtocolHandled(const std::string& scheme, const BooleanCallback& callback); - bool IsProtocolHandledInIO(const std::string& scheme); + static bool IsProtocolHandledInIO( + scoped_refptr request_context_getter, + const std::string& scheme); // Replace the protocol handler with a new one. template @@ -142,32 +145,36 @@ class Protocol : public mate::TrackableObject { content::BrowserThread::PostTaskAndReplyWithResult( content::BrowserThread::IO, FROM_HERE, base::Bind(&Protocol::InterceptProtocolInIO, - base::Unretained(this), scheme, handler), + request_context_getter_, isolate(), scheme, handler), base::Bind(&Protocol::OnIOCompleted, - base::Unretained(this), callback)); + GetWeakPtr(), callback)); } template - ProtocolError InterceptProtocolInIO(const std::string& scheme, - const Handler& handler) { - if (!job_factory_->IsHandledProtocol(scheme)) + static ProtocolError InterceptProtocolInIO( + scoped_refptr request_context_getter, + v8::Isolate* isolate, + const std::string& scheme, + const Handler& handler) { + auto job_factory = static_cast( + request_context_getter->job_factory()); + if (!job_factory->IsHandledProtocol(scheme)) return PROTOCOL_NOT_REGISTERED; // It is possible a protocol is handled but can not be intercepted. - if (!job_factory_->HasProtocolHandler(scheme)) + if (!job_factory->HasProtocolHandler(scheme)) return PROTOCOL_FAIL; - if (ContainsKey(original_protocols_, scheme)) - return PROTOCOL_INTERCEPTED; std::unique_ptr> protocol_handler( new CustomProtocolHandler( - isolate(), request_context_getter_, handler)); - original_protocols_.set( - scheme, - job_factory_->ReplaceProtocol(scheme, std::move(protocol_handler))); + isolate, request_context_getter.get(), handler)); + if (!job_factory->InterceptProtocol(scheme, std::move(protocol_handler))) + return PROTOCOL_INTERCEPTED; return PROTOCOL_OK; } // Restore the |scheme| to its original protocol handler. void UninterceptProtocol(const std::string& scheme, mate::Arguments* args); - ProtocolError UninterceptProtocolInIO(const std::string& scheme); + static ProtocolError UninterceptProtocolInIO( + scoped_refptr request_context_getter, + const std::string& scheme); // Convert error code to JS exception and call the callback. void OnIOCompleted(const CompletionCallback& callback, ProtocolError error); @@ -175,15 +182,14 @@ class Protocol : public mate::TrackableObject { // Convert error code to string. std::string ErrorCodeToString(ProtocolError error); - net::URLRequestContextGetter* request_context_getter_; + AtomURLRequestJobFactory* GetJobFactoryInIO() const; - // Map that stores the original protocols of schemes. - using OriginalProtocolsMap = base::ScopedPtrHashMap< - std::string, - std::unique_ptr>; - OriginalProtocolsMap original_protocols_; + base::WeakPtr GetWeakPtr() { + return weak_factory_.GetWeakPtr(); + } - AtomURLRequestJobFactory* job_factory_; // weak ref + scoped_refptr request_context_getter_; + base::WeakPtrFactory weak_factory_; DISALLOW_COPY_AND_ASSIGN(Protocol); }; diff --git a/atom/browser/api/atom_api_render_process_preferences.cc b/atom/browser/api/atom_api_render_process_preferences.cc index 59ae07b45c7..3d9495d932a 100644 --- a/atom/browser/api/atom_api_render_process_preferences.cc +++ b/atom/browser/api/atom_api_render_process_preferences.cc @@ -4,9 +4,8 @@ #include "atom/browser/api/atom_api_render_process_preferences.h" +#include "atom/browser/api/atom_api_web_contents.h" #include "atom/browser/atom_browser_client.h" -#include "atom/browser/native_window.h" -#include "atom/browser/window_list.h" #include "atom/common/native_mate_converters/value_converter.h" #include "atom/common/node_includes.h" #include "content/public/browser/render_process_host.h" @@ -19,18 +18,17 @@ namespace api { namespace { -bool IsBrowserWindow(content::RenderProcessHost* process) { +bool IsWebContents(v8::Isolate* isolate, content::RenderProcessHost* process) { content::WebContents* web_contents = static_cast(AtomBrowserClient::Get())-> GetWebContentsFromProcessID(process->GetID()); if (!web_contents) return false; - NativeWindow* window = NativeWindow::FromWebContents(web_contents); - if (!window) - return false; - - return true; + auto api_web_contents = WebContents::CreateFrom(isolate, web_contents); + auto type = api_web_contents->GetType(); + return type == WebContents::Type::BROWSER_WINDOW || + type == WebContents::Type::WEB_VIEW; } } // namespace @@ -63,10 +61,11 @@ void RenderProcessPreferences::BuildPrototype( // static mate::Handle -RenderProcessPreferences::ForAllBrowserWindow(v8::Isolate* isolate) { +RenderProcessPreferences::ForAllWebContents(v8::Isolate* isolate) { return mate::CreateHandle( isolate, - new RenderProcessPreferences(isolate, base::Bind(&IsBrowserWindow))); + new RenderProcessPreferences(isolate, + base::Bind(&IsWebContents, isolate))); } } // namespace api @@ -78,8 +77,8 @@ namespace { void Initialize(v8::Local exports, v8::Local unused, v8::Local context, void* priv) { mate::Dictionary dict(context->GetIsolate(), exports); - dict.SetMethod("forAllBrowserWindow", - &atom::api::RenderProcessPreferences::ForAllBrowserWindow); + dict.SetMethod("forAllWebContents", + &atom::api::RenderProcessPreferences::ForAllWebContents); } } // namespace diff --git a/atom/browser/api/atom_api_render_process_preferences.h b/atom/browser/api/atom_api_render_process_preferences.h index a305f1361b2..3fa197ed04c 100644 --- a/atom/browser/api/atom_api_render_process_preferences.h +++ b/atom/browser/api/atom_api_render_process_preferences.h @@ -17,7 +17,7 @@ class RenderProcessPreferences : public mate::Wrappable { public: static mate::Handle - ForAllBrowserWindow(v8::Isolate* isolate); + ForAllWebContents(v8::Isolate* isolate); static void BuildPrototype(v8::Isolate* isolate, v8::Local prototype); diff --git a/atom/browser/api/atom_api_web_contents.cc b/atom/browser/api/atom_api_web_contents.cc index 6cb9efb9614..52d24084d4b 100644 --- a/atom/browser/api/atom_api_web_contents.cc +++ b/atom/browser/api/atom_api_web_contents.cc @@ -187,6 +187,39 @@ struct Converter { } }; +template<> +struct Converter { + static v8::Local ToV8(v8::Isolate* isolate, + atom::api::WebContents::Type val) { + using Type = atom::api::WebContents::Type; + std::string type = ""; + switch (val) { + case Type::BACKGROUND_PAGE: type = "backgroundPage"; break; + case Type::BROWSER_WINDOW: type = "window"; break; + case Type::REMOTE: type = "remote"; break; + case Type::WEB_VIEW: type = "webview"; break; + default: break; + } + return mate::ConvertToV8(isolate, type); + } + + static bool FromV8(v8::Isolate* isolate, v8::Local val, + atom::api::WebContents::Type* out) { + using Type = atom::api::WebContents::Type; + std::string type; + if (!ConvertFromV8(isolate, val, &type)) + return false; + if (type == "webview") { + *out = Type::WEB_VIEW; + } else if (type == "backgroundPage") { + *out = Type::BACKGROUND_PAGE; + } else { + return false; + } + return true; + } +}; + } // namespace mate @@ -233,15 +266,22 @@ WebContents::WebContents(v8::Isolate* isolate, WebContents::WebContents(v8::Isolate* isolate, const mate::Dictionary& options) : embedder_(nullptr), + type_(BROWSER_WINDOW), request_id_(0), background_throttling_(true) { // Read options. options.Get("backgroundThrottling", &background_throttling_); - // Whether it is a guest WebContents. - bool is_guest = false; - options.Get("isGuest", &is_guest); - type_ = is_guest ? WEB_VIEW : BROWSER_WINDOW; + // FIXME(zcbenz): We should read "type" parameter for better design, but + // on Windows we have encountered a compiler bug that if we read "type" + // from |options| and then set |type_|, a memory corruption will happen + // and Electron will soon crash. + // Remvoe this after we upgraded to use VS 2015 Update 3. + bool b = false; + if (options.Get("isGuest", &b) && b) + type_ = WEB_VIEW; + else if (options.Get("isBackgroundPage", &b) && b) + type_ = BACKGROUND_PAGE; // Obtain the session. std::string partition; @@ -261,7 +301,7 @@ WebContents::WebContents(v8::Isolate* isolate, session_.Reset(isolate, session.ToV8()); content::WebContents* web_contents; - if (is_guest) { + if (IsGuest()) { scoped_refptr site_instance = content::SiteInstance::CreateForURL( session->browser_context(), GURL("chrome-guest://fake-host")); @@ -290,7 +330,7 @@ WebContents::WebContents(v8::Isolate* isolate, web_contents->SetUserAgentOverride(GetBrowserContext()->GetUserAgent()); - if (is_guest) { + if (IsGuest()) { guest_delegate_->Initialize(this); NativeWindow* owner_window = nullptr; @@ -744,13 +784,8 @@ int WebContents::GetID() const { return web_contents()->GetRenderProcessHost()->GetID(); } -std::string WebContents::GetType() const { - switch (type_) { - case BROWSER_WINDOW: return "window"; - case WEB_VIEW: return "webview"; - case REMOTE: return "remote"; - default: return ""; - } +WebContents::Type WebContents::GetType() const { + return type_; } bool WebContents::Equal(const WebContents* web_contents) const { diff --git a/atom/browser/api/atom_api_web_contents.h b/atom/browser/api/atom_api_web_contents.h index 13c6ce5a7b2..6151110887a 100644 --- a/atom/browser/api/atom_api_web_contents.h +++ b/atom/browser/api/atom_api_web_contents.h @@ -43,6 +43,13 @@ class WebContents : public mate::TrackableObject, public CommonWebContentsDelegate, public content::WebContentsObserver { public: + enum Type { + BACKGROUND_PAGE, // A DevTools extension background page. + BROWSER_WINDOW, // Used by BrowserWindow. + REMOTE, // Thin wrap around an existing WebContents. + WEB_VIEW, // Used by . + }; + // For node.js callback function type: function(error, buffer) using PrintToPDFCallback = base::Callback, v8::Local)>; @@ -59,7 +66,7 @@ class WebContents : public mate::TrackableObject, v8::Local prototype); int GetID() const; - std::string GetType() const; + Type GetType() const; bool Equal(const WebContents* web_contents) const; void LoadURL(const GURL& url, const mate::Dictionary& options); void DownloadURL(const GURL& url); @@ -268,12 +275,6 @@ class WebContents : public mate::TrackableObject, void DevToolsClosed() override; private: - enum Type { - BROWSER_WINDOW, // Used by BrowserWindow. - WEB_VIEW, // Used by . - REMOTE, // Thin wrap around an existing WebContents. - }; - AtomBrowserContext* GetBrowserContext() const; uint32_t GetNextRequestId() { diff --git a/atom/browser/api/atom_api_window.cc b/atom/browser/api/atom_api_window.cc index c95a4334041..cc3749bd014 100644 --- a/atom/browser/api/atom_api_window.cc +++ b/atom/browser/api/atom_api_window.cc @@ -95,9 +95,16 @@ Window::Window(v8::Isolate* isolate, const mate::Dictionary& options) { mate::Dictionary(isolate, web_contents->GetWrapper()).Set( "browserWindowOptions", options); + // The parent window. + mate::Handle parent; + if (options.Get("parent", &parent)) + parent_window_.Reset(isolate, parent.ToV8()); + // Creates BrowserWindow. - window_.reset(NativeWindow::Create(web_contents->managed_web_contents(), - options)); + window_.reset(NativeWindow::Create( + web_contents->managed_web_contents(), + options, + parent.IsEmpty() ? nullptr : parent->window_.get())); web_contents->SetOwnerWindow(window_.get()); window_->InitFromOptions(options); window_->AddObserver(this); @@ -120,10 +127,32 @@ Window::~Window() { base::MessageLoop::current()->DeleteSoon(FROM_HERE, window_.release()); } +void Window::AfterInit(v8::Isolate* isolate) { + mate::TrackableObject::AfterInit(isolate); + + // We can only append this window to parent window's child windows after this + // window's JS wrapper gets initialized. + mate::Handle parent; + if (!parent_window_.IsEmpty() && + mate::ConvertFromV8(isolate, GetParentWindow(), &parent)) + parent->child_windows_.Set(isolate, ID(), GetWrapper()); +} + void Window::WillCloseWindow(bool* prevent_default) { *prevent_default = Emit("close"); } +void Window::WillDestoryNativeObject() { + // Close all child windows before closing current window. + v8::Locker locker(isolate()); + v8::HandleScope handle_scope(isolate()); + for (v8::Local value : child_windows_.Values(isolate())) { + mate::Handle child; + if (mate::ConvertFromV8(isolate(), value, &child)) + child->window_->CloseImmediately(); + } +} + void Window::OnWindowClosed() { api_web_contents_->DestroyWebContents(); @@ -136,6 +165,8 @@ void Window::OnWindowClosed() { Emit("closed"); + RemoveFromParentChildWindows(); + // Destroy the native class when window is closed. base::MessageLoop::current()->PostTask(FROM_HERE, GetDestroyClosure()); } @@ -156,6 +187,10 @@ void Window::OnWindowHide() { Emit("hide"); } +void Window::OnReadyToShow() { + Emit("ready-to-show"); +} + void Window::OnWindowMaximize() { Emit("maximize"); } @@ -276,6 +311,10 @@ void Window::Show() { } void Window::ShowInactive() { + // This method doesn't make sense for modal window.. + if (IsModal()) + return; + window_->ShowInactive(); } @@ -287,6 +326,10 @@ bool Window::IsVisible() { return window_->IsVisible(); } +bool Window::IsEnabled() { + return window_->IsEnabled(); +} + void Window::Maximize() { window_->Maximize(); } @@ -529,6 +572,10 @@ void Window::SetIgnoreMouseEvents(bool ignore) { return window_->SetIgnoreMouseEvents(ignore); } +void Window::SetFocusable(bool focusable) { + return window_->SetFocusable(focusable); +} + void Window::CapturePage(mate::Arguments* args) { gfx::Rect rect; base::Callback callback; @@ -642,6 +689,42 @@ void Window::SetAspectRatio(double aspect_ratio, mate::Arguments* args) { window_->SetAspectRatio(aspect_ratio, extra_size); } +void Window::SetParentWindow(v8::Local value, + mate::Arguments* args) { + if (IsModal()) { + args->ThrowError("Can not be called for modal window"); + return; + } + + mate::Handle parent; + if (value->IsNull()) { + RemoveFromParentChildWindows(); + parent_window_.Reset(); + window_->SetParentWindow(nullptr); + } else if (mate::ConvertFromV8(isolate(), value, &parent)) { + parent_window_.Reset(isolate(), value); + window_->SetParentWindow(parent->window_.get()); + parent->child_windows_.Set(isolate(), ID(), GetWrapper()); + } else { + args->ThrowError("Must pass BrowserWindow instance or null"); + } +} + +v8::Local Window::GetParentWindow() const { + if (parent_window_.IsEmpty()) + return v8::Null(isolate()); + else + return v8::Local::New(isolate(), parent_window_); +} + +std::vector> Window::GetChildWindows() const { + return child_windows_.Values(isolate()); +} + +bool Window::IsModal() const { + return window_->is_modal(); +} + v8::Local Window::GetNativeWindowHandle() { gfx::AcceleratedWidget handle = window_->GetAcceleratedWidget(); return ToBuffer( @@ -667,6 +750,17 @@ v8::Local Window::WebContents(v8::Isolate* isolate) { return v8::Local::New(isolate, web_contents_); } +void Window::RemoveFromParentChildWindows() { + if (parent_window_.IsEmpty()) + return; + + mate::Handle parent; + if (!mate::ConvertFromV8(isolate(), GetParentWindow(), &parent)) + return; + + parent->child_windows_.Remove(ID()); +} + // static void Window::BuildPrototype(v8::Isolate* isolate, v8::Local prototype) { @@ -680,6 +774,7 @@ void Window::BuildPrototype(v8::Isolate* isolate, .SetMethod("showInactive", &Window::ShowInactive) .SetMethod("hide", &Window::Hide) .SetMethod("isVisible", &Window::IsVisible) + .SetMethod("isEnabled", &Window::IsEnabled) .SetMethod("maximize", &Window::Maximize) .SetMethod("unmaximize", &Window::Unmaximize) .SetMethod("isMaximized", &Window::IsMaximized) @@ -689,6 +784,12 @@ void Window::BuildPrototype(v8::Isolate* isolate, .SetMethod("setFullScreen", &Window::SetFullScreen) .SetMethod("isFullScreen", &Window::IsFullscreen) .SetMethod("setAspectRatio", &Window::SetAspectRatio) +#if !defined(OS_WIN) + .SetMethod("setParentWindow", &Window::SetParentWindow) +#endif + .SetMethod("getParentWindow", &Window::GetParentWindow) + .SetMethod("getChildWindows", &Window::GetChildWindows) + .SetMethod("isModal", &Window::IsModal) .SetMethod("getNativeWindowHandle", &Window::GetNativeWindowHandle) .SetMethod("getBounds", &Window::GetBounds) .SetMethod("setBounds", &Window::SetBounds) @@ -732,6 +833,7 @@ void Window::BuildPrototype(v8::Isolate* isolate, .SetMethod("setDocumentEdited", &Window::SetDocumentEdited) .SetMethod("isDocumentEdited", &Window::IsDocumentEdited) .SetMethod("setIgnoreMouseEvents", &Window::SetIgnoreMouseEvents) + .SetMethod("setFocusable", &Window::SetFocusable) .SetMethod("focusOnWebView", &Window::FocusOnWebView) .SetMethod("blurWebView", &Window::BlurWebView) .SetMethod("isWebViewFocused", &Window::IsWebViewFocused) diff --git a/atom/browser/api/atom_api_window.h b/atom/browser/api/atom_api_window.h index 23ab162261f..21ecca4c729 100644 --- a/atom/browser/api/atom_api_window.h +++ b/atom/browser/api/atom_api_window.h @@ -6,15 +6,16 @@ #define ATOM_BROWSER_API_ATOM_API_WINDOW_H_ #include +#include #include #include -#include "base/memory/scoped_ptr.h" #include "ui/gfx/image/image.h" #include "atom/browser/api/trackable_object.h" #include "atom/browser/native_window.h" #include "atom/browser/native_window_observer.h" #include "atom/common/api/atom_api_native_image.h" +#include "atom/common/key_weak_map.h" #include "native_mate/handle.h" class GURL; @@ -54,13 +55,18 @@ class Window : public mate::TrackableObject, Window(v8::Isolate* isolate, const mate::Dictionary& options); ~Window() override; + // TrackableObject: + void AfterInit(v8::Isolate* isolate) override; + // NativeWindowObserver: void WillCloseWindow(bool* prevent_default) override; + void WillDestoryNativeObject() override; void OnWindowClosed() override; void OnWindowBlur() override; void OnWindowFocus() override; void OnWindowShow() override; void OnWindowHide() override; + void OnReadyToShow() override; void OnWindowMaximize() override; void OnWindowUnmaximize() override; void OnWindowMinimize() override; @@ -93,6 +99,7 @@ class Window : public mate::TrackableObject, void ShowInactive(); void Hide(); bool IsVisible(); + bool IsEnabled(); void Maximize(); void Unmaximize(); bool IsMaximized(); @@ -146,6 +153,7 @@ class Window : public mate::TrackableObject, void SetDocumentEdited(bool edited); bool IsDocumentEdited(); void SetIgnoreMouseEvents(bool ignore); + void SetFocusable(bool focusable); void CapturePage(mate::Arguments* args); void SetProgressBar(double progress); void SetOverlayIcon(const gfx::Image& overlay, @@ -157,6 +165,10 @@ class Window : public mate::TrackableObject, void SetMenuBarVisibility(bool visible); bool IsMenuBarVisible(); void SetAspectRatio(double aspect_ratio, mate::Arguments* args); + void SetParentWindow(v8::Local value, mate::Arguments* args); + v8::Local GetParentWindow() const; + std::vector> GetChildWindows() const; + bool IsModal() const; v8::Local GetNativeWindowHandle(); #if defined(OS_WIN) @@ -179,6 +191,9 @@ class Window : public mate::TrackableObject, int32_t ID() const; v8::Local WebContents(v8::Isolate* isolate); + // Remove this window from parent window's |child_windows_|. + void RemoveFromParentChildWindows(); + #if defined(OS_WIN) typedef std::map MessageCallbackMap; MessageCallbackMap messages_callback_map_; @@ -186,6 +201,8 @@ class Window : public mate::TrackableObject, v8::Global web_contents_; v8::Global menu_; + v8::Global parent_window_; + KeyWeakMap child_windows_; api::WebContents* api_web_contents_; diff --git a/atom/browser/atom_browser_context.cc b/atom/browser/atom_browser_context.cc index 6f28cf6df7d..8268a777819 100644 --- a/atom/browser/atom_browser_context.cc +++ b/atom/browser/atom_browser_context.cc @@ -20,14 +20,15 @@ #include "atom/common/options_switches.h" #include "base/command_line.h" #include "base/files/file_path.h" +#include "base/memory/ptr_util.h" #include "base/path_service.h" -#include "components/prefs/pref_registry_simple.h" #include "base/strings/string_util.h" #include "base/strings/stringprintf.h" #include "base/threading/sequenced_worker_pool.h" #include "base/threading/worker_pool.h" #include "chrome/common/chrome_paths.h" #include "chrome/common/pref_names.h" +#include "components/prefs/pref_registry_simple.h" #include "content/public/browser/browser_thread.h" #include "content/public/common/url_constants.h" #include "content/public/common/user_agent.h" @@ -66,7 +67,6 @@ AtomBrowserContext::AtomBrowserContext(const std::string& partition, bool in_memory) : brightray::BrowserContext(partition, in_memory), cert_verifier_(new AtomCertVerifier), - job_factory_(new AtomURLRequestJobFactory), network_delegate_(new AtomNetworkDelegate) { } @@ -96,15 +96,15 @@ std::string AtomBrowserContext::GetUserAgent() { std::unique_ptr AtomBrowserContext::CreateURLRequestJobFactory( - content::ProtocolHandlerMap* handlers, - content::URLRequestInterceptorScopedVector* interceptors) { - std::unique_ptr job_factory(job_factory_); + content::ProtocolHandlerMap* protocol_handlers) { + std::unique_ptr job_factory( + new AtomURLRequestJobFactory); - for (auto& it : *handlers) { + for (auto& it : *protocol_handlers) { job_factory->SetProtocolHandler(it.first, - make_scoped_ptr(it.second.release())); + base::WrapUnique(it.second.release())); } - handlers->clear(); + protocol_handlers->clear(); job_factory->SetProtocolHandler( url::kDataScheme, make_scoped_ptr(new net::DataProtocolHandler)); @@ -132,16 +132,7 @@ AtomBrowserContext::CreateURLRequestJobFactory( make_scoped_ptr(new net::FtpProtocolHandler( new net::FtpNetworkLayer(host_resolver)))); - // Set up interceptors in the reverse order. - std::unique_ptr top_job_factory = - std::move(job_factory); - content::URLRequestInterceptorScopedVector::reverse_iterator it; - for (it = interceptors->rbegin(); it != interceptors->rend(); ++it) - top_job_factory.reset(new net::URLRequestInterceptingJobFactory( - std::move(top_job_factory), make_scoped_ptr(*it))); - interceptors->weak_clear(); - - return top_job_factory; + return std::move(job_factory); } net::HttpCache::BackendFactory* diff --git a/atom/browser/atom_browser_context.h b/atom/browser/atom_browser_context.h index 028f5d1e79c..c9b1de947fb 100644 --- a/atom/browser/atom_browser_context.h +++ b/atom/browser/atom_browser_context.h @@ -15,7 +15,6 @@ class AtomDownloadManagerDelegate; class AtomCertVerifier; class AtomNetworkDelegate; class AtomPermissionManager; -class AtomURLRequestJobFactory; class WebViewManager; class AtomBrowserContext : public brightray::BrowserContext { @@ -27,8 +26,7 @@ class AtomBrowserContext : public brightray::BrowserContext { net::NetworkDelegate* CreateNetworkDelegate() override; std::string GetUserAgent() override; std::unique_ptr CreateURLRequestJobFactory( - content::ProtocolHandlerMap* handlers, - content::URLRequestInterceptorScopedVector* interceptors) override; + content::ProtocolHandlerMap* protocol_handlers) override; net::HttpCache::BackendFactory* CreateHttpCacheBackendFactory( const base::FilePath& base_path) override; std::unique_ptr CreateCertVerifier() override; @@ -43,9 +41,6 @@ class AtomBrowserContext : public brightray::BrowserContext { void RegisterPrefs(PrefRegistrySimple* pref_registry) override; AtomCertVerifier* cert_verifier() const { return cert_verifier_; } - - AtomURLRequestJobFactory* job_factory() const { return job_factory_; } - AtomNetworkDelegate* network_delegate() const { return network_delegate_; } private: @@ -55,7 +50,6 @@ class AtomBrowserContext : public brightray::BrowserContext { // Managed by brightray::BrowserContext. AtomCertVerifier* cert_verifier_; - AtomURLRequestJobFactory* job_factory_; AtomNetworkDelegate* network_delegate_; DISALLOW_COPY_AND_ASSIGN(AtomBrowserContext); diff --git a/atom/browser/atom_browser_main_parts.cc b/atom/browser/atom_browser_main_parts.cc index 335e0576fcb..75f71d42314 100644 --- a/atom/browser/atom_browser_main_parts.cc +++ b/atom/browser/atom_browser_main_parts.cc @@ -148,7 +148,7 @@ void AtomBrowserMainParts::PreMainMessageLoopRun() { #endif #if !defined(OS_MACOSX) - // The corresponding call in OS X is in AtomApplicationDelegate. + // The corresponding call in macOS is in AtomApplicationDelegate. Browser::Get()->WillFinishLaunching(); Browser::Get()->DidFinishLaunching(); #endif diff --git a/atom/browser/auto_updater.cc b/atom/browser/auto_updater.cc index 7dbfc5a6feb..5a14eda2e14 100644 --- a/atom/browser/auto_updater.cc +++ b/atom/browser/auto_updater.cc @@ -17,7 +17,8 @@ void AutoUpdater::SetDelegate(Delegate* delegate) { } #if !defined(OS_MACOSX) || defined(MAS_BUILD) -void AutoUpdater::SetFeedURL(const std::string& url) { +void AutoUpdater::SetFeedURL(const std::string& url, + const HeaderMap& requestHeaders) { } void AutoUpdater::CheckForUpdates() { diff --git a/atom/browser/auto_updater.h b/atom/browser/auto_updater.h index d13c6f0c330..ad0b2cc18b9 100644 --- a/atom/browser/auto_updater.h +++ b/atom/browser/auto_updater.h @@ -5,6 +5,7 @@ #ifndef ATOM_BROWSER_AUTO_UPDATER_H_ #define ATOM_BROWSER_AUTO_UPDATER_H_ +#include #include #include "base/macros.h" @@ -42,11 +43,14 @@ class Delegate { class AutoUpdater { public: + typedef std::map HeaderMap; + // Gets/Sets the delegate. static Delegate* GetDelegate(); static void SetDelegate(Delegate* delegate); - static void SetFeedURL(const std::string& url); + static void SetFeedURL(const std::string& url, + const HeaderMap& requestHeaders); static void CheckForUpdates(); static void QuitAndInstall(); diff --git a/atom/browser/auto_updater_mac.mm b/atom/browser/auto_updater_mac.mm index ab996dda90a..005627e6c08 100644 --- a/atom/browser/auto_updater_mac.mm +++ b/atom/browser/auto_updater_mac.mm @@ -29,35 +29,42 @@ bool g_update_available = false; } // static -void AutoUpdater::SetFeedURL(const std::string& feed) { - if (g_updater == nil) { - Delegate* delegate = GetDelegate(); - if (!delegate) - return; +void AutoUpdater::SetFeedURL(const std::string& feed, + const HeaderMap& requestHeaders) { + Delegate* delegate = GetDelegate(); + if (!delegate) + return; - // Initialize the SQRLUpdater. - NSURL* url = [NSURL URLWithString:base::SysUTF8ToNSString(feed)]; - NSURLRequest* urlRequest = [NSURLRequest requestWithURL:url]; + NSURL* url = [NSURL URLWithString:base::SysUTF8ToNSString(feed)]; + NSMutableURLRequest* urlRequest = [NSMutableURLRequest requestWithURL:url]; - @try { - g_updater = [[SQRLUpdater alloc] initWithUpdateRequest:urlRequest]; - } @catch (NSException* error) { - delegate->OnError(base::SysNSStringToUTF8(error.reason)); - return; - } - - [[g_updater rac_valuesForKeyPath:@"state" observer:g_updater] - subscribeNext:^(NSNumber *stateNumber) { - int state = [stateNumber integerValue]; - // Dispatching the event on main thread. - dispatch_async(dispatch_get_main_queue(), ^{ - if (state == SQRLUpdaterStateCheckingForUpdate) - delegate->OnCheckingForUpdate(); - else if (state == SQRLUpdaterStateDownloadingUpdate) - delegate->OnUpdateAvailable(); - }); - }]; + for (const auto& it : requestHeaders) { + [urlRequest setValue:base::SysUTF8ToNSString(it.second) + forHTTPHeaderField:base::SysUTF8ToNSString(it.first)]; } + + if (g_updater) + [g_updater release]; + + // Initialize the SQRLUpdater. + @try { + g_updater = [[SQRLUpdater alloc] initWithUpdateRequest:urlRequest]; + } @catch (NSException* error) { + delegate->OnError(base::SysNSStringToUTF8(error.reason)); + return; + } + + [[g_updater rac_valuesForKeyPath:@"state" observer:g_updater] + subscribeNext:^(NSNumber *stateNumber) { + int state = [stateNumber integerValue]; + // Dispatching the event on main thread. + dispatch_async(dispatch_get_main_queue(), ^{ + if (state == SQRLUpdaterStateCheckingForUpdate) + delegate->OnCheckingForUpdate(); + else if (state == SQRLUpdaterStateDownloadingUpdate) + delegate->OnUpdateAvailable(); + }); + }]; } // static diff --git a/atom/browser/browser_mac.mm b/atom/browser/browser_mac.mm index 4561eab8c95..a50de2a07f6 100644 --- a/atom/browser/browser_mac.mm +++ b/atom/browser/browser_mac.mm @@ -58,7 +58,7 @@ bool Browser::RemoveAsDefaultProtocolClient(const std::string& protocol) { if (!bundleList) { return false; } - // On Mac OS X, we can't query the default, but the handlers list seems to put + // On macOS, we can't query the default, but the handlers list seems to put // Apple's defaults first, so we'll use the first option that isn't our bundle CFStringRef other = nil; for (CFIndex i = 0; i < CFArrayGetCount(bundleList); i++) { diff --git a/atom/browser/browser_observer.h b/atom/browser/browser_observer.h index 41aeceb6375..6e85b599d03 100644 --- a/atom/browser/browser_observer.h +++ b/atom/browser/browser_observer.h @@ -33,7 +33,7 @@ class BrowserObserver { virtual void OnQuit() {} // The browser has opened a file by double clicking in Finder or dragging the - // file to the Dock icon. (OS X only) + // file to the Dock icon. (macOS only) virtual void OnOpenFile(bool* prevent_default, const std::string& file_path) {} @@ -53,7 +53,7 @@ class BrowserObserver { const base::DictionaryValue& request_details) {} #if defined(OS_MACOSX) - // The browser wants to resume a user activity via handoff. (OS X only) + // The browser wants to resume a user activity via handoff. (macOS only) virtual void OnContinueUserActivity( bool* prevent_default, const std::string& type, diff --git a/atom/browser/common_web_contents_delegate_mac.mm b/atom/browser/common_web_contents_delegate_mac.mm index 69117f19053..aa675408305 100644 --- a/atom/browser/common_web_contents_delegate_mac.mm +++ b/atom/browser/common_web_contents_delegate_mac.mm @@ -6,9 +6,14 @@ #import +#include "brightray/browser/mac/event_dispatching_window.h" #include "content/public/browser/native_web_keyboard_event.h" #include "ui/events/keycodes/keyboard_codes.h" +@interface NSWindow (EventDispatchingWindow) +- (void)redispatchKeyEvent:(NSEvent*)event; +@end + namespace atom { void CommonWebContentsDelegate::HandleKeyboardEvent( @@ -22,18 +27,8 @@ void CommonWebContentsDelegate::HandleKeyboardEvent( if (event.windowsKeyCode == ui::VKEY_ESCAPE && is_html_fullscreen()) ExitFullscreenModeForTab(source); - BOOL handled = [[NSApp mainMenu] performKeyEquivalent:event.os_event]; - if (!handled && event.os_event.window) { - // Handle the cmd+~ shortcut. - if ((event.os_event.modifierFlags & NSCommandKeyMask) /* cmd */ && - (event.os_event.keyCode == 50 /* ~ */)) { - if (event.os_event.modifierFlags & NSShiftKeyMask) { - [NSApp sendAction:@selector(_cycleWindowsReversed:) to:nil from:nil]; - } else { - [NSApp sendAction:@selector(_cycleWindows:) to:nil from:nil]; - } - } - } + if (event.os_event.window) + [event.os_event.window redispatchKeyEvent:event.os_event]; } } // namespace atom diff --git a/atom/browser/native_window.cc b/atom/browser/native_window.cc index e0224836dac..4eb72dfe08c 100644 --- a/atom/browser/native_window.cc +++ b/atom/browser/native_window.cc @@ -46,7 +46,8 @@ namespace atom { NativeWindow::NativeWindow( brightray::InspectableWebContents* inspectable_web_contents, - const mate::Dictionary& options) + const mate::Dictionary& options, + NativeWindow* parent) : content::WebContentsObserver(inspectable_web_contents->GetWebContents()), has_frame_(true), transparent_(false), @@ -56,12 +57,17 @@ NativeWindow::NativeWindow( sheet_offset_x_(0.0), sheet_offset_y_(0.0), aspect_ratio_(0.0), + parent_(parent), + is_modal_(false), inspectable_web_contents_(inspectable_web_contents), weak_factory_(this) { options.Get(options::kFrame, &has_frame_); options.Get(options::kTransparent, &transparent_); options.Get(options::kEnableLargerThanScreen, &enable_larger_than_screen_); + if (parent) + options.Get("modal", &is_modal_); + // Tell the content module to initialize renderer widget with transparent // mode. ui::GpuSwitchingManager::SetTransparent(transparent_); @@ -153,7 +159,7 @@ void NativeWindow::InitFromOptions(const mate::Dictionary& options) { SetFullScreen(true); } bool skip; - if (options.Get(options::kSkipTaskbar, &skip) && skip) { + if (options.Get(options::kSkipTaskbar, &skip)) { SetSkipTaskbar(skip); } bool kiosk; @@ -282,6 +288,9 @@ bool NativeWindow::IsDocumentEdited() { return false; } +void NativeWindow::SetFocusable(bool focusable) { +} + void NativeWindow::SetMenu(ui::MenuModel* menu) { } @@ -289,6 +298,10 @@ bool NativeWindow::HasModalDialog() { return has_dialog_attached_; } +void NativeWindow::SetParentWindow(NativeWindow* parent) { + parent_ = parent; +} + void NativeWindow::FocusOnWebView() { web_contents()->GetRenderViewHost()->GetWidget()->Focus(); } @@ -394,6 +407,9 @@ void NativeWindow::CloseContents(content::WebContents* source) { inspectable_web_contents_ = nullptr; Observe(nullptr); + FOR_EACH_OBSERVER(NativeWindowObserver, observers_, + WillDestoryNativeObject()); + // When the web contents is gone, close the window immediately, but the // memory will not be freed until you call delete. // In this way, it would be safe to manage windows via smart pointers. If you @@ -557,6 +573,22 @@ void NativeWindow::BeforeUnloadDialogCancelled() { window_unresposive_closure_.Cancel(); } +void NativeWindow::DidFirstVisuallyNonEmptyPaint() { + if (IsVisible()) + return; + + // When there is a non-empty first paint, resize the RenderWidget to force + // Chromium to draw. + const auto view = web_contents()->GetRenderWidgetHostView(); + view->Show(); + view->SetSize(GetContentSize()); + + // Emit the ReadyToShow event in next tick in case of pending drawing work. + base::MessageLoop::current()->PostTask( + FROM_HERE, + base::Bind(&NativeWindow::NotifyReadyToShow, GetWeakPtr())); +} + bool NativeWindow::OnMessageReceived(const IPC::Message& message) { bool handled = true; IPC_BEGIN_MESSAGE_MAP(NativeWindow, message) @@ -592,12 +624,16 @@ void NativeWindow::ScheduleUnresponsiveEvent(int ms) { void NativeWindow::NotifyWindowUnresponsive() { window_unresposive_closure_.Cancel(); - if (!is_closed_ && !HasModalDialog()) + if (!is_closed_ && !HasModalDialog() && IsEnabled()) FOR_EACH_OBSERVER(NativeWindowObserver, observers_, OnRendererUnresponsive()); } +void NativeWindow::NotifyReadyToShow() { + FOR_EACH_OBSERVER(NativeWindowObserver, observers_, OnReadyToShow()); +} + void NativeWindow::OnCapturePageDone(const CapturePageCallback& callback, const SkBitmap& bitmap, content::ReadbackResponse response) { diff --git a/atom/browser/native_window.h b/atom/browser/native_window.h index c7d099fcadf..d3b6f8a2b0b 100644 --- a/atom/browser/native_window.h +++ b/atom/browser/native_window.h @@ -81,7 +81,8 @@ class NativeWindow : public base::SupportsUserData, // managing the window's live. static NativeWindow* Create( brightray::InspectableWebContents* inspectable_web_contents, - const mate::Dictionary& options); + const mate::Dictionary& options, + NativeWindow* parent = nullptr); // Find a window from its WebContents static NativeWindow* FromWebContents(content::WebContents* web_contents); @@ -97,6 +98,7 @@ class NativeWindow : public base::SupportsUserData, virtual void ShowInactive() = 0; virtual void Hide() = 0; virtual bool IsVisible() = 0; + virtual bool IsEnabled() = 0; virtual void Maximize() = 0; virtual void Unmaximize() = 0; virtual bool IsMaximized() = 0; @@ -155,8 +157,10 @@ class NativeWindow : public base::SupportsUserData, virtual void SetDocumentEdited(bool edited); virtual bool IsDocumentEdited(); virtual void SetIgnoreMouseEvents(bool ignore) = 0; + virtual void SetFocusable(bool focusable); virtual void SetMenu(ui::MenuModel* menu); virtual bool HasModalDialog(); + virtual void SetParentWindow(NativeWindow* parent); virtual gfx::NativeWindow GetNativeWindow() = 0; virtual gfx::AcceleratedWidget GetAcceleratedWidget() = 0; @@ -254,9 +258,13 @@ class NativeWindow : public base::SupportsUserData, has_dialog_attached_ = has_dialog_attached; } + NativeWindow* parent() const { return parent_; } + bool is_modal() const { return is_modal_; } + protected: NativeWindow(brightray::InspectableWebContents* inspectable_web_contents, - const mate::Dictionary& options); + const mate::Dictionary& options, + NativeWindow* parent); // Convert draggable regions in raw format to SkRegion format. Caller is // responsible for deleting the returned SkRegion instance. @@ -274,6 +282,7 @@ class NativeWindow : public base::SupportsUserData, // content::WebContentsObserver: void RenderViewCreated(content::RenderViewHost* render_view_host) override; void BeforeUnloadDialogCancelled() override; + void DidFirstVisuallyNonEmptyPaint() override; bool OnMessageReceived(const IPC::Message& message) override; private: @@ -283,6 +292,9 @@ class NativeWindow : public base::SupportsUserData, // Dispatch unresponsive event to observers. void NotifyWindowUnresponsive(); + // Dispatch ReadyToShow event to observers. + void NotifyReadyToShow(); + // Called when CapturePage has done. void OnCapturePageDone(const CapturePageCallback& callback, const SkBitmap& bitmap, @@ -315,7 +327,7 @@ class NativeWindow : public base::SupportsUserData, base::CancelableClosure window_unresposive_closure_; // Used to display sheets at the appropriate horizontal and vertical offsets - // on OS X. + // on macOS. double sheet_offset_x_; double sheet_offset_y_; @@ -324,6 +336,12 @@ class NativeWindow : public base::SupportsUserData, double aspect_ratio_; gfx::Size aspect_ratio_extraSize_; + // The parent window, it is guaranteed to be valid during this window's life. + NativeWindow* parent_; + + // Is this a modal window. + bool is_modal_; + // The page this window is viewing. brightray::InspectableWebContents* inspectable_web_contents_; diff --git a/atom/browser/native_window_mac.h b/atom/browser/native_window_mac.h index 27857239e8c..af99b3912e1 100644 --- a/atom/browser/native_window_mac.h +++ b/atom/browser/native_window_mac.h @@ -22,7 +22,8 @@ namespace atom { class NativeWindowMac : public NativeWindow { public: NativeWindowMac(brightray::InspectableWebContents* inspectable_web_contents, - const mate::Dictionary& options); + const mate::Dictionary& options, + NativeWindow* parent); ~NativeWindowMac() override; // NativeWindow: @@ -34,6 +35,7 @@ class NativeWindowMac : public NativeWindow { void ShowInactive() override; void Hide() override; bool IsVisible() override; + bool IsEnabled() override; void Maximize() override; void Unmaximize() override; bool IsMaximized() override; @@ -78,6 +80,7 @@ class NativeWindowMac : public NativeWindow { bool IsDocumentEdited() override; void SetIgnoreMouseEvents(bool ignore) override; bool HasModalDialog() override; + void SetParentWindow(NativeWindow* parent) override; gfx::NativeWindow GetNativeWindow() override; gfx::AcceleratedWidget GetAcceleratedWidget() override; void SetProgressBar(double progress) override; @@ -96,9 +99,12 @@ class NativeWindowMac : public NativeWindow { void SetStyleMask(bool on, NSUInteger flag); void SetCollectionBehavior(bool on, NSUInteger flag); - bool should_hide_native_toolbar_in_fullscreen() const { - return should_hide_native_toolbar_in_fullscreen_; - } + enum TitleBarStyle { + NORMAL, + HIDDEN, + HIDDEN_INSET, + }; + TitleBarStyle title_bar_style() const { return title_bar_style_; } protected: // Return a vector of non-draggable regions that fill a window of size @@ -138,14 +144,8 @@ class NativeWindowMac : public NativeWindow { // The presentation options before entering kiosk mode. NSApplicationPresentationOptions kiosk_options_; - // The window title, for frameless windows we only set title when fullscreen. - std::string title_; - - // Force showing the buttons for frameless window. - bool force_show_buttons_; - - // Whether to hide the native toolbar under fullscreen mode. - bool should_hide_native_toolbar_in_fullscreen_; + // The "titleBarStyle" option. + TitleBarStyle title_bar_style_; DISALLOW_COPY_AND_ASSIGN(NativeWindowMac); }; diff --git a/atom/browser/native_window_mac.mm b/atom/browser/native_window_mac.mm index 8de4b109373..5f997ee9b6b 100644 --- a/atom/browser/native_window_mac.mm +++ b/atom/browser/native_window_mac.mm @@ -15,6 +15,7 @@ #include "base/strings/sys_string_conversions.h" #include "brightray/browser/inspectable_web_contents.h" #include "brightray/browser/inspectable_web_contents_view.h" +#include "brightray/browser/mac/event_dispatching_window.h" #include "content/public/browser/browser_accessibility_state.h" #include "content/public/browser/web_contents.h" #include "content/public/browser/render_view_host.h" @@ -184,7 +185,7 @@ bool ScopedDisableResize::disable_resize_ = false; - (void)windowWillEnterFullScreen:(NSNotification*)notification { // Hide the native toolbar before entering fullscreen, so there is no visual // artifacts. - if (shell_->should_hide_native_toolbar_in_fullscreen()) { + if (shell_->title_bar_style() == atom::NativeWindowMac::HIDDEN_INSET) { NSWindow* window = shell_->GetNativeWindow(); [window setToolbar:nil]; } @@ -193,16 +194,20 @@ bool ScopedDisableResize::disable_resize_ = false; - (void)windowDidEnterFullScreen:(NSNotification*)notification { shell_->NotifyWindowEnterFullScreen(); - // For frameless window we don't set title for normal mode since the title - // bar is expected to be empty, but after entering fullscreen mode we have - // to set one, because title bar is visible here. + // For frameless window we don't show set title for normal mode since the + // titlebar is expected to be empty, but after entering fullscreen mode we + // have to set one, because title bar is visible here. NSWindow* window = shell_->GetNativeWindow(); - if (shell_->transparent() || !shell_->has_frame()) - [window setTitle:base::SysUTF8ToNSString(shell_->GetTitle())]; + if ((shell_->transparent() || !shell_->has_frame()) && + // FIXME(zcbenz): Showing titlebar for hiddenInset window is weird under + // fullscreen mode. + shell_->title_bar_style() != atom::NativeWindowMac::HIDDEN_INSET) { + [window setTitleVisibility:NSWindowTitleVisible]; + } // Restore the native toolbar immediately after entering fullscreen, if we do // this before leaving fullscreen, traffic light buttons will be jumping. - if (shell_->should_hide_native_toolbar_in_fullscreen()) { + if (shell_->title_bar_style() == atom::NativeWindowMac::HIDDEN_INSET) { base::scoped_nsobject toolbar( [[NSToolbar alloc] initWithIdentifier:@"titlebarStylingToolbar"]); [toolbar setShowsBaselineSeparator:NO]; @@ -215,18 +220,20 @@ bool ScopedDisableResize::disable_resize_ = false; } - (void)windowWillExitFullScreen:(NSNotification*)notification { - // Restore the title bar to empty. + // Restore the titlebar visibility. NSWindow* window = shell_->GetNativeWindow(); - if (shell_->transparent() || !shell_->has_frame()) - [window setTitle:@""]; + if ((shell_->transparent() || !shell_->has_frame()) && + shell_->title_bar_style() != atom::NativeWindowMac::HIDDEN_INSET) { + [window setTitleVisibility:NSWindowTitleHidden]; + } // Turn off the style for toolbar. - if (shell_->should_hide_native_toolbar_in_fullscreen()) + if (shell_->title_bar_style() == atom::NativeWindowMac::HIDDEN_INSET) shell_->SetStyleMask(false, NSFullSizeContentViewWindowMask); } - (void)windowDidExitFullScreen:(NSNotification*)notification { - // For certain versions of OS X the fullscreen button will automatically show + // For certain versions of macOS the fullscreen button will automatically show // after exiting fullscreen mode. if (!shell_->has_frame()) { NSWindow* window = shell_->GetNativeWindow(); @@ -264,7 +271,7 @@ bool ScopedDisableResize::disable_resize_ = false; @end -@interface AtomNSWindow : NSWindow { +@interface AtomNSWindow : EventDispatchingWindow { @private atom::NativeWindowMac* shell_; bool enable_larger_than_screen_; @@ -395,16 +402,39 @@ bool ScopedDisableResize::disable_resize_ = false; @end +namespace mate { + +template<> +struct Converter { + static bool FromV8(v8::Isolate* isolate, v8::Handle val, + atom::NativeWindowMac::TitleBarStyle* out) { + std::string title_bar_style; + if (!ConvertFromV8(isolate, val, &title_bar_style)) + return false; + if (title_bar_style == "hidden") { + *out = atom::NativeWindowMac::HIDDEN; + } else if (title_bar_style == "hidden-inset" || // Deprecate this after 2.0 + title_bar_style == "hiddenInset") { + *out = atom::NativeWindowMac::HIDDEN_INSET; + } else { + return false; + } + return true; + } +}; + +} // namespace mate + namespace atom { NativeWindowMac::NativeWindowMac( brightray::InspectableWebContents* web_contents, - const mate::Dictionary& options) - : NativeWindow(web_contents, options), + const mate::Dictionary& options, + NativeWindow* parent) + : NativeWindow(web_contents, options, parent), is_kiosk_(false), attention_request_id_(0), - force_show_buttons_(false), - should_hide_native_toolbar_in_fullscreen_(false) { + title_bar_style_(NORMAL) { int width = 800, height = 600; options.Get(options::kWidth, &width); options.Get(options::kHeight, &height); @@ -429,9 +459,8 @@ NativeWindowMac::NativeWindowMac( options.Get(options::kClosable, &closable); // New title bar styles are available in Yosemite or newer - std::string titleBarStyle; if (base::mac::IsOSYosemiteOrLater()) - options.Get(options::kTitleBarStyle, &titleBarStyle); + options.Get(options::kTitleBarStyle, &title_bar_style_); std::string windowType; options.Get(options::kType, &windowType); @@ -451,10 +480,9 @@ NativeWindowMac::NativeWindowMac( if (closable) { styleMask |= NSClosableWindowMask; } - if ((titleBarStyle == "hidden") || (titleBarStyle == "hidden-inset")) { + if (title_bar_style_ != NORMAL) { // The window without titlebar is treated the same with frameless window. set_has_frame(false); - force_show_buttons_ = true; } if (!useStandardWindow || transparent() || !has_frame()) { styleMask |= NSTexturedBackgroundWindowMask; @@ -474,9 +502,12 @@ NativeWindowMac::NativeWindowMac( window_delegate_.reset([[AtomNSWindowDelegate alloc] initWithShell:this]); [window_ setDelegate:window_delegate_]; + // Only use native parent window for non-modal windows. + if (parent && !is_modal()) { + SetParentWindow(parent); + } + if (transparent()) { - // Make window has transparent background. - [window_ setOpaque:NO]; // Setting the background color to clear will also hide the shadow. [window_ setBackgroundColor:[NSColor clearColor]]; } @@ -490,25 +521,30 @@ NativeWindowMac::NativeWindowMac( NSWindowCollectionBehaviorIgnoresCycle)]; } - // Remove non-transparent corners, see http://git.io/vfonD. - if (!has_frame()) + bool focusable; + if (options.Get(options::kFocusable, &focusable) && !focusable) + [window_ setDisableKeyOrMainWindow:YES]; + + if (transparent() || !has_frame()) { + // Don't show title bar. + [window_ setTitleVisibility:NSWindowTitleHidden]; + // Remove non-transparent corners, see http://git.io/vfonD. [window_ setOpaque:NO]; + } // We will manage window's lifetime ourselves. [window_ setReleasedWhenClosed:NO]; // Hide the title bar. - if (titleBarStyle == "hidden-inset") { + if (title_bar_style_ == HIDDEN_INSET) { [window_ setTitlebarAppearsTransparent:YES]; - [window_ setTitleVisibility:NSWindowTitleHidden]; base::scoped_nsobject toolbar( [[NSToolbar alloc] initWithIdentifier:@"titlebarStylingToolbar"]); [toolbar setShowsBaselineSeparator:NO]; [window_ setToolbar:toolbar]; - should_hide_native_toolbar_in_fullscreen_ = true; } - // On OS X the initial window size doesn't include window frame. + // On macOS the initial window size doesn't include window frame. bool use_content_size = false; options.Get(options::kUseContentSize, &use_content_size); if (!has_frame() || !use_content_size) @@ -565,6 +601,12 @@ NativeWindowMac::~NativeWindowMac() { } void NativeWindowMac::Close() { + // When this is a sheet showing, performClose won't work. + if (is_modal() && parent() && IsVisible()) { + CloseImmediately(); + return; + } + if (!IsClosable()) { WindowList::WindowCloseCancelled(this); return; @@ -594,6 +636,12 @@ bool NativeWindowMac::IsFocused() { } void NativeWindowMac::Show() { + if (is_modal() && parent()) { + [parent()->GetNativeWindow() beginSheet:window_ + completionHandler:^(NSModalResponse) {}]; + return; + } + // This method is supposed to put focus on window, however if the app does not // have focus then "makeKeyAndOrderFront" will only show the window. [NSApp activateIgnoringOtherApps:YES]; @@ -606,6 +654,12 @@ void NativeWindowMac::ShowInactive() { } void NativeWindowMac::Hide() { + if (is_modal() && parent()) { + [window_ orderOut:nil]; + [parent()->GetNativeWindow() endSheet:window_]; + return; + } + [window_ orderOut:nil]; } @@ -613,6 +667,10 @@ bool NativeWindowMac::IsVisible() { return [window_ isVisible]; } +bool NativeWindowMac::IsEnabled() { + return [window_ attachedSheet] == nil; +} + void NativeWindowMac::Maximize() { if (IsMaximized()) return; @@ -794,17 +852,11 @@ void NativeWindowMac::Center() { } void NativeWindowMac::SetTitle(const std::string& title) { - title_ = title; - - // We don't want the title to show in transparent or frameless window. - if (transparent() || !has_frame()) - return; - [window_ setTitle:base::SysUTF8ToNSString(title)]; } std::string NativeWindowMac::GetTitle() { - return title_; + return base::SysNSStringToUTF8([window_ title]);; } void NativeWindowMac::FlashFrame(bool flash) { @@ -887,6 +939,21 @@ bool NativeWindowMac::HasModalDialog() { return [window_ attachedSheet] != nil; } +void NativeWindowMac::SetParentWindow(NativeWindow* parent) { + if (is_modal()) + return; + + NativeWindow::SetParentWindow(parent); + + // Remove current parent window. + if ([window_ parentWindow]) + [[window_ parentWindow] removeChildWindow:window_]; + + // Set new current window. + if (parent) + [parent->GetNativeWindow() addChildWindow:window_ ordered:NSWindowAbove]; +} + gfx::NativeWindow NativeWindowMac::GetNativeWindow() { return window_; } @@ -903,7 +970,9 @@ void NativeWindowMac::SetProgressBar(double progress) { NSImageView* image_view = [[NSImageView alloc] init]; [image_view setImage:[NSApp applicationIconImage]]; [dock_tile setContentView:image_view]; + } + if ([[dock_tile.contentView subviews] count] == 0) { NSProgressIndicator* progress_indicator = [[AtomProgressBar alloc] initWithFrame:NSMakeRect(0.0f, 0.0f, dock_tile.size.width, 15.0)]; [progress_indicator setStyle:NSProgressIndicatorBarStyle]; @@ -912,7 +981,7 @@ void NativeWindowMac::SetProgressBar(double progress) { [progress_indicator setMinValue:0]; [progress_indicator setMaxValue:1]; [progress_indicator setHidden:NO]; - [image_view addSubview:progress_indicator]; + [dock_tile.contentView addSubview:progress_indicator]; } NSProgressIndicator* progress_indicator = @@ -1008,7 +1077,7 @@ void NativeWindowMac::InstallView() { [view setFrame:[content_view_ bounds]]; [content_view_ addSubview:view]; - if (force_show_buttons_) + if (title_bar_style_ != NORMAL) return; // Hide the window buttons. @@ -1016,7 +1085,7 @@ void NativeWindowMac::InstallView() { [[window_ standardWindowButton:NSWindowMiniaturizeButton] setHidden:YES]; [[window_ standardWindowButton:NSWindowCloseButton] setHidden:YES]; - // Some third-party OS X utilities check the zoom button's enabled state to + // Some third-party macOS utilities check the zoom button's enabled state to // determine whether to show custom UI on hover, so we disable it here to // prevent them from doing so in a frameless app window. [[window_ standardWindowButton:NSWindowZoomButton] setEnabled:NO]; @@ -1086,7 +1155,7 @@ void NativeWindowMac::SetStyleMask(bool on, NSUInteger flag) { else [window_ setStyleMask:[window_ styleMask] & (~flag)]; // Change style mask will make the zoom button revert to default, probably - // a bug of Cocoa or OS X. + // a bug of Cocoa or macOS. if (!zoom_button_enabled) SetMaximizable(false); } @@ -1098,7 +1167,7 @@ void NativeWindowMac::SetCollectionBehavior(bool on, NSUInteger flag) { else [window_ setCollectionBehavior:[window_ collectionBehavior] & (~flag)]; // Change collectionBehavior will make the zoom button revert to default, - // probably a bug of Cocoa or OS X. + // probably a bug of Cocoa or macOS. if (!zoom_button_enabled) SetMaximizable(false); } @@ -1106,8 +1175,9 @@ void NativeWindowMac::SetCollectionBehavior(bool on, NSUInteger flag) { // static NativeWindow* NativeWindow::Create( brightray::InspectableWebContents* inspectable_web_contents, - const mate::Dictionary& options) { - return new NativeWindowMac(inspectable_web_contents, options); + const mate::Dictionary& options, + NativeWindow* parent) { + return new NativeWindowMac(inspectable_web_contents, options, parent); } } // namespace atom diff --git a/atom/browser/native_window_observer.h b/atom/browser/native_window_observer.h index cfbae95bda1..16541d09090 100644 --- a/atom/browser/native_window_observer.h +++ b/atom/browser/native_window_observer.h @@ -33,6 +33,9 @@ class NativeWindowObserver { // Called when the window is gonna closed. virtual void WillCloseWindow(bool* prevent_default) {} + // Called before the native window object is going to be destroyed. + virtual void WillDestoryNativeObject() {} + // Called when the window is closed. virtual void OnWindowClosed() {} @@ -48,6 +51,9 @@ class NativeWindowObserver { // Called when window is hidden. virtual void OnWindowHide() {} + // Called when window is ready to show. + virtual void OnReadyToShow() {} + // Called when window state changed. virtual void OnWindowMaximize() {} virtual void OnWindowUnmaximize() {} diff --git a/atom/browser/native_window_views.cc b/atom/browser/native_window_views.cc index 29c4187a124..1feb9618ac6 100644 --- a/atom/browser/native_window_views.cc +++ b/atom/browser/native_window_views.cc @@ -29,6 +29,7 @@ #include "ui/views/window/client_view.h" #include "ui/views/widget/native_widget_private.h" #include "ui/views/widget/widget.h" +#include "ui/wm/core/window_util.h" #include "ui/wm/core/shadow_types.h" #if defined(USE_X11) @@ -36,6 +37,7 @@ #include "atom/browser/ui/views/global_menu_bar_x11.h" #include "atom/browser/ui/views/frameless_view.h" #include "atom/browser/ui/views/native_frame_view.h" +#include "atom/browser/ui/x/event_disabler.h" #include "atom/browser/ui/x/window_state_watcher.h" #include "atom/browser/ui/x/x_window_utils.h" #include "base/strings/string_util.h" @@ -125,14 +127,16 @@ class NativeWindowClientView : public views::ClientView { NativeWindowViews::NativeWindowViews( brightray::InspectableWebContents* web_contents, - const mate::Dictionary& options) - : NativeWindow(web_contents, options), + const mate::Dictionary& options, + NativeWindow* parent) + : NativeWindow(web_contents, options, parent), window_(new views::Widget), web_view_(inspectable_web_contents()->GetView()->GetView()), menu_bar_autohide_(false), menu_bar_visible_(false), menu_bar_alt_pressed_(false), keyboard_event_handler_(new views::UnhandledKeyboardEventHandler), + disable_count_(0), use_content_size_(false), movable_(true), resizable_(true), @@ -181,7 +185,14 @@ NativeWindowViews::NativeWindowViews( if (transparent() && !has_frame()) params.shadow_type = views::Widget::InitParams::SHADOW_TYPE_NONE; + bool focusable; + if (options.Get(options::kFocusable, &focusable) && !focusable) + params.activatable = views::Widget::InitParams::ACTIVATABLE_NO; + #if defined(OS_WIN) + if (parent) + params.parent = parent->GetNativeWindow(); + params.native_widget = new views::DesktopNativeWidgetAura(window_.get()); atom_desktop_window_tree_host_win_ = new AtomDesktopWindowTreeHostWin( @@ -232,12 +243,23 @@ NativeWindowViews::NativeWindowViews( state_atom_list.push_back(GetAtom("_NET_WM_STATE_FULLSCREEN")); } + std::string window_type; + options.Get(options::kType, &window_type); + + if (parent) { + SetParentWindow(parent); + // Force using dialog type for child window. + window_type = "dialog"; + // Modal window needs the _NET_WM_STATE_MODAL hint. + if (is_modal()) + state_atom_list.push_back(GetAtom("_NET_WM_STATE_MODAL")); + } + ui::SetAtomArrayProperty(GetAcceleratedWidget(), "_NET_WM_STATE", "ATOM", state_atom_list); // Set the _NET_WM_WINDOW_TYPE. - std::string window_type; - if (options.Get(options::kType, &window_type)) + if (!window_type.empty()) SetWindowType(GetAcceleratedWidget(), window_type); #endif @@ -333,6 +355,9 @@ bool NativeWindowViews::IsFocused() { } void NativeWindowViews::Show() { + if (is_modal() && NativeWindow::parent()) + static_cast(NativeWindow::parent())->SetEnabled(false); + window_->native_widget_private()->ShowWithWindowState(GetRestoredState()); NotifyWindowShow(); @@ -355,6 +380,9 @@ void NativeWindowViews::ShowInactive() { } void NativeWindowViews::Hide() { + if (is_modal() && NativeWindow::parent()) + static_cast(NativeWindow::parent())->SetEnabled(true); + window_->Hide(); NotifyWindowHide(); @@ -369,6 +397,14 @@ bool NativeWindowViews::IsVisible() { return window_->IsVisible(); } +bool NativeWindowViews::IsEnabled() { +#if defined(OS_WIN) + return ::IsWindowEnabled(GetAcceleratedWidget()); +#elif defined(USE_X11) + return !event_disabler_.get(); +#endif +} + void NativeWindowViews::Maximize() { if (IsVisible()) window_->Maximize(); @@ -692,6 +728,19 @@ void NativeWindowViews::SetIgnoreMouseEvents(bool ignore) { #endif } +void NativeWindowViews::SetFocusable(bool focusable) { +#if defined(OS_WIN) + LONG ex_style = ::GetWindowLong(GetAcceleratedWidget(), GWL_EXSTYLE); + if (focusable) + ex_style &= ~WS_EX_NOACTIVATE; + else + ex_style |= WS_EX_NOACTIVATE; + ::SetWindowLong(GetAcceleratedWidget(), GWL_EXSTYLE, ex_style); + SetSkipTaskbar(!focusable); + Focus(false); +#endif +} + void NativeWindowViews::SetMenu(ui::MenuModel* menu_model) { if (menu_model == nullptr) { // Remove accelerators @@ -755,6 +804,32 @@ void NativeWindowViews::SetMenu(ui::MenuModel* menu_model) { Layout(); } +void NativeWindowViews::SetParentWindow(NativeWindow* parent) { + NativeWindow::SetParentWindow(parent); + +#if defined(USE_X11) + XDisplay* xdisplay = gfx::GetXDisplay(); + XSetTransientForHint( + xdisplay, GetAcceleratedWidget(), + parent? parent->GetAcceleratedWidget() : DefaultRootWindow(xdisplay)); +#elif defined(OS_WIN) && defined(DEBUG) + // Should work, but does not, it seems that the views toolkit doesn't support + // reparenting on desktop. + if (parent) { + ::SetParent(GetAcceleratedWidget(), parent->GetAcceleratedWidget()); + views::Widget::ReparentNativeView(GetNativeWindow(), + parent->GetNativeWindow()); + wm::AddTransientChild(parent->GetNativeWindow(), GetNativeWindow()); + } else { + if (!GetNativeWindow()->parent()) + return; + ::SetParent(GetAcceleratedWidget(), NULL); + views::Widget::ReparentNativeView(GetNativeWindow(), nullptr); + wm::RemoveTransientChild(GetNativeWindow()->parent(), GetNativeWindow()); + } +#endif +} + gfx::NativeWindow NativeWindowViews::GetNativeWindow() { return window_->GetNativeWindow(); } @@ -850,6 +925,33 @@ void NativeWindowViews::SetIcon(const gfx::ImageSkia& icon) { } #endif +void NativeWindowViews::SetEnabled(bool enable) { + // Handle multiple calls of SetEnabled correctly. + if (enable) { + --disable_count_; + if (disable_count_ != 0) + return; + } else { + ++disable_count_; + if (disable_count_ != 1) + return; + } + +#if defined(OS_WIN) + ::EnableWindow(GetAcceleratedWidget(), enable); +#elif defined(USE_X11) + views::DesktopWindowTreeHostX11* tree_host = + views::DesktopWindowTreeHostX11::GetHostForXID(GetAcceleratedWidget()); + if (enable) { + tree_host->RemoveEventRewriter(event_disabler_.get()); + event_disabler_.reset(); + } else { + event_disabler_.reset(new EventDisabler); + tree_host->AddEventRewriter(event_disabler_.get()); + } +#endif +} + void NativeWindowViews::OnWidgetActivationChanged( views::Widget* widget, bool active) { if (widget != window_.get()) @@ -883,6 +985,15 @@ void NativeWindowViews::OnWidgetBoundsChanged( } void NativeWindowViews::DeleteDelegate() { + if (is_modal() && NativeWindow::parent()) { + NativeWindowViews* parent = + static_cast(NativeWindow::parent()); + // Enable parent window after current window gets closed. + parent->SetEnabled(true); + // Focus on parent window. + parent->Focus(true); + } + NotifyWindowClosed(); } @@ -1093,8 +1204,9 @@ ui::WindowShowState NativeWindowViews::GetRestoredState() { // static NativeWindow* NativeWindow::Create( brightray::InspectableWebContents* inspectable_web_contents, - const mate::Dictionary& options) { - return new NativeWindowViews(inspectable_web_contents, options); + const mate::Dictionary& options, + NativeWindow* parent) { + return new NativeWindowViews(inspectable_web_contents, options, parent); } } // namespace atom diff --git a/atom/browser/native_window_views.h b/atom/browser/native_window_views.h index 6a26c14e008..69d3d27a35d 100644 --- a/atom/browser/native_window_views.h +++ b/atom/browser/native_window_views.h @@ -32,6 +32,8 @@ class WindowStateWatcher; #if defined(OS_WIN) class AtomDesktopWindowTreeHostWin; +#elif defined(USE_X11) +class EventDisabler; #endif class NativeWindowViews : public NativeWindow, @@ -42,7 +44,8 @@ class NativeWindowViews : public NativeWindow, public views::WidgetObserver { public: NativeWindowViews(brightray::InspectableWebContents* inspectable_web_contents, - const mate::Dictionary& options); + const mate::Dictionary& options, + NativeWindow* parent); ~NativeWindowViews() override; // NativeWindow: @@ -54,6 +57,7 @@ class NativeWindowViews : public NativeWindow, void ShowInactive() override; void Hide() override; bool IsVisible() override; + bool IsEnabled() override; void Maximize() override; void Unmaximize() override; bool IsMaximized() override; @@ -92,7 +96,9 @@ class NativeWindowViews : public NativeWindow, void SetHasShadow(bool has_shadow) override; bool HasShadow() override; void SetIgnoreMouseEvents(bool ignore) override; + void SetFocusable(bool focusable) override; void SetMenu(ui::MenuModel* menu_model) override; + void SetParentWindow(NativeWindow* parent) override; gfx::NativeWindow GetNativeWindow() override; void SetOverlayIcon(const gfx::Image& overlay, const std::string& description) override; @@ -112,6 +118,8 @@ class NativeWindowViews : public NativeWindow, void SetIcon(const gfx::ImageSkia& icon); #endif + void SetEnabled(bool enable); + views::Widget* widget() const { return window_.get(); } #if defined(OS_WIN) @@ -186,6 +194,9 @@ class NativeWindowViews : public NativeWindow, // Handles window state events. std::unique_ptr window_state_watcher_; + // To disable the mouse events. + std::unique_ptr event_disabler_; + // The "resizable" flag on Linux is implemented by setting size constraints, // we need to make sure size constraints are restored when window becomes // resizable again. @@ -219,6 +230,9 @@ class NativeWindowViews : public NativeWindow, // Map from accelerator to menu item's command id. accelerator_util::AcceleratorTable accelerator_table_; + // How many times the Disable has been called. + int disable_count_; + bool use_content_size_; bool movable_; bool resizable_; diff --git a/atom/browser/net/atom_url_request_job_factory.cc b/atom/browser/net/atom_url_request_job_factory.cc index aff2565814b..d78b7026e56 100644 --- a/atom/browser/net/atom_url_request_job_factory.cc +++ b/atom/browser/net/atom_url_request_job_factory.cc @@ -5,6 +5,7 @@ #include "atom/browser/net/atom_url_request_job_factory.h" +#include "base/memory/ptr_util.h" #include "base/stl_util.h" #include "content/public/browser/browser_thread.h" #include "net/base/load_flags.h" @@ -41,14 +42,24 @@ bool AtomURLRequestJobFactory::SetProtocolHandler( return true; } -std::unique_ptr AtomURLRequestJobFactory::ReplaceProtocol( +bool AtomURLRequestJobFactory::InterceptProtocol( const std::string& scheme, std::unique_ptr protocol_handler) { - if (!ContainsKey(protocol_handler_map_, scheme)) - return nullptr; + if (!ContainsKey(protocol_handler_map_, scheme) || + ContainsKey(original_protocols_, scheme)) + return false; ProtocolHandler* original_protocol_handler = protocol_handler_map_[scheme]; protocol_handler_map_[scheme] = protocol_handler.release(); - return make_scoped_ptr(original_protocol_handler); + original_protocols_.set(scheme, base::WrapUnique(original_protocol_handler)); + return true; +} + +bool AtomURLRequestJobFactory::UninterceptProtocol(const std::string& scheme) { + if (!original_protocols_.contains(scheme)) + return false; + protocol_handler_map_[scheme] = + original_protocols_.take_and_erase(scheme).release(); + return true; } ProtocolHandler* AtomURLRequestJobFactory::GetProtocolHandler( diff --git a/atom/browser/net/atom_url_request_job_factory.h b/atom/browser/net/atom_url_request_job_factory.h index e3dbd775424..ea2710bb4cf 100644 --- a/atom/browser/net/atom_url_request_job_factory.h +++ b/atom/browser/net/atom_url_request_job_factory.h @@ -7,11 +7,11 @@ #define ATOM_BROWSER_NET_ATOM_URL_REQUEST_JOB_FACTORY_H_ #include +#include #include #include -#include "base/memory/scoped_ptr.h" -#include "base/synchronization/lock.h" +#include "base/containers/scoped_ptr_hash_map.h" #include "net/url_request/url_request_job_factory.h" namespace atom { @@ -27,11 +27,11 @@ class AtomURLRequestJobFactory : public net::URLRequestJobFactory { bool SetProtocolHandler(const std::string& scheme, std::unique_ptr protocol_handler); - // Intercepts the ProtocolHandler for a scheme. Returns the original protocol - // handler on success, otherwise returns NULL. - std::unique_ptr ReplaceProtocol( + // Intercepts the ProtocolHandler for a scheme. + bool InterceptProtocol( const std::string& scheme, std::unique_ptr protocol_handler); + bool UninterceptProtocol(const std::string& scheme); // Returns the protocol handler registered with scheme. ProtocolHandler* GetProtocolHandler(const std::string& scheme) const; @@ -60,6 +60,12 @@ class AtomURLRequestJobFactory : public net::URLRequestJobFactory { ProtocolHandlerMap protocol_handler_map_; + // Map that stores the original protocols of schemes. + using OriginalProtocolsMap = base::ScopedPtrHashMap< + std::string, std::unique_ptr>; + // Can only be accessed in IO thread. + OriginalProtocolsMap original_protocols_; + DISALLOW_COPY_AND_ASSIGN(AtomURLRequestJobFactory); }; diff --git a/atom/browser/resources/mac/Info.plist b/atom/browser/resources/mac/Info.plist index 7fda39ce35e..46898637c51 100644 --- a/atom/browser/resources/mac/Info.plist +++ b/atom/browser/resources/mac/Info.plist @@ -17,9 +17,9 @@ CFBundleIconFile electron.icns CFBundleVersion - 1.2.2 + 1.2.3 CFBundleShortVersionString - 1.2.2 + 1.2.3 LSApplicationCategoryType public.app-category.developer-tools LSMinimumSystemVersion diff --git a/atom/browser/resources/win/atom.rc b/atom/browser/resources/win/atom.rc index b82f28a4789..b6df17ca1d4 100644 --- a/atom/browser/resources/win/atom.rc +++ b/atom/browser/resources/win/atom.rc @@ -56,8 +56,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,2,2,0 - PRODUCTVERSION 1,2,2,0 + FILEVERSION 1,2,3,0 + PRODUCTVERSION 1,2,3,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -74,12 +74,12 @@ BEGIN BEGIN VALUE "CompanyName", "GitHub, Inc." VALUE "FileDescription", "Electron" - VALUE "FileVersion", "1.2.2" + VALUE "FileVersion", "1.2.3" VALUE "InternalName", "electron.exe" VALUE "LegalCopyright", "Copyright (C) 2015 GitHub, Inc. All rights reserved." VALUE "OriginalFilename", "electron.exe" VALUE "ProductName", "Electron" - VALUE "ProductVersion", "1.2.2" + VALUE "ProductVersion", "1.2.3" VALUE "SquirrelAwareVersion", "1" END END diff --git a/atom/browser/ui/message_box_mac.mm b/atom/browser/ui/message_box_mac.mm index d553a6a7dfb..8fd28e24463 100644 --- a/atom/browser/ui/message_box_mac.mm +++ b/atom/browser/ui/message_box_mac.mm @@ -79,7 +79,7 @@ NSAlert* CreateNSAlert(NativeWindow* parent_window, for (size_t i = 0; i < buttons.size(); ++i) { NSString* title = base::SysUTF8ToNSString(buttons[i]); - // An empty title causes crash on OS X. + // An empty title causes crash on macOS. if (buttons[i].empty()) title = @"(empty)"; NSButton* button = [alert addButtonWithTitle:title]; diff --git a/atom/browser/ui/tray_icon.h b/atom/browser/ui/tray_icon.h index dd018821cd3..1916c11b23a 100644 --- a/atom/browser/ui/tray_icon.h +++ b/atom/browser/ui/tray_icon.h @@ -40,11 +40,11 @@ class TrayIcon { virtual void SetToolTip(const std::string& tool_tip) = 0; // Sets the title displayed aside of the status icon in the status bar. This - // only works on OS X. + // only works on macOS. virtual void SetTitle(const std::string& title); // Sets whether the status icon is highlighted when it is clicked. This only - // works on OS X. + // works on macOS. virtual void SetHighlightMode(bool highlight); // Displays a notification balloon with the specified contents. diff --git a/atom/browser/ui/tray_icon_cocoa.mm b/atom/browser/ui/tray_icon_cocoa.mm index c3fa3f3b927..0dfd59132ae 100644 --- a/atom/browser/ui/tray_icon_cocoa.mm +++ b/atom/browser/ui/tray_icon_cocoa.mm @@ -12,9 +12,9 @@ namespace { -// By default, OS X sets 4px to tray image as left and right padding margin. +// By default, macOS sets 4px to tray image as left and right padding margin. const CGFloat kHorizontalMargin = 4; -// OS X tends to make the title 2px lower. +// macOS tends to make the title 2px lower. const CGFloat kVerticalTitleMargin = 2; } // namespace diff --git a/atom/browser/ui/tray_icon_gtk.cc b/atom/browser/ui/tray_icon_gtk.cc index 666e64101e8..3e533906090 100644 --- a/atom/browser/ui/tray_icon_gtk.cc +++ b/atom/browser/ui/tray_icon_gtk.cc @@ -4,7 +4,8 @@ #include "atom/browser/ui/tray_icon_gtk.h" -#include "base/guid.h" +#include "atom/browser/browser.h" +#include "base/strings/stringprintf.h" #include "base/strings/utf_string_conversions.h" #include "chrome/browser/ui/libgtk2ui/app_indicator_icon.h" #include "chrome/browser/ui/libgtk2ui/gtk2_status_icon.h" @@ -12,6 +13,13 @@ namespace atom { +namespace { + +// Number of app indicators used (used as part of app-indicator id). +int indicators_count; + +} // namespace + TrayIconGtk::TrayIconGtk() { } @@ -25,11 +33,16 @@ void TrayIconGtk::SetImage(const gfx::Image& image) { } base::string16 empty; - if (libgtk2ui::AppIndicatorIcon::CouldOpen()) + if (libgtk2ui::AppIndicatorIcon::CouldOpen()) { + ++indicators_count; icon_.reset(new libgtk2ui::AppIndicatorIcon( - base::GenerateGUID(), image.AsImageSkia(), empty)); - else + base::StringPrintf( + "%s%d", Browser::Get()->GetName().c_str(), indicators_count), + image.AsImageSkia(), + empty)); + } else { icon_.reset(new libgtk2ui::Gtk2StatusIcon(image.AsImageSkia(), empty)); + } icon_->set_delegate(this); } diff --git a/atom/browser/ui/x/event_disabler.cc b/atom/browser/ui/x/event_disabler.cc new file mode 100644 index 00000000000..6d0e4cfeb04 --- /dev/null +++ b/atom/browser/ui/x/event_disabler.cc @@ -0,0 +1,27 @@ +// Copyright (c) 2016 GitHub, Inc. +// Use of this source code is governed by the MIT license that can be +// found in the LICENSE file. + +#include "atom/browser/ui/x/event_disabler.h" + +namespace atom { + +EventDisabler::EventDisabler() { +} + +EventDisabler::~EventDisabler() { +} + +ui::EventRewriteStatus EventDisabler::RewriteEvent( + const ui::Event& event, + std::unique_ptr* rewritten_event) { + return ui::EVENT_REWRITE_DISCARD; +} + +ui::EventRewriteStatus EventDisabler::NextDispatchEvent( + const ui::Event& last_event, + std::unique_ptr* new_event) { + return ui::EVENT_REWRITE_CONTINUE; +} + +} // namespace atom diff --git a/atom/browser/ui/x/event_disabler.h b/atom/browser/ui/x/event_disabler.h new file mode 100644 index 00000000000..9a6645bcdca --- /dev/null +++ b/atom/browser/ui/x/event_disabler.h @@ -0,0 +1,32 @@ +// Copyright (c) 2016 GitHub, Inc. +// Use of this source code is governed by the MIT license that can be +// found in the LICENSE file. + +#ifndef ATOM_BROWSER_UI_X_EVENT_DISABLER_H_ +#define ATOM_BROWSER_UI_X_EVENT_DISABLER_H_ + +#include "base/macros.h" +#include "ui/events/event_rewriter.h" + +namespace atom { + +class EventDisabler : public ui::EventRewriter { + public: + EventDisabler(); + ~EventDisabler() override; + + // ui::EventRewriter: + ui::EventRewriteStatus RewriteEvent( + const ui::Event& event, + std::unique_ptr* rewritten_event) override; + ui::EventRewriteStatus NextDispatchEvent( + const ui::Event& last_event, + std::unique_ptr* new_event) override; + + private: + DISALLOW_COPY_AND_ASSIGN(EventDisabler); +}; + +} // namespace atom + +#endif // ATOM_BROWSER_UI_X_EVENT_DISABLER_H_ diff --git a/atom/common/api/atom_api_crash_reporter.cc b/atom/common/api/atom_api_crash_reporter.cc index e1932ad7f5f..184a70c72c1 100644 --- a/atom/common/api/atom_api_crash_reporter.cc +++ b/atom/common/api/atom_api_crash_reporter.cc @@ -15,24 +15,6 @@ using crash_reporter::CrashReporter; namespace mate { -template<> -struct Converter > { - static bool FromV8(v8::Isolate* isolate, - v8::Local val, - std::map* out) { - if (!val->IsObject()) - return false; - - v8::Local dict = val->ToObject(); - v8::Local keys = dict->GetOwnPropertyNames(); - for (uint32_t i = 0; i < keys->Length(); ++i) { - v8::Local key = keys->Get(i); - (*out)[V8ToString(key)] = V8ToString(dict->Get(key)); - } - return true; - } -}; - template<> struct Converter { static v8::Local ToV8(v8::Isolate* isolate, diff --git a/atom/common/api/atom_bindings.cc b/atom/common/api/atom_bindings.cc index f567492b52b..599fc674989 100644 --- a/atom/common/api/atom_bindings.cc +++ b/atom/common/api/atom_bindings.cc @@ -64,7 +64,7 @@ v8::Local GetSystemMemoryInfo(v8::Isolate* isolate, dict.Set("total", mem_info.total); dict.Set("free", mem_info.free); - // NB: These return bogus values on OS X + // NB: These return bogus values on macOS #if !defined(OS_MACOSX) dict.Set("swapTotal", mem_info.swap_total); dict.Set("swapFree", mem_info.swap_free); diff --git a/atom/common/atom_version.h b/atom/common/atom_version.h index fc11a68b291..d649af2a6ed 100644 --- a/atom/common/atom_version.h +++ b/atom/common/atom_version.h @@ -7,7 +7,7 @@ #define ATOM_MAJOR_VERSION 1 #define ATOM_MINOR_VERSION 2 -#define ATOM_PATCH_VERSION 2 +#define ATOM_PATCH_VERSION 3 #define ATOM_VERSION_IS_RELEASE 1 diff --git a/atom/common/chrome_version.h b/atom/common/chrome_version.h index 2cd932bd55a..3c3b780b9ce 100644 --- a/atom/common/chrome_version.h +++ b/atom/common/chrome_version.h @@ -8,7 +8,7 @@ #ifndef ATOM_COMMON_CHROME_VERSION_H_ #define ATOM_COMMON_CHROME_VERSION_H_ -#define CHROME_VERSION_STRING "51.0.2704.84" +#define CHROME_VERSION_STRING "51.0.2704.103" #define CHROME_VERSION "v" CHROME_VERSION_STRING #endif // ATOM_COMMON_CHROME_VERSION_H_ diff --git a/atom/common/key_weak_map.h b/atom/common/key_weak_map.h index bce34bfe0f6..009ba099c99 100644 --- a/atom/common/key_weak_map.h +++ b/atom/common/key_weak_map.h @@ -14,10 +14,6 @@ namespace atom { -namespace internal { - -} // namespace internal - // Like ES6's WeakMap, but the key is Integer and the value is Weak Pointer. template class KeyWeakMap { @@ -57,7 +53,7 @@ class KeyWeakMap { } // Returns all objects. - std::vector> Values(v8::Isolate* isolate) { + std::vector> Values(v8::Isolate* isolate) const { std::vector> keys; keys.reserve(map_.size()); for (const auto& iter : map_) { diff --git a/atom/common/node_includes.h b/atom/common/node_includes.h index 3734a43e5f4..46b6fa058eb 100644 --- a/atom/common/node_includes.h +++ b/atom/common/node_includes.h @@ -22,7 +22,7 @@ #undef DISALLOW_COPY_AND_ASSIGN #undef NO_RETURN #undef arraysize -#undef debug_string // This is defined in OS X 10.9 SDK in AssertMacros.h. +#undef debug_string // This is defined in macOS 10.9 SDK in AssertMacros.h. #include "vendor/node/src/env.h" #include "vendor/node/src/env-inl.h" #include "vendor/node/src/node.h" diff --git a/atom/common/options_switches.cc b/atom/common/options_switches.cc index d370f0ef859..36ec19edb86 100644 --- a/atom/common/options_switches.cc +++ b/atom/common/options_switches.cc @@ -66,7 +66,7 @@ const char kType[] = "type"; // Disable auto-hiding cursor. const char kDisableAutoHideCursor[] = "disableAutoHideCursor"; -// Use the OS X's standard window instead of the textured window. +// Use the macOS' standard window instead of the textured window. const char kStandardWindow[] = "standardWindow"; // Default browser window background color. @@ -75,6 +75,9 @@ const char kBackgroundColor[] = "backgroundColor"; // Whether the window should have a shadow. const char kHasShadow[] = "hasShadow"; +// Whether the window can be activated. +const char kFocusable[] = "focusable"; + // The WebPreferences. const char kWebPreferences[] = "webPreferences"; diff --git a/atom/common/options_switches.h b/atom/common/options_switches.h index 5924c054911..29fbc0e40f8 100644 --- a/atom/common/options_switches.h +++ b/atom/common/options_switches.h @@ -44,6 +44,7 @@ extern const char kDisableAutoHideCursor[]; extern const char kStandardWindow[]; extern const char kBackgroundColor[]; extern const char kHasShadow[]; +extern const char kFocusable[]; extern const char kWebPreferences[]; // WebPreferences. diff --git a/atom/common/platform_util_mac.mm b/atom/common/platform_util_mac.mm index 98bc4e537d8..d0146b11e08 100644 --- a/atom/common/platform_util_mac.mm +++ b/atom/common/platform_util_mac.mm @@ -8,6 +8,7 @@ #import #include "base/files/file_path.h" +#include "base/files/file_util.h" #include "base/logging.h" #include "base/mac/mac_logging.h" #include "base/mac/scoped_aedesc.h" @@ -17,7 +18,11 @@ namespace platform_util { -void ShowItemInFolder(const base::FilePath& full_path) { +void ShowItemInFolder(const base::FilePath& path) { + // The API only takes absolute path. + base::FilePath full_path = + path.IsAbsolute() ? path : base::MakeAbsoluteFilePath(path); + DCHECK([NSThread isMainThread]); NSString* path_string = base::SysUTF8ToNSString(full_path.value()); if (!path_string || ![[NSWorkspace sharedWorkspace] selectFile:path_string diff --git a/atom/renderer/atom_renderer_client.cc b/atom/renderer/atom_renderer_client.cc index 99b00227c3b..63a9a3eb263 100644 --- a/atom/renderer/atom_renderer_client.cc +++ b/atom/renderer/atom_renderer_client.cc @@ -282,6 +282,11 @@ void AtomRendererClient::DidCreateScriptContext( void AtomRendererClient::WillReleaseScriptContext( v8::Handle context, content::RenderFrame* render_frame) { + // Only allow node integration for the main frame, unless it is a devtools + // extension page. + if (!render_frame->IsMainFrame() && !IsDevToolsExtension(render_frame)) + return; + node::Environment* env = node::Environment::GetCurrent(context); if (env) mate::EmitEvent(env->isolate(), env->process_object(), "exit"); diff --git a/common.gypi b/common.gypi index 29fe70afc02..3389e18690a 100644 --- a/common.gypi +++ b/common.gypi @@ -124,7 +124,7 @@ ], 'conditions': [ ['OS=="mac" and libchromiumcontent_component==0', { - # -all_load is the "whole-archive" on OS X. + # -all_load is the "whole-archive" on macOS. 'xcode_settings': { 'OTHER_LDFLAGS': [ '-Wl,-all_load' ], }, diff --git a/default_app/main.js b/default_app/main.js index 37f69cd93b8..4e5ea96b03e 100644 --- a/default_app/main.js +++ b/default_app/main.js @@ -3,7 +3,6 @@ const {app, dialog, shell, Menu} = require('electron') const fs = require('fs') const Module = require('module') const path = require('path') -const repl = require('repl') const url = require('url') // Parse command line options. @@ -80,6 +79,15 @@ app.once('ready', () => { accelerator: 'CmdOrCtrl+V', role: 'paste' }, + { + label: 'Paste and Match Style', + accelerator: 'Shift+Command+V', + role: 'pasteandmatchstyle' + }, + { + label: 'Delete', + role: 'delete' + }, { label: 'Select All', accelerator: 'CmdOrCtrl+A', @@ -210,7 +218,21 @@ app.once('ready', () => { } ] }) - template[3].submenu.push( + template[3].submenu = [ + { + label: 'Close', + accelerator: 'CmdOrCtrl+W', + role: 'close' + }, + { + label: 'Minimize', + accelerator: 'CmdOrCtrl+M', + role: 'minimize' + }, + { + label: 'Zoom', + role: 'zoom' + }, { type: 'separator' }, @@ -218,7 +240,7 @@ app.once('ready', () => { label: 'Bring All to Front', role: 'front' } - ) + ] } const menu = Menu.buildFromTemplate(template) @@ -286,6 +308,13 @@ function loadApplicationByUrl (appUrl) { } function startRepl () { + if (process.platform === 'win32') { + console.error('Electron REPL not currently supported on Windows') + process.exit(1) + return + } + + const repl = require('repl') repl.start('> ').on('exit', () => { process.exit(0) }) diff --git a/docs-translations/es/api/process.md b/docs-translations/es/api/process.md index e50a2c1aac6..1a905125de2 100644 --- a/docs-translations/es/api/process.md +++ b/docs-translations/es/api/process.md @@ -38,7 +38,7 @@ El objeto `process` tiene los siguientes métodos: Interrumpe el hilo principal del proceso actual. -### process.setFdLimit(maxDescriptors) _OS X_ _Linux_ +### process.setFdLimit(maxDescriptors) _macOS_ _Linux_ * `maxDescriptors` Integer diff --git a/docs-translations/es/development/build-instructions-osx.md b/docs-translations/es/development/build-instructions-osx.md index 2ac3641e836..05c3a44f3d5 100644 --- a/docs-translations/es/development/build-instructions-osx.md +++ b/docs-translations/es/development/build-instructions-osx.md @@ -1,9 +1,9 @@ #Instrucciones de Compilación (Mac) -Siga las siguientes pautas para la construcción de Electron en OS X. +Siga las siguientes pautas para la construcción de Electron en macOS. #Requisitos previos - `OS X >= 10.8` + `macOS >= 10.8` `Xcode >= 5.1` `node.js (external)` @@ -36,7 +36,7 @@ Después de la construcción está hecho, usted puede encontrar `Electron.app` b #Soporte de 32bit -Electron sólo puede construirse para un objetivo de 64 bits en OS X y no hay un plan para apoyar a 32 bit OS X en el futuro. +Electron sólo puede construirse para un objetivo de 64 bits en macOS y no hay un plan para apoyar a 32 bit macOS en el futuro. #Pruebas diff --git a/docs-translations/es/styleguide.md b/docs-translations/es/styleguide.md index 18fa1aa3bb3..e7138aeb846 100644 --- a/docs-translations/es/styleguide.md +++ b/docs-translations/es/styleguide.md @@ -26,7 +26,7 @@ Estas son las maneras en las que construimos la documentación de Electron. - Argumentos opcionales son denotados cuando se llaman en listas. - Delimitador de línea de 80-columnas. - Métodos específicos de Plataformas son denotados en itálicas seguidas por la cabecera del método. - - ```### `method(foo, bar)` _OS X_``` + - ```### `method(foo, bar)` _macOS_``` - Preferir 'en el ___ proceso' en lugar de 'sobre el' ### Traducciones de la Documentación diff --git a/docs-translations/es/tutorial/application-distribution.md b/docs-translations/es/tutorial/application-distribution.md index 5966cdad7ec..f595b9eea15 100644 --- a/docs-translations/es/tutorial/application-distribution.md +++ b/docs-translations/es/tutorial/application-distribution.md @@ -5,7 +5,7 @@ aplicación deberá llamarse `app`, y ser colocado debajo del directorio de recursos de Electron (en OSX es `Electron.app/Contents/Resources/`, en Linux y Windows es `resources/`), de esta forma: -En OS X: +En macOS: ```text electron/Electron.app/Contents/Resources/app/ @@ -37,7 +37,7 @@ Para utilizar un archivo `asar` en reemplazo del directorio `app`, debes de renombrar el archivo a `app.asar`, y colocarlo por debajo el directorio de recursos de Electron (ver en seguida), Electron intentará leer el archivo y arrancar desde el. -En OS X: +En macOS: ```text electron/Electron.app/Contents/Resources/ diff --git a/docs-translations/es/tutorial/desktop-environment-integration.md b/docs-translations/es/tutorial/desktop-environment-integration.md index f19f36326f3..7db66c58043 100644 --- a/docs-translations/es/tutorial/desktop-environment-integration.md +++ b/docs-translations/es/tutorial/desktop-environment-integration.md @@ -6,9 +6,9 @@ en la JumpList de la barra de tareas, y en Mac, las aplicaciones pueden agregar Esta guía explica cómo integrar tu aplicación en esos entornos de escritorio a través de las APIs de Electron. -## Documentos recientes (Windows y OS X) +## Documentos recientes (Windows y macOS) -Windows y OS X proveen un acceso sencillo a la lista de documentos recientes. +Windows y macOS proveen un acceso sencillo a la lista de documentos recientes. __JumpList:__ @@ -42,14 +42,14 @@ registrar tu aplicación en [Application Registration][app-registration]. Cuando un usuario haga click en un archivo de la JumpList, una nueva instancia de tu aplicación se iniciará, la ruta del archivo se agregará como un argumento de la línea de comandos. -### Notas sobre OS X +### Notas sobre macOS Cuando un archivo es solicitado desde el menú de documentos recientes, el evento `open-file` del módulo `app` será emitido. -## Menú dock personalizado (OS X) +## Menú dock personalizado (macOS) -OS X permite a los desarrolladores definir un menú personalizado para el dock, +macOS permite a los desarrolladores definir un menú personalizado para el dock, el cual usualmente contiene algunos accesos directos a las características más comunes de tu aplicación: @@ -99,7 +99,7 @@ __Tareas de Internet Explorer:__ ![IE](http://i.msdn.microsoft.com/dynimg/IC420539.png) -A diferencia del menú dock en OS X, el cual es un menú real, las tareas de usuario en Windows +A diferencia del menú dock en macOS, el cual es un menú real, las tareas de usuario en Windows funcionan como accesos directos de aplicación, que al ser clickeados, lanzan el programa con argumentos específicos. diff --git a/docs-translations/es/tutorial/quick-start.md b/docs-translations/es/tutorial/quick-start.md index 9e65042c503..47008d6f5fc 100644 --- a/docs-translations/es/tutorial/quick-start.md +++ b/docs-translations/es/tutorial/quick-start.md @@ -74,7 +74,7 @@ var mainWindow = null; // Salir de todas las ventanas cuando se cierren. app.on('window-all-closed', function() { - // En OS X es común que las aplicaciones y su barra de menú + // En macOS es común que las aplicaciones y su barra de menú // se mantengan activas hasta que el usuario cierre la aplicación // explícitamente utilizando Cmd + Q if (process.platform != 'darwin') { @@ -139,7 +139,7 @@ En Linux: $ ./electron/electron your-app/ ``` -En OS X: +En macOS: ```bash $ ./Electron.app/Contents/MacOS/Electron your-app/ diff --git a/docs-translations/es/tutorial/supported-platforms.md b/docs-translations/es/tutorial/supported-platforms.md index 95ccc267722..ff08a5e1483 100644 --- a/docs-translations/es/tutorial/supported-platforms.md +++ b/docs-translations/es/tutorial/supported-platforms.md @@ -2,10 +2,10 @@ Las siguientes plataformas son soportadas por Electron: -### OS X +### macOS -Sólo se proveen binarios de 64 bit para OS X. -La versión mínima soportada es OS X 10.8. +Sólo se proveen binarios de 64 bit para macOS. +La versión mínima soportada es macOS 10.8. ### Windows diff --git a/docs-translations/es/tutorial/using-pepper-flash-plugin.md b/docs-translations/es/tutorial/using-pepper-flash-plugin.md index 5c41ff87826..85176f7f864 100644 --- a/docs-translations/es/tutorial/using-pepper-flash-plugin.md +++ b/docs-translations/es/tutorial/using-pepper-flash-plugin.md @@ -28,7 +28,7 @@ app.on('window-all-closed', function() { // Specify flash path. // On Windows, it might be /path/to/pepflashplayer.dll -// On OS X, /path/to/PepperFlashPlayer.plugin +// On macOS, /path/to/PepperFlashPlayer.plugin // On Linux, /path/to/libpepflashplayer.so app.commandLine.appendSwitch('ppapi-flash-path', '/path/to/libpepflashplayer.so'); diff --git a/docs-translations/fr-FR/README.md b/docs-translations/fr-FR/README.md index 666a03e99a3..fc505bc770c 100644 --- a/docs-translations/fr-FR/README.md +++ b/docs-translations/fr-FR/README.md @@ -85,7 +85,7 @@ dans la FAQ : * [Hiérarchie du Code Source](development/source-code-directory-structure.md) * [Différences Techniques par rapport à NW.js (anciennement node-webkit)](development/atom-shell-vs-node-webkit.md) * [Aperçu du Système de Build](development/build-system-overview.md) -* [Instructions de Build (OS X)](development/build-instructions-osx.md) +* [Instructions de Build (macOS)](development/build-instructions-osx.md) * [Instructions de Build (Windows)](development/build-instructions-windows.md) * [Instructions de Build (Linux)](development/build-instructions-linux.md) * [Installer un Serveur de Symbol dans le debugger](development/setting-up-symbol-server.md) diff --git a/docs-translations/fr-FR/styleguide.md b/docs-translations/fr-FR/styleguide.md index b683ee68aad..9dac1955aef 100644 --- a/docs-translations/fr-FR/styleguide.md +++ b/docs-translations/fr-FR/styleguide.md @@ -27,7 +27,7 @@ La documentation d'Electron a été écrite en suivant les règles ci-dessous : - Les arguments optionnels sont indiqués quand appelés dans la liste. - La longueur des lignes ne dépasse pas 80 caractères. - Les méthodes spécifiques à une plateforme sont notées en italique. - - ```### `method(foo, bar)` _OS X_``` + - ```### `method(foo, bar)` _macOS_``` - Préférer 'in the ___ process' au lieu de 'on' ### Traductions de la Documentation diff --git a/docs-translations/jp/README.md b/docs-translations/jp/README.md index 7359745d6c0..734bc8274c5 100644 --- a/docs-translations/jp/README.md +++ b/docs-translations/jp/README.md @@ -89,7 +89,7 @@ _リンクになっていないリストは未翻訳のものです。_ * Source Code Directory Structure (development/source-code-directory-structure.md) * Technical Differences to NW.js (formerly node-webkit)(development/atom-shell-vs-node-webkit.md) * Build System Overview (development/build-system-overview.md) -* Build Instructions (OS X) (development/build-instructions-osx.md) +* Build Instructions (macOS) (development/build-instructions-osx.md) * Build Instructions (Windows) (development/build-instructions-windows.md) * Build Instructions (Linux) (development/build-instructions-linux.md) * Debug Instructions (Windows) (development/debug-instructions-windows.md) diff --git a/docs-translations/jp/api/accelerator.md b/docs-translations/jp/api/accelerator.md index 83a66447ed5..032747ddf60 100644 --- a/docs-translations/jp/api/accelerator.md +++ b/docs-translations/jp/api/accelerator.md @@ -10,9 +10,9 @@ acceleratorは、キーボードショートカットを示す文字列です。 ## プラットフォームの留意点 -OS Xでは`Command` キー、LinuxとWindowsでは`Control` キーを意味する`CommandOrControl`はいくつかのacceleratorを定義しますが、LinuxとWindowsでは、`Command` キーは何の効果もありません。 +macOSでは`Command` キー、LinuxとWindowsでは`Control` キーを意味する`CommandOrControl`はいくつかのacceleratorを定義しますが、LinuxとWindowsでは、`Command` キーは何の効果もありません。 - `Super` キーは、WindowsとLinuxでは `Windows` キーに、OS Xでは、`Cmd` キーに関連付けられます。 + `Super` キーは、WindowsとLinuxでは `Windows` キーに、macOSでは、`Cmd` キーに関連付けられます。 ## 提供されている修飾語句 diff --git a/docs-translations/jp/api/app.md b/docs-translations/jp/api/app.md index 168f7a09399..2adac343033 100644 --- a/docs-translations/jp/api/app.md +++ b/docs-translations/jp/api/app.md @@ -17,7 +17,7 @@ app.on('window-all-closed', function() { ### イベント: 'will-finish-launching' -アプリケーションの基礎起動が終わったときに出力されます。Windows と Linuxでは、 `will-finish-launching` イベントと`ready`イベントは同じです。OS Xでは、`NSApplication`の `applicationWillFinishLaunching` 通知をに相当します。通常、`open-file`と`open-url` 用のリスナーの設定、クラッシュレポートの開始、自動アップデートをします。 +アプリケーションの基礎起動が終わったときに出力されます。Windows と Linuxでは、 `will-finish-launching` イベントと`ready`イベントは同じです。macOSでは、`NSApplication`の `applicationWillFinishLaunching` 通知をに相当します。通常、`open-file`と`open-url` 用のリスナーの設定、クラッシュレポートの開始、自動アップデートをします。 ほとんどの場合、 `ready` イベントハンドラーですべてをするべきです。 @@ -58,7 +58,7 @@ Electronの初期化が終わった時に出力します。 アプリケーションが終了したときに出力されます。 -### イベント: 'open-file' _OS X_ +### イベント: 'open-file' _macOS_ 戻り値: @@ -71,7 +71,7 @@ Electronの初期化が終わった時に出力します。 Windowsでは、ファイルパスを取得するために、 `process.argv` をパースする必要があります。 -### イベント: 'open-url' _OS X_ +### イベント: 'open-url' _macOS_ 戻り値: @@ -82,7 +82,7 @@ Windowsでは、ファイルパスを取得するために、 `process.argv` を このイベントをハンドルしたい場合は、`event.preventDefault()`をコールすべきです。 -### イベント: 'activate' _OS X_ +### イベント: 'activate' _macOS_ 戻り値: @@ -237,7 +237,7 @@ gpu プロセスがクラッシュしたときに出力されます。 * `appData` 既定で示すユーザーごとのアプリケーションディレクトリ * `%APPDATA%` Windows上 * `$XDG_CONFIG_HOME` or `~/.config` Linux上 - * `~/Library/Application Support` OS X上 + * `~/Library/Application Support` macOS上 * `userData` アプリの設定ファイルを格納するディレクトリで、既定では`appData` ディレクトリ配下のアプリ名ディレクトリです * `temp` 一時ディレクトリ * `exe` 現在の実行ファイル @@ -274,15 +274,15 @@ gpu プロセスがクラッシュしたときに出力されます。 現在のアプリケーションのロケールを戻します。 -### `app.addRecentDocument(path)` _OS X_ _Windows_ +### `app.addRecentDocument(path)` _macOS_ _Windows_ * `path` String 最近のドキュメント一覧に`path`を追加します。 -この一覧はOSが管理しています。Windowsではタスクバーからこの一覧を見れ、OS Xではdockメニューから見れます。 +この一覧はOSが管理しています。Windowsではタスクバーからこの一覧を見れ、macOSではdockメニューから見れます。 -### `app.clearRecentDocuments()` _OS X_ _Windows_ +### `app.clearRecentDocuments()` _macOS_ _Windows_ 最近のドキュメント一覧をクリアします。 @@ -321,7 +321,7 @@ The `callback` は、 `app`の`ready` イベントの出力後に実行するこ プロセスがアプリケーションのプライマリインスタンスでアプリがロードし続けるなら、このメソッドは `false`を戻します。プロセスがほかのインスタンスにパラメーターを送信し、`true`を戻すと、直ちに終了します。 -OS Xは、ユーザーがFinderで2つ目のアプリインスタンスを開いたり、`open-file` 、 `open-url`イベントが出力しようとすると、システムが自動的にシングルインスタンスを強制します。しかし、コマンドラインでアプリを開始するとシステムのシングルインスタンスメカニズムは無視されるので、シングルインスタンスを強制するためには、このメソッドを使う必要があります。 +macOSは、ユーザーがFinderで2つ目のアプリインスタンスを開いたり、`open-file` 、 `open-url`イベントが出力しようとすると、システムが自動的にシングルインスタンスを強制します。しかし、コマンドラインでアプリを開始するとシステムのシングルインスタンスメカニズムは無視されるので、シングルインスタンスを強制するためには、このメソッドを使う必要があります。 2つ目のインスタンスを起動するとき、メインのインスタンスのウィンドウをアクティブにする例 @@ -392,7 +392,7 @@ Chromiumのコマンドダインに引数を追加します。引数は正しく **Note:** `process.argv`に影響しません。 -### `app.dock.bounce([type])` _OS X_ +### `app.dock.bounce([type])` _macOS_ * `type` String (optional) - `critical` または `informational`を指定できます。既定では、 `informational`です。 @@ -402,37 +402,37 @@ Chromiumのコマンドダインに引数を追加します。引数は正しく リクエストを示すIDを戻します。 -### `app.dock.cancelBounce(id)` _OS X_ +### `app.dock.cancelBounce(id)` _macOS_ * `id` Integer `id`のバウンスをキャンセルします。 -### `app.dock.setBadge(text)` _OS X_ +### `app.dock.setBadge(text)` _macOS_ * `text` String dockのバッジエリアで表示する文字列を設定します。 -### `app.dock.getBadge()` _OS X_ +### `app.dock.getBadge()` _macOS_ dockのバッジ文字列を戻します。 -### `app.dock.hide()` _OS X_ +### `app.dock.hide()` _macOS_ dock アイコンを隠します。 -### `app.dock.show()` _OS X_ +### `app.dock.show()` _macOS_ dock アイコンを表示します。 -### `app.dock.setMenu(menu)` _OS X_ +### `app.dock.setMenu(menu)` _macOS_ * `menu` Menu アプリケーションの[dock menu][dock-menu]を設定します。 -### `app.dock.setIcon(image)` _OS X_ +### `app.dock.setIcon(image)` _macOS_ * `image` [NativeImage](native-image.md) diff --git a/docs-translations/jp/api/auto-updater.md b/docs-translations/jp/api/auto-updater.md index 818a75e019a..92f1fce2197 100644 --- a/docs-translations/jp/api/auto-updater.md +++ b/docs-translations/jp/api/auto-updater.md @@ -6,9 +6,9 @@ `autoUpdater`は、異なるプラットフォーム用に統一したAPIを提供していますが、それぞれのプラットフォーム上で、まだ多少の差があります。 -### OS X +### macOS -OS Xでは、 `autoUpdater` モジュールは、[Squirrel.Mac][squirrel-mac]上に構築されていて、動作させるのに特別な設定が不要であることを意味します。サーバーサイドの要件は、[Server Support][server-support]を読んでください。 +macOSでは、 `autoUpdater` モジュールは、[Squirrel.Mac][squirrel-mac]上に構築されていて、動作させるのに特別な設定が不要であることを意味します。サーバーサイドの要件は、[Server Support][server-support]を読んでください。 ### Windows @@ -16,7 +16,7 @@ Windowsでは、auto-updaterを使う前に、ユーザーのPCにアプリを Squirrelで生成されたインストーラーは、`com.squirrel.PACKAGE_ID.YOUR_EXE_WITHOUT_DOT_EXE`のフォーマット(例えば、`com.squirrel.slack.Slack` と `com.squirrel.code.Code`)で[Application User Model ID][app-user-model-id]とショートカットアイコンを作成します。`app.setAppUserModelId`APIで同じIDを使う必要があります。同じIDでないと、Windowsはタスクバーに適切にピン止めすることができません。 -サーバーサイドのセットアップは、OS Xと異なります。詳細は、[Squirrel.Windows][squirrel-windows] を参照してください。 +サーバーサイドのセットアップは、macOSと異なります。詳細は、[Squirrel.Windows][squirrel-windows] を参照してください。 ### Linux diff --git a/docs-translations/jp/api/crash-reporter.md b/docs-translations/jp/api/crash-reporter.md index 50dbdf28d40..a1fb21f5111 100644 --- a/docs-translations/jp/api/crash-reporter.md +++ b/docs-translations/jp/api/crash-reporter.md @@ -37,7 +37,7 @@ crashReporter.start({ 他の`crashReporter`APIを使用する前にこのメソッドをコールする必要があります。 -**Note:** OS Xでは、Electronは、WindowsとLinux上の`breakpad` とは異なる、新しい`crashpad`クライアントを使用します。クラッシュ収集機能を有効にするために、メインプロセスや、クラッシュレポートを収集したいそれぞれのレンダラープロセスで、`crashpad`を初期化するために`crashReporter.start`APIをコールする必要があります。 +**Note:** macOSでは、Electronは、WindowsとLinux上の`breakpad` とは異なる、新しい`crashpad`クライアントを使用します。クラッシュ収集機能を有効にするために、メインプロセスや、クラッシュレポートを収集したいそれぞれのレンダラープロセスで、`crashpad`を初期化するために`crashReporter.start`APIをコールする必要があります。 ### `crashReporter.getLastCrashReport()` diff --git a/docs-translations/jp/api/dialog.md b/docs-translations/jp/api/dialog.md index c01fef3fa33..48a17225bb5 100644 --- a/docs-translations/jp/api/dialog.md +++ b/docs-translations/jp/api/dialog.md @@ -10,7 +10,7 @@ const dialog = require('electron').dialog; console.log(dialog.showOpenDialog({ properties: [ 'openFile', 'openDirectory', 'multiSelections' ]})); ``` -**Note for OS X**: シートとしてダイアログを表示したい場合、唯一しなければならないことは、`browserWindow`パラメーターを参照する`BrowserWindow`を提供することです。 +**Note for macOS**: シートとしてダイアログを表示したい場合、唯一しなければならないことは、`browserWindow`パラメーターを参照する`BrowserWindow`を提供することです。 ## メソッド @@ -73,7 +73,7 @@ console.log(dialog.showOpenDialog({ properties: [ 'openFile', 'openDirectory', ' * `message` String - メッセージボックスのコンテンツ。 * `detail` String - メッセージの外部情報 * `icon` [NativeImage](native-image.md) - * `cancelId` Integer - ダイアログのボタンをクリックする代わりにユーザーがダイアログをキャンセルしたときに返す値です。既定では、ラベルの "cancel"や"no"を持つボタンのインデックスまたは、そのようなボタンが無ければ0を返します。OS XやWindowsでは、 すでに指定されているかどうかは関係なく、"Cancel"ボタンのインデックスはいつでも `cancelId`が使われます。 + * `cancelId` Integer - ダイアログのボタンをクリックする代わりにユーザーがダイアログをキャンセルしたときに返す値です。既定では、ラベルの "cancel"や"no"を持つボタンのインデックスまたは、そのようなボタンが無ければ0を返します。macOSやWindowsでは、 すでに指定されているかどうかは関係なく、"Cancel"ボタンのインデックスはいつでも `cancelId`が使われます。 * `noLink` Boolean - Windowsでは、Electronは、 ("Cancel" または "Yes"のような)共通ボタンである`buttons`の一つを見つけようとし、ダイアログ内のコマンドリンクとして表示します。この挙動が気に入らない場合は、 `noLink` を `true`に設定できます。 * `callback` Function diff --git a/docs-translations/jp/api/frameless-window.md b/docs-translations/jp/api/frameless-window.md index 4478387877e..518e2680cf9 100644 --- a/docs-translations/jp/api/frameless-window.md +++ b/docs-translations/jp/api/frameless-window.md @@ -11,9 +11,9 @@ const BrowserWindow = require('electron').BrowserWindow; var win = new BrowserWindow({ width: 800, height: 600, frame: false }); ``` -### OS Xでの別の方法 +### macOSでの別の方法 -Mac OS X 10.10 Yosemite以降では、Chrome無しのウィンドウを指定する方法があります。`frame`を`false`に設定しタイトルバーとウィンドウコントロールの両方を無効にする代わりに、タイトルバーを隠しコンテンツをフルウィンドウサイズに広げたいけど、標準的なウィンドウ操作用にウィンドウコントロール("トラフィックライト")を維持したいかもしれません。新しい`titleBarStyle`オプションを指定することで、そうできます。 +macOS 10.10 Yosemite以降では、Chrome無しのウィンドウを指定する方法があります。`frame`を`false`に設定しタイトルバーとウィンドウコントロールの両方を無効にする代わりに、タイトルバーを隠しコンテンツをフルウィンドウサイズに広げたいけど、標準的なウィンドウ操作用にウィンドウコントロール("トラフィックライト")を維持したいかもしれません。新しい`titleBarStyle`オプションを指定することで、そうできます。 ```javascript var win = new BrowserWindow({ 'titleBarStyle': 'hidden' }); diff --git a/docs-translations/jp/api/menu-item.md b/docs-translations/jp/api/menu-item.md index 9e28582e622..4c42f73d7e4 100644 --- a/docs-translations/jp/api/menu-item.md +++ b/docs-translations/jp/api/menu-item.md @@ -38,7 +38,7 @@ * `minimize` - 現在のウィンドウの最小化 * `close` - 現在のウィンドウを閉じます -OS Xでは、`role`は次の追加の値を取れます: +macOSでは、`role`は次の追加の値を取れます: * `about` - `orderFrontStandardAboutPanel`動作に紐づけられます * `hide` - `hide`動作に紐づけられます diff --git a/docs-translations/jp/api/menu.md b/docs-translations/jp/api/menu.md index 12039b1d6ad..d39573b29ee 100644 --- a/docs-translations/jp/api/menu.md +++ b/docs-translations/jp/api/menu.md @@ -208,9 +208,9 @@ Menu.setApplicationMenu(menu); * `menu` Menu -OS Xで、アプリケーションメニューとして`menu`を設定します。WindowsとLinuxでは、`menu`はそれぞれのウィンドウの上のメニューとして設定されます。 +macOSで、アプリケーションメニューとして`menu`を設定します。WindowsとLinuxでは、`menu`はそれぞれのウィンドウの上のメニューとして設定されます。 -### `Menu.sendActionToFirstResponder(action)` _OS X_ +### `Menu.sendActionToFirstResponder(action)` _macOS_ * `action` String @@ -229,7 +229,7 @@ OS Xで、アプリケーションメニューとして`menu`を設定します * `browserWindow` BrowserWindow (オプション) - 既定では`null`です。 * `x` Number (オプション) - 既定では -1です。 * `y` Number (**必須** `x` が使われている場合) - 既定では -1です。 -* `positioningItem` Number (オプション) _OS X_ - 既定では -1です。 +* `positioningItem` Number (オプション) _macOS_ - 既定では -1です。 メニューアイテムのインデックスを指定した座標にマウスカーソルを配置します。 @@ -252,13 +252,13 @@ OS Xで、アプリケーションメニューとして`menu`を設定します メニューのアイテムを収容した配列を取得します。 -## OS X アプリケーションメニューの注意事項 +## macOS アプリケーションメニューの注意事項 -OS Xは、WindowsとLinuxのアプリケーションのメニューとは完全に異なるスタイルを持ち、よりネイティブのようにアプリメニューを作成するのに幾つかの注意事項があります。 +macOSは、WindowsとLinuxのアプリケーションのメニューとは完全に異なるスタイルを持ち、よりネイティブのようにアプリメニューを作成するのに幾つかの注意事項があります。 ### 標準的なメニュー -OS Xでは、`Services`と`Windows`メニューのように定義された標準的な多くのメニューがあります。標準的なメニューを作成するために、メニューの`role`に次のどれかを設定する必要があり、Electronはそれを受けて標準的なメニューを作成します。 +macOSでは、`Services`と`Windows`メニューのように定義された標準的な多くのメニューがあります。標準的なメニューを作成するために、メニューの`role`に次のどれかを設定する必要があり、Electronはそれを受けて標準的なメニューを作成します。 * `window` * `help` @@ -266,11 +266,11 @@ OS Xでは、`Services`と`Windows`メニューのように定義された標準 ### 標準的なメニューアイテムの動作 -`About xxx`と`Hide xxx`、`Hide Others`のようないくつかのメニューアイテム用にOS Xは標準的な動作を提供します。メニューアイテムの動作に標準的な動作を設定するために、メニューアイテムの`role`属性を設定すべきです。 +`About xxx`と`Hide xxx`、`Hide Others`のようないくつかのメニューアイテム用にmacOSは標準的な動作を提供します。メニューアイテムの動作に標準的な動作を設定するために、メニューアイテムの`role`属性を設定すべきです。 ### メインのメニュー名 -OS Xでは、設定したラベルに関係なく、アプリケーションの最初のアイテムのラベルはいつもアプリの名前です。変更するために、アプリにバンドルされている`Info.plist`ファイルを修正してアプリの名前を変更する必要があります。詳細は、 [About Information Property List Files][AboutInformationPropertyListFiles] を見てください。 +macOSでは、設定したラベルに関係なく、アプリケーションの最初のアイテムのラベルはいつもアプリの名前です。変更するために、アプリにバンドルされている`Info.plist`ファイルを修正してアプリの名前を変更する必要があります。詳細は、 [About Information Property List Files][AboutInformationPropertyListFiles] を見てください。 ## メニューアイテムの位置 diff --git a/docs-translations/jp/api/native-image.md b/docs-translations/jp/api/native-image.md index fa98eaed221..a819123707c 100644 --- a/docs-translations/jp/api/native-image.md +++ b/docs-translations/jp/api/native-image.md @@ -66,7 +66,7 @@ var appIcon = new Tray('/Users/somebody/images/icon.png'); もっとも一般的なケースは、ライトとダークなメニュバー両方に切り替え可能なメニュバーアイコン用にテンプレート画像を使います。 -**Note:** テンプレート画像は、OS Xでのみサポートしています。 +**Note:** テンプレート画像は、macOSでのみサポートしています。 テンプレート画像として画像をマークするために、ファイル名の最後に`Template`をつけます。 diff --git a/docs-translations/jp/api/process.md b/docs-translations/jp/api/process.md index 0f9d60f5a3a..23301494a37 100644 --- a/docs-translations/jp/api/process.md +++ b/docs-translations/jp/api/process.md @@ -72,7 +72,7 @@ Windows Store App (appx)として動作中の場合は、値は`true`になり このプロセスのメインスレッドをハングさせます。 -### `process.setFdLimit(maxDescriptors)` _OS X_ _Linux_ +### `process.setFdLimit(maxDescriptors)` _macOS_ _Linux_ * `maxDescriptors` Integer diff --git a/docs-translations/jp/api/tray.md b/docs-translations/jp/api/tray.md index 5c76e740530..a26f6c59741 100644 --- a/docs-translations/jp/api/tray.md +++ b/docs-translations/jp/api/tray.md @@ -63,9 +63,9 @@ __プラットフォームの制限:__ トレイアイコンがクリックされたときに出力されます。 -__Note:__ `バウンド` 再生はOS XとWindoesのみで実装されています。 +__Note:__ `バウンド` 再生はmacOSとWindoesのみで実装されています。 -### イベント: 'right-click' _OS X_ _Windows_ +### イベント: 'right-click' _macOS_ _Windows_ * `event` Event * `altKey` Boolean @@ -80,7 +80,7 @@ __Note:__ `バウンド` 再生はOS XとWindoesのみで実装されていま トレイアイコンが右クリックされると出力されます。 -### イベント: 'double-click' _OS X_ _Windows_ +### イベント: 'double-click' _macOS_ _Windows_ * `event` Event * `altKey` Boolean @@ -107,26 +107,26 @@ __Note:__ `バウンド` 再生はOS XとWindoesのみで実装されていま タイムアウトもしくはユーザーの操作で閉じて、トレイバルーンがクロースされたときに出力されます。 -### イベント: 'drop' _OS X_ +### イベント: 'drop' _macOS_ トレイアイコンでアイテムがドラグアンドドロップされたときに出力されます。 -### イベント: 'drop-files' _OS X_ +### イベント: 'drop-files' _macOS_ * `event` * `files` Array - ドロップされたアイテムのフルパス トレイアイコンでファイルがドロップされたときに出力されます。 -### イベント: 'drag-enter' _OS X_ +### イベント: 'drag-enter' _macOS_ トレイアイコンにドラッグ操作が入ったときに出力されます。 -### イベント: 'drag-leave' _OS X_ +### イベント: 'drag-leave' _macOS_ トレイアイコンででドラッグ操作が行われたときに出力されます。 -### イベント: 'drag-end' _OS X_ +### イベント: 'drag-end' _macOS_ トレイ上でドラッグ操作が終了したか、ほかの場所で終了したときに出力されます。 @@ -146,11 +146,11 @@ __Note:__ `バウンド` 再生はOS XとWindoesのみで実装されていま トレイアイコンの`image`を設定します。 -### `Tray.setPressedImage(image)` _OS X_ +### `Tray.setPressedImage(image)` _macOS_ * `image` [NativeImage](native-image.md) -OS Xで押されたときにトレイアイコンの`image`を設定します。 +macOSで押されたときにトレイアイコンの`image`を設定します。 ### `Tray.setToolTip(toolTip)` @@ -158,13 +158,13 @@ OS Xで押されたときにトレイアイコンの`image`を設定します。 トレイアイコン用のホバーテキストを設定します。 -### `Tray.setTitle(title)` _OS X_ +### `Tray.setTitle(title)` _macOS_ * `title` String ステータスバーで、トレイアイコンのわきに表示するタイトルを設定します。 -### `Tray.setHighlightMode(highlight)` _OS X_ +### `Tray.setHighlightMode(highlight)` _macOS_ * `highlight` Boolean @@ -179,7 +179,7 @@ OS Xで押されたときにトレイアイコンの`image`を設定します。 トレイバルーンを表示します。 -### `Tray.popUpContextMenu([menu, position])` _OS X_ _Windows_ +### `Tray.popUpContextMenu([menu, position])` _macOS_ _Windows_ * `menu` Menu (optional) * `position` Object (optional) - ポップアップ位置 diff --git a/docs-translations/jp/tutorial/application-distribution.md b/docs-translations/jp/tutorial/application-distribution.md index 19cc42979e1..43df2adb3de 100644 --- a/docs-translations/jp/tutorial/application-distribution.md +++ b/docs-translations/jp/tutorial/application-distribution.md @@ -1,9 +1,9 @@ # アプリケーションの配布 -Electronでアプリケーションを配布するために、アプリケーションを`app` という名前のディレクトリにし、Electronのリソースディレクトリ(OS X では +Electronでアプリケーションを配布するために、アプリケーションを`app` という名前のディレクトリにし、Electronのリソースディレクトリ(macOS では `Electron.app/Contents/Resources/` 、Linux と Windows では `resources/`)配下に置くべきです, -OS X: +macOS: ```text electron/Electron.app/Contents/Resources/app/ @@ -29,7 +29,7 @@ electron/resources/app `app` フォルダの代わりに `asar` アーカイブを使用するためには、アーカイブファイルを `app.asar` という名前に変更し、Electron のリソースディレクトリに以下のように配置する必要があります。すると、Electron はアーカイブを読み込もうとし、それを開始します。 -OS X: +macOS: ```text electron/Electron.app/Contents/Resources/ @@ -54,7 +54,7 @@ Electronにバンドルした後、ユーザーに配布する前に、 Electron `electron.exe`を任意の名前に変更でき、[rcedit](https://github.com/atom/rcedit) のようなツールでアイコンやその他の情報を編集できます。 -### OS X +### macOS `Electron.app` を任意の名前に変更でき、次のファイルの `CFBundleDisplayName`と `CFBundleIdentifier`、 `CFBundleName`のフィールドの名前を変更する必要があります。 diff --git a/docs-translations/jp/tutorial/desktop-environment-integration.md b/docs-translations/jp/tutorial/desktop-environment-integration.md index 6cd838afa7d..c6f7a585fbe 100644 --- a/docs-translations/jp/tutorial/desktop-environment-integration.md +++ b/docs-translations/jp/tutorial/desktop-environment-integration.md @@ -4,7 +4,7 @@ このガイドでは、Electron APIでデスクトップ環境にアプリケーションを統合する方法を説明します。 -## 通知 (Windows, Linux, OS X) +## 通知 (Windows, Linux, macOS) 3つのオペレーティングシステム全てで、アプリケーションからユーザーに通知を送る手段が提供されています。通知を表示するためにオペレーティングシステムのネイティブ通知APIを使用しする[HTML5 Notification API](https://notifications.spec.whatwg.org/)で、Electronは、開発者に通知を送ることができます。 @@ -36,15 +36,15 @@ Model ID][app-user-model-id]で、アプリへのショートカットはスタ 通知は、`libnotify`を使用して送信されます。[デスクトップ通知仕様][notification-spec]に対応したデスクトップ環境上(Cinnamon、Enlightenment、Unity、GNOME、KDEなど)で通知を表示できます。 -### OS X +### macOS -通知は、そのままOS Xに通知されます。しかし、[通知に関するAppleのヒューマンインターフェイスガイドライン(英語版)](https://developer.apple.com/library/mac/documentation/UserExperience/Conceptual/OSXHIGuidelines/NotificationCenter.html)を知っておくべきです。 +通知は、そのままmacOSに通知されます。しかし、[通知に関するAppleのヒューマンインターフェイスガイドライン(英語版)](https://developer.apple.com/library/mac/documentation/UserExperience/Conceptual/OSXHIGuidelines/NotificationCenter.html)を知っておくべきです。 通知は、256バイトサイズに制限されており、制限を超えていた場合、通知が破棄されます。 -## 最近のドキュメント (Windows と OS X) +## 最近のドキュメント (Windows と macOS) -Windows と OS Xは、ジャンプリストやドックメニュー経由で、アプリケーションが開いた最近のドキュメント一覧に簡単にアクセスできます。 +Windows と macOSは、ジャンプリストやドックメニュー経由で、アプリケーションが開いた最近のドキュメント一覧に簡単にアクセスできます。 __JumpList:__ @@ -72,19 +72,19 @@ Windows で、この機能を使用できるようにするために、アプリ ユーザーがジャンプリストからファイルをクリックしたとき、アプリケーションの新しいインスタンスは、コマンドライン引数にファイルのパスを渡して開始します。 -### OS X 留意点 +### macOS 留意点 ファイルが最近のドキュメントメニューからリクエストされた時、 `app` モジュールの `open-file` イベントが発行されます。 -## ドックメニュー (OS X)のカスタマイズ +## ドックメニュー (macOS)のカスタマイズ -通常アプリケーションで使用する共通機能用のショートカットを含める、ドック用のカスタムメニューをOS Xでは指定できます。 +通常アプリケーションで使用する共通機能用のショートカットを含める、ドック用のカスタムメニューをmacOSでは指定できます。 __Dock menu of Terminal.app:__ -カスタムドックメニューを設定するために、OS Xのみに提供されている `app.dock.setMenu` APIを使用できます。 +カスタムドックメニューを設定するために、macOSのみに提供されている `app.dock.setMenu` APIを使用できます。 ```javascript const electron = require('electron'); @@ -115,7 +115,7 @@ __Internet Explorerのタスク:__ ![IE](http://i.msdn.microsoft.com/dynimg/IC420539.png) -実際のメニューであるOS Xのドックメニューとは異なり、ユーザーがタスクをクリックしたとき、Windowsではユーザータスクはアプリケーションのショートカットのように動作し、プログラムは指定された引数を実行します。 +実際のメニューであるmacOSのドックメニューとは異なり、ユーザーがタスクをクリックしたとき、Windowsではユーザータスクはアプリケーションのショートカットのように動作し、プログラムは指定された引数を実行します。 アプリケーション用のユーザータスクを設定するために、[app.setUserTasks][setusertaskstasks] APIを使用できます: @@ -192,11 +192,11 @@ __Audaciousのランチャーショートカット:__ ![audacious](https://help.ubuntu.com/community/UnityLaunchersAndDesktopFiles?action=AttachFile&do=get&target=shortcuts.png) -## タスクバーの進行状況バー (Windows, OS X, Unity) +## タスクバーの進行状況バー (Windows, macOS, Unity) Windowsでは、タスクバーボタンは、進行状況バーを表示するのに使えます。ウィンドウを切り替えることなくウィンドウの進行状況情報をユーザーに提供することができます。 -OS Xではプログレスバーはドックアイコンの一部として表示されます。 +macOSではプログレスバーはドックアイコンの一部として表示されます。 Unity DEは、ランチャーに進行状況バーの表示をするのと同様の機能を持っています。 __タスクバーボタン上の進行状況バー:__ @@ -227,9 +227,9 @@ let win = new BrowserWindow({...}); win.setOverlayIcon('path/to/overlay.png', 'Description for overlay'); ``` -## Windowのファイル表示 (OS X) +## Windowのファイル表示 (macOS) -OS Xでは、ウィンドウがrepresented fileを設定でき、タイトルバー上にファイルのアイコンを表示でき、タイトル上でCommand-クリックまたはControl-クリックをすると、パスがポップアップ表示されます。 +macOSでは、ウィンドウがrepresented fileを設定でき、タイトルバー上にファイルのアイコンを表示でき、タイトル上でCommand-クリックまたはControl-クリックをすると、パスがポップアップ表示されます。 ウィンドウの編集状態を設定できるように、このウィンドウのドキュメントが変更されたかどうかをファイルのアイコンで示せます。 diff --git a/docs-translations/jp/tutorial/mac-app-store-submission-guide.md b/docs-translations/jp/tutorial/mac-app-store-submission-guide.md index fd42d55937d..f396de6091d 100644 --- a/docs-translations/jp/tutorial/mac-app-store-submission-guide.md +++ b/docs-translations/jp/tutorial/mac-app-store-submission-guide.md @@ -84,7 +84,7 @@ codesign -s "$APP_KEY" -f --entitlements parent.plist "$APP_PATH" productbuild --component "$APP_PATH" /Applications --sign "$INSTALLER_KEY" "$RESULT_PATH" ``` -OS Xでのアプリのサンドボックス化を行うことが初めてなら、Appleの[Enabling App Sandbox][enable-app-sandbox]を通読し、基本的な考え方を確認してから、、エンタイトルメントファイルにアプリに必要なパーミッションキーを追加します。 +macOSでのアプリのサンドボックス化を行うことが初めてなら、Appleの[Enabling App Sandbox][enable-app-sandbox]を通読し、基本的な考え方を確認してから、、エンタイトルメントファイルにアプリに必要なパーミッションキーを追加します。 ### Appをアップロードする。 diff --git a/docs-translations/jp/tutorial/quick-start.md b/docs-translations/jp/tutorial/quick-start.md index f6c5e9679f8..8bd24994b52 100644 --- a/docs-translations/jp/tutorial/quick-start.md +++ b/docs-translations/jp/tutorial/quick-start.md @@ -86,14 +86,14 @@ app.on('ready', createWindow); // すべてのウィンドウが閉じられた時にアプリケーションを終了する。 app.on('window-all-closed', () => { - // OS Xでは、Cmd + Q(終了)をユーザーが実行するまではウィンドウが全て閉じられても終了しないでおく。 + // macOSでは、Cmd + Q(終了)をユーザーが実行するまではウィンドウが全て閉じられても終了しないでおく。 if (process.platform !== 'darwin') { app.quit(); } }); app.on('activate', () => { - // OS X では、ドックをクリックされた時にウィンドウがなければ新しく作成する。 + // macOS では、ドックをクリックされた時にウィンドウがなければ新しく作成する。 if (win === null) { createWindow(); } @@ -157,7 +157,7 @@ $ .\electron\electron.exe your-app\ $ ./electron/electron your-app/ ``` -#### OS X +#### macOS ```bash $ ./Electron.app/Contents/MacOS/Electron your-app/ diff --git a/docs-translations/jp/tutorial/supported-platforms.md b/docs-translations/jp/tutorial/supported-platforms.md index 7d9f24b7ab6..07da250f1b9 100644 --- a/docs-translations/jp/tutorial/supported-platforms.md +++ b/docs-translations/jp/tutorial/supported-platforms.md @@ -2,9 +2,9 @@ Electronでは次のプラットフォームをサポートします。 -### OS X +### macOS -OS X用に提供しているバイナリは64bitのみで、サポートするOS Xのバージョンは、OS X 10.9 以降です。 +macOS用に提供しているバイナリは64bitのみで、サポートするmacOSのバージョンは、macOS 10.9 以降です。 ### Windows diff --git a/docs-translations/jp/tutorial/using-pepper-flash-plugin.md b/docs-translations/jp/tutorial/using-pepper-flash-plugin.md index 8f0b56e1050..85a896f8cc3 100644 --- a/docs-translations/jp/tutorial/using-pepper-flash-plugin.md +++ b/docs-translations/jp/tutorial/using-pepper-flash-plugin.md @@ -5,7 +5,7 @@ Electronは、Pepper Flashプラグインをサポートしています。Electr ## Flash プラグインのコピー準備 -OS XとLinuxでは、Pepper Flashプラグインの詳細は、Chromeブラウザーで、`chrome://plugins` にアクセスして確認できます。そこで表示されるパスとバージョンは、ElectronのPepper Flashサポートに役立ちます。それを別のパスにコピーすることができます。 +macOSとLinuxでは、Pepper Flashプラグインの詳細は、Chromeブラウザーで、`chrome://plugins` にアクセスして確認できます。そこで表示されるパスとバージョンは、ElectronのPepper Flashサポートに役立ちます。それを別のパスにコピーすることができます。 ## Electron スイッチの追加 @@ -16,7 +16,7 @@ OS XとLinuxでは、Pepper Flashプラグインの詳細は、Chromeブラウ ```javascript // Specify flash path. // On Windows, it might be /path/to/pepflashplayer.dll -// On OS X, /path/to/PepperFlashPlayer.plugin +// On macOS, /path/to/PepperFlashPlayer.plugin // On Linux, /path/to/libpepflashplayer.so app.commandLine.appendSwitch('ppapi-flash-path', '/path/to/libpepflashplayer.so'); diff --git a/docs-translations/jp/tutorial/using-widevine-cdm-plugin.md b/docs-translations/jp/tutorial/using-widevine-cdm-plugin.md index 7c3b7677144..f8839182e5b 100644 --- a/docs-translations/jp/tutorial/using-widevine-cdm-plugin.md +++ b/docs-translations/jp/tutorial/using-widevine-cdm-plugin.md @@ -8,13 +8,13 @@ Electronは、ライセンス的な理由でWidevine CDMプラグインは同梱 __Note:__ Chromeブラウザのメジャーバージョンは、Electronが使用するChromeバージョンと同じでなければなりません。そうでなければ、プラグインは、`navigator.plugins`経由でロードされて表示されるにも関わらず動作しません。 -### Windows & OS X +### Windows & macOS Chromeブラウザーで、`chrome://components/`を開き、 `WidevineCdm` を探し、それが最新であることを確認し、`APP_DATA/Google/Chrome/WidevineCDM/VERSION/_platform_specific/PLATFORM_ARCH/`ディレクトリからすべてのプラグインバイナリを探します。 -`APP_DATA` は、アプリデータを格納するシステムロケーションです。Windowsでは`%LOCALAPPDATA%`、OS Xでは`~/Library/Application Support`です。`VERSION` は、Widevine CDM プラグインのバージョン文字列で、 `1.4.8.866`のような文字列が格納されます。`PLATFORM` は、 `mac` か `win`です。`ARCH` は `x86` か `x64`です。 +`APP_DATA` は、アプリデータを格納するシステムロケーションです。Windowsでは`%LOCALAPPDATA%`、macOSでは`~/Library/Application Support`です。`VERSION` は、Widevine CDM プラグインのバージョン文字列で、 `1.4.8.866`のような文字列が格納されます。`PLATFORM` は、 `mac` か `win`です。`ARCH` は `x86` か `x64`です。 -Windowsでは、`widevinecdm.dll` と `widevinecdmadapter.dll`が必要で、OS Xでは、`libwidevinecdm.dylib` と `widevinecdmadapter.plugin`です。任意の場所にコピーできますが、一緒に配置する必要があります。 +Windowsでは、`widevinecdm.dll` と `widevinecdmadapter.dll`が必要で、macOSでは、`libwidevinecdm.dylib` と `widevinecdmadapter.plugin`です。任意の場所にコピーできますが、一緒に配置する必要があります。 ### Linux @@ -32,7 +32,7 @@ __Note:__ `widevinecdmadapter` バイナリはElectronにパスが通ってい ```javascript // You have to pass the filename of `widevinecdmadapter` here, it is -// * `widevinecdmadapter.plugin` on OS X, +// * `widevinecdmadapter.plugin` on macOS, // * `libwidevinecdmadapter.so` on Linux, // * `widevinecdmadapter.dll` on Windows. app.commandLine.appendSwitch('widevine-cdm-path', '/path/to/widevinecdmadapter.plugin'); diff --git a/docs-translations/ko-KR/README.md b/docs-translations/ko-KR/README.md index b484d6dc8d7..b522b06f97a 100644 --- a/docs-translations/ko-KR/README.md +++ b/docs-translations/ko-KR/README.md @@ -6,7 +6,7 @@ URL에 포함되어 있습니다. 만약 그렇지 않다면, 아마 현재 보 수 있습니다. 또한 GitHub 인터페이스의 "Switch branches/tags" 드롭다운 메뉴에서도 사용 중인 Electron 버전으로 변경할 수 있습니다. -**역주:** 한국어 번역 문서는 `atom.io`에 반영되어 있지 않습니다. 한국어 번역 문서는 +**역자주:** 한국어 번역 문서는 `atom.io`에 반영되어 있지 않습니다. 한국어 번역 문서는 현재 `upstream` 원본 문서의 변경에 따라 최대한 문서의 버전을 맞추려고 노력하고 있지만 가끔 누락된 번역이 존재할 수 있습니다. @@ -22,10 +22,10 @@ Electron에 대해 자주 묻는 질문이 있습니다. 이슈를 생성하기 * [지원하는 플랫폼](tutorial/supported-platforms.md) * [보안](tutorial/security.md) * [Electron 버전 관리](tutorial/electron-versioning.md) -* [어플리케이션 배포](tutorial/application-distribution.md) -* [Mac 앱스토어 어플리케이션 제출 가이드](tutorial/mac-app-store-submission-guide.md) +* [애플리케이션 배포](tutorial/application-distribution.md) +* [Mac 앱스토어 애플리케이션 제출 가이드](tutorial/mac-app-store-submission-guide.md) * [Windows 스토어 가이드](tutorial/windows-store-guide.md) -* [어플리케이션 패키징](tutorial/application-packaging.md) +* [애플리케이션 패키징](tutorial/application-packaging.md) * [네이티브 Node 모듈 사용하기](tutorial/using-native-node-modules.md) * [메인 프로세스 디버깅하기](tutorial/debugging-main-process.md) * [Selenium 과 WebDriver 사용하기](tutorial/using-selenium-and-webdriver.md) @@ -93,7 +93,7 @@ Electron에 대해 자주 묻는 질문이 있습니다. 이슈를 생성하기 * [소스 코드 디렉터리 구조](development/source-code-directory-structure.md) * [NW.js(node-webkit)와 기술적으로 다른점](development/atom-shell-vs-node-webkit.md) * [빌드 시스템 개요](development/build-system-overview.md) -* [빌드 설명서 (OS X)](development/build-instructions-osx.md) +* [빌드 설명서 (macOS)](development/build-instructions-osx.md) * [빌드 설명서 (Windows)](development/build-instructions-windows.md) * [빌드 설명서 (Linux)](development/build-instructions-linux.md) * [디버그 설명서 (Windows)](development/debug-instructions-windows.md) diff --git a/docs-translations/ko-KR/api/accelerator.md b/docs-translations/ko-KR/api/accelerator.md index 05532d06c08..19302774930 100644 --- a/docs-translations/ko-KR/api/accelerator.md +++ b/docs-translations/ko-KR/api/accelerator.md @@ -12,13 +12,13 @@ Accelerator는 `+` 문자를 통해 여러 혼합키와 키코드를 결합할 ## 플랫폼에 관련하여 주의할 점 Linux와 Windows에서는 `Command`키가 없으므로 작동하지 않습니다. 대신에 -`CommandOrControl`을 사용하면 OS X의 `Command`와 Linux, Windows의 `Control` 모두 +`CommandOrControl`을 사용하면 macOS의 `Command`와 Linux, Windows의 `Control` 모두 지원할 수 있습니다. -`Option` 대신 `Alt`을 사용하는게 좋습니다. `Option` 키는 OS X에만 있으므로 +`Option` 대신 `Alt`을 사용하는게 좋습니다. `Option` 키는 macOS에만 있으므로 모든 플랫폼에서 사용할 수 있는 `Alt` 키를 권장합니다. -`Super`키는 Windows와 Linux 에서는 `윈도우`키를, OS X에서는 `Cmd`키로 맵핑됩니다. +`Super`키는 Windows와 Linux 에서는 `윈도우`키를, macOS에서는 `Cmd`키로 맵핑됩니다. ## 사용 가능한 혼합키 diff --git a/docs-translations/ko-KR/api/app.md b/docs-translations/ko-KR/api/app.md index 096cee0a364..b6695bdf21a 100644 --- a/docs-translations/ko-KR/api/app.md +++ b/docs-translations/ko-KR/api/app.md @@ -1,8 +1,8 @@ # app -> 어플리케이션의 이벤트 생명주기를 제어합니다. +> 애플리케이션의 이벤트 생명주기를 제어합니다. -밑의 예시는 마지막 윈도우가 종료되었을 때, 어플리케이션을 종료시키는 예시입니다: +밑의 예시는 마지막 윈도우가 종료되었을 때, 애플리케이션을 종료시키는 예시입니다: ```javascript const {app} = require('electron'); @@ -17,9 +17,9 @@ app.on('window-all-closed', () => { ### Event: 'will-finish-launching' -어플리케이션이 기본적인 시작 준비를 마치면 발생하는 이벤트입니다. +애플리케이션이 기본적인 시작 준비를 마치면 발생하는 이벤트입니다. Windows, Linux 운영체제에서의 `will-finish-launching` 이벤트는 `ready` 이벤트와 -동일합니다. OS X에서의 이벤트는 `NSApplication`의 +동일합니다. macOS에서의 이벤트는 `NSApplication`의 `applicationWillFinishLaunching`에 대한 알림으로 표현됩니다. 대개 이곳에서 `open-file`과 `open-url` 이벤트 리스너를 설정하고 crash reporter와 auto updater를 시작합니다. @@ -41,8 +41,8 @@ Electron은 먼저 모든 윈도우의 종료를 시도하고 `will-quit` 이벤 그리고 `will-quit` 이벤트가 발생했을 땐 `window-all-closed` 이벤트가 발생하지 않습니다. -**역주:** 이 이벤트는 말 그대로 현재 어플리케이션에서 윈도우만 완전히 종료됬을 때 -발생하는 이벤트입니다. 따라서 어플리케이션을 완전히 종료하려면 이 이벤트에서 +**역자주:** 이 이벤트는 말 그대로 현재 애플리케이션에서 윈도우만 완전히 종료됬을 때 +발생하는 이벤트입니다. 따라서 애플리케이션을 완전히 종료하려면 이 이벤트에서 `app.quit()`를 호출해 주어야 합니다. ### Event: 'before-quit' @@ -51,9 +51,9 @@ Returns: * `event` Event -어플리케이션 윈도우들이 닫히기 시작할 때 발생하는 이벤트입니다. +애플리케이션 윈도우들이 닫히기 시작할 때 발생하는 이벤트입니다. `event.preventDefault()` 호출은 이벤트의 기본 동작을 방지하기 때문에 -이를 통해 어플리케이션의 종료를 방지할 수 있습니다. +이를 통해 애플리케이션의 종료를 방지할 수 있습니다. ### Event: 'will-quit' @@ -61,8 +61,8 @@ Returns: * `event` Event -모든 윈도우들이 종료되고 어플리케이션이 종료되기 시작할 때 발생하는 이벤트입니다. -`event.preventDefault()` 호출을 통해 어플리케이션의 종료를 방지할 수 있습니다. +모든 윈도우들이 종료되고 애플리케이션이 종료되기 시작할 때 발생하는 이벤트입니다. +`event.preventDefault()` 호출을 통해 애플리케이션의 종료를 방지할 수 있습니다. `will-quit` 와 `window-all-closed` 이벤트의 차이점을 확인하려면 `window-all-closed` 이벤트의 설명을 참고하세요. @@ -74,51 +74,51 @@ Returns: * `event` Event * `exitCode` Integer -어플리케이션이 종료될 때 발생하는 이벤트입니다. +애플리케이션이 종료될 때 발생하는 이벤트입니다. -### Event: 'open-file' _OS X_ +### Event: 'open-file' _macOS_ Returns: * `event` Event * `path` String -사용자가 어플리케이션을 통해 파일을 열고자 할 때 발생하는 이벤트입니다. +사용자가 애플리케이션을 통해 파일을 열고자 할 때 발생하는 이벤트입니다. -`open-file` 이벤트는 보통 어플리케이션이 열려 있을 때 OS가 파일을 열기 위해 -어플리케이션을 재사용할 때 발생합니다. 이 이벤트는 파일을 dock에 떨어트릴 때, -어플리케이션이 실행되기 전에도 발생합니다. 따라서 이 이벤트를 제대로 처리하려면 -`open-file` 이벤트 핸들러를 어플리케이션이 시작하기 전에 등록해 놓았는지 확실히 +`open-file` 이벤트는 보통 애플리케이션이 열려 있을 때 OS가 파일을 열기 위해 +애플리케이션을 재사용할 때 발생합니다. 이 이벤트는 파일을 dock에 떨어트릴 때, +애플리케이션이 실행되기 전에도 발생합니다. 따라서 이 이벤트를 제대로 처리하려면 +`open-file` 이벤트 핸들러를 애플리케이션이 시작하기 전에 등록해 놓았는지 확실히 확인해야 합니다. (`ready` 이벤트가 발생하기 전에) 이 이벤트를 처리할 땐 반드시 `event.preventDefault()`를 호출해야 합니다. Windows에선 `process.argv` (메인 프로세스에서)를 통해 파일 경로를 얻을 수 있습니다. -### Event: 'open-url' _OS X_ +### Event: 'open-url' _macOS_ Returns: * `event` Event * `url` String -유저가 어플리케이션을 통해 URL을 열고자 할 때 발생하는 이벤트입니다. +유저가 애플리케이션을 통해 URL을 열고자 할 때 발생하는 이벤트입니다. -어플리케이션에서 URL을 열기 위해 반드시 URL 스킴이 등록되어 있어야 합니다. +애플리케이션에서 URL을 열기 위해 반드시 URL 스킴이 등록되어 있어야 합니다. 이 이벤트를 처리할 땐 반드시 `event.preventDefault()`를 호출해야 합니다. -### Event: 'activate' _OS X_ +### Event: 'activate' _macOS_ Returns: * `event` Event * `hasVisibleWindows` Boolean -어플리케이션이 활성화 되었을 때 발생하는 이벤트입니다. 이 이벤트는 사용자가 -어플리케이션의 dock 아이콘을 클릭했을 때 주로 발생합니다. +애플리케이션이 활성화 되었을 때 발생하는 이벤트입니다. 이 이벤트는 사용자가 +애플리케이션의 dock 아이콘을 클릭했을 때 주로 발생합니다. -### Event: 'continue-activity' _OS X_ +### Event: 'continue-activity' _macOS_ Returns: @@ -131,9 +131,9 @@ Returns: 발생하는 이벤트입니다. 이 이벤트를 처리하려면 반드시 `event.preventDefault()`를 호출해야 합니다. -사용자 activity는 activity의 소스 어플리케이션과 같은 개발자 팀 ID를 가지는 -어플리케이션 안에서만 재개될 수 있고, activity의 타입을 지원합니다. 지원하는 -activity의 타입은 어플리케이션 `Info.plist`의 `NSUserActivityTypes` 키에 열거되어 +사용자 activity는 activity의 소스 애플리케이션과 같은 개발자 팀 ID를 가지는 +애플리케이션 안에서만 재개될 수 있고, activity의 타입을 지원합니다. 지원하는 +activity의 타입은 애플리케이션 `Info.plist`의 `NSUserActivityTypes` 키에 열거되어 있습니다. ### Event: 'browser-window-blur' @@ -154,7 +154,7 @@ Returns: [browserWindow](browser-window.md)에 대한 포커스가 발생했을 때 발생하는 이벤트입니다. -**역주:** _포커스_ 는 창을 클릭해서 활성화 시켰을 때를 말합니다. +**역자주:** _포커스_ 는 창을 클릭해서 활성화 시켰을 때를 말합니다. ### Event: 'browser-window-created' @@ -165,6 +165,15 @@ Returns: 새로운 [browserWindow](browser-window.md)가 생성되었을 때 발생하는 이벤트입니다. +### Event: 'web-contents-created' + +Returns: + +* `event` Event +* `webContents` WebContents + +새로운 [webContents](web-contents.md)가 생성되었을 때 발생하는 이벤트입니다. + ### Event: 'certificate-error' Returns: @@ -265,7 +274,7 @@ GPU가 작동하던 중 크래시가 일어났을 때 발생하는 이벤트입 모든 윈도우 종료를 시도합니다. `before-quit` 이벤트가 먼저 발생합니다. 모든 윈도우가 성공적으로 종료되면 `will-quit` 이벤트가 발생하고 기본 동작에 따라 -어플리케이션이 종료됩니다. +애플리케이션이 종료됩니다. 이 함수는 모든 `beforeunload`와 `unload` 이벤트 핸들러가 제대로 실행됨을 보장합니다. `beforeunload` 이벤트 핸들러에서 `false`를 반환했을 때 윈도우 종료가 취소 될 수 @@ -275,7 +284,7 @@ GPU가 작동하던 중 크래시가 일어났을 때 발생하는 이벤트입 * `exitCode` Integer -`exitCode`와 함께 어플리케이션을 즉시 종료합니다. +`exitCode`와 함께 애플리케이션을 즉시 종료합니다. 모든 윈도우는 사용자의 동의 여부에 상관없이 즉시 종료되며 `before-quit` 이벤트와 `will-quit` 이벤트가 발생하지 않습니다. @@ -286,20 +295,20 @@ GPU가 작동하던 중 크래시가 일어났을 때 발생하는 이벤트입 * `args` Array (optional) * `execPath` String (optional) -현재 인스턴스가 종료되면 어플리케이션을 재시작합니다. +현재 인스턴스가 종료되면 애플리케이션을 재시작합니다. 기본적으로 새 인스턴스는 같은 작업 디렉토리의 것과 함께 현재 인스턴스의 명령줄 인수를 사용합니다. 만약 `args`가 지정되면, `args`가 기본 명령줄 인수 대신에 전달됩니다. -`execPath`가 지정되면, 현재 어플리케이션 대신 `execPath`가 실행됩니다. +`execPath`가 지정되면, 현재 애플리케이션 대신 `execPath`가 실행됩니다. -참고로 이 메서드는 어플리케이션을 종료하지 않으며, 어플리케이션을 다시 시작시키려면 +참고로 이 메서드는 애플리케이션을 종료하지 않으며, 애플리케이션을 다시 시작시키려면 `app.relaunch`를 호출한 후 `app.quit` 또는 `app.exit`를 실행해주어야 합니다. `app.relaunch`가 여러 번 호출되면, 현재 인스턴스가 종료된 후 여러 인스턴스가 시작됩니다. 다음은 현재 인스턴스를 즉시 종료시킨 후 새로운 명령줄 인수를 추가하여 새 -인스턴스의 어플리케이션을 실행하는 예시입니다: +인스턴스의 애플리케이션을 실행하는 예시입니다: ```javascript app.relaunch({args: process.argv.slice(1) + ['--relaunch']}) @@ -308,20 +317,20 @@ app.exit(0) ### `app.focus()` -Linux에선, 첫 번째로 보여지는 윈도우가 포커스됩니다. OS X에선, 어플리케이션을 활성화 -앱 상태로 만듭니다. Windows에선, 어플리케이션의 첫 윈도우에 포커스 됩니다. +Linux에선, 첫 번째로 보여지는 윈도우가 포커스됩니다. macOS에선, 애플리케이션을 활성화 +앱 상태로 만듭니다. Windows에선, 애플리케이션의 첫 윈도우에 포커스 됩니다. -### `app.hide()` _OS X_ +### `app.hide()` _macOS_ -최소화를 하지 않고 어플리케이션의 모든 윈도우들을 숨깁니다. +최소화를 하지 않고 애플리케이션의 모든 윈도우들을 숨깁니다. -### `app.show()` _OS X_ +### `app.show()` _macOS_ -숨긴 어플리케이션 윈도우들을 다시 보이게 만듭니다. 자동으로 포커스되지 않습니다. +숨긴 애플리케이션 윈도우들을 다시 보이게 만듭니다. 자동으로 포커스되지 않습니다. ### `app.getAppPath()` -현재 어플리케이션의 디렉터리를 반환합니다. +현재 애플리케이션의 디렉터리를 반환합니다. ### `app.getPath(name)` @@ -330,17 +339,17 @@ Linux에선, 첫 번째로 보여지는 윈도우가 포커스됩니다. OS X에 `name`에 관련한 특정 디렉터리 또는 파일의 경로를 반환합니다. 경로를 가져오는 데 실패할 경우 `Error`를 반환합니다. -**역주:** 이 메서드는 운영체제에서 지정한 특수 디렉터리를 가져오는데 사용할 수 있습니다. +**역자주:** 이 메서드는 운영체제에서 지정한 특수 디렉터리를 가져오는데 사용할 수 있습니다. `name`은 다음 목록에 있는 경로 중 하나를 선택해 사용할 수 있습니다: * `home` - 사용자의 홈 디렉터리. -* `appData` - 각 사용자의 어플리케이션 데이터 디렉터리. 기본 경로는 다음과 같습니다: +* `appData` - 각 사용자의 애플리케이션 데이터 디렉터리. 기본 경로는 다음과 같습니다: * `%APPDATA%` - Windows * `$XDG_CONFIG_HOME` 또는 `~/.config` - Linux - * `~/Library/Application Support` - OS X -* `userData` - 어플리케이션의 설정을 저장하는 디렉터리. - 이 디렉터리는 기본적으로 `appData`에 어플리케이션 이름으로 생성된 폴더가 지정됩니다. + * `~/Library/Application Support` - macOS +* `userData` - 애플리케이션의 설정을 저장하는 디렉터리. + 이 디렉터리는 기본적으로 `appData`에 애플리케이션 이름으로 생성된 폴더가 지정됩니다. * `temp` - 임시 폴더 디렉터리. * `userDesktop` - 현재 사용자의 데스트탑 디렉터리. * `exe` - 현재 실행중인 Electron 바이너리 파일. @@ -351,6 +360,7 @@ Linux에선, 첫 번째로 보여지는 윈도우가 포커스됩니다. OS X에 * `music` - 사용자의 음악 디렉터리. * `pictures` - 사용자의 사진 디렉터리. * `videos` - 사용자의 동영상 디렉터리. +* `pepperFlashSystemPlugin` - 시스템 버전의 Pepper Flash 플러그인의 전체 경로. ### `app.setPath(name, path)` @@ -369,49 +379,49 @@ Linux에선, 첫 번째로 보여지는 윈도우가 포커스됩니다. OS X에 ### `app.getVersion()` -로드된 어플리케이션의 버전을 반환합니다. +로드된 애플리케이션의 버전을 반환합니다. -만약 `package.json` 파일에서 어플리케이션의 버전을 찾을 수 없는 경우, 현재 번들 또는 +만약 `package.json` 파일에서 애플리케이션의 버전을 찾을 수 없는 경우, 현재 번들 또는 실행 파일의 버전을 반환합니다. ### `app.getName()` -`package.json`에서 기술된 현재 어플리케이션의 이름을 반환합니다. +`package.json`에서 기술된 현재 애플리케이션의 이름을 반환합니다. npm 모듈 규칙에 따라 대부분의 경우 `package.json`의 `name` 필드는 소문자 이름을 사용합니다. 하지만 Electron은 `name`대신 `productName` 필드를 주로 사용하기 때문에 -반드시 이 필드도 같이 지정해야 합니다. 이 필드는 맨 앞글자가 대문자인 어플리케이션 +반드시 이 필드도 같이 지정해야 합니다. 이 필드는 맨 앞글자가 대문자인 애플리케이션 전체 이름을 지정해야 합니다. ### `app.setName(name)` * `name` String -현재 어플리케이션의 이름을 덮어씌웁니다. +현재 애플리케이션의 이름을 덮어씌웁니다. ### `app.getLocale()` -현재 어플리케이션의 [로케일](https://ko.wikipedia.org/wiki/%EB%A1%9C%EC%BC%80%EC%9D%BC)을 +현재 애플리케이션의 [로케일](https://ko.wikipedia.org/wiki/%EB%A1%9C%EC%BC%80%EC%9D%BC)을 반환합니다. **참고:** 패키징된 앱을 배포할 때, `locales` 폴더도 같이 배포해야 합니다. **참고:** Windows에선 `ready` 이벤트가 발생한 이후에 이 메서드를 호출해야 합니다. -### `app.addRecentDocument(path)` _OS X_ _Windows_ +### `app.addRecentDocument(path)` _macOS_ _Windows_ * `path` String 최근 문서 목록에 `path`를 추가합니다. 이 목록은 OS에 의해 관리됩니다. 최근 문서 목록은 Windows의 경우 작업 표시줄에서 찾을 -수 있고, OS X의 경우 dock 메뉴에서 찾을 수 있습니다. +수 있고, macOS의 경우 dock 메뉴에서 찾을 수 있습니다. -### `app.clearRecentDocuments()` _OS X_ _Windows_ +### `app.clearRecentDocuments()` _macOS_ _Windows_ 최근 문서 목록을 모두 비웁니다. -### `app.setAsDefaultProtocolClient(protocol)` _OS X_ _Windows_ +### `app.setAsDefaultProtocolClient(protocol)` _macOS_ _Windows_ * `protocol` String - 프로토콜의 이름, `://` 제외. 만약 앱을 통해 `electron://`과 같은 링크를 처리하고 싶다면, 이 메서드에 `electron` 인수를 담아 호출하면 됩니다. @@ -419,31 +429,31 @@ npm 모듈 규칙에 따라 대부분의 경우 `package.json`의 `name` 필드 이 메서드는 지정한 프로토콜(URI scheme)에 대해 현재 실행파일을 기본 핸들러로 등록합니다. 이를 통해 운영체제와 더 가깝게 통합할 수 있습니다. 한 번 등록되면, `your-protocol://`과 같은 모든 링크에 대해 호출시 현재 실행 파일이 실행됩니다. -모든 링크, 프로토콜을 포함하여 어플리케이션의 인수로 전달됩니다. +모든 링크, 프로토콜을 포함하여 애플리케이션의 인수로 전달됩니다. -**참고:** OS X에선, 어플리케이션의 `info.plist`에 등록해둔 프로토콜만 사용할 수 +**참고:** macOS에선, 애플리케이션의 `info.plist`에 등록해둔 프로토콜만 사용할 수 있습니다. 이는 런타임에서 변경될 수 없습니다. 이 파일은 간단히 텍스트 에디터를 -사용하거나, 어플리케이션을 빌드할 때 스크립트가 생성되도록 할 수 있습니다. 자세한 +사용하거나, 애플리케이션을 빌드할 때 스크립트가 생성되도록 할 수 있습니다. 자세한 내용은 [Apple의 참조 문서][CFBundleURLTypes]를 확인하세요. 이 API는 내부적으로 Windows 레지스트리와 LSSetDefaultHandlerForURLScheme를 사용합니다. -### `app.removeAsDefaultProtocolClient(protocol)` _OS X_ _Windows_ +### `app.removeAsDefaultProtocolClient(protocol)` _macOS_ _Windows_ * `protocol` String - 프로토콜의 이름, `://` 제외. 이 메서드는 현재 실행파일이 지정한 프로토콜(URI scheme)에 대해 기본 핸들러인지를 확인합니다. 만약 그렇다면, 이 메서드는 앱을 기본 핸들러에서 제거합니다. -### `app.isDefaultProtocolClient(protocol)` _OS X_ _Windows_ +### `app.isDefaultProtocolClient(protocol)` _macOS_ _Windows_ * `protocol` String - `://`를 제외한 프로토콜의 이름. 이 메서드는 현재 실행 파일이 지정한 프로토콜에 대해 기본 동작인지 확인합니다. (URI 스킴) 만약 그렇다면 `true`를 반환하고 아닌 경우 `false`를 반환합니다. -**참고:** OS X에선, 응용 프로그램이 프로토콜에 대한 기본 프로토콜 동작으로 -등록되었는지를 확인하기 위해 이 메서드를 사용할 수 있습니다. 또한 OS X에서 +**참고:** macOS에선, 응용 프로그램이 프로토콜에 대한 기본 프로토콜 동작으로 +등록되었는지를 확인하기 위해 이 메서드를 사용할 수 있습니다. 또한 macOS에서 `~/Library/Preferences/com.apple.LaunchServices.plist`를 확인하여 검증할 수도 있습니다. 자세한 내용은 [Apple의 참조 문서][LSCopyDefaultHandlerForURLScheme]를 참고하세요. @@ -460,13 +470,13 @@ Windows에서 사용할 수 있는 JumpList의 [Tasks][tasks] 카테고리에 `t `Task` Object: * `program` String - 실행할 프로그램의 경로. - 보통 현재 작동중인 어플리케이션의 경로인 `process.execPath`를 지정합니다. + 보통 현재 작동중인 애플리케이션의 경로인 `process.execPath`를 지정합니다. * `arguments` String - `program`이 실행될 때 사용될 명령줄 인수. * `title` String - JumpList에 표시할 문자열. * `description` String - 이 작업에 대한 설명. * `iconPath` String - JumpList에 표시될 아이콘의 절대 경로. 아이콘을 포함하고 있는 임의의 리소스 파일을 사용할 수 있습니다. - 보통 어플리케이션의 아이콘을 그대로 사용하기 위해 `process.execPath`를 지정합니다. + 보통 애플리케이션의 아이콘을 그대로 사용하기 위해 `process.execPath`를 지정합니다. * `iconIndex` Integer - 아이콘 파일의 인덱스. 만약 아이콘 파일이 두 개 이상의 아이콘을 가지고 있을 경우, 사용할 아이콘의 인덱스를 이 옵션으로 지정해 주어야 합니다. 단, 아이콘을 하나만 포함하고 있는 경우 0을 지정하면 됩니다. @@ -475,38 +485,38 @@ Windows에서 사용할 수 있는 JumpList의 [Tasks][tasks] 카테고리에 `t * `callback` Function -현재 어플리케이션을 **Single Instance Application** 으로 만들어줍니다. -이 메서드는 어플리케이션이 여러 번 실행됐을 때 다중 인스턴스가 생성되는 대신 한 개의 +현재 애플리케이션을 **Single Instance Application** 으로 만들어줍니다. +이 메서드는 애플리케이션이 여러 번 실행됐을 때 다중 인스턴스가 생성되는 대신 한 개의 주 인스턴스만 유지되도록 만들 수 있습니다. 이때 중복 생성된 인스턴스는 주 인스턴스에 신호를 보내고 종료됩니다. `callback`은 주 인스턴스가 생성된 이후 또 다른 인스턴스가 생성됐을 때 `callback(argv, workingDirectory)` 형식으로 호출됩니다. `argv`는 두 번째 인스턴스의 명령줄 인수이며 `workingDirectory`는 현재 작업중인 디렉터리입니다. 보통 대부분의 -어플리케이션은 이러한 콜백이 호출될 때 주 윈도우를 포커스하고 최소화되어있으면 창 +애플리케이션은 이러한 콜백이 호출될 때 주 윈도우를 포커스하고 최소화되어있으면 창 복구를 실행합니다. `callback`은 `app`의 `ready` 이벤트가 발생한 후 실행됨을 보장합니다. -이 메서드는 현재 실행된 어플리케이션이 주 인스턴스인 경우 `false`를 반환하고 -어플리케이션의 로드가 계속 진행 되도록 합니다. 그리고 두 번째 중복된 인스턴스 생성인 +이 메서드는 현재 실행된 애플리케이션이 주 인스턴스인 경우 `false`를 반환하고 +애플리케이션의 로드가 계속 진행 되도록 합니다. 그리고 두 번째 중복된 인스턴스 생성인 경우 `true`를 반환합니다. (다른 인스턴스에 인수가 전달됬을 때) 이 불리언 값을 통해 중복 생성된 인스턴스는 즉시 종료시켜야 합니다. -OS X에선 사용자가 Finder에서 어플리케이션의 두 번째 인스턴스를 열려고 했을 때 자동으로 +macOS에선 사용자가 Finder에서 애플리케이션의 두 번째 인스턴스를 열려고 했을 때 자동으로 **Single Instance** 화 하고 `open-file`과 `open-url` 이벤트를 발생시킵니다. 그러나 -사용자가 어플리케이션을 CLI 터미널에서 실행하면 운영체제 시스템의 싱글 인스턴스 -메커니즘이 무시되며 그대로 중복 실행됩니다. 따라서 OS X에서도 이 메서드를 통해 확실히 +사용자가 애플리케이션을 CLI 터미널에서 실행하면 운영체제 시스템의 싱글 인스턴스 +메커니즘이 무시되며 그대로 중복 실행됩니다. 따라서 macOS에서도 이 메서드를 통해 확실히 중복 실행을 방지하는 것이 좋습니다. -다음 예시는 두 번째 인스턴스가 생성되었을 때 중복된 인스턴스를 종료하고 주 어플리케이션 +다음 예시는 두 번째 인스턴스가 생성되었을 때 중복된 인스턴스를 종료하고 주 애플리케이션 인스턴스의 윈도우를 활성화 시키는 예시입니다: ```javascript let myWindow = null; const shouldQuit = app.makeSingleInstance((commandLine, workingDirectory) => { - // 어플리케이션을 중복 실행했습니다. 주 어플리케이션 인스턴스를 활성화 합니다. + // 애플리케이션을 중복 실행했습니다. 주 애플리케이션 인스턴스를 활성화 합니다. if (myWindow) { if (myWindow.isMinimized()) myWindow.restore(); myWindow.focus(); @@ -527,9 +537,9 @@ app.on('ready', () => { ### `app.releaseSingleInstance()` 모든 `makeSingleInstance`에 의해 생성된 제한을 해제합니다. 이 메서드는 다시 여러 -인스턴스의 어플리케이션이 나란히 실행될 수 있도록 합니다. +인스턴스의 애플리케이션이 나란히 실행될 수 있도록 합니다. -### `app.setUserActivity(type, userInfo[, webpageURL])` _OS X_ +### `app.setUserActivity(type, userInfo[, webpageURL])` _macOS_ * `type` String - 고유하게 activity를 식별합니다. [`NSUserActivity.activityType`][activity-type]을 맵핑합니다. @@ -540,7 +550,7 @@ app.on('ready', () => { `NSUserActivity`를 만들고 현재 activity에 설정합니다. 이 activity는 이후 다른 기기와 [Handoff][handoff]할 때 자격으로 사용됩니다. -### `app.getCurrentActivityType()` _OS X_ +### `app.getCurrentActivityType()` _macOS_ 현재 작동중인 activity의 타입을 반환합니다. @@ -548,7 +558,7 @@ app.on('ready', () => { * `id` String -[어플리케이션의 사용자 모델 ID][app-user-model-id]를 `id`로 변경합니다. +[애플리케이션의 사용자 모델 ID][app-user-model-id]를 `id`로 변경합니다. ### `app.importCertificate(options, callback)` _LINUX_ @@ -563,6 +573,12 @@ pkcs12 형식으로된 인증서를 플랫폼 인증서 저장소로 가져옵 다른 값은 모두 Chrominum의 [net_error_list](https://code.google.com/p/chromium/codesearch#chromium/src/net/base/net_error_list.h)에 따라 실패를 의미합니다. +### `app.disableHardwareAcceleration()` + +현재 애플리케이션의 하드웨어 가속을 비활성화합니다. + +이 메서드는 `app`의 `ready` 이벤트가 발생하기 전에만 호출할 수 있습니다. + ### `app.commandLine.appendSwitch(switch[, value])` Chrominum의 명령줄에 스위치를 추가합니다. `value`는 추가적인 값을 뜻하며 옵션입니다. @@ -576,56 +592,56 @@ Chrominum의 명령줄에 인수를 추가합니다. 인수는 올바르게 인 **참고:** 이 메서드는 `process.argv`에 영향을 주지 않습니다. -### `app.dock.bounce([type])` _OS X_ +### `app.dock.bounce([type])` _macOS_ * `type` String (optional) - `critical` 또는 `informational`을 지정할 수 있습니다. 기본값은 `informational` 입니다. -`critical`이 전달되면 dock 아이콘이 어플리케이션이 활성화되거나 요청이 중지되기 전까지 +`critical`이 전달되면 dock 아이콘이 애플리케이션이 활성화되거나 요청이 중지되기 전까지 통통 튀는 바운스 효과를 적용합니다. -`informational`이 전달되면 dock 아이콘이 1초만 통통 튑니다. 하지만 어플리케이션이 +`informational`이 전달되면 dock 아이콘이 1초만 통통 튑니다. 하지만 애플리케이션이 활성화되거나 요청이 중지되기 전까지 요청은 계속 활성화로 유지 됩니다. 또한 요청을 취소할 때 사용할 수 있는 ID를 반환합니다. -### `app.dock.cancelBounce(id)` _OS X_ +### `app.dock.cancelBounce(id)` _macOS_ * `id` Integer `app.dock.bounce([type])` 메서드에서 반환한 `id`의 바운스 효과를 취소합니다. -### `app.dock.downloadFinished(filePath)` _OS X_ +### `app.dock.downloadFinished(filePath)` _macOS_ * `filePath` String `filePath`가 다운로드 폴더에 들어있다면 다운로드 스택을 바운스합니다. -### `app.dock.setBadge(text)` _OS X_ +### `app.dock.setBadge(text)` _macOS_ * `text` String dock의 badge에 표시할 문자열을 설정합니다. -### `app.dock.getBadge()` _OS X_ +### `app.dock.getBadge()` _macOS_ dock의 badge에 설정된 문자열을 반환합니다. -### `app.dock.hide()` _OS X_ +### `app.dock.hide()` _macOS_ dock 아이콘을 숨깁니다. -### `app.dock.show()` _OS X_ +### `app.dock.show()` _macOS_ dock 아이콘을 표시합니다. -### `app.dock.setMenu(menu)` _OS X_ +### `app.dock.setMenu(menu)` _macOS_ * `menu` [Menu](menu.md) -어플리케이션의 [dock menu][dock-menu]를 설정합니다. +애플리케이션의 [dock menu][dock-menu]를 설정합니다. -### `app.dock.setIcon(image)` _OS X_ +### `app.dock.setIcon(image)` _macOS_ * `image` [NativeImage](native-image.md) diff --git a/docs-translations/ko-KR/api/auto-updater.md b/docs-translations/ko-KR/api/auto-updater.md index e7fd24aa658..8dedf6ba8e1 100644 --- a/docs-translations/ko-KR/api/auto-updater.md +++ b/docs-translations/ko-KR/api/auto-updater.md @@ -1,17 +1,17 @@ # autoUpdater -> 어플리케이션이 자동으로 업데이트를 진행할 수 있도록 기능을 활성화합니다. +> 애플리케이션이 자동으로 업데이트를 진행할 수 있도록 기능을 활성화합니다. `autoUpdater` 모듈은 [Squirrel](https://github.com/Squirrel) 프레임워크에 대한 인터페이스를 제공합니다. -다음 프로젝트 중 하나를 선택하여, 어플리케이션을 배포하기 위한 멀티-플랫폼 릴리즈 +다음 프로젝트 중 하나를 선택하여, 애플리케이션을 배포하기 위한 멀티-플랫폼 릴리즈 서버를 손쉽게 구축할 수 있습니다: -- [nuts][nuts]: *어플리케이션을 위한 똑똑한 릴리즈 서버이며 GitHub를 백엔드로 +- [nuts][nuts]: *애플리케이션을 위한 똑똑한 릴리즈 서버이며 GitHub를 백엔드로 사용합니다. Squirrel을 통해 자동 업데이트를 지원합니다. (Mac & Windows)* - [electron-release-server][electron-release-server]: *완벽하게 모든 기능을 -지원하는 electron 어플리케이션을 위한 자가 호스트 릴리즈 서버입니다. auto-updater와 +지원하는 electron 애플리케이션을 위한 자가 호스트 릴리즈 서버입니다. autoUpdater와 호환됩니다* - [squirrel-updates-server][squirrel-updates-server]: *GitHub 릴리즈를 사용하는 Squirrel.Mac 와 Squirrel.Windows를 위한 간단한 node.js 기반 서버입니다* @@ -21,39 +21,41 @@ Squirrel.Mac 와 Squirrel.Windows를 위한 간단한 node.js 기반 서버입 `autoUpdater`는 기본적으로 모든 플랫폼에 대해 같은 API를 제공하지만, 여전히 플랫폼별로 약간씩 다른 점이 있습니다. -### OS X +### macOS -OS X에선 `auto-updater` 모듈이 [Squirrel.Mac][squirrel-mac]를 기반으로 작동합니다. +macOS에선 `autoUpdater`가 [Squirrel.Mac][squirrel-mac]를 기반으로 작동합니다. 따라서 이 모듈을 작동시키기 위해 특별히 준비해야 할 작업은 없습니다. 서버 사이드 요구 사항은 [서버 지원][server-support]을 참고하세요. -**참고:** Mac OS X에서 자동 업데이트를 지원하려면 반드시 사인이 되어있어야 합니다. +**참고:** macOS에서 자동 업데이트를 지원하려면 반드시 사인이 되어있어야 합니다. 이것은 `Squirrel.Mac`의 요구 사항입니다. ### Windows -Windows에선 `auto-updater` 모듈을 사용하기 전에 어플리케이션을 사용자의 장치에 -설치해야 합니다. [grunt-electron-installer][installer]를 사용하여 어플리케이션 -인스톨러를 만드는 것을 권장합니다. +Windows에선 `autoUpdater`를 사용하기 전에 애플리케이션을 사용자의 장치에 +설치해야 합니다. [electron-winstaller][installer-lib], +[electron-builder][electron-builder-lib] 또는 +[grunt-electron-installer][installer]를 사용하여 애플리케이션 인스톨러를 만드는 것을 +권장합니다. -Windows에선 `autoUpdater` 모듈을 사용하기 전에 사용자의 장치에 어플리케이션을 +Windows에선 `autoUpdater` 모듈을 사용하기 전에 사용자의 장치에 애플리케이션을 설치해야 합니다. 따라서 [electron-winstaller][installer-lib] 모듈이나 -[grunt-electron-installer][installer] 패키지를 사용하여 어플리케이션 인스톨러를 +[grunt-electron-installer][installer] 패키지를 사용하여 애플리케이션 인스톨러를 만드는 것을 권장합니다. Squirrel로 생성된 인스톨러는 [Application User Model ID][app-user-model-id]와 함께 `com.squirrel.PACKAGE_ID.YOUR_EXE_WITHOUT_DOT_EXE`으로 형식화된 바로가기 아이콘을 생성합니다. `com.squirrel.slack.Slack` 과 `com.squirrel.code.Code`가 그 예시입니다. -`app.setAppUserModelId` API를 통해 어플리케이션 ID를 동일하게 유지해야 합니다. 그렇지 -않으면 Windows 작업 표시줄에 어플리케이션을 고정할 때 제대로 적용되지 않을 수 있습니다. +`app.setAppUserModelId` API를 통해 애플리케이션 ID를 동일하게 유지해야 합니다. 그렇지 +않으면 Windows 작업 표시줄에 애플리케이션을 고정할 때 제대로 적용되지 않을 수 있습니다. -서버 사이드 요구 사항 또한 OS X와 다르게 적용됩니다. 자세한 내용은 +서버 사이드 요구 사항 또한 macOS와 다르게 적용됩니다. 자세한 내용은 [Squirrel.Windows][squirrel-windows]를 참고하세요. ### Linux -Linux는 따로 `auto-updater`를 지원하지 않습니다. -각 배포판의 패키지 관리자를 통해 어플리케이션 업데이트를 제공하는 것을 권장합니다. +Linux는 따로 `autoUpdater`를 지원하지 않습니다. +각 배포판의 패키지 관리자를 통해 애플리케이션 업데이트를 제공하는 것을 권장합니다. ## Events @@ -95,11 +97,12 @@ Returns: `autoUpdater` 객체에서 사용할 수 있는 메서드입니다: -### `autoUpdater.setFeedURL(url)` +### `autoUpdater.setFeedURL(url[, requestHeaders])` * `url` String +* `requestHeaders` Object _macOS_ - HTTP 요청 헤더. -`url`을 설정하고 자동 업데이터를 초기화합니다. `url`은 한번 설정되면 변경할 수 없습니다. +`url`을 설정하고 자동 업데이터를 초기화합니다. ### `autoUpdater.checkForUpdates()` @@ -108,7 +111,7 @@ Returns: ### `autoUpdater.quitAndInstall()` -어플리케이션을 다시 시작하고 다운로드된 업데이트를 설치합니다. +애플리케이션을 다시 시작하고 다운로드된 업데이트를 설치합니다. 이 메서드는 `update-downloaded` 이벤트가 발생한 이후에만 사용할 수 있습니다. [squirrel-mac]: https://github.com/Squirrel/Squirrel.Mac @@ -116,6 +119,7 @@ Returns: [squirrel-windows]: https://github.com/Squirrel/Squirrel.Windows [installer]: https://github.com/electron/grunt-electron-installer [installer-lib]: https://github.com/electron/windows-installer +[electron-builder-lib]: https://github.com/electron-userland/electron-builder [app-user-model-id]: https://msdn.microsoft.com/en-us/library/windows/desktop/dd378459(v=vs.85).aspx [electron-release-server]: https://github.com/ArekSredzki/electron-release-server [squirrel-updates-server]: https://github.com/Aluxian/squirrel-updates-server diff --git a/docs-translations/ko-KR/api/browser-window.md b/docs-translations/ko-KR/api/browser-window.md index df098cde877..b65f50911fb 100644 --- a/docs-translations/ko-KR/api/browser-window.md +++ b/docs-translations/ko-KR/api/browser-window.md @@ -6,22 +6,61 @@ ```javascript // 메인 프로세스에서 -const {BrowserWindow} = require('electron'); +const {BrowserWindow} = require('electron') // 또는 렌더러 프로세스에서 -const {BrowserWindow} = require('electron').remote; +const {BrowserWindow} = require('electron').remote -let win = new BrowserWindow({width: 800, height: 600, show: false}); +let win = new BrowserWindow({width: 800, height: 600}) win.on('closed', () => { win = null; -}); +}) win.loadURL('https://github.com'); -win.show(); ``` -또한 [Frameless Window](frameless-window.md) API를 사용하여 창 테두리가 없는 윈도우 -창을 생성할 수 있습니다. +## Frameless 윈도우 + +Frameless 윈도우를 만들거나 일정한 모양의 투명한 윈도우를 만드려면, +[Frameless 윈도우](frameless-window.md) API를 사용할 수 있습니다. + +## 우아하게 윈도우 표시하기 + +윈도우에서 페이지를 로딩할 때, 사용자는 페이지가 로드되는 모습을 볼 것입니다. +네이티브 어플리케이션으로써 좋지 않은 경험입니다. 윈도우가 시각적인 깜빡임 없이 +표시되도록 만드려면, 서로 다른 상황을 위해 두 가지 방법이 있습니다. + +### `ready-to-show` 이벤트 사용하기 + +페이지가 로딩되는 동안, `ready-to-show` 이벤트가 랜더러 프로세스가 랜더링이 완료되었을 +때 처음으로 발생합니다. 이 이벤트 이후로 윈도우를 표시하면 시각적인 깜빡임 없이 표시할 +수 있습니다. + +```javascript +let win = new BrowserWindow({show: false}) +win.once('ready-to-show', () => { + win.show() +}) +``` + +이 이벤트는 보통 `did-finish-load` 이벤트 이후에 발생하지만, 페이지가 너무 많은 외부 +리소스를 가지고 있다면, `did-finish-load` 이벤트가 발생하기 이전에 발생할 수도 +있습니다. + +### `backgroundColor` 설정하기 + +복잡한 어플리케이션에선, `ready-to-show` 이벤트가 너무 늦게 발생할 수 있습니다. +이는 사용자가 어플리케이션이 느리다고 생각할 수 있습니다. 이러한 경우 어플리케이션 +윈도우를 바로 보이도록 하고 어플리케이션의 배경과 가까운 배경색을 `backgroundColor`을 +통해 설정합니다: + +```javascript +let win = new BrowserWindow({backgroundColor: '#2e2c29'}) +win.loadURL('https://github.com') +``` + +참고로 `ready-to-show` 이벤트를 사용하더라도 어플리케이션을 네이티브 느낌이 나도록 +하기 위해 `backgroundColor`도 같이 설정하는 것을 권장합니다. ## Class: BrowserWindow @@ -58,15 +97,20 @@ win.show(); 않습니다. 기본값은 `true` 입니다. * `closable` Boolean - 윈도우를 닫을 수 있는지 여부. Linux에선 구현되어있지 않습니다. 기본값은 `true` 입니다. +* `focusable` Boolean - 윈도우가 포커스될 수 있는지 여부입니다. 기본값은 + `true`입니다. Windows에선 `focusable: false`를 설정함으로써 암시적으로 + `skipTaskbar: true`도 설정됩니다. Linux에선 `focusable: false`를 설정함으로써 + 윈도우가 wm과 함께 반응을 중지하며 모든 작업 영역에서 윈도우가 언제나 최상단에 있게 + 됩니다. * `alwaysOnTop` Boolean - 윈도우이 언제나 다른 창들 위에 유지되는지 여부. 기본값은 `false`입니다. * `fullscreen` Boolean - 윈도우의 전체화면 활성화 여부. 이 속성을 명시적으로 - `false`로 지정했을 경우, OS X에선 전체화면 버튼이 숨겨지거나 비활성됩니다. 기본값은 + `false`로 지정했을 경우, macOS에선 전체화면 버튼이 숨겨지거나 비활성됩니다. 기본값은 `false` 입니다. * `fullscreenable` Boolean - 윈도우가 전체화면 모드로 전환될 수 있는지 여부입니다. - 또한 OS X에선, 최대화/줌 버튼이 전체화면 모드 또는 윈도우 최대화를 실행할지 여부도 + 또한 macOS에선, 최대화/줌 버튼이 전체화면 모드 또는 윈도우 최대화를 실행할지 여부도 포함됩니다. 기본값은 `true`입니다. -* `skipTaskbar` Boolean - 작업표시줄 어플리케이션 아이콘 표시 스킵 여부. 기본값은 +* `skipTaskbar` Boolean - 작업표시줄 애플리케이션 아이콘 표시 스킵 여부. 기본값은 `false`입니다. * `kiosk` Boolean - Kiosk(키오스크) 모드. 기본값은 `false`입니다. * `title` String - 기본 윈도우 제목. 기본값은 `"Electron"`입니다. @@ -85,23 +129,23 @@ On Windows it is 활성화 되는 동시에 단일 mouse-down 이벤트를 발생시킬지 여부. 기본값은 `false`입니다. * `disableAutoHideCursor` Boolean - 타이핑중 자동으로 커서를 숨길지 여부. 기본값은 `false`입니다. -* `autoHideMenuBar` Boolean - `Alt`를 누르지 않는 한 어플리케이션 메뉴바를 숨길지 +* `autoHideMenuBar` Boolean - `Alt`를 누르지 않는 한 애플리케이션 메뉴바를 숨길지 여부. 기본값은 `false`입니다. * `enableLargerThanScreen` Boolean - 윈도우 크기가 화면 크기보다 크게 재조정 될 수 있는지 여부. 기본값은 `false`입니다. * `backgroundColor` String - `#66CD00` 와 `#FFF`, `#80FFFFFF` (알파 지원됨) 같이 16진수로 표현된 윈도우의 배경 색. 기본값은 `#FFF` (white). * `hasShadow` Boolean - 윈도우가 그림자를 가질지 여부를 지정합니다. 이 속성은 - OS X에서만 구현되어 있습니다. 기본값은 `true`입니다. + macOS에서만 구현되어 있습니다. 기본값은 `true`입니다. * `darkTheme` Boolean - 설정에 상관 없이 무조건 어두운 윈도우 테마를 사용합니다. 몇몇 GTK+3 데스크톱 환경에서만 작동합니다. 기본값은 `false`입니다. * `transparent` Boolean - 윈도우를 [투명화](frameless-window.md)합니다. 기본값은 `false`입니다. * `type` String - 특정 플랫폼에만 적용되는 윈도우의 종류를 지정합니다. 기본값은 일반 윈도우 입니다. 사용할 수 있는 창의 종류는 아래를 참고하세요. -* `standardWindow` Boolean - OS X의 표준 윈도우를 텍스쳐 윈도우 대신 사용합니다. +* `standardWindow` Boolean - macOS의 표준 윈도우를 텍스쳐 윈도우 대신 사용합니다. 기본 값은 `true`입니다. -* `titleBarStyle` String, OS X - 윈도우 타이틀 바 스타일을 지정합니다. 자세한 사항은 +* `titleBarStyle` String, macOS - 윈도우 타이틀 바 스타일을 지정합니다. 자세한 사항은 아래를 참고하세요. * `webPreferences` Object - 웹 페이지 기능을 설정합니다. 사용할 수 있는 속성은 아래를 참고하세요. @@ -114,14 +158,14 @@ On Windows it is * Linux의 경우, `desktop`, `dock`, `toolbar`, `splash`, `notification` 종류를 사용할 수 있습니다. -* OS X의 경우, `desktop`, `textured` 종류를 사용할 수 있습니다. +* macOS의 경우, `desktop`, `textured` 종류를 사용할 수 있습니다. * `textured`는 창에 메탈 그라디언트 외관(`NSTexturedBackgroundWindowMask`)을 설정합니다. * `desktop`은 데스크탑 배경 레벨(`kCGDesktopWindowLevel - 1`)에 윈도우를 배치합니다. 참고로 이렇게 만들어진 윈도우는 포커스, 키보드, 마우스 이벤트를 받을 수 없습니다. 하지만 편법으로 `globalShortcut`을 통해 키 입력을 받을 수 있습니다. -`titleBarStyle` 속성은 OS X 10.10 Yosemite 이후 버전만 지원하며, 다음 3가지 종류의 +`titleBarStyle` 속성은 macOS 10.10 Yosemite 이후 버전만 지원하며, 다음 3가지 종류의 값을 사용할 수 있습니다: * `default` 또는 미지정: 표준 Mac 회색 불투명 스타일을 사용합니다. @@ -148,7 +192,7 @@ On Windows it is 페이지에서 같은 `partition`을 사용할 수 있습니다. 만약 `persist:` 접두어로 시작하지 않으면 페이지는 인-메모리 세션을 사용합니다. 여러 페이지에서 같은 `partition`을 지정하면 같은 세션을 공유할 수 있습니다. `partition`을 지정하지 - 않으면 어플리케이션의 기본 세션이 사용됩니다. + 않으면 애플리케이션의 기본 세션이 사용됩니다. * `zoomFactor` Number - 페이지의 기본 줌 값을 지정합니다. 예를 들어 `300%`를 표현하려면 `3.0`으로 지정합니다. 기본값은 `1.0`입니다. * `javascript` Boolean - 자바스크립트를 활성화합니다. 기본값은 `false`입니다. @@ -174,11 +218,14 @@ On Windows it is 활성화합니다. 기본값은 `false`입니다. * `directWrite` Boolean - Windows에서 폰트 렌더링을 위해 DirectWrite를 사용하는지를 지정합니다. 기본값은 `true`입니다. -* `scrollBounce` Boolean - OS X에서 스크롤 튕기기 효과 (탄성 밴딩)를 활성화 합니다. +* `scrollBounce` Boolean - macOS에서 스크롤 튕기기 효과 (탄성 밴딩)를 활성화 합니다. 기본값은 `false`입니다. -* `blinkFeatures` String - `CSSVariables,KeyboardEventKey`같은 `,`로 구분된 - 기능 문자열들의 리스트입니다. 지원하는 전체 기능 문자열들은 - [setFeatureEnabledFromString][blink-feature-string] 함수에서 찾을 수 있습니다. +* `blinkFeatures` String - 활성화 할 `CSSVariables,KeyboardEventKey`같이 `,`로 + 구분된 기능 문자열들의 리스트입니다. [RuntimeEnabledFeatures.in][blink-feature-string] + 파일에서 찾을 수 있습니다. +* `disableBlinkFeatures` String - 비활성화 할 `CSSVariables,KeyboardEventKey`같이 + `,`로 구분된 기능 문자열들의 리스트입니다. [RuntimeEnabledFeatures.in][blink-feature-string] + 파일에서 찾을 수 있습니다. * `defaultFontFamily` Object - font-family의 기본 폰트를 지정합니다. * `standard` String - 기본값 `Times New Roman`. * `serif` String - 기본값 `Times New Roman`. @@ -227,7 +274,7 @@ window.onbeforeunload = (e) => { // 일반적인 브라우저와는 달리 사용자에게 확인 창을 보여주지 않고, non-void 값을 반환하면 // 조용히 닫기를 취소합니다. - // Dialog API를 통해 사용자가 어플리케이션을 종료할지 정할 수 있도록 확인 창을 표시하는 것을 + // Dialog API를 통해 사용자가 애플리케이션을 종료할지 정할 수 있도록 확인 창을 표시하는 것을 // 추천합니다. e.returnValue = false; }; @@ -262,6 +309,11 @@ window.onbeforeunload = (e) => { 윈도우가 숨겨진 상태일 때 발생하는 이벤트입니다. +### Event: 'ready-to-show' + +웹 페이지가 완전히 랜더링되어 윈도우가 시각적인 깜빡임없이 컨텐츠를 보여줄 수 있을 때 +발생하는 이벤트입니다. + ### Event: 'maximize' 윈도우가 최대화됐을 때 발생하는 이벤트입니다. @@ -286,9 +338,9 @@ window.onbeforeunload = (e) => { 윈도우가 새로운 위치로 이동될 때 발생하는 이벤트입니다. -__참고__: OS X에선 이 이벤트가 그저 `moved` 이벤트의 별칭(alias)으로 사용됩니다. +__참고__: macOS에선 이 이벤트가 그저 `moved` 이벤트의 별칭(alias)으로 사용됩니다. -### Event: 'moved' _OS X_ +### Event: 'moved' _macOS_ 윈도우가 새로운 위치로 이동되었을 때 발생하는 이벤트입니다. (한 번만) @@ -333,15 +385,15 @@ someWindow.on('app-command', (e, cmd) => { }); ``` -### Event: 'scroll-touch-begin' _OS X_ +### Event: 'scroll-touch-begin' _macOS_ 스크롤 휠 이벤트가 동작하기 시작했을 때 발생하는 이벤트입니다. -### Event: 'scroll-touch-end' _OS X_ +### Event: 'scroll-touch-end' _macOS_ 스크롤 휠 이벤트가 동작을 멈췄을 때 발생하는 이벤트입니다. -### Event: 'swipe' _OS X_ +### Event: 'swipe' _macOS_ Returns: @@ -361,7 +413,7 @@ Returns: ### `BrowserWindow.getFocusedWindow()` -어플리케이션에서 포커스된 윈도우를 반환합니다. 포커스된 윈도우가 없을 경우 `null`을 +애플리케이션에서 포커스된 윈도우를 반환합니다. 포커스된 윈도우가 없을 경우 `null`을 반환합니다. ### `BrowserWindow.fromWebContents(webContents)` @@ -382,8 +434,11 @@ ID에 해당하는 윈도우를 찾습니다. `path`에 있는 개발자 도구 확장 기능을 추가합니다. 그리고 확장 기능의 이름을 반환합니다. -확장 기능은 기억됩니다. 따라서 API는 단 한 번만 호출되어야 합니다. -이 API는 실제 프로그램 작성에 사용할 수 없습니다. +확장 기능은 기억됩니다. 따라서 API는 단 한 번만 호출되어야 합니다. 이 API는 실제 +프로그램 작성에 사용할 수 없습니다. 만약 이미 로드된 확장 기능을 추가하려 한다면, 이 +메서드는 아무것도 반환하지 않고 콘솔에 경고가 로그됩니다. + +**참고:** 이 API는 `app` 모듈의 `ready` 이벤트가 발생하기 전까지 사용할 수 없습니다. ### `BrowserWindow.removeDevToolsExtension(name)` @@ -391,6 +446,21 @@ ID에 해당하는 윈도우를 찾습니다. `name`에 해당하는 개발자 도구 확장 기능을 제거합니다. +**참고:** 이 API는 `app` 모듈의 `ready` 이벤트가 발생하기 전까지 사용할 수 없습니다. + +### `BrowserWindow.getDevToolsExtensions()` + +키는 확장 기능 이름을 값은 `name`과 `version` 속성을 포함하는 객체를 가지는 객체를 +반환합니다. + +개발자 도구 확장 기능이 설치되었는지 확인하려면 다음과 같이 실행할 수 있습니다: + +```javascript +let installed = BrowserWindow.getDevToolsExtensions().hasOwnProperty('devtron') +``` + +**참고:** 이 API는 `app` 모듈의 `ready` 이벤트가 발생하기 전까지 사용할 수 없습니다. + ## Instance Properties `new BrowserWindow`로 생성한 객체는 다음과 같은 속성을 가지고 있습니다: @@ -492,7 +562,7 @@ let win = new BrowserWindow({width: 800, height: 600}); 윈도우가 전체화면 모드 상태인지 여부를 반환합니다. -### `win.setAspectRatio(aspectRatio[, extraSize])` _OS X_ +### `win.setAspectRatio(aspectRatio[, extraSize])` _macOS_ * `aspectRatio` 유지하려 하는 콘텐츠 뷰 일부의 종횡비 * `extraSize` Object (optional) - 종횡비를 유지하는 동안 포함되지 않을 엑스트라 크기. @@ -520,7 +590,7 @@ let win = new BrowserWindow({width: 800, height: 600}); * `width` Integer * `height` Integer -* `animate` Boolean (optional) _OS X_ +* `animate` Boolean (optional) _macOS_ 윈도우를 지정한 `width`, `height`, `x`, `y`로 크기 재조정 및 이동합니다. @@ -532,7 +602,7 @@ let win = new BrowserWindow({width: 800, height: 600}); * `width` Integer * `height` Integer -* `animate` Boolean (optional) _OS X_ +* `animate` Boolean (optional) _macOS_ `width`와 `height` 값으로 윈도우 크기를 재조정합니다. (너비, 높이) @@ -544,7 +614,7 @@ let win = new BrowserWindow({width: 800, height: 600}); * `width` Integer * `height` Integer -* `animate` Boolean (optional) _OS X_ +* `animate` Boolean (optional) _macOS_ 윈도우 클라이언트 영역(웹 페이지)의 크기를 `width`, `height`로 재조정합니다. @@ -584,38 +654,38 @@ let win = new BrowserWindow({width: 800, height: 600}); 사용자에 의해 윈도우의 크기가 재조정될 수 있는지 여부를 반환합니다. -### `win.setMovable(movable)` _OS X_ _Windows_ +### `win.setMovable(movable)` _macOS_ _Windows_ * `movable` Boolean 사용자에 의해 윈도우를 이동시킬 수 있는지 여부를 지정합니다. Linux에선 아무 일도 일어나지 않습니다. -### `win.isMovable()` _OS X_ _Windows_ +### `win.isMovable()` _macOS_ _Windows_ 사용자에 의해 윈도우를 이동시킬 수 있는지 여부를 반환합니다. Linux에선 항상 `true`를 반환합니다. -### `win.setMinimizable(minimizable)` _OS X_ _Windows_ +### `win.setMinimizable(minimizable)` _macOS_ _Windows_ * `minimizable` Boolean 사용자에 의해 윈도우를 최소화시킬 수 있는지 여부를 지정합니다. Linux에선 아무 일도 일어나지 않습니다. -### `win.isMinimizable()` _OS X_ _Windows_ +### `win.isMinimizable()` _macOS_ _Windows_ 사용자에 의해 윈도우를 최소화시킬 수 있는지 여부를 반환합니다. Linux에선 항상 `true`를 반환합니다. -### `win.setMaximizable(maximizable)` _OS X_ _Windows_ +### `win.setMaximizable(maximizable)` _macOS_ _Windows_ * `maximizable` Boolean 사용자에 의해 윈도우를 최대화시킬 수 있는지 여부를 지정합니다. Linux에선 아무 일도 일어나지 않습니다. -### `win.isMaximizable()` _OS X_ _Windows_ +### `win.isMaximizable()` _macOS_ _Windows_ 사용자에 의해 윈도우를 최대화시킬 수 있는지 여부를 반환합니다. Linux에선 항상 `true`를 반환합니다. @@ -632,14 +702,14 @@ let win = new BrowserWindow({width: 800, height: 600}); 최대화/줌 버튼이 전체화면 모드 또는 윈도우 최대화를 토글할 수 있게 할지 여부를 반환합니다. -### `win.setClosable(closable)` _OS X_ _Windows_ +### `win.setClosable(closable)` _macOS_ _Windows_ * `closable` Boolean 사용자에 의해 윈도우가 수동적으로 닫힐 수 있는지 여부를 지정합니다. Linux에선 아무 일도 일어나지 않습니다. -### `win.isClosable()` _OS X_ _Windows_ +### `win.isClosable()` _macOS_ _Windows_ 사용자에 의해 윈도우가 수동적으로 닫힐 수 있는지 여부를 반환합니다. Linux에선 항상 `true`를 반환합니다. @@ -663,7 +733,7 @@ let win = new BrowserWindow({width: 800, height: 600}); * `x` Integer * `y` Integer -* `animate` Boolean (optional) _OS X_ +* `animate` Boolean (optional) _macOS_ 윈도우의 위치를 `x`, `y`로 이동합니다. @@ -683,9 +753,9 @@ let win = new BrowserWindow({width: 800, height: 600}); **참고:** 웹 페이지의 제목과 네이티브 윈도우의 제목은 서로 다를 수 있습니다. -### `win.setSheetOffset(offsetY[, offsetX])` _OS X_ +### `win.setSheetOffset(offsetY[, offsetX])` _macOS_ -Mac OS X에서 시트를 부착할 위치를 지정합니다. 기본적으로 시트는 윈도우의 프레임 바로 +macOS에서 시트를 부착할 위치를 지정합니다. 기본적으로 시트는 윈도우의 프레임 바로 아래의 위치에 부착됩니다. 아마도 이 기능은 보통 다음과 같이 HTML 렌더링된 툴바 밑에 표시하기 위해 사용할 것입니다: @@ -704,7 +774,7 @@ win.setSheetOffset(toolbarRect.height); * `skip` Boolean -어플리케이션 아이콘을 작업표시줄에 보이지 않도록 설정합니다. +애플리케이션 아이콘을 작업표시줄에 보이지 않도록 설정합니다. ### `win.setKiosk(flag)` @@ -720,7 +790,7 @@ Kiosk(키오스크) 모드를 설정합니다. `Buffer` 상의 플랫폼에 따른 윈도우 핸들을 반환합니다. -핸들의 타입에 따라 적절히 캐스팅됩니다. Windows의 `HWND`, OS X의 `NSView*`, Linux의 +핸들의 타입에 따라 적절히 캐스팅됩니다. Windows의 `HWND`, macOS의 `NSView*`, Linux의 `Window` (`unsigned long`)를 예로 들 수 있습니다. ### `win.hookWindowMessage(message, callback)` _Windows_ @@ -747,24 +817,24 @@ Windows 메시지 훅을 등록합니다. `callback`은 WndProc에서 메시지 모든 메시지 훅을 등록 해제합니다. -### `win.setRepresentedFilename(filename)` _OS X_ +### `win.setRepresentedFilename(filename)` _macOS_ * `filename` String 윈도우 대표 파일의 경로명을 설정합니다. 파일의 아이콘이 윈도우 타이틀 바에 표시됩니다. -### `win.getRepresentedFilename()` _OS X_ +### `win.getRepresentedFilename()` _macOS_ 윈도우 대표 파일의 경로명을 반환합니다. -### `win.setDocumentEdited(edited)` _OS X_ +### `win.setDocumentEdited(edited)` _macOS_ * `edited` Boolean 윈도우의 문서가 변경되었는지 여부를 설정합니다. 그리고 `true`로 설정했을 때 타이틀 바의 아이콘이 회색으로 표시됩니다. -### `win.isDocumentEdited()` _OS X_ +### `win.isDocumentEdited()` _macOS_ 윈도우의 문서가 변경되었는지 여부를 반환합니다. @@ -803,7 +873,7 @@ Windows 메시지 훅을 등록합니다. `callback`은 WndProc에서 메시지 * `progress` Double -작업표시줄에 표시되고 있는 어플리케이션 아이콘에 진행 상태를 표시합니다. [0, 1.0] +작업표시줄에 표시되고 있는 애플리케이션 아이콘에 진행 상태를 표시합니다. [0, 1.0] 사이의 값을 지정할 수 있습니다. 진행 상태가 < 0 이 되면 진행 상태 표시를 제거합니다. @@ -820,16 +890,16 @@ Linux 플랫폼에선 Unity 데스크톱 환경만 지원합니다. 그리고 * `description` String - 접근성 설정에 의한 스크린 리더에 제공될 설명입니다 현재 작업표시줄 아이콘에 16 x 16 픽셀 크기의 오버레이를 지정합니다. 보통 이 기능은 -어플리케이션의 여러 상태를 사용자에게 소극적으로 알리기 위한 방법으로 사용됩니다. +애플리케이션의 여러 상태를 사용자에게 소극적으로 알리기 위한 방법으로 사용됩니다. -### `win.setHasShadow(hasShadow)` _OS X_ +### `win.setHasShadow(hasShadow)` _macOS_ * `hasShadow` (Boolean) 윈도우가 그림자를 가질지 여부를 지정합니다. Windows와 Linux에선 아무 일도 일어나지 않습니다. -### `win.hasShadow()` _OS X_ +### `win.hasShadow()` _macOS_ 윈도우가 그림자를 가지고 있는지 여부를 반환합니다. Windows와 Linux에선 항상 `true`를 반환합니다. @@ -864,9 +934,9 @@ Linux 플랫폼에선 Unity 데스크톱 환경만 지원합니다. 그리고 눌려지지 않은 상태를 유지합니다. 이 값은 버튼을 알림의 용도로 사용하기 위해 만들어졌습니다. -### `win.showDefinitionForSelection()` _OS X_ +### `win.showDefinitionForSelection()` _macOS_ -페이지의 선택된 단어에 대한 사전 검색 결과 팝업을 표시합니다. +`webContents.showDefinitionForSelection()`와 같습니다. ### `win.setIcon(icon)` _Windows_ _Linux_ @@ -895,7 +965,7 @@ Linux 플랫폼에선 Unity 데스크톱 환경만 지원합니다. 그리고 메뉴 막대의 표시 여부를 설정합니다. 만약 메뉴 막대 자동 숨김 상태라면 여전히 사용자가 `Alt` 키를 입력하여 메뉴 막대를 표시되도록 할 수 있습니다. -**역주:** 기본 메뉴 막대를 완전히 없애려면 `win.setMenu(null)`를 호출해야 합니다. +**역자주:** 기본 메뉴 막대를 완전히 없애려면 `win.setMenu(null)`를 호출해야 합니다. 단순히 이 API를 사용하면 여전히 메뉴에 등록된 핫 키가 작동합니다. ### `win.isMenuBarVisible()` @@ -916,10 +986,19 @@ Linux 플랫폼에선 Unity 데스크톱 환경만 지원합니다. 그리고 **참고:** 이 API는 Windows에서 언제나 false를 반환합니다. -### `win.setIgnoreMouseEvents(ignore)` _OS X_ +### `win.setIgnoreMouseEvents(ignore)` * `ignore` Boolean -윈도우에서 일어나는 모든 마우스 이벤트를 무시합니다. +윈도우가 모든 마우스 이벤트를 무시하게 만듭니다. -[blink-feature-string]: https://code.google.com/p/chromium/codesearch#chromium/src/out/Debug/gen/blink/platform/RuntimeEnabledFeatures.cpp&sq=package:chromium&type=cs&l=576 +이 윈도우에서 일어나는 모든 마우스 이벤트가 이 윈도우 밑의 윈도우로 전달됩니다. 하지만 +이 윈도우가 포커스되어 있다면, 여전히 키보드 이벤트는 받을 수 있습니다. + +### `win.setFocusable(focusable)` _Windows_ + +* `focusable` Boolean + +윈도우가 포커스될 수 있는지 여부를 변경합니다. + +[blink-feature-string]: https://cs.chromium.org/chromium/src/third_party/WebKit/Source/platform/RuntimeEnabledFeatures.in diff --git a/docs-translations/ko-KR/api/chrome-command-line-switches.md b/docs-translations/ko-KR/api/chrome-command-line-switches.md index 930d7511183..9a306735ece 100644 --- a/docs-translations/ko-KR/api/chrome-command-line-switches.md +++ b/docs-translations/ko-KR/api/chrome-command-line-switches.md @@ -2,8 +2,8 @@ > Electron에서 지원하는 커맨드 명령줄 스위치입니다. -어플리케이션 메인 스크립트의 [app][app] 모듈에서 [ready][ready] 이벤트가 실행되기 -전에 [app.commandLine.appendSwitch][append-switch]를 호출하면, 어플리케이션의 +애플리케이션 메인 스크립트의 [app][app] 모듈에서 [ready][ready] 이벤트가 실행되기 +전에 [app.commandLine.appendSwitch][append-switch]를 호출하면, 애플리케이션의 명령줄 옵션을 추가로 지정할 수 있습니다: ```javascript @@ -149,7 +149,7 @@ Chromium이 렌더러 프로세스의 보이지 않는 페이지의 우선순위 Chromium의 로그를 콘솔에 출력합니다. -이 스위치는 어플리케이션이 로드되기 전에 분석 되므로 `app.commandLine.appendSwitch` +이 스위치는 애플리케이션이 로드되기 전에 분석 되므로 `app.commandLine.appendSwitch` 메서드에선 사용할 수 없습니다. 하지만 `ELECTRON_ENABLE_LOGGING` 환경 변수를 설정하면 본 스위치를 지정한 것과 같은 효과를 낼 수 있습니다. diff --git a/docs-translations/ko-KR/api/crash-reporter.md b/docs-translations/ko-KR/api/crash-reporter.md index f70d3fb9ed2..4f9058aa217 100644 --- a/docs-translations/ko-KR/api/crash-reporter.md +++ b/docs-translations/ko-KR/api/crash-reporter.md @@ -2,7 +2,7 @@ > 원격 서버에 크래시 정보를 보고합니다. -다음 예시는 윈격 서버에 어플리케이션 크래시 정보를 자동으로 보고하는 예시입니다: +다음 예시는 윈격 서버에 애플리케이션 크래시 정보를 자동으로 보고하는 예시입니다: ```javascript const {crashReporter} = require('electron'); @@ -39,7 +39,7 @@ crashReporter.start({ 다른 crashReporter API를 사용하기 전에 이 메서드를 먼저 호출해야 합니다. -**참고:** OS X에선 Windows와 Linux의 `breakpad`와 달리 새로운 `crashpad` +**참고:** macOS에선 Windows와 Linux의 `breakpad`와 달리 새로운 `crashpad` 클라이언트를 사용합니다. 오류 수집 기능을 활성화 시키려면 오류를 수집하고 싶은 메인 프로세스나 렌더러 프로세스에서 `crashReporter.start` 메서드를 호출하여 `crashpad`를 초기화해야 합니다. diff --git a/docs-translations/ko-KR/api/dialog.md b/docs-translations/ko-KR/api/dialog.md index 949a26835db..c478d47bea1 100644 --- a/docs-translations/ko-KR/api/dialog.md +++ b/docs-translations/ko-KR/api/dialog.md @@ -105,7 +105,7 @@ const {dialog} = require('electron').remote; * `cancelId` Integer - 유저가 대화 상자의 버튼을 클릭하지 않고 대화 상자를 취소했을 때 반환되는 버튼의 인덱스입니다. 기본적으로 버튼 리스트가 "cancel" 또는 "no" 라벨을 가지고 있을 때 해당 버튼의 인덱스를 반환합니다. 따로 두 라벨이 지정되지 - 않은 경우 0을 반환합니다. OS X와 Windows에선 `cancelId` 지정 여부에 상관없이 + 않은 경우 0을 반환합니다. macOS와 Windows에선 `cancelId` 지정 여부에 상관없이 "Cancel" 버튼이 언제나 `cancelId`로 지정됩니다. * `noLink` Boolean - Windows에서 Electron은 ("Cancel"이나 "Yes"와 같은) 흔히 사용되는 버튼을 찾으려고 시도하고 대화 상자 내에서 해당 버튼을 커맨드 링크처럼 @@ -116,8 +116,8 @@ const {dialog} = require('electron').remote; 대화 상자를 표시합니다. `browserWindow`를 지정하면 대화 상자가 완전히 닫힐 때까지 지정한 창을 사용할 수 없습니다. 완료 시 유저가 선택한 버튼의 인덱스를 반환합니다. -**역주:** 부정을 표현하는 "아니오", "취소"와 같은 한글 단어는 지원되지 않습니다. 만약 -OS X 또는 Windows에서 "확인", "취소"와 같은 순서로 버튼을 지정하게 될 때 Alt + f4로 +**역자주:** 부정을 표현하는 "아니오", "취소"와 같은 한글 단어는 지원되지 않습니다. 만약 +macOS 또는 Windows에서 "확인", "취소"와 같은 순서로 버튼을 지정하게 될 때 Alt + f4로 해당 대화 상자를 끄게 되면 "확인"을 누른 것으로 판단되어 버립니다. 이를 해결하려면 "Cancel"을 대신 사용하거나 BrowserWindow API를 사용하여 대화 상자를 직접 구현해야 합니다. @@ -130,13 +130,13 @@ OS X 또는 Windows에서 "확인", "취소"와 같은 순서로 버튼을 지 에러 메시지를 보여주는 대화 상자를 표시합니다. 이 함수는 `app` 모듈의 `ready` 이벤트가 발생하기 전까지 사용할 수 있습니다. 이 메서드는 -보통 어플리케이션이 시작되기 전에 특정한 에러를 표시하기 위해 사용됩니다. 만약 +보통 애플리케이션이 시작되기 전에 특정한 에러를 표시하기 위해 사용됩니다. 만약 Linux에서 `ready` 이벤트가 발생하기 전에 이 API를 호출할 경우, 메시지는 stderr를 통해서 표시되며 GUI 대화 상자는 표시되지 않습니다. ## Sheets -Mac OS X에선, `browserWindow` 인수에 `BrowserWindow` 객체 참조를 전달하면 대화 +macOS에선, `browserWindow` 인수에 `BrowserWindow` 객체 참조를 전달하면 대화 상자가 해당 윈도우에 시트처럼 표시되도록 표현할 수 있습니다. 윈도우의 객체 참조가 제공되지 않으면 모달 형태로 표시됩니다. diff --git a/docs-translations/ko-KR/api/download-item.md b/docs-translations/ko-KR/api/download-item.md index a7489081bb3..781d6863604 100644 --- a/docs-translations/ko-KR/api/download-item.md +++ b/docs-translations/ko-KR/api/download-item.md @@ -2,49 +2,70 @@ > 원격 소스로부터의 파일 다운로드를 제어합니다. -`DownloadItem`은 EventEmitter를 상속받았으며 Electron의 다운로드 아이템을 표현합니다. -이 클래스 객체는 `Session` 모듈의 `will-download` 이벤트에 사용되며 사용자가 다운로드 -아이템을 다룰 수 있도록 도와줍니다. +`DownloadItem`은 `EventEmitter`를 상속받았으며 Electron의 다운로드 아이템을 +표현합니다. 이 클래스 객체는 `Session` 클래스의 `will-download` 이벤트에 사용되며 +사용자가 다운로드 아이템을 다룰 수 있도록 도와줍니다. ```javascript // 메인 프로세스 win.webContents.session.on('will-download', (event, item, webContents) => { // Set the save path, making Electron not to prompt a save dialog. - item.setSavePath('/tmp/save.pdf'); - console.log(item.getMimeType()); - console.log(item.getFilename()); - console.log(item.getTotalBytes()); - item.on('updated', () => { - console.log('Received bytes: ' + item.getReceivedBytes()); - }); - item.on('done', (e, state) => { - if (state === 'completed') { - console.log('Download successfully'); - } else { - console.log('Download is cancelled or interrupted that can\'t be resumed'); + item.setSavePath('/tmp/save.pdf') + + item.on('updated', (event, state) => { + if (state === 'interrupted') { + console.log('Download is interrupted but can be resumed') + } else if (state === 'progressing') { + if (item.isPaused()) { + console.log('Download is paused') + } else { + console.log(`Received bytes: ${item.getReceivedBytes()}`) + } } - }); -}); + }) + item.once('done', (event, state) => { + if (state === 'completed') { + console.log('Download successfully') + } else { + console.log(`Download failed: ${state}`) + } + }) +}) ``` ## Events ### Event: 'updated' -`downloadItem`이 갱신될 때 발생하는 이벤트입니다. - -### Event: 'done' +Returns: + +* `event` Event +* `state` String + +다운로드가 업데이트되었으며 아직 끝나지 않았을 때 발생하는 이벤트입니다. + +`state`는 다음 중 하나가 될 수 있습니다: + +* `progressing` - 다운로드가 진행중입니다. +* `interrupted` - 다운로드가 중지되었으며 다시 재개할 수 있습니다. + +### Event: 'done' + +Returns: * `event` Event * `state` String - * `completed` - 다운로드가 성공적으로 완료되었습니다. - * `cancelled` - 다운로드가 취소되었습니다. - * `interrupted` - 다운로드 중 파일 서버로부터의 연결이 끊겼습니다. 다운로드가 종료될 때 발생하는 이벤트입니다. 이 이벤트는 다운로드 중 문제가 발생하여 중단되거나, 모두 성공적으로 완료된 경우, `downloadItem.cancel()` 같은 메서드를 통해 취소하는 경우의 종료 작업이 모두 포함됩니다. +`state`는 다음 중 하나가 될 수 있습니다: + +* `completed` - 다운로드가 성공적으로 완료되었습니다. +* `cancelled` - 다운로드가 취소되었습니다. +* `interrupted` - 다운로드가 중지되었으며 다시 재개할 수 있습니다. + ## Methods `downloadItem` 객체는 다음과 같은 메서드를 가지고 있습니다: @@ -61,10 +82,18 @@ win.webContents.session.on('will-download', (event, item, webContents) => { 다운로드를 일시 중지합니다. +### `downloadItem.isPaused()` + +다운로드가 일시 중지되었는지 여부를 반환합니다. + ### `downloadItem.resume()` 중디된 다운로드를 재개합니다. +### `downloadItem.canResume()` + +다운로드를 재개할 수 있는지 여부를 반환합니다. + ### `downloadItem.cancel()` 다운로드를 취소합니다. @@ -101,3 +130,14 @@ win.webContents.session.on('will-download', (event, item, webContents) => { ### `downloadItem.getContentDisposition()` 응답 헤더에서 Content-Disposition 필드를 문자열로 반환합니다. + +### `downloadItem.getState()` + +현재 상태를 `String` 타입으로 가져옵니다. + +값은 다음이 될 수 있습니다: + +* `progressing` - 다운로드가 진행중입니다. +* `completed` - 다운로드가 성공적으로 완료되었습니다. +* `cancelled` - 다운로드가 취소되었습니다. +* `interrupted` - 다운로드가 중지되었습니다. diff --git a/docs-translations/ko-KR/api/environment-variables.md b/docs-translations/ko-KR/api/environment-variables.md index 2f4103d1bb5..d497edc4c8b 100644 --- a/docs-translations/ko-KR/api/environment-variables.md +++ b/docs-translations/ko-KR/api/environment-variables.md @@ -1,8 +1,8 @@ # 환경 변수 -> 어플리케이션의 구성과 동작을 코드 변경 없이 제어합니다. +> 애플리케이션의 구성과 동작을 코드 변경 없이 제어합니다. -특정 Electron 동작은 명령줄 플래그와 어플리케이션의 코드보다 먼저 초기화되어야 하므로 +특정 Electron 동작은 명령줄 플래그와 애플리케이션의 코드보다 먼저 초기화되어야 하므로 환경 변수에 의해 작동합니다. POSIX 쉘의 예시입니다: diff --git a/docs-translations/ko-KR/api/frameless-window.md b/docs-translations/ko-KR/api/frameless-window.md index 3d0892a4e2d..a9e7737c616 100644 --- a/docs-translations/ko-KR/api/frameless-window.md +++ b/docs-translations/ko-KR/api/frameless-window.md @@ -1,40 +1,40 @@ -# Frameless Window +# Frameless 윈도우 > 툴바, 테두리, 시각적인 "chrome" 없이 윈도우를 엽니다. -Frameless Window는 [창 테두리](https://developer.mozilla.org/ko/docs/Glossary/Chrome)가 +Frameless 윈도우는 [창 테두리](https://developer.mozilla.org/ko/docs/Glossary/Chrome)가 없는 윈도우를 말합니다. 이 기능은 윈도우의 일부분인 툴바와 같이 웹 페이지의 일부분이 아닌 부분을 보이지 않도록 합니다. [`BrowserWindow`](browser-window.md) 클래스의 옵션에서 설정할 수 있습니다. -## Frameless Window 만들기 +## Frameless 윈도우 만들기 -Frameless Window를 만드려면 [BrowserWindow](browser-window.md) 객체의 +Frameless 윈도우를 만드려면 [BrowserWindow](browser-window.md) 객체의 `options` 객체에서 `frame` 옵션을 `false`로 지정하면 됩니다: ```javascript -const {BrowserWindow} = require('electron'); -let win = new BrowserWindow({width: 800, height: 600, frame: false}); +const {BrowserWindow} = require('electron') +let win = new BrowserWindow({width: 800, height: 600, frame: false}) ``` -### 최신 OS X에서 사용할 수 있는 대안 +### 최신 macOS에서 사용할 수 있는 대안 -OS X 10.10 Yosemite 이후의 최신 버전부터는 테두리가 없는 창을 만들 때 새로운 방법을 +macOS 10.10 Yosemite 이후의 최신 버전부터는 테두리가 없는 창을 만들 때 새로운 방법을 사용할 수 있습니다. `frame` 옵션을 `false`로 지정하여 제목과 창 구성 요소를 모두 비활성화하는 대신 새로운 `titleBarStyle` 옵션을 통해 제목만 숨기고 창 구성 요소 ("신호등 버튼")의 기능과 창 크기를 그대로 유지할 수 있습니다: ```javascript -let win = new BrowserWindow({titleBarStyle: 'hidden'}); +let win = new BrowserWindow({titleBarStyle: 'hidden'}) ``` ## 투명한 창 만들기 -Frameless Window 창의 배경을 투명하게 만들고 싶다면 `transparent` 옵션을 `true`로 +Frameless 윈도우 창의 배경을 투명하게 만들고 싶다면 `transparent` 옵션을 `true`로 바꿔주기만 하면됩니다: ```javascript -let win = new BrowserWindow({transparent: true, frame: false}); +let win = new BrowserWindow({transparent: true, frame: false}) ``` ### API의 한계 @@ -45,18 +45,28 @@ let win = new BrowserWindow({transparent: true, frame: false}); * 투명한 창은 크기를 조절할 수 없습니다. `resizable` 속성을 `true`로 할 경우 몇몇 플랫폼에선 크래시가 일어납니다. * `blur` 필터는 웹 페이지에서만 적용됩니다. 윈도우 아래 콘텐츠에는 블러 효과를 적용할 - 방법이 없습니다. (예시: 유저의 시스템에 열린 다른 어플리케이션) + 방법이 없습니다. (예시: 유저의 시스템에 열린 다른 애플리케이션) * Windows에선 DWM(데스크톱 창 관리자)가 비활성화되어 있을 경우 투명한 창이 작동하지 않습니다. * Linux를 사용할 경우 [alpha channel doesn't work on some NVidia drivers](https://code.google.com/p/chromium/issues/detail?id=369209) upstream 버그가 있는 관계로 투명한 창 기능을 사용하려면 CLI 옵션에 `--enable-transparent-visuals --disable-gpu`을 추가해야 합니다. 이 옵션은 GPU의 사용을 중단하고 윈도우를 생성하는데 ARGB를 사용할 수 있도록 해줍니다. -* OS X(Mac)에선 네이티브 창에서 보여지는 그림자가 투명한 창에선 보이지 않습니다. +* macOS(Mac)에선 네이티브 창에서 보여지는 그림자가 투명한 창에선 보이지 않습니다. + +## 클릭이 통과될 수 있는 윈도우 + +클릭이 통과될 수 있는 윈도우를 만드려면, i.e. 모든 마우스 이벤트를 무시하는 윈도우를 +만드려면, [win.setIgnoreMouseEvents(ignore)][ignore-mouse-events] API를 사용하여 +구현할 수 있습니다: + +```javascript +win.setIgnoreMouseEvents(true) +``` ## 드래그 가능 위치 지정 -기본적으로 Frameless Window는 드래그 할 수 없습니다. 어플리케이션의 CSS에서 특정 +기본적으로 Frameless 윈도우는 드래그 할 수 없습니다. 애플리케이션의 CSS에서 특정 범위를 `-webkit-app-region: drag`로 지정하면 OS의 기본 타이틀 바 처럼 드래그 되도록 할 수 있습니다. 그리고 `-webkit-app-region: no-drag`를 지정해서 드래그 불가능 영역을 만들 수도 있습니다. 현재 사각형 형태의 범위만 지원합니다. @@ -83,7 +93,7 @@ button { ## 텍스트 선택 -Frameless Window에서 텍스트가 선택되는 드래그 동작은 혼란을 야기할 수 있습니다. 예를 +Frameless 윈도우에서 텍스트가 선택되는 드래그 동작은 혼란을 야기할 수 있습니다. 예를 들어 타이틀 바를 드래그 할 때 타이틀 바의 텍스트를 실수로 선택할 수 있습니다. 이를 방지하기 위해 다음과 같이 드래그 영역의 텍스트 선택 기능을 비활성화해야 할 필요가 있습니다: @@ -101,3 +111,5 @@ Frameless Window에서 텍스트가 선택되는 드래그 동작은 혼란을 드래그 가능 영역에서 오른쪽 클릭 할 경우 시스템 메뉴가 팝업 됩니다. 이러한 이유로 컨텍스트 메뉴 지정 시 모든 플랫폼에서 정상적으로 작동하게 하려면 커스텀 컨텍스트 메뉴를 드래그 영역 내에 만들어선 안됩니다. + +[ignore-mouse-events]: browser-window.md#winsetignoremouseeventsignore diff --git a/docs-translations/ko-KR/api/global-shortcut.md b/docs-translations/ko-KR/api/global-shortcut.md index 3af9bb40317..0fe84efc03d 100644 --- a/docs-translations/ko-KR/api/global-shortcut.md +++ b/docs-translations/ko-KR/api/global-shortcut.md @@ -1,12 +1,12 @@ # globalSortcut -> 어플리케이션에 키보드 포커스가 없을 때도 키보드 이벤트를 받을 수 있도록 합니다. +> 애플리케이션에 키보드 포커스가 없을 때도 키보드 이벤트를 받을 수 있도록 합니다. `globalShortcut` 모듈은 운영체제의 전역 키보드 단축키를 등록/해제 하는 방법을 제공합니다. 이 모듈을 사용하여 사용자가 다양한 작업을 편하게 할 수 있도록 단축키를 정의 할 수 있습니다. -**참고:** 등록된 단축키는 어플리케이션이 백그라운드로 작동(창이 포커스 되지 않음) 할 +**참고:** 등록된 단축키는 애플리케이션이 백그라운드로 작동(창이 포커스 되지 않음) 할 때도 계속해서 작동합니다. 이 모듈은 `app` 모듈의 `ready` 이벤트가 발생하기 전까지 사용할 수 없습니다. @@ -48,8 +48,8 @@ app.on('will-quit', () => { `accelerator`의 전역 단축키를 등록합니다. 유저로부터 등록된 단축키가 눌렸을 경우 `callback` 함수가 호출됩니다. -accelerator가 이미 다른 어플리케이션에서 사용 중일 경우, 이 작업은 조용히 실패합니다. -이러한 동작은 어플리케이션이 전역 키보드 단축키를 가지고 충돌이 일어나지 않도록 하기 +accelerator가 이미 다른 애플리케이션에서 사용 중일 경우, 이 작업은 조용히 실패합니다. +이러한 동작은 애플리케이션이 전역 키보드 단축키를 가지고 충돌이 일어나지 않도록 하기 위해 운영체제에 의해 예정된 동작입니다. ### `globalShortcut.isRegistered(accelerator)` @@ -58,8 +58,8 @@ accelerator가 이미 다른 어플리케이션에서 사용 중일 경우, 이 지정된 `accelerator` 단축키가 등록되었는지 여부를 확인합니다. -Accelerator가 이미 다른 어플리케이션에서 사용 중일 경우, 여전히 `false`를 반환합니다. -이러한 동작은 어플리케이션이 전역 키보드 단축키를 가지고 충돌이 일어나지 않도록 하기 +Accelerator가 이미 다른 애플리케이션에서 사용 중일 경우, 여전히 `false`를 반환합니다. +이러한 동작은 애플리케이션이 전역 키보드 단축키를 가지고 충돌이 일어나지 않도록 하기 위해 운영체제에 의해 예정된 동작입니다. ### `globalShortcut.unregister(accelerator)` diff --git a/docs-translations/ko-KR/api/menu-item.md b/docs-translations/ko-KR/api/menu-item.md index 022e554688a..254fec147f1 100644 --- a/docs-translations/ko-KR/api/menu-item.md +++ b/docs-translations/ko-KR/api/menu-item.md @@ -1,6 +1,6 @@ # MenuItem -> 네이티브 어플리케이션 메뉴와 컨텍스트 메뉴에 아이템을 추가합니다. +> 네이티브 애플리케이션 메뉴와 컨텍스트 메뉴에 아이템을 추가합니다. [`menu`](menu.md)에서 예시를 확인할 수 있습니다. @@ -46,22 +46,25 @@ * `cut` * `copy` * `paste` +* `pasteandmatchstyle` * `selectall` +* `delete` * `minimize` - 현재 윈도우를 최소화합니다 * `close` - 현재 윈도우를 닫습니다 -OS X에서의 `role`은 다음 값을 추가로 가질 수 있습니다: +macOS에서의 `role`은 다음 값을 추가로 가질 수 있습니다: * `about` - `orderFrontStandardAboutPanel` 액션에 대응 * `hide` - `hide` 액션에 대응 * `hideothers` - `hideOtherApplications` 액션에 대응 * `unhide` - `unhideAllApplications` 액션에 대응 * `front` - `arrangeInFront` 액션에 대응 +* `zoom` - `performZoom` 액션에 대응 * `window` - 부 메뉴를 가지는 "Window" 메뉴 * `help` - 부 메뉴를 가지는 "Help" 메뉴 * `services` - 부 메뉴를 가지는 "Services" 메뉴 -OS X에서는 `role`을 지정할 때, `label`과 `accelerator`만 MenuItem에 효과가 +macOS에서는 `role`을 지정할 때, `label`과 `accelerator`만 MenuItem에 효과가 적용되도록 변경되며, 다른 옵션들은 모두 무시됩니다. ## Instance Properties diff --git a/docs-translations/ko-KR/api/menu.md b/docs-translations/ko-KR/api/menu.md index e627a9a87a4..eaee7e8d4f9 100644 --- a/docs-translations/ko-KR/api/menu.md +++ b/docs-translations/ko-KR/api/menu.md @@ -1,6 +1,6 @@ # Menu -> 네이티브 어플리케이션 메뉴와 컨텍스트 메뉴를 생성합니다. +> 네이티브 애플리케이션 메뉴와 컨텍스트 메뉴를 생성합니다. 이 모듈은 메인 프로세스용 모듈이지만 `remote` 모듈을 통해 렌더러 프로세스에서도 사용할 수 있습니다. @@ -30,7 +30,7 @@ window.addEventListener('contextmenu', (e) => { ``` 또 하나의 예를 들자면 다음 예시는 렌더러 프로세스에서 template API를 사용하여 -어플리케이션 메뉴를 만듭니다: +애플리케이션 메뉴를 만듭니다: ```javascript const template = [ @@ -65,6 +65,15 @@ const template = [ accelerator: 'CmdOrCtrl+V', role: 'paste' }, + { + label: 'Paste and Match Style', + accelerator: 'Shift+Command+V', + role: 'pasteandmatchstyle' + }, + { + label: 'Delete', + role: 'delete' + }, { label: 'Select All', accelerator: 'CmdOrCtrl+A', @@ -173,7 +182,21 @@ if (process.platform === 'darwin') { ] }); // Window menu. - template[3].submenu.push( + template[3].submenu = [ + { + label: 'Close', + accelerator: 'CmdOrCtrl+W', + role: 'close' + }, + { + label: 'Minimize', + accelerator: 'CmdOrCtrl+M', + role: 'minimize' + }, + { + label: 'Zoom', + role: 'zoom' + }, { type: 'separator' }, @@ -181,7 +204,7 @@ if (process.platform === 'darwin') { label: 'Bring All to Front', role: 'front' } - ); + ]; } const menu = Menu.buildFromTemplate(template); @@ -202,18 +225,25 @@ Menu.setApplicationMenu(menu); * `menu` Menu -지정한 `menu`를 어플리케이션 메뉴로 만듭니다. OS X에선 상단바에 표시되며 Windows와 +지정한 `menu`를 애플리케이션 메뉴로 만듭니다. macOS에선 상단바에 표시되며 Windows와 Linux에선 각 창의 상단에 표시됩니다. -### `Menu.sendActionToFirstResponder(action)` _OS X_ +**참고** 이 API는 `app`의 `ready` 이벤트가 발생한 이후에 호출해야 합니다. + +### `Menu.getApplicationMenu()` + +설정되어있는 어플리케이션 메뉴를 반환합니다. (`Menu`의 인스턴스) 만약 없다면 `null`을 +반환합니다. + +### `Menu.sendActionToFirstResponder(action)` _macOS_ * `action` String -`action`을 어플리케이션의 first responder에 전달합니다. 이 메서드는 Cocoa 메뉴 +`action`을 애플리케이션의 first responder에 전달합니다. 이 메서드는 Cocoa 메뉴 동작을 에뮬레이트 하는데 사용되며 보통 `MenuItem`의 `role` 속성에 사용됩니다. -OS X의 네이티브 액션에 대해 자세히 알아보려면 -[OS X Cocoa Event Handling Guide](https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/EventOverview/EventArchitecture/EventArchitecture.html#//apple_ref/doc/uid/10000060i-CH3-SW7) +macOS의 네이티브 액션에 대해 자세히 알아보려면 +[macOS Cocoa Event Handling Guide](https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/EventOverview/EventArchitecture/EventArchitecture.html#//apple_ref/doc/uid/10000060i-CH3-SW7) 문서를 참고하세요. ### `Menu.buildFromTemplate(template)` @@ -235,13 +265,13 @@ OS X의 네이티브 액션에 대해 자세히 알아보려면 * `browserWindow` BrowserWindow (optional) - 기본값은 `null`입니다. * `x` Number (optional) - 기본값은 -1입니다. * `y` Number (만약 `x`를 지정한 경우 **필수 항목**) - 기본값은 -1입니다. -* `positioningItem` Number (optional) _OS X_ - 메뉴 팝업 시 마우스 커서에 바로 +* `positioningItem` Number (optional) _macOS_ - 메뉴 팝업 시 마우스 커서에 바로 위치시킬 메뉴 아이템의 인덱스. 기본값은 -1입니다. 메뉴를 `browserWindow` 내부 팝업으로 표시합니다. 옵션으로 메뉴를 표시할 `(x,y)` 좌표를 지정할 수 있습니다. 따로 좌표를 지정하지 않은 경우 마우스 커서 위치에 표시됩니다. `positioningItem` 속성은 메뉴 팝업 시 마우스 커서에 바로 위치시킬 메뉴 아이템의 -인덱스입니다. (OS X에서만 지원합니다) +인덱스입니다. (macOS에서만 지원합니다) ### `menu.append(menuItem)` @@ -264,15 +294,15 @@ OS X의 네이티브 액션에 대해 자세히 알아보려면 메뉴가 가지고 있는 메뉴 아이템들의 배열입니다. -## OS X 어플리케이션 메뉴에 대해 알아 둬야 할 것들 +## macOS 애플리케이션 메뉴에 대해 알아 둬야 할 것들 -OS X에선 Windows, Linux와 달리 완전히 다른 어플리케이션 메뉴 스타일을 가지고 있습니다. -그래서 어플리케이션을 네이티브처럼 작동할 수 있도록 하기 위해 다음 몇 가지 유의 사항을 +macOS에선 Windows, Linux와 달리 완전히 다른 애플리케이션 메뉴 스타일을 가지고 있습니다. +그래서 애플리케이션을 네이티브처럼 작동할 수 있도록 하기 위해 다음 몇 가지 유의 사항을 숙지해야 합니다. ### 기본 메뉴 -OS X엔 `Services`나 `Windows`와 같은 많은 시스템 지정 기본 메뉴가 있습니다. 기본 +macOS엔 `Services`나 `Windows`와 같은 많은 시스템 지정 기본 메뉴가 있습니다. 기본 메뉴를 만들려면 반드시 다음 리스트 중 한 가지를 선택하여 메뉴의 `role`로 지정해야 합니다. 그러면 Electron이 자동으로 인식하여 해당 메뉴를 기본 메뉴로 만듭니다: @@ -282,14 +312,14 @@ OS X엔 `Services`나 `Windows`와 같은 많은 시스템 지정 기본 메뉴 ### 메뉴 아이템 기본 동작 -OS X는 몇가지 메뉴 아이템에 대해 `About xxx`, `Hide xxx`, `Hide Others`와 같은 +macOS는 몇가지 메뉴 아이템에 대해 `About xxx`, `Hide xxx`, `Hide Others`와 같은 기본 동작을 제공하고 있습니다. 메뉴 아이템의 기본 동작을 지정하려면 반드시 메뉴 아이템의 `role` 속성을 지정해야 합니다. ### 메인 메뉴의 이름 -OS X에선 지정한 어플리케이션 메뉴에 상관없이 메뉴의 첫번째 라벨은 언제나 어플리케이션의 -이름이 됩니다. 어플리케이션 이름을 변경하려면 앱 번들내의 `Info.plist` 파일을 수정해야 +macOS에선 지정한 애플리케이션 메뉴에 상관없이 메뉴의 첫번째 라벨은 언제나 애플리케이션의 +이름이 됩니다. 애플리케이션 이름을 변경하려면 앱 번들내의 `Info.plist` 파일을 수정해야 합니다. 자세한 내용은 [About Information Property List Files][AboutInformationPropertyListFiles] 문서를 참고하세요. ## 지정한 브라우저 윈도우에 메뉴 설정 (*Linux* *Windows*) diff --git a/docs-translations/ko-KR/api/native-image.md b/docs-translations/ko-KR/api/native-image.md index 8c03b78e114..d44f000a1c9 100644 --- a/docs-translations/ko-KR/api/native-image.md +++ b/docs-translations/ko-KR/api/native-image.md @@ -1,6 +1,6 @@ # nativeImage -> PNG 또는 JPG 파일을 사용하여 트레이, 독, 어플리케이션 아이콘을 생성합니다. +> PNG 또는 JPG 파일을 사용하여 트레이, 독, 애플리케이션 아이콘을 생성합니다. Electron은 파일 경로 또는 `nativeImage` 인스턴스를 통해 이미지를 사용할 수 있는 API를 가지고 있습니다. `null`을 전달할 경우 빈 이미지가 생성됩니다. @@ -79,7 +79,7 @@ let appIcon = new Tray('/Users/somebody/images/icon.png'); 가장 일반적으로 템플릿 이미지는 밝고 어두운 테마 색상으로 변경할 수 있는 메뉴 바 아이콘 등에 사용되고 있습니다. -**참고:** 템플릿 이미지는 OS X 운영체제만 지원합니다. +**참고:** 템플릿 이미지는 macOS 운영체제만 지원합니다. 템플릿 이미지를 지정하려면 다음 예시와 같이 파일명에 `Template` 문자열을 추가해야 합니다: @@ -101,6 +101,12 @@ let appIcon = new Tray('/Users/somebody/images/icon.png'); `path`로부터 이미지를 로드하여 새로운 `nativeImage` 인스턴스를 만듭니다. +```javascript +const nativeImage = require('electron').nativeImage; + +let image = nativeImage.createFromPath('/Users/somebody/images/icon.png'); +``` + ### `nativeImage.createFromBuffer(buffer[, scaleFactor])` * `buffer` [Buffer][buffer] @@ -117,12 +123,7 @@ let appIcon = new Tray('/Users/somebody/images/icon.png'); ## Instance Methods -`nativeImage` 인스턴스 객체에서 사용할 수 있는 메서드 입니다: - -```javascript -const nativeImage = require('electron').nativeImage; -let image = nativeImage.createFromPath('/Users/somebody/images/icon.png'); -``` +`nativeImage` 인스턴스 객체에서 사용할 수 있는 메서드입니다. ### `image.toPng()` @@ -138,10 +139,10 @@ let image = nativeImage.createFromPath('/Users/somebody/images/icon.png'); 이미지를 data URL로 반환합니다. -### `image.getNativeHandle()` _OS X_ +### `image.getNativeHandle()` _macOS_ 이미지의 네이티브 핸들 밑에 있는 C 포인터를 담은 [Buffer][buffer]을 반환합니다. -OS X에선, `NSImage` 인스턴스가 반환됩니다. +macOS에선, `NSImage` 인스턴스가 반환됩니다. 참고로 반환된 포인터는 복사본이 아닌 네이티브 이미지의 밑에 있는 약한 포인터이며, 따라서 반드시 관련된 `nativeImage` 인스턴스가 확실하게 유지되고 있는지를 인지해야 diff --git a/docs-translations/ko-KR/api/power-save-blocker.md b/docs-translations/ko-KR/api/power-save-blocker.md index 145b746cbbb..baa174498e2 100644 --- a/docs-translations/ko-KR/api/power-save-blocker.md +++ b/docs-translations/ko-KR/api/power-save-blocker.md @@ -20,10 +20,10 @@ powerSaveBlocker.stop(id); ### `powerSaveBlocker.start(type)` * `type` String - Power save blocker 종류 - * `prevent-app-suspension` - 저전력 모드 등으로 인한 어플리케이션 작동 중단을 + * `prevent-app-suspension` - 저전력 모드 등으로 인한 애플리케이션 작동 중단을 방지합니다. 시스템을 항시 활성화 상태로 만듭니다. 하지만 화면은 자동으로 꺼질 수 있습니다. 사용 예시: 파일 다운로드, 음악 재생 등. - * `prevent-display-sleep`- 슬립 모드 등으로 인한 어플리케이션의 작동 중단을 + * `prevent-display-sleep`- 슬립 모드 등으로 인한 애플리케이션의 작동 중단을 방지합니다. 시스템을 항시 활성화 상태로 만들고 슬립 모드(화면 꺼짐)를 방지합니다. 사용 예시: 비디오 재생 등. diff --git a/docs-translations/ko-KR/api/process.md b/docs-translations/ko-KR/api/process.md index 946dd92eac5..d7f27bc33dd 100644 --- a/docs-translations/ko-KR/api/process.md +++ b/docs-translations/ko-KR/api/process.md @@ -74,7 +74,7 @@ Causes the main thread of the current process crash. Causes the main thread of the current process hang. -### `process.setFdLimit(maxDescriptors)` _OS X_ _Linux_ +### `process.setFdLimit(maxDescriptors)` _macOS_ _Linux_ * `maxDescriptors` Integer @@ -133,7 +133,7 @@ On Windows / Linux: 현재 프로세스의 주 스레드를 중단시킵니다. -### `process.setFdLimit(maxDescriptors)` _OS X_ _Linux_ +### `process.setFdLimit(maxDescriptors)` _macOS_ _Linux_ * `maxDescriptors` Integer diff --git a/docs-translations/ko-KR/api/screen.md b/docs-translations/ko-KR/api/screen.md index 7ac3539016d..ff592304533 100644 --- a/docs-translations/ko-KR/api/screen.md +++ b/docs-translations/ko-KR/api/screen.md @@ -9,46 +9,44 @@ 상속 받았습니다. **참고:** 렌더러 / DevTools에선 이미 DOM 속성이 `window.screen`을 가지고 있으므로 -`screen = require('screen')` 형식으로 모듈을 사용할 수 없습니다. 아래의 예시와 같이 -`electronScreen` 같은 이름으로 모듈 이름을 대체하여 사용해야 합니다. +`screen = require('screen')` 형식으로 모듈을 사용할 수 없습니다. 다음 예시는 화면 전체를 채우는 윈도우 창을 생성합니다: -```javascript -const {app, BrowserWindow, screen: electronScreen} = require('electron'); -let win; +```javascript +const electron = require('electron') +const {app, BrowserWindow} = electron + +let win app.on('ready', () => { - let {width, height} = electronScreen.getPrimaryDisplay().workAreaSize; - win = new BrowserWindow({width, height}); + const {width, height} = electron.screen.getPrimaryDisplay().workAreaSize + win = new BrowserWindow({width, height}) }); ``` 다음 예시는 확장 디스플레이에 윈도우를 생성합니다: ```javascript -const {app, BrowserWindow, screen: electronScreen} = require('electron'); +const electron = require('electron') +const {app, BrowserWindow} = require('electron') -let win; +let win app.on('ready', () => { - let displays = electronScreen.getAllDisplays(); - let externalDisplay = null; - for (let i in displays) { - if (displays[i].bounds.x !== 0 || displays[i].bounds.y !== 0) { - externalDisplay = displays[i]; - break; - } - } + let displays = electron.screen.getAllDisplays() + let externalDisplay = displays.find((display) => { + return display.bounds.x !== 0 || display.bounds.y !== 0 + }) if (externalDisplay) { win = new BrowserWindow({ x: externalDisplay.bounds.x + 50, y: externalDisplay.bounds.y + 50 - }); + }) } -}); +}) ``` ## `Display` 객체 diff --git a/docs-translations/ko-KR/api/session.md b/docs-translations/ko-KR/api/session.md index e21fa3b75bd..a2dc9b682a6 100644 --- a/docs-translations/ko-KR/api/session.md +++ b/docs-translations/ko-KR/api/session.md @@ -28,7 +28,7 @@ let ses = win.webContents.session; `partition`이 `persist:`로 시작하면 페이지는 지속성 세션을 사용하며 다른 모든 앱 내의 페이지에서 같은 `partition`을 사용할 수 있습니다. 만약 `persist:` 접두어로 시작하지 -않으면 페이지는 인-메모리 세션을 사용합니다. `partition`을 지정하지 않으면 어플리케이션의 +않으면 페이지는 인-메모리 세션을 사용합니다. `partition`을 지정하지 않으면 애플리케이션의 기본 세션이 반환됩니다. ## Properties @@ -37,7 +37,7 @@ let ses = win.webContents.session; ### session.defaultSession -어플리케이션의 기본 세션 객체를 반환합니다. +애플리케이션의 기본 세션 객체를 반환합니다. ## Class: Session @@ -244,7 +244,7 @@ proxyURL = ["://"][":"] * `path` String - 다운로드 위치 -다운로드 저장 위치를 지정합니다. 기본 다운로드 위치는 각 어플리케이션 데이터 디렉터리의 +다운로드 저장 위치를 지정합니다. 기본 다운로드 위치는 각 애플리케이션 데이터 디렉터리의 `Downloads` 폴더입니다. #### `ses.enableNetworkEmulation(options)` @@ -539,3 +539,23 @@ HTTP 요청을 보내기 전 요청 헤더를 사용할 수 있을 때 `listener * `timestamp` Double * `fromCache` Boolean * `error` String - 에러 설명. + +#### `ses.protocol` + +현재 세션의 [protocol](protocol.md) 모듈 인스턴스를 반환합니다. + +```javascript +const {app, session} = require('electron') +const path = require('path') + +app.on('ready', function () { + const protocol = session.fromPartition(partitionName).protocol + protocol.registerFileProtocol('atom', function (request, callback) { + var url = request.url.substr(7) + callback({path: path.normalize(__dirname + '/' + url)}) + }, function (error) { + if (error) + console.error('Failed to register protocol') + }) +}) +``` diff --git a/docs-translations/ko-KR/api/shell.md b/docs-translations/ko-KR/api/shell.md index d8237db9b38..2079fa0829e 100644 --- a/docs-translations/ko-KR/api/shell.md +++ b/docs-translations/ko-KR/api/shell.md @@ -1,6 +1,6 @@ # shell -> 파일과 URL을 각 기본 어플리케이션을 통해 관리합니다. +> 파일과 URL을 각 기본 애플리케이션을 통해 관리합니다. `shell` 모듈은 데스크톱 환경 통합에 관련한 유틸리티를 제공하는 모듈입니다. @@ -31,15 +31,15 @@ shell.openExternal('https://github.com'); ### `shell.openExternal(url[, options])` * `url` String -* `options` Object (optional) _OS X_ - * `activate` Boolean - `true`로 설정하면 어플리케이션을 바로 활성화 상태로 +* `options` Object (optional) _macOS_ + * `activate` Boolean - `true`로 설정하면 애플리케이션을 바로 활성화 상태로 실행합니다. 기본값은 `true`입니다. 제공된 외부 프로토콜 URL을 기반으로 데스크톱의 기본 프로그램으로 엽니다. (예를 들어 -mailto: URL은 유저의 기본 이메일 에이전트로 URL을 엽니다.) 어플리케이션이 해당 URL을 +mailto: URL은 유저의 기본 이메일 에이전트로 URL을 엽니다.) 애플리케이션이 해당 URL을 열 수 있을 때 `true`를 반환합니다. 아니라면 `false`를 반환합니다. -**역주:** 탐색기로 폴더만 표시하려면 `'file://경로'`와 같이 지정하여 열 수 있습니다. +**역자주:** 탐색기로 폴더만 표시하려면 `'file://경로'`와 같이 지정하여 열 수 있습니다. ### `shell.moveItemToTrash(fullPath)` diff --git a/docs-translations/ko-KR/api/synopsis.md b/docs-translations/ko-KR/api/synopsis.md index cb2ea015e29..4b38c7a2f5b 100644 --- a/docs-translations/ko-KR/api/synopsis.md +++ b/docs-translations/ko-KR/api/synopsis.md @@ -6,7 +6,7 @@ Electron은 모든 [Node.js의 built-in 모듈](http://nodejs.org/api/)과 third node 모듈을 완벽하게 지원합니다. ([네이티브 모듈](../tutorial/using-native-node-modules.md) 포함) -또한 Electron은 네이티브 데스크톱 어플리케이션을 개발 할 수 있도록 추가적인 built-in +또한 Electron은 네이티브 데스크톱 애플리케이션을 개발 할 수 있도록 추가적인 built-in 모듈을 제공합니다. 몇몇 모듈은 메인 프로세스에서만 사용할 수 있고 어떤 모듈은 렌더러 프로세스(웹 페이지)에서만 사용할 수 있습니다. 또한 두 프로세스 모두 사용할 수 있는 모듈도 있습니다. @@ -43,7 +43,7 @@ app.on('ready', () => { ``` -어플리케이션을 실행하려면 [앱 실행하기](../tutorial/quick-start.md#앱 실행하기) +애플리케이션을 실행하려면 [앱 실행하기](../tutorial/quick-start.md#앱 실행하기) 문서를 참고하기 바랍니다. ## 분리 할당 diff --git a/docs-translations/ko-KR/api/system-preferences.md b/docs-translations/ko-KR/api/system-preferences.md index 9b53baee35b..254bd006874 100644 --- a/docs-translations/ko-KR/api/system-preferences.md +++ b/docs-translations/ko-KR/api/system-preferences.md @@ -4,17 +4,17 @@ ## Methods -### `systemPreferences.isDarkMode()` _OS X_ +### `systemPreferences.isDarkMode()` _macOS_ 이 메서드는 시스템이 어두운 모드 상태인 경우 `true`를 반환하고 아닐 경우 `false`를 반환합니다. -### `systemPreferences.subscribeNotification(event, callback)` _OS X_ +### `systemPreferences.subscribeNotification(event, callback)` _macOS_ * `event` String * `callback` Function -OS X의 네이티브 알림을 구독하며, 해당하는 `event`가 발생하면 `callback`이 +macOS의 네이티브 알림을 구독하며, 해당하는 `event`가 발생하면 `callback`이 `callback(event, userInfo)` 형태로 호출됩니다. `userInfo`는 알림과 함께 전송되는 사용자 정보 딕셔너리를 포함하는 객체입니다. @@ -28,13 +28,13 @@ OS X의 네이티브 알림을 구독하며, 해당하는 `event`가 발생하 * `AppleColorPreferencesChangedNotification` * `AppleShowScrollBarsSettingChanged` -### `systemPreferences.unsubscribeNotification(id)` _OS X_ +### `systemPreferences.unsubscribeNotification(id)` _macOS_ * `id` Integer `id`와 함께 구독자를 제거합니다. -### `systemPreferences.getUserDefault(key, type)` _OS X_ +### `systemPreferences.getUserDefault(key, type)` _macOS_ * `key` String * `type` String - `string`, `boolean`, `integer`, `float`, `double`, `url`, @@ -42,7 +42,7 @@ OS X의 네이티브 알림을 구독하며, 해당하는 `event`가 발생하 시스템 설정에서 `key`에 해당하는 값을 가져옵니다. -OS X에선 API가 `NSUserDefaults`를 읽어들입니다. 유명한 `key`와 `type`은 다음과 +macOS에선 API가 `NSUserDefaults`를 읽어들입니다. 유명한 `key`와 `type`은 다음과 같습니다: * `AppleInterfaceStyle: string` diff --git a/docs-translations/ko-KR/api/tray.md b/docs-translations/ko-KR/api/tray.md index 9d5d8a81bc9..95fe59fd597 100644 --- a/docs-translations/ko-KR/api/tray.md +++ b/docs-translations/ko-KR/api/tray.md @@ -7,14 +7,14 @@ const {app, Menu, Tray} = require('electron'); let appIcon = null; app.on('ready', () => { - appIcon = new Tray('/path/to/my/icon'); // 현재 어플리케이션 디렉터리를 기준으로 하려면 `__dirname + '/images/tray.png'` 형식으로 입력해야 합니다. + appIcon = new Tray('/path/to/my/icon'); // 현재 애플리케이션 디렉터리를 기준으로 하려면 `__dirname + '/images/tray.png'` 형식으로 입력해야 합니다. const contextMenu = Menu.buildFromTemplate([ {label: 'Item1', type: 'radio'}, {label: 'Item2', type: 'radio'}, {label: 'Item3', type: 'radio', checked: true}, {label: 'Item4', type: 'radio'} ]); - appIcon.setToolTip('이것은 나의 어플리케이션 입니다!'); + appIcon.setToolTip('이것은 나의 애플리케이션 입니다!'); appIcon.setContextMenu(contextMenu); }); ``` @@ -71,9 +71,9 @@ appIcon.setContextMenu(contextMenu); 트레이 아이콘이 클릭될 때 발생하는 이벤트입니다. -**참고:** `bounds`는 OS X 와 Windows에서만 작동합니다. +**참고:** `bounds`는 macOS 와 Windows에서만 작동합니다. -### Event: 'right-click' _OS X_ _Windows_ +### Event: 'right-click' _macOS_ _Windows_ * `event` Event * `altKey` Boolean @@ -88,7 +88,7 @@ appIcon.setContextMenu(contextMenu); 트레이 아이콘을 오른쪽 클릭될 때 호출 됩니다. -### Event: 'double-click' _OS X_ _Windows_ +### Event: 'double-click' _macOS_ _Windows_ * `event` Event * `altKey` Boolean @@ -115,26 +115,26 @@ appIcon.setContextMenu(contextMenu); 풍선 팝업이 시간이 지나 사라지거나 유저가 클릭하여 닫을 때 발생하는 이벤트입니다. -### Event: 'drop' _OS X_ +### Event: 'drop' _macOS_ 드래그 가능한 아이템이 트레이 아이콘에 드롭되면 발생하는 이벤트입니다. -### Event: 'drop-files' _OS X_ +### Event: 'drop-files' _macOS_ * `event` * `files` Array - 드롭된 파일의 경로 트레이 아이콘에 파일이 드롭되면 발생하는 이벤트입니다. -### Event: 'drag-enter' _OS X_ +### Event: 'drag-enter' _macOS_ 트레이 아이콘에 드래그 작업이 시작될 때 발생하는 이벤트입니다. -### Event: 'drag-leave' _OS X_ +### Event: 'drag-leave' _macOS_ 트레이 아이콘에 드래그 작업이 종료될 때 발생하는 이벤트입니다. -### Event: 'drag-end' _OS X_ +### Event: 'drag-end' _macOS_ 트레이 아이콘에 드래그 작업이 종료되거나 다른 위치에서 종료될 때 발생하는 이벤트입니다. @@ -154,7 +154,7 @@ appIcon.setContextMenu(contextMenu); `image`를 사용하여 트레이 아이콘의 이미지를 설정합니다. -### `Tray.setPressedImage(image)` _OS X_ +### `Tray.setPressedImage(image)` _macOS_ * `image` [NativeImage](native-image.md) @@ -166,13 +166,13 @@ appIcon.setContextMenu(contextMenu); 트레이 아이콘의 툴팁 텍스트를 설정합니다. -### `Tray.setTitle(title)` _OS X_ +### `Tray.setTitle(title)` _macOS_ * `title` String 상태바에서 트레이 아이콘 옆에 표시되는 제목 텍스트를 설정합니다. -### `Tray.setHighlightMode(highlight)` _OS X_ +### `Tray.setHighlightMode(highlight)` _macOS_ * `highlight` Boolean @@ -188,7 +188,7 @@ appIcon.setContextMenu(contextMenu); 트레이에 풍선 팝업을 생성합니다. -### `Tray.popUpContextMenu([menu, position])` _OS X_ _Windows_ +### `Tray.popUpContextMenu([menu, position])` _macOS_ _Windows_ * `menu` Menu (optional) * `position` Object (optional) - 팝업 메뉴의 위치 @@ -196,7 +196,7 @@ appIcon.setContextMenu(contextMenu); * `y` Integer 트레이 아이콘의 컨텍스트 메뉴를 팝업시킵니다. `menu`가 전달되면, `menu`가 트레이 -메뉴의 컨텍스트 메뉴 대신 표시됩니다. +아이콘의 컨텍스트 메뉴 대신 표시됩니다. `position`은 Windows에서만 사용할 수 있으며 기본값은 (0, 0)입니다. diff --git a/docs-translations/ko-KR/api/web-contents.md b/docs-translations/ko-KR/api/web-contents.md index 467c019a7ef..437b5dabbe7 100644 --- a/docs-translations/ko-KR/api/web-contents.md +++ b/docs-translations/ko-KR/api/web-contents.md @@ -289,9 +289,9 @@ Returns: Returns: * `event` Event -* `url` URL +* `url` String -마우스나 키보드를 사용해 링크에 포커스를 할 때 발생하는 이벤트입니다. +마우스나 키보드를 사용해 링크에 포커스할 때 발생하는 이벤트입니다. ### Event: 'cursor-changed' @@ -674,7 +674,7 @@ ServiceWorker가 존재하면 모두 등록을 해제하고 JS Promise가 만족 `webContents.print({silent: false, printBackground: false})`를 호출하는 것과 같습니다. -**참고:** Windows에서의 프린터 API는 `pdf.dll`에 의존합니다. 따라서 어플리케이션이 +**참고:** Windows에서의 프린터 API는 `pdf.dll`에 의존합니다. 따라서 애플리케이션이 print기능을 사용하지 않는 경우 전체 바이너리 크기를 줄이기 위해 `pdf.dll`을 삭제해도 됩니다. @@ -944,6 +944,10 @@ win.webContents.on('did-finish-load', () => { }); ``` +### `webContents.showDefinitionForSelection()` _macOS_ + +페이지에서 선택된 단어에 대한 사전 검색 결과 팝업을 표시합니다. + ## Instance Properties `WebContents`객체들은 다음 속성들을 가지고 있습니다: diff --git a/docs-translations/ko-KR/api/web-frame.md b/docs-translations/ko-KR/api/web-frame.md index fdc68d22231..f7841248f3b 100644 --- a/docs-translations/ko-KR/api/web-frame.md +++ b/docs-translations/ko-KR/api/web-frame.md @@ -136,7 +136,7 @@ console.log(webFrame.getResourceUsage()) 참고로 맹목적으로 이 메서드를 호출하는 것은 이 빈 캐시를 다시 채워야하기 때문에 Electron을 느리게 만듭니다. 따라서 이 메서드는 페이지가 예상했던 것 보다 실질적으로 더 -적은 메모리를 사용하게 만드는 어플리케이션 이벤트가 발생했을 때만 호출해야 합니다. +적은 메모리를 사용하게 만드는 애플리케이션 이벤트가 발생했을 때만 호출해야 합니다. (i.e. 아주 무거운 페이지에서 거의 빈 페이지로 이동한 후 계속 유지할 경우) [spellchecker]: https://github.com/atom/node-spellchecker diff --git a/docs-translations/ko-KR/api/web-view-tag.md b/docs-translations/ko-KR/api/web-view-tag.md index 71032fcb573..7238ea69abf 100644 --- a/docs-translations/ko-KR/api/web-view-tag.md +++ b/docs-translations/ko-KR/api/web-view-tag.md @@ -6,16 +6,16 @@ 사용할 수 있습니다. 게스트 콘텐츠는 `webview` 컨테이너에 담겨 대상 페이지에 삽입되고 해당 페이지에선 게스트 콘텐츠의 배치 및 렌더링 과정을 조작할 수 있습니다. -`iframe`과는 달리 `webview`는 어플리케이션과 분리된 프로세스에서 작동합니다. +`iframe`과는 달리 `webview`는 애플리케이션과 분리된 프로세스에서 작동합니다. 이는 웹 페이지와 같은 권한을 가지지 않고 앱과 임베디드(게스트) 콘텐츠간의 모든 상호작용이 비동기로 작동한다는 것을 의미합니다. 따라서 임베디드 콘텐츠로부터 -어플리케이션을 안전하게 유지할 수 있습니다. +애플리케이션을 안전하게 유지할 수 있습니다. 보안상의 이유로, `webview`는 `nodeIntegration`이 활성화된 `BrowserWindow`에서만 사용할 수 있습니다. ## 예시 -웹 페이지를 어플리케이션에 삽입하려면 `webview` 태그를 사용해 원하는 타겟 페이지에 +웹 페이지를 애플리케이션에 삽입하려면 `webview` 태그를 사용해 원하는 타겟 페이지에 추가하면 됩니다. (게스트 콘텐츠가 앱 페이지에 추가 됩니다) 간단한 예로 `webview` 태그의 `src` 속성에 페이지를 지정하고 css 스타일을 이용해서 컨테이너의 외관을 설정할 수 있습니다: @@ -196,9 +196,19 @@ API를 사용할 수 있습니다. 이를 지정하면 내부에서 로우레벨 ``` -활성화할 blink 기능을 지정한 `,`로 구분된 문자열의 리스트입니다. 지원하는 기능 문자열의 -전체 목록은 [setFeatureEnabledFromString][blink-feature-string] 함수에서 찾을 수 -있습니다. +활성화할 blink 기능을 지정한 `,`로 구분된 문자열의 리스트입니다. 지원하는 기능 +문자열의 전체 목록은 [RuntimeEnabledFeatures.in][blink-feature-string] 파일에서 +찾을 수 있습니다. + +### `disableblinkfeatures` + +```html + +``` + +비활성화할 blink 기능을 지정한 `,`로 구분된 문자열의 리스트입니다. 지원하는 기능 +문자열의 전체 목록은 [RuntimeEnabledFeatures.in][blink-feature-string] 파일에서 +찾을 수 있습니다. ## Methods @@ -324,7 +334,7 @@ Webview에 웹 페이지 `url`을 로드합니다. `url`은 `http://`, `file://` 이 옵션을 활성화 시키면 `requestFullScreen`와 같은 HTML API에서 유저의 승인을 무시하고 개발자가 API를 바로 사용할 수 있도록 허용합니다. -**역주:** 기본적으로 브라우저에선 전체화면, 웹캠, 파일 열기등의 API를 사용하려면 유저의 +**역자주:** 기본적으로 브라우저에선 전체화면, 웹캠, 파일 열기등의 API를 사용하려면 유저의 승인(이벤트)이 필요합니다. ### `.openDevTools()` @@ -468,6 +478,10 @@ Service worker에 대한 개발자 도구를 엽니다. `event` 객체에 대해 자세히 알아보려면 [webContents.sendInputEvent](web-contents.md##webcontentssendinputeventevent)를 참고하세요. +### `.showDefinitionForSelection()` _macOS_ + +페이지에서 선택된 단어에 대한 사전 검색 결과 팝업을 표시합니다. + ### `.getWebContents()` 이 `webview`에 해당하는 [WebContents](web-contents.md)를 반환합니다. @@ -768,6 +782,15 @@ Returns: ```html ``` + +### Event: 'update-target-url' + +Returns: + +* `url` String + +마우스나 키보드를 사용해 링크에 포커스할 때 발생하는 이벤트입니다. + ### Event: 'devtools-opened' 개발자 도구가 열렸을 때 발생하는 이벤트입니다. @@ -780,4 +803,4 @@ Returns: 개발자 도구가 포커스되거나 열렸을 때 발생하는 이벤트입니다. -[blink-feature-string]: https://code.google.com/p/chromium/codesearch#chromium/src/out/Debug/gen/blink/platform/RuntimeEnabledFeatures.cpp&sq=package:chromium&type=cs&l=527 +[blink-feature-string]: https://cs.chromium.org/chromium/src/third_party/WebKit/Source/platform/RuntimeEnabledFeatures.in diff --git a/docs-translations/ko-KR/development/atom-shell-vs-node-webkit.md b/docs-translations/ko-KR/development/atom-shell-vs-node-webkit.md index 21972d2f38a..e5e967420ef 100644 --- a/docs-translations/ko-KR/development/atom-shell-vs-node-webkit.md +++ b/docs-translations/ko-KR/development/atom-shell-vs-node-webkit.md @@ -3,15 +3,15 @@ __참고: Electron은 Atom Shell의 새로운 이름입니다.__ NW.js 처럼 Electron은 JavaScript와 HTML 그리고 Node 통합 환경을 제공함으로써 웹 -페이지에서 저 수준 시스템에 접근할 수 있도록 하여 웹 기반 데스크탑 어플리케이션을 +페이지에서 저 수준 시스템에 접근할 수 있도록 하여 웹 기반 데스크탑 애플리케이션을 작성할 수 있도록 하는 프레임워크 입니다. 하지만 Electron과 NW.js는 근본적인 개발흐름의 차이도 있습니다: -__1. 어플리케이션의 엔트리 포인트__ +__1. 애플리케이션의 엔트리 포인트__ -NW.js에선 어플리케이션의 엔트리 포인트로 웹 페이지를 사용합니다. `package.json`내의 -main 필드에 메인 웹 페이지(index.html) URL을 지정하면 어플리케이션의 메인 윈도우로 +NW.js에선 애플리케이션의 엔트리 포인트로 웹 페이지를 사용합니다. `package.json`내의 +main 필드에 메인 웹 페이지(index.html) URL을 지정하면 애플리케이션의 메인 윈도우로 열리게 됩니다. Electron에선 JavaScript를 엔트리 포인트로 사용합니다. URL을 직접 제공하는 대신 API를 diff --git a/docs-translations/ko-KR/development/build-instructions-osx.md b/docs-translations/ko-KR/development/build-instructions-osx.md index 55a88b0cefd..9527a712fe1 100644 --- a/docs-translations/ko-KR/development/build-instructions-osx.md +++ b/docs-translations/ko-KR/development/build-instructions-osx.md @@ -1,10 +1,10 @@ -# 빌드 설명서 (OS X) +# 빌드 설명서 (macOS) -이 가이드는 OS X 운영체제에서 Electron을 빌드하는 방법을 설명합니다. +이 가이드는 macOS 운영체제에서 Electron을 빌드하는 방법을 설명합니다. ## 빌드전 요구 사항 -* OS X >= 10.8 +* macOS >= 10.8 * [Xcode](https://developer.apple.com/technologies/tools/) >= 5.1 * [node.js](http://nodejs.org) (external) @@ -47,7 +47,7 @@ $ ./script/build.py -c D ## 32비트 지원 -Electron은 현재 OS X 64비트만 지원하고 있습니다. 그리고 앞으로도 OS X 32비트는 지원할 +Electron은 현재 macOS 64비트만 지원하고 있습니다. 그리고 앞으로도 macOS 32비트는 지원할 계획이 없습니다. ## 테스트 diff --git a/docs-translations/ko-KR/development/build-system-overview.md b/docs-translations/ko-KR/development/build-system-overview.md index 044a2da0ae2..b10b813dced 100644 --- a/docs-translations/ko-KR/development/build-system-overview.md +++ b/docs-translations/ko-KR/development/build-system-overview.md @@ -8,7 +8,7 @@ Electron은 프로젝트 생성을 위해 [gyp](https://gyp.gsrc.io/)를 사용 Electron을 빌드 할 때 `gyp` 파일들은 다음과 같은 규칙을 따릅니다: -* `atom.gyp`는 Electron의 빌드 과정 자체를 정의합니다. +* `electron.gyp`는 Electron의 빌드 과정 자체를 정의합니다. * `common.gypi`는 Node가 Chromium과 함께 빌드될 수 있도록 조정한 빌드 설정입니다. * `vendor/brightray/brightray.gyp`는 `brightray`의 빌드 과정을 정의하고 Chromium 링킹에 대한 기본적인 설정을 포함합니다. diff --git a/docs-translations/ko-KR/development/debug-instructions-windows.md b/docs-translations/ko-KR/development/debug-instructions-windows.md index 27f96c284b0..31e814f3d9e 100644 --- a/docs-translations/ko-KR/development/debug-instructions-windows.md +++ b/docs-translations/ko-KR/development/debug-instructions-windows.md @@ -1,6 +1,6 @@ # Windows에서 Electron 디버깅하기 -만약 작성한 Javascript 어플리케이션이 아닌 Electron 자체의 크래시나 문제를 경험하고 +만약 작성한 Javascript 애플리케이션이 아닌 Electron 자체의 크래시나 문제를 경험하고 있다면, 네이티브/C++ 디버깅에 익숙하지 않은 개발자는 디버깅이 약간 까다로울 수 있습니다. 그렇다 해도, Visual Studio, GitHub의 Electron이 호스팅하는 심볼 서버, Electron 소스 코드가 중단점을 통해 순차적으로 쉽게 디버깅할 수 있는 환경을 제공합니다. @@ -27,7 +27,7 @@ Electron 소스 코드가 중단점을 통해 순차적으로 쉽게 디버깅 ## Electron에 디버거 연결하고 디버깅하기 디버깅 작업을 시작하려면, PowerShell/CMD 중 한 가지를 열고 디버그 빌드 상태의 -Electron에 인수로 어플리케이션을 전달하여 실행합니다: +Electron에 인수로 애플리케이션을 전달하여 실행합니다: ```powershell $ ./out/D/electron.exe ~/my-electron-app/ @@ -51,13 +51,13 @@ $ ./out/D/electron.exe ~/my-electron-app/ 로컬에서 작동 중인 프로세스 또는 원격 컴퓨터에 Visual Studio 디버거를 적용시킬 수 있습니다. 프로세스의 실행이 끝난 후, 디버그 / 프로세스에 연결을 (또는 `Ctrl+Alt+P` 입력) 클릭하면 "프로세스에 연결" 대화 상자가 열립니다. 이 도구를 통해 로컬 또는 -원격에서 작동 중인 어플리케이션을 디버깅할 수 있으며 여러 프로세스를 동시에 디버깅할 +원격에서 작동 중인 애플리케이션을 디버깅할 수 있으며 여러 프로세스를 동시에 디버깅할 수도 있습니다. 만약 Electron이 서로 다른 유저 계정에서 실행 중이라면, `모든 사용자의 프로세스 보이기`를 선택하면 됩니다. 참고로 이는 `BrowserWindow`가 열린 개수에 따라 달라질 수 있으며 아마 다수의 프로세스를 발견할 수 있을 것입니다. 전형적인 one-window -어플리케이션은 Visual Studio에서 두 개의 `Electron.exe` 항목으로 표시됩니다. 하나는 +애플리케이션은 Visual Studio에서 두 개의 `Electron.exe` 항목으로 표시됩니다. 하나는 메인 프로세스이며 다른 하나는 렌더러 프로세스입니다. 리스트는 단지 이름 하나만 제공하기 때문에 현재까지는 다른 적절한 프로세스 판별법이 없습니다. @@ -75,9 +75,9 @@ Javascript 파일에 의해 실행) remote (`require('electron').remote`)를 사 ## 프로세스를 관찰하기 위해 ProcMon 사용 Visual Studio는 특정 코드 경로를 탐색하는것에 대해 환상적인 기능을 제공하고 ProcMon은 -어플리케이션이 운영체제와 하는 일의 모든 것을 관찰하는데 강력한 기능을 가지고 있습니다. +애플리케이션이 운영체제와 하는 일의 모든 것을 관찰하는데 강력한 기능을 가지고 있습니다. 이 툴은 프로세스의 파일, 레지스트리, 네트워킹, 프로세스, 프로파일링 상세를 포착할 수 -있으며 강력하게 **모든** 이벤트의 발생을 로깅을 시도합니다. 만약 어플리케이션이 +있으며 강력하게 **모든** 이벤트의 발생을 로깅을 시도합니다. 만약 애플리케이션이 운영체제에 대해 무슨 일을 하고 있는지 이해하고 싶다면 이는 좋은 자원이 될 것입니다. ProcMon의 기본적인 디버깅 기능을 알아보고 싶다면 Microsoft에서 제공하는 diff --git a/docs-translations/ko-KR/faq/electron-faq.md b/docs-translations/ko-KR/faq/electron-faq.md index c186d148c2a..34a8733556e 100644 --- a/docs-translations/ko-KR/faq/electron-faq.md +++ b/docs-translations/ko-KR/faq/electron-faq.md @@ -29,8 +29,8 @@ Node.js의 새로운 기능은 보통 V8 업그레이드에서 가져옵니다. [`sessionStorage`][session-storage], 그리고 [IndexedDB][indexed-db]가 있습니다. 또는 Electron에서만 사용할 수 있는 IPC 시스템을 사용하여 메인 프로세스의 global -변수에 데이터를 저장한 후 다음과 같이 렌더러 프로세스에서 `remote` 모듈을 사용하여 -접근할 수 있습니다: +변수에 데이터를 저장한 후 다음과 같이 렌더러 프로세스에서 `electron` 모듈의 `remote` +속성을 통하여 접근할 수 있습니다: ```javascript // 메인 프로세스에서 @@ -41,15 +41,15 @@ global.sharedObject = { ```javascript // 첫 번째 페이지에서 -require('remote').getGlobal('sharedObject').someProperty = 'new value'; +require('electron').remote.getGlobal('sharedObject').someProperty = 'new value'; ``` ```javascript // 두 번째 페이지에서 -console.log(require('remote').getGlobal('sharedObject').someProperty); +console.log(require('electron').remote.getGlobal('sharedObject').someProperty); ``` -## 제작한 어플리케이션의 윈도우/트레이가 몇 분 후에나 나타납니다. +## 제작한 애플리케이션의 윈도우/트레이가 몇 분 후에나 나타납니다. 이러한 문제가 발생하는 이유는 보통 윈도우/트레이를 담은 변수에 가비지 컬렉션이 작동해서 그럴 가능성이 높습니다. diff --git a/docs-translations/ko-KR/styleguide.md b/docs-translations/ko-KR/styleguide.md index 340fa4204a0..6fd30bbef10 100644 --- a/docs-translations/ko-KR/styleguide.md +++ b/docs-translations/ko-KR/styleguide.md @@ -27,7 +27,7 @@ Electron 문서를 작성하는 규칙은 다음과 같습니다. - 선택적 인수는 목록에서 호출되면 표시합니다. - 문장의 길이는 한 줄당 80 칸을 유지합니다. - 플랫폼 특정 메서드 헤더는 이탈릭체로 표시합니다. - - ```### `method(foo, bar)` _OS X_``` + - ```### `method(foo, bar)` _macOS_``` - 'on' 표현 대신 'in the ___ process' 형식의 표현을 지향합니다. ### 번역된 참조 문서 diff --git a/docs-translations/ko-KR/tutorial/application-distribution.md b/docs-translations/ko-KR/tutorial/application-distribution.md index 66f729a18e0..1b4dde82df8 100644 --- a/docs-translations/ko-KR/tutorial/application-distribution.md +++ b/docs-translations/ko-KR/tutorial/application-distribution.md @@ -1,12 +1,12 @@ -# 어플리케이션 배포 +# 애플리케이션 배포 -Electron 어플리케이션을 배포하는 방법은 간단합니다. +Electron 애플리케이션을 배포하는 방법은 간단합니다. 먼저 폴더 이름을 `app`로 지정한 후 Electron 리소스 디렉터리에 폴더를 통째로 집어넣기만 -하면 됩니다. 리소스 디렉터리는 OS X의 경우: `Electron.app/Contents/Resources/` +하면 됩니다. 리소스 디렉터리는 macOS의 경우: `Electron.app/Contents/Resources/` Windows와 Linux의 경우: `resources/` 입니다. -OS X의 경우: +macOS의 경우: ```text electron/Electron.app/Contents/Resources/app/ @@ -31,13 +31,13 @@ electron/resources/app ## asar로 앱 패키징 하기 소스파일 전체를 복사해서 배포하는 것과는 별개로 [asar](https://github.com/electron/asar) -아카이브를 통해 어플리케이션의 소스 코드가 사용자에게 노출되는 것을 방지할 수 있습니다. +아카이브를 통해 애플리케이션의 소스 코드가 사용자에게 노출되는 것을 방지할 수 있습니다. -`asar` 아카이브를 사용할 땐 단순히 `app` 폴더 대신에 어플리케이션을 패키징한 +`asar` 아카이브를 사용할 땐 단순히 `app` 폴더 대신에 애플리케이션을 패키징한 `app.asar` 파일로 대체하면됩니다. Electron은 자동으로 `app`폴더 대신 asar 아카이브를 -기반으로 어플리케이션을 실행합니다. +기반으로 애플리케이션을 실행합니다. -OS X의 경우: +macOS의 경우: ```text electron/Electron.app/Contents/Resources/ @@ -51,20 +51,20 @@ electron/resources/ └── app.asar ``` -자세한 내용은 [어플리케이션 패키징](application-packaging.md)에서 찾아볼 수 있습니다. +자세한 내용은 [애플리케이션 패키징](application-packaging.md)에서 찾아볼 수 있습니다. ## 다운로드한 바이너리의 리소스를 앱에 맞게 수정하기 -어플리케이션을 Electron에 번들링한 후 해당 어플리케이션에 맞게 리브랜딩 할 수 있습니다. +애플리케이션을 Electron에 번들링한 후 해당 애플리케이션에 맞게 리브랜딩 할 수 있습니다. ### Windows [rcedit](https://github.com/atom/rcedit)를 통해 `electron.exe`을 원하는 이름으로 변경할 수 있고, 또한 아이콘과 기타 정보도 변경할 수 있습니다. -### OS X +### macOS -`Electron.app`을 원하는 이름으로 변경할 수 있습니다. 그리고 다음 표시된 어플리케이션 +`Electron.app`을 원하는 이름으로 변경할 수 있습니다. 그리고 다음 표시된 애플리케이션 내부 파일에서 `CFBundleDisplayName`, `CFBundleIdentifier` 그리고 `CFBundleName` 필드를 원하는 이름으로 변경해야 합니다: @@ -74,10 +74,10 @@ electron/resources/ 또한 helper 앱이 프로세스 모니터에 `Electron Helper`로 나오지 않도록 이름을 변경할 수 있습니다. 하지만 반드시 내부 및 모든 helper 앱의 이름을 변경해야 합니다. -어플리케이션 아이콘은 `Electron.app/Contents/Resources/atom.icns`을 원하는 +애플리케이션 아이콘은 `Electron.app/Contents/Resources/atom.icns`을 원하는 아이콘으로 변경하면 됩니다. -어플리케이션 이름을 원하는 이름으로 변경한 예시: +애플리케이션 이름을 원하는 이름으로 변경한 예시: ``` MyApp.app/Contents @@ -101,13 +101,13 @@ MyApp.app/Contents ### Linux -실행파일 `electron`의 이름을 원하는 대로 바꿀 수 있습니다. 리눅스 어플리케이션의 +실행파일 `electron`의 이름을 원하는 대로 바꿀 수 있습니다. 리눅스 애플리케이션의 아이콘은 [.desktop](https://developer.gnome.org/integration-guide/stable/desktop-files.html.en) 파일을 사용하여 지정할 수 있습니다. ## 패키징 툴 -어플리케이션을 일일이 수동으로 패키지로 만드는 대신, 서드 파티 패키징 툴을 사용하며 +애플리케이션을 일일이 수동으로 패키지로 만드는 대신, 서드 파티 패키징 툴을 사용하며 이러한 작업을 자동화 시킬 수 있습니다: * [electron-packager](https://github.com/maxogden/electron-packager) @@ -115,7 +115,7 @@ MyApp.app/Contents ## Electron 소스 코드를 다시 빌드하여 리소스 수정하기 -또한 Electron 소스 코드를 다시 빌드할 때 어플리케이션 이름을 변경할 수 있습니다. +또한 Electron 소스 코드를 다시 빌드할 때 애플리케이션 이름을 변경할 수 있습니다. `atom.gyp` 파일을 수정하여 다음과 같이 다시 빌드할 수 있습니다: @@ -125,13 +125,13 @@ Electron의 소스 코드를 수정하고 다시 빌드하는 작업은 상당 소스 코드를 수정하는 대신 [grunt-build-atom-shell](https://github.com/paulcbetts/grunt-build-atom-shell)을 사용하여 빌드를 자동화 시킬 수 있습니다. -이 툴을 사용하면 자동으로 `.gyp`파일을 수정하고 다시 빌드합니다. 그리고 어플리케이션의 +이 툴을 사용하면 자동으로 `.gyp`파일을 수정하고 다시 빌드합니다. 그리고 애플리케이션의 네이티브 Node 모듈 또한 새로운 실행파일 이름으로 일치시킵니다. ### Electron 커스텀 포크 만들기 Electron의 커스텀 포크를 만드는 것은 거의 확실히 앱을 만드는데 있어서 필요한 작업이 -아닐 수 있으며, 심지어 "제품 등급"의 어플리케이션이라도 필요하지 않습니다. +아닐 수 있으며, 심지어 "제품 등급"의 애플리케이션이라도 필요하지 않습니다. `electron-packager` 또는 `electron-builder`와 같은 도구를 사용하면 다른 특별한 과정 없이 Electron을 "Rebrand" 할 수 있습니다. @@ -157,16 +157,16 @@ Electron의 개발자로써, Electron을 매우 많은 시나리오에서도 작 3. 다음의 환경 변수들을 설정합니다: - * `ELECTRON_GITHUB_TOKEN` - GitHub에 릴리즈를 만들 수 있는 토큰. - * `ELECTRON_S3_ACCESS_KEY`, `ELECTRON_S3_BUCKET`, `ELECTRON_S3_SECRET_KEY` - - node.js 헤더 뿐만 아니라 심볼을 업로드할 장소. - * `ELECTRON_RELEASE` - `true`로 지정하고 업로드 부분이 실행되면, 설정되지 않은 - 부분을 남기고 `surf-build`가 CI-type 확인을 실행합니다. 모든 pull request를 - 실행할 때 적합합니다. - * `CI` - `true` 또는 다른 것을 지정하면 실패합니다. - * `GITHUB_TOKEN` - `ELECTRON_GITHUB_TOKEN`와 같게 설정 - * `SURF_TEMP` - Windows에선 `C:\Temp`로 설정하면 긴 경로 문제를 해결할 수 있습니다. - * `TARGET_ARCH` - `ia32` 또는 `x64`를 지정. + * `ELECTRON_GITHUB_TOKEN` - GitHub에 릴리즈를 만들 수 있는 토큰. + * `ELECTRON_S3_ACCESS_KEY`, `ELECTRON_S3_BUCKET`, `ELECTRON_S3_SECRET_KEY` - + node.js 헤더 뿐만 아니라 심볼을 업로드할 장소. + * `ELECTRON_RELEASE` - `true`로 지정하고 업로드 부분이 실행되면, 설정되지 않은 + 부분을 남기고 `surf-build`가 CI-type 확인을 실행합니다. 모든 pull request를 + 실행할 때 적합합니다. + * `CI` - `true` 또는 다른 것을 지정하면 실패합니다. + * `GITHUB_TOKEN` - `ELECTRON_GITHUB_TOKEN`와 같게 설정 + * `SURF_TEMP` - Windows에선 `C:\Temp`로 설정하면 긴 경로 문제를 해결할 수 있습니다. + * `TARGET_ARCH` - `ia32` 또는 `x64`를 지정. 4. Electron에 기여를 하는 기여자라면, _반드시_ `script/upload.py`에서 포크를 위해 `ELECTRON_REPO`를 설정해야 합니다. (`MYORG/electron`) diff --git a/docs-translations/ko-KR/tutorial/application-packaging.md b/docs-translations/ko-KR/tutorial/application-packaging.md index 6dd52b34ef8..dd86ab0fc7a 100644 --- a/docs-translations/ko-KR/tutorial/application-packaging.md +++ b/docs-translations/ko-KR/tutorial/application-packaging.md @@ -1,15 +1,15 @@ -# 어플리케이션 패키징 +# 애플리케이션 패키징 Windows에서 일어나는 긴 경로 이름에 대한 [issues](https://github.com/joyent/node/issues/6960)를 -완화하고 `require` 속도를 약간 빠르게 하며 어플리케이션의 리소스와 소스 코드를 좋지 않은 -사용자로부터 보호하기 위해 어플리케이션을 [asar][asar] 아카이브로 패키징 할 수 있습니다. +완화하고 `require` 속도를 약간 빠르게 하며 애플리케이션의 리소스와 소스 코드를 좋지 않은 +사용자로부터 보호하기 위해 애플리케이션을 [asar][asar] 아카이브로 패키징 할 수 있습니다. ## `asar` 아카이브 생성 [asar][asar] 아카이브는 tar과 비슷한 포맷으로 모든 리소스를 하나의 파일로 만듭니다. 그리고 Electron은 압축해제 없이 임의로 모든 파일을 읽어들일 수 있습니다. -간단한 작업을 통해 어플리케이션을 `asar` 아카이브로 압축할 수 있습니다: +간단한 작업을 통해 애플리케이션을 `asar` 아카이브로 압축할 수 있습니다: ### 1. asar 유틸리티 설치 @@ -176,7 +176,7 @@ $ asar pack app app.asar --unpack *.node 커맨드를 실행한 후 같은 디렉터리에 `app.asar` 파일 외에 `app.asar.unpacked` 폴더가 같이 생성됩니다. 이 폴더안에 unpack 옵션에서 설정한 파일들이 압축이 풀려진 상태로 -포함되어 있습니다. 사용자에게 어플리케이션을 배포할 때 반드시 해당 폴더도 같이 배포해야 +포함되어 있습니다. 사용자에게 애플리케이션을 배포할 때 반드시 해당 폴더도 같이 배포해야 합니다. [asar]: https://github.com/electron/asar diff --git a/docs-translations/ko-KR/tutorial/desktop-environment-integration.md b/docs-translations/ko-KR/tutorial/desktop-environment-integration.md index beece23e3f7..4298083e9a3 100644 --- a/docs-translations/ko-KR/tutorial/desktop-environment-integration.md +++ b/docs-translations/ko-KR/tutorial/desktop-environment-integration.md @@ -1,15 +1,15 @@ # 데스크톱 환경 통합 -어플리케이션 배포의 대상이 되는 서로 다른 운영체제 시스템의 환경에 맞춰 어플리케이션의 +애플리케이션 배포의 대상이 되는 서로 다른 운영체제 시스템의 환경에 맞춰 애플리케이션의 기능을 통합할 수 있습니다. 예를 들어 Windows에선 태스크바의 JumpList에 바로가기를 -추가할 수 있고 Mac(OS X)에선 dock 메뉴에 커스텀 메뉴를 추가할 수 있습니다. +추가할 수 있고 Mac(macOS)에선 dock 메뉴에 커스텀 메뉴를 추가할 수 있습니다. 이 문서는 Electron API를 이용하여 각 운영체제 시스템의 기능을 활용하는 방법을 설명합니다. -## 데스크톱 알림 (Windows, Linux, OS X) +## 데스크톱 알림 (Windows, Linux, macOS) -Windows, Linux, OS X 운영체제 모두 기본적으로 어플리케이션에서 유저에게 알림을 보내는 +Windows, Linux, macOS 운영체제 모두 기본적으로 애플리케이션에서 유저에게 알림을 보내는 방법을 제공합니다. Electron은 [HTML5 Notification API](https://notifications.spec.whatwg.org/)를 통해 개발자가 편리하게 데스크톱 알림을 사용할 수 있는 기능을 제공합니다. 데스크톱 알림은 운영체제의 네이티브 알림 API를 사용하여 표시합니다. @@ -47,25 +47,25 @@ myNotification.onclick = () => { 따르는 모든 데스크탑 환경에서 데스크톱 알림 기능을 사용할 수 있습니다. Cinnamon, Enlightenment, Unity, GNOME, KDE등을 지원합니다. -### OS X +### macOS -OS X에서의 데스크톱 알림은 아주 직관적입니다. 하지만 데스크톱 알림을 사용할 땐 +macOS에서의 데스크톱 알림은 아주 직관적입니다. 하지만 데스크톱 알림을 사용할 땐 [Apple's Human Interface guidelines regarding notifications](https://developer.apple.com/library/mac/documentation/UserExperience/Conceptual/OSXHIGuidelines/NotificationCenter.html) 가이드를 고려해야 합니다. 참고로 데스크롭 알림의 최대 길이는 256 바이트 입니다. 길이가 초과할 경우 초과한 글자가 잘립니다. -## 최근 사용한 문서 (Windows & OS X) +## 최근 사용한 문서 (Windows & macOS) -Windows와 OS X는 JumpList 또는 dock 메뉴를 통해 최근 문서 리스트에 쉽게 접근할 수 +Windows와 macOS는 JumpList 또는 dock 메뉴를 통해 최근 문서 리스트에 쉽게 접근할 수 있습니다. __JumpList:__ ![JumpList 최근 문서](http://i.msdn.microsoft.com/dynimg/IC420538.png) -__어플리케이션 dock menu:__ +__애플리케이션 dock menu:__ @@ -85,29 +85,29 @@ app.clearRecentDocuments(); ### Windows에서 주의할 점 -이 기능을 Windows에서 사용할 땐 운영체제 시스템에 어플리케이션에서 사용하는 파일 +이 기능을 Windows에서 사용할 땐 운영체제 시스템에 애플리케이션에서 사용하는 파일 확장자가 등록되어 있어야 합니다. 그렇지 않은 경우 파일을 JumpList에 추가해도 추가되지 -않습니다. 어플리케이션 등록에 관련된 API의 모든 내용은 [Application Registration][app-registration]에서 +않습니다. 애플리케이션 등록에 관련된 API의 모든 내용은 [Application Registration][app-registration]에서 찾아볼 수 있습니다. 유저가 JumpList에서 파일을 클릭할 경우 클릭된 파일의 경로가 커맨드 라인 인수로 추가되어 -새로운 인스턴스의 어플리케이션이 실행됩니다. +새로운 인스턴스의 애플리케이션이 실행됩니다. -### OS X에서 주의할 점 +### macOS에서 주의할 점 파일이 최근 문서 메뉴에서 요청될 경우 `app` 모듈의 `open-file` 이벤트가 호출됩니다. -## 커스텀 독 메뉴 (OS X) +## 커스텀 독 메뉴 (macOS) -OS X는 개발자가 dock에 커스텀 메뉴를 만들 수 있도록 허용하고 있습니다. -보통 어플리케이션의 특정 기능 바로가기를 만들 때 사용합니다: +macOS는 개발자가 dock에 커스텀 메뉴를 만들 수 있도록 허용하고 있습니다. +보통 애플리케이션의 특정 기능 바로가기를 만들 때 사용합니다: __Terminal.app의 dock menu:__ 커스텀 dock menu를 설정하려면 `app.dock.setMenu` API를 사용하면 됩니다. -OS X에서만 사용 가능합니다: +macOS에서만 사용 가능합니다: ```javascript const {app, Menu} = require('electron'); @@ -129,12 +129,12 @@ app.dock.setMenu(dockMenu); Windows에선 JumpList의 `Tasks` 카테고리에 원하는 작업을 설정할 수 있습니다. MSDN에선 해당 기능을 다음과 같이 설명하고 있습니다: -> 어플리케이션 작업은 프로그램의 기능 그리고 주요사양 두가지를 기반으로 유저의 행동을 -> 예측하여 정의합니다. 실행할 필요가 없는 어플리케이션 작업은 작동하지 않을 때 반드시 +> 애플리케이션 작업은 프로그램의 기능 그리고 주요사양 두가지를 기반으로 유저의 행동을 +> 예측하여 정의합니다. 실행할 필요가 없는 애플리케이션 작업은 작동하지 않을 때 반드시 > context-free를 유지해야 합니다. 작업은 일반 사용자가 프로그램을 실행하거나 이메일 > 프로그램으로 이메일을 작성하거나 달력을 불러오고, 워드 프로세서로 새 문서를 작성, > 특정 모드, 부속 명령으로 프로그램을 실행하는 등의 통계적, 일반적으로 가장 많이 -> 사용되는 작업인지를 고려해야 합니다. 어플리케이션 작업은 일반 유저가 필요로 하지 +> 사용되는 작업인지를 고려해야 합니다. 애플리케이션 작업은 일반 유저가 필요로 하지 > 않는 고급 기능을 조잡하게 채우거나 등록과 같은 일회성의 작업을 포함해선 안됩니다. > 또한 작업에 특별 이벤트 또는 업그레이드 등의 홍보성 작업을 추가하면 안됩니다. > @@ -147,8 +147,8 @@ __Internet Explorer의 작업:__ ![IE](http://i.msdn.microsoft.com/dynimg/IC420539.png) -OS X의 dock menu(진짜 메뉴)와는 달리 Windows의 사용자 작업은 어플리케이션 바로 -가기처럼 작동합니다. 유저가 작업을 클릭할 때 설정한 인수와 함께 새로운 어플리케이션이 +macOS의 dock menu(진짜 메뉴)와는 달리 Windows의 사용자 작업은 애플리케이션 바로 +가기처럼 작동합니다. 유저가 작업을 클릭할 때 설정한 인수와 함께 새로운 애플리케이션이 실행됩니다. 사용자 작업을 설정하려면 [app.setUserTasks][setusertaskstasks] 메서드를 통해 구현할 @@ -175,12 +175,12 @@ app.setUserTasks([]); ``` -사용자 작업 리스트는 어플리케이션이 삭제되지 않는 한 종료되어도 태스크바에 보존됩니다. +사용자 작업 리스트는 애플리케이션이 삭제되지 않는 한 종료되어도 태스크바에 보존됩니다. 이러한 이유로 반드시 프로그램 경로와 아이콘 경로를 지정해야 합니다. ## 미리보기 툴바 -Windows에선 작업 표시줄의 어플리케이션 선택시 나오는 미리보기에 특정한 미리보기 툴바를 +Windows에선 작업 표시줄의 애플리케이션 선택시 나오는 미리보기에 특정한 미리보기 툴바를 추가할 수 있습니다. 이 기능은 유저가 윈도우를 활성화 하지 않고 특정한 커맨드를 실행시킬 수 있도록 할 수 있습니다. @@ -188,7 +188,7 @@ MSDN의 설명에 의하면: > 이 툴바는 표준 툴바의 공통 컨트롤과 비슷한 역할을 합니다. 버튼은 최대 7개 까지 > 만들 수 있습니다. 각 버튼의 구조엔 ID, 이미지, 툴팁, 상태 등이 정의되어있습니다. -> 작업표시줄에 구조가 전달되면 어플리케이션이 상태에 따라 버튼을 숨기거나, 활성화하거나, +> 작업표시줄에 구조가 전달되면 애플리케이션이 상태에 따라 버튼을 숨기거나, 활성화하거나, > 비활성화 할 수 있습니다. > > 예를 들어, 윈도우 미디어 플레이어는(WMP) 미디어 플레이어가 공통적으로 사용하는 @@ -198,7 +198,7 @@ __Windows Media Player의 미리보기 툴바:__ ![player](https://i-msdn.sec.s-msft.com/dynimg/IC420540.png) -[BrowserWindow.setThumbarButtons][setthumbarbuttons] API를 통해 어플리케이션에 +[BrowserWindow.setThumbarButtons][setthumbarbuttons] API를 통해 애플리케이션에 미리보기 툴바를 설정할 수 있습니다: ```javascript @@ -214,7 +214,7 @@ win.setThumbarButtons([ { tooltip: 'button1', icon: path.join(__dirname, 'button1.png'), - click() { console.log('button2 clicked'); } + click() { console.log('button1 clicked'); } }, { tooltip: 'button2', @@ -241,13 +241,13 @@ __Audacious의 런처 숏컷:__ ![audacious](https://help.ubuntu.com/community/UnityLaunchersAndDesktopFiles?action=AttachFile&do=get&target=shortcuts.png) -## 작업 표시줄 안의 프로그래스 바 (Windows, OS X, Unity) +## 작업 표시줄 안의 프로그래스 바 (Windows, macOS, Unity) -Windows에선 작업 표시줄의 어플리케이션 버튼에 프로그래스 바를 추가할 수 있습니다. -이 기능은 사용자가 어플리케이션의 창을 열지 않고도 어플리케이션의 작업의 상태 정보를 +Windows에선 작업 표시줄의 애플리케이션 버튼에 프로그래스 바를 추가할 수 있습니다. +이 기능은 사용자가 애플리케이션의 창을 열지 않고도 애플리케이션의 작업의 상태 정보를 시각적으로 보여줄 수 있도록 해줍니다. -OS X에선 프로그래스바가 dock 아이콘의 일부에 표시됩니다. +macOS에선 프로그래스바가 dock 아이콘의 일부에 표시됩니다. 또한 Unity DE도 런처에 프로그래스 바를 부착할 수 있습니다. @@ -265,7 +265,7 @@ win.setProgressBar(0.5); ## 작업 표시줄의 아이콘 오버레이 (Windows) -Windows에선 작업 표시줄 버튼에 어플리케이션의 상태를 표시하는 작은 오버레이를 사용할 +Windows에선 작업 표시줄 버튼에 애플리케이션의 상태를 표시하는 작은 오버레이를 사용할 수 있습니다. MSDN에서 인용하자면 (영문): > Icon overlays serve as a contextual notification of status, and are intended @@ -290,9 +290,9 @@ let win = new BrowserWindow({...}); win.setOverlayIcon('path/to/overlay.png', 'Description for overlay'); ``` -## 대표 파일 제시 (OS X) +## 대표 파일 제시 (macOS) -OS X는 창에서 대표 파일을 설정할 수 있습니다. 타이틀바에서 파일 아이콘이 있고, 사용자가 +macOS는 창에서 대표 파일을 설정할 수 있습니다. 타이틀바에서 파일 아이콘이 있고, 사용자가 Command-Click 또는 Control-Click 키를 누를 경우 파일 경로 팝업이 보여집니다. 또한 창의 상태도 지정할 수 있습니다. 다시 말해 로드된 문서의 수정 여부를 제목의 파일 아이콘에 표시할 수 있습니다. diff --git a/docs-translations/ko-KR/tutorial/devtools-extension.md b/docs-translations/ko-KR/tutorial/devtools-extension.md index 633e23d8268..2640b02a6cb 100644 --- a/docs-translations/ko-KR/tutorial/devtools-extension.md +++ b/docs-translations/ko-KR/tutorial/devtools-extension.md @@ -1,6 +1,6 @@ # 개발자 도구 확장 기능 -어플리케이션의 디버깅을 쉽게 하기 위해 Electron은 기본적으로 +애플리케이션의 디버깅을 쉽게 하기 위해 Electron은 기본적으로 [Chrome DevTools Extension][devtools-extension]을 지원합니다. Electron은 유명한 웹 프레임워크를 디버깅하기 위해 사용할 수 있는 개발자 도구 확장 @@ -23,7 +23,7 @@ Electron에 확장 기능을 로드하려면, Chrome 브라우저에서 다운 * `~/.config/google-chrome-beta/Default/Extensions/` * `~/.config/google-chrome-canary/Default/Extensions/` * `~/.config/chromium/Default/Extensions/` - * OS X에선 `~/Library/Application Support/Google/Chrome/Default/Extensions`. + * macOS에선 `~/Library/Application Support/Google/Chrome/Default/Extensions`. 4. 확장 기능의 경로를 `BrowserWindow.addDevToolsExtension` API로 전달합니다. React Developer Tools의 경우 다음과 비슷해야 합니다: `~/Library/Application Support/Google/Chrome/Default/Extensions/fmkadmapgofadopljbjfkapdkoienihi/0.14.10_0` diff --git a/docs-translations/ko-KR/tutorial/electron-versioning.md b/docs-translations/ko-KR/tutorial/electron-versioning.md index 13d83563033..0bf5b103ec8 100644 --- a/docs-translations/ko-KR/tutorial/electron-versioning.md +++ b/docs-translations/ko-KR/tutorial/electron-versioning.md @@ -8,12 +8,12 @@ Electron은 Node와 Chromium에 큰 의존성을 지니고 있는 만큼, 유의 버전 숫자는 다음과 같은 규칙으로 올라갑니다: * Major: Electron API의 주요 변경 사항을 반영합니다 - 만약 `0.37.0`에서 `1.0.0`로 - 업그레이드하는 경우, 어플리케이션을 업데이트해야 합니다. + 업그레이드하는 경우, 애플리케이션을 업데이트해야 합니다. * Minor: 주요 Chrome과 Node 버전의 업그레이드를 반영하거나; Electron의 중요한 변경 - 사항을 반영합니다 - 만약 `1.0.0`에서 `1.1.0`로 업그레이드하는 경우, 어플리케이션은 + 사항을 반영합니다 - 만약 `1.0.0`에서 `1.1.0`로 업그레이드하는 경우, 애플리케이션은 여전히 작동하겠지만, 약간의 업데이트가 필요할 수 있습니다. * Patch: 새로운 기능과 버그 수정을 반영합니다 - 만약 `1.0.0`에서 `1.0.1`로 - 업그레이드하는 경우, 어플리케이션은 잘 작동할 것입니다. + 업그레이드하는 경우, 애플리케이션은 잘 작동할 것입니다. `electron-prebuilt`를 사용하고 있다면, Electron의 변경 사항을 확실하게 인지하고 개발자 스스로 업그레이드를 적용하기 위해 고정된 버전 숫자를 사용하는 것을 권장합니다. diff --git a/docs-translations/ko-KR/tutorial/mac-app-store-submission-guide.md b/docs-translations/ko-KR/tutorial/mac-app-store-submission-guide.md index 439909ba4c1..370f31d7749 100644 --- a/docs-translations/ko-KR/tutorial/mac-app-store-submission-guide.md +++ b/docs-translations/ko-KR/tutorial/mac-app-store-submission-guide.md @@ -1,38 +1,38 @@ -# Mac 앱 스토어 어플리케이션 제출 가이드 +# Mac 앱 스토어 애플리케이션 제출 가이드 Electron은 v0.34.0 버전부터 앱 패키지를 Mac App Store(MAS)에 제출할 수 있게 -되었습니다. 이 가이드는 어플리케이션을 앱 스토어에 등록하는 방법과 빌드의 한계에 대한 +되었습니다. 이 가이드는 애플리케이션을 앱 스토어에 등록하는 방법과 빌드의 한계에 대한 설명을 제공합니다. -**참고:** Mac App Store에 어플리케이션을 등록하려면 +**참고:** Mac App Store에 애플리케이션을 등록하려면 [Apple Developer Program][developer-program]에 등록되어 있어야 하며 비용이 발생할 수 있습니다. -## 앱 스토어에 어플리케이션을 등록하는 방법 +## 앱 스토어에 애플리케이션을 등록하는 방법 -다음 몇 가지 간단한 절차에 따라 앱 스토어에 어플리케이션을 등록하는 방법을 알아봅니다. +다음 몇 가지 간단한 절차에 따라 앱 스토어에 애플리케이션을 등록하는 방법을 알아봅니다. 한가지, 이 절차는 제출한 앱이 Apple로부터 승인되는 것을 보장하지 않습니다. 따라서 여전히 Apple의 [Submitting Your App][submitting-your-app] 가이드를 숙지하고 있어야 하며 앱 스토어 제출 요구 사항을 확실히 인지하고 있어야 합니다. ### 인증서 취득 -앱 스토어에 어플리케이션을 제출하려면, 먼저 Apple로부터 인증서를 취득해야 합니다. 취득 +앱 스토어에 애플리케이션을 제출하려면, 먼저 Apple로부터 인증서를 취득해야 합니다. 취득 방법은 웹에서 찾아볼 수 있는 [가이드][nwjs-guide]를 참고하면 됩니다. ### Team ID 얻기 -어플리케이션에 서명하기 전에, 먼저 개발 계정의 Team ID를 알아야 합니다. Team ID를 +애플리케이션에 서명하기 전에, 먼저 개발 계정의 Team ID를 알아야 합니다. Team ID를 알아보려면 [Apple Developer Center](https://developer.apple.com/account/)에 로그인한 후, 사이드바의 Membership을 클릭합니다. Team ID는 Membership Information 섹션의 팀 이름 밑에 위치합니다. ### 앱에 서명하기 -준비 작업이 끝난 후, [어플리케이션 배포](application-distribution.md) 문서에 따라 -어플리케이션을 패키징한 후 어플리케이션에 서명 합니다. +준비 작업이 끝난 후, [애플리케이션 배포](application-distribution.md) 문서에 따라 +애플리케이션을 패키징한 후 애플리케이션에 서명합니다. -먼저, Team ID를 키로 가지고 있는 어플리케이션의 `Info.plist`에 `ElectronTeamID` 키를 +먼저, Team ID를 키로 가지고 있는 애플리케이션의 `Info.plist`에 `ElectronTeamID` 키를 추가해야 합니다: ```xml @@ -77,17 +77,17 @@ Electron은 v0.34.0 버전부터 앱 패키지를 Mac App Store(MAS)에 제출 ``` -`TEAM_ID` 부분은 Team ID로 치환하고, `your.bundle.id` 부분은 어플리케이션의 Bundle +`TEAM_ID` 부분은 Team ID로 치환하고, `your.bundle.id` 부분은 애플리케이션의 Bundle ID로 치환해야 합니다. -그리고 다음 스크립트를 통해 어플리케이션에 서명합니다: +그리고 다음 스크립트를 통해 애플리케이션에 서명합니다: ```bash #!/bin/bash -# 어플리케이션의 이름. +# 애플리케이션의 이름. APP="YourApp" -# 서명할 어플리케이션의 경로. +# 서명할 애플리케이션의 경로. APP_PATH="/path/to/YourApp.app" # 서명된 패키지의 출력 경로. RESULT_PATH="~/Desktop/$APP.pkg" @@ -116,38 +116,41 @@ codesign -s "$APP_KEY" -f --entitlements "$PARENT_PLIST" "$APP_PATH" productbuild --component "$APP_PATH" /Applications --sign "$INSTALLER_KEY" "$RESULT_PATH" ``` -만약 OS X의 샌드박스 개념에 대해 처음 접한다면 Apple의 [Enabling App Sandbox][enable-app-sandbox] +만약 macOS의 샌드박스 개념에 대해 처음 접한다면 Apple의 [Enabling App Sandbox][enable-app-sandbox] 문서를 참고하여 기본적인 개념을 이해해야 합니다. 그리고 자격(plist) 파일에 -어플리케이션에서 요구하는 권한의 키를 추가합니다. +애플리케이션에서 요구하는 권한의 키를 추가합니다. -그 외에 [electron-osx-sign][electron-osx-sign] 모듈을 이용해서 직접 서명할 수도 있습니다. -#### 네이티브 모듈 서명하기 +그 외에 별로도 [electron-osx-sign][electron-osx-sign] 모듈을 사용하여 직접 서명할 +수도 있습니다. -앱 내부에서 사용한 네이티브 모듈들도 서명이 필요합니다. -electron-osx-sign 을 사용한다면, 앱 실행 인수 목록에 경로를 반드시 지정해야 합니다. +#### 네이티브 모듈에 서명하기 + +앱 내부에서 사용한 네이티브 모듈도 서명이 필요합니다. `electron-osx-sign`을 +사용한다면, 인수 목록에 빌트인 바이너리 경로가 포함되어 있는지 확인해야 합니다: ```bash electron-osx-sign YourApp.app YourApp.app/Contents/Resources/app/node_modules/nativemodule/build/release/nativemodule ``` -참고할 점은 네이티브 모듈이 의도하지 않았지만 오브젝트 파일(.o)을 포함하는 경우도 있습니다. -이 경우 오브젝트 파일들의 서명을 해야할 수도 있습니다. -[electron-packager][electron-packager]를 사용한다면, 빌드 과정에 `--ignore=.+\.o$` 코드를 추가해 해당 파일을 무시해줍시다. +참고로 네이티브 모듈이 의도하지 않게 중간 파일을 포함하는 경우도 있으며 이 파일은 +포함되어선 안됩니다. (해당 파일에도 서명해야 할 수도 있습니다) +[electron-packager][electron-packager]를 사용한다면, 빌드 과정에 `--ignore=.+\.o$` +인수를 추가하여 중간 파일을 무시할 수 있습니다. -### 어플리케이션 업로드 +### 애플리케이션 업로드 -어플리케이션 서명을 완료한 후 iTunes Connect에 업로드하기 위해 Application Loader를 +애플리케이션 서명을 완료한 후 iTunes Connect에 업로드하기 위해 Application Loader를 사용할 수 있습니다. 참고로 업로드하기 전에 [레코드][create-record]를 만들었는지 확인해야 합니다. -### 어플리케이션을 심사에 제출 +### 애플리케이션을 심사에 제출 -위 과정을 마치면 [어플리케이션을 심사를 위해 제출][submit-for-review]할 수 있습니다. +위 과정을 마치면 [애플리케이션을 심사를 위해 제출][submit-for-review]할 수 있습니다. ## MAS 빌드의 한계 -모든 어플리케이션 샌드박스에 대한 요구 사항을 충족시키기 위해, 다음 모듈들은 MAS +모든 애플리케이션 샌드박스에 대한 요구 사항을 충족시키기 위해, 다음 모듈들은 MAS 빌드에서 비활성화됩니다: * `crashReporter` @@ -157,15 +160,38 @@ electron-osx-sign YourApp.app YourApp.app/Contents/Resources/app/node_modules/na * 비디오 캡쳐 기능은 몇몇 장치에서 작동하지 않을 수 있습니다. * 특정 접근성 기능이 작동하지 않을 수 있습니다. -* 어플리케이션이 DNS의 변경을 감지하지 못할 수 있습니다. +* 애플리케이션이 DNS의 변경을 감지하지 못할 수 있습니다. -또한 어플리케이션 샌드박스 개념으로 인해 어플리케이션에서 접근할 수 있는 리소스는 +또한 애플리케이션 샌드박스 개념으로 인해 애플리케이션에서 접근할 수 있는 리소스는 엄격하게 제한되어 있습니다. 자세한 내용은 [앱 샌드박싱][app-sandboxing] 문서를 참고하세요. +### 추가적인 권한 + +Mac 앱 스토어 빌드를 위해 앱에서 사용하는 Electron API에 따라 `parent.plist` 파일에 +추가적인 기능에 대한 권한을 추가해야 할 수도 있습니다. + +#### dialog.showOpenDialog + +```xml +com.apple.security.files.user-selected.read-only + +``` + +자세한 내용은 [User-Selected 파일 접근 활성화 문서][user-selected]를 참고하세요. + +#### dialog.showSaveDialog + +```xml +com.apple.security.files.user-selected.read-write + +``` + +자세한 내용은 [User-Selected 파일 접근 활성화 문서][user-selected]를 참고하세요. + ## Electron에서 사용하는 암호화 알고리즘 -국가와 살고 있는 지역에 따라, 맥 앱스토어는 제출한 어플리케이션에서 사용하는 암호화 +국가와 살고 있는 지역에 따라, 맥 앱스토어는 제출한 애플리케이션에서 사용하는 암호화 알고리즘의 문서를 요구할 수 있습니다. 심지어 U.S. Encryption Registration (ERN)의 승인 사본을 제출하라고 할 수도 있습니다. @@ -196,9 +222,9 @@ Electron은 다음과 같은 암호화 알고리즘을 사용합니다: * RIPEMD - [ISO/IEC 10118-3](http://webstore.ansi.org/RecordDetail.aspx?sku=ISO%2FIEC%2010118-3:2004) ERN의 승인을 얻는 방법은, 다음 글을 참고하는 것이 좋습니다: -[어플리케이션이 암호화를 사용할 때, 합법적으로 Apple의 앱 스토어에 제출하는 방법 (또는 ERN의 승인을 얻는 방법)][ern-tutorial]. +[애플리케이션이 암호화를 사용할 때, 합법적으로 Apple의 앱 스토어에 제출하는 방법 (또는 ERN의 승인을 얻는 방법)][ern-tutorial]. -**역주:** [Mac 앱 배포 가이드 공식 한국어 문서](https://developer.apple.com/osx/distribution/kr/) +**역자주:** [Mac 앱 배포 가이드 공식 한국어 문서](https://developer.apple.com/osx/distribution/kr/) [developer-program]: https://developer.apple.com/support/compare-memberships/ [submitting-your-app]: https://developer.apple.com/library/mac/documentation/IDEs/Conceptual/AppDistributionGuide/SubmittingYourApp/SubmittingYourApp.html @@ -211,3 +237,4 @@ ERN의 승인을 얻는 방법은, 다음 글을 참고하는 것이 좋습니 [app-sandboxing]: https://developer.apple.com/app-sandboxing/ [ern-tutorial]: https://carouselapps.com/2015/12/15/legally-submit-app-apples-app-store-uses-encryption-obtain-ern/ [temporary-exception]: https://developer.apple.com/library/mac/documentation/Miscellaneous/Reference/EntitlementKeyReference/Chapters/AppSandboxTemporaryExceptionEntitlements.html +[user-selected]: https://developer.apple.com/library/mac/documentation/Miscellaneous/Reference/EntitlementKeyReference/Chapters/EnablingAppSandbox.html#//apple_ref/doc/uid/TP40011195-CH4-SW6] diff --git a/docs-translations/ko-KR/tutorial/quick-start.md b/docs-translations/ko-KR/tutorial/quick-start.md index d96a430ecc9..37611d319fc 100644 --- a/docs-translations/ko-KR/tutorial/quick-start.md +++ b/docs-translations/ko-KR/tutorial/quick-start.md @@ -3,8 +3,8 @@ ## 소개 Electron은 자바스크립트와 함께 제공된 풍부한 네이티브 API를 사용하여 멋진 데스크탑 -어플리케이션을 만들 수 있도록 해주는 프레임워크입니다. 이 프레임워크의 Node.js는 웹 -서버 개발이 아닌 데스크탑 어플리케이션 개발에 초점을 맞췄습니다. +애플리케이션을 만들 수 있도록 해주는 프레임워크입니다. 이 프레임워크의 Node.js는 웹 +서버 개발이 아닌 데스크탑 애플리케이션 개발에 초점을 맞췄습니다. 이 말은 Electron이 GUI 라이브러리의 자바스크립트 바인딩이라는 뜻이 아닙니다. 대신, Electron은 웹 페이지의 GUI를 사용합니다. 쉽게 말해 Electron은 자바스크립트를 사용하여 @@ -41,9 +41,10 @@ API를 사용하여 low-level 수준으로 운영체제와 상호작용할 수 프로세스에서 그 작업을 처리할 수 있도록 메인 프로세스와 통신을 해야 합니다. Electron에는 메인 프로세스와 렌더러 프로세스 사이에 통신을 할 수 있도록 -[ipcRenderer](../api/ipc-renderer.md)와 [ipcMain](../api/ipc-main.md) 모듈을 제공하고 있습니다. -또는 [remote](../api/remote.md) 모듈을 사용하여 RPC 스타일로 통신할 수도 있습니다. -또한 FAQ에서 [다양한 객체를 공유하는 방법](share-data)도 소개하고 있습니다. +[`ipcRenderer`](../api/ipc-renderer.md)와 [`ipcMain`](../api/ipc-main.md) 모듈을 +제공하고 있습니다. 또는 [remote](../api/remote.md) 모듈을 사용하여 RPC 스타일로 +통신할 수도 있습니다. 또한 FAQ에서 [다양한 객체를 공유하는 방법](share-data)도 +소개하고 있습니다. ## 첫번째 Electron 앱 만들기 @@ -76,7 +77,7 @@ __알림__: 만약 `main` 필드가 `package.json`에 설정되어 있지 않으 ```javascript const electron = require('electron'); -// 어플리케이션 생명주기를 조작 하는 모듈. +// 애플리케이션 생명주기를 조작 하는 모듈. const {app} = electron; // 네이티브 브라우저 창을 만드는 모듈. const {BrowserWindow} = electron; @@ -109,9 +110,9 @@ function createWindow () { // 사용할 수 있습니다. app.on('ready', createWindow); -// 모든 창이 닫히면 어플리케이션 종료. +// 모든 창이 닫히면 애플리케이션 종료. app.on('window-all-closed', () => { - // OS X의 대부분의 어플리케이션은 유저가 Cmd + Q 커맨드로 확실하게 + // macOS의 대부분의 애플리케이션은 유저가 Cmd + Q 커맨드로 확실하게 // 종료하기 전까지 메뉴바에 남아 계속 실행됩니다. if (process.platform !== 'darwin') { app.quit(); @@ -119,14 +120,14 @@ app.on('window-all-closed', () => { }); app.on('activate', () => { - // OS X에선 보통 독 아이콘이 클릭되고 나서도 + // macOS에선 보통 독 아이콘이 클릭되고 나서도 // 열린 윈도우가 없으면, 새로운 윈도우를 다시 만듭니다. if (win === null) { createWindow(); } }); -// 이 파일엔 제작할 어플리케이션에 특화된 메인 프로세스 코드를 +// 이 파일엔 제작할 애플리케이션에 특화된 메인 프로세스 코드를 // 포함할 수 있습니다. 또한 파일을 분리하여 require하는 방법으로 // 코드를 작성할 수도 있습니다. ``` @@ -142,7 +143,7 @@ app.on('activate', () => {

헬로 월드!

- 이 어플리케이션은 node , + 이 애플리케이션은 node , Chrome , Electron 을 사용합니다. @@ -151,7 +152,7 @@ app.on('activate', () => { ## 앱 실행하기 -앱을 작성한 후 [어플리케이션 배포](application-distribution.md) 가이드를 따라 앱을 +앱을 작성한 후 [애플리케이션 배포](application-distribution.md) 가이드를 따라 앱을 패키징 하고 패키징한 앱을 실행할 수 있습니다. 또한 Electron 실행파일을 다운로드 받아 바로 실행해 볼 수도 있습니다. @@ -160,7 +161,7 @@ app.on('activate', () => { [`electron-prebuilt`](https://github.com/electron-userland/electron-prebuilt)는 Electron의 미리 컴파일된 바이너리를 포함하는 `npm` 모듈입니다. -만약 `npm`을 통해 전역에 이 모듈을 설치했다면, 어플리케이션 소스 디렉터리에서 다음 +만약 `npm`을 통해 전역에 이 모듈을 설치했다면, 애플리케이션 소스 디렉터리에서 다음 명령을 실행하면 바로 실행할 수 있습니다: ```bash @@ -195,18 +196,18 @@ $ .\electron\electron.exe your-app\ $ ./electron/electron your-app/ ``` -#### OS X +#### macOS ```bash $ ./Electron.app/Contents/MacOS/Electron your-app/ ``` -어플리케이션 실행파일은 `Electron`의 release 패키지에 포함되어 있습니다. +애플리케이션 실행파일은 `Electron`의 release 패키지에 포함되어 있습니다. [여기](https://github.com/electron/electron/releases)에서 다운로드 받을 수 있습니다. ### 배포용 실행 파일 만들기 -어플리케이션 작성을 모두 끝냈다면 [어플리케이션 배포](application-distribution.md) +애플리케이션 작성을 모두 끝냈다면 [애플리케이션 배포](application-distribution.md) 가이드를 통해 제작한 앱을 패키징하고 배포할 수 있습니다. ### 미리 작성된 앱 실행하기 @@ -218,14 +219,14 @@ $ ./Electron.app/Contents/MacOS/Electron your-app/ [Node.js](https://nodejs.org/en/download/)가 필요합니다. (CLI에서 실행 가능한 [npm](https://npmjs.org)이 있어야 합니다) -**역주**: `npm`은 보통 Node.js를 설치하면 자동으로 같이 설치됩니다. +**역자주**: `npm`은 보통 Node.js를 설치하면 자동으로 같이 설치됩니다. ```bash # 저장소를 클론합니다 $ git clone https://github.com/electron/electron-quick-start # 저장소 안으로 들어갑니다 $ cd electron-quick-start -# 어플리케이션의 종속성 모듈을 설치한 후 실행합니다 +# 애플리케이션의 종속성 모듈을 설치한 후 실행합니다 $ npm install && npm start ``` diff --git a/docs-translations/ko-KR/tutorial/security.md b/docs-translations/ko-KR/tutorial/security.md index 5d16d86ed6e..6d8a44f693d 100644 --- a/docs-translations/ko-KR/tutorial/security.md +++ b/docs-translations/ko-KR/tutorial/security.md @@ -8,16 +8,16 @@ 하지만 Electron을 사용하여 작업한다면, Electron은 웹 브라우저가 아니라는 것을 기억해 두어야 합니다. Electron은 친근한 웹 기술을 사용하여 풍부한 기능의 데스크톱 -어플리케이션을 만들 수 있도록 해주지만 그만큼 코드가 더 큰 힘을 사용합니다. +애플리케이션을 만들 수 있도록 해주지만 그만큼 코드가 더 큰 힘을 사용합니다. JavaScript가 파일 시스템, 유저 쉘, 그외 여러가지 기능에 접근할 수 있습니다. 이러한 -능력은 높은 퀄리티를 가진 네이티브 어플리케이션을 개발할 수 있도록 해주지만 코드에 +능력은 높은 퀄리티를 가진 네이티브 애플리케이션을 개발할 수 있도록 해주지만 코드에 부여된 추가적인 기능만큼 고유한 보안 문제가 발생할 가능성이 있습니다. 이를 염두해두고, 신뢰할 수 없는 출처의 임의의 콘텐츠를 표시할 때 Electron에서 자체적으로 처리하지 않는 심각한 보안 문제를 야기할 수 있다는 점을 주의해야 합니다. -실제로도, 가장 유명한 Electron 어플리케이션들은 (Atom, Slack, Visual Studio Code, +실제로도, 가장 유명한 Electron 애플리케이션들은 (Atom, Slack, Visual Studio Code, 등) 주로 로컬 콘텐츠를 (또는 Node 통합이 제외된 신뢰된, 보안된 원격 콘텐츠) 사용합니다 -- 만약 어플리케이션이 온라인 출처에서 가져온 코드를 실행한다면, 그 코드가 악성 코드가 +- 만약 애플리케이션이 온라인 출처에서 가져온 코드를 실행한다면, 그 코드가 악성 코드가 아닌지 판별하는 것은 본인의 책임입니다. ## Chromium 보안 문제와 업그레이드 @@ -29,7 +29,7 @@ Electron이 새로운 버전의 Chromium을 가능한 한 빠르게 지원하려 며칠부터 몇 주까지 더 걸릴 수 있습니다. 현재 Chromium 구성 요소를 업데이트하는 시스템은 우리가 사용할 수 있는 자원과 이 -프레임워크를 기반으로 구축된 대부분의 어플리케이션이 요구하는 것 사이에서 적절한 균형을 +프레임워크를 기반으로 구축된 대부분의 애플리케이션이 요구하는 것 사이에서 적절한 균형을 유지하고 있다고 느끼고 있습니다. 우리는 확실히 Electron 위에 무언가를 만드는 사람들의 사용 사례에 대한 자세한 내용을 듣는 것에 관심이 있습니다. 이러한 노력을 지원하는 Pull request와 기여는 언제나 환영합니다. @@ -39,11 +39,11 @@ request와 기여는 언제나 환영합니다. 원격 위치에서 받아온 코드를 로컬에서 실행하는 경우 언제나 보안 문제가 존재합니다. 예를 들어, 원격 웹 사이트가 브라우저 윈도우에서 표시될 때를 생각해볼 때, 만약 공격자가 어떠한 방법으로 웹 페이지의 콘텐츠를 변경하는 경우 (소스를 직접적으로 공격하거나 -어플리케이션과 실질적인 위치 사이에서 공격하는 등), 공갹자는 사용자의 기기에서 네이티브 +애플리케이션과 실질적인 위치 사이에서 공격하는 등), 공갹자는 사용자의 기기에서 네이티브 코드를 실행할 수 있습니다. > :warning: 어떠한 상황에서도 원격 코드를 로드하고 실행할 땐 Node 통합 기능을 -비활성화하고, 로컬 파일만 (어플리케이션 패키지 내부에 포함된) Node 코드를 실행시킬 수 +비활성화하고, 로컬 파일만 (애플리케이션 패키지 내부에 포함된) Node 코드를 실행시킬 수 있도록 하는 것이 좋습니다. 원격 콘텐츠를 표시할 땐, 항상 `webview`를 사용하고 `nodeIntegration`이 비활성화되어있는지 확인하세요. @@ -57,7 +57,7 @@ request와 기여는 언제나 환영합니다. * `webSecurity`를 비활성화하지 않습니다. 이 옵션을 비활성화하면 동일-출처 정책도 비활성화됩니다. * [`Content-Security-Policy`](http://www.html5rocks.com/en/tutorials/security/content-security-policy/) - 를 정의하고, 한정적인 규칙을 사용하세요 (ie: `script-src 'self'`) + 를 정의하고, 한정적인 규칙을 사용하세요 (i.e. `script-src 'self'`) * 문자열을 코드로 실행할 수 있는 [`eval`을 덮어쓰고 비활성화](https://github.com/nylas/N1/blob/0abc5d5defcdb057120d726b271933425b75b415/static/index.js#L6)하세요. * `allowDisplayingInsecureContent`를 `true`로 설정하지 마세요. diff --git a/docs-translations/ko-KR/tutorial/supported-platforms.md b/docs-translations/ko-KR/tutorial/supported-platforms.md index d71951cd3d8..d2d71c1454e 100644 --- a/docs-translations/ko-KR/tutorial/supported-platforms.md +++ b/docs-translations/ko-KR/tutorial/supported-platforms.md @@ -2,9 +2,9 @@ Electron에선 다음과 같은 플랫폼을 지원합니다: -### OS X +### macOS -OS X는 64비트 바이너리만 제공됩니다. 그리고 최소 OS X 지원 버전은 10.9입니다. +macOS는 64비트 바이너리만 제공됩니다. 그리고 최소 macOS 지원 버전은 10.9입니다. ### Windows diff --git a/docs-translations/ko-KR/tutorial/testing-on-headless-ci.md b/docs-translations/ko-KR/tutorial/testing-on-headless-ci.md index 8343777e436..42b2e027fd8 100644 --- a/docs-translations/ko-KR/tutorial/testing-on-headless-ci.md +++ b/docs-translations/ko-KR/tutorial/testing-on-headless-ci.md @@ -3,7 +3,7 @@ Chromium을 기반으로 한 Electron은 작업을 위해 디스플레이 드라이버가 필요합니다. 만약 Chromium이 디스플레이 드라이버를 찾기 못한다면, Electron은 그대로 실행에 실패할 것입니다. 따라서 실행하는 방법에 관계없이 모든 테스트를 실행하지 못하게 됩니다. -Electron 기반 어플리케이션을 Travis, Circle, Jenkins 또는 유사한 시스템에서 테스팅을 +Electron 기반 애플리케이션을 Travis, Circle, Jenkins 또는 유사한 시스템에서 테스팅을 진행하려면 약간의 설정이 필요합니다. 요점만 말하자면, 가상 디스플레이 드라이버가 필요합니다. @@ -18,11 +18,11 @@ Electron의 Chromium은 자동적으로 `$DISPLAY` 변수를 찾습니다. 따 다른 설정이 필요하지 않습니다. 이러한 작업은 Paul Betts의 [xvfb-maybe](https://github.com/paulcbetts/xvfb-maybe)를 통해 자동화 할 수 있습니다: `xvfb-maybe`를 테스트 커맨드 앞에 추가하고 현재 시스템에서 요구하면 -이 작은 툴이 자동적으로 xvfb를 설정합니다. Windows와 Mac OS X에선 간단히 아무 작업도 +이 작은 툴이 자동적으로 xvfb를 설정합니다. Windows와 macOS에선 간단히 아무 작업도 하지 않습니다. ``` -## Windows와 OS X에선, 그저 electron-mocha를 호출합니다 +## Windows와 macOS에선, 그저 electron-mocha를 호출합니다 ## Linux에선, 현재 headless 환경에 있는 경우 ## xvfb-run electron-mocha ./test/*.js와 같습니다 xvfb-maybe electron-mocha ./test/*.js @@ -32,7 +32,7 @@ xvfb-maybe electron-mocha ./test/*.js Travis에선, `.travis.yml`이 대충 다음과 같이 되어야 합니다: -``` +```yml addons: apt: packages: diff --git a/docs-translations/ko-KR/tutorial/using-native-node-modules.md b/docs-translations/ko-KR/tutorial/using-native-node-modules.md index 156319aaec4..fb503679c04 100644 --- a/docs-translations/ko-KR/tutorial/using-native-node-modules.md +++ b/docs-translations/ko-KR/tutorial/using-native-node-modules.md @@ -1,69 +1,91 @@ -# 네이티브 node 모듈 사용하기 +# 네이티브 Node 모듈 사용하기 -Electron에선 node.js 네이티브 모듈이 지원됩니다. 하지만 Electron은 공식 node.js의 -V8 엔진과는 다른 V8 버전을 사용합니다. 이러한 이유로 네이티브 모듈을 사용하기 위해선 -Electron의 V8 버전에 맞춰 네이티브 모듈을 다시 빌드하고 헤더를 변경해야 합니다. - -## 네이티브 node 모듈 호환성 - -네이티브 모듈은 node.js가 새로운 V8 버전을 사용함으로 인해 작동하지 않을 수 있습니다. -사용하는 네이티브 모듈이 Electron에 맞춰 작동할 수 있도록 하려면 Electron에서 사용하는 -node.js의 버전을 확인할 필요가 있습니다. Electron에서 사용하는 node 버전은 -[releases](https://github.com/electron/electron/releases)에서 확인할 수 있으며 -`process.version`을 출력하여 버전을 확인할 수도 있습니다. -([시작하기](./quick-start.md)의 -예시를 참고하세요) - -혹시 직접 만든 네이티브 모듈이 있다면 [NAN](https://github.com/nodejs/nan/) 모듈을 -사용하는 것을 고려해보는 것이 좋습니다. 이 모듈은 다중 버전의 node.js를 지원하기 쉽게 -만들어 줍니다. 이를 통해 오래된 모듈을 새 버전의 node.js에 맞게 포팅 할 수 있습니다. -Electron도 이 모듈을 통해 포팅된 네이티브 모듈을 사용할 수 있습니다. +Electron에선 네이티브 Node 모듈을 지원합니다. 하지만 Electron이 시스템에 설치된 +Node의 버전과 전혀 다른 V8 버전을 사용하고 있을 가능성이 높은 관계로, 네이티브 모듈을 +빌드할 때 Electron의 헤더를 수동으로 지정해 주어야 합니다. ## 네이티브 모듈을 설치하는 방법 -네이티브 모듈을 설치하는 방법은 세 가지 종류가 있습니다. +네이티브 모듈을 설치하는 방법에는 세 가지 방법이 있습니다: -### 쉬운 방법 +### `npm` 사용하기 -[`electron-rebuild`](https://github.com/paulcbetts/electron-rebuild) 패키지를 -사용하면 빠르고 간단하게 네이티브 모듈을 다시 빌드할 수 있습니다. +몇 가지 환경 변수를 설치하는 것으로, 직접적으로 `npm`을 모듈을 설치하는데 사용할 수 +있습니다. -다음 예시는 `electron-rebuild`를 통해 자동으로 모듈의 헤더를 다운로드하고 네이티브 -모듈을 빌드합니다: +다음 예시는 Electron에 대한 모든 종속성을 설치하는 예시입니다: -```sh +```bash +# Electron의 버전. +export npm_config_target=1.2.3 +# Electron의 아키텍쳐, ia32 또는 x64가 될 수 있습니다. +export npm_config_arch=x64 +# Electron에 대한 헤더 다운로드 링크. +export npm_config_disturl=https://atom.io/download/atom-shell +# node-pre-gyp에 Electron을 빌드한다는 것을 알려줍니다. +export npm_config_runtime=electron +# node-pre-gyp에 소스 코드로부터 모듈을 빌드한다는 것을 알려줍니다. +export npm_config_build_from_source=true +# 모든 종속성을 설치하고 캐시를 ~/.electron-gyp에 저장합니다. +HOME=~/.electron-gyp npm install +``` + +### 모듈을 설치하고 Electron을 위해 다시 빌드하기 + +다른 Node 프로젝트와 같이 모듈을 설치하는 것을 선택할 수도 있습니다. 그리고 +[`electron-rebuild`][electron-rebuild] 패키지와 함께 Electron에 대해 모듈을 다시 +빌드할 수 있습니다. 이 모듈은 Electron의 버전을 가져올 수 있고 헤더를 다운로드 하거나 +네이티브 모듈을 빌드하는 등의 작업을 자동으로 실행할 수 있습니다. + +다음 예시는 `electron-rebuild`을 설치하고 자동으로 모듈을 빌드하는 예시입니다: + +```bash npm install --save-dev electron-rebuild -# 필요한 네이티브 모듈을 `npm install`로 설치한 후 다음 명령을 실행하세요: +# "npm install"을 실행할 때마다 다음 명령을 실행하세요: ./node_modules/.bin/electron-rebuild # Windows에서 문제가 발생하면 다음 명령을 대신 실행하세요: .\node_modules\.bin\electron-rebuild.cmd ``` -### `npm`을 이용한 방법 +**역자주:** `npm script`의 `postinstall`을 사용하면 이 작업을 자동화 할 수 있습니다. -또한 `npm`을 통해 설치할 수도 있습니다. -환경변수가 필요한 것을 제외하고 일반 Node 모듈을 설치하는 방법과 완전히 똑같습니다: +### Electron을 위해 직접적으로 빌드하기 + +현재 본인이 네이티브 모듈을 개발하고 있는 개발자이고 Electron에 대해 실험하고 싶다면, +직접적으로 모듈을 Electron에 대해 다시 빌드하고 싶을 것입니다. `node-gyp`를 통해 +직접적으로 Electron에 대해 빌드할 수 있습니다. ```bash -export npm_config_disturl=https://atom.io/download/atom-shell -export npm_config_target=0.33.1 -export npm_config_arch=x64 -export npm_config_runtime=electron -HOME=~/.electron-gyp npm install module-name -``` - -### `node-gyp`를 이용한 방법 - -Node 모듈을 `node-gyp`를 사용하여 Electron을 타겟으로 빌드할 때는 `node-gyp`에 헤더 -다운로드 주소와 버전을 알려주어야 합니다: - -```bash -$ cd /path-to-module/ -$ HOME=~/.electron-gyp node-gyp rebuild --target=0.29.1 --arch=x64 --dist-url=https://atom.io/download/atom-shell +cd /path-to-module/ +HOME=~/.electron-gyp node-gyp rebuild --target=1.2.3 --arch=x64 --dist-url=https://atom.io/download/atom-shell ``` `HOME=~/.electron-gyp`은 변경할 헤더의 위치를 찾습니다. `--target=0.29.1`은 Electron의 버전입니다. `--dist-url=...`은 헤더를 다운로드 하는 주소입니다. `--arch=x64`는 64비트 시스템을 타겟으로 빌드 한다는 것을 `node-gyp`에게 알려줍니다. + +## 문제 해결 + +네이티브 모듈을 설치했는데 잘 작동하지 않았다면, 다음 몇 가지를 확인해봐야 합니다: + +* 모듈의 아키텍쳐가 Electron의 아키텍쳐와 일치합니다. (ia32 또는 x64) +* Electron을 업그레이드한 후, 보통은 모듈을 다시 빌드해야 합니다. +* 문제가 의심된다면, 먼저 `electron-rebuild`를 실행하세요. + +## 모듈이 `node-pre-gyp`에 의존합니다 + +[`node-pre-gyp` 툴][node-pre-gyp]은 미리 빌드된 바이너리와 함께 네이티브 Node 모듈을 +배치하는 방법을 제공하며 수 많은 유명한 모듈들이 이를 사용합니다. + +보통 이 모듈은 Electron과 함께 잘 작동하지만, Electron이 Node보다 새로운 V8 버전을 +사용할 때, 만약 ABI가 변경되었다면, 때때로 안 좋은 일이 일어납니다. 그래서 일반적으론 +언제나 네이티브 모듈의 소스 코드를 가져와서 빌드하는 것을 권장합니다. + +`npm`을 통한 방법을 따르고 있다면, 기본적으로 이 소스를 받아와서 빌드합니다. 만약 +그렇지 않다면, `npm`에 `--build-from-source`를 전달해 주어야 합니다. 아니면 +`npm_config_build_from_source`를 환경 변수에 설정하는 방법도 있습니다. + +[electron-rebuild]: https://github.com/paulcbetts/electron-rebuild +[node-pre-gyp]: https://github.com/mapbox/node-pre-gyp diff --git a/docs-translations/ko-KR/tutorial/using-pepper-flash-plugin.md b/docs-translations/ko-KR/tutorial/using-pepper-flash-plugin.md index c892d154e5a..bfe16a85cf4 100644 --- a/docs-translations/ko-KR/tutorial/using-pepper-flash-plugin.md +++ b/docs-translations/ko-KR/tutorial/using-pepper-flash-plugin.md @@ -1,7 +1,7 @@ # Pepper 플래시 플러그인 사용하기 Electron은 Pepper 플래시 플러그인을 지원합니다. Electron에서 Pepper 플래시 -플러그인을 사용하려면 Pepper 플래시 플러그인의 위치를 지정한 후 어플리케이션 내에서 +플러그인을 사용하려면 Pepper 플래시 플러그인의 위치를 지정한 후 애플리케이션 내에서 활성화 시켜야 합니다. ## 플래시 플러그인 준비하기 @@ -13,18 +13,30 @@ Electron은 Pepper 플래시 플러그인을 지원합니다. Electron에서 Pep ## Electron 스위치 추가 플러그인을 사용하려면 Electron 커맨드 라인에 `--ppapi-flash-path` 와 -`ppapi-flash-version` 플래그를 `app`의 `ready` 이벤트가 발생하기 전에 추가해야 +`--ppapi-flash-version` 플래그를 `app`의 `ready` 이벤트가 발생하기 전에 추가해야 합니다. 그리고 `browser-window`에 `plugins` 옵션을 활성화해야 합니다. +예를 들면: + ```javascript -// 플래시 플러그인의 위치를 설정합니다. -// Windows의 경우, /path/to/pepflashplayer.dll 또는 main.js에 존재하는 경우 pepflashplayer.dll -// OS X의 경우, /path/to/PepperFlashPlayer.plugin -// Linux의 경우, /path/to/libpepflashplayer.so -app.commandLine.appendSwitch('ppapi-flash-path', '/path/to/libpepflashplayer.so'); +// 플래시 플러그인의 위치를 설정합니다. main.js와 위치가 같다고 가정할 때: +let pluginName +switch (process.platform) { + case 'win32': + pluginName = 'pepflashplayer.dll' + break + case 'darwin': + pluginName = 'PepperFlashPlayer.plugin' + break + case 'linux': + pluginName = 'libpepflashplayer.so' + break +} + +app.commandLine.appendSwitch('ppapi-flash-path', path.join(__dirname, pluginName)) // 선택적인으로 플래시 플레이어의 버전을 설정합니다. 예시로는, v17.0.0.169 -app.commandLine.appendSwitch('ppapi-flash-version', '17.0.0.169'); +app.commandLine.appendSwitch('ppapi-flash-version', '17.0.0.169') app.on('ready', () => { win = new BrowserWindow({ @@ -33,12 +45,16 @@ app.on('ready', () => { webPreferences: { plugins: true } - }); - win.loadURL(`file://${__dirname}/index.html`); + }) + win.loadURL(`file://${__dirname}/index.html`) // 이외의 코드 }); ``` +직접 플러그인을 삽입하는 대신 시스템의 Pepper Flash 플러그인을 사용할 수도 있습니다. +시스템상의 플러그인의 경로는 `app.getPath('pepperFlashSystemPlugin')`로 불러올 수 +있습니다. + ## `` 태그를 이용하여 플러그인을 활성화 `plugins` 속성을 `` 태그에 추가합니다. @@ -56,3 +72,6 @@ app.on('ready', () => { Pepper 플래시 플러그인의 구조는 Electron과 일치해야 합니다. Windows에서 자주 발생하는 문제는 32비트 버전의 플래시 플레이어를 64비트 버전의 Electron에서 사용하는 것입니다. + +Windows에선 `--ppapi-flash-path`로 전달되는 경로의 분리자로 `\`를 사용해야 합니다. +POSIX-스타일 경로는 작동하지 않을 것입니다. diff --git a/docs-translations/ko-KR/tutorial/using-selenium-and-webdriver.md b/docs-translations/ko-KR/tutorial/using-selenium-and-webdriver.md index e4d333c44e0..96ed767d277 100644 --- a/docs-translations/ko-KR/tutorial/using-selenium-and-webdriver.md +++ b/docs-translations/ko-KR/tutorial/using-selenium-and-webdriver.md @@ -39,12 +39,12 @@ app.start().then(function () { }).then(function (title) { // 윈도우의 제목을 검증합니다. assert.equal(title, 'My App') -}).then(function () { - // 어플리케이션을 중지합니다. - return app.stop() }).catch(function (error) { // 테스트의 실패가 있다면 로깅합니다. console.error('Test failed', error.message) +}).then(function () { + // 애플리케이션을 중지합니다. + return app.stop() }) ``` @@ -159,11 +159,11 @@ client ## 작업 환경 -따로 Electron을 다시 빌드하지 않는 경우 간단히 어플리케이션을 Electron의 리소스 +따로 Electron을 다시 빌드하지 않는 경우 간단히 애플리케이션을 Electron의 리소스 디렉터리에 [배치](application-distribution.md)하여 바로 테스트 할 수 있습니다. -또한, Electron 바이너리의 명령줄 인수에 어플리케이션 폴더를 지정하는 방법으로 실행할 -수도 있습니다. 이 방법을 사용하면 어플리케이션 폴더를 Electron의 `resource` +또한, Electron 바이너리의 명령줄 인수에 애플리케이션 폴더를 지정하는 방법으로 실행할 +수도 있습니다. 이 방법을 사용하면 애플리케이션 폴더를 Electron의 `resource` 디렉터리로 복사하는 불필요한 과정을 생략할 수 있습니다. [chrome-driver]: https://sites.google.com/a/chromium.org/chromedriver/ diff --git a/docs-translations/ko-KR/tutorial/using-widevine-cdm-plugin.md b/docs-translations/ko-KR/tutorial/using-widevine-cdm-plugin.md index 6031857efea..3be7f70a8c2 100644 --- a/docs-translations/ko-KR/tutorial/using-widevine-cdm-plugin.md +++ b/docs-translations/ko-KR/tutorial/using-widevine-cdm-plugin.md @@ -12,21 +12,21 @@ Chrome 브라우저를 설치해야 합니다. 같습니다, 만약 그렇지 않다면 `navigator.plugins`가 로드됐더라도 정상적으로 작동하지 않습니다. -### Windows & OS X +### Windows & macOS Chrome 브라우저에서 `chrome://components/`를 열고 `WidevineCdm`을 찾은 후 확실히 최신버전인지 확인합니다. 여기까지 하면 모든 플러그인 바이너리를 `APP_DATA/Google/Chrome/WidevineCDM/VERSION/_platform_specific/PLATFORM_ARCH/` 디렉터리에서 찾을 수 있습니다. -`APP_DATA`는 어플리케이션 데이터를 저장하고 있는 시스템 경로입니다. Windows에선 -`%LOCALAPPDATA%`로 접근할 수 있고 OS X에선 `~/Library/Application Support`로 +`APP_DATA`는 애플리케이션 데이터를 저장하고 있는 시스템 경로입니다. Windows에선 +`%LOCALAPPDATA%`로 접근할 수 있고 macOS에선 `~/Library/Application Support`로 접근할 수 있습니다. `VERSION`은 `1.4.8.866` 같은 Widevine CDM 플러그인의 버전 문자열입니다. `PLATFORM`은 플랫폼을 뜻하며 `mac` 또는 `win`이 될 수 있으며 `ARCH`는 아키텍쳐를 뜻하고 `x86` 또는 `x64`가 될 수 있습니다. Windows에선 `widevinecdm.dll` 와 `widevinecdmadapter.dll` 같은 바이너리를 -요구하며 OS X에선 `libwidevinecdm.dylib`와 `widevinecdmadapter.plugin` 바이너리를 +요구하며 macOS에선 `libwidevinecdm.dylib`와 `widevinecdmadapter.plugin` 바이너리를 요구합니다. 원하는 곳에 이들을 복사해 놓을 수 있습니다. 하지만 반드시 바이너리는 같은 위치에 두어야 합니다. @@ -52,7 +52,7 @@ Linux에선 플러그인 바이너리들이 Chrome 브라우저와 함께 제공 ```javascript // `widevinecdmadapter`의 파일 이름을 이곳에 전달해야 합니다. 파일 이름은 -// * OS X에선 `widevinecdmadapter.plugin`로 지정합니다, +// * macOS에선 `widevinecdmadapter.plugin`로 지정합니다, // * Linux에선 `libwidevinecdmadapter.so`로 지정합니다, // * Windows에선 `widevinecdmadapter.dll`로 지정합니다. app.commandLine.appendSwitch('widevine-cdm-path', '/path/to/widevinecdmadapter.plugin'); diff --git a/docs-translations/ko-KR/tutorial/windows-store-guide.md b/docs-translations/ko-KR/tutorial/windows-store-guide.md index e6401b08563..1f76070d064 100644 --- a/docs-translations/ko-KR/tutorial/windows-store-guide.md +++ b/docs-translations/ko-KR/tutorial/windows-store-guide.md @@ -4,8 +4,8 @@ Windows 8부터, 오래되고 좋은 win32 실행 파일이 새로운 형제를 Windows Platform. 새로운 `.appx` 포맷은 Cortana와 푸시 알림과 같은 다수의 강력한 API뿐만 아니라, Windows Store를 통해 설치와 업데이트를 단순화합니다. -Microsoft는 개발자들이 새로운 어플리케이션 모델의 좋은 기능들을 사용할 수 있도록 -[Electron 어플리케이션을 `.appx` 패키지로 컴파일시키는 도구를 개발했습니다](http://github.com/catalystcode/electron-windows-store). +Microsoft는 개발자들이 새로운 애플리케이션 모델의 좋은 기능들을 사용할 수 있도록 +[Electron 애플리케이션을 `.appx` 패키지로 컴파일시키는 도구를 개발했습니다][electron-windows-store]. 이 가이드는 이 도구를 사용하는 방법과 Electron AppX 패키지의 호환성과 한정 사항을 설명합니다. @@ -13,28 +13,24 @@ Microsoft는 개발자들이 새로운 어플리케이션 모델의 좋은 기 Windows 10 "기념일 업데이트"는 win32 `.exe` 바이너리를 가상화된 파일 시스템과 레지스트리를 함께 실행시킬 수 있도록 만들었습니다. 두 가지 모두 실행 중인 -어플리케이션과 Windows 컨테이너 안의 인스톨러에 의해 컴파일되는 동안 만들어지며, +애플리케이션과 Windows 컨테이너 안의 인스톨러에 의해 컴파일되는 동안 만들어지며, 설치가 되는 동안 Windows가 확실하게 어떤 변경 사항이 운영 체제에 적용되는지 식별할 수 있도록 합니다. 가상 파일 시스템과 가상 레지스트리를 페어링 하는 실행 파일은 Windows가 -원-클릭으로 설치와 삭제를 할 수 있도록 만듭니다. +한 번의 클릭으로 설치와 삭제를 할 수 있도록 만듭니다. 더 나아가서, exe는 appx 모델 안에서 실행됩니다 - 이 말은 즉 Universial Windows Platform에서 제공되는 수많은 API를 사용할 수 있다는 이야기입니다. 더 많은 기능을 -사용하기 위해, Electron 어플리케이션은 숨겨진 UWP 앱과 페어링 하여 `exe`와 같이 -실행할 수 있습니다 - 이렇게 헬퍼와 비슷하게 실행되고 작업을 실행하기 위해 -백그라운드에서 작동하며, 푸시 알림을 받거나, 다른 UWP 어플리케이션과 통신하는 역할을 +사용하기 위해, Electron 애플리케이션은 백그라운드로 실행된 UWP 앱과 페어링 하여 +`exe`와 같이 실행할 수 있습니다 - 이렇게 헬퍼와 비슷하게 실행되고 작업을 실행하기 위해 +백그라운드에서 작동하며, 푸시 알림을 받거나, 다른 UWP 애플리케이션과 통신하는 역할을 합니다. -현재 존재하는 Electron 어플리케이션을 컴파일 하려면, 다음 요구 사항을 충족해야 합니다: +현재 존재하는 Electron 애플리케이션을 컴파일 하려면, 다음 요구 사항을 충족해야 합니다: -* Windows 10 기념일 업데이트 - 엔터프라이즈 에디션 (이 업데이트는 빌드 번호가 14316 - 이거나, 더 높습니다 - 2016년 5월, Windows Insiders Preview 업데이트에 포함되어 - 있습니다) -* 64 비트 (x64) 머신과 프로세서, 하드웨어-보조 가상화, 그리고 Second Level Address - Translation (SLAT) -* Windows 10 SDK, [여기서](https://developer.microsoft.com/en-us/windows/downloads/windows-10-sdk) - 다운로드할 수 있습니다. -* 최소 Node 4 버전 이상 (버전을 확인하려면 `node -v`를 실행하세요) + +* Windows 10 기념일 업데이트 (이 업데이트가 정식 배포되기 전까지 개발자는 Windows + Insider Preview를 사용할 수 있습니다) +* Windows 10 SDK, [여기서 다운로드][windows-sdk] 그리고 CLI에서 `electron-windows-store`를 설치합니다: @@ -42,29 +38,11 @@ Platform에서 제공되는 수많은 API를 사용할 수 있다는 이야기 npm install -g electron-windows-store ``` -## 설정과 준비 - -처음 CLI를 실행하기 전에, "Windows Desktop App Converter"를 먼저 설정해야 합니다. -이 작업은 약 몇 분 정도 소요됩니다. 하지만 걱정하지 않아도 됩니다 - 이 작업은 딱 한 -번만 하면 됩니다. Desktop App Converter는 [여기](https://www.microsoft.com/en-us/download/details.aspx?id=51691)에서 -다운로드받을 수 있고, `DesktopAppConverter.zip`와 `BaseImage-14316.wim` 두 파일을 -모두 받아야 합니다. - -1. `DesktopAppConverter.zip`의 압축을 풉니다. 그다음 PowerShell을 관리자 권한으로 - 실행하고 압축을 푼 위치로 이동합니다. (실행하는 모든 명령에 "관리자 권한"을 - 적용하려면 `Set-ExecutionPolicy bypass`를 실행하면 됩니다) -2. 그리고, `.\DesktopAppConverter.ps1 -Setup -BaseImage .\BaseImage-14316.wim`를 - 실행하여 Windows 베이스 이미지 (`BaseImage-14316.wim`)를 Desktop App Converter로 - 전달하고 설치를 진행합니다. -3. 만약 위 명령이 재시작을 요구하면, 기기를 재시작하고 위 명령을 다시 실행시키세요. - -설치가 완료되면, 컴파일할 Electron 어플리케이션 경로로 이동합니다. - -## Electron 어플리케이션 패키지 만들기 +## Step 1: Electron 어플리케이션 패키징 [electron-packager](https://github.com/electron-userland/electron-packager)를 -사용하여 어플리케이션을 패키징합니다. (또는 비슷한 도구를 사용합니다) 마지막으로 최종 -어플리케이션에선 `node_modules`가 필요 없으며 그저 어플리케이션의 크기를 늘릴 뿐이니 +사용하여 애플리케이션을 패키징합니다. (또는 비슷한 도구를 사용합니다) 마지막으로 최종 +애플리케이션에선 `node_modules`가 필요 없으며 그저 애플리케이션의 크기를 늘릴 뿐이니 확실하게 지웠는지 확인합니다. 출력된 파일들은 대충 다음과 같아야 합니다: @@ -98,10 +76,10 @@ npm install -g electron-windows-store └── xinput1_3.dll ``` -## 명령줄 도구 실행하기 +## `electron-windows-store` 실행하기 관리자 권한의 PowerShell ("관리자 권한으로 실행")을 실행하고, 디렉토리 입력과 출력, -어플리케이션의 이름과 버전, 마지막으로 `node_modules`를 평탄화시키는 인수들과 함께 +애플리케이션의 이름과 버전, 마지막으로 `node_modules`를 평탄화시키는 인수들과 함께 `electron-windows-store`를 실행합니다. ``` @@ -113,8 +91,8 @@ electron-windows-store ` --package-name myelectronapp ``` -명령이 실행되면, 도구는 다음과 같이 작동합니다: Electron 어플리케이션을 입력으로 받고, -`node_modules`를 평탄화하고 어플리케이션을 `app.zip`으로 압축합니다. 그리고 +명령이 실행되면, 도구는 다음과 같이 작동합니다: Electron 애플리케이션을 입력으로 받고, +`node_modules`를 평탄화하고 애플리케이션을 `app.zip`으로 압축합니다. 그리고 인스톨러와 Windows Container를 사용하여, "확장된" AppX 패키지를 만듭니다 - Windows Application Manifest (`AppXManifest.xml`)와 동시에 가상 파일 시스템과 가상 레지스트리를 포함하여 출력 폴더로 내보냅니다. @@ -124,13 +102,52 @@ Windows Application Manifest (`AppXManifest.xml`)와 동시에 가상 파일 시 도구는 새 AppX 패키지에 서명하기 위해 컴퓨터에서 신뢰된 인증서를 만드는 데 사용할 수 있습니다. 서명된 AppX 패키지로, CLI는 자동으로 기기에 패키지를 설치할 수 있습니다. -## AppX 패키지 사용하기 +## Step 3: AppX 패키지 사용하기 Windows 기념일 업데이트 (코드네임 Windows 레드스톤)가 아직 모든 일반 사용자에게 -배포되지 않았기 때문에, 올해까지는 어플리케이션을 Windows Store에 올릴 수 없을 것 +배포되지 않았기 때문에, 올해까지는 애플리케이션을 Windows Store에 올릴 수 없을 것 입니다 - 하지만 개발자 또는 회사 환경에서 `Add-AppxPackage` -[PowerShell Cmdlet을 통해](https://technet.microsoft.com/en-us/library/hh856048.aspx) -기기에 어플리케이션을 설치할 수 있습니다. +[PowerShell Cmdlet을 통해][add-appxpackage] 기기에 애플리케이션을 설치할 수 있습니다. 또 다른 중요한 제약은 컴파일된 AppX 패키지는 여전히 win32 실행 파일이 담겨있다는 -것입니다 - 따라서 Xbox, HoloLen, Phone에서 실행할 수 없습니다. +것입니다 - 따라서 Xbox, HoloLens, Phone에서 실행할 수 없습니다. + +## Optional: 백그라운드 작업을 사용하여 UWP 기능 추가 + +필요하다면 Windows 10의 모든 기능을 사용하기 위해 보이지 않는 UWP 백그라운드 작업과 +Electron 앱을 연결할 수 있습니다 - 푸시 알림, 코타나 통합, 라이브 타일등. + +Electron 앱이 토스트 알림이나 라이브 타일을 사용할 수 있도록 하는 방법을 알아보려면 +[Microsoft가 제공하는 샘플을 참고하세요][background-task]. + +## Optional: 컨테이너 가상화를 사용하여 변환 + +AppX 패키지를 만드려면, `electron-windows-store` CLI를 통해 대부분의 Electron 앱을 +그대로 변환할 수 있습니다. 하지만, 커스텀 인스톨러를 사용하고 있거나, 패키지를 +생성하는데 어떠한 문제라도 겪고있다면, Windows Container를 사용하여 패키지를 생성하는 +시도를 해볼 수 있습니다 - 이 모드를 사용하면, CLI가 어플리케이션이 정확하게 운영체제에 +대해 수행하는 작업이 어떤 변경 사항을 만드는지를 결정하기 위해 어플리케이션을 빈 Windows +Container에서 설치하고 실행할 것입니다. + +처음 CLI를 실행하기 전에, "Windows Desktop App Converter"를 먼저 설정해야 합니다. +이 작업은 약 몇 분 정도 소요됩니다. 하지만 걱정하지 않아도 됩니다 - 이 작업은 딱 한 +번만 하면 됩니다. Desktop App Converter는 [여기][app-converter]에서 다운로드 받을 +수 있고, `DesktopAppConverter.zip`와 `BaseImage-14316.wim` 두 파일을 모두 받아야 +합니다. + +1. `DesktopAppConverter.zip`의 압축을 풉니다. 그다음 PowerShell을 관리자 권한으로 + 실행하고 압축을 푼 위치로 이동합니다. (실행하는 모든 명령에 "관리자 권한"을 + 적용하려면 `Set-ExecutionPolicy bypass`를 실행하면 됩니다) +2. 그리고, `.\DesktopAppConverter.ps1 -Setup -BaseImage .\BaseImage-14316.wim`를 + 실행하여 Windows 베이스 이미지 (`BaseImage-14316.wim`)를 Desktop App Converter로 + 전달하고 설치를 진행합니다. +3. 만약 위 명령이 재시작을 요구하면, 기기를 재시작하고 위 명령을 다시 실행시키세요. + +설치가 완료되면, 컴파일할 Electron 애플리케이션 경로로 이동합니다. + +[windows-sdk]: https://developer.microsoft.com/en-us/windows/downloads/windows-10-sdk +[app-converter]: https://www.microsoft.com/en-us/download/details.aspx?id=51691 +[add-appxpackage]: https://technet.microsoft.com/en-us/library/hh856048.aspx +[electron-packager]: https://github.com/electron-userland/electron-packager +[electron-windows-store]: https://github.com/catalystcode/electron-windows-store +[background-task]: https://github.com/felixrieseberg/electron-uwp-background diff --git a/docs-translations/pt-BR/api/accelerator.md b/docs-translations/pt-BR/api/accelerator.md index 92d70c844e8..7d4df4c79da 100644 --- a/docs-translations/pt-BR/api/accelerator.md +++ b/docs-translations/pt-BR/api/accelerator.md @@ -11,11 +11,11 @@ Exemplos: ## Aviso sobre plataformas No Linux e no Windows a tecla `Command` não tem nenhum efeito, -então use `CommandOrControl` que representa a tecla `Command` existente no OS X e +então use `CommandOrControl` que representa a tecla `Command` existente no macOS e `Control` no Linux e no Windows para definir aceleradores (atalhos). A chave `Super` está mapeada para a tecla `Windows` para Windows e Linux, -e para a tecla `Cmd` para OS X. +e para a tecla `Cmd` para macOS. ## Modificadores disponíveis diff --git a/docs-translations/pt-BR/api/app.md b/docs-translations/pt-BR/api/app.md index 85cfaade585..c18a803439a 100644 --- a/docs-translations/pt-BR/api/app.md +++ b/docs-translations/pt-BR/api/app.md @@ -18,7 +18,7 @@ O objeto `app` emite os seguintes eventos: ### Evento: 'will-finish-launching' Emitido quando o aplicativo finaliza a inicialização básica. No Windows e no Linux, -o evento `will-finish-launching` é o mesmo que o evento `ready`; No OS X, +o evento `will-finish-launching` é o mesmo que o evento `ready`; No macOS, esse evento representa a notificação `applicationWillFinishLaunching` do `NSApplication`. Normalmente aqui seriam criados *listeners* para os eventos `open-file` e `open-url`, e inicializar o *crash reporter* e atualizador automático. @@ -65,7 +65,7 @@ evento `will-quit` e `window-all-closed`. Emitido quando o aplicativo está finalizando. -### Evento: 'open-file' _OS X_ +### Evento: 'open-file' _macOS_ Retorna: @@ -85,7 +85,7 @@ Você deve chamar `event.preventDefault()` se quiser cuidar deste caso. No Windows, você deve fazer o *parse* do `process.argv` para pegar o endereço do arquivo. -### Evento: 'open-url' _OS X_ +### Evento: 'open-url' _macOS_ Retorna: @@ -97,7 +97,7 @@ ser registrado para ser aberto pelo seu aplicativo. Você deve chamar `event.preventDefault()` se quiser cuidar deste caso. -### Evento: 'activate' _OS X_ +### Evento: 'activate' _macOS_ Retorna: @@ -266,7 +266,7 @@ Você pode requisitar os seguintes endereços pelo nome: * `appData` Diretório de dados do aplicativo por usuário, que por padrão aponta para: * `%APPDATA%` no Windows * `$XDG_CONFIG_HOME` ou `~/.config` no Linux - * `~/Library/Application Support` no OS X + * `~/Library/Application Support` no macOS * `userData` O diretório para guardar os arquivos de configuração do seu aplicativo, que por padrão é o diretório `appData` concatenado com o nome do seu aplicativo. * `temp` Diretório temporário. * `exe` O arquivo executável atual. @@ -312,16 +312,16 @@ seu aplicativo, e que será preferido ao `name` pelo Electron. Retorna a localidade atual do aplicativo. -### `app.addRecentDocument(path)` _OS X_ _Windows_ +### `app.addRecentDocument(path)` _macOS_ _Windows_ * `path` String Adiciona `path` à lista de documentos recentes. Esta lista é gerenciada pelo S.O.. No Windows você pode visitar a lista pela -barra de tarefas, e no OS X você pode visita-la pelo *dock*. +barra de tarefas, e no macOS você pode visita-la pelo *dock*. -### `app.clearRecentDocuments()` _OS X_ _Windows_ +### `app.clearRecentDocuments()` _macOS_ _Windows_ Limpa a lista de documentos recentes. @@ -361,7 +361,7 @@ Normalmente aplicativos respondem à isso não minimizando sua janela primária Este método retorna `false` caso seu processo seja a instância primária do aplicativo e seu aplicativo deve continuar carregando. E retorna `true` caso seu processo tenha enviado seus parâmetros para outra instância, e você deve imediatamente finalizar. -No OS X o sistema enforça instância única automaticamente quando usuários tentam abrir uma segunda instância do seu aplicativo no *Finder*, e os eventos `open-file` e `open-url` serão emitidos para isso. Entretanto, quando usuários inicializam seu aplicativo na linha de comando, o mecanismo de instância única do sistema será ignorado e você terá de utilizar esse método para assegurar-se de ter uma instância única. +No macOS o sistema enforça instância única automaticamente quando usuários tentam abrir uma segunda instância do seu aplicativo no *Finder*, e os eventos `open-file` e `open-url` serão emitidos para isso. Entretanto, quando usuários inicializam seu aplicativo na linha de comando, o mecanismo de instância única do sistema será ignorado e você terá de utilizar esse método para assegurar-se de ter uma instância única. Um exemplo de ativação da janela de primeira instância quando uma segunda instância inicializa: @@ -405,7 +405,7 @@ Adiciona um argumento à linha de comando do Chromium. O argumento será passado **Nota:** Isto não irá afetar `process.argv`. -### `app.dock.bounce([type])` _OS X_ +### `app.dock.bounce([type])` _macOS_ * `type` String (opcional) - Pode ser `critical` ou `informational`. O padrão é `informational` @@ -417,31 +417,31 @@ Entretanto, a requisição se mantém ativa até que o aplicativo se torne ativo Retorna um ID representando a requisição. -### `app.dock.cancelBounce(id)` _OS X_ +### `app.dock.cancelBounce(id)` _macOS_ * `id` Integer Cancela o salto do `id`. -### `app.dock.setBadge(text)` _OS X_ +### `app.dock.setBadge(text)` _macOS_ * `text` String Define a string a ser exibida na área de *badging* do *dock*. -### `app.dock.getBadge()` _OS X_ +### `app.dock.getBadge()` _macOS_ Retorna a string da *badge* do *dock*. -### `app.dock.hide()` _OS X_ +### `app.dock.hide()` _macOS_ Esconde o ícone do *dock*. -### `app.dock.show()` _OS X_ +### `app.dock.show()` _macOS_ Exibe o ícone do *dock*. -### `app.dock.setMenu(menu)` _OS X_ +### `app.dock.setMenu(menu)` _macOS_ * `menu` Menu diff --git a/docs-translations/pt-BR/api/auto-updater.md b/docs-translations/pt-BR/api/auto-updater.md index 27c3ef3c074..f7c49db8ff5 100644 --- a/docs-translations/pt-BR/api/auto-updater.md +++ b/docs-translations/pt-BR/api/auto-updater.md @@ -6,9 +6,9 @@ Este módulo oferece uma interface para o framework de atualização automática Embora o `autoUpdater` ofereça uma API uniforme para diferentes plataformas, existem diferenças sutis em cada plataforma. -### OS X +### macOS -No OS X, o módulo `autoUpdater` é construído sobre o [Squirrel.Mac][squirrel-mac], o que significa que você não precisa de nenhuma configuração especial para fazê-lo funcionar. Para requerimentos de servidor, você pode ler [Server Support][server-support]. +No macOS, o módulo `autoUpdater` é construído sobre o [Squirrel.Mac][squirrel-mac], o que significa que você não precisa de nenhuma configuração especial para fazê-lo funcionar. Para requerimentos de servidor, você pode ler [Server Support][server-support]. ### Windows @@ -16,7 +16,7 @@ No Windows, você deve instalar seu aplicativo na máquina de um usuário antes O instalador gerado com Squirrel irá criar um ícone de atalho com um [Application User Model ID][app-user-model-id] no formato `com.squirrel.PACKAGE_ID.YOUR_EXE_WITHOUT_DOT_EXE`, por exemplo: `com.squirrel.slack.Slack` e `com.squirrel.code.Code`. Você precisa usar o mesmo ID para seu aplicativo a API `app.setAppUserModelId`, senão o Windows não conseguirá fixar seu aplicativo corretamente na barra de tarefas. -A configuração do servidor também é diferente do OS X. Você pode ler a documentação do [Squirrel.Windows][squirrel-windows] para mais detalhes. +A configuração do servidor também é diferente do macOS. Você pode ler a documentação do [Squirrel.Windows][squirrel-windows] para mais detalhes. ### Linux diff --git a/docs-translations/pt-BR/api/browser-window.md b/docs-translations/pt-BR/api/browser-window.md index 5ebfa663772..4360296ffe6 100644 --- a/docs-translations/pt-BR/api/browser-window.md +++ b/docs-translations/pt-BR/api/browser-window.md @@ -38,7 +38,7 @@ Ela cria uma nova `BrowserWindow` com propriedades nativas definidas pelo `optio * `maxHeight` Integer - Altura máxima da janela. O padrão é sem limites. * `resizable` Boolean - Se é possível modificar o tamanho da janela. O padrão é `true`. * `alwaysOnTop` Boolean - Se a janela deve sempre ficar à frente de outras janelas. O padrão é `false`. -* `fullscreen` Boolean - Se a janela deve estar em tela cheia. Quando definido como `false`, o botão de tela cheia estará escondido ou desabilitado no OS X. O padrão é `false`. +* `fullscreen` Boolean - Se a janela deve estar em tela cheia. Quando definido como `false`, o botão de tela cheia estará escondido ou desabilitado no macOS. O padrão é `false`. * `skipTaskbar` Boolean - Se deve mostrar a janela na barra de tarefas. O padrão é `false`. * `kiosk` Boolean - Modo *kiosk*. O padrão é `false`. * `title` String - Título padrão da janela. O padrão é `"Electron"`. @@ -55,8 +55,8 @@ Ela cria uma nova `BrowserWindow` com propriedades nativas definidas pelo `optio * `type` String - Define o tipo da janela, que aplica propriedades adicionais específicas da plataforma. Por padrão é indefinido e será criada uma janela de aplicativo comum. Possíveis valores: * No Linux, os tipos possíveis são `desktop`, `dock`, `toolbar`, `splash`, `notification`. - * No OS X, os tipos possíveis são `desktop`, `textured`. O tipo `textured` adiciona a aparência degradê metálica (`NSTexturedBackgroundWindowMask`). O tipo `desktop` coloca a janela no nível do fundo de tela do desktop (`kCGDesktopWindowLevel - 1`). Note que a janela `desktop` não irá receber foco, eventos de teclado ou mouse, mas você pode usar `globalShortcut` para receber entrada de dados ocasionalmente. -* `titleBarStyle` String, OS X - Define o estilo da barra de título da janela. Esta opção está suportada a partir da versão OS X 10.10 Yosemite. Há três possíveis valores: + * No macOS, os tipos possíveis são `desktop`, `textured`. O tipo `textured` adiciona a aparência degradê metálica (`NSTexturedBackgroundWindowMask`). O tipo `desktop` coloca a janela no nível do fundo de tela do desktop (`kCGDesktopWindowLevel - 1`). Note que a janela `desktop` não irá receber foco, eventos de teclado ou mouse, mas você pode usar `globalShortcut` para receber entrada de dados ocasionalmente. +* `titleBarStyle` String, macOS - Define o estilo da barra de título da janela. Esta opção está suportada a partir da versão macOS 10.10 Yosemite. Há três possíveis valores: * `default` ou não definido, resulta na barra de título cinza opaca padrão do Mac. * `hidden` resulta numa barra de título oculta e a janela de conteúdo no tamanho máximo, porém a barra de título ainda possui os controles padrões de janela ("semáforo") no canto superior esquerdo. * `hidden-inset` resulta numa barra de título oculta com uma aparência alternativa onde os botões de semáforo estão ligeiramente mais longe do canto da janela. @@ -165,9 +165,9 @@ Emitido quando o tamanho da janela está sendo alterado. Emitido quando está sendo movida para uma nova posição. -__Note__: No OS X este evento é apenas um apelido de `moved`. +__Note__: No macOS este evento é apenas um apelido de `moved`. -### Evento: 'moved' _OS X_ +### Evento: 'moved' _macOS_ Emitido uma vez quando a janela é movida para uma nova posição. @@ -331,7 +331,7 @@ Define se a janela deve estar em modo tela cheia. Retorna um boolean, indicando se a janela está em modo tela cheia. -### `win.setAspectRatio(aspectRatio[, extraSize])` _OS X_ +### `win.setAspectRatio(aspectRatio[, extraSize])` _macOS_ * `aspectRatio` A proporção que queremos manter para uma porção do conteúdo da *view*. * `extraSize` Object (opcional) - O tamanho extra não incluído enquanto a proporção é mantida. Propriedades: @@ -493,23 +493,23 @@ Desengancha a mensagem de janela. Desengancha todas as mensagens de janela. -### `win.setRepresentedFilename(filename)` _OS X_ +### `win.setRepresentedFilename(filename)` _macOS_ * `filename` String Define o endereço do arquivo que a janela representa, e o ícone do arquivo será exibido na barra de título da janela. -### `win.getRepresentedFilename()` _OS X_ +### `win.getRepresentedFilename()` _macOS_ Retorna o endereço do arquivo que a janela representa. -### `win.setDocumentEdited(edited)` _OS X_ +### `win.setDocumentEdited(edited)` _macOS_ * `edited` Boolean Define se o documento da janela foi editado, e o ícone na barra de título se torna cinza quando definido como `true`. -### `win.isDocumentEdited()` _OS X_ +### `win.isDocumentEdited()` _macOS_ Retorna um boolean indicando se o documento da janela foi editado. @@ -581,7 +581,7 @@ Adiciona uma barra de ferramentes miniatura com um conjunto de botões específi O número de botões na barra de ferramentas miniatura não deve ser maior que 7 devido ao espaço limitado. Uma vez que você define a barra de ferramentas miniatura, ela não pode ser removida por causa da limitação da plataforma. Mas você pode chamar a API com um array vazio para limpar todos os botões. -### `win.showDefinitionForSelection()` _OS X_ +### `win.showDefinitionForSelection()` _macOS_ Mostra um dicionário *pop-up* que procura a palavra selecionada na página. diff --git a/docs-translations/pt-BR/api/process.md b/docs-translations/pt-BR/api/process.md index 71502de80d6..814c4c15e31 100644 --- a/docs-translations/pt-BR/api/process.md +++ b/docs-translations/pt-BR/api/process.md @@ -40,7 +40,7 @@ O objeto `process` tem os seguintes métodos: Faz com que o *thread* principal do processo congele. -### `process.setFdLimit(maxDescriptors)` _OS X_ _Linux_ +### `process.setFdLimit(maxDescriptors)` _macOS_ _Linux_ * `maxDescriptors` Integer diff --git a/docs-translations/pt-BR/styleguide.md b/docs-translations/pt-BR/styleguide.md index 817fa3c81e3..40a3a8a7f10 100644 --- a/docs-translations/pt-BR/styleguide.md +++ b/docs-translations/pt-BR/styleguide.md @@ -23,7 +23,7 @@ Estas são as formas que escrevemos a documentação do Electron. - Argumentos opcionais são indicados quando chamado na lista. - Comprimento da linha é de 80 caracteres com colunas quebradas. - Métodos específicos para uma plataforma são postos em itálico seguindo o cabeçalho do método. - - ```### `method(foo, bar)` _OS X_``` + - ```### `method(foo, bar)` _macOS_``` ## Lendo a documentação do Electron diff --git a/docs-translations/pt-BR/tutorial/application-distribution.md b/docs-translations/pt-BR/tutorial/application-distribution.md index f5a87d532c5..3bff230dae9 100644 --- a/docs-translations/pt-BR/tutorial/application-distribution.md +++ b/docs-translations/pt-BR/tutorial/application-distribution.md @@ -63,7 +63,7 @@ antes de distribuí-lo aos usuários. Você pode renomear `electron.exe` para o nome que desejar e editar o seu ícone e outras informações com ferramentas como [rcedit](https://github.com/atom/rcedit). -### OS X +### macOS Você pode renomear `Electron.app` para o nome que desejar e também pode mudar o nome do `CFBundleDisplayName`, `CFBundleIdentifier` e os campos em `CFBundleName` diff --git a/docs-translations/pt-BR/tutorial/desktop-environment-integration.md b/docs-translations/pt-BR/tutorial/desktop-environment-integration.md index 20a78d32d53..bf1e35969b2 100644 --- a/docs-translations/pt-BR/tutorial/desktop-environment-integration.md +++ b/docs-translations/pt-BR/tutorial/desktop-environment-integration.md @@ -8,9 +8,9 @@ menu customizado na dock. Este guia explica como integrar suas aplicações no ambiente desktop com a API do Electron. -## Documentos Recentes (Windows & OS X) +## Documentos Recentes (Windows & macOS) -O Windows e o OS X disponibilizam um acesso fácil para a lista de arquivos +O Windows e o macOS disponibilizam um acesso fácil para a lista de arquivos abertos recentemente pela aplicação através do JumpList ou Dock Menu respectivamente. __JumpList:__ @@ -48,14 +48,14 @@ Quando um usuário clica em um arquivo na JumpList, uma nova instância da sua a deve ser iniciada com o caminho do arquivo adicionado como um argumento de linha de comando. -### Notas para OS X +### Notas para macOS Quando um arquivo for requisitado pelo menu de documentos recentes, o evento `open-file` do módulo `app` irá ser emitido. -## Dock Menu customizado (OS X) +## Dock Menu customizado (macOS) -OS X permite que desenvolvedores especifiquem um menu customizado para a dock, +macOS permite que desenvolvedores especifiquem um menu customizado para a dock, que normalmente contém alguns atalhos para as funcionalidades mais utilizadas da sua aplicação. @@ -64,7 +64,7 @@ __Dock menu do Terminal.app:__ Para criar seu Dock Menu customizado, você pode usar a API `app.dock.setMenu`, -ela está disponível apenas no OS X: +ela está disponível apenas no macOS: ```javascript var app = require('app'); @@ -106,7 +106,7 @@ __Tarefas do Internet Explorer:__ ![IE](http://i.msdn.microsoft.com/dynimg/IC420539.png) -Ao contrário do Menu Dock no OS X que é um verdadeiro menu, tarefas do usuário no Windows +Ao contrário do Menu Dock no macOS que é um verdadeiro menu, tarefas do usuário no Windows funcionam como atalhos, de uma forma que quando o usuário clica em uma tarefa, um programa deve ser executado com os argumentos especificados. @@ -226,9 +226,9 @@ var window = new BrowserWindow({...}); window.setProgressBar(0.5); ``` -## Representação do arquivo na janela (OS X) +## Representação do arquivo na janela (macOS) -No OS X, uma janela pode possuir a representação de um arquivo na barra de título, +No macOS, uma janela pode possuir a representação de um arquivo na barra de título, permitindo que ao usuário acionar um Command-Click ou Control-Click sobre o título da janela, uma pop-up de navegação entre arquivos é exibida. diff --git a/docs-translations/pt-BR/tutorial/quick-start.md b/docs-translations/pt-BR/tutorial/quick-start.md index 6a21123ecf6..ad28b4f9210 100644 --- a/docs-translations/pt-BR/tutorial/quick-start.md +++ b/docs-translations/pt-BR/tutorial/quick-start.md @@ -88,7 +88,7 @@ var mainWindow = null; // Sair quando todas as janelas estiverem fechadas. app.on('window-all-closed', function() { - // No OS X é comum para as aplicações na barra de menu + // No macOS é comum para as aplicações na barra de menu // continuarem ativas até que o usuário saia explicitamente // com Cmd + Q if (process.platform != 'darwin') { @@ -173,7 +173,7 @@ $ .\electron\electron.exe seu-app\ $ ./electron/electron seu-app/ ``` -#### OS X +#### macOS ```bash $ ./Electron.app/Contents/MacOS/Electron seu-app/ diff --git a/docs-translations/pt-BR/tutorial/supported-platforms.md b/docs-translations/pt-BR/tutorial/supported-platforms.md index 0fc42179bb9..1db405257da 100644 --- a/docs-translations/pt-BR/tutorial/supported-platforms.md +++ b/docs-translations/pt-BR/tutorial/supported-platforms.md @@ -2,9 +2,9 @@ As plataformas suportadas por Electron são: -### OS X +### macOS -Somente binarios em 64bit são construidos para OS X e a versão mínima suportada é OS X 10.9. +Somente binarios em 64bit são construidos para macOS e a versão mínima suportada é macOS 10.9. ### Windows Suporte para Windows 7 ou superior, versões anteriores não são suportados (e não ira funcionar) diff --git a/docs-translations/pt-BR/tutorial/using-pepper-flash-plugin.md b/docs-translations/pt-BR/tutorial/using-pepper-flash-plugin.md index 7ffba7cc336..2f87b067d66 100644 --- a/docs-translations/pt-BR/tutorial/using-pepper-flash-plugin.md +++ b/docs-translations/pt-BR/tutorial/using-pepper-flash-plugin.md @@ -6,7 +6,7 @@ habilitado em sua aplicação. ## Prepare uma cópia do plugin Flash -Tanto no OS X como no Linux, os detalhes do plugin Pepper Flash podem ser +Tanto no macOS como no Linux, os detalhes do plugin Pepper Flash podem ser encontrados navegando por `chrome://plugins` no navegador Chrome. Essa localização e versão são úteis para o suporte do plugin Electron's Pepper Flash. Você pode também copiar para outra localização. @@ -36,7 +36,7 @@ app.on('window-all-closed', function() { // Epecifica o caminho do flash. // No Windows, deve ser /path/to/pepflashplayer.dll -// No OS X, /path/to/PepperFlashPlayer.plugin +// No macOS, /path/to/PepperFlashPlayer.plugin // No Linux, /path/to/libpepflashplayer.so app.commandLine.appendSwitch('ppapi-flash-path', '/path/to/libpepflashplayer.so'); diff --git a/docs-translations/ru-RU/README.md b/docs-translations/ru-RU/README.md index d2e9d532246..5a358eac9f6 100644 --- a/docs-translations/ru-RU/README.md +++ b/docs-translations/ru-RU/README.md @@ -75,7 +75,7 @@ * [Структура папок с исходным кодом](development/source-code-directory-structure.md) * [Technical Differences to NW.js (formerly node-webkit)](development/atom-shell-vs-node-webkit.md) * [Обзор системы сборки](development/build-system-overview.md) -* [Инструкции по сборке (OS X)](development/build-instructions-osx.md) +* [Инструкции по сборке (macOS)](development/build-instructions-osx.md) * [Инструкции по сборке (Windows)](development/build-instructions-windows.md) * [Инструкции по сборке (Linux)](development/build-instructions-linux.md) * [Настройка сервера символов для отладчика](development/setting-up-symbol-server.md) diff --git a/docs-translations/ru-RU/tutorial/application-distribution.md b/docs-translations/ru-RU/tutorial/application-distribution.md index 5ed04b5e767..7659523caed 100644 --- a/docs-translations/ru-RU/tutorial/application-distribution.md +++ b/docs-translations/ru-RU/tutorial/application-distribution.md @@ -1,11 +1,11 @@ # Распространение приложения Чтобы разпространять ваше приложение на Electron, папка с вашим приложением -должна называться `app` и находиться в папке ресурсов Electron (в OS X это +должна называться `app` и находиться в папке ресурсов Electron (в macOS это `Electron.app/Contents/Resources/`, в Linux и Windows - `resources/`), вот так: -Для OS X: +Для macOS: ```text electron/Electron.app/Contents/Resources/app/ @@ -38,7 +38,7 @@ electron/resources/app после чего Electron попробует считать ресурсы и запустить архив. -Для OS X: +Для macOS: ```text electron/Electron.app/Contents/Resources/ @@ -64,7 +64,7 @@ electron/resources/ Вы можете переименовать `electron.exe` как пожелаете и поменять иконку и прочую информацию приложениями вроде [rcedit](https://github.com/atom/rcedit). -### OS X +### macOS Вы можете переименовать `Electron.app` как пожелаете, а также изменить поля `CFBundleDisplayName`, `CFBundleIdentifier` и `CFBundleName` в следующих diff --git a/docs-translations/ru-RU/tutorial/mac-app-store-submission-guide.md b/docs-translations/ru-RU/tutorial/mac-app-store-submission-guide.md index 598f3233728..6b711e55cbc 100644 --- a/docs-translations/ru-RU/tutorial/mac-app-store-submission-guide.md +++ b/docs-translations/ru-RU/tutorial/mac-app-store-submission-guide.md @@ -85,7 +85,7 @@ productbuild --component "$APP_PATH" /Applications --sign "$INSTALLER_KEY" "$RESULT_PATH" ``` -Если вы только начали разрабатывать под Mac OS X, то мы советуем Вам прочитать [App SandBox](https://developer.apple.com/library/ios/documentation/Miscellaneous/Reference/EntitlementKeyReference/Chapters/EnablingAppSandbox.html "Ссылка для новичков в разработке приложений для Mac OS X") +Если вы только начали разрабатывать под macOS, то мы советуем Вам прочитать [App SandBox](https://developer.apple.com/library/ios/documentation/Miscellaneous/Reference/EntitlementKeyReference/Chapters/EnablingAppSandbox.html "Ссылка для новичков в разработке приложений для macOS") ## Обновление приложения diff --git a/docs-translations/ru-RU/tutorial/quick-start.md b/docs-translations/ru-RU/tutorial/quick-start.md index b8041b5e856..c08e6726470 100644 --- a/docs-translations/ru-RU/tutorial/quick-start.md +++ b/docs-translations/ru-RU/tutorial/quick-start.md @@ -113,7 +113,7 @@ app.on('ready', createWindow) // Выйти, если все окна закрыты app.on('window-all-closed', function () { - //На OS X приложение и его строка меню обычно остаются активными, + //На macOS приложение и его строка меню обычно остаются активными, //пока пользователь не завершит их с помощью `Cmd + Q`. if (process.platform !== 'darwin') { app.quit() @@ -121,7 +121,7 @@ app.on('window-all-closed', function () { }) app.on('activate', function () { - //На OS X приложение обычно пересоздаёт окно, когда + //На macOS приложение обычно пересоздаёт окно, когда //пользователь кликает на его иконку в доке, если не открыто //других окон. if (mainWindow === null) { @@ -192,7 +192,7 @@ $ .\electron\electron.exe your-app\ $ ./electron/electron your-app/ ``` -#### OS X +#### macOS ```bash $ ./Electron.app/Contents/MacOS/Electron your-app/ diff --git a/docs-translations/ru-RU/tutorial/supported-platforms.md b/docs-translations/ru-RU/tutorial/supported-platforms.md index 8321ddb7bec..0c929daa119 100644 --- a/docs-translations/ru-RU/tutorial/supported-platforms.md +++ b/docs-translations/ru-RU/tutorial/supported-platforms.md @@ -2,9 +2,9 @@ Следующие платформы поддерживаются Electron: -### OS X +### macOS -Поддерживает только 64-x битные OS X. Минимально поддерживаемой версией является OS X 10.9 +Поддерживает только 64-x битные macOS. Минимально поддерживаемой версией является macOS 10.9 ### Windows diff --git a/docs-translations/th-TH/README.md b/docs-translations/th-TH/README.md index 3b9f5207711..0a1863674ab 100644 --- a/docs-translations/th-TH/README.md +++ b/docs-translations/th-TH/README.md @@ -66,7 +66,7 @@ * [โครงสร้างไดเรคทอรี่ของซอร์สโค้ด](development/source-code-directory-structure.md) * [ความแตกต่างทางเทคนิคจาก NW.js (หรือ node-webkit)](development/atom-shell-vs-node-webkit.md) * [ภาพรวมการสร้างระบบ](development/build-system-overview.md) -* [ขั้นตอนการสร้าง (OS X)](development/build-instructions-osx.md) +* [ขั้นตอนการสร้าง (macOS)](development/build-instructions-osx.md) * [ขั้นตอนการสร้าง (Windows)](development/build-instructions-windows.md) * [ขั้นตอนการสร้าง (Linux)](development/build-instructions-linux.md) * [Setting Up Symbol Server in debugger](development/setting-up-symbol-server.md) diff --git a/docs-translations/tr-TR/README.md b/docs-translations/tr-TR/README.md index b055e63f5af..5717a5cea32 100644 --- a/docs-translations/tr-TR/README.md +++ b/docs-translations/tr-TR/README.md @@ -79,7 +79,7 @@ Bir problem(issue) bildirmeden önce sıkça sorulan sorulara göz atın: * [Kaynak Kod Dizin Yapısı](https://github.com/electron/electron/tree/master/docs/development/source-code-directory-structure.md) * [NW.js(node-webkit adıyla bilinen) İle Arasındaki Teknik Farklılıklar](https://github.com/electron/electron/tree/master/docs/development/atom-shell-vs-node-webkit.md) * [Build Sisyem Genel Bakış](https://github.com/electron/electron/tree/master/docs/development/build-system-overview.md) -* [(OS X) Build Komutları](https://github.com/electron/electron/tree/master/docs/development/build-instructions-osx.md) +* [(macOS) Build Komutları](https://github.com/electron/electron/tree/master/docs/development/build-instructions-osx.md) * [(Windows) Build Komutları](https://github.com/electron/electron/tree/master/docs/development/build-instructions-windows.md) * [(Linux) Build Komutları](https://github.com/electron/electron/tree/master/docs/development/build-instructions-linux.md) * [(Windows) Hata Ayıklama Komutları](https://github.com/electron/electron/tree/master/docs/development/debug-instructions-windows.md) diff --git a/docs-translations/tr-TR/api/accelerator.md b/docs-translations/tr-TR/api/accelerator.md index 9105e5c6e46..be1acfbed1c 100644 --- a/docs-translations/tr-TR/api/accelerator.md +++ b/docs-translations/tr-TR/api/accelerator.md @@ -12,10 +12,10 @@ Hızlandırıcılar `+` karakteriyle birden fazla niteleyici ile kombinlenebilir ## Platform bilgileri Linux ve Windows'ta `Command` tuşu herhangi bir etki göstermez. Bunun yerine -`CommandOrControl` niteleyicisini kullanın. Bu işlem OS X'te `Command`, +`CommandOrControl` niteleyicisini kullanın. Bu işlem macOS'te `Command`, Linux ve Windows'ta `Control` tuşunun işlevini sağlar. `Alt` ise tüm platformlarda mevcuttur. -`Super` tuşu Windows ve Linux'te `Windows` tuşuna, OS X'te ise `Cmd` tuşuna eşleştirilmiştir. +`Super` tuşu Windows ve Linux'te `Windows` tuşuna, macOS'te ise `Cmd` tuşuna eşleştirilmiştir. ## Mevcut düzenleyiciler diff --git a/docs-translations/tr-TR/styleguide.md b/docs-translations/tr-TR/styleguide.md index 5e8f7524072..e9092d1d7c8 100644 --- a/docs-translations/tr-TR/styleguide.md +++ b/docs-translations/tr-TR/styleguide.md @@ -24,7 +24,7 @@ Electron Dokümantasyonunu geliştirmek için aşağıdaki yöntemleri takip edi - Optional arguments are denoted when called out in list. - Line length is 80-column wrapped. - Platform specific methods are noted in italics following method header. - - ```### `method(foo, bar)` _OS X_``` + - ```### `method(foo, bar)` _macOS_``` - Prefer 'in the ___ process' over 'on' ### Dokümantasyon Çevirisi diff --git a/docs-translations/uk-UA/README.md b/docs-translations/uk-UA/README.md index ef503a8844a..8600bdcd773 100644 --- a/docs-translations/uk-UA/README.md +++ b/docs-translations/uk-UA/README.md @@ -77,7 +77,7 @@ * [Source Code Directory Structure](development/source-code-directory-structure.md) * [Technical Differences to NW.js (formerly node-webkit)](development/atom-shell-vs-node-webkit.md) * [Build System Overview](development/build-system-overview.md) -* [Build Instructions (OS X)](development/build-instructions-osx.md) +* [Build Instructions (macOS)](development/build-instructions-osx.md) * [Build Instructions (Windows)](development/build-instructions-windows.md) * [Build Instructions (Linux)](development/build-instructions-linux.md) * [Setting Up Symbol Server in debugger](development/setting-up-symbol-server.md) diff --git a/docs-translations/uk-UA/styleguide.md b/docs-translations/uk-UA/styleguide.md index 2a5907ec4ea..94c70e5ce25 100644 --- a/docs-translations/uk-UA/styleguide.md +++ b/docs-translations/uk-UA/styleguide.md @@ -24,7 +24,7 @@ or [writing Electron documentation](#writing-electron-documentation). - Optional arguments are denoted when called out in list. - Line length is 80-column wrapped. - Platform specific methods are noted in italics following method header. - - ```### `method(foo, bar)` _OS X_``` + - ```### `method(foo, bar)` _macOS_``` - Prefer 'in the ___ process' over 'on' ### Переклад документації diff --git a/docs-translations/zh-CN/README.md b/docs-translations/zh-CN/README.md index 58293e38470..d3948c2bd2b 100644 --- a/docs-translations/zh-CN/README.md +++ b/docs-translations/zh-CN/README.md @@ -73,7 +73,7 @@ * [源码目录结构](development/source-code-directory-structure.md) * [与 NW.js(原 node-webkit)在技术上的差异](development/atom-shell-vs-node-webkit.md) * [构建系统概览](development/build-system-overview.md) -* [构建步骤(OS X)](development/build-instructions-osx.md) +* [构建步骤(macOS)](development/build-instructions-osx.md) * [构建步骤(Windows)](development/build-instructions-windows.md) * [构建步骤(Linux)](development/build-instructions-linux.md) * [在调试中使用 Symbol Server](development/setting-up-symbol-server.md) diff --git a/docs-translations/zh-CN/api/accelerator.md b/docs-translations/zh-CN/api/accelerator.md index 06e7397c849..0b1e2cd3f4d 100644 --- a/docs-translations/zh-CN/api/accelerator.md +++ b/docs-translations/zh-CN/api/accelerator.md @@ -9,10 +9,10 @@ ## 运行平台相关的提示 -在 Linux 和 Windows 上,`Command` 键并不存在,因此我们通常用 `CommandOrControl` 来表示“在 OS X 下为 `Command` 键,但在 +在 Linux 和 Windows 上,`Command` 键并不存在,因此我们通常用 `CommandOrControl` 来表示“在 macOS 下为 `Command` 键,但在 Linux 和 Windows 下为 `Control` 键。 -`Super` 键是指 Linux 和 Windows 上的 `Windows` 键,但是在 OS X 下为 `Command` 键。 +`Super` 键是指 Linux 和 Windows 上的 `Windows` 键,但是在 macOS 下为 `Command` 键。 ## 可用的功能按键 diff --git a/docs-translations/zh-CN/api/app.md b/docs-translations/zh-CN/api/app.md index 24cb70e8420..c2f244f4388 100644 --- a/docs-translations/zh-CN/api/app.md +++ b/docs-translations/zh-CN/api/app.md @@ -18,7 +18,7 @@ app.on('window-all-closed', function() { ### 事件:'will-finish-launching' 当应用程序完成基础的启动的时候被触发。在 Windows 和 Linux 中, -`will-finish-launching` 事件与 `ready` 事件是相同的; 在 OS X 中, +`will-finish-launching` 事件与 `ready` 事件是相同的; 在 macOS 中, 这个时间相当于 `NSApplication` 中的 `applicationWillFinishLaunching` 提示。 你应该经常在这里为 `open-file` 和 `open-url` 设置监听器,并启动崩溃报告和自动更新。 @@ -65,7 +65,7 @@ app.on('window-all-closed', function() { 当应用程序正在退出时触发。 -### 事件:'open-file' _OS X_ +### 事件:'open-file' _macOS_ 返回: @@ -79,7 +79,7 @@ app.on('window-all-closed', function() { 如果你想处理这个事件,你应该调用 `event.preventDefault()` 。 在 Windows系统中, 你需要通过解析 process.argv 来获取文件路径。 -### 事件:'open-url' _OS X_ +### 事件:'open-url' _macOS_ 返回: @@ -90,7 +90,7 @@ app.on('window-all-closed', function() { 如果你想处理这个事件,你应该调用 `event.preventDefault()` 。 -### 事件:'activate' _OS X_ +### 事件:'activate' _macOS_ 返回: @@ -225,11 +225,11 @@ app.on('login', function(event, webContents, request, authInfo, callback) { 这个方法保证了所有的 `beforeunload` 和 `unload` 事件处理器被正确执行。假如一个窗口的 `beforeunload` 事件处理器返回 `false`,那么整个应用可能会取消退出。 -### `app.hide()` _OS X_ +### `app.hide()` _macOS_ 隐藏所有的应用窗口,不是最小化. -### `app.show()` _OS X_ +### `app.show()` _macOS_ 隐藏后重新显示所有的窗口,不会自动选中他们。 @@ -257,7 +257,7 @@ app.on('login', function(event, webContents, request, authInfo, callback) { * `appData` 当前用户的应用数据文件夹,默认对应: * `%APPDATA%` Windows 中 * `$XDG_CONFIG_HOME` or `~/.config` Linux 中 - * `~/Library/Application Support` OS X 中 + * `~/Library/Application Support` macOS 中 * `userData` 储存你应用程序设置文件的文件夹,默认是 `appData` 文件夹附加应用的名称 * `temp` 临时文件夹 * `exe` 当前的可执行文件 @@ -305,15 +305,15 @@ app.on('login', function(event, webContents, request, authInfo, callback) { 返回当前应用程序的语言。 -### `app.addRecentDocument(path)` _OS X_ _Windows_ +### `app.addRecentDocument(path)` _macOS_ _Windows_ * `path` String 在最近访问的文档列表中添加 `path`。 -这个列表由操作系统进行管理。在 Windows 中您可以通过任务条进行访问,在 OS X 中你可以通过 dock 菜单进行访问。 +这个列表由操作系统进行管理。在 Windows 中您可以通过任务条进行访问,在 macOS 中你可以通过 dock 菜单进行访问。 -### `app.clearRecentDocuments()` _OS X_ _Windows_ +### `app.clearRecentDocuments()` _macOS_ _Windows_ 清除最近访问的文档列表。 @@ -358,7 +358,7 @@ app.on('login', function(event, webContents, request, authInfo, callback) { 如果当前实例为第一个实例,那么在这个方法将会返回 `false` 来保证它继续运行。否则将会返回 `true` 来让它立刻退出。 -在 OS X 中,如果用户通过 Finder、`open-file` 或者 `open-url` 打开应用,系统会强制确保只有一个实例在运行。但是如果用户是通过 +在 macOS 中,如果用户通过 Finder、`open-file` 或者 `open-url` 打开应用,系统会强制确保只有一个实例在运行。但是如果用户是通过 命令行打开,这个系统机制会被忽略,所以你仍然需要靠这个方法来保证应用为单实例运行的。 下面是一个简单的例子。我们可以通过这个例子了解如何确保应用为单实例运行状态。 @@ -432,7 +432,7 @@ if (browserOptions.transparent) { **注意** 这个方法不会影响 `process.argv`。 -### `app.dock.bounce([type])` _OS X_ +### `app.dock.bounce([type])` _macOS_ * `type` String - 可选参数,可以是 `critical` 或 `informational`。默认为 `informational`。 @@ -442,37 +442,37 @@ if (browserOptions.transparent) { 这个方法返回的返回值表示这个请求的 ID。 -### `app.dock.cancelBounce(id)` _OS X_ +### `app.dock.cancelBounce(id)` _macOS_ * `id` Integer 取消这个 `id` 对应的请求。 -### `app.dock.setBadge(text)` _OS X_ +### `app.dock.setBadge(text)` _macOS_ * `text` String 设置应用在 dock 中显示的字符串。 -### `app.dock.getBadge()` _OS X_ +### `app.dock.getBadge()` _macOS_ 返回应用在 dock 中显示的字符串。 -### `app.dock.hide()` _OS X_ +### `app.dock.hide()` _macOS_ 隐藏应用在 dock 中的图标。 -### `app.dock.show()` _OS X_ +### `app.dock.show()` _macOS_ 显示应用在 dock 中的图标。 -### `app.dock.setMenu(menu)` _OS X_ +### `app.dock.setMenu(menu)` _macOS_ * `menu` [Menu](menu.md) 设置应用的 [dock 菜单][dock-menu]. -### `app.dock.setIcon(image)` _OS X_ +### `app.dock.setIcon(image)` _macOS_ * `image` [NativeImage](native-image.md) diff --git a/docs-translations/zh-CN/api/auto-updater.md b/docs-translations/zh-CN/api/auto-updater.md index f027fbc6e50..845b4c24d9b 100644 --- a/docs-translations/zh-CN/api/auto-updater.md +++ b/docs-translations/zh-CN/api/auto-updater.md @@ -6,9 +6,9 @@ 虽然 `autoUpdater` 模块提供了一套各平台通用的接口,但是在每个平台间依然会有一些微小的差异。 -### OS X +### macOS -在 OS X 上,`autoUpdater` 模块依靠的是内置的 [Squirrel.Mac][squirrel-mac],这意味着你不需要依靠其他的设置就能使用。关于 +在 macOS 上,`autoUpdater` 模块依靠的是内置的 [Squirrel.Mac][squirrel-mac],这意味着你不需要依靠其他的设置就能使用。关于 更新服务器的配置,你可以通过阅读 [Server Support][server-support] 这篇文章来了解。 ### Windows @@ -19,7 +19,7 @@ Squirrel 自动生成的安装向导会生成一个带 [Application User Model I Application User Model ID 的格式是 `com.squirrel.PACKAGE_ID.YOUR_EXE_WITHOUT_DOT_EXE`, 比如 像 `com.squirrel.slack.Slack` 和 `com.squirrel.code.Code` 这样的。你应该在自己的应用中使用 `app.setAppUserModelId` 方法设置相同的 API,不然 Windows 将不能正确地把你的应用固定在任务栏上。 -服务器端的配置和 OS X 也是不一样的,你可以阅读 [Squirrel.Windows][squirrel-windows] 这个文档来获得详细信息。 +服务器端的配置和 macOS 也是不一样的,你可以阅读 [Squirrel.Windows][squirrel-windows] 这个文档来获得详细信息。 ### Linux diff --git a/docs-translations/zh-CN/api/browser-window.md b/docs-translations/zh-CN/api/browser-window.md index 0d720c42591..f2fe697c729 100644 --- a/docs-translations/zh-CN/api/browser-window.md +++ b/docs-translations/zh-CN/api/browser-window.md @@ -47,8 +47,8 @@ win.show(); * `maximizable` Boolean - 窗口是否可以最大化. 在 Linux 上无效. 默认为 `true`. * `closable` Boolean - 窗口是否可以关闭. 在 Linux 上无效. 默认为 `true`. * `alwaysOnTop` Boolean - 窗口是否总是显示在其他窗口之前. 在 Linux 上无效. 默认为 `false`. - * `fullscreen` Boolean - 窗口是否可以全屏幕. 当明确设置值为When `false` ,全屏化按钮将会隐藏,在 OS X 将禁用. 默认 `false`. - * `fullscreenable` Boolean - 在 OS X 上,全屏化按钮是否可用,默认为 `true`. + * `fullscreen` Boolean - 窗口是否可以全屏幕. 当明确设置值为When `false` ,全屏化按钮将会隐藏,在 macOS 将禁用. 默认 `false`. + * `fullscreenable` Boolean - 在 macOS 上,全屏化按钮是否可用,默认为 `true`. * `skipTaskbar` Boolean - 是否在任务栏中显示窗口. 默认是`false`. * `kiosk` Boolean - kiosk 方式. 默认为 `false`. * `title` String - 窗口默认title. 默认 `"Electron"`. @@ -62,7 +62,7 @@ win.show(); * `enableLargerThanScreen` Boolean - 是否允许允许改变窗口大小大于屏幕. 默认是 `false`. * `backgroundColor` String -窗口的 background color 值为十六进制,如 `#66CD00` 或 `#FFF` 或 `#80FFFFFF` (支持透明度). 默认为在 Linux 和 Windows 上为 `#000` (黑色) , Mac上为 `#FFF`(或透明). - * `hasShadow` Boolean - 窗口是否有阴影. 只在 OS X 上有效. 默认为 `true`. + * `hasShadow` Boolean - 窗口是否有阴影. 只在 macOS 上有效. 默认为 `true`. * `darkTheme` Boolean - 为窗口使用 dark 主题, 只在一些拥有 GTK+3 桌面环境上有效. 默认为 `false`. * `transparent` Boolean - 窗口 [透明](frameless-window.md). 默认为 `false`. @@ -74,13 +74,13 @@ win.show(); * Linux, 可用值为 `desktop`, `dock`, `toolbar`, `splash`, `notification`. -* OS X, 可用值为 `desktop`, `textured`. +* macOS, 可用值为 `desktop`, `textured`. * `textured` type 添加金属梯度效果 (`NSTexturedBackgroundWindowMask`). * `desktop` 设置窗口在桌面背景窗口水平 (`kCGDesktopWindowLevel - 1`). 注意桌面窗口不可聚焦, 不可不支持键盘和鼠标事件, 但是可以使用 `globalShortcut` 来解决输入问题. -`titleBarStyle` 只在 OS X 10.10 Yosemite 或更新版本上支持. +`titleBarStyle` 只在 macOS 10.10 Yosemite 或更新版本上支持. 可用值: * `default` 以及无值, 显示在 Mac 标题栏上为不透明的标准灰色. @@ -206,9 +206,9 @@ window.onbeforeunload = function(e) { 在窗口移动的时候触发. -注意:在 OS X 中别名为 `moved`. +注意:在 macOS 中别名为 `moved`. -### Event: 'moved' _OS X_ +### Event: 'moved' _macOS_ 在窗口移动的时候触发. @@ -242,11 +242,11 @@ someWindow.on('app-command', function(e, cmd) { }); ``` -### Event: 'scroll-touch-begin' _OS X_ +### Event: 'scroll-touch-begin' _macOS_ 在滚动条事件开始的时候触发. -### Event: 'scroll-touch-end' _OS X_ +### Event: 'scroll-touch-end' _macOS_ 在滚动条事件结束的时候触发. @@ -379,7 +379,7 @@ var win = new BrowserWindow({ width: 800, height: 600 }); 返回 boolean, 窗口是否全屏化. -### `win.setAspectRatio(aspectRatio[, extraSize])` _OS X_ +### `win.setAspectRatio(aspectRatio[, extraSize])` _macOS_ * `aspectRatio` 维持部分视图内容窗口的高宽比值. * `extraSize` Object (可选) - 维持高宽比值时不包含的额外size. @@ -398,7 +398,7 @@ var win = new BrowserWindow({ width: 800, height: 600 }); * `y` Integer * `width` Integer * `height` Integer -* `animate` Boolean (可选) _OS X_ +* `animate` Boolean (可选) _macOS_ 重新设置窗口的宽高值,并且移动到指定的 `x`, `y` 位置. @@ -410,7 +410,7 @@ var win = new BrowserWindow({ width: 800, height: 600 }); * `width` Integer * `height` Integer -* `animate` Boolean (可选) _OS X_ +* `animate` Boolean (可选) _macOS_ 重新设置窗口的宽高值. @@ -422,7 +422,7 @@ var win = new BrowserWindow({ width: 800, height: 600 }); * `width` Integer * `height` Integer -* `animate` Boolean (可选) _OS X_ +* `animate` Boolean (可选) _macOS_ 重新设置窗口客户端的宽高值(例如网页界面). @@ -462,33 +462,33 @@ var win = new BrowserWindow({ width: 800, height: 600 }); 返回 boolean,窗口是否可以被用户改变size. -### `win.setMovable(movable)` _OS X_ _Windows_ +### `win.setMovable(movable)` _macOS_ _Windows_ * `movable` Boolean 设置窗口是否可以被用户拖动. Linux 无效. -### `win.isMovable()` _OS X_ _Windows_ +### `win.isMovable()` _macOS_ _Windows_ 返回 boolean,窗口是否可以被用户拖动. Linux 总是返回 `true`. -### `win.setMinimizable(minimizable)` _OS X_ _Windows_ +### `win.setMinimizable(minimizable)` _macOS_ _Windows_ * `minimizable` Boolean 设置窗口是否可以最小化. Linux 无效. -### `win.isMinimizable()` _OS X_ _Windows_ +### `win.isMinimizable()` _macOS_ _Windows_ 返回 boolean,窗口是否可以最小化. Linux 总是返回 `true`. -### `win.setMaximizable(maximizable)` _OS X_ _Windows_ +### `win.setMaximizable(maximizable)` _macOS_ _Windows_ * `maximizable` Boolean 设置窗口是否可以最大化. Linux 无效. -### `win.isMaximizable()` _OS X_ _Windows_ +### `win.isMaximizable()` _macOS_ _Windows_ 返回 boolean,窗口是否可以最大化. Linux 总是返回 `true`. @@ -502,13 +502,13 @@ var win = new BrowserWindow({ width: 800, height: 600 }); 返回 boolean,点击最大化按钮是否可以全屏或最大化窗口. -### `win.setClosable(closable)` _OS X_ _Windows_ +### `win.setClosable(closable)` _macOS_ _Windows_ * `closable` Boolean 设置窗口是否可以人为关闭. Linux 无效. -### `win.isClosable()` _OS X_ _Windows_ +### `win.isClosable()` _macOS_ _Windows_ 返回 boolean,窗口是否可以人为关闭. Linux 总是返回 `true`. @@ -530,7 +530,7 @@ var win = new BrowserWindow({ width: 800, height: 600 }); * `x` Integer * `y` Integer -* `animate` Boolean (可选) _OS X_ +* `animate` Boolean (可选) _macOS_ 移动窗口到对应的 `x` and `y` 坐标. @@ -576,7 +576,7 @@ var win = new BrowserWindow({ width: 800, height: 600 }); 以 `Buffer` 形式返回这个具体平台的窗口的句柄. -windows上句柄类型为 `HWND` ,OS X `NSView*` , Linux `Window`. +windows上句柄类型为 `HWND` ,macOS `NSView*` , Linux `Window`. ### `win.hookWindowMessage(message, callback)` _Windows_ @@ -601,23 +601,23 @@ windows上句柄类型为 `HWND` ,OS X `NSView*` , Linux `Window`. 窗口消息全部不拦截. -### `win.setRepresentedFilename(filename)` _OS X_ +### `win.setRepresentedFilename(filename)` _macOS_ * `filename` String 设置窗口当前文件路径,并且将这个文件的图标放在窗口标题栏上. -### `win.getRepresentedFilename()` _OS X_ +### `win.getRepresentedFilename()` _macOS_ 获取窗口当前文件路径. -### `win.setDocumentEdited(edited)` _OS X_ +### `win.setDocumentEdited(edited)` _macOS_ * `edited` Boolean 明确指出窗口文档是否可以编辑,如果可以编辑则将标题栏的图标变成灰色. -### `win.isDocumentEdited()` _OS X_ +### `win.isDocumentEdited()` _macOS_ 返回 boolean,当前窗口文档是否可编辑. @@ -668,13 +668,13 @@ windows上句柄类型为 `HWND` ,OS X `NSView*` , Linux `Window`. 向当前任务栏添加一个 16 x 16 像素的图标,通常用来覆盖一些应用的状态,或者直接来提示用户. -### `win.setHasShadow(hasShadow)` _OS X_ +### `win.setHasShadow(hasShadow)` _macOS_ * `hasShadow` (Boolean) 设置窗口是否应该有阴影.在Windows和Linux系统无效. -### `win.hasShadow()` _OS X_ +### `win.hasShadow()` _macOS_ 返回 boolean,设置窗口是否有阴影.在Windows和Linux系统始终返回 `true`. @@ -704,7 +704,7 @@ windows上句柄类型为 `HWND` ,OS X `NSView*` , Linux `Window`. * `hidden` - button 对用户不可见. * `noninteractive` - button 可用但是不可响应; 也不显示按下的状态. 它的值意味着这是一个在通知单使用 button 的实例. -### `win.showDefinitionForSelection()` _OS X_ +### `win.showDefinitionForSelection()` _macOS_ 在界面查找选中文字时显示弹出字典. @@ -744,7 +744,7 @@ windows上句柄类型为 `HWND` ,OS X `NSView*` , Linux `Window`. **注意:** 在 windows上始终返回 false. -### `win.setIgnoreMouseEvents(ignore)` _OS X_ +### `win.setIgnoreMouseEvents(ignore)` _macOS_ * `ignore` Boolean diff --git a/docs-translations/zh-CN/api/crash-reporter.md b/docs-translations/zh-CN/api/crash-reporter.md index 6f2de5e8459..f8422bf454c 100644 --- a/docs-translations/zh-CN/api/crash-reporter.md +++ b/docs-translations/zh-CN/api/crash-reporter.md @@ -37,7 +37,7 @@ crashReporter.start({ 只可以在使用其它 `crashReporter` APIs 之前使用这个方法. -**注意:** 在 OS X, Electron 使用一个新的 `crashpad` 客户端, 与 Windows 和 Linux 的 `breakpad` 不同. 为了开启崩溃点搜集,你需要在主进程和其它每个你需要搜集崩溃报告的渲染进程中调用 `crashReporter.start` API 来初始化 `crashpad`. +**注意:** 在 macOS, Electron 使用一个新的 `crashpad` 客户端, 与 Windows 和 Linux 的 `breakpad` 不同. 为了开启崩溃点搜集,你需要在主进程和其它每个你需要搜集崩溃报告的渲染进程中调用 `crashReporter.start` API 来初始化 `crashpad`. ### `crashReporter.getLastCrashReport()` diff --git a/docs-translations/zh-CN/api/dialog.md b/docs-translations/zh-CN/api/dialog.md index 3e77eeaa2a5..dd691fa6469 100644 --- a/docs-translations/zh-CN/api/dialog.md +++ b/docs-translations/zh-CN/api/dialog.md @@ -10,7 +10,7 @@ const dialog = require('electron').dialog; console.log(dialog.showOpenDialog({ properties: [ 'openFile', 'openDirectory', 'multiSelections' ]})); ``` -**OS X 上的注意事项**: 如果你想像sheets一样展示对话框,只需要在`browserWindow` 参数中提供一个 `BrowserWindow` 的引用对象. +**macOS 上的注意事项**: 如果你想像sheets一样展示对话框,只需要在`browserWindow` 参数中提供一个 `BrowserWindow` 的引用对象. ## 方法 @@ -79,7 +79,7 @@ console.log(dialog.showOpenDialog({ properties: [ 'openFile', 'openDirectory', ' * `message` String - message box 内容. * `detail` String - 额外信息. * `icon` [NativeImage](native-image.md) - * `cancelId` Integer - 当用户关闭对话框的时候,不是通过点击对话框的button,就返回值.默认值为对应 "cancel" 或 "no" 标签button 的索引值, 或者如果没有这种button,就返回0. 在 OS X 和 Windows 上, "Cancel" button 的索引值将一直是 `cancelId`, 不管之前是不是特别指出的. + * `cancelId` Integer - 当用户关闭对话框的时候,不是通过点击对话框的button,就返回值.默认值为对应 "cancel" 或 "no" 标签button 的索引值, 或者如果没有这种button,就返回0. 在 macOS 和 Windows 上, "Cancel" button 的索引值将一直是 `cancelId`, 不管之前是不是特别指出的. * `noLink` Boolean - 在 Windows ,Electron 将尝试识别哪个button 是普通 button (如 "Cancel" 或 "Yes"), 然后再对话框中以链接命令(command links)方式展现其它的 button . 这能让对话框展示得很炫酷.如果你不喜欢这种效果,你可以设置 `noLink` 为 `true`. * `callback` Function diff --git a/docs-translations/zh-CN/api/frameless-window.md b/docs-translations/zh-CN/api/frameless-window.md index 833f070ad27..eb9a889263c 100644 --- a/docs-translations/zh-CN/api/frameless-window.md +++ b/docs-translations/zh-CN/api/frameless-window.md @@ -14,9 +14,9 @@ const BrowserWindow = require('electron').BrowserWindow; var win = new BrowserWindow({ width: 800, height: 600, frame: false }); ``` -### OS X上的替代方案 +### macOS上的替代方案 -在Mac OS X 10.10 Yosemite或者更新的版本中,有一个替代方案去生成一个无边框窗口。 +在macOS 10.10 Yosemite或者更新的版本中,有一个替代方案去生成一个无边框窗口。 不同于设置`frame`为`false`会隐藏标题栏以及失去对窗口的控制,你可能想隐藏标题栏使你的页面内容显示在整个窗口上 ,同时又想保持对窗口的控制("traffic lights")。你可以通过指定`titleBarStyle`这一新选项达到目标: diff --git a/docs-translations/zh-CN/api/menu-item.md b/docs-translations/zh-CN/api/menu-item.md index 3d5eceedcb9..6d5d59d934e 100644 --- a/docs-translations/zh-CN/api/menu-item.md +++ b/docs-translations/zh-CN/api/menu-item.md @@ -36,7 +36,7 @@ * `minimize` - 最小化当前窗口 * `close` - 关闭当前窗口 -在 OS X 上,`role` 还可以有以下值: +在 macOS 上,`role` 还可以有以下值: * `about` - 匹配 `orderFrontStandardAboutPanel` 行为 * `hide` - 匹配 `hide` 行为 diff --git a/docs-translations/zh-CN/api/menu.md b/docs-translations/zh-CN/api/menu.md index 1997a293d24..ea2535cc8b0 100644 --- a/docs-translations/zh-CN/api/menu.md +++ b/docs-translations/zh-CN/api/menu.md @@ -211,16 +211,16 @@ Menu.setApplicationMenu(menu); * `menu` Menu -在 OS X 上设置应用菜单 `menu` . +在 macOS 上设置应用菜单 `menu` . 在windows 和 linux,是为每个窗口都在其顶部设置菜单 `menu`. -### `Menu.sendActionToFirstResponder(action)` _OS X_ +### `Menu.sendActionToFirstResponder(action)` _macOS_ * `action` String 发送 `action` 给应用的第一个响应器.这个用来模仿 Cocoa 菜单的默认行为,通常你只需要使用 `MenuItem` 的属性 `role`. -查看更多 OS X 的原生 action [OS X Cocoa Event Handling Guide](https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/EventOverview/EventArchitecture/EventArchitecture.html#//apple_ref/doc/uid/10000060i-CH3-SW7) . +查看更多 macOS 的原生 action [macOS Cocoa Event Handling Guide](https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/EventOverview/EventArchitecture/EventArchitecture.html#//apple_ref/doc/uid/10000060i-CH3-SW7) . ### `Menu.buildFromTemplate(template)` @@ -239,7 +239,7 @@ Menu.setApplicationMenu(menu); * `browserWindow` BrowserWindow (可选) - 默认为 `null`. * `x` Number (可选) - 默认为 -1. * `y` Number (**必须** 如果x设置了) - 默认为 -1. -* `positioningItem` Number (可选) _OS X_ - 在指定坐标鼠标位置下面的菜单项的索引. 默认为 +* `positioningItem` Number (可选) _macOS_ - 在指定坐标鼠标位置下面的菜单项的索引. 默认为 -1. 在 `browserWindow` 中弹出 context menu .你可以选择性地提供指定的 `x, y` 来设置菜单应该放在哪里,否则它将默认地放在当前鼠标的位置. @@ -261,13 +261,13 @@ Menu.setApplicationMenu(menu); 获取一个菜单项数组. -## OS X Application 上的菜单的注意事项 +## macOS Application 上的菜单的注意事项 -相对于windows 和 linux, OS X 上的应用菜单是完全不同的style,这里是一些注意事项,来让你的菜单项更原生化. +相对于windows 和 linux, macOS 上的应用菜单是完全不同的style,这里是一些注意事项,来让你的菜单项更原生化. ### 标准菜单 -在 OS X 上,有很多系统定义的标准菜单,例如 `Services` and +在 macOS 上,有很多系统定义的标准菜单,例如 `Services` and `Windows` 菜单.为了让你的应用更标准化,你可以为你的菜单的 `role` 设置值,然后 electron 将会识别他们并且让你的菜单更标准: * `window` @@ -276,12 +276,12 @@ Menu.setApplicationMenu(menu); ### 标准菜单项行为 -OS X 为一些菜单项提供了标准的行为方法,例如 `About xxx`, +macOS 为一些菜单项提供了标准的行为方法,例如 `About xxx`, `Hide xxx`, and `Hide Others`. 为了让你的菜单项的行为更标准化,你应该为菜单项设置 `role` 属性. ### 主菜单名 -在 OS X ,无论你设置的什么标签,应用菜单的第一个菜单项的标签始终未你的应用名字.想要改变它的话,你必须通过修改应用绑定的 `Info.plist` 文件来修改应用名字.更多信息参考[About Information +在 macOS ,无论你设置的什么标签,应用菜单的第一个菜单项的标签始终未你的应用名字.想要改变它的话,你必须通过修改应用绑定的 `Info.plist` 文件来修改应用名字.更多信息参考[About Information Property List Files][AboutInformationPropertyListFiles] . ## 为制定浏览器窗口设置菜单 (*Linux* *Windows*) diff --git a/docs-translations/zh-CN/api/native-image.md b/docs-translations/zh-CN/api/native-image.md index 3644ff0b8bc..aa544d07dc3 100644 --- a/docs-translations/zh-CN/api/native-image.md +++ b/docs-translations/zh-CN/api/native-image.md @@ -63,7 +63,7 @@ var appIcon = new Tray('/Users/somebody/images/icon.png'); 最常见的用力是将模板图片用到菜单栏图片上,所以它可以同时适应亮、黑不同的菜单栏. -**注意:** 模板图片只在 OS X 上可用. +**注意:** 模板图片只在 macOS 上可用. 为了将图片标识为一个模板图片,它的文件名应当以 `Template` 结尾. 例如: @@ -121,9 +121,9 @@ var image = nativeImage.createFromPath('/Users/somebody/images/icon.png'); 返回图片数据的 URL. -### `image.getNativeHandle()` _OS X_ +### `image.getNativeHandle()` _macOS_ -返回一个保存了 c 指针的 [Buffer][buffer] 来潜在处理原始图像.在OS X, 将会返回一个 `NSImage` 指针实例. +返回一个保存了 c 指针的 [Buffer][buffer] 来潜在处理原始图像.在macOS, 将会返回一个 `NSImage` 指针实例. 注意那返回的指针是潜在原始图像的弱指针,而不是一个复制,你_必须_ 确保与 `nativeImage` 的关联不间断 . diff --git a/docs-translations/zh-CN/api/process.md b/docs-translations/zh-CN/api/process.md index 28127776cf0..c52591c5429 100644 --- a/docs-translations/zh-CN/api/process.md +++ b/docs-translations/zh-CN/api/process.md @@ -41,7 +41,7 @@ process.once('loaded', function() { 使当前进程的主线程挂起. -### `process.setFdLimit(maxDescriptors)` _OS X_ _Linux_ +### `process.setFdLimit(maxDescriptors)` _macOS_ _Linux_ * `maxDescriptors` Integer diff --git a/docs-translations/zh-CN/api/tray.md b/docs-translations/zh-CN/api/tray.md index d5647871ac7..2d23857e595 100644 --- a/docs-translations/zh-CN/api/tray.md +++ b/docs-translations/zh-CN/api/tray.md @@ -68,9 +68,9 @@ appIcon.setContextMenu(contextMenu); 当tray icon被点击的时候发出事件. -__注意:__ `bounds` 只在 OS X 和 Windows 上起效. +__注意:__ `bounds` 只在 macOS 和 Windows 上起效. -### Event: 'right-click' _OS X_ _Windows_ +### Event: 'right-click' _macOS_ _Windows_ * `event` Event * `altKey` Boolean @@ -85,7 +85,7 @@ __注意:__ `bounds` 只在 OS X 和 Windows 上起效. 当tray icon被鼠标右键点击的时候发出事件. -### Event: 'double-click' _OS X_ _Windows_ +### Event: 'double-click' _macOS_ _Windows_ * `event` Event * `altKey` Boolean @@ -112,27 +112,27 @@ __注意:__ `bounds` 只在 OS X 和 Windows 上起效. 当tray 气泡关闭的时候发出事件,因为超时或人为关闭. -### Event: 'drop' _OS X_ +### Event: 'drop' _macOS_ 当tray icon上的任何可拖动项被删除的时候发出事件. -### Event: 'drop-files' _OS X_ +### Event: 'drop-files' _macOS_ * `event` * `files` Array - 已删除文件的路径. 当tray icon上的可拖动文件被删除的时候发出事件. -### Event: 'drag-enter' _OS X_ +### Event: 'drag-enter' _macOS_ 当一个拖动操作进入tray icon的时候发出事件. -### Event: 'drag-leave' _OS X_ +### Event: 'drag-leave' _macOS_ 当一个拖动操作离开tray icon的时候发出事件. Emitted when a drag operation exits the tray icon. -### Event: 'drag-end' _OS X_ +### Event: 'drag-end' _macOS_ 当一个拖动操作在tray icon上或其它地方停止拖动的时候发出事件. @@ -152,11 +152,11 @@ Emitted when a drag operation exits the tray icon. 让 `image` 与 tray icon 关联起来. -### `Tray.setPressedImage(image)` _OS X_ +### `Tray.setPressedImage(image)` _macOS_ * `image` [NativeImage](native-image.md) -当在 OS X 上按压 tray icon 的时候, 让 `image` 与 tray icon 关联起来. +当在 macOS 上按压 tray icon 的时候, 让 `image` 与 tray icon 关联起来. ### `Tray.setToolTip(toolTip)` @@ -164,13 +164,13 @@ Emitted when a drag operation exits the tray icon. 为 tray icon 设置 hover text. -### `Tray.setTitle(title)` _OS X_ +### `Tray.setTitle(title)` _macOS_ * `title` String 在状态栏沿着 tray icon 设置标题. -### `Tray.setHighlightMode(highlight)` _OS X_ +### `Tray.setHighlightMode(highlight)` _macOS_ * `highlight` Boolean @@ -185,7 +185,7 @@ Emitted when a drag operation exits the tray icon. 展示一个 tray balloon. -### `Tray.popUpContextMenu([menu, position])` _OS X_ _Windows_ +### `Tray.popUpContextMenu([menu, position])` _macOS_ _Windows_ * `menu` Menu (optional) * `position` Object (可选) - 上托位置. diff --git a/docs-translations/zh-CN/development/build-instructions-osx.md b/docs-translations/zh-CN/development/build-instructions-osx.md index 98f6648a359..d2052c27a54 100644 --- a/docs-translations/zh-CN/development/build-instructions-osx.md +++ b/docs-translations/zh-CN/development/build-instructions-osx.md @@ -1,10 +1,10 @@ -# Build Instructions (OS X) +# Build Instructions (macOS) -遵循下面的引导,在 OS X 上构建 Electron . +遵循下面的引导,在 macOS 上构建 Electron . ## 前提 -* OS X >= 10.8 +* macOS >= 10.8 * [Xcode](https://developer.apple.com/technologies/tools/) >= 5.1 * [node.js](http://nodejs.org) (外部) @@ -45,7 +45,7 @@ $ ./script/build.py -c D ## 32位支持 -在 OS X 上,构建 Electron 只支持 64位的,不支持 32位的 . +在 macOS 上,构建 Electron 只支持 64位的,不支持 32位的 . ## 测试 diff --git a/docs-translations/zh-CN/development/coding-style.md b/docs-translations/zh-CN/development/coding-style.md index 4136ae4805b..f293ece40de 100644 --- a/docs-translations/zh-CN/development/coding-style.md +++ b/docs-translations/zh-CN/development/coding-style.md @@ -6,7 +6,7 @@ 对于 C++ 和 Python,我们遵循 Chromium 的[编码规范](http://www.chromium.org/developers/coding-style)。你可以使用 `script/cpplint.py` 来检验文件是否符合要求。 -我们目前使用的 Pyhton 版本是 Python 2.7。 +我们目前使用的 Python 版本是 Python 2.7。 C++ 代码中用到了许多 Chromium 中的接口和数据类型,所以希望你能熟悉它们。Chromium 中的[重要接口和数据结构](https://www.chromium.org/developers/coding-style/important-abstractions-and-data-structures)就是一篇不错的入门文档,里面提到了一些特殊类型、域内类型(退出作用域时自动释放内存)、日志机制,等等。 diff --git a/docs-translations/zh-CN/faq/electron-faq.md b/docs-translations/zh-CN/faq/electron-faq.md index 3431c6018ab..6c13dcdf509 100644 --- a/docs-translations/zh-CN/faq/electron-faq.md +++ b/docs-translations/zh-CN/faq/electron-faq.md @@ -114,7 +114,7 @@ Uncaught TypeError: Cannot read property 'setZoomLevel' of undefined console.log(require.resolve('electron')); ``` -确认以下它是不是像下面这样的: +确认一下它是不是像下面这样的: ``` "/path/to/Electron.app/Contents/Resources/atom.asar/renderer/api/lib/exports/electron.js" diff --git a/docs-translations/zh-CN/tutorial/application-distribution.md b/docs-translations/zh-CN/tutorial/application-distribution.md index 2dca19342ad..07c9c0d8748 100644 --- a/docs-translations/zh-CN/tutorial/application-distribution.md +++ b/docs-translations/zh-CN/tutorial/application-distribution.md @@ -1,10 +1,10 @@ # 应用部署 为了使用 Electron 部署你的应用程序,你存放应用程序的文件夹需要叫做 `app` 并且需要放在 Electron 的 -资源文件夹下(在 OS X 中是指 `Electron.app/Contents/Resources/`,在 Linux 和 Windows 中是指 `resources/`) +资源文件夹下(在 macOS 中是指 `Electron.app/Contents/Resources/`,在 Linux 和 Windows 中是指 `resources/`) 就像这样: -在 OS X 中: +在 macOS 中: ```text electron/Electron.app/Contents/Resources/app/ @@ -33,7 +33,7 @@ electron/resources/app 然后将其放到 Electron 的资源文件夹下,然后 Electron 就会试图读取这个库文件并从中启动。 如下所示: -在 OS X 中: +在 macOS 中: ```text electron/Electron.app/Contents/Resources/ @@ -59,7 +59,7 @@ electron/resources/ [rcedit](https://github.com/atom/rcedit) 编辑它的 icon 和其他信息。 -### OS X +### macOS 你可以将 `Electron.app` 改成任意你喜欢的名字,然后你也需要修改这些文件中的 `CFBundleDisplayName`, `CFBundleIdentifier` 以及 `CFBundleName` 字段。 diff --git a/docs-translations/zh-CN/tutorial/desktop-environment-integration.md b/docs-translations/zh-CN/tutorial/desktop-environment-integration.md index 3f946da34e1..ea92d8d44fe 100644 --- a/docs-translations/zh-CN/tutorial/desktop-environment-integration.md +++ b/docs-translations/zh-CN/tutorial/desktop-environment-integration.md @@ -3,7 +3,7 @@ 本章将会说明怎样使用 Electron APIs 把你的应用和桌面环境集成到一块。 -## Notifications (Windows, Linux, OS X) +## Notifications (Windows, Linux, macOS) 这三个操作系统都为用户提供了发送通知的方法。Electron让开发人员通过 [HTML5 Notification API](https://notifications.spec.whatwg.org/) @@ -38,14 +38,14 @@ Model ID][app-user-model-id]安装到开始屏幕上。需要注意的是,这 Specification][notification-spec]的桌面环境中显示,包括 Cinnamon, Enlightenment, Unity, GNOME, KDE。 -### OS X +### macOS -在OS X系统中,通知是直接转发的,你应该了解[Apple's Human Interface guidelines regarding notifications](https://developer.apple.com/library/mac/documentation/UserExperience/Conceptual/OSXHIGuidelines/NotificationCenter.html)。 +在macOS系统中,通知是直接转发的,你应该了解[Apple's Human Interface guidelines regarding notifications](https://developer.apple.com/library/mac/documentation/UserExperience/Conceptual/OSXHIGuidelines/NotificationCenter.html)。 注意通知被限制在256个字节以内,如果超出,则会被截断。 -## 最近文档 (Windows & OS X) -Windows 和 OS X 提供获取最近文档列表的便捷方式,那就是打开跳转列表或者鱼眼菜单。 +## 最近文档 (Windows & macOS) +Windows 和 macOS 提供获取最近文档列表的便捷方式,那就是打开跳转列表或者鱼眼菜单。 跳转列表: ![JumpList][1] @@ -66,15 +66,15 @@ app.clearRecentDocuments(); ## Windows 需注意 为了这个特性在 Windows 上表现正常,你的应用需要被注册成为一种文件类型的句柄,否则,在你注册之前,文件不会出现在跳转列表。你可以在 [Application Registration][5] 里找到任何关于注册事宜的说明。 -## OS X 需注意 +## macOS 需注意 当一个文件被最近文件列表请求时,`app` 模块里的 `open-file` 事件将会被发出。 -## 自定义的鱼眼菜单(OS X) -OS X 可以让开发者定制自己的菜单,通常会包含一些常用特性的快捷方式。 +## 自定义的鱼眼菜单(macOS) +macOS 可以让开发者定制自己的菜单,通常会包含一些常用特性的快捷方式。 ### 菜单中的终端 ![Dock menu of Terminal.app][6] -使用 `app.dock.setMenu` API 来设置你的菜单,这仅在 OS X 上可行: +使用 `app.dock.setMenu` API 来设置你的菜单,这仅在 macOS 上可行: ```javascript var app = require('app'); var Menu = require('menu'); @@ -98,7 +98,7 @@ app.dock.setMenu(dockMenu); ### IE 的任务 ![IE][7] -不同于 OS X 的鱼眼菜单,Windows 上的用户任务表现得更像一个快捷方式,比如当用户点击一个任务,一个程序将会被传入特定的参数并且运行。 +不同于 macOS 的鱼眼菜单,Windows 上的用户任务表现得更像一个快捷方式,比如当用户点击一个任务,一个程序将会被传入特定的参数并且运行。 你可以使用 [app.setUserTasks][8] API 来设置你的应用中的用户任务: ```javascript @@ -177,7 +177,7 @@ Unity DE 也具有同样的特性,在运行器上显示进度条。 var window = new BrowserWindow({...}); window.setProgressBar(0.5); ``` -在 OS X,一个窗口可以设置它展示的文件,文件的图标可以出现在标题栏,当用户 Command-Click 或者 Control-Click 标题栏,文件路径弹窗将会出现。 +在 macOS,一个窗口可以设置它展示的文件,文件的图标可以出现在标题栏,当用户 Command-Click 或者 Control-Click 标题栏,文件路径弹窗将会出现。 ### 展示文件弹窗菜单: ![Represented file popup menu][16] diff --git a/docs-translations/zh-CN/tutorial/mac-app-store-submission-guide.md b/docs-translations/zh-CN/tutorial/mac-app-store-submission-guide.md index bf326169fb7..35dbb420c31 100644 --- a/docs-translations/zh-CN/tutorial/mac-app-store-submission-guide.md +++ b/docs-translations/zh-CN/tutorial/mac-app-store-submission-guide.md @@ -100,7 +100,7 @@ codesign -s "$APP_KEY" -f --entitlements "$PARENT_PLIST" "$APP_PATH" productbuild --component "$APP_PATH" /Applications --sign "$INSTALLER_KEY" "$RESULT_PATH" ``` -如果你是 OS X 下的应用沙箱使用新手,应当仔细阅读 Apple 的 [Enabling App Sandbox][enable-app-sandbox] 了解一些基础,然后在授权文件 (entitlements files) 内添加你的应用需要的许可。 +如果你是 macOS 下的应用沙箱使用新手,应当仔细阅读 Apple 的 [Enabling App Sandbox][enable-app-sandbox] 了解一些基础,然后在授权文件 (entitlements files) 内添加你的应用需要的许可。 ### 上传你的应用并检查提交 diff --git a/docs-translations/zh-CN/tutorial/online-offline-events.md b/docs-translations/zh-CN/tutorial/online-offline-events.md index d61f7378b96..c13e44c6885 100644 --- a/docs-translations/zh-CN/tutorial/online-offline-events.md +++ b/docs-translations/zh-CN/tutorial/online-offline-events.md @@ -33,7 +33,7 @@ app.on('ready', function() { ``` -也会有人想要在主进程也有回应这些事件的实例。然后主进程没有 `navigator` 对象因此不能直接探测在线还是离线。使用 Electron 的进程间通讯工具,事件就可以在主进程被使,就像下面的例子: +也会有人想要在主进程也有回应这些事件的实例。然后主进程没有 `navigator` 对象因此不能直接探测在线还是离线。使用 Electron 的进程间通讯工具,事件就可以在主进程被使用,就像下面的例子: *main.js* ```javascript diff --git a/docs-translations/zh-CN/tutorial/quick-start.md b/docs-translations/zh-CN/tutorial/quick-start.md index 6ea9d6d5525..4330bde6336 100644 --- a/docs-translations/zh-CN/tutorial/quick-start.md +++ b/docs-translations/zh-CN/tutorial/quick-start.md @@ -77,7 +77,7 @@ app.on('ready', createWindow); // Quit when all windows are closed. app.on('window-all-closed', () => { - // On OS X it is common for applications and their menu bar + // On macOS it is common for applications and their menu bar // to stay active until the user quits explicitly with Cmd + Q if (process.platform !== 'darwin') { app.quit(); @@ -85,7 +85,7 @@ app.on('window-all-closed', () => { }); app.on('activate', () => { - // On OS X it's common to re-create a window in the app when the + // On macOS it's common to re-create a window in the app when the // dock icon is clicked and there are no other windows open. if (mainWindow === null) { createWindow(); @@ -136,7 +136,7 @@ $ .\electron\electron.exe your-app\ ```bash $ ./electron/electron your-app/ ``` -### OS X +### macOS ```bash $ ./Electron.app/Contents/MacOS/Electron your-app/ ``` diff --git a/docs-translations/zh-CN/tutorial/supported-platforms.md b/docs-translations/zh-CN/tutorial/supported-platforms.md index e03ccd82364..dde3f130c57 100644 --- a/docs-translations/zh-CN/tutorial/supported-platforms.md +++ b/docs-translations/zh-CN/tutorial/supported-platforms.md @@ -2,9 +2,9 @@ 以下的平台是 Electron 目前支持的: -### OS X +### macOS -对于 OS X 系统仅有64位的二进制文档,支持的最低版本是 OS X 10.8。 +对于 macOS 系统仅有64位的二进制文档,支持的最低版本是 macOS 10.8。 ### Windows diff --git a/docs-translations/zh-CN/tutorial/testing-on-headless-ci.md b/docs-translations/zh-CN/tutorial/testing-on-headless-ci.md index 7da98b0a1a6..b768467109f 100644 --- a/docs-translations/zh-CN/tutorial/testing-on-headless-ci.md +++ b/docs-translations/zh-CN/tutorial/testing-on-headless-ci.md @@ -14,10 +14,10 @@ Jenkins 或者类似的系统上测试基于Electron的应用时,需要进行 然后创建一个虚拟的xvfb屏幕并且导出一个指向他的名为`DISPLAY`的环境变量。Electron中的Chromium 会自动的去寻找`$DISPLAY`,所以你的应用不需要再去进行配置。这一步可以通过Paul Betts's的 [xvfb-maybe](https://github.com/paulcbetts/xvfb-maybe)实现自动化:如果系统需要,在`xvfb-maybe`前加上你的测试命令 -然后这个小工具会自动的设置xvfb。在Windows或者Mac OS X系统下,它不会执行任何东西。 +然后这个小工具会自动的设置xvfb。在Windows或者macOS系统下,它不会执行任何东西。 ``` -## On Windows or OS X, this just invokes electron-mocha +## On Windows or macOS, this just invokes electron-mocha ## On Linux, if we are in a headless environment, this will be equivalent ## to xvfb-run electron-mocha ./test/*.js xvfb-maybe electron-mocha ./test/*.js diff --git a/docs-translations/zh-CN/tutorial/using-pepper-flash-plugin.md b/docs-translations/zh-CN/tutorial/using-pepper-flash-plugin.md index ce1f210c5c9..c030720f37c 100644 --- a/docs-translations/zh-CN/tutorial/using-pepper-flash-plugin.md +++ b/docs-translations/zh-CN/tutorial/using-pepper-flash-plugin.md @@ -5,7 +5,7 @@ Electron 现在支持 Pepper Flash 插件。要在 Electron 里面使用 Pepper ## 保留一份 Flash 插件的副本 -在 OS X 和 Linux 上,你可以在 Chrome 浏览器的 `chrome://plugins` 页面上找到 Pepper +在 macOS 和 Linux 上,你可以在 Chrome 浏览器的 `chrome://plugins` 页面上找到 Pepper Flash 的插件信息。插件的路径和版本会对 Election 对其的支持有帮助。你也可以把插件 复制到另一个路径以保留一份副本。 @@ -19,7 +19,7 @@ Flash 的插件信息。插件的路径和版本会对 Election 对其的支持 ```javascript // Specify flash path. 设置 flash 路径 // On Windows, it might be /path/to/pepflashplayer.dll -// On OS X, /path/to/PepperFlashPlayer.plugin +// On macOS, /path/to/PepperFlashPlayer.plugin // On Linux, /path/to/libpepflashplayer.so app.commandLine.appendSwitch('ppapi-flash-path', '/path/to/libpepflashplayer.so'); diff --git a/docs-translations/zh-CN/tutorial/using-widevine-cdm-plugin.md b/docs-translations/zh-CN/tutorial/using-widevine-cdm-plugin.md index d5df1646c48..25ce3bd525e 100644 --- a/docs-translations/zh-CN/tutorial/using-widevine-cdm-plugin.md +++ b/docs-translations/zh-CN/tutorial/using-widevine-cdm-plugin.md @@ -8,17 +8,17 @@ Electron 没有为 Widevine CDM 插件 配制许可 reasons, 为了获得它, __注意:__ Chrome 浏览器的主要版本必须和 Electron 使用的版本一样,否则插件不会有效,虽然 `navigator.plugins` 会显示你已经安装了它 . -### Windows & OS X +### Windows & macOS 在 Chrome 浏览器中打开 `chrome://components/` ,找到 `WidevineCdm` 并且确定它更新到最新版本,然后你可以从 `APP_DATA/Google/Chrome/WidevineCDM/VERSION/_platform_specific/PLATFORM_ARCH/` 路径找到所有的插件二进制文件 . `APP_DATA` 是系统存放数据的地方,在 Windows 上它是 -`%LOCALAPPDATA%`, 在 OS X 上它是 `~/Library/Application Support`. `VERSION` 是 +`%LOCALAPPDATA%`, 在 macOS 上它是 `~/Library/Application Support`. `VERSION` 是 Widevine CDM 插件的版本字符串, 类似 `1.4.8.866`. `PLATFORM` 是 `mac` 或 `win`. `ARCH` 是 `x86` 或 `x64`. 在 Windows,必要的二进制文件是 `widevinecdm.dll` and -`widevinecdmadapter.dll`, 在 OS X ,它们是 `libwidevinecdm.dylib` 和 +`widevinecdmadapter.dll`, 在 macOS ,它们是 `libwidevinecdm.dylib` 和 `widevinecdmadapter.plugin`. 你可以将它们复制到任何你喜欢的地方,但是它们必须要放在一起. ### Linux @@ -38,7 +38,7 @@ __注意:__ 虽然只有 `widevinecdmadapter` 的二进制文件传递给了 El ```javascript // You have to pass the filename of `widevinecdmadapter` here, it is -// * `widevinecdmadapter.plugin` on OS X, +// * `widevinecdmadapter.plugin` on macOS, // * `libwidevinecdmadapter.so` on Linux, // * `widevinecdmadapter.dll` on Windows. app.commandLine.appendSwitch('widevine-cdm-path', '/path/to/widevinecdmadapter.plugin'); diff --git a/docs-translations/zh-TW/README.md b/docs-translations/zh-TW/README.md index 29ed827c668..3924e1fa83c 100644 --- a/docs-translations/zh-TW/README.md +++ b/docs-translations/zh-TW/README.md @@ -66,7 +66,7 @@ * [源碼目錄結構](development/source-code-directory-structure.md) * [與 NW.js (原名node-webkit) 在技術上的差異](development/atom-shell-vs-node-webkit.md) * [構建系統概況](development/build-system-overview.md) -* [構建步驟 (OS X)](development/build-instructions-osx.md) +* [構建步驟 (macOS)](development/build-instructions-osx.md) * [構建步驟 (Windows)](development/build-instructions-windows.md) * [構建步驟 (Linux)](development/build-instructions-linux.md) * [在 debugger 中使用 symbol server](development/setting-up-symbol-server.md) diff --git a/docs-translations/zh-TW/api/process.md b/docs-translations/zh-TW/api/process.md index ba3dd245f7a..bb83f42b154 100644 --- a/docs-translations/zh-TW/api/process.md +++ b/docs-translations/zh-TW/api/process.md @@ -15,7 +15,7 @@ 會導致目前行程的主執行緒停住 -## process.setFdLimit(maxDescriptors) _OS X_ _Linux_ +## process.setFdLimit(maxDescriptors) _macOS_ _Linux_ * `maxDescriptors` Integer diff --git a/docs-translations/zh-TW/tutorial/application-distribution.md b/docs-translations/zh-TW/tutorial/application-distribution.md index 53561ecfda6..f26f97bf909 100644 --- a/docs-translations/zh-TW/tutorial/application-distribution.md +++ b/docs-translations/zh-TW/tutorial/application-distribution.md @@ -1,8 +1,8 @@ # 應用程式部署 -要部屬你的 Electron 應用程式,你需要把你的應用程式資料夾命名為 `app`,並放置於 Electron 的資源目錄下 (在 OS X 中位在 `Electron.app/Contents/Resources/` 而 Linux 和 Windows 的是在 `resources/`),例如: +要部屬你的 Electron 應用程式,你需要把你的應用程式資料夾命名為 `app`,並放置於 Electron 的資源目錄下 (在 macOS 中位在 `Electron.app/Contents/Resources/` 而 Linux 和 Windows 的是在 `resources/`),例如: -OS X: +macOS: ```text electron/Electron.app/Contents/Resources/app/ @@ -28,7 +28,7 @@ electron/resources/app 要使用 `asar` 壓縮檔來取代 `app` 資料夾,你需要重新命名該壓縮檔為 `app.asar`,然後如下所示把它放到 Electron 的資源目錄中,接著 Electron 就會試著讀取壓縮檔並從它開始執行。 -OS X: +macOS: ```text electron/Electron.app/Contents/Resources/ @@ -53,7 +53,7 @@ electron/resources/ 你可以重新命名 `electron.exe` 為任何你喜歡的名稱,然後透過像是 [rcedit](https://github.com/atom/rcedit) 的工具來編輯它的圖示(icon)和其他資訊。 -### OS X +### macOS 你可以重新命名 `Electron.app` 為任何你喜歡的名稱,另外你也需要重新命名下列檔案中的 `CFBundleDisplayName`、`CFBundleIdentifier` 和 `CFBundleName` 欄位: diff --git a/docs-translations/zh-TW/tutorial/mac-app-store-submission-guide.md b/docs-translations/zh-TW/tutorial/mac-app-store-submission-guide.md index 6deaa8295ef..b33ddeda405 100644 --- a/docs-translations/zh-TW/tutorial/mac-app-store-submission-guide.md +++ b/docs-translations/zh-TW/tutorial/mac-app-store-submission-guide.md @@ -74,7 +74,7 @@ codesign -fs "$APP_KEY" --entitlements parent.plist "$APP_PATH" productbuild --component "$APP_PATH" /Applications --sign "$INSTALLER_KEY" "$RESULT_PATH" ``` -如果你是第一次使用 OS X 下的應用程式沙盒(app sandboxing),你應該也要閱讀 Apple 的 [Enabling App Sandbox][enable-app-sandbox] 以舉被基本概念,然後把你的應用程式會用到的 key 的權限都加入管理權現的檔案中。 +如果你是第一次使用 macOS 下的應用程式沙盒(app sandboxing),你應該也要閱讀 Apple 的 [Enabling App Sandbox][enable-app-sandbox] 以具備基本概念,然後把你的應用程式會用到的 key 的權限都加入管理權現的檔案中。 ### 上傳你的應用程式和提交檢視 @@ -101,4 +101,4 @@ productbuild --component "$APP_PATH" /Applications --sign "$INSTALLER_KEY" "$RES [enable-app-sandbox]: https://developer.apple.com/library/ios/documentation/Miscellaneous/Reference/EntitlementKeyReference/Chapters/EnablingAppSandbox.html [create-record]: https://developer.apple.com/library/ios/documentation/LanguagesUtilities/Conceptual/iTunesConnect_Guide/Chapters/CreatingiTunesConnectRecord.html [submit-for-review]: https://developer.apple.com/library/ios/documentation/LanguagesUtilities/Conceptual/iTunesConnect_Guide/Chapters/SubmittingTheApp.html -[app-sandboxing]: https://developer.apple.com/app-sandboxing/ \ No newline at end of file +[app-sandboxing]: https://developer.apple.com/app-sandboxing/ diff --git a/docs-translations/zh-TW/tutorial/quick-start.md b/docs-translations/zh-TW/tutorial/quick-start.md index af98a0e580c..ec1f612868c 100644 --- a/docs-translations/zh-TW/tutorial/quick-start.md +++ b/docs-translations/zh-TW/tutorial/quick-start.md @@ -68,7 +68,7 @@ var mainWindow = null; // 當所有窗口被關閉了,退出。 app.on('window-all-closed', function() { -  // 在OS X 上,通常使用者在明確地按下 Cmd + Q 之前 +  // 在macOS 上,通常使用者在明確地按下 Cmd + Q 之前   // 應用會保持活動狀態   if (process.platform != 'darwin') {     app.quit(); @@ -147,7 +147,7 @@ $ .\electron\electron.exe your-app\ $ ./electron/electron your-app/ ``` -### OS X +### macOS ``` bash $ ./Electron.app/Contents/MacOS/Electron your-app/ diff --git a/docs-translations/zh-TW/tutorial/supported-platforms.md b/docs-translations/zh-TW/tutorial/supported-platforms.md index 225bc9b2b55..d17943761d9 100644 --- a/docs-translations/zh-TW/tutorial/supported-platforms.md +++ b/docs-translations/zh-TW/tutorial/supported-platforms.md @@ -2,9 +2,9 @@ Electron 已支援以下平台: -### OS X +### macOS -OS X 系統只有 64 位元的執行檔,且 OS X 的最低版本要求為 OS X 10.8。 +macOS 系統只有 64 位元的執行檔,且 macOS 的最低版本要求為 macOS 10.8。 ### Windows diff --git a/docs-translations/zh-TW/tutorial/using-pepper-flash-plugin.md b/docs-translations/zh-TW/tutorial/using-pepper-flash-plugin.md index e27554c5168..2e1ea49f021 100644 --- a/docs-translations/zh-TW/tutorial/using-pepper-flash-plugin.md +++ b/docs-translations/zh-TW/tutorial/using-pepper-flash-plugin.md @@ -4,7 +4,7 @@ Electron 現在支援 Pepper Flash 外掛,要在 Electron 中使用 Pepper Fla ## 準備一份 Flash 外掛 -在 OS X 和 Linux 上,Pepper Flash 外掛的細節可以透過查看 Chrome 瀏覽器中的 `chrome://plugins` 來得知,它的位置和版本對於 Electron 的 Pepper Flash 支援都有很大的幫助,你可以把它複製一份到別的位置。 +在 macOS 和 Linux 上,Pepper Flash 外掛的細節可以透過查看 Chrome 瀏覽器中的 `chrome://plugins` 來得知,它的位置和版本對於 Electron 的 Pepper Flash 支援都有很大的幫助,你可以把它複製一份到別的位置。 ## 加入 Electron 開關 @@ -16,7 +16,7 @@ Electron 命定列或是在應用程式的 ready 事件之前使用 `app.command ```javascript // 指定 Flash 路徑 // Windows 中可能是 /path/to/pepflashplayer.dll -// OS X 中 /path/to/PepperFlashPlayer.plugin +// macOS 中 /path/to/PepperFlashPlayer.plugin // Linux 中 /path/to/libpepflashplayer.so app.commandLine.appendSwitch('ppapi-flash-path', '/path/to/libpepflashplayer.so'); diff --git a/docs/README.md b/docs/README.md index 1cbe32d8dd8..072e97cfc32 100644 --- a/docs/README.md +++ b/docs/README.md @@ -90,7 +90,7 @@ an issue: * [Source Code Directory Structure](development/source-code-directory-structure.md) * [Technical Differences to NW.js (formerly node-webkit)](development/atom-shell-vs-node-webkit.md) * [Build System Overview](development/build-system-overview.md) -* [Build Instructions (OS X)](development/build-instructions-osx.md) +* [Build Instructions (macOS)](development/build-instructions-osx.md) * [Build Instructions (Windows)](development/build-instructions-windows.md) * [Build Instructions (Linux)](development/build-instructions-linux.md) * [Debug Instructions (Windows)](development/debug-instructions-windows.md) diff --git a/docs/api/accelerator.md b/docs/api/accelerator.md index 1710d598e3d..1f760b46361 100644 --- a/docs/api/accelerator.md +++ b/docs/api/accelerator.md @@ -13,14 +13,14 @@ Examples: ## Platform notice On Linux and Windows, the `Command` key does not have any effect so -use `CommandOrControl` which represents `Command` on OS X and `Control` on +use `CommandOrControl` which represents `Command` on macOS and `Control` on Linux and Windows to define some accelerators. -Use `Alt` instead of `Option`. The `Option` key only exists on OS X, whereas +Use `Alt` instead of `Option`. The `Option` key only exists on macOS, whereas the `Alt` key is available on all platforms. The `Super` key is mapped to the `Windows` key on Windows and Linux and -`Cmd` on OS X. +`Cmd` on macOS. ## Available modifiers diff --git a/docs/api/app.md b/docs/api/app.md index b7ce6ce02fa..c014395eb10 100644 --- a/docs/api/app.md +++ b/docs/api/app.md @@ -19,7 +19,7 @@ The `app` object emits the following events: ### Event: 'will-finish-launching' Emitted when the application has finished basic startup. On Windows and Linux, -the `will-finish-launching` event is the same as the `ready` event; on OS X, +the `will-finish-launching` event is the same as the `ready` event; on macOS, this event represents the `applicationWillFinishLaunching` notification of `NSApplication`. You would usually set up listeners for the `open-file` and `open-url` events here, and start the crash reporter and auto updater. @@ -73,7 +73,7 @@ Returns: Emitted when the application is quitting. -### Event: 'open-file' _OS X_ +### Event: 'open-file' _macOS_ Returns: @@ -92,7 +92,7 @@ You should call `event.preventDefault()` if you want to handle this event. On Windows, you have to parse `process.argv` (in the main process) to get the filepath. -### Event: 'open-url' _OS X_ +### Event: 'open-url' _macOS_ Returns: @@ -104,7 +104,7 @@ must be registered to be opened by your application. You should call `event.preventDefault()` if you want to handle this event. -### Event: 'activate' _OS X_ +### Event: 'activate' _macOS_ Returns: @@ -114,7 +114,7 @@ Returns: Emitted when the application is activated, which usually happens when the user clicks on the application's dock icon. -### Event: 'continue-activity' _OS X_ +### Event: 'continue-activity' _macOS_ Returns: @@ -160,6 +160,15 @@ Returns: Emitted when a new [browserWindow](browser-window.md) is created. +### Event: 'web-contents-created' + +Returns: + +* `event` Event +* `webContents` WebContents + +Emitted when a new [webContents](web-contents.md) is created. + ### Event: 'certificate-error' Returns: @@ -305,14 +314,14 @@ app.exit(0) ### `app.focus()` -On Linux, focuses on the first visible window. On OS X, makes the application +On Linux, focuses on the first visible window. On macOS, makes the application the active app. On Windows, focuses on the application's first window. -### `app.hide()` _OS X_ +### `app.hide()` _macOS_ Hides all application windows without minimizing them. -### `app.show()` _OS X_ +### `app.show()` _macOS_ Shows application windows after they were hidden. Does not automatically focus them. @@ -334,7 +343,7 @@ You can request the following paths by the name: * `appData` Per-user application data directory, which by default points to: * `%APPDATA%` on Windows * `$XDG_CONFIG_HOME` or `~/.config` on Linux - * `~/Library/Application Support` on OS X + * `~/Library/Application Support` on macOS * `userData` The directory for storing your app's configuration files, which by default it is the `appData` directory appended with your app's name. * `temp` Temporary directory. @@ -394,20 +403,20 @@ Returns the current application locale. **Note:** On Windows you have to call it after the `ready` events gets emitted. -### `app.addRecentDocument(path)` _OS X_ _Windows_ +### `app.addRecentDocument(path)` _macOS_ _Windows_ * `path` String Adds `path` to the recent documents list. This list is managed by the OS. On Windows you can visit the list from the task -bar, and on OS X you can visit it from dock menu. +bar, and on macOS you can visit it from dock menu. -### `app.clearRecentDocuments()` _OS X_ _Windows_ +### `app.clearRecentDocuments()` _macOS_ _Windows_ Clears the recent documents list. -### `app.setAsDefaultProtocolClient(protocol)` _OS X_ _Windows_ +### `app.setAsDefaultProtocolClient(protocol)` _macOS_ _Windows_ * `protocol` String - The name of your protocol, without `://`. If you want your app to handle `electron://` links, call this method with `electron` as the @@ -415,35 +424,35 @@ Clears the recent documents list. This method sets the current executable as the default handler for a protocol (aka URI scheme). It allows you to integrate your app deeper into the operating -system. Once registered, all links with `your-protocol://` will be openend with +system. Once registered, all links with `your-protocol://` will be opened with the current executable. The whole link, including protocol, will be passed to your application as a parameter. -**Note:** On OS X, you can only register protocols that have been added to +**Note:** On macOS, you can only register protocols that have been added to your app's `info.plist`, which can not be modified at runtime. You can however change the file with a simple text editor or script during build time. Please refer to [Apple's documentation][CFBundleURLTypes] for details. The API uses the Windows Registry and LSSetDefaultHandlerForURLScheme internally. -### `app.removeAsDefaultProtocolClient(protocol)` _OS X_ _Windows_ +### `app.removeAsDefaultProtocolClient(protocol)` _macOS_ _Windows_ * `protocol` String - The name of your protocol, without `://`. This method checks if the current executable as the default handler for a protocol (aka URI scheme). If so, it will remove the app as the default handler. -### `app.isDefaultProtocolClient(protocol)` _OS X_ _Windows_ +### `app.isDefaultProtocolClient(protocol)` _macOS_ _Windows_ * `protocol` String - The name of your protocol, without `://`. This method checks if the current executable is the default handler for a protocol (aka URI scheme). If so, it will return true. Otherwise, it will return false. -**Note:** On OS X, you can use this method to check if the app has been +**Note:** On macOS, you can use this method to check if the app has been registered as the default protocol handler for a protocol. You can also verify this by checking `~/Library/Preferences/com.apple.LaunchServices.plist` on the -OS X machine. Please refer to +macOS machine. Please refer to [Apple's documentation][LSCopyDefaultHandlerForURLScheme] for details. The API uses the Windows Registry and LSCopyDefaultHandlerForURLScheme internally. @@ -494,7 +503,7 @@ application and your app should continue loading. And returns `true` if your process has sent its parameters to another instance, and you should immediately quit. -On OS X the system enforces single instance automatically when users try to open +On macOS the system enforces single instance automatically when users try to open a second instance of your app in Finder, and the `open-file` and `open-url` events will be emitted for that. However when users start your app in command line the system's single instance mechanism will be bypassed and you have to @@ -529,7 +538,7 @@ app.on('ready', () => { Releases all locks that were created by `makeSingleInstance`. This will allow multiple instances of the application to once again run side by side. -### `app.setUserActivity(type, userInfo[, webpageURL])` _OS X_ +### `app.setUserActivity(type, userInfo[, webpageURL])` _macOS_ * `type` String - Uniquely identifies the activity. Maps to [`NSUserActivity.activityType`][activity-type]. @@ -540,7 +549,7 @@ multiple instances of the application to once again run side by side. Creates an `NSUserActivity` and sets it as the current activity. The activity is eligible for [Handoff][handoff] to another device afterward. -### `app.getCurrentActivityType()` _OS X_ +### `app.getCurrentActivityType()` _macOS_ Returns the type of the currently running activity. @@ -582,7 +591,7 @@ correctly. **Note:** This will not affect `process.argv`. -### `app.dock.bounce([type])` _OS X_ +### `app.dock.bounce([type])` _macOS_ * `type` String (optional) - Can be `critical` or `informational`. The default is `informational` @@ -596,43 +605,43 @@ or the request is canceled. Returns an ID representing the request. -### `app.dock.cancelBounce(id)` _OS X_ +### `app.dock.cancelBounce(id)` _macOS_ * `id` Integer Cancel the bounce of `id`. -### `app.dock.downloadFinished(filePath)` _OS X_ +### `app.dock.downloadFinished(filePath)` _macOS_ * `filePath` String Bounces the Downloads stack if the filePath is inside the Downloads folder. -### `app.dock.setBadge(text)` _OS X_ +### `app.dock.setBadge(text)` _macOS_ * `text` String Sets the string to be displayed in the dock’s badging area. -### `app.dock.getBadge()` _OS X_ +### `app.dock.getBadge()` _macOS_ Returns the badge string of the dock. -### `app.dock.hide()` _OS X_ +### `app.dock.hide()` _macOS_ Hides the dock icon. -### `app.dock.show()` _OS X_ +### `app.dock.show()` _macOS_ Shows the dock icon. -### `app.dock.setMenu(menu)` _OS X_ +### `app.dock.setMenu(menu)` _macOS_ * `menu` [Menu](menu.md) Sets the application's [dock menu][dock-menu]. -### `app.dock.setIcon(image)` _OS X_ +### `app.dock.setIcon(image)` _macOS_ * `image` [NativeImage](native-image.md) diff --git a/docs/api/auto-updater.md b/docs/api/auto-updater.md index a2eec31ecbf..46157d02e91 100644 --- a/docs/api/auto-updater.md +++ b/docs/api/auto-updater.md @@ -20,21 +20,20 @@ application by using one of these projects: Though `autoUpdater` provides a uniform API for different platforms, there are still some subtle differences on each platform. -### OS X +### macOS -On OS X, the `autoUpdater` module is built upon [Squirrel.Mac][squirrel-mac], +On macOS, the `autoUpdater` module is built upon [Squirrel.Mac][squirrel-mac], meaning you don't need any special setup to make it work. For server-side requirements, you can read [Server Support][server-support]. -**Note:** Your application must be signed for automatic updates on Mac OS X. +**Note:** Your application must be signed for automatic updates on macOS. This is a requirement of `Squirrel.Mac`. ### Windows On Windows, you have to install your app into a user's machine before you can use the `autoUpdater`, so it is recommended that you use the -[electron-winstaller][installer-lib] module or the [grunt-electron-installer][installer] -package to generate a Windows installer. +[electron-winstaller][installer-lib], [electron-builder][electron-builder-lib] or the [grunt-electron-installer][installer] package to generate a Windows installer. The installer generated with Squirrel will create a shortcut icon with an [Application User Model ID][app-user-model-id] in the format of @@ -43,7 +42,7 @@ The installer generated with Squirrel will create a shortcut icon with an same ID for your app with `app.setAppUserModelId` API, otherwise Windows will not be able to pin your app properly in task bar. -The server-side setup is also different from OS X. You can read the documents of +The server-side setup is also different from macOS. You can read the documents of [Squirrel.Windows][squirrel-windows] to get more details. ### Linux @@ -94,12 +93,12 @@ On Windows only `releaseName` is available. The `autoUpdater` object has the following methods: -### `autoUpdater.setFeedURL(url)` +### `autoUpdater.setFeedURL(url[, requestHeaders])` * `url` String +* `requestHeaders` Object _macOS_ - HTTP request headers. -Sets the `url` and initialize the auto updater. The `url` cannot be changed -once it is set. +Sets the `url` and initialize the auto updater. ### `autoUpdater.checkForUpdates()` @@ -116,6 +115,7 @@ should only be called after `update-downloaded` has been emitted. [squirrel-windows]: https://github.com/Squirrel/Squirrel.Windows [installer]: https://github.com/electron/grunt-electron-installer [installer-lib]: https://github.com/electron/windows-installer +[electron-builder-lib]: https://github.com/electron-userland/electron-builder [app-user-model-id]: https://msdn.microsoft.com/en-us/library/windows/desktop/dd378459(v=vs.85).aspx [electron-release-server]: https://github.com/ArekSredzki/electron-release-server [squirrel-updates-server]: https://github.com/Aluxian/squirrel-updates-server diff --git a/docs/api/browser-window.md b/docs/api/browser-window.md index 8b850b5c438..e95570450b6 100644 --- a/docs/api/browser-window.md +++ b/docs/api/browser-window.md @@ -4,22 +4,93 @@ ```javascript // In the main process. -const {BrowserWindow} = require('electron'); +const {BrowserWindow} = require('electron') // Or in the renderer process. -const {BrowserWindow} = require('electron').remote; +const {BrowserWindow} = require('electron').remote -let win = new BrowserWindow({width: 800, height: 600, show: false}); +let win = new BrowserWindow({width: 800, height: 600}) win.on('closed', () => { - win = null; -}); + win = null +}) -win.loadURL('https://github.com'); -win.show(); +win.loadURL('https://github.com') ``` -You can also create a window without chrome by using -[Frameless Window](frameless-window.md) API. +## Frameless window + +To create a window without chrome, or a transparent window in arbitrary shape, +you can use the [Frameless Window](frameless-window.md) API. + +## Showing window gracefully + +When loading a page in window directly, users will see the progress of loading +page, which is not good experience for native app. To make the window display +without visual flash, there are two solutions for different situations. + +### Using `ready-to-show` event + +While loading the page, the `ready-to-show` event will be emitted when renderer +process has done drawing for the first time, showing window after this event +will have no visual flash: + +```javascript +let win = new BrowserWindow({show: false}) +win.once('ready-to-show', () => { + win.show() +}) +``` + +This is event is usually emitted after the `did-finish-load` event, but for +pages with many remote resources, it may be emitted before the `did-finish-load` +event. + +### Setting `backgroundColor` + +For a complex app, the `ready-to-show` event could be emitted too late, making +the app feel slow. In this case, it is recommended to show the window +immediately, and use a `backgroundColor` close to your app's background: + +```javascript +let win = new BrowserWindow({backgroundColor: '#2e2c29'}) +win.loadURL('https://github.com') +``` + +Note that even for apps that use `ready-to-show` event, it is still recommended +to set `backgroundColor` to make app feel more native. + +## Parent and child windows + +By using `parent` option, you can create child windows: + +```javascript +let top = new BrowserWindow() +let child = new BrowserWindow({parent: top}) +``` + +The `child` window will always show on top of the `top` window. + +### Modal windows + +A modal window is a child window that disables parent window, to create a modal +window, you have to set both `parent` and `modal` options: + +```javascript +let child = new BrowserWindow({parent: top, modal: true, show: false}) +child.loadURL('https://github.com') +child.once('ready-to-show', () => { + child.show() +}) +``` + +### Platform notices + +* On macOS the child windows will keep the relative position to parent window + when parent window moves, while on Windows and Linux child windows will not + move. +* On Windows it is not supported to change parent window dynamically. +* On Linux the type of modal windows will be changed to `dialog`. +* On Linux many desktop environments do not support hiding a modal window. ## Class: BrowserWindow @@ -54,13 +125,18 @@ It creates a new `BrowserWindow` with native properties as set by the `options`. implemented on Linux. Default is `true`. * `closable` Boolean - Whether window is closable. This is not implemented on Linux. Default is `true`. + * `focusable` Boolean - Whether the window can be focused. Default is + `true`. On Windows setting `focusable: false` also implies setting + `skipTaskbar: true`. On Linux setting `focusable: false` makes the window + stop interacting with wm, so the window will always stay on top in all + workspaces. * `alwaysOnTop` Boolean - Whether the window should always stay on top of other windows. Default is `false`. * `fullscreen` Boolean - Whether the window should show in fullscreen. When explicitly set to `false` the fullscreen button will be hidden or disabled - on OS X. Default is `false`. + on macOS. Default is `false`. * `fullscreenable` Boolean - Whether the window can be put into fullscreen - mode. On OS X, also whether the maximize/zoom button should toggle full + mode. On macOS, also whether the maximize/zoom button should toggle full screen mode or maximize window. Default is `true`. * `skipTaskbar` Boolean - Whether to show the window in taskbar. Default is `false`. @@ -73,6 +149,9 @@ It creates a new `BrowserWindow` with native properties as set by the `options`. `true`. * `frame` Boolean - Specify `false` to create a [Frameless Window](frameless-window.md). Default is `true`. + * `parent` BrowserWindow - Specify parent window. Default is `null`. + * `modal` Boolean - Whether this is a modal window. This only works when the + window is a child window. Default is `false`. * `acceptFirstMouse` Boolean - Whether the web view accepts a single mouse-down event that simultaneously activates the window. Default is `false`. @@ -86,7 +165,7 @@ It creates a new `BrowserWindow` with native properties as set by the `options`. like `#66CD00` or `#FFF` or `#80FFFFFF` (alpha is supported). Default is `#FFF` (white). * `hasShadow` Boolean - Whether window should have a shadow. This is only - implemented on OS X. Default is `true`. + implemented on macOS. Default is `true`. * `darkTheme` Boolean - Forces using dark theme for the window, only works on some GTK+3 desktop environments. Default is `false`. * `transparent` Boolean - Makes the window [transparent](frameless-window.md). @@ -108,7 +187,7 @@ supported values are: * On Linux, possible types are `desktop`, `dock`, `toolbar`, `splash`, `notification`. -* On OS X, possible types are `desktop`, `textured`. +* On macOS, possible types are `desktop`, `textured`. * The `textured` type adds metal gradient appearance (`NSTexturedBackgroundWindowMask`). * The `desktop` type places the window at the desktop background window level @@ -116,7 +195,7 @@ supported values are: focus, keyboard or mouse events, but you can use `globalShortcut` to receive input sparingly. -The `titleBarStyle` option is only supported on OS X 10.10 Yosemite and newer. +The `titleBarStyle` option is only supported on macOS 10.10 Yosemite and newer. Possible values are: * `default` or not specified, results in the standard gray opaque Mac title @@ -173,7 +252,7 @@ The `webPreferences` option is an object that can have following properties: * `directWrite` Boolean - Enables DirectWrite font rendering system on Windows. Default is `true`. * `scrollBounce` Boolean - Enables scroll bounce (rubber banding) effect on - OS X. Default is `false`. + macOS. Default is `false`. * `blinkFeatures` String - A list of feature strings separated by `,`, like `CSSVariables,KeyboardEventKey` to enable. The full list of supported feature strings can be found in the [RuntimeEnabledFeatures.in][blink-feature-string] @@ -266,6 +345,11 @@ Emitted when the window is shown. Emitted when the window is hidden. +### Event: 'ready-to-show' + +Emitted when the web page has been rendered and window can be displayed without +visual flash. + ### Event: 'maximize' Emitted when window is maximized. @@ -290,9 +374,9 @@ Emitted when the window is getting resized. Emitted when the window is getting moved to a new position. -__Note__: On OS X this event is just an alias of `moved`. +__Note__: On macOS this event is just an alias of `moved`. -### Event: 'moved' _OS X_ +### Event: 'moved' _macOS_ Emitted once when the window is moved to a new position. @@ -336,15 +420,15 @@ someWindow.on('app-command', (e, cmd) => { }); ``` -### Event: 'scroll-touch-begin' _OS X_ +### Event: 'scroll-touch-begin' _macOS_ Emitted when scroll wheel event phase has begun. -### Event: 'scroll-touch-end' _OS X_ +### Event: 'scroll-touch-end' _macOS_ Emitted when scroll wheel event phase has ended. -### Event: 'swipe' _OS X_ +### Event: 'swipe' _macOS_ Returns: @@ -390,12 +474,32 @@ console. Method will also not return if the extension's manifest is missing or incomplete. +**Note:** This API cannot be called before the `ready` event of the `app` module +is emitted. + ### `BrowserWindow.removeDevToolsExtension(name)` * `name` String Remove the DevTools extension whose name is `name`. +**Note:** This API cannot be called before the `ready` event of the `app` module +is emitted. + +### `BrowserWindow.getDevToolsExtensions()` + +Returns an Object where the keys are the extension names and each value is +an Object containing `name` and `version` properties. + +To check if a DevTools extension is installed you can run the following: + +```javascript +let installed = BrowserWindow.getDevToolsExtensions().hasOwnProperty('devtron') +``` + +**Note:** This API cannot be called before the `ready` event of the `app` module +is emitted. + ## Instance Properties Objects created with `new BrowserWindow` have the following properties: @@ -464,6 +568,10 @@ Hides the window. Returns a boolean, whether the window is visible to the user. +### `win.isModal()` + +Returns whether current window is a modal window. + ### `win.maximize()` Maximizes the window. @@ -499,7 +607,7 @@ Sets whether the window should be in fullscreen mode. Returns a boolean, whether the window is in fullscreen mode. -### `win.setAspectRatio(aspectRatio[, extraSize])` _OS X_ +### `win.setAspectRatio(aspectRatio[, extraSize])` _macOS_ * `aspectRatio` The aspect ratio we want to maintain for some portion of the content view. @@ -529,7 +637,7 @@ height areas you have within the overall content view. * `y` Integer * `width` Integer * `height` Integer -* `animate` Boolean (optional) _OS X_ +* `animate` Boolean (optional) _macOS_ Resizes and moves the window to `width`, `height`, `x`, `y`. @@ -541,7 +649,7 @@ Returns an object that contains window's width, height, x and y values. * `width` Integer * `height` Integer -* `animate` Boolean (optional) _OS X_ +* `animate` Boolean (optional) _macOS_ Resizes the window to `width` and `height`. @@ -553,7 +661,7 @@ Returns an array that contains window's width and height. * `width` Integer * `height` Integer -* `animate` Boolean (optional) _OS X_ +* `animate` Boolean (optional) _macOS_ Resizes the window's client area (e.g. the web page) to `width` and `height`. @@ -593,37 +701,37 @@ Sets whether the window can be manually resized by user. Returns whether the window can be manually resized by user. -### `win.setMovable(movable)` _OS X_ _Windows_ +### `win.setMovable(movable)` _macOS_ _Windows_ * `movable` Boolean Sets whether the window can be moved by user. On Linux does nothing. -### `win.isMovable()` _OS X_ _Windows_ +### `win.isMovable()` _macOS_ _Windows_ Returns whether the window can be moved by user. On Linux always returns `true`. -### `win.setMinimizable(minimizable)` _OS X_ _Windows_ +### `win.setMinimizable(minimizable)` _macOS_ _Windows_ * `minimizable` Boolean Sets whether the window can be manually minimized by user. On Linux does nothing. -### `win.isMinimizable()` _OS X_ _Windows_ +### `win.isMinimizable()` _macOS_ _Windows_ Returns whether the window can be manually minimized by user. On Linux always returns `true`. -### `win.setMaximizable(maximizable)` _OS X_ _Windows_ +### `win.setMaximizable(maximizable)` _macOS_ _Windows_ * `maximizable` Boolean Sets whether the window can be manually maximized by user. On Linux does nothing. -### `win.isMaximizable()` _OS X_ _Windows_ +### `win.isMaximizable()` _macOS_ _Windows_ Returns whether the window can be manually maximized by user. On Linux always returns `true`. @@ -640,13 +748,13 @@ maximizes the window. Returns whether the maximize/zoom window button toggles fullscreen mode or maximizes the window. -### `win.setClosable(closable)` _OS X_ _Windows_ +### `win.setClosable(closable)` _macOS_ _Windows_ * `closable` Boolean Sets whether the window can be manually closed by user. On Linux does nothing. -### `win.isClosable()` _OS X_ _Windows_ +### `win.isClosable()` _macOS_ _Windows_ Returns whether the window can be manually closed by user. On Linux always returns `true`. @@ -671,7 +779,7 @@ Moves window to the center of the screen. * `x` Integer * `y` Integer -* `animate` Boolean (optional) _OS X_ +* `animate` Boolean (optional) _macOS_ Moves window to `x` and `y`. @@ -692,9 +800,9 @@ Returns the title of the native window. **Note:** The title of web page can be different from the title of the native window. -### `win.setSheetOffset(offsetY[, offsetX])` _OS X_ +### `win.setSheetOffset(offsetY[, offsetX])` _macOS_ -Changes the attachment point for sheets on Mac OS X. By default, sheets are +Changes the attachment point for sheets on macOS. By default, sheets are attached just below the window frame, but you may want to display them beneath a HTML-rendered toolbar. For example: @@ -729,7 +837,7 @@ Returns whether the window is in kiosk mode. Returns the platform-specific handle of the window as `Buffer`. -The native type of the handle is `HWND` on Windows, `NSView*` on OS X, and +The native type of the handle is `HWND` on Windows, `NSView*` on macOS, and `Window` (`unsigned long`) on Linux. ### `win.hookWindowMessage(message, callback)` _Windows_ @@ -756,25 +864,25 @@ Unhook the window message. Unhooks all of the window messages. -### `win.setRepresentedFilename(filename)` _OS X_ +### `win.setRepresentedFilename(filename)` _macOS_ * `filename` String Sets the pathname of the file the window represents, and the icon of the file will show in window's title bar. -### `win.getRepresentedFilename()` _OS X_ +### `win.getRepresentedFilename()` _macOS_ Returns the pathname of the file the window represents. -### `win.setDocumentEdited(edited)` _OS X_ +### `win.setDocumentEdited(edited)` _macOS_ * `edited` Boolean Specifies whether the window’s document has been edited, and the icon in title bar will become gray when set to `true`. -### `win.isDocumentEdited()` _OS X_ +### `win.isDocumentEdited()` _macOS_ Whether the window's document has been edited. @@ -835,14 +943,14 @@ screen readers Sets a 16 x 16 pixel overlay onto the current taskbar icon, usually used to convey some sort of application status or to passively notify the user. -### `win.setHasShadow(hasShadow)` _OS X_ +### `win.setHasShadow(hasShadow)` _macOS_ * `hasShadow` (Boolean) Sets whether the window should have a shadow. On Windows and Linux does nothing. -### `win.hasShadow()` _OS X_ +### `win.hasShadow()` _macOS_ Returns whether the window has a shadow. On Windows and Linux always returns `true`. @@ -883,7 +991,7 @@ The `flags` is an array that can include following `String`s: button state is drawn. This value is intended for instances where the button is used in a notification. -### `win.showDefinitionForSelection()` _OS X_ +### `win.showDefinitionForSelection()` _macOS_ Same as `webContents.showDefinitionForSelection()`. @@ -942,4 +1050,25 @@ All mouse events happened in this window will be passed to the window below this window, but if this window has focus, it will still receive keyboard events. +### `win.setFocusable(focusable)` _Windows_ + +* `focusable` Boolean + +Changes whether the window can be focused. + [blink-feature-string]: https://cs.chromium.org/chromium/src/third_party/WebKit/Source/platform/RuntimeEnabledFeatures.in + +### `win.setParentWindow(parent)` _Linux_ _macOS_ + +* `parent` BrowserWindow + +Sets `parent` as current window's parent window, passing `null` will turn +current window into a top-level window. + +### `win.getParentWindow()` + +Returns the parent window. + +### `win.getChildWindows()` + +Returns all child windows. diff --git a/docs/api/crash-reporter.md b/docs/api/crash-reporter.md index 1a07ac31d41..bd323de8839 100644 --- a/docs/api/crash-reporter.md +++ b/docs/api/crash-reporter.md @@ -42,7 +42,7 @@ The `crash-reporter` module has the following methods: You are required to call this method before using other `crashReporter` APIs. -**Note:** On OS X, Electron uses a new `crashpad` client, which is different +**Note:** On macOS, Electron uses a new `crashpad` client, which is different from `breakpad` on Windows and Linux. To enable the crash collection feature, you are required to call the `crashReporter.start` API to initialize `crashpad` in the main process and in each renderer process from which you wish to collect diff --git a/docs/api/dialog.md b/docs/api/dialog.md index c276f2e2d5b..afc32afda46 100644 --- a/docs/api/dialog.md +++ b/docs/api/dialog.md @@ -103,7 +103,7 @@ will be passed via `callback(filename)` * `cancelId` Integer - The value will be returned when user cancels the dialog instead of clicking the buttons of the dialog. By default it is the index of the buttons that have "cancel" or "no" as label, or 0 if there is no such - buttons. On OS X and Windows the index of "Cancel" button will always be + buttons. On macOS and Windows the index of "Cancel" button will always be used as `cancelId`, not matter whether it is already specified. * `noLink` Boolean - On Windows Electron will try to figure out which one of the `buttons` are common buttons (like "Cancel" or "Yes"), and show the @@ -129,7 +129,7 @@ and no GUI dialog will appear. ## Sheets -On Mac OS X, dialogs are presented as sheets attached to a window if you provide +On macOS, dialogs are presented as sheets attached to a window if you provide a `BrowserWindow` reference in the `browserWindow` parameter, or modals if no window is provided. diff --git a/docs/api/frameless-window.md b/docs/api/frameless-window.md index 66c42588b2b..b6b5926beef 100644 --- a/docs/api/frameless-window.md +++ b/docs/api/frameless-window.md @@ -18,9 +18,9 @@ const {BrowserWindow} = require('electron') let win = new BrowserWindow({width: 800, height: 600, frame: false}) ``` -### Alternatives on OS X +### Alternatives on macOS -On Mac OS X 10.10 Yosemite and newer, there's an alternative way to specify +On macOS 10.10 Yosemite and newer, there's an alternative way to specify a chromeless window. Instead of setting `frame` to `false` which disables both the titlebar and window controls, you may want to have the title bar hidden and your content extend to the full window size, yet still preserve @@ -50,7 +50,7 @@ let win = new BrowserWindow({transparent: true, frame: false}) * The `blur` filter only applies to the web page, so there is no way to apply blur effect to the content below the window (i.e. other applications open on the user's system). -* On Windows operation systems, transparent windows will not work when DWM is +* On Windows operating systems, transparent windows will not work when DWM is disabled. * On Linux users have to put `--enable-transparent-visuals --disable-gpu` in the command line to disable GPU and allow ARGB to make transparent window, diff --git a/docs/api/menu-item.md b/docs/api/menu-item.md index c12b14cc0bc..ec3fef55e57 100644 --- a/docs/api/menu-item.md +++ b/docs/api/menu-item.md @@ -52,18 +52,19 @@ The `role` property can have following values: * `minimize` - Minimize current window * `close` - Close current window -On OS X `role` can also have following additional values: +On macOS `role` can also have following additional values: * `about` - Map to the `orderFrontStandardAboutPanel` action * `hide` - Map to the `hide` action * `hideothers` - Map to the `hideOtherApplications` action * `unhide` - Map to the `unhideAllApplications` action * `front` - Map to the `arrangeInFront` action +* `zoom` - Map to the `performZoom` action * `window` - The submenu is a "Window" menu * `help` - The submenu is a "Help" menu * `services` - The submenu is a "Services" menu -When specifying `role` on OS X, `label` and `accelerator` are the only options +When specifying `role` on macOS, `label` and `accelerator` are the only options that will affect the MenuItem. All other options will be ignored. ## Instance Properties diff --git a/docs/api/menu.md b/docs/api/menu.md index 2b555fd83d6..7dea2c6b4cd 100644 --- a/docs/api/menu.md +++ b/docs/api/menu.md @@ -66,6 +66,15 @@ const template = [ accelerator: 'CmdOrCtrl+V', role: 'paste' }, + { + label: 'Paste and Match Style', + accelerator: 'Shift+Command+V', + role: 'pasteandmatchstyle' + }, + { + label: 'Delete', + role: 'delete' + }, { label: 'Select All', accelerator: 'CmdOrCtrl+A', @@ -174,7 +183,21 @@ if (process.platform === 'darwin') { ] }); // Window menu. - template[3].submenu.push( + template[3].submenu = [ + { + label: 'Close', + accelerator: 'CmdOrCtrl+W', + role: 'close' + }, + { + label: 'Minimize', + accelerator: 'CmdOrCtrl+M', + role: 'minimize' + }, + { + label: 'Zoom', + role: 'zoom' + }, { type: 'separator' }, @@ -182,7 +205,7 @@ if (process.platform === 'darwin') { label: 'Bring All to Front', role: 'front' } - ); + ]; } const menu = Menu.buildFromTemplate(template); @@ -203,10 +226,16 @@ The `menu` class has the following methods: * `menu` Menu -Sets `menu` as the application menu on OS X. On Windows and Linux, the `menu` +Sets `menu` as the application menu on macOS. On Windows and Linux, the `menu` will be set as each window's top menu. -### `Menu.sendActionToFirstResponder(action)` _OS X_ +**Note:** This API has to be called after the `ready` event of `app` module. + +### `Menu.getApplicationMenu()` + +Returns the application menu (an instance of `Menu`), if set, or `null`, if not set. + +### `Menu.sendActionToFirstResponder(action)` _macOS_ * `action` String @@ -214,8 +243,8 @@ Sends the `action` to the first responder of application. This is used for emulating default Cocoa menu behaviors, usually you would just use the `role` property of `MenuItem`. -See the [OS X Cocoa Event Handling Guide](https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/EventOverview/EventArchitecture/EventArchitecture.html#//apple_ref/doc/uid/10000060i-CH3-SW7) -for more information on OS X's native actions. +See the [macOS Cocoa Event Handling Guide](https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/EventOverview/EventArchitecture/EventArchitecture.html#//apple_ref/doc/uid/10000060i-CH3-SW7) +for more information on macOS' native actions. ### `Menu.buildFromTemplate(template)` @@ -236,7 +265,7 @@ The `menu` object has the following instance methods: * `browserWindow` BrowserWindow (optional) - Default is `null`. * `x` Number (optional) - Default is -1. * `y` Number (**required** if `x` is used) - Default is -1. -* `positioningItem` Number (optional) _OS X_ - The index of the menu item to +* `positioningItem` Number (optional) _macOS_ - The index of the menu item to be positioned under the mouse cursor at the specified coordinates. Default is -1. @@ -265,14 +294,14 @@ Inserts the `menuItem` to the `pos` position of the menu. Get an array containing the menu's items. -## Notes on OS X Application Menu +## Notes on macOS Application Menu -OS X has a completely different style of application menu from Windows and +macOS has a completely different style of application menu from Windows and Linux, here are some notes on making your app's menu more native-like. ### Standard Menus -On OS X there are many system defined standard menus, like the `Services` and +On macOS there are many system defined standard menus, like the `Services` and `Windows` menus. To make your menu a standard menu, you should set your menu's `role` to one of following and Electron will recognize them and make them become standard menus: @@ -283,13 +312,13 @@ become standard menus: ### Standard Menu Item Actions -OS X has provided standard actions for some menu items, like `About xxx`, +macOS has provided standard actions for some menu items, like `About xxx`, `Hide xxx`, and `Hide Others`. To set the action of a menu item to a standard action, you should set the `role` attribute of the menu item. ### Main Menu's Name -On OS X the label of application menu's first item is always your app's name, +On macOS the label of application menu's first item is always your app's name, no matter what label you set. To change it you have to change your app's name by modifying your app bundle's `Info.plist` file. See [About Information Property List Files][AboutInformationPropertyListFiles] for more information. diff --git a/docs/api/native-image.md b/docs/api/native-image.md index d61f57ee4b9..d2a2926ca6d 100644 --- a/docs/api/native-image.md +++ b/docs/api/native-image.md @@ -81,7 +81,7 @@ mixed with other content to create the desired final appearance. The most common case is to use template images for a menu bar icon so it can adapt to both light and dark menu bars. -**Note:** Template image is only supported on OS X. +**Note:** Template image is only supported on macOS. To mark an image as a template image, its filename should end with the word `Template`. For example: @@ -141,10 +141,10 @@ Returns a [Buffer][buffer] that contains the image's `JPEG` encoded data. Returns the data URL of the image. -### `image.getNativeHandle()` _OS X_ +### `image.getNativeHandle()` _macOS_ Returns a [Buffer][buffer] that stores C pointer to underlying native handle of -the image. On OS X, a pointer to `NSImage` instance would be returned. +the image. On macOS, a pointer to `NSImage` instance would be returned. Notice that the returned pointer is a weak pointer to the underlying native image instead of a copy, so you _must_ ensure that the associated diff --git a/docs/api/process.md b/docs/api/process.md index 37cc81f76a8..3bd8f1a4f27 100644 --- a/docs/api/process.md +++ b/docs/api/process.md @@ -74,7 +74,7 @@ Causes the main thread of the current process crash. Causes the main thread of the current process hang. -### `process.setFdLimit(maxDescriptors)` _OS X_ _Linux_ +### `process.setFdLimit(maxDescriptors)` _macOS_ _Linux_ * `maxDescriptors` Integer diff --git a/docs/api/screen.md b/docs/api/screen.md index 440c99ac3f0..d5318d8fc02 100644 --- a/docs/api/screen.md +++ b/docs/api/screen.md @@ -2,7 +2,7 @@ > Retrieve information about screen size, displays, cursor position, etc. -You cannot not use this module until the `ready` event of the `app` module is +You cannot use this module until the `ready` event of the `app` module is emitted (by invoking or requiring it). `screen` is an [EventEmitter](http://nodejs.org/api/events.html#events_class_events_eventemitter). diff --git a/docs/api/shell.md b/docs/api/shell.md index 780e99a0fc1..a1c01f0fbc7 100644 --- a/docs/api/shell.md +++ b/docs/api/shell.md @@ -31,7 +31,7 @@ Open the given file in the desktop's default manner. ### `shell.openExternal(url[, options])` * `url` String -* `options` Object (optional) _OS X_ +* `options` Object (optional) _macOS_ * `activate` Boolean - `true` to bring the opened application to the foreground. The default is `true`. diff --git a/docs/api/system-preferences.md b/docs/api/system-preferences.md index 7b2f0724a4a..a47975d0974 100644 --- a/docs/api/system-preferences.md +++ b/docs/api/system-preferences.md @@ -2,18 +2,23 @@ > Get system preferences. +```javascript +const {systemPreferences} = require('electron'); +console.log(systemPreferences.isDarkMode()); +``` + ## Methods -### `systemPreferences.isDarkMode()` _OS X_ +### `systemPreferences.isDarkMode()` _macOS_ This method returns `true` if the system is in Dark Mode, and `false` otherwise. -### `systemPreferences.subscribeNotification(event, callback)` _OS X_ +### `systemPreferences.subscribeNotification(event, callback)` _macOS_ * `event` String * `callback` Function -Subscribes to native notifications of OS X, `callback` will be called with +Subscribes to native notifications of macOS, `callback` will be called with `callback(event, userInfo)` when the corresponding `event` happens. The `userInfo` is an Object that contains the user information dictionary sent along with the notification. @@ -29,13 +34,13 @@ example values of `event` are: * `AppleColorPreferencesChangedNotification` * `AppleShowScrollBarsSettingChanged` -### `systemPreferences.unsubscribeNotification(id)` _OS X_ +### `systemPreferences.unsubscribeNotification(id)` _macOS_ * `id` Integer Removes the subscriber with `id`. -### `systemPreferences.getUserDefault(key, type)` _OS X_ +### `systemPreferences.getUserDefault(key, type)` _macOS_ * `key` String * `type` String - Can be `string`, `boolean`, `integer`, `float`, `double`, @@ -43,7 +48,7 @@ Removes the subscriber with `id`. Get the value of `key` in system preferences. -This API reads from `NSUserDefaults` on OS X, some popular `key` and `type`s +This API reads from `NSUserDefaults` on macOS, some popular `key` and `type`s are: * `AppleInterfaceStyle: string` diff --git a/docs/api/tray.md b/docs/api/tray.md index 421d4fcf63d..902444e5336 100644 --- a/docs/api/tray.md +++ b/docs/api/tray.md @@ -71,9 +71,9 @@ labeled as such. Emitted when the tray icon is clicked. -**Note:** The `bounds` payload is only implemented on OS X and Windows. +**Note:** The `bounds` payload is only implemented on macOS and Windows. -### Event: 'right-click' _OS X_ _Windows_ +### Event: 'right-click' _macOS_ _Windows_ * `event` Event * `altKey` Boolean @@ -88,7 +88,7 @@ Emitted when the tray icon is clicked. Emitted when the tray icon is right clicked. -### Event: 'double-click' _OS X_ _Windows_ +### Event: 'double-click' _macOS_ _Windows_ * `event` Event * `altKey` Boolean @@ -116,26 +116,26 @@ Emitted when the tray balloon is clicked. Emitted when the tray balloon is closed because of timeout or user manually closes it. -### Event: 'drop' _OS X_ +### Event: 'drop' _macOS_ Emitted when any dragged items are dropped on the tray icon. -### Event: 'drop-files' _OS X_ +### Event: 'drop-files' _macOS_ * `event` * `files` Array - the file path of dropped files. Emitted when dragged files are dropped in the tray icon. -### Event: 'drag-enter' _OS X_ +### Event: 'drag-enter' _macOS_ Emitted when a drag operation enters the tray icon. -### Event: 'drag-leave' _OS X_ +### Event: 'drag-leave' _macOS_ Emitted when a drag operation exits the tray icon. -### Event: 'drag-end' _OS X_ +### Event: 'drag-end' _macOS_ Emitted when a drag operation ends on the tray or ends at another location. @@ -156,11 +156,11 @@ Destroys the tray icon immediately. Sets the `image` associated with this tray icon. -### `Tray.setPressedImage(image)` _OS X_ +### `Tray.setPressedImage(image)` _macOS_ * `image` [NativeImage](native-image.md) -Sets the `image` associated with this tray icon when pressed on OS X. +Sets the `image` associated with this tray icon when pressed on macOS. ### `Tray.setToolTip(toolTip)` @@ -168,13 +168,13 @@ Sets the `image` associated with this tray icon when pressed on OS X. Sets the hover text for this tray icon. -### `Tray.setTitle(title)` _OS X_ +### `Tray.setTitle(title)` _macOS_ * `title` String Sets the title displayed aside of the tray icon in the status bar. -### `Tray.setHighlightMode(highlight)` _OS X_ +### `Tray.setHighlightMode(highlight)` _macOS_ * `highlight` Boolean @@ -190,15 +190,15 @@ when the tray icon is clicked. Defaults to true. Displays a tray balloon. -### `Tray.popUpContextMenu([menu, position])` _OS X_ _Windows_ +### `Tray.popUpContextMenu([menu, position])` _macOS_ _Windows_ * `menu` Menu (optional) * `position` Object (optional) - The pop up position. * `x` Integer * `y` Integer -Popups the context menu of tray icon. When `menu` is passed, the `menu` will -showed instead of the tray's context menu. +Pops up the context menu of the tray icon. When `menu` is passed, the `menu` will +be shown instead of the tray icon's context menu. The `position` is only available on Windows, and it is (0, 0) by default. diff --git a/docs/api/web-contents.md b/docs/api/web-contents.md index 60c736e0041..fec4708d1c6 100644 --- a/docs/api/web-contents.md +++ b/docs/api/web-contents.md @@ -325,8 +325,8 @@ Returns: * `event` Event * `params` Object - * `x` Integer - x coodinate - * `y` Integer - y coodinate + * `x` Integer - x coordinate + * `y` Integer - y coordinate * `linkURL` String - URL of the link that encloses the node the context menu was invoked on. * `linkText` String - Text associated with the link. May be an empty @@ -957,7 +957,7 @@ win.webContents.on('did-finish-load', () => { }); ``` -### `webContents.showDefinitionForSelection()` _OS X_ +### `webContents.showDefinitionForSelection()` _macOS_ Shows pop-up dictionary that searches the selected word on the page. diff --git a/docs/api/web-frame.md b/docs/api/web-frame.md index a933b8b4813..1ad5589bfb4 100644 --- a/docs/api/web-frame.md +++ b/docs/api/web-frame.md @@ -141,7 +141,7 @@ previous navigation). Note that blindly calling this method probably makes Electron slower since it will have to refill these emptied caches, you should only call it if an event -in your app has occured that makes you think your page is actually using less +in your app has occurred that makes you think your page is actually using less memory (i.e. you have navigated from a super heavy page to a mostly empty one, and intend to stay there). diff --git a/docs/api/web-view-tag.md b/docs/api/web-view-tag.md index c210bd8b9cb..25725cecea2 100644 --- a/docs/api/web-view-tag.md +++ b/docs/api/web-view-tag.md @@ -490,7 +490,7 @@ Sends an input `event` to the page. See [webContents.sendInputEvent](web-contents.md##webcontentssendinputeventevent) for detailed description of `event` object. -### `.showDefinitionForSelection()` _OS X_ +### `.showDefinitionForSelection()` _macOS_ Shows pop-up dictionary that searches the selected word on the page. diff --git a/docs/development/build-instructions-osx.md b/docs/development/build-instructions-osx.md index b703a75897d..13ac616603f 100644 --- a/docs/development/build-instructions-osx.md +++ b/docs/development/build-instructions-osx.md @@ -1,10 +1,10 @@ -# Build Instructions (OS X) +# Build Instructions (macOS) -Follow the guidelines below for building Electron on OS X. +Follow the guidelines below for building Electron on macOS. ## Prerequisites -* OS X >= 10.8 +* macOS >= 10.8 * [Xcode](https://developer.apple.com/technologies/tools/) >= 5.1 * [node.js](http://nodejs.org) (external) @@ -48,8 +48,8 @@ After building is done, you can find `Electron.app` under `out/D`. ## 32bit Support -Electron can only be built for a 64bit target on OS X and there is no plan to -support 32bit OS X in future. +Electron can only be built for a 64bit target on macOS and there is no plan to +support 32bit macOS in future. ## Tests diff --git a/docs/styleguide.md b/docs/styleguide.md index a34889d2ca3..44afe2aadb8 100644 --- a/docs/styleguide.md +++ b/docs/styleguide.md @@ -24,7 +24,7 @@ These are the ways that we construct the Electron documentation. - Optional arguments are denoted when called out in list. - Line length is 80-column wrapped. - Platform specific methods are noted in italics following method header. - - ```### `method(foo, bar)` _OS X_``` + - ```### `method(foo, bar)` _macOS_``` - Prefer 'in the ___ process' over 'on' ### Documentation Translations diff --git a/docs/tutorial/application-distribution.md b/docs/tutorial/application-distribution.md index 4d3e12db75f..7eeea8dcd14 100644 --- a/docs/tutorial/application-distribution.md +++ b/docs/tutorial/application-distribution.md @@ -1,11 +1,11 @@ # Application Distribution To distribute your app with Electron, the folder containing your app should be -named `app` and placed under Electron's resources directory (on OS X it is +named `app` and placed under Electron's resources directory (on macOS it is `Electron.app/Contents/Resources/` and on Linux and Windows it is `resources/`), like this: -On OS X: +On macOS: ```text electron/Electron.app/Contents/Resources/app/ @@ -37,7 +37,7 @@ To use an `asar` archive to replace the `app` folder, you need to rename the archive to `app.asar`, and put it under Electron's resources directory like below, and Electron will then try to read the archive and start from it. -On OS X: +On macOS: ```text electron/Electron.app/Contents/Resources/ @@ -63,7 +63,7 @@ before distributing it to users. You can rename `electron.exe` to any name you like, and edit its icon and other information with tools like [rcedit](https://github.com/atom/rcedit). -### OS X +### macOS You can rename `Electron.app` to any name you want, and you also have to rename the `CFBundleDisplayName`, `CFBundleIdentifier` and `CFBundleName` fields in diff --git a/docs/tutorial/desktop-environment-integration.md b/docs/tutorial/desktop-environment-integration.md index c552abbf949..adb08ad5dc4 100644 --- a/docs/tutorial/desktop-environment-integration.md +++ b/docs/tutorial/desktop-environment-integration.md @@ -8,7 +8,7 @@ applications can put a custom menu in the dock menu. This guide explains how to integrate your application into those desktop environments with Electron APIs. -## Notifications (Windows, Linux, OS X) +## Notifications (Windows, Linux, macOS) All three operating systems provide means for applications to send notifications to the user. Electron conveniently allows developers to send notifications with @@ -50,17 +50,17 @@ desktop environment that follows [Desktop Notifications Specification][notification-spec], including Cinnamon, Enlightenment, Unity, GNOME, KDE. -### OS X +### macOS -Notifications are straight-forward on OS X, you should however be aware of +Notifications are straight-forward on macOS, you should however be aware of [Apple's Human Interface guidelines regarding notifications](https://developer.apple.com/library/mac/documentation/UserExperience/Conceptual/OSXHIGuidelines/NotificationCenter.html). Note that notifications are limited to 256 bytes in size - and will be truncated if you exceed that limit. -## Recent documents (Windows & OS X) +## Recent documents (Windows & macOS) -Windows and OS X provide easy access to a list of recent documents opened by +Windows and macOS provide easy access to a list of recent documents opened by the application via JumpList or dock menu, respectively. __JumpList:__ @@ -95,14 +95,14 @@ on registering your application in [Application Registration][app-registration]. When a user clicks a file from the JumpList, a new instance of your application will be started with the path of the file added as a command line argument. -### OS X Notes +### macOS Notes When a file is requested from the recent documents menu, the `open-file` event of `app` module will be emitted for it. -## Custom Dock Menu (OS X) +## Custom Dock Menu (macOS) -OS X enables developers to specify a custom menu for the dock, which usually +macOS enables developers to specify a custom menu for the dock, which usually contains some shortcuts for commonly used features of your application: __Dock menu of Terminal.app:__ @@ -110,7 +110,7 @@ __Dock menu of Terminal.app:__ To set your custom dock menu, you can use the `app.dock.setMenu` API, which is -only available on OS X: +only available on macOS: ```javascript const electron = require('electron'); @@ -154,7 +154,7 @@ __Tasks of Internet Explorer:__ ![IE](http://i.msdn.microsoft.com/dynimg/IC420539.png) -Unlike the dock menu in OS X which is a real menu, user tasks in Windows work +Unlike the dock menu in macOS which is a real menu, user tasks in Windows work like application shortcuts such that when user clicks a task, a program will be executed with specified arguments. @@ -221,7 +221,7 @@ win.setThumbarButtons([ { tooltip: 'button1', icon: path.join(__dirname, 'button1.png'), - click() { console.log('button2 clicked'); } + click() { console.log('button1 clicked'); } }, { tooltip: 'button2', @@ -248,13 +248,13 @@ __Launcher shortcuts of Audacious:__ ![audacious](https://help.ubuntu.com/community/UnityLaunchersAndDesktopFiles?action=AttachFile&do=get&target=shortcuts.png) -## Progress Bar in Taskbar (Windows, OS X, Unity) +## Progress Bar in Taskbar (Windows, macOS, Unity) On Windows a taskbar button can be used to display a progress bar. This enables a window to provide progress information to the user without the user having to switch to the window itself. -On OS X the progress bar will be displayed as a part of the dock icon. +On macOS the progress bar will be displayed as a part of the dock icon. The Unity DE also has a similar feature that allows you to specify the progress bar in the launcher. @@ -298,9 +298,9 @@ let win = new BrowserWindow({...}); win.setOverlayIcon('path/to/overlay.png', 'Description for overlay'); ``` -## Represented File of Window (OS X) +## Represented File of Window (macOS) -On OS X a window can set its represented file, so the file's icon can show in +On macOS a window can set its represented file, so the file's icon can show in the title bar and when users Command-Click or Control-Click on the title a path popup will show. diff --git a/docs/tutorial/devtools-extension.md b/docs/tutorial/devtools-extension.md index 94f5ac13bf6..631d0ad0eb7 100644 --- a/docs/tutorial/devtools-extension.md +++ b/docs/tutorial/devtools-extension.md @@ -21,7 +21,7 @@ Using the [React Developer Tools][react-devtools] as example: * `~/.config/google-chrome-beta/Default/Extensions/` * `~/.config/google-chrome-canary/Default/Extensions/` * `~/.config/chromium/Default/Extensions/` - * on OS X it is `~/Library/Application Support/Google/Chrome/Default/Extensions`. + * on macOS it is `~/Library/Application Support/Google/Chrome/Default/Extensions`. 1. Pass the location of the extension to `BrowserWindow.addDevToolsExtension` API, for the React Developer Tools, it is something like: `~/Library/Application Support/Google/Chrome/Default/Extensions/fmkadmapgofadopljbjfkapdkoienihi/0.14.10_0` @@ -45,7 +45,7 @@ Following Devtools Extensions are tested and guaranteed to work in Electron: ### What should I do if a DevTools Extension is not working? -Fist please make sure the extension is still being maintained, some extensions +First please make sure the extension is still being maintained, some extensions can not even work for recent versions of Chrome browser, and we are not able to do anything for them. diff --git a/docs/tutorial/mac-app-store-submission-guide.md b/docs/tutorial/mac-app-store-submission-guide.md index b2c08e8849f..c7ed9162fdc 100644 --- a/docs/tutorial/mac-app-store-submission-guide.md +++ b/docs/tutorial/mac-app-store-submission-guide.md @@ -116,7 +116,7 @@ codesign -s "$APP_KEY" -f --entitlements "$PARENT_PLIST" "$APP_PATH" productbuild --component "$APP_PATH" /Applications --sign "$INSTALLER_KEY" "$RESULT_PATH" ``` -If you are new to app sandboxing under OS X, you should also read through +If you are new to app sandboxing under macOS, you should also read through Apple's [Enabling App Sandbox][enable-app-sandbox] to have a basic idea, then add keys for the permissions needed by your app to the entitlements files. @@ -166,6 +166,32 @@ Also, due to the usage of app sandboxing, the resources which can be accessed by the app are strictly limited; you can read [App Sandboxing][app-sandboxing] for more information. +### Additional Entitlements + +Depending on which Electron APIs your app uses, you may need to add additional +entitlements to your `parent.plist` file to be able to use these APIs from your +app's Mac App Store build. + +#### dialog.showOpenDialog + +```xml +com.apple.security.files.user-selected.read-only + +``` + +See the [Enabling User-Selected File Access documentation][user-selected] for +more details. + +#### dialog.showSaveDialog + +```xml +com.apple.security.files.user-selected.read-write + +``` + +See the [Enabling User-Selected File Access documentation][user-selected] for +more details. + ## Cryptographic Algorithms Used by Electron Depending on the country and region you are located, Mac App Store may require @@ -213,3 +239,4 @@ ERN)][ern-tutorial]. [app-sandboxing]: https://developer.apple.com/app-sandboxing/ [ern-tutorial]: https://carouselapps.com/2015/12/15/legally-submit-app-apples-app-store-uses-encryption-obtain-ern/ [temporary-exception]: https://developer.apple.com/library/mac/documentation/Miscellaneous/Reference/EntitlementKeyReference/Chapters/AppSandboxTemporaryExceptionEntitlements.html +[user-selected]: https://developer.apple.com/library/mac/documentation/Miscellaneous/Reference/EntitlementKeyReference/Chapters/EnablingAppSandbox.html#//apple_ref/doc/uid/TP40011195-CH4-SW6 diff --git a/docs/tutorial/quick-start.md b/docs/tutorial/quick-start.md index 59ee27602b3..59bfb4bb26b 100644 --- a/docs/tutorial/quick-start.md +++ b/docs/tutorial/quick-start.md @@ -116,7 +116,7 @@ app.on('ready', createWindow); // Quit when all windows are closed. app.on('window-all-closed', () => { - // On OS X it is common for applications and their menu bar + // On macOS it is common for applications and their menu bar // to stay active until the user quits explicitly with Cmd + Q if (process.platform !== 'darwin') { app.quit(); @@ -124,7 +124,7 @@ app.on('window-all-closed', () => { }); app.on('activate', () => { - // On OS X it's common to re-create a window in the app when the + // On macOS it's common to re-create a window in the app when the // dock icon is clicked and there are no other windows open. if (win === null) { createWindow(); @@ -194,7 +194,7 @@ $ .\electron\electron.exe your-app\ $ ./electron/electron your-app/ ``` -#### OS X +#### macOS ```bash $ ./Electron.app/Contents/MacOS/Electron your-app/ diff --git a/docs/tutorial/security.md b/docs/tutorial/security.md index 2ac25d135eb..ca8bd3a4b7f 100644 --- a/docs/tutorial/security.md +++ b/docs/tutorial/security.md @@ -56,7 +56,7 @@ This is not bulletproof, but at the least, you should attempt the following: (using `webPreferences`) * Do not disable `webSecurity`. Disabling it will disable the same-origin policy. * Define a [`Content-Security-Policy`](http://www.html5rocks.com/en/tutorials/security/content-security-policy/) -, and use restrictive rules (ie: `script-src 'self'`) +, and use restrictive rules (i.e. `script-src 'self'`) * [Override and disable `eval`](https://github.com/nylas/N1/blob/0abc5d5defcdb057120d726b271933425b75b415/static/index.js#L6) , which allows strings to be executed as code. * Do not set `allowDisplayingInsecureContent` to true. diff --git a/docs/tutorial/supported-platforms.md b/docs/tutorial/supported-platforms.md index a7f736995d2..322ee422268 100644 --- a/docs/tutorial/supported-platforms.md +++ b/docs/tutorial/supported-platforms.md @@ -2,10 +2,10 @@ Following platforms are supported by Electron: -### OS X +### macOS -Only 64bit binaries are provided for OS X, and the minimum OS X version -supported is OS X 10.9. +Only 64bit binaries are provided for macOS, and the minimum macOS version +supported is macOS 10.9. ### Windows diff --git a/docs/tutorial/testing-on-headless-ci.md b/docs/tutorial/testing-on-headless-ci.md index 5e75235d4f2..557c358b12b 100644 --- a/docs/tutorial/testing-on-headless-ci.md +++ b/docs/tutorial/testing-on-headless-ci.md @@ -20,11 +20,11 @@ for `$DISPLAY`, so no further configuration of your app is required. This step can be automated with Paul Betts's [xvfb-maybe](https://github.com/paulcbetts/xvfb-maybe): Prepend your test commands with `xvfb-maybe` and the little tool will automatically configure -xvfb, if required by the current system. On Windows or Mac OS X, it will simply +xvfb, if required by the current system. On Windows or macOS, it will simply do nothing. ``` -## On Windows or OS X, this just invokes electron-mocha +## On Windows or macOS, this just invokes electron-mocha ## On Linux, if we are in a headless environment, this will be equivalent ## to xvfb-run electron-mocha ./test/*.js xvfb-maybe electron-mocha ./test/*.js @@ -34,7 +34,7 @@ xvfb-maybe electron-mocha ./test/*.js On Travis, your `.travis.yml` should look roughly like this: -``` +```yml addons: apt: packages: diff --git a/docs/tutorial/using-native-node-modules.md b/docs/tutorial/using-native-node-modules.md index f73c1cde1f0..1b7dbeda2c4 100644 --- a/docs/tutorial/using-native-node-modules.md +++ b/docs/tutorial/using-native-node-modules.md @@ -1,67 +1,93 @@ # Using Native Node Modules -The native Node modules are supported by Electron, but since Electron is -using a different V8 version from official Node, you have to manually specify -the location of Electron's headers when building native modules. +The native Node modules are supported by Electron, but since Electron is very +likely to use a different V8 version from the Node binary installed in your +system, you have to manually specify the location of Electron's headers when +building native modules. -## Native Node Module Compatibility - -Native modules might break when Node starts using a new version of V8. -To make sure the module you're interested in will work with Electron, you should -check if it supports the internal Node version used by Electron. -You can check what version of Node is used in Electron by looking it up in -the [releases](https://github.com/electron/electron/releases) page or by using -`process.version` (see [Quick Start](https://github.com/electron/electron/blob/master/docs/tutorial/quick-start.md) -for example). - -Consider using [NAN](https://github.com/nodejs/nan/) for your own modules, since -it makes it easier to support multiple versions of Node. It's also helpful for -porting old modules to newer versions of Node so they can work with Electron. - -## How to Install Native Modules +## How to install native modules Three ways to install native modules: -### The Easy Way +### Using `npm` -The most straightforward way to rebuild native modules is via the -[`electron-rebuild`](https://github.com/paulcbetts/electron-rebuild) package, -which handles the manual steps of downloading headers and building native modules: +By setting a few environment variables, you can use `npm` to install modules +directly. -```sh +An example of installing all dependencies for Electron: + +```bash +# Electron's version. +export npm_config_target=1.2.3 +# The architecture of Electron, can be ia32 or x64. +export npm_config_arch=x64 +# Download headers for Electron. +export npm_config_disturl=https://atom.io/download/atom-shell +# Tell node-pre-gyp that we are building for Electron. +export npm_config_runtime=electron +# Tell node-pre-gyp to build module from source code. +export npm_config_build_from_source=true +# Install all dependencies, and store cache to ~/.electron-gyp. +HOME=~/.electron-gyp npm install +``` + +### Installing modules and rebuilding for Electron + +You can also choose to install modules like other Node projects, and then +rebuild the modules for Electron with the [`electron-rebuild`][electron-rebuild] +package. This module can get the version of Electron and handle the manual steps +of downloading headers and building native modules for your. + +An example of installing `electron-rebuild` and then rebuild modules with it: + +```bash npm install --save-dev electron-rebuild -# Every time you run "npm install", run this +# Every time you run "npm install", run this: ./node_modules/.bin/electron-rebuild # On Windows if you have trouble, try: .\node_modules\.bin\electron-rebuild.cmd ``` -### The npm Way +### Manually building for Electron -You can also use `npm` to install modules. The steps are exactly the same with -Node modules, except that you need to setup some environment variables: +If you are a developer developing a native module and want to test it against +Electron, you might want to rebuild the module for Electron manually. You can +use `node-gyp` directly to build for Electron: ```bash -export npm_config_disturl=https://atom.io/download/atom-shell -export npm_config_target=0.33.1 -export npm_config_arch=x64 -export npm_config_runtime=electron -HOME=~/.electron-gyp npm install module-name -``` - -### The node-gyp Way - -To build Node modules with headers of Electron, you need to tell `node-gyp` -where to download headers and which version to use: - -```bash -$ cd /path-to-module/ -$ HOME=~/.electron-gyp node-gyp rebuild --target=0.29.1 --arch=x64 --dist-url=https://atom.io/download/atom-shell +cd /path-to-module/ +HOME=~/.electron-gyp node-gyp rebuild --target=1.2.3 --arch=x64 --dist-url=https://atom.io/download/atom-shell ``` The `HOME=~/.electron-gyp` changes where to find development headers. The -`--target=0.29.1` is version of Electron. The `--dist-url=...` specifies +`--target=1.2.3` is version of Electron. The `--dist-url=...` specifies where to download the headers. The `--arch=x64` says the module is built for 64bit system. + +## Troubleshooting + +If you installed a native module and found it was not working, you need to check +following things: + +* The architecture of module has to match Electron's architecture (ia32 or x64). +* After you upgraded Electron, you usually need to rebuild the modules. +* When in doubt, run `electron-rebuild` first. + +## Modules that rely on `node-pre-gyp` + +The [`node-pre-gyp` tool][node-pre-gyp] provides a way to deploy native Node +modules with prebuilt binaries, and many popular modules are using it. + +Usually those modules work fine under Electron, but sometimes when Electron uses +a newer version of V8 than Node, and there are ABI changes, bad things may +happen. So in general it is recommended to always build native modules from +source code. + +If you are following the `npm` way of installing modules, then this is done +by default, if not, you have to pass `--build-from-source` to `npm`, or set the +`npm_config_build_from_source` environment variable. + +[electron-rebuild]: https://github.com/paulcbetts/electron-rebuild +[node-pre-gyp]: https://github.com/mapbox/node-pre-gyp diff --git a/docs/tutorial/using-pepper-flash-plugin.md b/docs/tutorial/using-pepper-flash-plugin.md index 9ff6ebf00eb..349d7c0e9f6 100644 --- a/docs/tutorial/using-pepper-flash-plugin.md +++ b/docs/tutorial/using-pepper-flash-plugin.md @@ -6,27 +6,37 @@ and then enable it in your application. ## Prepare a Copy of Flash Plugin -On OS X and Linux, the details of the Pepper Flash plugin can be found by +On macOS and Linux, the details of the Pepper Flash plugin can be found by navigating to `chrome://plugins` in the Chrome browser. Its location and version are useful for Electron's Pepper Flash support. You can also copy it to another location. ## Add Electron Switch -You can directly add `--ppapi-flash-path` and `ppapi-flash-version` to the +You can directly add `--ppapi-flash-path` and `--ppapi-flash-version` to the Electron command line or by using the `app.commandLine.appendSwitch` method before the app ready event. Also, turn on `plugins` option of `BrowserWindow`. + For example: ```javascript -// Specify flash path. -// On Windows, it might be /path/to/pepflashplayer.dll or just pepflashplayer.dll if it resides main.js -// On OS X, /path/to/PepperFlashPlayer.plugin -// On Linux, /path/to/libpepflashplayer.so -app.commandLine.appendSwitch('ppapi-flash-path', '/path/to/libpepflashplayer.so'); +// Specify flash path, supposing it is placed in the same directory with main.js. +let pluginName +switch (process.platform) { + case 'win32': + pluginName = 'pepflashplayer.dll' + break + case 'darwin': + pluginName = 'PepperFlashPlayer.plugin' + break + case 'linux': + pluginName = 'libpepflashplayer.so' + break +} +app.commandLine.appendSwitch('ppapi-flash-path', path.join(__dirname, pluginName)) // Optional: Specify flash version, for example, v17.0.0.169 -app.commandLine.appendSwitch('ppapi-flash-version', '17.0.0.169'); +app.commandLine.appendSwitch('ppapi-flash-version', '17.0.0.169') app.on('ready', () => { win = new BrowserWindow({ @@ -35,13 +45,15 @@ app.on('ready', () => { webPreferences: { plugins: true } - }); - win.loadURL(`file://${__dirname}/index.html`); + }) + win.loadURL(`file://${__dirname}/index.html`) // Something else }); ``` -The path to the system wide Pepper Flash plugin can also be obtained by calling `app.getPath('pepperFlashSystemPlugin')`. +You can also try loading the system wide Pepper Flash plugin instead of shipping +the plugins yourself, its path can be received by calling +`app.getPath('pepperFlashSystemPlugin')`. ## Enable Flash Plugin in a `` Tag @@ -60,3 +72,6 @@ plugin's path is correct). The architecture of Pepper Flash plugin has to match Electron's one. On Windows, a common error is to use 32bit version of Flash plugin against 64bit version of Electron. + +On Windows the path passed to `--ppapi-flash-path` has to use `\` as path +delimiter, using POSIX-style paths will not work. diff --git a/docs/tutorial/using-selenium-and-webdriver.md b/docs/tutorial/using-selenium-and-webdriver.md index 4002f012241..50727c7169f 100644 --- a/docs/tutorial/using-selenium-and-webdriver.md +++ b/docs/tutorial/using-selenium-and-webdriver.md @@ -39,12 +39,12 @@ app.start().then(function () { }).then(function (title) { // Verify the window's title assert.equal(title, 'My App') -}).then(function () { - // Stop the application - return app.stop() }).catch(function (error) { // Log any failures console.error('Test failed', error.message) +}).then(function () { + // Stop the application + return app.stop() }) ``` diff --git a/docs/tutorial/using-widevine-cdm-plugin.md b/docs/tutorial/using-widevine-cdm-plugin.md index af1337c5eae..b7b37c58a99 100644 --- a/docs/tutorial/using-widevine-cdm-plugin.md +++ b/docs/tutorial/using-widevine-cdm-plugin.md @@ -12,7 +12,7 @@ the architecture and Chrome version of the Electron build you use. version used by Electron, otherwise the plugin will not work even though `navigator.plugins` would show it has been loaded. -### Windows & OS X +### Windows & macOS Open `chrome://components/` in Chrome browser, find `WidevineCdm` and make sure it is up to date, then you can find all the plugin binaries from the @@ -20,12 +20,12 @@ sure it is up to date, then you can find all the plugin binaries from the directory. `APP_DATA` is system's location for storing app data, on Windows it is -`%LOCALAPPDATA%`, on OS X it is `~/Library/Application Support`. `VERSION` is +`%LOCALAPPDATA%`, on macOS it is `~/Library/Application Support`. `VERSION` is Widevine CDM plugin's version string, like `1.4.8.866`. `PLATFORM` is `mac` or `win`. `ARCH` is `x86` or `x64`. On Windows the required binaries are `widevinecdm.dll` and -`widevinecdmadapter.dll`, on OS X they are `libwidevinecdm.dylib` and +`widevinecdmadapter.dll`, on macOS they are `libwidevinecdm.dylib` and `widevinecdmadapter.plugin`. You can copy them to anywhere you like, but they have to be put together. @@ -52,7 +52,7 @@ Example code: ```javascript // You have to pass the filename of `widevinecdmadapter` here, it is -// * `widevinecdmadapter.plugin` on OS X, +// * `widevinecdmadapter.plugin` on macOS, // * `libwidevinecdmadapter.so` on Linux, // * `widevinecdmadapter.dll` on Windows. app.commandLine.appendSwitch('widevine-cdm-path', '/path/to/widevinecdmadapter.plugin'); diff --git a/docs/tutorial/windows-store-guide.md b/docs/tutorial/windows-store-guide.md index 6378ccb25a2..7a5108d66ba 100644 --- a/docs/tutorial/windows-store-guide.md +++ b/docs/tutorial/windows-store-guide.md @@ -104,7 +104,7 @@ folder. Once the expanded AppX files are created, the tool uses the Windows App Packager (`MakeAppx.exe`) to create a single-file AppX package from those files on disk. Finally, the tool can be used to create a trusted certificate on your computer -to sign the new AppX pacakge. With the signed AppX package, the CLI can also +to sign the new AppX package. With the signed AppX package, the CLI can also automatically install the package on your machine. ## Step 3: Using the AppX Package @@ -157,4 +157,4 @@ Once installation succeeded, you can move on to compiling your Electron app. [add-appxpackage]: https://technet.microsoft.com/en-us/library/hh856048.aspx [electron-packager]: https://github.com/electron-userland/electron-packager [electron-windows-store]: https://github.com/catalystcode/electron-windows-store -[background-task]: https://github.com/felixrieseberg/electron-uwp-background \ No newline at end of file +[background-task]: https://github.com/felixrieseberg/electron-uwp-background diff --git a/electron.gyp b/electron.gyp index 994cdcea899..09c1e279793 100644 --- a/electron.gyp +++ b/electron.gyp @@ -4,7 +4,7 @@ 'product_name%': 'Electron', 'company_name%': 'GitHub, Inc', 'company_abbr%': 'github', - 'version%': '1.2.2', + 'version%': '1.2.3', }, 'includes': [ 'filenames.gypi', diff --git a/filenames.gypi b/filenames.gypi index 2b87e36fa4d..af7080821b4 100644 --- a/filenames.gypi +++ b/filenames.gypi @@ -63,8 +63,10 @@ 'lib/renderer/api/remote.js', 'lib/renderer/api/screen.js', 'lib/renderer/api/web-frame.js', + 'lib/renderer/extensions/event.js', 'lib/renderer/extensions/i18n.js', 'lib/renderer/extensions/storage.js', + 'lib/renderer/extensions/web-navigation.js', ], 'js2c_sources': [ 'lib/common/asar.js', @@ -284,6 +286,8 @@ 'atom/browser/ui/win/notify_icon.h', 'atom/browser/ui/win/taskbar_host.cc', 'atom/browser/ui/win/taskbar_host.h', + 'atom/browser/ui/x/event_disabler.cc', + 'atom/browser/ui/x/event_disabler.h', 'atom/browser/ui/x/window_state_watcher.cc', 'atom/browser/ui/x/window_state_watcher.h', 'atom/browser/ui/x/x_window_utils.cc', diff --git a/lib/browser/api/auto-updater/auto-updater-win.js b/lib/browser/api/auto-updater/auto-updater-win.js index 5b1127027e9..8775534031f 100644 --- a/lib/browser/api/auto-updater/auto-updater-win.js +++ b/lib/browser/api/auto-updater/auto-updater-win.js @@ -19,7 +19,7 @@ AutoUpdater.prototype.quitAndInstall = function () { return app.quit() } -AutoUpdater.prototype.setFeedURL = function (updateURL) { +AutoUpdater.prototype.setFeedURL = function (updateURL, headers) { this.updateURL = updateURL } diff --git a/lib/browser/api/auto-updater/squirrel-update-win.js b/lib/browser/api/auto-updater/squirrel-update-win.js index 121e9422696..4783a9dd988 100644 --- a/lib/browser/api/auto-updater/squirrel-update-win.js +++ b/lib/browser/api/auto-updater/squirrel-update-win.js @@ -28,7 +28,7 @@ var spawnUpdate = function (args, detached, callback) { // Process spawned, different args: Return with error // No process spawned: Spawn new process if (spawnedProcess && !isSameArgs(args)) { - return callback('AutoUpdater process with arugments ' + args + ' is already running') + return callback('AutoUpdater process with arguments ' + args + ' is already running') } else if (!spawnedProcess) { spawnedProcess = spawn(updateExe, args, { detached: detached @@ -78,7 +78,7 @@ var spawnUpdate = function (args, detached, callback) { // Start an instance of the installed app. exports.processStart = function () { - return spawnUpdate(['--processStart', exeName], true, function () {}) + return spawnUpdate(['--processStartAndWait', exeName], true, function () {}) } // Download the releases specified by the URL and write new results to stdout. diff --git a/lib/browser/api/browser-window.js b/lib/browser/api/browser-window.js index 6ac31e737b8..388e396844d 100644 --- a/lib/browser/api/browser-window.js +++ b/lib/browser/api/browser-window.js @@ -10,7 +10,7 @@ BrowserWindow.prototype._init = function () { // Avoid recursive require. const {app} = require('electron') - // Simulate the application menu on platforms other than OS X. + // Simulate the application menu on platforms other than macOS. if (process.platform !== 'darwin') { const menu = app.getApplicationMenu() if (menu) this.setMenu(menu) @@ -55,7 +55,7 @@ BrowserWindow.prototype._init = function () { // focus it when we first start to load URL, if we do it earlier it won't // have effect, if we do it later we might move focus in the page. // - // Though this hack is only needed on OS X when the app is launched from + // Though this hack is only needed on macOS when the app is launched from // Finder, we still do it on all platforms in case of other bugs we don't // know. this.webContents.once('load-url', function () { @@ -117,7 +117,6 @@ BrowserWindow.fromDevToolsWebContents = (webContents) => { } // Helpers. - Object.assign(BrowserWindow.prototype, { loadURL (...args) { return this.webContents.loadURL.apply(this.webContents, args) diff --git a/lib/browser/api/menu.js b/lib/browser/api/menu.js index e05637e79e7..b122fc36cf3 100644 --- a/lib/browser/api/menu.js +++ b/lib/browser/api/menu.js @@ -150,10 +150,12 @@ Menu.prototype.popup = function (window, x, y, positioningItem) { window = BrowserWindow.getFocusedWindow() } - // Default parameters. + // Default to showing under mouse location. if (typeof x !== 'number') x = -1 if (typeof y !== 'number') y = -1 - if (typeof positioningItem !== 'number') positioningItem = 0 + + // Default to not highlighting any item. + if (typeof positioningItem !== 'number') positioningItem = -1 this.popupAt(window, x, y, positioningItem) } diff --git a/lib/browser/api/protocol.js b/lib/browser/api/protocol.js index 4daf4edaccd..1f729240016 100644 --- a/lib/browser/api/protocol.js +++ b/lib/browser/api/protocol.js @@ -9,9 +9,15 @@ exports.registerStandardSchemes = function (schemes) { registerStandardSchemes(schemes) } -app.once('ready', function () { +const setupProtocol = function () { let protocol = session.defaultSession.protocol for (let method in protocol) { exports[method] = protocol[method].bind(protocol) } -}) +} + +if (app.isReady()) { + setupProtocol() +} else { + app.once('ready', setupProtocol) +} diff --git a/lib/browser/api/web-contents.js b/lib/browser/api/web-contents.js index a3b4009aae7..dcd14a40fe3 100644 --- a/lib/browser/api/web-contents.js +++ b/lib/browser/api/web-contents.js @@ -1,7 +1,7 @@ 'use strict' const {EventEmitter} = require('events') -const {ipcMain, session, Menu, NavigationController} = require('electron') +const {app, ipcMain, session, Menu, NavigationController} = require('electron') // session is not used here, the purpose is to make sure session is initalized // before the webContents module. @@ -10,14 +10,6 @@ session const binding = process.atomBinding('web_contents') const debuggerBinding = process.atomBinding('debugger') -const WebContents = new EventEmitter() -WebContents.create = (options = {}) => { - return binding.create(options) -} -WebContents.fromId = (id) => { - return binding.fromId(id) -} - let nextId = 0 const getNextId = function () { return ++nextId @@ -232,7 +224,7 @@ const wrapWebContents = function (webContents) { this._printToPDF(printingSetting, callback) } - WebContents.emit('web-contents-created', webContents) + app.emit('web-contents-created', {}, webContents) } binding._setWrapWebContents(wrapWebContents) @@ -245,4 +237,12 @@ const wrapDebugger = function (webContentsDebugger) { debuggerBinding._setWrapDebugger(wrapDebugger) -module.exports = WebContents +module.exports = { + create (options = {}) { + return binding.create(options) + }, + + fromId (id) { + return binding.fromId(id) + } +} diff --git a/lib/browser/chrome-extension.js b/lib/browser/chrome-extension.js index ea9dc15f2c7..e3cd4540780 100644 --- a/lib/browser/chrome-extension.js +++ b/lib/browser/chrome-extension.js @@ -1,6 +1,6 @@ const {app, ipcMain, session, webContents, BrowserWindow} = require('electron') const {getAllWebContents} = process.atomBinding('web_contents') -const renderProcessPreferences = process.atomBinding('render_process_preferences').forAllBrowserWindow() +const renderProcessPreferences = process.atomBinding('render_process_preferences').forAllWebContents() const fs = require('fs') const path = require('path') @@ -19,6 +19,11 @@ const generateExtensionIdFromName = function (name) { return name.replace(/[\W_]+/g, '-').toLowerCase() } +const isWindowOrWebView = function (webContents) { + const type = webContents.getType() + return type === 'window' || type === 'webview' +} + // Create or get manifest object from |srcDirectory|. const getManifestFromPath = function (srcDirectory) { let manifest @@ -73,6 +78,7 @@ const startBackgroundPages = function (manifest) { const html = new Buffer(`${scripts}`) const contents = webContents.create({ + isBackgroundPage: true, commandLineSwitches: ['--background-page'] }) backgroundPages[manifest.extensionId] = { html: html, webContents: contents } @@ -91,17 +97,42 @@ const removeBackgroundPages = function (manifest) { delete backgroundPages[manifest.extensionId] } -// Dispatch tabs events. -const hookWebContentsForTabEvents = function (webContents) { - const tabId = webContents.id +const sendToBackgroundPages = function (...args) { for (const page of objectValues(backgroundPages)) { - page.webContents.sendToAll('CHROME_TABS_ONCREATED', tabId) + page.webContents.sendToAll(...args) } +} + +// Dispatch web contents events to Chrome APIs +const hookWebContentsEvents = function (webContents) { + const tabId = webContents.id + + sendToBackgroundPages('CHROME_TABS_ONCREATED') + + webContents.on('will-navigate', (event, url) => { + sendToBackgroundPages('CHROME_WEBNAVIGATION_ONBEFORENAVIGATE', { + frameId: 0, + parentFrameId: -1, + processId: webContents.getId(), + tabId: tabId, + timeStamp: Date.now(), + url: url + }) + }) + + webContents.on('did-navigate', (event, url) => { + sendToBackgroundPages('CHROME_WEBNAVIGATION_ONCOMPLETED', { + frameId: 0, + parentFrameId: -1, + processId: webContents.getId(), + tabId: tabId, + timeStamp: Date.now(), + url: url + }) + }) webContents.once('destroyed', () => { - for (const page of objectValues(backgroundPages)) { - page.webContents.sendToAll('CHROME_TABS_ONREMOVED', tabId) - } + sendToBackgroundPages('CHROME_TABS_ONREMOVED', tabId) }) } @@ -111,7 +142,7 @@ let nextId = 0 ipcMain.on('CHROME_RUNTIME_CONNECT', function (event, extensionId, connectInfo) { const page = backgroundPages[extensionId] if (!page) { - console.error(`Connect to unkown extension ${extensionId}`) + console.error(`Connect to unknown extension ${extensionId}`) return } @@ -132,7 +163,7 @@ ipcMain.on('CHROME_I18N_MANIFEST', function (event, extensionId) { ipcMain.on('CHROME_RUNTIME_SENDMESSAGE', function (event, extensionId, message) { const page = backgroundPages[extensionId] if (!page) { - console.error(`Connect to unkown extension ${extensionId}`) + console.error(`Connect to unknown extension ${extensionId}`) return } @@ -142,7 +173,7 @@ ipcMain.on('CHROME_RUNTIME_SENDMESSAGE', function (event, extensionId, message) ipcMain.on('CHROME_TABS_SEND_MESSAGE', function (event, tabId, extensionId, isBackgroundPage, message) { const contents = webContents.fromId(tabId) if (!contents) { - console.error(`Sending message to unkown tab ${tabId}`) + console.error(`Sending message to unknown tab ${tabId}`) return } @@ -154,7 +185,7 @@ ipcMain.on('CHROME_TABS_SEND_MESSAGE', function (event, tabId, extensionId, isBa ipcMain.on('CHROME_TABS_EXECUTESCRIPT', function (event, requestId, tabId, extensionId, details) { const contents = webContents.fromId(tabId) if (!contents) { - console.error(`Sending message to unkown tab ${tabId}`) + console.error(`Sending message to unknown tab ${tabId}`) return } @@ -236,10 +267,10 @@ const loadDevToolsExtensions = function (win, manifests) { win.devToolsWebContents.executeJavaScript(`DevToolsAPI.addExtensions(${JSON.stringify(extensionInfoArray)})`) } -webContents.on('web-contents-created', function (webContents) { - if (webContents.getType() === 'remote') return +app.on('web-contents-created', function (event, webContents) { + if (!isWindowOrWebView(webContents)) return - hookWebContentsForTabEvents(webContents) + hookWebContentsEvents(webContents) webContents.on('devtools-opened', function () { loadDevToolsExtensions(webContents, objectValues(manifestMap)) }) @@ -321,8 +352,9 @@ app.once('ready', function () { BrowserWindow.addDevToolsExtension = function (srcDirectory) { const manifest = getManifestFromPath(srcDirectory) if (manifest) { + loadExtension(manifest) for (const webContents of getAllWebContents()) { - if (webContents.getType() !== 'remote') { + if (isWindowOrWebView(webContents)) { loadDevToolsExtensions(webContents, [manifest]) } } @@ -339,4 +371,13 @@ app.once('ready', function () { delete manifestMap[manifest.extensionId] delete manifestNameMap[name] } + + BrowserWindow.getDevToolsExtensions = function () { + const extensions = {} + Object.keys(manifestNameMap).forEach(function (name) { + const manifest = manifestNameMap[name] + extensions[name] = {name: manifest.name, version: manifest.version} + }) + return extensions + } }) diff --git a/lib/renderer/chrome-api.js b/lib/renderer/chrome-api.js index fdc16f7375d..6c28c98edf4 100644 --- a/lib/renderer/chrome-api.js +++ b/lib/renderer/chrome-api.js @@ -1,31 +1,9 @@ const {ipcRenderer} = require('electron') +const Event = require('./extensions/event') const url = require('url') let nextId = 0 -class Event { - constructor () { - this.listeners = [] - } - - addListener (callback) { - this.listeners.push(callback) - } - - removeListener (callback) { - const index = this.listeners.indexOf(callback) - if (index !== -1) { - this.listeners.splice(index, 1) - } - } - - emit (...args) { - for (const listener of this.listeners) { - listener(...args) - } - } -} - class Tab { constructor (tabId) { this.id = tabId @@ -183,7 +161,7 @@ exports.injectTo = function (extensionId, isBackgroundPage, context) { onMessage: chrome.runtime.onMessage } - chrome.storage = require('./extensions/storage.js') + chrome.storage = require('./extensions/storage') chrome.pageAction = { show () {}, @@ -195,5 +173,6 @@ exports.injectTo = function (extensionId, isBackgroundPage, context) { getPopup () {} } - chrome.i18n = require('./extensions/i18n.js').setup(extensionId) + chrome.i18n = require('./extensions/i18n').setup(extensionId) + chrome.webNavigation = require('./extensions/web-navigation').setup() } diff --git a/lib/renderer/extensions/event.js b/lib/renderer/extensions/event.js new file mode 100644 index 00000000000..4a951407f59 --- /dev/null +++ b/lib/renderer/extensions/event.js @@ -0,0 +1,24 @@ +class Event { + constructor () { + this.listeners = [] + } + + addListener (callback) { + this.listeners.push(callback) + } + + removeListener (callback) { + const index = this.listeners.indexOf(callback) + if (index !== -1) { + this.listeners.splice(index, 1) + } + } + + emit (...args) { + for (const listener of this.listeners) { + listener(...args) + } + } +} + +module.exports = Event diff --git a/lib/renderer/extensions/web-navigation.js b/lib/renderer/extensions/web-navigation.js new file mode 100644 index 00000000000..19faa800191 --- /dev/null +++ b/lib/renderer/extensions/web-navigation.js @@ -0,0 +1,21 @@ +const Event = require('./event') +const {ipcRenderer} = require('electron') + +class WebNavigation { + constructor () { + this.onBeforeNavigate = new Event() + this.onCompleted = new Event() + + ipcRenderer.on('CHROME_WEBNAVIGATION_ONBEFORENAVIGATE', (event, details) => { + this.onBeforeNavigate.emit(details) + }) + + ipcRenderer.on('CHROME_WEBNAVIGATION_ONCOMPLETED', (event, details) => { + this.onCompleted.emit(details) + }) + } +} + +exports.setup = () => { + return new WebNavigation() +} diff --git a/lib/renderer/override.js b/lib/renderer/override.js index ced2318e718..c5683888767 100644 --- a/lib/renderer/override.js +++ b/lib/renderer/override.js @@ -154,20 +154,11 @@ window.open = function (url, frameName, features) { } // Use the dialog API to implement alert(). -window.alert = function (message, title) { - var buttons - if (arguments.length === 0) { - message = '' - } - if (title == null) { - title = '' - } - buttons = ['OK'] - message = String(message) +window.alert = function (message = '', title = '') { remote.dialog.showMessageBox(remote.getCurrentWindow(), { - message: message, - title: title, - buttons: buttons + message: String(message), + title: String(title), + buttons: ['OK'] }) } diff --git a/lib/renderer/web-view/web-view.js b/lib/renderer/web-view/web-view.js index 82ed62dd3a5..98ca22d9498 100644 --- a/lib/renderer/web-view/web-view.js +++ b/lib/renderer/web-view/web-view.js @@ -166,6 +166,12 @@ var WebViewImpl = (function () { resizeEvent = new Event('resize', { bubbles: true }) + + // Using client size values, because when a webview is transformed `newSize` + // is incorrect + newSize.width = this.webviewNode.clientWidth + newSize.height = this.webviewNode.clientHeight + resizeEvent.newWidth = newSize.width resizeEvent.newHeight = newSize.height this.dispatchEvent(resizeEvent) diff --git a/package.json b/package.json index 824cae71107..f4eb3eb287a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "electron", - "version": "1.2.2", + "version": "1.2.3", "devDependencies": { "asar": "^0.11.0", "request": "*", diff --git a/script/bootstrap.py b/script/bootstrap.py index 6380ffe27c7..198d7d0a7de 100755 --- a/script/bootstrap.py +++ b/script/bootstrap.py @@ -196,7 +196,8 @@ def update_win32_python(): def build_libchromiumcontent(verbose, target_arch, defines): - args = [os.path.join(SOURCE_ROOT, 'script', 'build-libchromiumcontent.py')] + args = [sys.executable, + os.path.join(SOURCE_ROOT, 'script', 'build-libchromiumcontent.py')] if verbose: args += ['-v'] if defines: diff --git a/script/lib/config.py b/script/lib/config.py index dcdb7e2cfe2..125cecb5a35 100644 --- a/script/lib/config.py +++ b/script/lib/config.py @@ -8,7 +8,7 @@ import sys BASE_URL = os.getenv('LIBCHROMIUMCONTENT_MIRROR') or \ 'https://s3.amazonaws.com/github-janky-artifacts/libchromiumcontent' -LIBCHROMIUMCONTENT_COMMIT = '7ae12b2856b81f5bfa1290108f72c3e4b5c13c52' +LIBCHROMIUMCONTENT_COMMIT = '2932c73bec8852c8cdf4b18f8b6372075c3e651e' PLATFORM = { 'cygwin': 'win32', diff --git a/spec/api-app-spec.js b/spec/api-app-spec.js index 260bdd31545..d2bda5794ae 100644 --- a/spec/api-app-spec.js +++ b/spec/api-app-spec.js @@ -275,7 +275,18 @@ describe('app module', function () { w = new BrowserWindow({ show: false }) - w.emit('blur') + }) + + it('should emit web-contents-created event when a webContents is created', function (done) { + app.once('web-contents-created', function (e, webContents) { + setImmediate(function () { + assert.equal(w.webContents.id, webContents.id) + done() + }) + }) + w = new BrowserWindow({ + show: false + }) }) }) }) diff --git a/spec/api-auto-updater-spec.js b/spec/api-auto-updater-spec.js index 6335f335943..f3c897865b8 100644 --- a/spec/api-auto-updater-spec.js +++ b/spec/api-auto-updater-spec.js @@ -21,7 +21,7 @@ if (!process.mas) { }) describe('setFeedURL', function () { - it('emits an error on Mac OS X when the application is unsigned', function (done) { + it('emits an error on macOS when the application is unsigned', function (done) { if (process.platform !== 'darwin') { return done() } diff --git a/spec/api-browser-window-spec.js b/spec/api-browser-window-spec.js index 5048f3cd4a9..7310cd6a904 100644 --- a/spec/api-browser-window-spec.js +++ b/spec/api-browser-window-spec.js @@ -337,6 +337,22 @@ describe('browser-window module', function () { }) }) + describe('BrowserWindow.setProgressBar(progress)', function () { + it('sets the progress', function () { + assert.doesNotThrow(function () { + if (process.platform === 'darwin') { + app.dock.setIcon(path.join(fixtures, 'assets', 'logo.png')) + } + w.setProgressBar(.5) + + if (process.platform === 'darwin') { + app.dock.setIcon(null) + } + w.setProgressBar(-1) + }) + }) + }) + describe('BrowserWindow.fromId(id)', function () { it('returns the window with id', function () { assert.equal(w.id, BrowserWindow.fromId(w.id).id) @@ -764,7 +780,7 @@ describe('browser-window module', function () { }) describe('fullscreenable state', function () { - // Only implemented on OS X. + // Only implemented on macOS. if (process.platform !== 'darwin') return it('can be changed with fullscreenable option', function () { @@ -820,6 +836,110 @@ describe('browser-window module', function () { }) }) + describe('parent window', function () { + let c = null + + beforeEach(function () { + if (c != null) c.destroy() + c = new BrowserWindow({show: false, parent: w}) + }) + + afterEach(function () { + if (c != null) c.destroy() + c = null + }) + + describe('parent option', function () { + it('sets parent window', function () { + assert.equal(c.getParentWindow(), w) + }) + + it('adds window to child windows of parent', function () { + assert.deepEqual(w.getChildWindows(), [c]) + }) + + it('removes from child windows of parent when window is closed', function (done) { + c.once('closed', () => { + assert.deepEqual(w.getChildWindows(), []) + done() + }) + c.close() + }) + }) + + describe('win.setParentWindow(parent)', function () { + if (process.platform === 'win32') return + + beforeEach(function () { + if (c != null) c.destroy() + c = new BrowserWindow({show: false}) + }) + + it('sets parent window', function () { + assert.equal(w.getParentWindow(), null) + assert.equal(c.getParentWindow(), null) + c.setParentWindow(w) + assert.equal(c.getParentWindow(), w) + c.setParentWindow(null) + assert.equal(c.getParentWindow(), null) + }) + + it('adds window to child windows of parent', function () { + assert.deepEqual(w.getChildWindows(), []) + c.setParentWindow(w) + assert.deepEqual(w.getChildWindows(), [c]) + c.setParentWindow(null) + assert.deepEqual(w.getChildWindows(), []) + }) + + it('removes from child windows of parent when window is closed', function (done) { + c.once('closed', () => { + assert.deepEqual(w.getChildWindows(), []) + done() + }) + c.setParentWindow(w) + c.close() + }) + }) + + describe('modal option', function () { + // The isEnabled API is not reliable on macOS. + if (process.platform === 'darwin') return + + beforeEach(function () { + if (c != null) c.destroy() + c = new BrowserWindow({show: false, parent: w, modal: true}) + }) + + it('disables parent window', function () { + assert.equal(w.isEnabled(), true) + c.show() + assert.equal(w.isEnabled(), false) + }) + + it('enables parent window when closed', function (done) { + c.once('closed', () => { + assert.equal(w.isEnabled(), true) + done() + }) + c.show() + c.close() + }) + + it('disables parent window recursively', function () { + let c2 = new BrowserWindow({show: false, parent: w, modal: true}) + c.show() + assert.equal(w.isEnabled(), false) + c2.show() + assert.equal(w.isEnabled(), false) + c.destroy() + assert.equal(w.isEnabled(), false) + c2.destroy() + assert.equal(w.isEnabled(), true) + }) + }) + }) + describe('window.webContents.send(channel, args...)', function () { it('throws an error when the channel is missing', function () { assert.throws(function () { @@ -838,9 +958,11 @@ describe('browser-window module', function () { beforeEach(function () { BrowserWindow.removeDevToolsExtension('foo') + assert.equal(BrowserWindow.getDevToolsExtensions().hasOwnProperty('foo'), false) var extensionPath = path.join(__dirname, 'fixtures', 'devtools-extensions', 'foo') BrowserWindow.addDevToolsExtension(extensionPath) + assert.equal(BrowserWindow.getDevToolsExtensions().hasOwnProperty('foo'), true) w.webContents.on('devtools-opened', function () { var showPanelIntevalId = setInterval(function () { diff --git a/spec/api-native-image-spec.js b/spec/api-native-image-spec.js index 196ed1356d7..4ada22af9ed 100644 --- a/spec/api-native-image-spec.js +++ b/spec/api-native-image-spec.js @@ -35,7 +35,7 @@ describe('nativeImage module', () => { assert.equal(image.getSize().width, 538) }) - it('Gets an NSImage pointer on OS X', () => { + it('Gets an NSImage pointer on macOS', () => { if (process.platform !== 'darwin') return const imagePath = `${path.join(__dirname, 'fixtures', 'api')}${path.sep}..${path.sep}${path.join('assets', 'logo.png')}` diff --git a/spec/api-session-spec.js b/spec/api-session-spec.js index 9529ec5e007..25a09ba313b 100644 --- a/spec/api-session-spec.js +++ b/spec/api-session-spec.js @@ -18,7 +18,7 @@ describe('session module', function () { var url = 'http://127.0.0.1' var partitionName = 'temp' var protocolName = 'sp' - const tempProtocol = session.fromPartition(partitionName).protocol + const partitionProtocol = session.fromPartition(partitionName).protocol const protocol = session.defaultSession.protocol beforeEach(function () { @@ -288,19 +288,23 @@ describe('session module', function () { }) }) + afterEach(function (done) { + partitionProtocol.unregisterProtocol(protocolName, () => done()) + }) + it('handles requests from a partition', function (done) { var handler = function (error, callback) { callback({ data: 'test' }) } - tempProtocol.registerStringProtocol(protocolName, handler, function (error) { + partitionProtocol.registerStringProtocol(protocolName, handler, function (error) { if (error) { return done(error) } protocol.isProtocolHandled(protocolName, function (result) { assert.equal(result, false) - tempProtocol.isProtocolHandled(protocolName, function (result) { + partitionProtocol.isProtocolHandled(protocolName, function (result) { assert.equal(result, true) w.webContents.on('did-finish-load', function () { done() diff --git a/spec/node-spec.js b/spec/node-spec.js index 93a247ef4ff..93905b49d7e 100644 --- a/spec/node-spec.js +++ b/spec/node-spec.js @@ -5,6 +5,8 @@ const path = require('path') const os = require('os') const {remote} = require('electron') +const isCI = remote.getGlobal('isCi') + describe('node feature', function () { var fixtures = path.join(__dirname, 'fixtures') @@ -225,7 +227,9 @@ describe('node feature', function () { process.stdout.write('test') }) - xit('should have isTTY defined', function () { + it('should have isTTY defined', function () { + if (isCI) return + assert.equal(typeof process.stdout.isTTY, 'boolean') }) }) diff --git a/toolchain.gypi b/toolchain.gypi index 11da28f7023..1c5f8a71351 100644 --- a/toolchain.gypi +++ b/toolchain.gypi @@ -6,7 +6,7 @@ 'clang%': 1, 'variables': { - # The minimum OS X SDK version to use. + # The minimum macOS SDK version to use. 'mac_sdk_min%': '10.10', # Set ARM architecture version. diff --git a/vendor/brightray b/vendor/brightray index 097d14b39f8..4e4113ee434 160000 --- a/vendor/brightray +++ b/vendor/brightray @@ -1 +1 @@ -Subproject commit 097d14b39f83a945373c111dec46ad078c6f5f39 +Subproject commit 4e4113ee43484c6058ced9defa9b905e0e7339a6 diff --git a/vendor/native_mate b/vendor/native_mate index 4ad6ecd1961..e75f2aa087d 160000 --- a/vendor/native_mate +++ b/vendor/native_mate @@ -1 +1 @@ -Subproject commit 4ad6ecd19617ac33c09e93ccb6d8e652ac1ac126 +Subproject commit e75f2aa087db346efc4b530f9e1ce7d3a72a3434