Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(468)

Unified Diff: components/html_viewer/html_document.cc

Issue 1163953002: html_viewer: Add DevToolsAgentImpl. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Don't create DevToolsAgentImpl instance unless --remote-debugging-port is specified Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/html_viewer/html_document.h ('k') | mandoline/app/android/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/html_viewer/html_document.cc
diff --git a/components/html_viewer/html_document.cc b/components/html_viewer/html_document.cc
index d7f287c45b8f009513fee39f4a1860eb5c124754..0b30e4a67721937d521e323cdc07d845e4b54ce7 100644
--- a/components/html_viewer/html_document.cc
+++ b/components/html_viewer/html_document.cc
@@ -12,8 +12,10 @@
#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_input_events_type_converters.h"
#include "components/html_viewer/blink_url_request_type_converters.h"
+#include "components/html_viewer/devtools_agent_impl.h"
#include "components/html_viewer/media_factory.h"
#include "components/html_viewer/setup.h"
#include "components/html_viewer/web_layer_tree_view_impl.h"
@@ -67,6 +69,11 @@ bool EnableOOPIFs() {
return base::CommandLine::ForCurrentProcess()->HasSwitch(kOOPIF);
}
+bool EnableRemoteDebugging() {
+ return base::CommandLine::ForCurrentProcess()->HasSwitch(
+ devtools_service::kRemoteDebuggingPort);
+}
+
// WebRemoteFrameClient implementation used for OOPIFs.
// TODO(sky): this needs to talk to browser by way of an interface.
class RemoteFrameClientImpl : public blink::WebRemoteFrameClient {
@@ -214,8 +221,19 @@ void HTMLDocument::Load(URLResponsePtr response) {
touch_handler_.reset(new TouchHandler(web_view_));
web_layer_tree_view_impl_->set_widget(web_view_);
ConfigureSettings(web_view_->settings());
- web_view_->setMainFrame(
- blink::WebLocalFrame::create(blink::WebTreeScopeType::Document, this));
+
+ blink::WebLocalFrame* main_frame =
+ blink::WebLocalFrame::create(blink::WebTreeScopeType::Document, this);
+ web_view_->setMainFrame(main_frame);
+
+ // 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()) {
+ devtools_agent_.reset(
+ new DevToolsAgentImpl(main_frame, html_document_app_->shell()));
+ }
GURL url(response->url);
@@ -329,6 +347,9 @@ void HTMLDocument::frameDetached(blink::WebFrame* frame) {
if (frame->parent())
frame->parent()->removeChild(frame);
+ if (devtools_agent_ && frame == devtools_agent_->frame())
+ devtools_agent_.reset();
+
// |frame| is invalid after here.
frame->close();
}
« no previous file with comments | « components/html_viewer/html_document.h ('k') | mandoline/app/android/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698