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

Unified Diff: components/html_viewer/devtools_agent_impl.cc

Issue 1677293002: Bye bye Mandoline (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: moar Created 4 years, 10 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/devtools_agent_impl.h ('k') | components/html_viewer/discardable_memory_allocator.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/html_viewer/devtools_agent_impl.cc
diff --git a/components/html_viewer/devtools_agent_impl.cc b/components/html_viewer/devtools_agent_impl.cc
deleted file mode 100644
index 2cf2e8942db94b7cb7294ba7f84f5151be91171b..0000000000000000000000000000000000000000
--- a/components/html_viewer/devtools_agent_impl.cc
+++ /dev/null
@@ -1,93 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "components/html_viewer/devtools_agent_impl.h"
-
-#include <utility>
-
-#include "base/bind.h"
-#include "base/logging.h"
-#include "third_party/WebKit/public/platform/WebString.h"
-#include "third_party/WebKit/public/web/WebDevToolsAgent.h"
-#include "third_party/WebKit/public/web/WebLocalFrame.h"
-
-namespace html_viewer {
-
-DevToolsAgentImpl::DevToolsAgentImpl(blink::WebLocalFrame* frame,
- const std::string& id,
- const std::string* state)
- : frame_(frame), id_(id), binding_(this), cache_until_client_ready_(false) {
- DCHECK(frame);
- frame_->setDevToolsAgentClient(this);
-
- if (state) {
- cache_until_client_ready_ = true;
- frame_->devToolsAgent()->reattach(blink::WebString::fromUTF8(id_), 0,
- blink::WebString::fromUTF8(*state));
- }
-}
-
-DevToolsAgentImpl::~DevToolsAgentImpl() {
- if (cache_until_client_ready_ || client_)
- frame_->devToolsAgent()->detach();
-}
-
-void DevToolsAgentImpl::BindToRequest(
- mojo::InterfaceRequest<DevToolsAgent> request) {
- binding_.Bind(std::move(request));
-}
-
-void DevToolsAgentImpl::SetClient(
- devtools_service::DevToolsAgentClientPtr client) {
- if (client_)
- frame_->devToolsAgent()->detach();
-
- client_ = std::move(client);
- client_.set_connection_error_handler(base::Bind(
- &DevToolsAgentImpl::OnConnectionError, base::Unretained(this)));
-
- if (cache_until_client_ready_) {
- cache_until_client_ready_ = false;
- for (const auto& message : cached_client_messages_)
- client_->DispatchProtocolMessage(message.call_id, message.response,
- message.state);
- cached_client_messages_.clear();
- } else {
- frame_->devToolsAgent()->attach(blink::WebString::fromUTF8(id_), 0);
- }
-}
-
-void DevToolsAgentImpl::DispatchProtocolMessage(const mojo::String& message) {
- frame_->devToolsAgent()->dispatchOnInspectorBackend(
- 0, blink::WebString::fromUTF8(message));
-}
-
-void DevToolsAgentImpl::sendProtocolMessage(int session_id,
- int call_id,
- const blink::WebString& response,
- const blink::WebString& state) {
- DCHECK(!response.isNull());
-
- mojo::String response_str = response.utf8();
- mojo::String state_str;
- if (!state.isNull())
- state_str = state.utf8();
-
- if (client_) {
- client_->DispatchProtocolMessage(call_id, response_str, state_str);
- } else if (cache_until_client_ready_) {
- cached_client_messages_.resize(cached_client_messages_.size() + 1);
- CachedClientMessage& message = cached_client_messages_.back();
- message.call_id = call_id;
- message.response.Swap(&response_str);
- message.state.Swap(&state_str);
- }
-}
-
-void DevToolsAgentImpl::OnConnectionError() {
- client_.reset();
- frame_->devToolsAgent()->detach();
-}
-
-} // namespace html_viewer
« no previous file with comments | « components/html_viewer/devtools_agent_impl.h ('k') | components/html_viewer/discardable_memory_allocator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698