mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
- Add developer tools support (issue #127).
- Send title change notifications generated after page content is done loading. - Restore windows and bring to the front in BrowserWebViewDelegate::show(). git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@168 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
@ -10,6 +10,8 @@
|
||||
#include "request_impl.h"
|
||||
#include "stream_impl.h"
|
||||
|
||||
#include "base/file_path.h"
|
||||
#include "base/path_service.h"
|
||||
#include "base/synchronization/waitable_event.h"
|
||||
#include "base/utf_string_conversions.h"
|
||||
#include "third_party/WebKit/WebKit/chromium/public/WebDocument.h"
|
||||
@ -232,6 +234,18 @@ void CefBrowserImpl::StopFinding(bool clearSelection)
|
||||
&CefBrowserImpl::UIT_StopFinding, clearSelection));
|
||||
}
|
||||
|
||||
void CefBrowserImpl::ShowDevTools()
|
||||
{
|
||||
CefThread::PostTask(CefThread::UI, FROM_HERE, NewRunnableMethod(this,
|
||||
&CefBrowserImpl::UIT_ShowDevTools));
|
||||
}
|
||||
|
||||
void CefBrowserImpl::CloseDevTools()
|
||||
{
|
||||
CefThread::PostTask(CefThread::UI, FROM_HERE, NewRunnableMethod(this,
|
||||
&CefBrowserImpl::UIT_CloseDevTools));
|
||||
}
|
||||
|
||||
CefRefPtr<CefFrame> CefBrowserImpl::GetCefFrame(WebFrame* frame)
|
||||
{
|
||||
CefRefPtr<CefFrame> cef_frame;
|
||||
@ -573,6 +587,12 @@ void CefBrowserImpl::UIT_DestroyBrowser()
|
||||
}
|
||||
GetWebViewDelegate()->RevokeDragDrop();
|
||||
|
||||
if (dev_tools_agent_.get()) {
|
||||
BrowserDevToolsClient* client = dev_tools_agent_->client();
|
||||
if (client)
|
||||
client->browser()->UIT_DestroyBrowser();
|
||||
}
|
||||
|
||||
// Clean up anything associated with the WebViewHost widget.
|
||||
GetWebViewHost()->webwidget()->close();
|
||||
webviewhost_.reset();
|
||||
@ -1171,6 +1191,38 @@ void CefBrowserImpl::UIT_SetZoomLevel(CefFrame* frame, double zoomLevel)
|
||||
frame->Release();
|
||||
}
|
||||
|
||||
void CefBrowserImpl::UIT_ShowDevTools()
|
||||
{
|
||||
REQUIRE_UIT();
|
||||
|
||||
if(!dev_tools_agent_.get())
|
||||
return;
|
||||
|
||||
BrowserDevToolsClient* client = dev_tools_agent_->client();
|
||||
if (!client) {
|
||||
// Create the inspector window.
|
||||
FilePath dir_exe;
|
||||
PathService::Get(base::DIR_EXE, &dir_exe);
|
||||
FilePath devtools_path =
|
||||
dir_exe.AppendASCII("resources/inspector/devtools.html");
|
||||
|
||||
CefPopupFeatures features;
|
||||
CefRefPtr<CefBrowserImpl> browser =
|
||||
UIT_CreatePopupWindow(devtools_path.value(), features);
|
||||
browser->CreateDevToolsClient(dev_tools_agent_.get());
|
||||
browser->UIT_Show(WebKit::WebNavigationPolicyNewWindow);
|
||||
} else {
|
||||
// Give focus to the existing inspector window.
|
||||
client->browser()->UIT_Show(WebKit::WebNavigationPolicyNewWindow);
|
||||
}
|
||||
}
|
||||
|
||||
void CefBrowserImpl::CreateDevToolsClient(BrowserDevToolsAgent *agent)
|
||||
{
|
||||
dev_tools_client_.reset(new BrowserDevToolsClient(this, agent));
|
||||
}
|
||||
|
||||
|
||||
// CefFrameImpl
|
||||
|
||||
bool CefFrameImpl::IsFocused()
|
||||
|
Reference in New Issue
Block a user