Add InspectableWebContentsViewDelegate

This commit is contained in:
Cheng Zhao 2015-06-25 12:30:04 +08:00
parent 2ea2413752
commit afa9f30aac
4 changed files with 26 additions and 4 deletions

View file

@ -96,6 +96,8 @@ NativeWindow::NativeWindow(
zoom_factor_(1.0),
inspectable_web_contents_(inspectable_web_contents),
weak_factory_(this) {
inspectable_web_contents->GetView()->SetDelegate(this);
options.Get(switches::kFrame, &has_frame_);
options.Get(switches::kTransparent, &transparent_);
options.Get(switches::kEnableLargerThanScreen, &enable_larger_than_screen_);
@ -496,6 +498,7 @@ void NativeWindow::RenderViewCreated(
}
void NativeWindow::CloseContents(content::WebContents* source) {
inspectable_web_contents_->GetView()->SetDelegate(nullptr);
inspectable_web_contents_ = nullptr;
// When the web contents is gone, close the window immediately, but the
@ -525,6 +528,18 @@ void NativeWindow::RendererResponsive(content::WebContents* source) {
FOR_EACH_OBSERVER(NativeWindowObserver, observers_, OnRendererResponsive());
}
void NativeWindow::DevToolsFocused() {
FOR_EACH_OBSERVER(NativeWindowObserver, observers_, OnDevToolsFocus());
}
void NativeWindow::DevToolsOpened() {
FOR_EACH_OBSERVER(NativeWindowObserver, observers_, OnDevToolsOpened());
}
void NativeWindow::DevToolsClosed() {
FOR_EACH_OBSERVER(NativeWindowObserver, observers_, OnDevToolsClosed());
}
void NativeWindow::BeforeUnloadDialogCancelled() {
WindowList::WindowCloseCancelled(this);