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

Side by Side Diff: chrome/browser/ui/views/extensions/extension_popup.cc

Issue 442303002: DevTools: migrate DevTools APIs to use WebContents instead of RenderViewHost. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Review comments addressed. Created 6 years, 4 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/views/extensions/extension_popup.h" 5 #include "chrome/browser/ui/views/extensions/extension_popup.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "chrome/browser/chrome_notification_types.h" 8 #include "chrome/browser/chrome_notification_types.h"
9 #include "chrome/browser/devtools/devtools_window.h" 9 #include "chrome/browser/devtools/devtools_window.h"
10 #include "chrome/browser/extensions/extension_view_host.h" 10 #include "chrome/browser/extensions/extension_view_host.h"
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 break; 100 break;
101 default: 101 default:
102 NOTREACHED() << L"Received unexpected notification"; 102 NOTREACHED() << L"Received unexpected notification";
103 } 103 }
104 } 104 }
105 105
106 void ExtensionPopup::OnDevToolsStateChanged( 106 void ExtensionPopup::OnDevToolsStateChanged(
107 content::DevToolsAgentHost* agent_host, 107 content::DevToolsAgentHost* agent_host,
108 bool attached) { 108 bool attached) {
109 // First check that the devtools are being opened on this popup. 109 // First check that the devtools are being opened on this popup.
110 if (host()->render_view_host() != agent_host->GetRenderViewHost()) 110 if (host()->host_contents() != agent_host->GetWebContents())
111 return; 111 return;
112 112
113 if (attached) { 113 if (attached) {
114 // Set inspect_with_devtools_ so the popup will be kept open while 114 // Set inspect_with_devtools_ so the popup will be kept open while
115 // the devtools are open. 115 // the devtools are open.
116 inspect_with_devtools_ = true; 116 inspect_with_devtools_ = true;
117 } else { 117 } else {
118 // Widget::Close posts a task, which should give the devtools window a 118 // Widget::Close posts a task, which should give the devtools window a
119 // chance to finish detaching from the inspected RenderViewHost. 119 // chance to finish detaching from the inspected RenderViewHost.
120 GetWidget()->Close(); 120 GetWidget()->Close();
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 return popup; 218 return popup;
219 } 219 }
220 220
221 void ExtensionPopup::ShowBubble() { 221 void ExtensionPopup::ShowBubble() {
222 GetWidget()->Show(); 222 GetWidget()->Show();
223 223
224 // Focus on the host contents when the bubble is first shown. 224 // Focus on the host contents when the bubble is first shown.
225 host()->host_contents()->Focus(); 225 host()->host_contents()->Focus();
226 226
227 if (inspect_with_devtools_) { 227 if (inspect_with_devtools_) {
228 DevToolsWindow::OpenDevToolsWindow(host()->render_view_host(), 228 DevToolsWindow::OpenDevToolsWindow(host()->host_contents(),
229 DevToolsToggleAction::ShowConsole()); 229 DevToolsToggleAction::ShowConsole());
230 } 230 }
231 } 231 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698