зеркало из https://github.com/electron/electron.git
[Win] Add custom frame view implementation for native window.
This commit is contained in:
Родитель
528e6d2679
Коммит
9e3772ff0f
|
@ -11,6 +11,7 @@
|
|||
#include "ui/views/controls/webview/webview.h"
|
||||
#include "ui/views/widget/widget.h"
|
||||
#include "ui/views/window/client_view.h"
|
||||
#include "ui/views/window/native_frame_view.h"
|
||||
|
||||
namespace atom {
|
||||
|
||||
|
@ -33,6 +34,30 @@ class NativeWindowClientView : public views::ClientView {
|
|||
|
||||
private:
|
||||
NativeWindowWin* shell_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(NativeWindowClientView);
|
||||
};
|
||||
|
||||
class NativeWindowFrameView : public views::NativeFrameView {
|
||||
public:
|
||||
explicit NativeWindowFrameView(views::Widget* frame, NativeWindowWin* shell)
|
||||
: NativeFrameView(frame),
|
||||
shell_(shell) {
|
||||
}
|
||||
virtual ~NativeWindowFrameView() {}
|
||||
|
||||
virtual gfx::Size GetMinimumSize() OVERRIDE {
|
||||
return shell_->GetMinimumSize();
|
||||
}
|
||||
|
||||
virtual gfx::Size GetMaximumSize() OVERRIDE {
|
||||
return shell_->GetMaximumSize();
|
||||
}
|
||||
|
||||
private:
|
||||
NativeWindowWin* shell_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(NativeWindowFrameView);
|
||||
};
|
||||
|
||||
|
||||
|
@ -237,6 +262,11 @@ views::ClientView* NativeWindowWin::CreateClientView(views::Widget* widget) {
|
|||
return new NativeWindowClientView(widget, web_view_, this);
|
||||
}
|
||||
|
||||
views::NonClientFrameView* NativeWindowWin::CreateNonClientFrameView(
|
||||
views::Widget* widget) {
|
||||
return new NativeWindowFrameView(widget, this);
|
||||
}
|
||||
|
||||
// static
|
||||
NativeWindow* NativeWindow::Create(content::WebContents* web_contents,
|
||||
base::DictionaryValue* options) {
|
||||
|
|
|
@ -75,6 +75,8 @@ class NativeWindowWin : public NativeWindow,
|
|||
virtual views::Widget* GetWidget() OVERRIDE;
|
||||
virtual const views::Widget* GetWidget() const OVERRIDE;
|
||||
virtual views::ClientView* CreateClientView(views::Widget* widget) OVERRIDE;
|
||||
virtual views::NonClientFrameView* CreateNonClientFrameView(
|
||||
views::Widget* widget) OVERRIDE;
|
||||
|
||||
private:
|
||||
scoped_ptr<views::Widget> window_;
|
||||
|
|
Загрузка…
Ссылка в новой задаче