9ad77c4a38
DevToolsWindow represents a vanilla top-level window that shows the dev tools. It uses ui::WindowImpl to implement window functionality, which requires a newer libchromiumcontent which contains the necessary headers for using that class, and requires some modifications to brightray.gypi to make WTL's headers available. * vendor/libchromiumcontent 2f53a96...fc02d93 (4): > Export third_party/wtl/include headers > Export test_support_base.pdb and test_support_content.pdb > Fix linker errors with test_support_base on Windows > Fix linker errors with base_prefs_test_support on Windows
47 lines
1.4 KiB
C++
47 lines
1.4 KiB
C++
#include "browser/win/devtools_window.h"
|
|
|
|
#include "browser/inspectable_web_contents_impl.h"
|
|
#include "browser/win/inspectable_web_contents_view_win.h"
|
|
|
|
#include "content/public/browser/web_contents_view.h"
|
|
#include "ui/base/win/hidden_window.h"
|
|
|
|
namespace brightray {
|
|
|
|
DevToolsWindow* DevToolsWindow::Create(InspectableWebContentsViewWin* controller) {
|
|
return new DevToolsWindow(controller);
|
|
}
|
|
|
|
DevToolsWindow::DevToolsWindow(InspectableWebContentsViewWin* controller)
|
|
: controller_(controller) {
|
|
}
|
|
|
|
DevToolsWindow::~DevToolsWindow() {
|
|
}
|
|
|
|
LRESULT DevToolsWindow::OnCreate(UINT, WPARAM, LPARAM, BOOL&) {
|
|
SetParent(controller_->inspectable_web_contents()->devtools_web_contents()->GetView()->GetNativeView(), hwnd());
|
|
SetWindowText(hwnd(), L"Developer Tools");
|
|
return 0;
|
|
}
|
|
|
|
LRESULT DevToolsWindow::OnDestroy(UINT, WPARAM, LPARAM, BOOL&) {
|
|
SetParent(controller_->inspectable_web_contents()->devtools_web_contents()->GetView()->GetNativeView(), ui::GetHiddenWindow());
|
|
delete this;
|
|
return 0;
|
|
}
|
|
|
|
LRESULT DevToolsWindow::OnSize(UINT, WPARAM, LPARAM, BOOL&) {
|
|
RECT rect;
|
|
GetClientRect(hwnd(), &rect);
|
|
|
|
SetWindowPos(controller_->inspectable_web_contents()->devtools_web_contents()->GetView()->GetNativeView(),
|
|
nullptr,
|
|
rect.left, rect.top,
|
|
rect.right - rect.left, rect.bottom - rect.top,
|
|
SWP_NOZORDER | SWP_SHOWWINDOW);
|
|
|
|
return 0;
|
|
}
|
|
|
|
}
|