| 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 |
| 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. This is safe to do since |popup_| is deleted via a posted task. |
| 299 DCHECK(!popup_on_stack->HasObserver(this)); |
| 300 } |
| 301 |
| 285 void ExclusiveAccessBubbleViews::OnWidgetVisibilityChanged( | 302 void ExclusiveAccessBubbleViews::OnWidgetVisibilityChanged( |
| 286 views::Widget* widget, | 303 views::Widget* widget, |
| 287 bool visible) { | 304 bool visible) { |
| 288 UpdateMouseWatcher(); | 305 UpdateMouseWatcher(); |
| 289 } | 306 } |
| 290 | 307 |
| 291 void ExclusiveAccessBubbleViews::LinkClicked(views::Link* link, | 308 void ExclusiveAccessBubbleViews::LinkClicked(views::Link* link, |
| 292 int event_flags) { | 309 int event_flags) { |
| 293 ExitExclusiveAccess(); | 310 ExitExclusiveAccess(); |
| 294 } | 311 } |
| OLD | NEW |