Add BrowserWindow.focusOnWebView and blurWebView.

This commit is contained in:
Cheng Zhao 2013-05-24 17:51:15 +08:00
parent f3a8a0741c
commit edf2e84895
7 changed files with 50 additions and 3 deletions

View file

@ -132,6 +132,14 @@ void NativeWindow::CloseDevTools() {
inspectable_web_contents()->GetView()->CloseDevTools();
}
void NativeWindow::FocusOnWebView() {
GetWebContents()->GetRenderViewHost()->Focus();
}
void NativeWindow::BlurWebView() {
GetWebContents()->GetRenderViewHost()->Blur();
}
void NativeWindow::CloseWebContents() {
bool prevent_default = false;
FOR_EACH_OBSERVER(NativeWindowObserver,
@ -162,6 +170,10 @@ void NativeWindow::NotifyWindowClosed() {
WindowList::RemoveWindow(this);
}
void NativeWindow::NotifyWindowBlur() {
FOR_EACH_OBSERVER(NativeWindowObserver, observers_, OnWindowBlur());
}
// Window opened by window.open.
void NativeWindow::WebContentsCreated(
content::WebContents* source_contents,
@ -207,11 +219,11 @@ bool NativeWindow::CanOverscrollContent() const {
}
void NativeWindow::ActivateContents(content::WebContents* contents) {
GetWebContents()->GetRenderViewHost()->Focus();
FocusOnWebView();
}
void NativeWindow::DeactivateContents(content::WebContents* contents) {
GetWebContents()->GetRenderViewHost()->Blur();
BlurWebView();
}
void NativeWindow::MoveContents(content::WebContents* source,