Add InspectableWebContentsViewDelegate
This commit is contained in:
parent
2ea2413752
commit
afa9f30aac
4 changed files with 26 additions and 4 deletions
|
@ -96,6 +96,8 @@ NativeWindow::NativeWindow(
|
||||||
zoom_factor_(1.0),
|
zoom_factor_(1.0),
|
||||||
inspectable_web_contents_(inspectable_web_contents),
|
inspectable_web_contents_(inspectable_web_contents),
|
||||||
weak_factory_(this) {
|
weak_factory_(this) {
|
||||||
|
inspectable_web_contents->GetView()->SetDelegate(this);
|
||||||
|
|
||||||
options.Get(switches::kFrame, &has_frame_);
|
options.Get(switches::kFrame, &has_frame_);
|
||||||
options.Get(switches::kTransparent, &transparent_);
|
options.Get(switches::kTransparent, &transparent_);
|
||||||
options.Get(switches::kEnableLargerThanScreen, &enable_larger_than_screen_);
|
options.Get(switches::kEnableLargerThanScreen, &enable_larger_than_screen_);
|
||||||
|
@ -496,6 +498,7 @@ void NativeWindow::RenderViewCreated(
|
||||||
}
|
}
|
||||||
|
|
||||||
void NativeWindow::CloseContents(content::WebContents* source) {
|
void NativeWindow::CloseContents(content::WebContents* source) {
|
||||||
|
inspectable_web_contents_->GetView()->SetDelegate(nullptr);
|
||||||
inspectable_web_contents_ = nullptr;
|
inspectable_web_contents_ = nullptr;
|
||||||
|
|
||||||
// When the web contents is gone, close the window immediately, but the
|
// 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());
|
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() {
|
void NativeWindow::BeforeUnloadDialogCancelled() {
|
||||||
WindowList::WindowCloseCancelled(this);
|
WindowList::WindowCloseCancelled(this);
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
#include "base/memory/scoped_ptr.h"
|
#include "base/memory/scoped_ptr.h"
|
||||||
#include "base/memory/weak_ptr.h"
|
#include "base/memory/weak_ptr.h"
|
||||||
#include "base/observer_list.h"
|
#include "base/observer_list.h"
|
||||||
|
#include "brightray/browser/inspectable_web_contents_view_delegate.h"
|
||||||
#include "content/public/browser/readback_types.h"
|
#include "content/public/browser/readback_types.h"
|
||||||
#include "content/public/browser/web_contents_observer.h"
|
#include "content/public/browser/web_contents_observer.h"
|
||||||
#include "content/public/browser/web_contents_user_data.h"
|
#include "content/public/browser/web_contents_user_data.h"
|
||||||
|
@ -53,7 +54,8 @@ namespace atom {
|
||||||
|
|
||||||
struct DraggableRegion;
|
struct DraggableRegion;
|
||||||
|
|
||||||
class NativeWindow : public content::WebContentsObserver {
|
class NativeWindow : public content::WebContentsObserver,
|
||||||
|
public brightray::InspectableWebContentsViewDelegate {
|
||||||
public:
|
public:
|
||||||
typedef base::Callback<void(const SkBitmap& bitmap)> CapturePageCallback;
|
typedef base::Callback<void(const SkBitmap& bitmap)> CapturePageCallback;
|
||||||
|
|
||||||
|
@ -228,7 +230,12 @@ class NativeWindow : public content::WebContentsObserver {
|
||||||
virtual void UpdateDraggableRegions(
|
virtual void UpdateDraggableRegions(
|
||||||
const std::vector<DraggableRegion>& regions) = 0;
|
const std::vector<DraggableRegion>& regions) = 0;
|
||||||
|
|
||||||
// Implementations of content::WebContentsObserver.
|
// brightray::InspectableWebContentsViewDelegate:
|
||||||
|
void DevToolsFocused() override;
|
||||||
|
void DevToolsOpened() override;
|
||||||
|
void DevToolsClosed() override;
|
||||||
|
|
||||||
|
// content::WebContentsObserver:
|
||||||
void RenderViewCreated(content::RenderViewHost* render_view_host) override;
|
void RenderViewCreated(content::RenderViewHost* render_view_host) override;
|
||||||
void BeforeUnloadDialogCancelled() override;
|
void BeforeUnloadDialogCancelled() override;
|
||||||
void TitleWasSet(content::NavigationEntry* entry, bool explicit_set) override;
|
void TitleWasSet(content::NavigationEntry* entry, bool explicit_set) override;
|
||||||
|
|
|
@ -120,7 +120,7 @@ class NativeWindowViews : public NativeWindow,
|
||||||
bool ExecuteWindowsCommand(int command_id) override;
|
bool ExecuteWindowsCommand(int command_id) override;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// brightray::InspectableWebContentsDelegate:
|
// brightray::InspectableWebContentsViewDelegate:
|
||||||
gfx::ImageSkia GetDevToolsWindowIcon() override;
|
gfx::ImageSkia GetDevToolsWindowIcon() override;
|
||||||
#if defined(USE_X11)
|
#if defined(USE_X11)
|
||||||
void GetDevToolsWindowWMClass(
|
void GetDevToolsWindowWMClass(
|
||||||
|
|
2
vendor/brightray
vendored
2
vendor/brightray
vendored
|
@ -1 +1 @@
|
||||||
Subproject commit 20871355cb590e009d7ee394a7d9da0e4666ea0b
|
Subproject commit b05e019d2f66023fad1ae2f16cc765e3d62ffd5e
|
Loading…
Add table
Add a link
Reference in a new issue