set dock state using devtools dockController
This commit is contained in:
parent
fca548b2fc
commit
968bc5c9a2
1 changed files with 8 additions and 7 deletions
|
@ -124,15 +124,11 @@ GURL GetRemoteBaseURL() {
|
||||||
content::GetWebKitRevision().c_str()));
|
content::GetWebKitRevision().c_str()));
|
||||||
}
|
}
|
||||||
|
|
||||||
GURL GetDevToolsURL(
|
GURL GetDevToolsURL(bool can_dock) {
|
||||||
bool can_dock,
|
|
||||||
const std::string& dock_state) {
|
|
||||||
auto url_string =
|
auto url_string =
|
||||||
base::StringPrintf(kChromeUIDevToolsURL,
|
base::StringPrintf(kChromeUIDevToolsURL,
|
||||||
GetRemoteBaseURL().spec().c_str(),
|
GetRemoteBaseURL().spec().c_str(),
|
||||||
can_dock ? "true" : "");
|
can_dock ? "true" : "");
|
||||||
if (!dock_state.empty())
|
|
||||||
url_string += "&settings={\"currentDockState\":\"\\\"" + dock_state + "\\\"\"}&";
|
|
||||||
return GURL(url_string);
|
return GURL(url_string);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -287,7 +283,7 @@ void InspectableWebContentsImpl::ShowDevTools() {
|
||||||
agent_host_->AttachClient(this);
|
agent_host_->AttachClient(this);
|
||||||
|
|
||||||
devtools_web_contents_->GetController().LoadURL(
|
devtools_web_contents_->GetController().LoadURL(
|
||||||
GetDevToolsURL(can_dock_, dock_state_),
|
GetDevToolsURL(can_dock_),
|
||||||
content::Referrer(),
|
content::Referrer(),
|
||||||
ui::PAGE_TRANSITION_AUTO_TOPLEVEL,
|
ui::PAGE_TRANSITION_AUTO_TOPLEVEL,
|
||||||
std::string());
|
std::string());
|
||||||
|
@ -381,8 +377,13 @@ void InspectableWebContentsImpl::LoadCompleted() {
|
||||||
view_->ShowDevTools();
|
view_->ShowDevTools();
|
||||||
|
|
||||||
// If the devtools can dock, "SetIsDocked" will be called by devtools itself.
|
// If the devtools can dock, "SetIsDocked" will be called by devtools itself.
|
||||||
if (!can_dock_)
|
if (!can_dock_) {
|
||||||
SetIsDocked(DispatchCallback(), false);
|
SetIsDocked(DispatchCallback(), false);
|
||||||
|
} else {
|
||||||
|
base::string16 javascript = base::UTF8ToUTF16(
|
||||||
|
"WebInspector.dockController.setDockSide(\"" + dock_state_ + "\");");
|
||||||
|
devtools_web_contents_->GetMainFrame()->ExecuteJavaScript(javascript);
|
||||||
|
}
|
||||||
|
|
||||||
if (view_->GetDelegate())
|
if (view_->GetDelegate())
|
||||||
view_->GetDelegate()->DevToolsOpened();
|
view_->GetDelegate()->DevToolsOpened();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue