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

Unified Diff: chrome/browser/ui/views/extensions/extension_popup.cc

Issue 2419943002: [DevTools] Migrate from AgentStateCallbacks to DevToolsAgentHostObserver. (Closed)
Patch Set: mac Created 4 years, 2 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/ui/views/extensions/extension_popup.cc
diff --git a/chrome/browser/ui/views/extensions/extension_popup.cc b/chrome/browser/ui/views/extensions/extension_popup.cc
index 474b270aef8dc5b1d95ec56a3f6317a899c7e1bc..faf2c7c4de248b1eddfe2452d683849fa5fce7d9 100644
--- a/chrome/browser/ui/views/extensions/extension_popup.cc
+++ b/chrome/browser/ui/views/extensions/extension_popup.cc
@@ -59,8 +59,6 @@ ExtensionPopup::ExtensionPopup(extensions::ExtensionViewHost* host,
ShowAction show_action)
: BubbleDialogDelegateView(anchor_view, arrow),
host_(host),
- devtools_callback_(base::Bind(
- &ExtensionPopup::OnDevToolsStateChanged, base::Unretained(this))),
widget_initialized_(false) {
inspect_with_devtools_ = show_action == SHOW_AND_INSPECT;
set_margins(gfx::Insets(kBubbleMargin));
@@ -75,7 +73,7 @@ ExtensionPopup::ExtensionPopup(extensions::ExtensionViewHost* host,
this,
extensions::NOTIFICATION_EXTENSION_HOST_VIEW_SHOULD_CLOSE,
content::Source<content::BrowserContext>(host->browser_context()));
- content::DevToolsAgentHost::AddAgentStateCallback(devtools_callback_);
+ content::DevToolsAgentHost::AddObserver(this);
GetExtensionView(host)->GetBrowser()->tab_strip_model()->AddObserver(this);
@@ -93,7 +91,7 @@ ExtensionPopup::ExtensionPopup(extensions::ExtensionViewHost* host,
}
ExtensionPopup::~ExtensionPopup() {
- content::DevToolsAgentHost::RemoveAgentStateCallback(devtools_callback_);
+ content::DevToolsAgentHost::RemoveObserver(this);
GetExtensionView(
host_.get())->GetBrowser()->tab_strip_model()->RemoveObserver(this);
@@ -123,22 +121,23 @@ void ExtensionPopup::Observe(int type,
}
}
-void ExtensionPopup::OnDevToolsStateChanged(
- content::DevToolsAgentHost* agent_host,
- bool attached) {
+void ExtensionPopup::DevToolsAgentHostAttached(
+ content::DevToolsAgentHost* agent_host) {
// First check that the devtools are being opened on this popup.
if (host()->host_contents() != agent_host->GetWebContents())
return;
+ // Set inspect_with_devtools_ so the popup will be kept open while
+ // the devtools are open.
+ inspect_with_devtools_ = true;
+}
- if (attached) {
- // Set inspect_with_devtools_ so the popup will be kept open while
- // the devtools are open.
- inspect_with_devtools_ = true;
- } else {
- // Widget::Close posts a task, which should give the devtools window a
- // chance to finish detaching from the inspected RenderViewHost.
- GetWidget()->Close();
- }
+void ExtensionPopup::DevToolsAgentHostDetached(
+ content::DevToolsAgentHost* agent_host) {
+ if (host()->host_contents() != agent_host->GetWebContents())
+ return;
+ // Widget::Close posts a task, which should give the devtools window a
+ // chance to finish detaching from the inspected RenderViewHost.
+ GetWidget()->Close();
}
void ExtensionPopup::OnExtensionSizeChanged(ExtensionViewViews* view) {
« no previous file with comments | « chrome/browser/ui/views/extensions/extension_popup.h ('k') | content/browser/devtools/devtools_agent_host_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698