refactor: rename the atom directory to shell
This commit is contained in:
parent
4575a4aae3
commit
d7f07e8a80
631 changed files with 0 additions and 0 deletions
32
shell/browser/api/atom_api_web_contents_mac.mm
Normal file
32
shell/browser/api/atom_api_web_contents_mac.mm
Normal 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 "atom/browser/api/atom_api_web_contents.h"
|
||||
#include "content/public/browser/render_widget_host_view.h"
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
namespace atom {
|
||||
|
||||
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 atom
|
Loading…
Add table
Add a link
Reference in a new issue