2013-06-04 18:31:37 +00:00
|
|
|
#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 {
|
|
|
|
|
2013-11-18 00:05:21 +00:00
|
|
|
DevToolsWindow* DevToolsWindow::Create(
|
|
|
|
InspectableWebContentsViewWin* controller) {
|
2013-06-04 18:31:37 +00:00
|
|
|
return new DevToolsWindow(controller);
|
|
|
|
}
|
|
|
|
|
|
|
|
DevToolsWindow::DevToolsWindow(InspectableWebContentsViewWin* controller)
|
|
|
|
: controller_(controller) {
|
|
|
|
}
|
|
|
|
|
|
|
|
DevToolsWindow::~DevToolsWindow() {
|
|
|
|
}
|
|
|
|
|
2014-06-27 17:40:33 +00:00
|
|
|
LRESULT DevToolsWindow::OnCreate(UINT, WPARAM, LPARAM) {
|
2013-11-18 00:05:21 +00:00
|
|
|
auto devtools_web_contents =
|
|
|
|
controller_->inspectable_web_contents()->devtools_web_contents();
|
|
|
|
SetParent(devtools_web_contents->GetView()->GetNativeView(), hwnd());
|
2013-06-04 18:31:37 +00:00
|
|
|
SetWindowText(hwnd(), L"Developer Tools");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2014-06-27 17:40:33 +00:00
|
|
|
LRESULT DevToolsWindow::OnDestroy(UINT, WPARAM, LPARAM) {
|
2013-11-18 00:05:21 +00:00
|
|
|
auto devtools_web_contents =
|
|
|
|
controller_->inspectable_web_contents()->devtools_web_contents();
|
|
|
|
SetParent(
|
|
|
|
devtools_web_contents->GetView()->GetNativeView(), ui::GetHiddenWindow());
|
2013-06-04 18:31:37 +00:00
|
|
|
delete this;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2014-06-27 17:40:33 +00:00
|
|
|
LRESULT DevToolsWindow::OnSize(UINT, WPARAM, LPARAM) {
|
2013-06-04 18:31:37 +00:00
|
|
|
RECT rect;
|
|
|
|
GetClientRect(hwnd(), &rect);
|
|
|
|
|
2013-11-18 00:05:21 +00:00
|
|
|
auto devtools_web_contents =
|
|
|
|
controller_->inspectable_web_contents()->devtools_web_contents();
|
|
|
|
SetWindowPos(devtools_web_contents->GetView()->GetNativeView(),
|
2013-06-04 18:31:37 +00:00
|
|
|
nullptr,
|
|
|
|
rect.left, rect.top,
|
|
|
|
rect.right - rect.left, rect.bottom - rect.top,
|
|
|
|
SWP_NOZORDER | SWP_SHOWWINDOW);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2013-11-17 23:20:17 +00:00
|
|
|
} // namespace brightray
|