mac: Provide ViewsDelegate
This commit is contained in:
parent
fcc82ebd35
commit
37a7df49d6
7 changed files with 93 additions and 1 deletions
30
atom/browser/ui/cocoa/views_delegate_mac.h
Normal file
30
atom/browser/ui/cocoa/views_delegate_mac.h
Normal file
|
@ -0,0 +1,30 @@
|
|||
// Copyright (c) 2018 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_COCOA_VIEWS_DELEGATE_MAC_H_
|
||||
#define ATOM_BROWSER_UI_COCOA_VIEWS_DELEGATE_MAC_H_
|
||||
|
||||
#include "ui/views/views_delegate.h"
|
||||
|
||||
namespace atom {
|
||||
|
||||
class ViewsDelegateMac : public views::ViewsDelegate {
|
||||
public:
|
||||
ViewsDelegateMac();
|
||||
~ViewsDelegateMac() override;
|
||||
|
||||
// ViewsDelegate:
|
||||
void OnBeforeWidgetInit(
|
||||
views::Widget::InitParams* params,
|
||||
views::internal::NativeWidgetDelegate* delegate) override;
|
||||
ui::ContextFactory* GetContextFactory() override;
|
||||
ui::ContextFactoryPrivate* GetContextFactoryPrivate() override;
|
||||
|
||||
private:
|
||||
DISALLOW_COPY_AND_ASSIGN(ViewsDelegateMac);
|
||||
};
|
||||
|
||||
} // namespace atom
|
||||
|
||||
#endif // ATOM_BROWSER_UI_COCOA_VIEWS_DELEGATE_MAC_H_
|
33
atom/browser/ui/cocoa/views_delegate_mac.mm
Normal file
33
atom/browser/ui/cocoa/views_delegate_mac.mm
Normal file
|
@ -0,0 +1,33 @@
|
|||
// 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 "atom/browser/ui/cocoa/views_delegate_mac.h"
|
||||
|
||||
#include "content/public/browser/context_factory.h"
|
||||
#include "ui/views/widget/native_widget_mac.h"
|
||||
|
||||
namespace atom {
|
||||
|
||||
ViewsDelegateMac::ViewsDelegateMac() {
|
||||
}
|
||||
|
||||
ViewsDelegateMac::~ViewsDelegateMac() {
|
||||
}
|
||||
|
||||
void ViewsDelegateMac::OnBeforeWidgetInit(
|
||||
views::Widget::InitParams* params,
|
||||
views::internal::NativeWidgetDelegate* delegate) {
|
||||
if (!params->native_widget)
|
||||
params->native_widget = new views::NativeWidgetMac(delegate);
|
||||
}
|
||||
|
||||
ui::ContextFactory* ViewsDelegateMac::GetContextFactory() {
|
||||
return content::GetContextFactory();
|
||||
}
|
||||
|
||||
ui::ContextFactoryPrivate* ViewsDelegateMac::GetContextFactoryPrivate() {
|
||||
return content::GetContextFactoryPrivate();
|
||||
}
|
||||
|
||||
} // namespace atom
|
Loading…
Add table
Add a link
Reference in a new issue