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

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

Issue 275783002: Fix an ExtensionPopup crash on browser window close. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix build. Created 6 years, 7 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 "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "chrome/browser/chrome_notification_types.h" 9 #include "chrome/browser/chrome_notification_types.h"
10 #include "chrome/browser/devtools/devtools_window.h" 10 #include "chrome/browser/devtools/devtools_window.h"
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 sz.set_height(std::max(kMinHeight, std::min(kMaxHeight, sz.height()))); 151 sz.set_height(std::max(kMinHeight, std::min(kMaxHeight, sz.height())));
152 return sz; 152 return sz;
153 } 153 }
154 154
155 void ExtensionPopup::OnWidgetDestroying(views::Widget* widget) { 155 void ExtensionPopup::OnWidgetDestroying(views::Widget* widget) {
156 BubbleDelegateView::OnWidgetDestroying(widget); 156 BubbleDelegateView::OnWidgetDestroying(widget);
157 #if defined(USE_AURA) 157 #if defined(USE_AURA)
158 aura::Window* bubble_window = GetWidget()->GetNativeWindow(); 158 aura::Window* bubble_window = GetWidget()->GetNativeWindow();
159 aura::client::ActivationClient* activation_client = 159 aura::client::ActivationClient* activation_client =
160 aura::client::GetActivationClient(bubble_window->GetRootWindow()); 160 aura::client::GetActivationClient(bubble_window->GetRootWindow());
161 activation_client->RemoveObserver(this); 161 // If the popup was being inspected with devtools and the browser window was
162 // closed, then the root window and activation client are already destroyed.
163 if (activation_client)
164 activation_client->RemoveObserver(this);
162 #endif 165 #endif
163 } 166 }
164 167
165 void ExtensionPopup::OnWidgetActivationChanged(views::Widget* widget, 168 void ExtensionPopup::OnWidgetActivationChanged(views::Widget* widget,
166 bool active) { 169 bool active) {
167 // Dismiss only if the window being activated is not owned by this popup's 170 // Dismiss only if the window being activated is not owned by this popup's
168 // window. In particular, don't dismiss when we lose activation to a child 171 // window. In particular, don't dismiss when we lose activation to a child
169 // dialog box. Possibly relevant: http://crbug.com/106723 and 172 // dialog box. Possibly relevant: http://crbug.com/106723 and
170 // http://crbug.com/179786 173 // http://crbug.com/179786
171 views::Widget* this_widget = GetWidget(); 174 views::Widget* this_widget = GetWidget();
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 GetWidget()->Show(); 251 GetWidget()->Show();
249 252
250 // Focus on the host contents when the bubble is first shown. 253 // Focus on the host contents when the bubble is first shown.
251 host()->host_contents()->Focus(); 254 host()->host_contents()->Focus();
252 255
253 if (inspect_with_devtools_) { 256 if (inspect_with_devtools_) {
254 DevToolsWindow::OpenDevToolsWindow(host()->render_view_host(), 257 DevToolsWindow::OpenDevToolsWindow(host()->render_view_host(),
255 DevToolsToggleAction::ShowConsole()); 258 DevToolsToggleAction::ShowConsole());
256 } 259 }
257 } 260 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698