electron/shell/browser/ui/cocoa/views_delegate_mac.mm
Electron Bot 39baf68790
chore: bump chromium to 5b340c815ce15ab2efcf277ed19e9 (master) (#22064)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>
Co-authored-by: loc <andy@slack-corp.com>
Co-authored-by: Robo <hop2deep@gmail.com>
Co-authored-by: Jeremy Apthorp <nornagon@nornagon.net>
2020-03-03 13:35:05 -08:00

39 lines
1.1 KiB
Text

// Copyright (c) 2018 GitHub, Inc.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#include "shell/browser/ui/cocoa/views_delegate_mac.h"
#include "content/public/browser/context_factory.h"
#include "ui/views/widget/native_widget_mac.h"
namespace electron {
ViewsDelegateMac::ViewsDelegateMac() {}
ViewsDelegateMac::~ViewsDelegateMac() {}
void ViewsDelegateMac::OnBeforeWidgetInit(
views::Widget::InitParams* params,
views::internal::NativeWidgetDelegate* delegate) {
// If we already have a native_widget, we don't have to try to come
// up with one.
if (params->native_widget)
return;
if (!native_widget_factory().is_null()) {
params->native_widget = native_widget_factory().Run(*params, delegate);
if (params->native_widget)
return;
}
// Setting null here causes Widget to create the default NativeWidget
// implementation.
params->native_widget = nullptr;
}
ui::ContextFactory* ViewsDelegateMac::GetContextFactory() {
return content::GetContextFactory();
}
} // namespace electron