chore: rename atom -> electron (#21986)

This commit is contained in:
Jeremy Apthorp 2020-02-04 12:19:40 -08:00 committed by GitHub
parent f14fc4b041
commit d9321f4df7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
287 changed files with 1771 additions and 1708 deletions

View file

@ -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.
#include "content/public/browser/render_widget_host_view.h"
#include "shell/browser/api/electron_api_web_contents.h"
#import <Cocoa/Cocoa.h>
namespace electron {
namespace api {
bool WebContents::IsFocused() const {
auto* view = web_contents()->GetRenderWidgetHostView();
if (!view)
return false;
if (GetType() != Type::BACKGROUND_PAGE) {
auto window = [web_contents()->GetNativeView().GetNativeNSView() window];
// On Mac the render widget host view does not lose focus when the window
// loses focus so check if the top level window is the key window.
if (window && ![window isKeyWindow])
return false;
}
return view->HasFocus();
}
} // namespace api
} // namespace electron