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

Unified Diff: chrome/browser/devtools/devtools_ui_bindings.cc

Issue 427143003: [DevTools] Move DevToolsClientHost functionality out of DevToolsFrontendHost. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 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
Index: chrome/browser/devtools/devtools_ui_bindings.cc
diff --git a/chrome/browser/devtools/devtools_ui_bindings.cc b/chrome/browser/devtools/devtools_ui_bindings.cc
index 5148556e4d410fc110b896544ca6d87db022ac15..f564461500bd7ade474a8a7bc531f6d201a6d372 100644
--- a/chrome/browser/devtools/devtools_ui_bindings.cc
+++ b/chrome/browser/devtools/devtools_ui_bindings.cc
@@ -259,6 +259,16 @@ void DevToolsUIBindings::FrontendWebContentsObserver::WebContentsDestroyed() {
void DevToolsUIBindings::FrontendWebContentsObserver::RenderProcessGone(
base::TerminationStatus status) {
+ switch (status) {
+ case base::TERMINATION_STATUS_ABNORMAL_TERMINATION:
+ case base::TERMINATION_STATUS_PROCESS_WAS_KILLED:
+ case base::TERMINATION_STATUS_PROCESS_CRASHED:
+ content::DevToolsManager::GetInstance()->ClientHostClosing(
+ devtools_bindings_);
+ break;
+ default:
+ break;
+ }
devtools_bindings_->delegate_->RenderProcessGone();
}
@@ -266,9 +276,7 @@ void DevToolsUIBindings::FrontendWebContentsObserver::AboutToNavigateRenderView(
content::RenderViewHost* render_view_host) {
content::NavigationEntry* entry =
web_contents()->GetController().GetActiveEntry();
- if (devtools_bindings_->url_ == entry->GetURL())
- content::DevToolsClientHost::SetupDevToolsFrontendClient(render_view_host);
- else
+ if (devtools_bindings_->url_ != entry->GetURL())
delete devtools_bindings_;
}
@@ -311,7 +319,7 @@ DevToolsUIBindings::DevToolsUIBindings(content::WebContents* web_contents,
frontend_contents_observer_.reset(new FrontendWebContentsObserver(this));
web_contents_->GetMutableRendererPrefs()->can_accept_load_drops = false;
- frontend_host_.reset(content::DevToolsClientHost::CreateDevToolsFrontendHost(
+ frontend_host_.reset(content::DevToolsFrontendHost::Create(
web_contents_, this));
file_helper_.reset(new DevToolsFileHelper(web_contents_, profile_));
file_system_indexer_ = new DevToolsFileSystemIndexer();
@@ -339,8 +347,7 @@ DevToolsUIBindings::DevToolsUIBindings(content::WebContents* web_contents,
}
DevToolsUIBindings::~DevToolsUIBindings() {
- content::DevToolsManager::GetInstance()->ClientHostClosing(
- frontend_host_.get());
+ content::DevToolsManager::GetInstance()->ClientHostClosing(this);
for (IndexingJobsMap::const_iterator jobs_it(indexing_jobs_.begin());
jobs_it != indexing_jobs_.end(); ++jobs_it) {
@@ -351,10 +358,7 @@ DevToolsUIBindings::~DevToolsUIBindings() {
SetDevicesUpdatesEnabled(false);
}
-void DevToolsUIBindings::InspectedContentsClosing() {
- delegate_->InspectedContentsClosing();
-}
-
+// content::NotificationObserver overrides ------------------------------------
void DevToolsUIBindings::Observe(int type,
const content::NotificationSource& source,
const content::NotificationDetails& details) {
@@ -362,7 +366,13 @@ void DevToolsUIBindings::Observe(int type,
UpdateTheme();
}
-void DevToolsUIBindings::DispatchOnEmbedder(const std::string& message) {
+// content::DevToolsFrontendHost::Delegate implementation ---------------------
+bool DevToolsUIBindings::ShouldSetupDevToolsFrontendForUrl(const GURL& url) {
+ return url.SchemeIs(content::kChromeDevToolsScheme);
pfeldman 2014/07/31 11:47:25 It seems like we can make this decision in content
+}
+
+void DevToolsUIBindings::HandleMessageFromDevToolsFrontend(
+ const std::string& message) {
std::string method;
base::ListValue empty_params;
base::ListValue* params = &empty_params;
@@ -391,6 +401,26 @@ void DevToolsUIBindings::DispatchOnEmbedder(const std::string& message) {
}
}
+void DevToolsUIBindings::HandleMessageFromDevToolsFrontendToBackend(
+ const std::string& message) {
+ content::DevToolsManager::GetInstance()->DispatchOnInspectorBackend(
+ this, message);
+}
+
+// content::DevToolsClientHost implementation ---------------------------------
+void DevToolsUIBindings::DispatchOnInspectorFrontend(
+ const std::string& message) {
+ frontend_host_->DispatchOnDevToolsFrontend(message);
pfeldman 2014/07/31 11:47:25 Can we use a CallClientFunction here?
dgozman 2014/07/31 13:05:31 There is a TODO for that. It requires some blink-s
+}
+
+void DevToolsUIBindings::InspectedContentsClosing() {
+ delegate_->InspectedContentsClosing();
+}
+
+void DevToolsUIBindings::ReplacedWithAnotherClient() {
+}
+
+// DevToolsEmbedderMessageDispatcher::Delegate implementation -----------------
void DevToolsUIBindings::ActivateWindow() {
delegate_->ActivateWindow();
}

Powered by Google App Engine
This is Rietveld 408576698