views: Explicitly set initially focused view

This commit is contained in:
Cheng Zhao 2018-03-06 16:05:31 +09:00
parent 413fdc6f0d
commit 9000bd6679
2 changed files with 4 additions and 2 deletions

View file

@ -140,7 +140,8 @@ NativeWindowViews::NativeWindowViews(
NativeWindow* parent)
: NativeWindow(web_contents, options, parent),
window_(new views::Widget),
web_view_(inspectable_web_contents()->GetView()->GetView()),
web_view_(web_contents->GetView()->GetView()),
focused_view_(web_contents->GetView()->GetWebView()),
menu_bar_autohide_(false),
menu_bar_visible_(false),
menu_bar_alt_pressed_(false),
@ -1235,7 +1236,7 @@ void NativeWindowViews::DeleteDelegate() {
}
views::View* NativeWindowViews::GetInitiallyFocusedView() {
return inspectable_web_contents()->GetView()->GetWebView();
return focused_view_;
}
bool NativeWindowViews::CanResize() const {

View file

@ -214,6 +214,7 @@ class NativeWindowViews : public NativeWindow,
std::unique_ptr<views::Widget> window_;
views::View* web_view_; // Managed by inspectable_web_contents_.
views::View* focused_view_; // The view should be focused by default.
std::unique_ptr<AutofillPopup> autofill_popup_;