[Win] Add custom frame view implementation for native window.
This commit is contained in:
parent
528e6d2679
commit
9e3772ff0f
2 changed files with 32 additions and 0 deletions
|
@ -11,6 +11,7 @@
|
||||||
#include "ui/views/controls/webview/webview.h"
|
#include "ui/views/controls/webview/webview.h"
|
||||||
#include "ui/views/widget/widget.h"
|
#include "ui/views/widget/widget.h"
|
||||||
#include "ui/views/window/client_view.h"
|
#include "ui/views/window/client_view.h"
|
||||||
|
#include "ui/views/window/native_frame_view.h"
|
||||||
|
|
||||||
namespace atom {
|
namespace atom {
|
||||||
|
|
||||||
|
@ -33,6 +34,30 @@ class NativeWindowClientView : public views::ClientView {
|
||||||
|
|
||||||
private:
|
private:
|
||||||
NativeWindowWin* shell_;
|
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);
|
return new NativeWindowClientView(widget, web_view_, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
views::NonClientFrameView* NativeWindowWin::CreateNonClientFrameView(
|
||||||
|
views::Widget* widget) {
|
||||||
|
return new NativeWindowFrameView(widget, this);
|
||||||
|
}
|
||||||
|
|
||||||
// static
|
// static
|
||||||
NativeWindow* NativeWindow::Create(content::WebContents* web_contents,
|
NativeWindow* NativeWindow::Create(content::WebContents* web_contents,
|
||||||
base::DictionaryValue* options) {
|
base::DictionaryValue* options) {
|
||||||
|
|
|
@ -75,6 +75,8 @@ class NativeWindowWin : public NativeWindow,
|
||||||
virtual views::Widget* GetWidget() OVERRIDE;
|
virtual views::Widget* GetWidget() OVERRIDE;
|
||||||
virtual const views::Widget* GetWidget() const OVERRIDE;
|
virtual const views::Widget* GetWidget() const OVERRIDE;
|
||||||
virtual views::ClientView* CreateClientView(views::Widget* widget) OVERRIDE;
|
virtual views::ClientView* CreateClientView(views::Widget* widget) OVERRIDE;
|
||||||
|
virtual views::NonClientFrameView* CreateNonClientFrameView(
|
||||||
|
views::Widget* widget) OVERRIDE;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
scoped_ptr<views::Widget> window_;
|
scoped_ptr<views::Widget> window_;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue