| 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/location.h" |
| 9 #include "base/macros.h" | 10 #include "base/macros.h" |
| 10 #include "base/message_loop/message_loop.h" | 11 #include "base/single_thread_task_runner.h" |
| 11 #include "base/strings/utf_string_conversions.h" | 12 #include "base/strings/utf_string_conversions.h" |
| 13 #include "base/threading/thread_task_runner_handle.h" |
| 12 #include "build/build_config.h" | 14 #include "build/build_config.h" |
| 13 #include "chrome/app/chrome_command_ids.h" | 15 #include "chrome/app/chrome_command_ids.h" |
| 14 #include "chrome/browser/chrome_notification_types.h" | 16 #include "chrome/browser/chrome_notification_types.h" |
| 15 #include "chrome/browser/ui/exclusive_access/exclusive_access_manager.h" | 17 #include "chrome/browser/ui/exclusive_access/exclusive_access_manager.h" |
| 16 #include "chrome/browser/ui/exclusive_access/fullscreen_controller.h" | 18 #include "chrome/browser/ui/exclusive_access/fullscreen_controller.h" |
| 17 #include "chrome/browser/ui/views/exclusive_access_bubble_views_context.h" | 19 #include "chrome/browser/ui/views/exclusive_access_bubble_views_context.h" |
| 18 #include "chrome/browser/ui/views/frame/immersive_mode_controller.h" | 20 #include "chrome/browser/ui/views/frame/immersive_mode_controller.h" |
| 19 #include "chrome/browser/ui/views/frame/top_container_view.h" | 21 #include "chrome/browser/ui/views/frame/top_container_view.h" |
| 20 #include "chrome/browser/ui/views/subtle_notification_view.h" | 22 #include "chrome/browser/ui/views/subtle_notification_view.h" |
| 21 #include "chrome/grit/generated_resources.h" | 23 #include "chrome/grit/generated_resources.h" |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 // This is tricky. We may be in an ATL message handler stack, in which case | 93 // This is tricky. We may be in an ATL message handler stack, in which case |
| 92 // the popup cannot be deleted yet. We also can't set the popup's ownership | 94 // the popup cannot be deleted yet. We also can't set the popup's ownership |
| 93 // model to NATIVE_WIDGET_OWNS_WIDGET because if the user closed the last tab | 95 // model to NATIVE_WIDGET_OWNS_WIDGET because if the user closed the last tab |
| 94 // while in fullscreen mode, Windows has already destroyed the popup HWND by | 96 // while in fullscreen mode, Windows has already destroyed the popup HWND by |
| 95 // the time we get here, and thus either the popup will already have been | 97 // the time we get here, and thus either the popup will already have been |
| 96 // deleted (if we set this in our constructor) or the popup will never get | 98 // deleted (if we set this in our constructor) or the popup will never get |
| 97 // another OnFinalMessage() call (if not, as currently). So instead, we tell | 99 // another OnFinalMessage() call (if not, as currently). So instead, we tell |
| 98 // the popup to synchronously hide, and then asynchronously close and delete | 100 // the popup to synchronously hide, and then asynchronously close and delete |
| 99 // itself. | 101 // itself. |
| 100 popup_->Close(); | 102 popup_->Close(); |
| 101 base::MessageLoop::current()->DeleteSoon(FROM_HERE, popup_); | 103 base::ThreadTaskRunnerHandle::Get()->DeleteSoon(FROM_HERE, popup_); |
| 102 } | 104 } |
| 103 | 105 |
| 104 void ExclusiveAccessBubbleViews::UpdateContent( | 106 void ExclusiveAccessBubbleViews::UpdateContent( |
| 105 const GURL& url, | 107 const GURL& url, |
| 106 ExclusiveAccessBubbleType bubble_type) { | 108 ExclusiveAccessBubbleType bubble_type) { |
| 107 DCHECK_NE(EXCLUSIVE_ACCESS_BUBBLE_TYPE_NONE, bubble_type); | 109 DCHECK_NE(EXCLUSIVE_ACCESS_BUBBLE_TYPE_NONE, bubble_type); |
| 108 if (bubble_type_ == bubble_type && url_ == url) | 110 if (bubble_type_ == bubble_type && url_ == url) |
| 109 return; | 111 return; |
| 110 | 112 |
| 111 url_ = url; | 113 url_ = url; |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 276 void ExclusiveAccessBubbleViews::OnWidgetVisibilityChanged( | 278 void ExclusiveAccessBubbleViews::OnWidgetVisibilityChanged( |
| 277 views::Widget* widget, | 279 views::Widget* widget, |
| 278 bool visible) { | 280 bool visible) { |
| 279 UpdateMouseWatcher(); | 281 UpdateMouseWatcher(); |
| 280 } | 282 } |
| 281 | 283 |
| 282 void ExclusiveAccessBubbleViews::LinkClicked(views::Link* link, | 284 void ExclusiveAccessBubbleViews::LinkClicked(views::Link* link, |
| 283 int event_flags) { | 285 int event_flags) { |
| 284 ExitExclusiveAccess(); | 286 ExitExclusiveAccess(); |
| 285 } | 287 } |
| OLD | NEW |