OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/views/extensions/extension_popup.h" | 5 #include "chrome/browser/views/extensions/extension_popup.h" |
6 | 6 |
7 #include "chrome/browser/browser.h" | 7 #include "chrome/browser/browser.h" |
8 #include "chrome/browser/browser_list.h" | 8 #include "chrome/browser/browser_list.h" |
9 #include "chrome/browser/browser_window.h" | 9 #include "chrome/browser/browser_window.h" |
10 #include "chrome/browser/debugger/devtools_manager.h" | 10 #include "chrome/browser/debugger/devtools_manager.h" |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 break; | 251 break; |
252 case NotificationType::EXTENSION_HOST_VIEW_SHOULD_CLOSE: | 252 case NotificationType::EXTENSION_HOST_VIEW_SHOULD_CLOSE: |
253 // If we aren't the host of the popup, then disregard the notification. | 253 // If we aren't the host of the popup, then disregard the notification. |
254 if (Details<ExtensionHost>(host()) != details) | 254 if (Details<ExtensionHost>(host()) != details) |
255 return; | 255 return; |
256 Close(); | 256 Close(); |
257 | 257 |
258 break; | 258 break; |
259 case NotificationType::DEVTOOLS_WINDOW_CLOSING: | 259 case NotificationType::DEVTOOLS_WINDOW_CLOSING: |
260 // Make sure its the devtools window that inspecting our popup. | 260 // Make sure its the devtools window that inspecting our popup. |
261 if (Details<RenderViewHost>(extension_host_->render_view_host()) != detail
s) | 261 if (Details<RenderViewHost>(extension_host_->render_view_host()) != |
| 262 details) |
262 return; | 263 return; |
263 | 264 |
264 // If the devtools window is closing, we post a task to ourselves to | 265 // If the devtools window is closing, we post a task to ourselves to |
265 // close the popup. This gives the devtools window a chance to finish | 266 // close the popup. This gives the devtools window a chance to finish |
266 // detaching from the inspected RenderViewHost. | 267 // detaching from the inspected RenderViewHost. |
267 MessageLoop::current()->PostTask(FROM_HERE, NewRunnableMethod(this, | 268 MessageLoop::current()->PostTask(FROM_HERE, NewRunnableMethod(this, |
268 &ExtensionPopup::Close)); | 269 &ExtensionPopup::Close)); |
269 | 270 |
270 break; | 271 break; |
271 default: | 272 default: |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
364 | 365 |
365 void ExtensionPopup::Close() { | 366 void ExtensionPopup::Close() { |
366 if (closing_) | 367 if (closing_) |
367 return; | 368 return; |
368 closing_ = true; | 369 closing_ = true; |
369 DetachFromBrowser(); | 370 DetachFromBrowser(); |
370 if (observer_) | 371 if (observer_) |
371 observer_->ExtensionPopupClosed(this); | 372 observer_->ExtensionPopupClosed(this); |
372 Release(); // Balanced in ctor. | 373 Release(); // Balanced in ctor. |
373 } | 374 } |
OLD | NEW |