summaryrefslogtreecommitdiffstats
path: root/components/html_viewer/html_document_oopif.cc
diff options
context:
space:
mode:
authoryzshen <yzshen@chromium.org>2015-08-21 19:41:13 -0700
committerCommit bot <commit-bot@chromium.org>2015-08-22 02:41:48 +0000
commit020dd26e26903bf63564601cbf31670f7cda6854 (patch)
treedc7509aa4b4dea7e1b428dc585091123edfdeb1d /components/html_viewer/html_document_oopif.cc
parent10032d2ee6783d9848bb04bafa245ec63916d039 (diff)
downloadchromium_src-020dd26e26903bf63564601cbf31670f7cda6854.zip
chromium_src-020dd26e26903bf63564601cbf31670f7cda6854.tar.gz
chromium_src-020dd26e26903bf63564601cbf31670f7cda6854.tar.bz2
Mandoline: Introduce a tab-level DevTools agent and persist state across navigations.
The tab-level agent (i.e., FrameDevToolsAgent) relays messages between the DevTools service and the DevTools agent of the frame that it attaches to. It persists state across frame navigations and also intercepts "Page.navigate" requests. BUG=517266 Review URL: https://codereview.chromium.org/1288653004 Cr-Commit-Position: refs/heads/master@{#344956}
Diffstat (limited to 'components/html_viewer/html_document_oopif.cc')
-rw-r--r--components/html_viewer/html_document_oopif.cc38
1 files changed, 21 insertions, 17 deletions
diff --git a/components/html_viewer/html_document_oopif.cc b/components/html_viewer/html_document_oopif.cc
index 7538add..d8f00ef 100644
--- a/components/html_viewer/html_document_oopif.cc
+++ b/components/html_viewer/html_document_oopif.cc
@@ -10,7 +10,6 @@
#include "base/stl_util.h"
#include "base/strings/string_util.h"
#include "base/thread_task_runner_handle.h"
-#include "components/devtools_service/public/cpp/switches.h"
#include "components/html_viewer/blink_url_request_type_converters.h"
#include "components/html_viewer/devtools_agent_impl.h"
#include "components/html_viewer/document_resource_waiter.h"
@@ -44,11 +43,6 @@ bool IsTestInterfaceEnabled() {
kEnableTestInterface);
}
-bool EnableRemoteDebugging() {
- return base::CommandLine::ForCurrentProcess()->HasSwitch(
- devtools_service::kRemoteDebuggingPort);
-}
-
} // namespace
HTMLDocumentOOPIF::BeforeLoadCache::BeforeLoadCache() {
@@ -83,6 +77,9 @@ HTMLDocumentOOPIF::HTMLDocumentOOPIF(
static_cast<mojo::InterfaceFactory<mandoline::FrameTreeClient>*>(this));
connection->AddService(static_cast<InterfaceFactory<AxProvider>*>(this));
connection->AddService(&view_manager_client_factory_);
+ connection->AddService(
+ static_cast<mojo::InterfaceFactory<devtools_service::DevToolsAgent>*>(
+ this));
if (IsTestInterfaceEnabled()) {
connection->AddService(
static_cast<mojo::InterfaceFactory<TestHTMLViewer>*>(this));
@@ -138,13 +135,13 @@ void HTMLDocumentOOPIF::Load() {
frame_ = HTMLFrameTreeManager::CreateFrameAndAttachToTree(
global_state_, view, resource_waiter_.Pass(), this);
- // TODO(yzshen): http://crbug.com/498986 Creating DevToolsAgentImpl instances
- // causes html_viewer_apptests flakiness currently. Before we fix that we
- // cannot enable remote debugging (which is required by Telemetry tests) on
- // the bots.
- if (EnableRemoteDebugging() && !frame_->parent()) {
- devtools_agent_.reset(new DevToolsAgentImpl(
- frame_->web_frame()->toWebLocalFrame(), html_document_app_->shell()));
+ if (devtools_agent_request_.is_pending()) {
+ if (frame_->devtools_agent()) {
+ frame_->devtools_agent()->BindToRequest(devtools_agent_request_.Pass());
+ } else {
+ devtools_agent_request_ =
+ mojo::InterfaceRequest<devtools_service::DevToolsAgent>();
+ }
}
const GURL url(extra_data->synthetic_response->url);
@@ -191,10 +188,6 @@ void HTMLDocumentOOPIF::OnViewDestroyed(View* view) {
resource_waiter_->set_root(nullptr);
}
-bool HTMLDocumentOOPIF::ShouldNavigateLocallyInMainFrame() {
- return devtools_agent_ && devtools_agent_->handling_page_navigate_request();
-}
-
void HTMLDocumentOOPIF::OnFrameDidFinishLoad() {
did_finish_local_frame_load_ = true;
scoped_ptr<BeforeLoadCache> before_load_cache = before_load_cache_.Pass();
@@ -263,4 +256,15 @@ void HTMLDocumentOOPIF::Create(
resource_waiter_->Bind(request.Pass());
}
+void HTMLDocumentOOPIF::Create(
+ mojo::ApplicationConnection* connection,
+ mojo::InterfaceRequest<devtools_service::DevToolsAgent> request) {
+ if (frame_) {
+ if (frame_->devtools_agent())
+ frame_->devtools_agent()->BindToRequest(request.Pass());
+ } else {
+ devtools_agent_request_ = request.Pass();
+ }
+}
+
} // namespace html_viewer