win: Make native window a views::View.
This commit is contained in:
parent
a2f679e4bd
commit
4e2d3f3d12
2 changed files with 26 additions and 2 deletions
|
@ -401,6 +401,23 @@ void NativeWindowWin::HandleKeyboardEvent(
|
||||||
event.os_event.wParam, event.os_event.lParam);
|
event.os_event.wParam, event.os_event.lParam);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void NativeWindowWin::Layout() {
|
||||||
|
DCHECK(web_view_);
|
||||||
|
web_view_->SetBounds(0, 0, width(), height());
|
||||||
|
OnViewWasResized();
|
||||||
|
}
|
||||||
|
|
||||||
|
void NativeWindowWin::ViewHierarchyChanged(bool is_add,
|
||||||
|
views::View* parent,
|
||||||
|
views::View* child) {
|
||||||
|
if (is_add && child == this)
|
||||||
|
AddChildView(web_view_);
|
||||||
|
}
|
||||||
|
|
||||||
|
void NativeWindowWin::DeleteDelegate() {
|
||||||
|
// Do nothing, window is managed by users.
|
||||||
|
}
|
||||||
|
|
||||||
bool NativeWindowWin::CanResize() const {
|
bool NativeWindowWin::CanResize() const {
|
||||||
return resizable_;
|
return resizable_;
|
||||||
}
|
}
|
||||||
|
@ -430,7 +447,7 @@ const views::Widget* NativeWindowWin::GetWidget() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
views::ClientView* NativeWindowWin::CreateClientView(views::Widget* widget) {
|
views::ClientView* NativeWindowWin::CreateClientView(views::Widget* widget) {
|
||||||
return new NativeWindowClientView(widget, web_view_, this);
|
return new NativeWindowClientView(widget, this, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
views::NonClientFrameView* NativeWindowWin::CreateNonClientFrameView(
|
views::NonClientFrameView* NativeWindowWin::CreateNonClientFrameView(
|
||||||
|
|
|
@ -26,7 +26,7 @@ namespace atom {
|
||||||
class Menu2;
|
class Menu2;
|
||||||
|
|
||||||
class NativeWindowWin : public NativeWindow,
|
class NativeWindowWin : public NativeWindow,
|
||||||
public views::WidgetDelegate {
|
public views::WidgetDelegateView {
|
||||||
public:
|
public:
|
||||||
explicit NativeWindowWin(content::WebContents* web_contents,
|
explicit NativeWindowWin(content::WebContents* web_contents,
|
||||||
base::DictionaryValue* options);
|
base::DictionaryValue* options);
|
||||||
|
@ -83,7 +83,14 @@ class NativeWindowWin : public NativeWindow,
|
||||||
content::WebContents*,
|
content::WebContents*,
|
||||||
const content::NativeWebKeyboardEvent&) OVERRIDE;
|
const content::NativeWebKeyboardEvent&) OVERRIDE;
|
||||||
|
|
||||||
|
// Overridden from views::View:
|
||||||
|
virtual void Layout() OVERRIDE;
|
||||||
|
virtual void ViewHierarchyChanged(bool is_add,
|
||||||
|
views::View* parent,
|
||||||
|
views::View* child) OVERRIDE;
|
||||||
|
|
||||||
// Overridden from views::WidgetDelegate:
|
// Overridden from views::WidgetDelegate:
|
||||||
|
virtual void DeleteDelegate() OVERRIDE;
|
||||||
virtual bool CanResize() const OVERRIDE;
|
virtual bool CanResize() const OVERRIDE;
|
||||||
virtual bool CanMaximize() const OVERRIDE;
|
virtual bool CanMaximize() const OVERRIDE;
|
||||||
virtual string16 GetWindowTitle() const OVERRIDE;
|
virtual string16 GetWindowTitle() const OVERRIDE;
|
||||||
|
|
Loading…
Reference in a new issue