Chromium Code Reviews| OLD | NEW |
|---|---|
| 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/exclusive_access_bubble_views.h" | 5 #include "chrome/browser/ui/views/exclusive_access_bubble_views.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/i18n/case_conversion.h" | 9 #include "base/i18n/case_conversion.h" |
| 10 #include "base/location.h" | 10 #include "base/location.h" |
| (...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 275 } | 275 } |
| 276 | 276 |
| 277 void ExclusiveAccessBubbleViews::Observe( | 277 void ExclusiveAccessBubbleViews::Observe( |
| 278 int type, | 278 int type, |
| 279 const content::NotificationSource& source, | 279 const content::NotificationSource& source, |
| 280 const content::NotificationDetails& details) { | 280 const content::NotificationDetails& details) { |
| 281 DCHECK_EQ(chrome::NOTIFICATION_FULLSCREEN_CHANGED, type); | 281 DCHECK_EQ(chrome::NOTIFICATION_FULLSCREEN_CHANGED, type); |
| 282 UpdateMouseWatcher(); | 282 UpdateMouseWatcher(); |
| 283 } | 283 } |
| 284 | 284 |
| 285 void ExclusiveAccessBubbleViews::OnWidgetDestroyed(views::Widget* widget) { | |
| 286 // Although SubtleNotificationView uses WIDGET_OWNS_NATIVE_WIDGET, a close can | |
|
msw
2017/05/03 18:48:33
Would using the default NATIVE_WIDGET_OWNS_WIDGET
tapted
2017/05/04 06:42:07
I think this added complexity would remain. That i
| |
| 287 // originate from the OS or some Chrome shutdown codepaths that bypass the | |
| 288 // destructor. | |
| 289 views::Widget* popup_on_stack = popup_; | |
| 290 DCHECK(popup_on_stack->HasObserver(this)); | |
| 291 | |
| 292 // Get ourselves destroyed. Calling ExitExclusiveAccess() won't work because | |
| 293 // the parent window might be destroyed as well, so asking it to exit | |
| 294 // fullscreen would be a bad idea. | |
| 295 bubble_view_context_->DestroyAnyExclusiveAccessBubble(); | |
| 296 | |
| 297 // Note: |this| is destroyed on the line above. Check that the destructor was | |
| 298 // invoked. Note this is safe to do since |popup_| is deleted via a posted | |
|
msw
2017/05/03 18:48:33
optional nit: remove "Note" to avoid an extra line
tapted
2017/05/04 06:42:07
Done.
| |
| 299 // task. | |
| 300 DCHECK(!popup_on_stack->HasObserver(this)); | |
| 301 } | |
| 302 | |
| 285 void ExclusiveAccessBubbleViews::OnWidgetVisibilityChanged( | 303 void ExclusiveAccessBubbleViews::OnWidgetVisibilityChanged( |
| 286 views::Widget* widget, | 304 views::Widget* widget, |
| 287 bool visible) { | 305 bool visible) { |
| 288 UpdateMouseWatcher(); | 306 UpdateMouseWatcher(); |
| 289 } | 307 } |
| 290 | 308 |
| 291 void ExclusiveAccessBubbleViews::LinkClicked(views::Link* link, | 309 void ExclusiveAccessBubbleViews::LinkClicked(views::Link* link, |
| 292 int event_flags) { | 310 int event_flags) { |
| 293 ExitExclusiveAccess(); | 311 ExitExclusiveAccess(); |
| 294 } | 312 } |
| OLD | NEW |