refactor: Make NativeWindow inherit WidgetDelegate
This commit is contained in:
parent
ee2c3607ad
commit
6d18bd0633
4 changed files with 8 additions and 7 deletions
|
@ -16,6 +16,7 @@
|
||||||
#include "base/supports_user_data.h"
|
#include "base/supports_user_data.h"
|
||||||
#include "content/public/browser/web_contents_user_data.h"
|
#include "content/public/browser/web_contents_user_data.h"
|
||||||
#include "extensions/browser/app_window/size_constraints.h"
|
#include "extensions/browser/app_window/size_constraints.h"
|
||||||
|
#include "ui/views/widget/widget_delegate.h"
|
||||||
|
|
||||||
class SkRegion;
|
class SkRegion;
|
||||||
|
|
||||||
|
@ -47,7 +48,8 @@ class NativeBrowserView;
|
||||||
|
|
||||||
struct DraggableRegion;
|
struct DraggableRegion;
|
||||||
|
|
||||||
class NativeWindow : public base::SupportsUserData {
|
class NativeWindow : public base::SupportsUserData,
|
||||||
|
public views::WidgetDelegate {
|
||||||
public:
|
public:
|
||||||
~NativeWindow() override;
|
~NativeWindow() override;
|
||||||
|
|
||||||
|
|
|
@ -12,8 +12,6 @@
|
||||||
|
|
||||||
#include "atom/browser/native_window.h"
|
#include "atom/browser/native_window.h"
|
||||||
#include "base/mac/scoped_nsobject.h"
|
#include "base/mac/scoped_nsobject.h"
|
||||||
#include "ui/views/widget/widget_delegate.h"
|
|
||||||
#include "ui/views/widget/widget_observer.h"
|
|
||||||
|
|
||||||
@class AtomNSWindow;
|
@class AtomNSWindow;
|
||||||
@class AtomNSWindowDelegate;
|
@class AtomNSWindowDelegate;
|
||||||
|
@ -23,8 +21,7 @@
|
||||||
|
|
||||||
namespace atom {
|
namespace atom {
|
||||||
|
|
||||||
class NativeWindowMac : public NativeWindow,
|
class NativeWindowMac : public NativeWindow {
|
||||||
public views::WidgetDelegate {
|
|
||||||
public:
|
public:
|
||||||
NativeWindowMac(const mate::Dictionary& options, NativeWindow* parent);
|
NativeWindowMac(const mate::Dictionary& options, NativeWindow* parent);
|
||||||
~NativeWindowMac() override;
|
~NativeWindowMac() override;
|
||||||
|
|
|
@ -138,6 +138,9 @@ NativeWindowViews::NativeWindowViews(const mate::Dictionary& options,
|
||||||
maximizable_(true),
|
maximizable_(true),
|
||||||
minimizable_(true),
|
minimizable_(true),
|
||||||
fullscreenable_(true) {
|
fullscreenable_(true) {
|
||||||
|
// The root view is this class, it is managed by us.
|
||||||
|
set_owned_by_client();
|
||||||
|
|
||||||
options.Get(options::kTitle, &title_);
|
options.Get(options::kTitle, &title_);
|
||||||
options.Get(options::kAutoHideMenuBar, &menu_bar_autohide_);
|
options.Get(options::kAutoHideMenuBar, &menu_bar_autohide_);
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,6 @@
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "atom/browser/ui/accelerator_util.h"
|
#include "atom/browser/ui/accelerator_util.h"
|
||||||
#include "ui/views/widget/widget_delegate.h"
|
|
||||||
#include "ui/views/widget/widget_observer.h"
|
#include "ui/views/widget/widget_observer.h"
|
||||||
|
|
||||||
#if defined(OS_WIN)
|
#if defined(OS_WIN)
|
||||||
|
@ -41,7 +40,7 @@ class NativeWindowViews : public NativeWindow,
|
||||||
#if defined(OS_WIN)
|
#if defined(OS_WIN)
|
||||||
public MessageHandlerDelegate,
|
public MessageHandlerDelegate,
|
||||||
#endif
|
#endif
|
||||||
public views::WidgetDelegateView,
|
public views::View,
|
||||||
public views::WidgetObserver {
|
public views::WidgetObserver {
|
||||||
public:
|
public:
|
||||||
NativeWindowViews(const mate::Dictionary& options, NativeWindow* parent);
|
NativeWindowViews(const mate::Dictionary& options, NativeWindow* parent);
|
||||||
|
|
Loading…
Reference in a new issue